/* ========== WEEK STRIP (horizontal) ========== */
.week-strip-container {
  margin-bottom: var(--space-sm);
  padding-top: 10px;
  border-top: none;
}

.week-strip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.week-strip-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.week-strip-nav {
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 4px 10px;
  line-height: 1;
}

.week-strip-nav:active { color: var(--lime); }

.week-strip {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 2px 0;
}

.week-strip::-webkit-scrollbar { display: none; }

.week-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
  padding: 8px 4px 6px;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  border: 1.5px solid transparent;
  cursor: default;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.week-pill.scheduled,
.week-pill.completed,
.week-pill.missed { cursor: pointer; }

.week-pill:active { transform: scale(0.92); }

.week-pill.today {
  background: rgba(204,255,0,0.1);
  border-color: var(--lime);
  box-shadow: 0 0 16px rgba(204,255,0,0.08), inset 0 0 12px rgba(204,255,0,0.04);
}

.week-pill.selected:not(.today) {
  background: var(--bg-tertiary);
  border-color: rgba(255,255,255,0.3);
}

.week-pill-day {
  font-size: 0.5625rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.week-pill.today .week-pill-day { color: var(--lime); }

.week-pill-date {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
}

.week-pill.today .week-pill-date { color: var(--lime); }

.week-pill-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  margin-top: 2px;
}

.dot-rest { background: rgba(255,255,255,0.08); }
.dot-scheduled { background: var(--lime); box-shadow: 0 0 6px rgba(204,255,0,0.4); }
.dot-done { background: var(--success); box-shadow: 0 0 6px rgba(34,197,94,0.4); }
.dot-missed { background: var(--danger); }

/* Legacy week-schedule (keep for coach views) */
.week-schedule {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Calendar Month Stats */
.cal-month-stats {
  display: flex;
  gap: var(--space-xs);
  margin-bottom: var(--space-sm);
}

.cal-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
}

.cal-stat-value {

  font-size: 1.25rem;
  letter-spacing: 0.04em;
}

.cal-stat-value.stat-completed { color: var(--success); }
.cal-stat-value.stat-scheduled { color: var(--lime); }
.cal-stat-value.stat-missed { color: var(--danger); }

.cal-stat-label {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  text-transform: none;
  letter-spacing: 0.06em;
}

/* Calendar */
.client-calendar {
  margin-bottom: var(--space-md);
}

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xs);
}

.cal-month-label {

  font-size: 1.125rem;
  letter-spacing: 0.06em;
  text-transform: none;
}

.cal-legend {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  margin-bottom: var(--space-sm);
  font-size: 0.6875rem;
  color: var(--text-secondary);
}

.cal-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.cal-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cal-indicator.scheduled {
  border: 1.5px solid var(--lime);
  background: transparent;
}

.cal-indicator.completed {
  background: var(--success);
}

.cal-indicator.missed {
  background: var(--danger);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  /* Lock every cell to the same row height regardless of workout title length.
     1fr would let workout-bearing rows grow — pin to an explicit minmax so the
     calendar reads as a uniform grid, like Apple Calendar. */
  grid-auto-rows: minmax(64px, 64px);
  gap: 3px;
}

.cal-day-header {
  text-align: center;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: none;
  letter-spacing: 0.08em;
  padding: 4px 0;
}

.cal-day {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 4px 3px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  cursor: pointer;
  /* Match the grid-auto-rows height — combined with overflow:hidden this
     keeps the cell square-ish and clips overlong workout titles. */
  height: 64px;
  min-height: 0;
  gap: 2px;
  overflow: hidden;
  transition: border-color 0.15s;
}

.cal-day:hover {
  border-color: var(--lime-border);
}

.cal-day.today {
  border-color: var(--lime);
  background: var(--lime-subtle);
}

.cal-day.has-workout {
  border-left: 2px solid var(--lime-border);
}

.cal-day.other-month {
  opacity: 0.25;
}

.cal-day-num {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
}

.cal-day.today .cal-day-num {
  color: var(--lime);
}

/* Workout entries inside calendar day */
.cal-day-entries {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 100%;
  overflow: hidden;
}

.cal-day-entry {
  display: flex;
  align-items: center;
  gap: 2px;
  width: 100%;
}

.cal-entry-name {
  font-size: 0.5625rem;
  line-height: 1.2;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.cal-day-entry.completed .cal-entry-name {
  color: var(--success);
}

.cal-day-entry.missed .cal-entry-name {
  color: var(--danger);
  text-decoration: line-through;
}

.cal-day-more {
  font-size: 0.5rem;
  color: var(--text-tertiary);
  text-align: center;
}

.cal-day-entry.cal-selectable {
  cursor: pointer;
  padding: 2px 3px;
  border-radius: 4px;
  margin-bottom: 1px;
  border: 1px solid transparent;
  transition: background 0.1s, border-color 0.1s;
}

.cal-day-entry.cal-selectable:active {
  background: rgba(255,255,255,0.08);
}

.cal-day-entry.cal-entry-checked {
  background: rgba(204,255,0,0.12);
  border-color: rgba(204,255,0,0.35);
}

.cal-select-check {
  font-size: 0.5rem;
  width: 10px;
  height: 10px;
  border: 1px solid var(--text-tertiary);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--lime);
  line-height: 1;
}

.cal-entry-checked .cal-select-check {
  border-color: var(--lime);
  background: rgba(204,255,0,0.15);
}

.cal-weight {
  font-size: 0.5rem;
  font-weight: 700;
  color: var(--lime);
  margin-top: auto;
  padding-top: 2px;
  letter-spacing: 0.02em;
}

.cal-weight-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--lime-subtle);
  border: 1px solid var(--lime-border);
  border-radius: 8px;
  margin-bottom: var(--space-sm);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--lime);
}

.cal-modal-assignment.select-mode {
  cursor: pointer;
  user-select: none;
}

.cal-modal-assignment.selected {
  border-color: var(--lime);
  background: var(--lime-subtle);
}

.cal-checkbox {
  flex-shrink: 0;
  accent-color: var(--lime);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.cal-series-prompt {
  padding: var(--space-sm) 0;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-primary);
  color: var(--text-secondary);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-ghost:hover {
  border-color: var(--lime-border);
  color: var(--text-primary);
}

.cal-day.grid-selected {
  border-color: var(--danger) !important;
  background: rgba(239, 68, 68, 0.08) !important;
  position: relative;
}

.cal-day.grid-selected::after {
  content: '✓';
  position: absolute;
  top: 2px;
  right: 3px;
  font-size: 0.55rem;
  font-weight: 800;
  color: var(--danger);
  line-height: 1;
}

/* Assign modal tabs */
.assign-tabs {
  display: flex;
  gap: 0;
  margin-bottom: var(--space-md);
  border: 1px solid var(--border-primary);
  border-radius: 10px;
  overflow: hidden;
}

.assign-tab {
  flex: 1;
  padding: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  text-align: center;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}

.assign-tab.active {
  background: var(--lime);
  color: #000;
}

.assign-mode {
  min-height: 0;
}

/* Repeat preview */
.repeat-preview {
  max-height: 25vh;
  overflow-y: auto;
  margin-bottom: var(--space-sm);
}

.repeat-preview-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.8125rem;
  border-bottom: 1px solid var(--border-primary);
}

.repeat-preview-item:last-child {
  border-bottom: none;
}

/* Calendar day modal */
.cal-modal-assignment {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  margin-bottom: var(--space-xs);
}

.cal-modal-assignment .cal-assign-info h4 {

  font-size: 0.875rem;
  text-transform: none;
  letter-spacing: 0.04em;
  margin: 0;
}

.cal-modal-assignment .cal-assign-info span {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.week-day-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 12px;
  background: var(--bg-card);
  border: none;
  border-radius: 10px;
  transition: border-color 0.15s;
}

.week-day-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.week-day-card.today {
  border-color: rgba(204,255,0,0.15);
  background: rgba(204,255,0,0.04);
}

.week-day-card.completed {
  border-left: 2px solid var(--success);
}

.week-day-name {

  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  min-width: 40px;
  text-transform: none;
}

.week-day-date {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-left: 4px;
  font-weight: 300;
  text-transform: none;
  letter-spacing: normal;
}

.week-day-workout {
  flex: 1;
  margin-left: var(--space-md);
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.week-day-status {
  font-size: 0.625rem;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0.08em;
}

.status-scheduled { background: rgba(204,255,0,0.1); color: var(--lime); }
.status-completed { background: rgba(34, 197, 94, 0.1); color: var(--success); }
.status-missed { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.status-rest { color: var(--text-tertiary); font-size: 0.625rem; opacity: 0.6; }

.assignment-actions {
  display: flex;
  gap: var(--space-xs);
  justify-content: flex-end;
}

.btn-action {
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 8px;
  border: none;
  background: var(--bg-tertiary);
  cursor: pointer;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;

  transition: background 0.15s;
}

.btn-reset {
  color: var(--warning);
  border-color: rgba(234, 179, 8, 0.25);
}

.btn-reset:hover {
  background: rgba(234, 179, 8, 0.1);
}

.btn-move {
  color: var(--lime);
  border-color: var(--lime-border);
}

.btn-move:hover {
  background: var(--lime-subtle);
}

/* Today's workout card action buttons */
.today-workout-card .assignment-actions {
  margin-top: var(--space-sm);
  justify-content: center;
}

/* ========== ACTIVE WORKOUT ========== */
/* Active workout goes full-screen — no top bar, no bottom nav */
#activeWorkoutView,
#workoutPreviewView {
  top: 0;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: 0;
}

/* Both full-screen views use the same shape: a fixed-height flex column whose
   middle section does the scrolling. The preview used to let the whole page
   scroll under a `position:sticky` header — but the header lives inside
   .view-content, so it could only rise to that element's content box and left a
   transparent safe-area strip above it that the exercise list scrolled through
   (visible over the status bar). An inner scroller makes that impossible. */
#activeWorkoutView .view-content,
#workoutPreviewView .view-content {
  display: flex;
  flex-direction: column;
  /* 100% of the fixed parent, NOT 100vh. The parent is `position:fixed;
     top:0; bottom:0`, so its content box is exactly the real viewport minus its
     own safe-area padding — which is what the old
     `calc(100vh - env(safe-area-inset-top))` was trying to reconstruct. On iOS
     (Safari and the Capacitor WKWebView) 100vh is the LARGE viewport: it
     ignores the collapsible toolbars, so it overshoots the visible area and
     pushes the last thing in the column — Start Workout here, Finish Workout in
     the active view — below the fold. A percentage of the fixed box can't. */
  height: 100%;
  padding-bottom: 0;
}

#previewExerciseList {
  flex: 1;
  min-height: 0;      /* without this a flex item refuses to shrink and scroll */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#workoutSummary {
  top: 0;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.workout-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  flex-shrink: 0;
}

.workout-header h3 {
  flex: 1;
  text-align: center;
  margin: 0;

  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.workout-timer {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--lime);
  font-size: 15px;

  letter-spacing: 0.02em;
  text-shadow: 0 0 12px rgba(204,255,0,0.3);
}

/* Live Workout Stats */
.workout-live-stats {
  display: flex;
  justify-content: space-around;
  padding: 6px 0;
  margin-bottom: 4px;
  border-bottom: 0.5px solid var(--border-primary);
  flex-shrink: 0;
}

.live-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.live-stat-value {

  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.live-stat-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: none;
  letter-spacing: 0;
}

.exercise-progress {
  height: 2px;
  background: rgba(255,255,255,0.04);
  border-radius: 1px;
  margin-bottom: 6px;
  overflow: hidden;
  flex-shrink: 0;
}

.exercise-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--lime-dim), var(--lime));
  border-radius: 1px;
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 8px rgba(204,255,0,0.3);
}

/* ========== EXERCISE LIST (vertical, collapsible) ========== */
.ex-list-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: var(--space-2xs) 0;
  flex-shrink: 0;
}

.ex-expand-all {
  background: none;
  border: none;
  padding: var(--space-2xs) 0;
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
}

.ex-expand-all:active { color: var(--lime); }

.workout-exercise-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--space-md);
}

.ex-section {
  border-bottom: 1px solid var(--hairline);
}

.ex-head {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  padding: var(--space-sm) 0;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  color: var(--text-primary);
}

.ex-head-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  background: var(--fill-soft);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.ex-section.done .ex-head-num {
  background: var(--lime-tint);
  color: var(--lime);
}

.ex-head-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ex-head-name {
  font-size: var(--fs-base);
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ex-head-meta {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  text-transform: capitalize;
}

.ex-head-count {
  flex-shrink: 0;
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}

.ex-section.done .ex-head-count { color: var(--lime); }

.ex-chevron {
  flex-shrink: 0;
  color: var(--text-tertiary);
  transition: transform 0.2s ease;
}

.ex-section.collapsed .ex-chevron { transform: rotate(-90deg); }

.ex-body {
  padding-bottom: var(--space-sm);
}

.ex-section.collapsed .ex-body { display: none; }

/* The Reps / Time column header doubles as the mode switch, so it has to read
   as a column label first and a control second: same size, weight, tracking and
   case as its sibling <span> headers, with lime + a swap glyph as the only
   signal that it is tappable. A separate toggle chip above the table was too
   loud for a per-exercise setting.
   NB: do NOT name this `.log-mode-toggle` — Focus Mode's log sheet already owns
   that class further down this file, and its 999px pill silently won. */
.set-mode-head {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0;
  border: none;
  background: none;
  color: var(--lime);
  font: inherit;
  font-weight: 600;
  letter-spacing: inherit;
  text-transform: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.set-mode-head svg {
  opacity: 0.75;
  flex-shrink: 0;
}

.set-mode-head:active {
  opacity: 0.55;
}

/* Sticky finish action — the only way out of a workout now that there is no
   per-exercise Next button */
.workout-finish-bar {
  flex-shrink: 0;
  padding: var(--space-sm) 0;
  padding-bottom: calc(var(--space-sm) + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--hairline);
}

.workout-finish-bar .btn-primary {
  width: 100%;
  min-height: 46px;
}

.add-set-link {
  background: none;
  border: none;
  color: var(--lime);

  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 0;
  display: block;
}

/* Set Table */
.set-table {
  margin: 6px 0;
}

.set-table-header {
  display: grid;
  grid-template-columns: 40px 1fr 80px 70px 40px;
  gap: 8px;
  padding: 8px 0;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.set-row {
  display: grid;
  grid-template-columns: 40px 1fr 80px 70px 44px;
  gap: 8px;
  align-items: center;
  padding: 8px 4px;
  border-top: none;
  transition: background 0.15s ease;
  position: relative;
  z-index: 1;
  background: var(--bg-primary);
  border-radius: 10px;
  margin-bottom: 2px;
}

.set-row.active-set {
  background: rgba(204,255,0,0.04);
  border-radius: 10px;
  border-left: none;
  padding-left: 4px;
  box-shadow: inset 0 0 0 1px rgba(204,255,0,0.1);
}

.set-row .set-num {

  font-size: 15px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-align: center;
}

.set-row .set-prev {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}

.set-row input {
  width: 100%;
  padding: 8px;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  min-height: 44px;
  font-variant-numeric: tabular-nums;
  background: rgba(255,255,255,0.06);
  border: none;
  border-radius: 10px;
  color: var(--text-primary);
  transition: background 0.15s, box-shadow 0.15s;
}

.set-row input:focus {
  background: rgba(255,255,255,0.1);
  box-shadow: 0 0 0 1.5px rgba(204,255,0,0.2);
}

/* The set-complete control. This styles the real checkbox the rows render —
   the old .set-check-btn rules targeted markup nothing ever emitted, which is
   why completing a set showed a raw native checkbox. */
.set-check {
  display: flex;
  align-items: center;
  justify-content: center;
}

.set-check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  /* .set-row input above sets min-height:44px + padding for the weight/reps
     fields; inherited here it stretched the checkbox into a tall pill. */
  min-height: 0;
  padding: 0;
  flex: 0 0 auto;
  margin: 0;
  border-radius: 50%;
  border: 1.5px solid var(--hairline-strong);
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: background 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
              border-color 0.2s ease,
              transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Tick drawn as a rotated L so there's no icon font or SVG per row */
.set-check input[type="checkbox"]::after {
  content: '';
  position: absolute;
  left: 9px;
  top: 4px;
  width: 6px;
  height: 12px;
  border: solid var(--text-on-lime);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.15s ease;
}

.set-check input[type="checkbox"]:checked {
  background: var(--lime);
  border-color: var(--lime);
  transform: scale(1.05);
  box-shadow: var(--lime-glow) 0 0 12px;
}

.set-check input[type="checkbox"]:checked::after {
  transform: rotate(45deg) scale(1);
}

/* Beat .set-row input:focus, which would repaint the checked circle grey */
.set-check input[type="checkbox"]:focus {
  background: transparent;
  box-shadow: none;
}

.set-check input[type="checkbox"]:checked:focus {
  background: var(--lime);
  box-shadow: var(--lime-glow) 0 0 12px;
}

/* Swipe-to-delete */
.set-row-wrapper {
  position: relative;
  overflow: hidden;
}

.set-row-delete-bg {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 80px;
  background: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  border-radius: 10px;
  opacity: 0;
  transition: opacity 0.15s;
}

/* Armed state: partial swipe parks the row with the Delete button exposed */
.set-row-wrapper.delete-armed .set-row-delete-bg {
  opacity: 1;
  cursor: pointer;
}

/* Undo snackbar — deletes are recoverable for 5s instead of confirmed upfront */
.undo-toast {
  position: fixed;
  bottom: calc(120px + env(safe-area-inset-bottom, 0px));
  left: 16px;
  right: 16px;
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--surface-3);
  border: 1px solid var(--surface-4);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: var(--fs-md);
  font-weight: 500;
  z-index: var(--z-toast);
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.undo-toast.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.undo-toast-btn {
  background: none;
  border: none;
  color: var(--lime);
  font-size: var(--fs-md);
  font-weight: 700;
  padding: var(--space-2xs) var(--space-xs);
  cursor: pointer;
}

.set-row.completed {
  background: var(--bg-primary);
  border-radius: 10px;
}

.set-row.completed .set-num {
  color: var(--lime-dim);
}

.set-row.just-completed {
  animation: setComplete 0.5s ease;
}

@keyframes setComplete {
  0%   { background: rgba(204, 255, 0, 0.15); transform: scale(1.01); }
  100% { background: var(--bg-primary); transform: scale(1); }
}

.set-row.pr-set {
  background: rgba(234, 179, 8, 0.06);
  border: 1px solid rgba(234, 179, 8, 0.2);
  border-radius: 8px;
}

.exercise-notes {
  padding-bottom: var(--space-xs);
}

.exercise-notes input {
  margin-top: 6px;
  font-size: 14px;
  padding: 8px 12px;
  min-height: 36px;
}

/* ========== INLINE REST TIMER ========== */
/* Sits in the log under the set you just finished, so the rest of the session
   stays readable and editable while the clock runs. */
.rest-inline {
  margin: var(--space-2xs) 0 var(--space-xs);
  padding: var(--space-xs);
  border-radius: var(--radius-control);
  background: var(--lime-tint-soft);
  box-shadow: inset 0 0 0 1px var(--lime-tint);
  animation: restInlineIn 0.2s ease;
}

@keyframes restInlineIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.rest-inline-track {
  height: 3px;
  border-radius: 2px;
  background: var(--fill-soft);
  overflow: hidden;
  margin-bottom: var(--space-xs);
}

.rest-inline-fill {
  height: 100%;
  width: 100%;
  background: var(--lime);
  border-radius: 2px;
  transition: width 0.5s linear;
}

.rest-inline-row {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.rest-inline-label {
  font-size: var(--fs-2xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--lime);
}

.rest-inline-count {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  min-width: 2.2ch;
}

.rest-inline-count.ending {
  color: var(--warning);
  animation: restCountPulse 1s ease infinite;
}

@keyframes restCountPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}

.rest-inline-next {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rest-inline-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  flex-shrink: 0;
}

.rest-adjust,
.rest-skip {
  padding: 6px 10px;
  min-height: 32px;
  border: none;
  border-radius: var(--radius-lg);
  background: var(--fill-soft);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.rest-skip {
  background: var(--lime);
  color: var(--text-on-lime);
}

.rest-adjust:active,
.rest-skip:active { opacity: 0.7; }

.rest-inline.rest-complete {
  background: var(--lime-tint-strong);
}

/* Mirror of the strip, shown only while the strip itself is scrolled away */
.rest-minibar {
  position: fixed;
  left: var(--space-md);
  right: var(--space-md);
  bottom: calc(var(--space-md) + env(safe-area-inset-bottom, 0px));
  display: none;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-card);
  background: var(--surface-3);
  box-shadow: var(--shadow-md), inset 0 0 0 1px var(--lime-tint);
  z-index: var(--z-raised);
}

.rest-minibar.visible { display: flex; }

/* AdMob pins a ~50dp native banner over the bottom of the webview during rest
   (free tier, native only) — lift the bar clear of it rather than under it. */
body.ad-banner-visible .rest-minibar {
  bottom: calc(var(--space-md) + 60px + env(safe-area-inset-bottom, 0px));
}

.rest-minibar.rest-complete {
  background: var(--lime-tint-strong);
}

/* ========== WORKOUT SUMMARY ========== */
.summary-header {
  text-align: center;
  padding: var(--space-xl) 0 var(--space-md);
}

.summary-header h2 {

  font-size: 1.75rem;
  font-weight: 700;
  color: var(--lime);
  letter-spacing: -0.02em;
  text-transform: none;
  line-height: 1;
}

.summary-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  padding: 0;
  margin-bottom: var(--space-lg);
  background: var(--border-primary);
  border-radius: 12px;
  overflow: hidden;
}

.summary-stat {
  text-align: center;
  padding: var(--space-lg);
  background: var(--bg-card);
}

.summary-stat-value {

  font-size: 2rem;
  font-weight: 400;
  color: var(--text-primary);
  line-height: 1;
}

.summary-stat-label {
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: none;
  letter-spacing: 0.04em;
  margin-top: 4px;
}

.prs-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--space-lg);
}

.pr-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  background: rgba(234, 179, 8, 0.05);
  border: 1px solid rgba(234, 179, 8, 0.15);
  border-radius: 8px;
  font-size: 0.875rem;
}

.pr-item .pr-exercise { font-weight: 600; }
.pr-item .pr-value { color: var(--warning); font-weight: 700; font-variant-numeric: tabular-nums; }

.summary-rating {
  text-align: center;
  margin-bottom: var(--space-lg);
}

.summary-rating p {
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.04em;
}

.rating-stars {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.rating-stars button {
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  transition: color 0.15s, transform 0.15s;
}

.rating-stars button.active { color: var(--lime); }
.rating-stars button:hover { transform: scale(1.2); }

/* ========== FOCUS MODE (voice-first workout) ========== */
/* Full-screen: override the default .view offset/padding so it fills the
   screen exactly and never scrolls (the top bar is hidden in this view). */
#focusWorkoutView {
  top: 0;
  padding-bottom: 0;
  overflow: hidden;
}
.focus-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: max(env(safe-area-inset-top), 12px) var(--space-lg) calc(env(safe-area-inset-bottom) + 12px);
  background: var(--bg-primary);
}
.focus-body { overflow-y: auto; }
.focus-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}
.focus-counter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 0.05em;
  background: none;
  border: none;
  padding: 6px 8px;
  cursor: pointer;
}
.focus-counter svg { opacity: 0.7; }
.focus-counter:active { transform: scale(0.96); }
.focus-jump-done {
  flex: 0 0 auto;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--lime);
}
.focus-progress {
  height: 4px;
  border-radius: 4px;
  background: var(--bg-tertiary);
  margin: var(--space-md) 0 var(--space-lg);
  overflow: hidden;
}
.focus-progress-bar {
  height: 100%;
  background: var(--lime);
  border-radius: 4px;
  transition: width 0.3s ease;
}
.focus-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-lg);
}
.focus-exercise-head h1 {
  font-size: 2rem;
  line-height: 1.1;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 var(--space-sm);
}
.focus-sub {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.95rem;
  color: var(--text-secondary);
}
.focus-sub .focus-dot { color: var(--text-tertiary); }
.focus-prev {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-md);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  background: var(--bg-card);
}
.focus-prev-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
}
.focus-prev-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}
.focus-cues {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.focus-cues-title {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-tertiary);
  margin-bottom: 2px;
}
.focus-cue {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  font-size: 1.05rem;
  line-height: 1.35;
  color: var(--text-secondary);
}
.focus-cue-n {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border-radius: 999px;
  background: var(--lime-subtle);
  color: var(--lime);
  border: 1px solid var(--lime-border);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.focus-cues-loading {
  font-size: 0.9rem;
  color: var(--text-tertiary);
}
.focus-video-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  align-self: flex-start;
  padding: 8px 14px;
  border: 1px solid var(--lime-border);
  border-radius: 999px;
  background: var(--lime-subtle);
  color: var(--lime);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.focus-video {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
}
.focus-video iframe { width: 100%; height: 100%; border: 0; }
.focus-logged {
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  background: var(--bg-card);
  padding: var(--space-md);
}
.focus-logged-title {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-sm);
}
.focus-logged-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--text-secondary);
  padding: 3px 0;
}
.summary-logged {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.summary-logged-ex {
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  background: var(--bg-card);
  padding: var(--space-md);
}
.summary-logged-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}
.summary-logged-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 2px 0;
}
.summary-skipped-note {
  text-align: center;
  font-size: var(--fs-md);
  color: var(--text-tertiary);
  padding: var(--space-xs) 0;
}
.focus-actions {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}
.focus-rest-btn, .focus-log-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 18px 16px;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  white-space: nowrap;
}
.focus-rest-btn {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
}
.focus-log-btn {
  background: var(--lime);
  color: var(--bg-primary);
}
.focus-log-btn:active, .focus-rest-btn:active { transform: scale(0.98); }
.focus-prev-exercise {
  margin-top: var(--space-md);
  width: 100%;
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px;
  cursor: pointer;
}

/* ---- Voice logging bottom sheet ---- */
.log-sheet {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
}
.log-sheet.open { display: block; }
.log-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}
.log-sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-card);
  border-top-left-radius: 22px;
  border-top-right-radius: 22px;
  padding: 10px var(--space-lg) calc(env(safe-area-inset-bottom) + 20px);
  max-height: 88vh;
  overflow-y: auto;
  animation: logSheetUp 0.25s ease;
}
@keyframes logSheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.log-sheet-grabber {
  width: 40px;
  height: 4px;
  border-radius: 4px;
  background: var(--border-primary);
  margin: 4px auto var(--space-md);
}
.log-sheet-panel h3 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 4px;
}
.log-sheet-help {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0 0 var(--space-lg);
}
.log-mic-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}
.log-mic {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: none;
  background: var(--lime-subtle);
  color: var(--lime);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s;
}
.log-mic:active { transform: scale(0.94); }
.log-mic.listening {
  background: var(--lime);
  color: var(--bg-primary);
  animation: micPulse 1.2s ease-in-out infinite;
}
@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--lime-dim); }
  50% { box-shadow: 0 0 0 14px transparent; }
}
.log-mic-hint {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  font-weight: 600;
}
.log-transcript {
  width: 100%;
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 12px;
  font-size: 1rem;
  resize: none;
  font-family: inherit;
}
.log-parse-btn {
  width: 100%;
  margin-top: var(--space-md);
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--lime-border);
  background: var(--lime-subtle);
  color: var(--lime);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}
.log-parsed { margin-top: var(--space-md); }
.log-parsing { color: var(--text-secondary); font-size: 0.9rem; text-align: center; padding: var(--space-md); }
.log-parsed-head {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-sm);
  text-align: center;
}
.log-parsed-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 6px 0;
}
.log-parsed-num {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
}
.log-parsed-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border-primary);
  border-radius: 10px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 12px;
  font-size: 1.05rem;
  font-weight: 600;
  text-align: center;
}
.log-parsed-x { color: var(--text-tertiary); font-weight: 700; }
.log-parsed-del {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: none;
  background: none;
  color: var(--text-tertiary);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.log-add-set {
  width: 100%;
  margin-top: var(--space-sm);
  padding: 10px;
  border: 1px dashed var(--border-primary);
  border-radius: 10px;
  background: none;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.log-confirm { width: 100%; margin-top: var(--space-lg); }
.log-missing-note {
  margin-top: var(--space-sm);
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--warning);
}
.log-parsed-row.missing input[placeholder="reps?"] {
  border-color: var(--warning);
  color: var(--warning);
}

/* ---- Start-workout chooser ---- */
.ws-option {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  cursor: pointer;
}
.ws-option:active { transform: scale(0.99); }
.ws-option-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.ws-option-sub { font-size: 0.82rem; color: var(--text-secondary); }
.ws-back {
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 4px 0 var(--space-sm);
  cursor: pointer;
}
.ws-list { display: flex; flex-direction: column; gap: var(--space-sm); max-height: 60vh; overflow-y: auto; }
.ws-empty { color: var(--text-secondary); text-align: center; padding: var(--space-lg) 0; }
.ws-card {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
}
.ws-card-main { flex: 1; min-width: 0; cursor: pointer; }
.ws-card-title { font-size: 0.98rem; font-weight: 700; color: var(--text-primary); }
.ws-card-sub { font-size: 0.8rem; color: var(--text-secondary); }
.ws-go {
  flex: 0 0 auto;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--lime-border);
  background: var(--lime-subtle);
  color: var(--lime);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}
.ws-del {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  border-radius: 999px;
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
  font-size: 1.1rem;
  cursor: pointer;
}
.ws-name-input {
  width: 100%;
  padding: 12px var(--space-md);
  margin-bottom: var(--space-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 0.95rem;
}
.ws-save-list { display: flex; flex-direction: column; gap: 6px; max-height: 40vh; overflow-y: auto; }
.ws-save-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 10px;
  font-size: 0.92rem;
  color: var(--text-primary);
}
.ws-save-row .ws-muscle { font-size: 0.78rem; color: var(--text-tertiary); }
.ws-detail-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

/* ---- Timed hold: count-up stopwatch ---- */
.focus-stopwatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg);
  border: 1px solid var(--border-primary);
  border-radius: 16px;
  background: var(--bg-card);
}
.focus-sw-time {
  font-size: 3rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  line-height: 1;
}
.focus-sw-goal {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
}
.focus-sw-btn {
  margin-top: 4px;
  padding: 12px 28px;
  border-radius: 999px;
  border: none;
  background: var(--lime);
  color: var(--bg-primary);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}
.focus-sw-btn.running {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
}
.focus-sw-btn:active { transform: scale(0.97); }

/* ---- Log sheet: Reps/Time mode toggle ---- */
.log-mode-toggle {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin: 0 0 var(--space-md);
  background: var(--bg-secondary);
  border-radius: 999px;
}
.log-mode-opt {
  flex: 1;
  padding: 9px 12px;
  border: none;
  border-radius: 999px;
  background: none;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}
.log-mode-opt.active {
  background: var(--lime);
  color: var(--bg-primary);
}
.log-dur-input {
  flex: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

