/* ── Karta treningu: pasek górny, postęp i akcje trzymają się ekranu ──
   Sesja siłowa to długa lista, po której się scrolluje. Nagłówek, licznik
   postępu i przyciski zapisu muszą być pod ręką bez wracania na górę. */
.workout-modal {
  display: flex;
  flex-direction: column;
  padding: 0;
}

.workout-sticky-head {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg-card);
}

.workout-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 14px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.workout-topbar-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.workout-eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.workout-title {
  margin: 0;
  font-size: 1.3rem;
  line-height: 1.25;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.workout-date {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.workout-close-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
}

.workout-close-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.workout-main {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.25rem 1rem;
}

.workout-body {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── Pasek postępu sesji ─────────────────────────────────────── */
.workout-progress {
  padding: 10px 18px 12px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.wp-track {
  height: 6px;
  border-radius: 999px;
  background: var(--bg-surface);
  overflow: hidden;
}

.wp-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-strength));
  transition: width 0.35s ease;
}

.workout-progress.is-complete .wp-fill {
  background: var(--accent-strength);
}

.wp-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.wp-stat strong {
  color: var(--text-primary);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.wp-delta {
  margin-left: auto;
  font-size: 0.78rem;
  font-weight: 600;
}

.wp-delta.up { color: var(--accent-strength); }
.wp-delta.down { color: var(--accent-cardio); }
.wp-delta.goal { color: var(--text-muted); font-weight: 500; }

/* ── Podsumowanie ostatniego treningu ────────────────────────── */
.last-session-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-primary);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.last-session-card.is-loading,
.last-session-card.is-empty {
  border-left-color: var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.ls-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.ls-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
}

.ls-when {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.ls-tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-primary);
  font-weight: 600;
  font-size: 0.72rem;
}

.ls-tag-other {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.ls-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.ls-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 6px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.18);
  text-align: center;
}

.ls-metric-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.ls-metric-value {
  font-size: 0.95rem;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.ls-details {
  margin-top: 10px;
}

.ls-details summary {
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 4px 0;
}

.ls-details summary:hover {
  color: var(--text-primary);
}

.ls-exercise-list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ls-exercise-list li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.8rem;
  padding: 4px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
}

.ls-ex-name {
  flex: 1;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.ls-ex-detail {
  color: var(--text-primary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ls-ex-volume {
  min-width: 72px;
  text-align: right;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ls-footnote {
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

@media (max-width: 520px) {
  .ls-metrics {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Strength Forms */
.exercises-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.exercise-block {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 1rem;
  border: 1px solid var(--border);
  transition: var(--transition);
}

/* Ćwiczenie z odhaczonymi wszystkimi seriami schodzi wizualnie na drugi plan,
   żeby na liście od razu było widać, co jeszcze zostało do zrobienia. */
.exercise-block.exercise-done {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.05);
}

.exercise-block.exercise-done .exercise-index {
  background: var(--accent-strength);
  border-color: var(--accent-strength);
  color: #fff;
}

.exercise-index {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.exercise-block.in-superset {
  border-left-width: 4px;
}

.exercise-block.superset-group-a {
  border-left-color: #3b82f6;
  background: rgba(59, 130, 246, 0.03);
}

.exercise-block.superset-group-b {
  border-left-color: #a855f7;
  background: rgba(168, 85, 247, 0.03);
}

.exercise-block.superset-group-c {
  border-left-color: #eab308;
  background: rgba(234, 179, 8, 0.03);
}

.exercise-block.superset-group-d {
  border-left-color: #ec4899;
  background: rgba(236, 72, 153, 0.03);
}

.exercise-block-header {
  margin-bottom: 0.75rem;
}

.exercise-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0.5rem;
}

/* ── Historia ćwiczenia: co było ostatnim razem ──────────────── */
.exercise-history {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  min-height: 24px;
  font-size: 0.78rem;
}

.eh-last {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  color: var(--text-secondary);
}

.eh-when {
  color: var(--text-muted);
  white-space: nowrap;
}

.eh-when::before {
  content: '↩️ ';
}

.eh-summary {
  color: var(--text-primary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.eh-loading,
.eh-empty {
  color: var(--text-muted);
  font-style: italic;
}

.eh-loading {
  opacity: 0.6;
}

.btn-copy-last {
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: var(--accent-primary);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-copy-last:hover {
  background: rgba(59, 130, 246, 0.25);
}

.eh-pr {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(234, 179, 8, 0.12);
  color: #eab308;
  font-weight: 700;
  font-size: 0.72rem;
  white-space: nowrap;
}

/* ── Trend ćwiczenia: kilka ostatnich sesji i zastój ─────────── */
.eh-trend {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  min-width: 0;
}

.eh-trend-label {
  color: var(--text-muted);
  white-space: nowrap;
}

.eh-chips {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
  flex: 1 1 100%;
  min-width: 0;
  max-width: 420px;
}

.eh-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1 0;
  min-width: 0;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  line-height: 1.25;
}

.eh-chip-date {
  color: var(--text-muted);
  font-size: 0.66rem;
}

.eh-chip-value {
  color: var(--text-primary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.eh-chip-arrow {
  margin-right: 3px;
  font-size: 0.62rem;
}

.eh-chip.is-up .eh-chip-arrow { color: var(--accent-strength); }
.eh-chip.is-down .eh-chip-arrow { color: var(--accent-danger); }
.eh-chip.is-flat .eh-chip-arrow { color: var(--text-muted); }

/* Ostatnia (najnowsza) sesja wyróżniona — to z nią porównujesz dzisiejszą */
.eh-chip:last-child {
  border-color: rgb(var(--accent-primary-rgb) / 0.45);
}

.eh-stagnation {
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--accent-warning) 14%, transparent);
  color: var(--accent-warning);
  font-weight: 700;
  font-size: 0.72rem;
  white-space: nowrap;
  cursor: help;
}

.exercise-name-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--border);
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: bold;
  padding: 0.5rem 0;
  outline: none;
}

.exercise-rest-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.2);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.exercise-rest-info {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.btn-rest-quick {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--accent-primary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-rest-quick:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: var(--accent-primary);
}

.exercise-rest-bar {
  flex-wrap: wrap;
  gap: 6px 10px;
}

.exercise-rest-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-rest-step {
  min-width: 36px;
  min-height: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: var(--transition);
}

.btn-rest-step:hover {
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

.rest-edit-input {
  width: 54px;
  min-height: 32px;
  padding: 4px 6px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
}

.rest-edit-input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.exercise-rest-controls .rest-unit {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.exercise-rest-controls .btn-rest-quick {
  margin-left: 4px;
}

.eh-rest {
  color: var(--text-secondary);
  font-weight: 500;
}

.exercise-name-input:focus {
  border-bottom-color: var(--accent-primary);
}

.sets-table {
  width: 100%;
  /* Bez ograniczenia szerokości kolumny rozjeżdżają się na desktopie i pola
     jednej serii przestają czytać się jako jeden wiersz. */
  max-width: 580px;
  margin: 0 auto 1rem;
  border-collapse: collapse;
}

.sets-table th {
  color: var(--text-muted);
  font-weight: 500;
  text-align: center;
  padding: 0.5rem;
  font-size: 0.85rem;
}

.sets-table td {
  text-align: center;
}

.sets-table th.col-set {
  text-align: left;
}

.set-row {
  transition: var(--transition);
}

.set-row td {
  padding: 0.5rem 0.35rem;
}

.set-row.completed {
  background: rgba(34, 197, 94, 0.1);
}

.set-row.completed input {
  color: var(--accent-strength);
  border-color: rgba(34, 197, 94, 0.35);
}

/* Placeholder z ostatniej sesji: widać, od czego zacząć, a pole
   zostaje puste, więc nic nie zapisze się przypadkiem. */
.set-row.has-ghost input::placeholder {
  color: var(--text-muted);
  opacity: 0.75;
  font-style: italic;
}

.sets-table th.col-set { width: 46px; }
.sets-table th.col-side { width: 88px; }
.sets-table th.col-check { width: 56px; }
.sets-table th.col-remove { width: 44px; }

.sets-table th.col-set,
.sets-table th.col-side,
.sets-table th.col-check,
.sets-table th.col-remove {
  white-space: nowrap;
}

.set-actions {
  text-align: center;
}

.btn-remove-set {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  opacity: 0.45;
  transition: var(--transition);
}

.btn-remove-set:hover {
  opacity: 1;
  color: var(--accent-danger);
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.1);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.set-number {
  color: var(--text-muted);
  font-weight: bold;
}

.set-row input {
  width: 100%;
  max-width: 130px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  text-align: center;
  min-height: 44px;
  font-variant-numeric: tabular-nums;
}

.set-row input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

/* Strzałki pola liczbowego zjadają szerokość wąskiej kolumny i ucinają wpis */
.set-row input::-webkit-outer-spin-button,
.set-row input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.set-row input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.set-checkbox {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border);
  margin: 0 auto;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.set-row.completed .set-checkbox {
  background: var(--accent-strength);
  border-color: var(--accent-strength);
}

.set-row.completed .set-checkbox::after {
  content: '✓';
  color: #fff;
  font-weight: bold;
  font-size: 1.05rem;
}

.set-checkbox:hover {
  border-color: var(--accent-strength);
}

.set-checkbox:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

.add-set-btn {
  width: 100%;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 0.5rem;
  min-height: 44px;
}

.add-exercise-btn {
  min-height: 44px;
  border: 1px dashed var(--border);
  background: transparent;
}

/* Rest Timer */
.rest-timer {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center;
  border: 1px solid var(--border);
}

.rest-timer-display {
  font-size: 2rem;
  font-weight: bold;
  color: var(--text-primary);
  margin-bottom: 1rem;
  cursor: pointer;
  transition: var(--transition);
}

.rest-timer-display.active {
  color: var(--accent-primary);
  animation: pulse 2s infinite;
}

.rest-timer-display.done {
  color: var(--accent-strength);
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.6; }
  100% { opacity: 1; }
}

.rest-timer-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.rest-timer-preset {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 20px;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
}

.rest-timer-preset:hover {
  background: var(--bg-hover);
}

/* Cardio Form */
.cardio-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.cardio-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: center;
}

.cardio-icon {
  font-size: 3rem;
}

.cardio-activity-select {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  min-height: 44px;
}

/* minmax(0, 1fr) zamiast 1fr — domyślna szerokość <input> nie pozwala
   kolumnie zejść poniżej swojego rozmiaru i siatka wychodziła poza modal. */
.cardio-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  /* dłuższa etykieta łamie się na dwie linie — pola i tak mają zostać w rzędzie */
  align-items: end;
}

@media (min-width: 640px) {
  .cardio-stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}

.input-group input {
  width: 100%;
  min-width: 0;
}

.input-group label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.input-group input {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  min-height: 44px;
}

.cardio-tempo {
  text-align: center;
  font-size: 1.2rem;
  color: var(--text-secondary);
  background: var(--bg-surface);
  padding: 1rem;
  border-radius: var(--radius-sm);
}

.cardio-tempo span {
  font-weight: bold;
  color: var(--text-primary);
}

/* Notes & Actions */
.workout-notes {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.workout-notes-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.workout-notes textarea {
  width: 100%;
  min-height: 80px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  resize: vertical;
  font-family: inherit;
  font-size: 0.9rem;
}

.workout-notes textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
}

/* Dolny dok: licznik przerwy i przyciski zapisu w jednym pasku, zawsze
   widoczne — sesja siłowa to długa lista i wracanie na dół po zapis to
   najczęstszy ruch w całym module. */
.workout-footer {
  position: sticky;
  bottom: 0;
  z-index: 5;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
}

.workout-actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 0.75rem;
  padding: 12px 1rem;
}

.complete-btn {
  background: var(--accent-strength);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-weight: bold;
  font-size: 1rem;
  cursor: pointer;
  min-height: 44px;
}

.save-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-weight: 500;
  cursor: pointer;
  min-height: 44px;
}

@media (max-width: 600px) {
  .workout-main {
    padding: 1rem 0.75rem;
  }

  /* Przerwę zmienia się palcem w trakcie treningu — pełne pola dotyku */
  .btn-rest-step,
  .rest-edit-input,
  .exercise-rest-controls .btn-rest-quick {
    min-height: 44px;
  }

  .btn-rest-step {
    min-width: 44px;
  }

  .workout-topbar {
    padding: 12px 14px 10px;
  }

  .workout-title {
    font-size: 1.1rem;
  }

  .workout-actions {
    grid-template-columns: 1fr 1.3fr;
    gap: 0.5rem;
    padding: 10px 0.75rem;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .sets-table th {
    font-size: 0.78rem;
    white-space: nowrap;
  }

  /* Objętość z poprzedniej sesji jest w karcie "Ostatni trening" — przy
     ćwiczeniu na wąskim ekranie tylko łamie linię. */
  .eh-volume {
    display: none;
  }

  .workout-actions .btn {
    padding: 0.85rem 0.5rem;
    font-size: 0.92rem;
  }
}

.exercise-tags {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  align-items: center;
}

.exercise-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 10px;
  white-space: nowrap;
}

.tag-superset {
  background: rgba(234, 179, 8, 0.15);
  color: #eab308;
  font-weight: 700;
}

.superset-group-a .tag-superset {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

.superset-group-b .tag-superset {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
}

.superset-group-c .tag-superset {
  background: rgba(234, 179, 8, 0.2);
  color: #facc15;
}

.superset-group-d .tag-superset {
  background: rgba(236, 72, 153, 0.2);
  color: #f472b6;
}

.tag-time {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-primary);
}

.tag-bilateral {
  background: rgba(249, 115, 22, 0.15);
  color: var(--accent-cardio);
}

/* Bilateral Side Badges */
.set-side {
  text-align: center;
}

.side-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 8px;
}

.side-badge-l {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-primary);
}

.side-badge-r {
  background: rgba(249, 115, 22, 0.15);
  color: var(--accent-cardio);
}

.set-row.side-l {
  border-left: 3px solid var(--accent-primary);
}

.set-row.side-r {
  border-left: 3px solid var(--accent-cardio);
}

/* Workout Plan Name */
.workout-plan-name {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Rest Timer Label */
.rest-timer-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* ── Workload & RPE Selector ──────────────────────────────────── */
.strength-footer-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.5rem;
}

.workout-workload-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.workout-duration-field {
  display: flex;
  align-items: center;
  gap: 12px;
}

.workout-duration-field label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

.workout-duration-field input {
  width: 110px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 6px 10px;
  font-size: 0.95rem;
  font-weight: 600;
}

.rpe-selector-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rpe-header label {
  font-size: 0.88rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.rpe-header strong {
  color: var(--text-primary);
  font-weight: 600;
}

.rpe-pills {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
}

.rpe-pill {
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-base);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rpe-pill:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
  transform: translateY(-1px);
}

/* RPE Colors when active */
.rpe-pill.active.rpe-1, .rpe-pill.active.rpe-2 {
  background: #10b981;
  color: #ffffff;
  border-color: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.rpe-pill.active.rpe-3, .rpe-pill.active.rpe-4 {
  background: #06b6d4;
  color: #ffffff;
  border-color: #06b6d4;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
}

.rpe-pill.active.rpe-5, .rpe-pill.active.rpe-6 {
  background: #6366f1;
  color: #ffffff;
  border-color: #6366f1;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

.rpe-pill.active.rpe-7, .rpe-pill.active.rpe-8 {
  background: #f59e0b;
  color: #000000;
  border-color: #f59e0b;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.rpe-pill.active.rpe-9, .rpe-pill.active.rpe-10 {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

@media (max-width: 480px) {
  .rpe-pills {
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 6px;
  }
}

/* ==========================================================================
   Live Cardio Tracker & Bluetooth HR Styles
   ========================================================================== */

/* CTA Banner in Cardio Form */
.live-tracker-cta-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(37, 99, 235, 0.05) 100%);
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 1rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.live-tracker-cta-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.live-tracker-cta-desc {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.btn-start-live {
  white-space: nowrap;
  padding: 10px 18px;
  font-weight: 700;
  font-size: 0.92rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-start-live:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.5);
}

/* Live Pulse Dot */
.live-pulse-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: #ef4444;
  border-radius: 50%;
  box-shadow: 0 0 8px #ef4444;
  animation: pulseLiveDot 1.4s infinite;
}

@keyframes pulseLiveDot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Live Tracker Modal Shell */
.live-tracker-modal {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 0.5rem;
  color: var(--text-primary);
}

.live-tracker-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
}

.live-tracker-activity {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.live-tracker-activity h2 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
}

.live-tracker-date {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.live-close-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.live-close-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border-color: #ef4444;
}

/* Device Connections Bar */
.live-tracker-devices-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.live-device-btn {
  flex: 1;
  min-width: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.live-device-btn:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
  background: rgba(59, 130, 246, 0.08);
}

.live-device-btn.connected {
  background: rgba(16, 185, 129, 0.12);
  border-color: #10b981;
  color: #10b981;
}

.live-device-btn.gps-on {
  background: rgba(59, 130, 246, 0.12);
  border-color: #3b82f6;
  color: #3b82f6;
}

/* Main Heart Rate Hero Card */
.live-hr-hero {
  background: radial-gradient(circle at 50% 30%, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1rem;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.live-hr-pulse-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.live-heart-icon {
  font-size: 2.75rem;
  filter: drop-shadow(0 0 12px rgba(239, 68, 68, 0.4));
  transition: transform 0.1s ease;
}

.live-heart-icon.beating {
  animation: heartBeat 0.8s infinite ease-in-out;
}

@keyframes heartBeat {
  0% { transform: scale(1); }
  15% { transform: scale(1.22); }
  30% { transform: scale(1); }
  45% { transform: scale(1.15); }
  60% { transform: scale(1); }
}

.live-hr-digits-box {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.live-hr-val {
  font-size: 4rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -2px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.live-hr-unit {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* Zone Display */
.live-hr-zone-container {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.live-zone-pill {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  transition: all 0.3s ease;
}

.live-zone-meter {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.live-zone-meter-fill {
  height: 100%;
  transition: width 0.3s ease, background 0.3s ease;
  border-radius: 4px;
}

.live-zone-legend {
  width: 100%;
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0 4px;
}

/* Live Metrics HUD Grid */
.live-metrics-hud {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (min-width: 560px) {
  .live-metrics-hud {
    grid-template-columns: repeat(4, 1fr);
  }
}

.live-metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.live-metric-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

.live-metric-val {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.live-metric-val small {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* Sparkline Chart Box */
.live-sparkline-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
}

.live-sparkline-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.live-sparkline-svg {
  width: 100%;
  height: 50px;
  overflow: visible;
}

/* Live Actions */
.live-tracker-actions {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 12px;
  margin-top: 0.5rem;
}

.live-action-btn {
  min-height: 50px;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-warning {
  background: #f59e0b !important;
  color: #000000 !important;
  border-color: #f59e0b !important;
}

.complete-live-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.35);
  color: #ffffff;
}

.complete-live-btn:hover {
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
  transform: translateY(-1px);
}

@media (max-width: 480px) {
  .live-tracker-cta-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .btn-start-live {
    width: 100%;
  }
}


/* Autoregulacja — rekomendacja przed treningiem */
.workout-guidance {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--text-muted);
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.workout-guidance.guidance-green { border-left-color: var(--accent-strength); }
.workout-guidance.guidance-proceed { border-left-color: var(--accent-primary); }
.workout-guidance.guidance-reduce { border-left-color: var(--accent-cardio); }
.workout-guidance.guidance-swap { border-left-color: var(--accent-danger); }

.guidance-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.guidance-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.guidance-score {
  font-size: 0.8rem;
  font-weight: 600;
}

.guidance-detail {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.guidance-adjustments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.guidance-adjustments span {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
}

.guidance-load {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Licznik przerwy w dolnym doku
   ========================================================================== */
.rest-float {
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  overflow: hidden;
  animation: rest-slide-in 0.2s ease;
}

@keyframes rest-slide-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.rest-float-track {
  height: 4px;
  background: rgba(0, 0, 0, 0.25);
}

.rest-float-fill {
  height: 100%;
  width: 100%;
  background: var(--accent-primary);
  transition: width 1s linear, background 0.3s ease;
}

.rest-float-body {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 1rem;
}

.rest-float-time {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  min-width: 70px;
}

.rest-float-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.rest-float-meta strong {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.rest-float-meta span {
  font-size: 0.82rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rest-float-controls {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.rest-float-btn {
  min-height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.rest-float-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.rest-float-skip {
  color: var(--accent-primary);
  border-color: rgba(59, 130, 246, 0.35);
}

.rest-float.ending .rest-float-time {
  color: var(--accent-cardio);
}

.rest-float.ending .rest-float-fill {
  background: var(--accent-cardio);
}

.rest-float.done .rest-float-time {
  color: var(--accent-strength);
}

.rest-float.done .rest-float-fill {
  background: var(--accent-strength);
}

@media (max-width: 600px) {
  .rest-float-body {
    padding: 8px 0.75rem;
    gap: 8px;
  }

  .rest-float-time {
    font-size: 1.3rem;
    min-width: 62px;
  }

  /* Nagłówek "Przerwa" ustępuje miejsca nazwie ćwiczenia */
  .rest-float-meta strong {
    display: none;
  }

  .rest-float-btn {
    padding: 0 8px;
    font-size: 0.72rem;
  }
}

/* Przywrócony szkic treningu */
.workout-draft-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.5rem 0.5rem 0.875rem;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--accent-primary);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.workout-draft-banner .btn-sm {
  min-height: 44px;
  flex-shrink: 0;
}
