/* ═══════════════════════════════════
   TOKENS
════════════════════════════════════ */
:root {
  --bg:        #0d0d0d;
  --surface:   #181818;
  --surface2:  #222222;
  --border:    #2c2c2c;
  --text:      #f0f0f0;
  /* 6.3: was #777, which failed AA on every surface (4.34 / 3.97 / 3.55 against
     --bg / --surface / --surface2). #999 clears 4.5:1 on all three with real
     headroom (6.82 / 6.10 / 5.58), so a future surface tweak can't silently
     drop it back under. 76 usages — this is the app's whole secondary tier. */
  --muted:     #999;
  --accent:    #c8ff57;   /* lime */
  /* Two reds on purpose (6.3). --danger is bright enough to read as TEXT on the
     dark surfaces (10 such uses); white on it as a BUTTON FILL was only 3.47:1,
     and .btn-danger's label is 1rem/800 = 16px, which is not WCAG "large text",
     so 4.5 applies. --danger-solid is the fill: #fff on it is 4.81:1.
     Darkening the single token instead would have traded one failure for ten. */
  --danger:       #ff4040;
  --danger-solid: #d92d2d;
  --radius:    14px;
  --font:      -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, sans-serif;
}

/* ═══════════════════════════════════
   RESET
════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  height: 100%;
  background: var(--bg);
}

body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  overflow: hidden;
}

/* ═══════════════════════════════════
   SCREEN ROUTER
════════════════════════════════════ */
.screen {
  display: none;
  height: 100dvh;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

/* ═══════════════════════════════════
   IDLE
════════════════════════════════════ */
.idle-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px 24px;
}

.app-title {
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: -2px;
  color: var(--accent);
  line-height: 1;
}

.idle-subtitle {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 12px;
  text-align: center;
}

/* Hook variant — carries last-session context, so it reads as content, not chrome */
.idle-subtitle--hook {
  color: var(--text);
  max-width: 300px;
  line-height: 1.45;
}

/* — Recovery screen (corrupt database) — */
.recovery-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--danger);
  text-align: center;
}

.recovery-body {
  font-size: 0.95rem;
  color: var(--text);
  max-width: 300px;
  line-height: 1.5;
  text-align: center;
  margin-bottom: 8px;
}

.recovery-hint {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  margin-bottom: 8px;
}

/* — Week strip — */
.week-strip {
  width: 100%;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.week-strip-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.week-strip-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.week-strip-streak {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
}

.week-strip-days {
  display: flex;
  justify-content: space-between;
  padding: 0 4px;
}

.week-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.week-day-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--border);
}

.week-day--trained .week-day-dot {
  background: var(--accent);
  border-color: var(--accent);
}

.week-day--today .week-day-dot { border-color: var(--text); }

.week-day-letter {
  font-size: 0.65rem;
  color: var(--muted);
}

.week-day--today .week-day-letter {
  color: var(--text);
  font-weight: 700;
}

/* — Muscle coverage row (inside the week-strip card) — */
.week-strip-coverage {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.coverage-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.7rem;
  color: var(--muted);
}

.coverage-chip--hit {
  border-color: transparent;
  background: rgba(200, 255, 87, 0.12);
  color: var(--accent);
  font-weight: 600;
}

.coverage-chip-count {
  font-weight: 700;
  font-size: 0.65rem;
  opacity: 0.85;
}

.idle-plan-line {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

/* — Link row — */
.idle-links {
  display: flex;
  gap: 28px;
  margin-top: 12px;
}

/* Pre-session day chooser link (5.3). Compound selector: must outrank
   .btn-text's accent color, which appears later */
.btn-text.idle-start-day-link {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 10px;
}

/* Compound selector: must outrank .btn-text's accent color, which appears later */
.btn-text.idle-link {
  color: var(--muted);
  font-size: 0.85rem;
}

/* ═══════════════════════════════════
   BUTTONS
════════════════════════════════════ */
.btn-primary {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  padding: 16px 28px;
  letter-spacing: 0.01em;
  transition: opacity 0.1s;
  -webkit-appearance: none;
}
.btn-primary:active { opacity: 0.75; }

.btn-large {
  width: 100%;
  font-size: 1.1rem;
  padding: 20px;
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  padding: 16px 24px;
  transition: background 0.1s;
  -webkit-appearance: none;
}
.btn-secondary:active { background: var(--border); }

.btn-danger {
  background: var(--danger-solid);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  padding: 16px 24px;
  transition: opacity 0.1s;
  -webkit-appearance: none;
}
.btn-danger:active { opacity: 0.8; }

/* An <a> wearing a button class (6.7, Settings → About GymOps). Anchors don't
   centre their own text or drop their underline, and they size to content
   rather than filling a flex column — these four lines are the whole gap
   between a link and the button it sits next to. */
.btn-link {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
}

.btn-text {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 10px;
  -webkit-appearance: none;
}

/* ═══════════════════════════════════
   KEYBOARD FOCUS (6.3)
   The app had no focus indicator of any kind on buttons — a keyboard or
   switch user could not tell where they were. :focus-visible (not :focus) so
   a tap never leaves a ring behind on touch, which is why this was safe to
   make global. Lime reads against every surface (16.6:1 on --bg) and the
   offset keeps it clear of the element's own rounding.
════════════════════════════════════ */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Inside the danger fill the lime ring is illegible; white reads on both the
   red and the surface behind it. */
.btn-danger:focus-visible {
  outline-color: #fff;
}

/* Picker/merge rows sit flush against each other, so an outset ring would be
   clipped by the neighbouring row — inset it instead. */
.exercise-list li:focus-visible {
  outline-offset: -3px;
}

/* ═══════════════════════════════════
   WORKOUT SCREEN
════════════════════════════════════ */
.workout-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* — Top section (above the fold) — */
/* Vertical budget matters here: every px of padding/gap comes straight out
   of .sets-log (the flex:1 internal scroller below). Keep gaps tight —
   at 375×667 with the rest bar up the log was down to one visible row. */
.top-section {
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.last-session {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.3;
}

.exercise-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.exercise-name {
  font-size: 1.25rem;
  font-weight: 700;
  flex: 1;
  min-width: 0; /* allow shrink so the Plan/Day chips + Change never overflow the row */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}

/* — Stats — */
.set-info-row {
  display: flex;
  gap: 0;
}

.stat-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 20px 4px 0;
}

.set-info-row .stat-block + .stat-block {
  padding: 4px 0 4px 20px;
  border-left: 1px solid var(--border);
}

.stat-label {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.stat-value--timer {
  font-size: 1.2rem;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* — Input — */
.input-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-row {
  display: flex;
  gap: 10px;
}

.input-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 0;
}

.input-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
}

.input-col .set-input {
  width: 100%;
}

.set-input {
  width: 100%;
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 2.2rem;
  font-weight: 800;
  padding: 18px 20px;
  text-align: center;
  letter-spacing: 0.15em;
  outline: none;
  transition: border-color 0.15s;
  caret-color: var(--accent);
  font-family: var(--font);
  -webkit-appearance: none;
}

.set-input:focus {
  border-color: var(--accent);
}

.set-input::placeholder {
  color: var(--muted);
  font-style: italic;
  letter-spacing: 0.05em;
}

.input-hint {
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
}

.input-error {
  font-size: 0.85rem;
  color: var(--danger);
  text-align: center;
  padding: 2px 0;
  font-weight: 600;
}

/* Inline lbs↔kg converter under the weight input (5.2.x #5) */
.weight-convert {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  padding: 2px 0;
}

.hidden { display: none !important; }

/* ═══════════════════════════════════
   TOAST
════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  z-index: 400;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  white-space: nowrap;
  max-width: calc(100% - 40px);
  text-align: center;
}

.toast.show { opacity: 1; }

.toast.error {
  border-color: var(--danger);
  color: var(--danger);
}

/* — Action buttons — */
.action-buttons {
  display: flex;
  gap: 12px;
}

.action-buttons .btn-secondary,
.action-buttons .btn-danger {
  flex: 1;
}

/* — Up Next hint — */
.up-next-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  cursor: pointer;
}

.up-next-label {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  flex-shrink: 0;
}

.up-next-name {
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 600;
}

.up-next-arrow {
  font-size: 0.9rem;
  color: var(--muted);
}

/* — Progression signal — */
.progression-signal {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  padding-top: 10px;
}

/* — Sets log — */
.sets-log {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 20px 24px;
}

/* Log Set slimmed on the active screen only — btn-large's 20px padding is
   fine in modals/idle but here it starves the sets log */
#btn-log-set { padding: 16px; }

.sets-log-title {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-bottom: 10px;
}

.sets-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.set-item {
  background: var(--surface);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.set-item-exercise {
  font-size: 0.875rem;
  color: var(--muted);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.set-item-details {
  font-size: 0.925rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}

.sets-empty {
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
  padding: 24px 0;
}

/* — Rest timer bar — compact so it steals as little height as possible
   from the This Session log below it (5.2.x #3) */
.rest-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.rest-label {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  flex: 1;
}

.rest-countdown {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
  min-width: 52px;
  text-align: center;
}

/* One-off ±30s adjust on the running countdown (5.2.x #4) */
.rest-adjust {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 10px;
  cursor: pointer;
}

.rest-adjust:active { background: var(--border); }

.rest-skip {
  flex: 1;
  text-align: right;
  font-size: 0.85rem;
  color: var(--muted);
}

.set-delete-btn {
  background: none;
  border: none;
  padding: 4px 2px;
  cursor: pointer;
  font-size: 0.85rem;
  opacity: 0.35;
  flex-shrink: 0;
  line-height: 1;
}
.set-delete-btn:active { opacity: 0.7; }

.set-item--confirming {
  justify-content: space-between;
  gap: 8px;
}
.set-delete-confirm-msg {
  font-size: 0.875rem;
  color: var(--text);
  flex: 1;
}
.set-delete-confirm-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}
.set-delete-cancel {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0;
}
.set-delete-confirm {
  font-size: 0.8rem;
  padding: 6px 12px;
  border-radius: 8px;
}

/* ═══════════════════════════════════
   COMPLETED
════════════════════════════════════ */
.completed-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 32px 24px;
  text-align: center;
}

.completed-label {
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: -0.5px;
}

.completed-summary {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 16px;
}

.completed-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

/* ═══════════════════════════════════
   EXERCISE PICKER (bottom sheet)
════════════════════════════════════ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
}

.modal.hidden { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.modal-sheet {
  position: relative;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 480px;
  padding: 12px 20px 40px;
  max-height: 72vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 18px;
  flex-shrink: 0;
}

.modal-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.exercise-list {
  list-style: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  margin-bottom: 8px;
}

.exercise-list li {
  display: flex;
  align-items: center;
  padding: 14px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.1s;
  border-bottom: 1px solid var(--border);
}

.exercise-list li:last-child {
  border-bottom: none;
}

.exercise-list li:active {
  background: var(--surface2);
}

.exercise-list li.selected {
  color: var(--accent);
  font-weight: 700;
}

.exercise-list li.exercise-done {
  color: var(--muted);
}

.exercise-list li.exercise-done::after {
  content: ' ✓';
  color: var(--accent);
  opacity: 0.6;
  font-size: 0.85em;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-cancel {
  width: 100%;
  text-align: center;
  padding: 12px;
  flex-shrink: 0;
  color: var(--muted);
}

.other-name-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  padding-bottom: 8px;
}

.other-name-section.hidden { display: none; }

.other-name-input {
  font-size: 1.4rem;
  padding: 14px 16px;
}

.other-type-prompt {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.other-type-prompt.hidden { display: none; }

.other-type-label {
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
}

.other-type-actions {
  display: flex;
  gap: 10px;
}

.other-type-actions .btn-secondary {
  flex: 1;
}

/* ═══════════════════════════════════
   SETTINGS
════════════════════════════════════ */
.settings-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 24px 40px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.settings-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.settings-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.unit-toggle {
  display: flex;
  gap: 8px;
}

.unit-btn,
.reminder-btn,
.rest-btn {
  flex: 1;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.unit-btn--active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}

/* Search field at the top of the picker — never autofocused (keyboard pop
   mid-workout is friction); type="search" gives the native clear button. */
.picker-search {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 1rem;
  padding: 10px 12px;
  margin-bottom: 8px;
  -webkit-appearance: none;
}

.picker-search:focus {
  outline: none;
  border-color: var(--accent);
}

/* Muscle-group filter chips — one horizontally scrollable row */
.picker-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin-bottom: 8px;
  padding-bottom: 2px;
  /* A horizontal scroll container resolves its flex min-height to 0, so without
     this the row is what gives when .modal-sheet hits max-height:72vh — at
     375x667 with the full catalogue it collapsed to ~6px and the group filters
     became untappable. Same guard .modal-handle / .modal-title already carry. */
  flex-shrink: 0;
}

.picker-chips::-webkit-scrollbar { display: none; }

.picker-chip {
  flex: 0 0 auto;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 5px 12px;
}

.picker-chip--active {
  border-color: var(--accent);
  color: var(--accent);
}

/* Non-clickable hint when a search has no matches */
.picker-empty {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 12px 4px;
}

.picker-sort-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.picker-sort-btn {
  flex: 1;
  padding: 7px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.picker-sort-btn--active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}

.settings-hint {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

/* Connection state for the Google Drive card (6.6). Reads as a status line,
   not a tappable row — the buttons below it own the interaction. */
.settings-status {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}

.settings-status--on {
  color: var(--accent);
}

/* Usage counters (6.9). A label/value pair per row on one line — deliberately
   plain: this is a readout, not a dashboard, and it sits below every control a
   user actually came to Settings for. */
.usage-list {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 4px 14px;
}

.usage-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}

.usage-row:last-child { border-bottom: none; }

.usage-row-label {
  font-size: 0.875rem;
  color: var(--muted);
}

/* Tabular figures so the column of numbers doesn't jitter as digits change. */
.usage-row-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* Inline failure under a Settings action (e.g. a declined Drive consent).
   Inline rather than a toast: the user is looking right at the control that
   failed and needs the instruction to still be there when they retry. */
.settings-error {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--danger);
  text-align: center;
}

.settings-version {
  margin-top: auto;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  opacity: 0.6;
}

.export-date-row {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.export-date-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.export-date-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.export-date-input {
  color-scheme: dark;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 1rem;
  width: 100%;
  box-sizing: border-box;
}

.release-notes-scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  margin-bottom: 16px;
}

.release-notes-entry {
  margin-bottom: 20px;
}

.release-notes-version {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 8px;
}

.release-notes-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.release-notes-list li {
  position: relative;
  padding: 3px 0 3px 14px;
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.45;
}

.release-notes-list li::before {
  content: '·';
  position: absolute;
  left: 0;
  color: var(--muted);
}

.settings-danger-link {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
  padding: 8px 0 0;
  cursor: pointer;
  opacity: 0.5;
}

.modal-body {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 8px;
}

/* ═══════════════════════════════════
   SESSION REMINDER BANNER
════════════════════════════════════ */
.reminder-banner {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.reminder-text {
  font-size: 0.95rem;
  color: var(--text);
}

.reminder-dismiss {
  font-size: 0.85rem;
  color: var(--muted);
  flex-shrink: 0;
}

/* ═══════════════════════════════════
   SESSION COMPLETION SIGNAL
════════════════════════════════════ */
.session-signal-sheet {
  padding: 20px 24px 36px;
}

.session-signal-lines {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.session-signal-line {
  font-size: 1rem;
  color: var(--text);
}

.session-signal-interpretation {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
  opacity: 0.85;
  margin-bottom: 24px;
}

/* ═══════════════════════════════════
   SESSION NOTES
════════════════════════════════════ */
.notes-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.notes-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
  font-family: var(--font);
  line-height: 1.5;
  padding: 12px 14px;
  resize: none;
  min-height: 80px;
  outline: none;
  transition: border-color 0.15s;
  caret-color: var(--accent);
  -webkit-appearance: none;
  display: block;
}

.notes-input:focus {
  border-color: var(--accent);
}

.notes-input::placeholder {
  color: var(--muted);
}

/* ════════════════════════════════════
   AI SUMMARY
════════════════════════════════════ */
.ai-key-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 1rem;
  font-family: monospace;
  outline: none;
  box-sizing: border-box;
  -webkit-appearance: none;
  /* Masks the key on a type="text" input so password managers stay out of it
     (5.2.x #2). Supported in Chrome + Safari — the deploy targets. */
  -webkit-text-security: disc;
}

.ai-key-input:focus {
  border-color: var(--accent);
}

.ai-key-input::placeholder {
  color: var(--muted);
}

.ai-summary-text {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.6;
  padding: 8px 0 20px;
  white-space: pre-wrap;
  min-height: 60px;
}

.ai-summary-text.loading {
  color: var(--muted);
  font-style: italic;
}

.ai-summary-text.error {
  color: var(--danger);
}

/* ════════════════════════════════════
   PLANS
════════════════════════════════════ */
.plan-expiry-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  gap: 8px;
  width: 100%;
}

.plan-expiry-text {
  font-size: 0.85rem;
  color: var(--muted);
  flex: 1;
}

.plan-expiry-action {
  font-size: 0.85rem;
  color: var(--accent);
  white-space: nowrap;
  padding: 0;
}

/* All-time PRs set this session (Agent 1 debrief). Accent, unlike the muted
   adherence line below it — this is the one line on the screen that should
   catch the eye, and it echoes the lime of the PR celebration it follows. */
.completed-prs {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
  margin-top: 8px;
  white-space: pre-line; /* multiple PRs list one per line — see renderSessionPRs */
  line-height: 1.45;
}

.completed-plan-adherence {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 4px;
  white-space: pre-line; /* 5.5: header / progress / skipped as separate lines */
  line-height: 1.5;
}

/* Drive upload state on the completed screen */
.drive-status {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 8px;
}

.drive-status--fail {
  color: var(--danger);
}

/* Plans screen */
.plan-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.plan-card-empty {
  color: var(--muted);
  font-size: 0.9rem;
}

.plan-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.plan-card-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.plan-card-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 2px;
}

/* Week-coverage row on the active plan card (5.5) */
.plan-week-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0 2px;
}

.plan-week-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.plan-week-label {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-right: 2px;
}

.plan-week-chip {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
}

.plan-week-chip--done {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(200, 255, 87, 0.08);
}

.plan-week-sessions {
  font-size: 0.8rem;
  color: var(--muted);
}

.plan-objectives-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.plan-objectives-list li {
  font-size: 0.85rem;
  color: var(--muted);
  padding-left: 12px;
  position: relative;
}

.plan-objectives-list li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--accent);
}

.plan-exercises-preview {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
}

.past-plan-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.past-plan-name {
  font-size: 0.9rem;
  color: var(--muted);
}

/* Plan editor */
.plan-text-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 1rem;
  font-family: var(--font);
  outline: none;
  -webkit-appearance: none;
}

.plan-text-input:focus {
  border-color: var(--accent);
}

.plan-text-input::placeholder {
  color: var(--muted);
}

.plan-duration-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.plan-duration-input {
  width: 90px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  -webkit-appearance: none;
  text-align: center;
}

.plan-duration-input:focus {
  border-color: var(--accent);
}

.plan-duration-label {
  font-size: 0.9rem;
  color: var(--muted);
}

.plan-exercise-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.plan-exercise-row-name {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text);
  min-width: 0;
}

.plan-exercise-row-targets {
  display: flex;
  align-items: center;
  gap: 4px;
}

.plan-target-input {
  width: 48px;
  padding: 8px 2px; /* 1rem font is the iOS no-zoom floor (4.7) — width comes from trimming padding, not the font */
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 1rem;
  text-align: center;
  outline: none;
  -webkit-appearance: none;
}

.plan-target-input:focus {
  border-color: var(--accent);
}

.plan-target-sep {
  font-size: 0.85rem;
  color: var(--muted);
}

.plan-exercise-remove {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 4px 8px;
}

/* Multi-day plans (5.2) — stacked day sections in the editor */
.plan-day-section {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 12px;
}

.plan-day-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.plan-day-name-input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font);
  padding: 6px 2px;
  outline: none;
  -webkit-appearance: none;
}

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

.plan-day-name-input::placeholder {
  color: var(--muted);
  font-weight: 400;
}

.plan-day-exercises { margin-bottom: 10px; }

.plan-day-add-ex {
  width: 100%;
  font-size: 0.85rem;
  padding: 10px;
}

/* Day name lines on the plan card preview */
.plan-preview-day {
  color: var(--text);
  font-weight: 600;
}

/* Active-screen day chip — tap to switch the session's plan day */
.day-chip {
  flex: 0 0 auto;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--surface2);
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-size: 0.8rem;
  font-family: var(--font);
  padding: 4px 12px;
  cursor: pointer;
}

/* View-plan chip (active screen) — muted sibling of the accent day-chip */
.plan-chip {
  flex: 0 0 auto;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.8rem;
  font-family: var(--font);
  padding: 4px 12px;
  cursor: pointer;
  white-space: nowrap;
}

/* Current-plan viewer bottom sheet */
.plan-view-sub {
  font-size: 0.85rem;
  color: var(--muted);
  margin: -6px 0 12px;
  flex-shrink: 0;
}

.plan-view-list {
  list-style: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  margin: 0 0 8px;
}

.plan-view-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 6px;
  border-bottom: 1px solid var(--border);
  font-size: 1rem;
}

.plan-view-item:last-child { border-bottom: none; }

.plan-view-status {
  flex: 0 0 16px;
  text-align: center;
  color: var(--muted);
}

.plan-view-ex {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-view-target {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.85rem;
}

.plan-view-item--current { color: var(--accent); font-weight: 600; }
.plan-view-item--current .plan-view-status,
.plan-view-item--current .plan-view-target { color: var(--accent); }

.plan-view-item--done .plan-view-ex { color: var(--muted); }
.plan-view-item--done .plan-view-status { color: var(--accent); }

/* Day switcher bottom sheet */
.day-switch-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0 16px;
}

.day-switch-row {
  width: 100%;
  text-align: left;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
  font-family: var(--font);
  padding: 14px 16px;
  cursor: pointer;
}

.day-switch-row--current {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* Picker plan section */
/* Compound selector: must outrank .exercise-list li's padding + border-bottom,
   which would otherwise put section labels in list-row gutters and underline
   them, making a non-interactive label read as a tappable row */
.exercise-list li.picker-section-header {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 16px 6px;
  border-bottom: none;
  list-style: none;
  pointer-events: none;
}

/* Compound selector: must outrank .exercise-list li's padding + border-bottom,
   which would otherwise inflate this 1px hairline to a 29px filled slab
   (height:1px can't shrink below the 14px/14px padding, and the background
   fills the whole padding box) */
.exercise-list li.picker-divider {
  list-style: none;
  height: 1px;
  padding: 0;
  border-bottom: none;
  background: var(--border);
  margin: 8px 0;
  pointer-events: none;
}

.picker-target-hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin-left: auto;
}

/* ════════════════════════════════════
   EXERCISE HISTORY */

/* — Exercise list — */
.history-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
}

.history-row:active { background: var(--surface2); }

.history-row-name {
  flex: 1;
  font-weight: 600;
  font-size: 0.95rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-row-meta {
  color: var(--muted);
  font-size: 0.75rem;
  flex-shrink: 0;
}

.history-row-arrow {
  color: var(--muted);
  font-size: 1rem;
}

.history-empty {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  margin-top: 40px;
  padding: 0 16px;
}

/* — Stat tiles — */
.history-stats-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.history-stat {
  flex: 1;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.history-stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.history-stat-value {
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
}

.history-stat-value.positive { color: var(--accent); }
.history-stat-value.negative { color: var(--danger); }

/* — Chart card — */
.history-chart-card {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 10px 8px 6px;
  margin-bottom: 16px;
}

.history-chart-card svg {
  display: block;
  width: 100%;
  height: auto;
  /* Vertical drags still scroll the page; horizontal drags scrub the chart */
  touch-action: pan-y;
}

.history-chart-note {
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
  padding: 6px 12px 10px;
}

.history-tooltip {
  position: absolute;
  top: 6px;
  transform: translateX(-50%);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  pointer-events: none;
  z-index: 2;
  text-align: center;
  white-space: nowrap;
}

.history-tooltip-value {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
}

.history-tooltip-date {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
}

/* — Session breakdown (the chart's table view) — */
.history-sessions-title { margin-bottom: 8px; }

.history-session-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--surface2);
  font-size: 0.9rem;
}

.history-session-date {
  color: var(--muted);
  font-size: 0.75rem;
  width: 64px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.history-session-main { flex: 1; }

.history-session-sets {
  color: var(--muted);
  font-size: 0.75rem;
  flex-shrink: 0;
}

/* ════════════════════════════════════
   QUICK LOG (one-tap set)
   5.6 prominence pass: hero (lime primary) by default when a reference
   exists; .quick-log-quiet while the user shows manual intent (typing).
   Emphasis changes are COLOR-ONLY — same padding/size in both states so
   the buttons never shift under a mid-tap finger. */
.quick-log-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 15px 14px;
  color: #000;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  min-width: 0;
  transition: opacity 0.1s;
  -webkit-appearance: none;
}

.quick-log-btn:active { opacity: 0.75; }

/* Quiet state: an input is focused or holds text — manual path leads */
.quick-log-btn.quick-log-quiet {
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text);
  font-weight: 600;
}

.quick-log-btn.quick-log-quiet:active {
  background: var(--border);
  border-color: var(--accent);
  opacity: 1;
}

/* ✓ Logged confirmation (5.2.x #1): brief white→lime flash, button text
   swapped to "✓ Logged — {value}" for the confirmation window */
.quick-log-btn.quick-log-confirm {
  animation: quick-log-flash 0.4s ease-out;
}

.quick-log-confirm .quick-log-arrow { display: none; }

@keyframes quick-log-flash {
  0%   { background-color: #ffffff; }
  100% { background-color: var(--accent); }
}

@media (prefers-reduced-motion: reduce) {
  .quick-log-btn.quick-log-confirm { animation: none; }
}

.quick-log-label {
  color: rgba(0, 0, 0, 0.65);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-log-quiet .quick-log-label { color: var(--muted); }

.quick-log-value {
  font-weight: 800;
  font-size: 1.05rem;
  white-space: nowrap;
}

.quick-log-quiet .quick-log-value {
  font-weight: 700;
  font-size: 1rem;
}

.quick-log-arrow { font-weight: 800; }

.quick-log-quiet .quick-log-arrow { color: var(--accent); }

/* Log Set demoted to secondary colours while quick-log is the hero */
.btn-primary.btn-demoted {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 600;
}

.btn-primary.btn-demoted:active {
  background: var(--border);
  opacity: 1;
}

/* ════════════════════════════════════
   STORAGE-FULL BANNER (persist failure, 4.4) */
.persist-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 150; /* above screens + PR overlay (60), below modals (200) */
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: #2a1212;
  border-bottom: 1px solid var(--danger);
}

.persist-banner-text {
  flex: 1;
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text);
}

.persist-banner-text strong {
  color: var(--danger);
  display: block;
}

.persist-banner-btn {
  flex-shrink: 0;
  padding: 10px 14px;
  font-size: 0.8125rem;
}

/* ════════════════════════════════════
   PR CELEBRATION */
.pr-celebration {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 13, 13, 0.6);
}

.pr-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 26px 36px;
  animation: pr-pop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.pr-trophy {
  font-size: 2.4rem;
  line-height: 1;
}

.pr-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.pr-detail {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}

@keyframes pr-pop {
  0%   { transform: scale(0.6); opacity: 0; }
  60%  { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* Confetti burst — pieces fly out from centre on per-piece --dx/--dy/--rot */
.pr-confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.pr-confetti-piece {
  position: absolute;
  top: 42%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  opacity: 0;
  animation: pr-confetti 0.9s ease-out both;
}

@keyframes pr-confetti {
  0%   { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .pr-confetti-piece { display: none; }
  .pr-card { animation: none; }
}

/* ════════════════════════════════════
   PLAN NUDGE BANNER */
.plan-nudge-banner {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.plan-nudge-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  text-align: left;
}

/* ═══════════════════════════════════
   FIRST RUN + INSTALL (6.1)
════════════════════════════════════ */

/* Orientation card. Deliberately quieter than the plan-nudge banner (no accent
   border): it is context, not a call to action — the lime Start button below
   it must stay the loudest thing on a first-run screen. */
.first-run-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.first-run-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
}

.first-run-body {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.45;
}

.first-run-hint {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
}

/* Compound selector: must outrank .btn-text's accent colour, declared earlier */
.btn-text.first-run-dismiss {
  align-self: flex-end;
  padding: 4px 0 0;
  font-size: 0.85rem;
}

/* Install ask — same shape as the plan-nudge banner so it reads as the same
   class of object, with the accent border since it does carry an action. */
.install-card {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.install-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  text-align: left;
}

.btn-text.install-action {
  flex-shrink: 0;
  font-weight: 800;
}

/* ═══════════════════════════════════
   IMPORT FLOW (6.2)
════════════════════════════════════ */

/* Stage container — sheet content swaps in place rather than the sheet
   resizing between four separate modals. */
.import-stage {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Multi-line stats block. pre-line so the summary reads as a short list
   without an extra element per line (same trick as plan adherence). */
.import-summary {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.5;
  white-space: pre-line;
  text-align: left;
}

/* The unresolved-name list. Capped and scrollable: a messy export can produce
   a lot of these, and the Import button must stay reachable without scrolling
   the whole sheet past it. */
.import-decisions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 34vh;
  overflow-y: auto;
}

.import-decision {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.import-decision-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  word-break: break-word;
}

.import-decision-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.import-choice {
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 12px;
  cursor: pointer;
  -webkit-appearance: none;
}

.import-choice--active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}

/* Import entry points outside Settings (6.2). Compound selectors: both must
   outrank .btn-text's accent colour and padding, declared earlier. */
.btn-text.first-run-import {
  align-self: flex-start;
  padding: 2px 0;
  font-size: 0.82rem;
  text-align: left;
}

.btn-text.history-empty-import {
  display: block;
  margin: 4px auto 0;
  font-size: 0.85rem;
}

/* ═══════════════════════════════════
   MERGE EXERCISE (6.2)
════════════════════════════════════ */

/* The detail screen's actions moved off the header row when Merge joined
   Rename: at 375px "← Back" plus both buttons leave ~70px for the exercise
   name, which truncates anything longer than "Dips". Compound selector —
   .settings-header's 32px margin is declared earlier and would otherwise
   strand the actions row halfway down the screen. */
.settings-header.exercise-history-header {
  margin-bottom: 8px;
}

.exercise-history-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  margin-bottom: 20px;
}

/* Long custom names still can't push Back off the row. */
.exercise-history-header .settings-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Same flex-shrink guard the picker's chips row needed: inside a sheet capped
   at 72vh, anything without it collapses so the scrolling list can grow. */
#merge-search {
  flex-shrink: 0;
  font-size: 1rem;
  margin-bottom: 10px;
}

.exercise-list.merge-list {
  min-height: 120px;
}

/* Compound selector: .exercise-list li is (0,1,1) and would otherwise keep its
   row padding, underline and pointer cursor on a non-tappable note. */
.exercise-list li.merge-empty {
  color: var(--muted);
  font-size: 0.85rem;
  padding: 14px 12px;
  border-bottom: none;
  cursor: default;
  pointer-events: none;
}

#merge-exercise-body,
#merge-exercise-error {
  flex-shrink: 0;
}

#merge-exercise-modal .modal-actions {
  flex-shrink: 0;
}
