/* ============================================================
   Midnight Instrument — dark athletic minimal
   Graphite ground · signal-amber accent · IBM Plex Mono readouts
   Archivo signage headings · Newsreader only for the coach's
   letters. Hairline borders, no shadows. The signature is the
   descent chart: one amber phosphor line crossing two checkpoints
   before falling into the 55 kg goal band.
   Dark is canonical; [data-theme="light"] is the daylight
   variant of the same instrument.
   ============================================================ */

:root {
  color-scheme: dark;

  /* Surfaces & ink */
  --bg:          #0B0D0E;
  --bg-glow:     #111417;
  --surface:     #131619;
  --surface-2:   #1A1E22;
  --ink:         #E8EBED;
  --ink-soft:    #C0C7CC;
  --muted:       #8B949B;
  --faint:       #626C74;
  --line:        #22272C;
  --line-strong: #39424A;
  --backdrop:    rgba(1, 3, 4, 0.62);

  /* Signal colors — amber is the instrument's one hot accent */
  --pine:        #F5A83C;   /* accent */
  --pine-deep:   #FFC067;   /* accent, brighter (text on dark) */
  --pine-tint:   #2A2110;
  --on-pine:     #171004;
  --rust:        #E0764B;   /* watch / warning */
  --rust-tint:   #2C1A10;
  --danger:      #E25E4E;
  --danger-tint: #2E1511;
  --rest:        #82A9CB;
  --rest-tint:   #16202A;
  --success:     #5FBE8E;
  --success-tint:#12271C;

  /* Type */
  --font-ui:    'Archivo', system-ui, -apple-system, sans-serif;
  --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-mono:  'IBM Plex Mono', ui-monospace, 'SF Mono', monospace;

  /* Shape — hairlines carry the depth; no shadows */
  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    none;
}

/* Daylight variant. The inline boot script in index.html/login.html stamps a
   resolved `data-theme` of light|dark on <html> before first paint, folding
   the "system" preference into one of the two. */
:root[data-theme="light"] {
  color-scheme: light;

  --bg:          #EFF1F2;
  --bg-glow:     #F7F8F8;
  --surface:     #FBFCFC;
  --surface-2:   #E9ECED;
  --ink:         #191D20;
  --ink-soft:    #3A4147;
  --muted:       #59636A;
  --faint:       #626C73;
  --line:        #DCE0E2;
  --line-strong: #C0C7CB;
  --backdrop:    rgba(20, 24, 27, 0.5);

  --pine:        #8B5907;
  --pine-deep:   #7E5108;
  --pine-tint:   #F4E7CE;
  --on-pine:     #FFFDF7;
  --rust:        #9F4E29;
  --rust-tint:   #F6E5DA;
  --danger:      #B0402F;
  --danger-tint: #F6E0DB;
  --rest:        #48688A;
  --rest-tint:   #E3EAF1;
  --success:     #2B744D;
  --success-tint:#DFEEE4;
}

/* ============================================================
   Reset & base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4, p { margin: 0; }

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

:focus-visible {
  outline: 2px solid var(--pine);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: var(--pine-tint); }

.hidden { display: none !important; }
.w-full { width: 100%; }
.pb-safe { padding-bottom: 0; }

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

/* Numerals read as instrument output everywhere */
.form-input, .stepper input, .rir-input, strong, td, .cardio-timer__clock {
  font-variant-numeric: tabular-nums;
}

/* Small uppercase label used only where compact instrument metadata helps. */
.kicker {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ============================================================
   App shell
   ============================================================ */
#app-shell {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.offline-banner {
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 30;
  width: min(100%, 560px);
  transform: translateX(-50%);
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line-strong);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  font-size: 0.8125rem;
  font-weight: 600;
  text-align: center;
}

#app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 20px 10px;
  background: var(--bg);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
}

.brand-mark { width: 20px; height: 20px; color: var(--pine); }

.header-brand h1 {
  font-size: 0.9375rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.header-btns { display: flex; gap: 4px; }

#tab-content {
  flex: 1;
  padding: 12px 16px 110px;
}

#workout-content { padding-bottom: 112px; }

.tab-panel { display: none; }
.tab-panel.active {
  display: block;
  animation: panel-in 0.18s ease-out both;
}

@keyframes panel-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Bottom tab bar */
#tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  z-index: 20;
  transform: translateX(-50%);
  width: 100%;
  max-width: 560px;
  display: flex;
  justify-content: space-around;
  padding: 8px 24px calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}

.tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 76px;
  padding: 6px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--faint);
  font-size: 0.65625rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  transition: color 0.15s ease;
}

.tab-btn svg { width: 22px; height: 22px; }
.tab-btn.active { color: var(--pine-deep); }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: transform 0.06s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:active { transform: scale(0.985); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary, .btn-cta {
  background: var(--pine);
  color: var(--on-pine);
}
.btn-primary:not(:disabled):hover, .btn-cta:not(:disabled):hover { background: var(--pine-deep); }

.btn-primary:disabled,
.btn-secondary:disabled {
  opacity: 1;
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--muted);
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}
.btn-secondary:not(:disabled):hover { border-color: var(--faint); }

.btn-ghost {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 8px 10px;
  min-height: 44px;
  border-radius: var(--radius-sm);
}
.btn-ghost:hover { color: var(--ink); background: var(--surface-2); }

.btn-danger {
  background: transparent;
  border-color: color-mix(in srgb, var(--danger) 40%, transparent);
  color: var(--danger);
}
.btn-danger:not(:disabled):hover { background: var(--danger-tint); }

.btn-undo { color: var(--danger); }

.btn-sm { min-height: 34px; padding: 6px 12px; font-size: 0.8125rem; }
.btn-start { font-size: 1rem; }
.btn-change { align-self: center; }
.btn-view-plan { padding-left: 0; }

/* ============================================================
   Forms & messages
   ============================================================ */
.form-group { margin-bottom: 14px; }

.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.71875rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.form-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 1rem;
  transition: border-color 0.15s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--pine);
  box-shadow: 0 0 0 3px var(--pine-tint);
}

.form-input--weight {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 600;
  text-align: center;
  letter-spacing: -0.01em;
}

textarea.form-input { resize: vertical; line-height: 1.4; }

.msg {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 550;
  margin: 10px 0;
}
.msg-error { background: var(--danger-tint); color: var(--danger); }
.msg-success { background: var(--success-tint); color: var(--success); }

.flash-msg { min-height: 4px; }
.flash-msg .msg { margin: 8px 0 0; }

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 64px 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.spinner {
  width: 26px;
  height: 26px;
  border: 2.5px solid var(--line);
  border-top-color: var(--pine);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center;
  padding: 72px 24px;
  color: var(--muted);
}
.empty-state h3 { color: var(--ink); font-size: 1.125rem; margin: 14px 0 4px; }
.empty-state p { font-size: 0.875rem; margin-bottom: 20px; }
.empty-state .btn { max-width: 220px; margin: 0 auto; }
.empty-icon { color: var(--faint); display: flex; justify-content: center; }

/* ============================================================
   Cards — hairline panels, no shadows
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}

/* ============================================================
   Home: one action, one visible schedule, secondary detail folded
   ============================================================ */
.today { padding: 12px 4px 4px; margin-bottom: 4px; }

.today__topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.today__date {
  font-family: var(--font-mono);
  font-size: 0.71875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0;
}

.today__title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.05;
  margin-top: 6px;
  margin-bottom: 8px;
}

.today--rest .today__title { color: var(--rest); }
.today--active .today__title { color: var(--pine-deep); }

.today__lead {
  max-width: 42ch;
  color: var(--ink-soft);
  font-size: 0.875rem;
}

.home-schedule {
  margin-top: 18px;
  padding: 14px 0 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.home-schedule__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.home-schedule__head h3 {
  font-size: 0.9375rem;
  font-weight: 750;
}

.home-schedule__head p {
  max-width: 38ch;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.71875rem;
  line-height: 1.4;
}

.home-schedule__head .btn-view-plan {
  min-height: 36px;
  margin-top: -6px;
  padding: 6px 8px;
  white-space: nowrap;
}

.cycle-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.cycle-strip__slot {
  min-width: 0;
  min-height: 62px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  text-align: center;
}

.cycle-strip__slot.is-rest { background: var(--surface-2); }
.cycle-strip__slot.is-current {
  border-color: var(--pine);
  background: var(--pine);
  color: var(--on-pine);
}

.cycle-strip__number {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
}

.cycle-strip__name {
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1.12;
}

.pace-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.71875rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: var(--surface-2);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}
.pace-chip--good    { background: var(--success-tint); color: var(--success); border-color: transparent; }
.pace-chip--watch   { background: var(--rust-tint);    color: var(--rust);    border-color: transparent; }
.pace-chip--bad     { background: var(--danger-tint);  color: var(--danger);  border-color: transparent; }
.pace-chip--neutral { background: var(--surface-2);    color: var(--muted); }

/* Morning weight gate */
.home-weight-gate {
  margin: 18px 0 0;
  padding: 0;
}

.home-weight-gate__row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.home-weight-gate__row .form-input--weight { max-width: 132px; min-height: 54px; }

.home-weight-gate__unit {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--muted);
}

.home-weight-gate__why { margin-left: auto; color: var(--muted); font-size: 0.75rem; }

.home-missed-weight {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin-top: 6px;
  font-size: 0.875rem;
  color: var(--ink-soft);
}

.home-missed-weight input {
  width: 20px;
  height: 20px;
  accent-color: var(--pine);
}

.home-weight-gate__hint {
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--faint);
}

.home-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.start-requirement { margin: 7px 2px 0; color: var(--muted); font-size: 0.75rem; }
.start-requirement.is-ready { color: var(--success); }

/* Home note to coach */
.home-user-note {
  margin: 12px 0 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.home-user-note > summary,
.session-details > summary {
  display: flex;
  min-height: 50px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
  color: var(--ink-soft);
  font-size: 0.875rem;
  font-weight: 700;
}

.home-user-note > summary::-webkit-details-marker,
.session-details > summary::-webkit-details-marker { display: none; }

.home-user-note__body { padding: 0 0 12px; }
.home-user-note__body p { margin-top: 6px; color: var(--muted); font-size: 0.75rem; }
.home-user-note__input { min-height: 72px; font-size: 0.9375rem; background: var(--surface); }

.save-status {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
}
.save-status--success { color: var(--success); }
.save-status--error { color: var(--danger); }

/* Workout picker */
.home-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.home-picker__item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.home-picker__item.is-selected {
  border-color: var(--pine);
  background: var(--pine-tint);
}

.home-picker__item--rest.is-selected {
  border-color: var(--rest);
  background: var(--rest-tint);
}

.home-picker__key {
  font-family: var(--font-mono);
  font-size: 0.65625rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.home-picker__name { font-size: 0.875rem; font-weight: 650; }

/* Active session strip on Home */
.active-session-summary {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--pine);
  border-radius: var(--radius);
  background: var(--pine-tint);
}
.active-session-summary > div { display: flex; justify-content: space-between; gap: 12px; }
.active-session-summary strong { font-family: var(--font-mono); }
.active-session-summary span { color: var(--muted); font-size: 0.75rem; }
.active-session-summary p { margin-top: 8px; color: var(--ink-soft); font-size: 0.8125rem; }

/* Contextual Home accessory: part of Today, secondary to the workout action. */
.grip-widget {
  margin: 16px 0 4px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.grip-widget--due {
  border-color: color-mix(in srgb, var(--pine) 72%, var(--line-strong));
  box-shadow: inset 3px 0 0 var(--pine);
}

.grip-widget__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 15px 10px;
}

.grip-widget__header h3 {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.015em;
}

.grip-widget__header p {
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.75rem;
}

.grip-widget__state {
  flex-shrink: 0;
  min-width: 90px;
  padding-left: 12px;
  border-left: 1px solid var(--line);
  text-align: right;
}

.grip-widget__state strong,
.grip-widget__state span { display: block; }

.grip-widget__state strong {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.2;
}

.grip-widget--due .grip-widget__state strong { color: var(--pine-deep); }

.grip-widget__state span {
  margin-top: 2px;
  color: var(--faint);
  font-size: 0.625rem;
  line-height: 1.2;
}

.grip-widget__cue {
  padding: 0 15px 12px;
  color: var(--ink-soft);
  font-size: 0.8125rem;
}

.grip-widget__prescription {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(118px, 0.75fr);
  margin: 0 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.grip-widget__work {
  min-width: 0;
  padding: 12px 13px;
}

.grip-widget__work > span,
.grip-widget__support dt {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.59375rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.grip-widget__work strong {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 1.25rem;
  line-height: 1.2;
}

.grip-widget__work p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.6875rem;
}

.grip-widget__support {
  margin: 0;
  border-left: 1px solid var(--line);
}

.grip-widget__support div { padding: 8px 10px; }
.grip-widget__support div + div { border-top: 1px solid var(--line); }

.grip-widget__support dd {
  margin: 2px 0 0;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  white-space: nowrap;
}

.grip-widget__timing {
  padding: 10px 15px 12px;
  color: var(--muted);
  font-size: 0.71875rem;
}

.grip-widget__guide { border-top: 1px solid var(--line); }

.grip-widget__guide > summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 15px;
  cursor: pointer;
  list-style: none;
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 700;
}

.grip-widget__guide > summary::-webkit-details-marker { display: none; }
.grip-widget__guide > summary:active { transform: translateY(1px); }

.grip-widget__guide > summary span:last-child {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 600;
}

.grip-widget__guide-body {
  display: grid;
  gap: 10px;
  padding: 0 15px 14px;
}

.grip-widget__guide-body > p:not(.grip-widget__equipment) {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 10px;
  color: var(--ink-soft);
  font-size: 0.75rem;
}

.grip-widget__guide-body strong { color: var(--ink); }

.grip-widget__equipment {
  color: var(--faint);
  font-size: 0.6875rem;
}

.home-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 6px 8px;
}

.home-foot > span:first-child { color: var(--muted); font-size: 0.75rem; }

.home-foot__meta {
  font-family: var(--font-mono);
  font-size: 0.71875rem;
  color: var(--faint);
  text-align: right;
}

/* One secondary disclosure replaces the former stack of dashboard cards. */
.home-more {
  margin: 0 0 12px;
  border-bottom: 1px solid var(--line);
}

.home-more > summary {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 4px;
  cursor: pointer;
  list-style: none;
}

.home-more > summary::-webkit-details-marker { display: none; }
.home-more > summary > span:first-child { min-width: 0; }
.home-more > summary strong { display: block; font-size: 0.9375rem; }
.home-more > summary small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.71875rem;
  font-weight: 400;
}

.home-more__status {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
}

.home-more > summary .pace-chip {
  flex-shrink: 0;
  max-width: 44%;
  justify-content: center;
  text-align: center;
}

.home-more__body { padding: 4px 0 12px; }
.home-more__body > .card,
.home-more__body > .coach-note,
.home-more__body > .adherence-panel,
.home-more__body > .fold { margin-bottom: 10px; }

/* ============================================================
   Coach note — the letter (the one serif voice)
   ============================================================ */
.coach-note {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 20px 18px;
  margin-bottom: 14px;
}

.coach-note::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 2px;
  border-radius: 0 2px 2px 0;
  background: var(--pine);
}

.coach-note__meta {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}

.coach-note__seal {
  font-size: 0.65625rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--pine-deep);
}

.coach-note__day {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--faint);
}

.coach-note__title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.coach-note__body p {
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

.coach-note__body p + p { margin-top: 0.55em; }

.coach-note--workout { padding: 14px 18px 13px; }
.coach-note--workout .coach-note__body p { font-size: 1rem; }

/* ============================================================
   Cut card — the descent (signature)
   ============================================================ */
.cut-card { padding-bottom: 12px; }

.cut-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.cut-card__title {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-top: 3px;
}

.cut-card__title span {
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
}

.cut-card__phase {
  font-family: var(--font-mono);
  font-size: 0.71875rem;
  line-height: 1.5;
  color: var(--muted);
  margin: -2px 0 8px;
}

.cut-card__phase strong {
  color: var(--ink-soft);
  font-weight: 600;
}

.cut-chart { margin: 4px -6px 10px; }

.dc-svg { width: 100%; height: auto; display: block; }

.dc-band  { fill: var(--pine-tint); opacity: 0.8; }
.dc-guide { fill: none; stroke: var(--line-strong); stroke-width: 1.5; stroke-dasharray: 2 5; stroke-linecap: round; stroke-linejoin: round; }
.dc-line  {
  fill: none;
  stroke: var(--pine);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  /* The one glow in the whole app: the descent reads as a phosphor trace. */
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--pine) 55%, transparent));
}
.dc-raw   { fill: var(--faint); opacity: 0.55; }
.dc-now   { fill: var(--pine-deep); stroke: var(--bg); stroke-width: 2; }
.dc-now-label {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  fill: var(--pine-deep);
}
.dc-axis {
  font-family: var(--font-mono);
  font-size: 15px;
  fill: var(--faint);
  text-anchor: end;
}
.dc-axis--x { text-anchor: middle; }
.dc-band-label { fill: var(--pine); opacity: 0.8; }
.dc-today { stroke: var(--line-strong); stroke-width: 1; }

.cut-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.cut-stats > div {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cut-stats span {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.cut-stats strong {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.cut-card__action {
  font-size: 0.875rem;
  font-weight: 550;
  color: var(--ink-soft);
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}

.cut-target-strip {
  font-family: var(--font-mono);
  font-size: 0.71875rem;
  line-height: 1.7;
  color: var(--muted);
  margin-top: 10px;
}

/* Cut-day ledger: a one-based countdown, independent of calendar months. */
.cut-countdown {
  margin: 14px 0;
  padding: 18px 16px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.cut-countdown__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.cut-countdown__head h3 {
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.cut-countdown__head h3 span {
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0;
}

.cut-countdown__remaining {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: var(--font-mono);
  font-size: 1.65rem;
  line-height: 1;
  color: var(--pine-deep);
}

.cut-countdown__remaining span {
  margin-top: 5px;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cut-countdown__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 14px 0 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.cut-countdown__stats span {
  min-width: 0;
  padding: 10px 8px;
  color: var(--muted);
  font-size: 0.625rem;
  text-align: center;
  text-transform: uppercase;
}

.cut-countdown__stats span + span { border-left: 1px solid var(--line); }

.cut-countdown__stats strong {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

.cut-countdown__grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.cut-day-cell {
  position: relative;
  aspect-ratio: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--faint);
}

.cut-day-cell__number {
  font-family: var(--font-mono);
  font-size: clamp(0.625rem, 2.8vw, 0.8125rem);
  font-weight: 650;
  line-height: 1;
}

.cut-day-cell small {
  overflow: hidden;
  max-width: 100%;
  padding: 0 2px;
  color: inherit;
  font-family: var(--font-mono);
  font-size: clamp(0.4375rem, 1.8vw, 0.5625rem);
  line-height: 1;
  white-space: nowrap;
}

.cut-day-cell.is-past {
  background: color-mix(in srgb, var(--pine-tint) 45%, var(--surface-2));
  color: var(--muted);
}

.cut-day-cell.is-future { opacity: 0.72; }

.cut-day-cell.is-today {
  z-index: 1;
  border-color: var(--pine);
  box-shadow: inset 0 0 0 1px var(--pine);
  background: var(--pine-tint);
  color: var(--pine-deep);
}

.cut-day-cell.has-weight { color: var(--pine-deep); }

.cut-day-cell.is-checkpoint {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink-soft);
}

.cut-day-cell.is-checkpoint.is-today { border-color: var(--pine); }

.cut-countdown__note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.6875rem;
  line-height: 1.45;
}

/* Weekly log table */
.weight-table-wrap { overflow-x: auto; }

.weight-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.78125rem;
}

.weight-table th {
  text-align: left;
  font-family: var(--font-ui);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 8px;
  border-bottom: 1px solid var(--line-strong);
}

.weight-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
}

.weight-table tr:last-child td { border-bottom: 0; }

.is-loss { color: var(--success) !important; }
.is-gain { color: var(--rust) !important; }

/* ============================================================
   Adherence & daily check-in panels
   ============================================================ */
.adherence-panel {
  margin: 0 0 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.adherence-panel__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.adherence-panel__head h3 { font-size: 0.9375rem; }
.adherence-panel__head span { color: var(--muted); font-family: var(--font-mono); font-size: 0.65625rem; }
.adherence-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.adherence-stat { padding: 10px 8px; border-left: 2px solid var(--line-strong); }
.adherence-stat.is-complete { border-color: var(--success); }
.adherence-stat strong { display: block; font-family: var(--font-mono); font-size: 1.25rem; }
.adherence-stat strong span { color: var(--muted); font-size: 0.75rem; }
.adherence-stat small { color: var(--muted); font-size: 0.6875rem; }
.adherence-panel__nudge { margin-top: 10px; color: var(--rust); font-size: 0.78125rem; }

.daily-checkin {
  margin: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.daily-checkin > summary {
  display: flex;
  min-height: 60px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 4px;
  cursor: pointer;
  list-style: none;
}
.daily-checkin > summary::-webkit-details-marker { display: none; }
.daily-checkin > summary > span:first-child { min-width: 0; }
.daily-checkin > summary strong { display: block; font-size: 0.9375rem; }
.daily-checkin > summary small { display: block; margin-top: 2px; color: var(--muted); font-size: 0.71875rem; font-weight: 400; }
.daily-checkin__body { padding: 4px 4px 16px; border-top: 1px solid var(--line); }
.daily-checkin__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding-top: 12px; }
.daily-checkin__field > span,
.daily-checkin__waist > span:first-child {
  display: block;
  margin-bottom: 5px;
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 700;
}
.daily-checkin__field .form-input { min-height: 46px; padding: 9px 10px; font-family: var(--font-mono); font-size: 1rem; font-weight: 700; }
.daily-checkin__field > small { display: block; margin: 4px 1px 0; color: var(--muted); font-family: var(--font-mono); font-size: 0.625rem; }
.daily-checkin__waist {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.daily-checkin__waist > span:first-child { margin: 0; }
.daily-checkin__waist > span:first-child small { color: var(--muted); font-weight: 400; }
.daily-checkin__waist-input { position: relative; width: 112px; }
.daily-checkin__waist-input .form-input { min-height: 44px; padding-right: 34px; font-family: var(--font-mono); }
.daily-checkin__waist-input em { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 0.6875rem; font-style: normal; }
.daily-checkin__body > p { margin-top: 12px; color: var(--muted); font-size: 0.71875rem; }

/* ============================================================
   Folds (collapsible detail sections)
   ============================================================ */
.fold {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 14px;
}

.fold--inset {
  background: var(--surface-2);
  border-color: transparent;
  margin: 4px 0 0;
}

.fold__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.fold__head::-webkit-details-marker { display: none; }

.fold__title {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 650;
  color: var(--ink-soft);
}

.fold__hint {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--faint);
}

.fold__chevron {
  color: var(--faint);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.fold[open] > .fold__head .fold__chevron { transform: rotate(180deg); }

.fold__body { padding: 2px 16px 16px; }

.fold__empty { font-size: 0.8125rem; color: var(--muted); }

.check-line {
  display: flex;
  gap: 10px;
  padding: 7px 0;
  font-size: 0.875rem;
  color: var(--ink-soft);
}

.check-line__tick {
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--pine);
  opacity: 0.75;
}

.focus-line {
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.focus-line:first-child { border-top: 0; }

.focus-line strong {
  display: block;
  font-size: 0.78125rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.focus-line p { font-size: 0.84375rem; color: var(--muted); }

.focus-line--high strong { color: var(--pine-deep); }
.focus-line--high p { color: var(--ink-soft); }

/* ============================================================
   Workout screen
   ============================================================ */
.workout-session-head {
  position: sticky;
  top: 66px;
  z-index: 6;
  padding: 12px 14px;
  border-color: var(--line-strong);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.workout-session-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.workout-session-top .kicker { margin-bottom: 2px; }
.workout-session-top .btn-sm { min-height: 40px; padding: 7px 10px; }

.workout-session-top h2 {
  font-size: 1.375rem;
  font-weight: 850;
  letter-spacing: 0.015em;
  text-transform: uppercase;
}

.workout-session-sub {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 3px 0 12px;
}

.workout-progress-bar {
  height: 4px;
  margin-top: 10px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}

.workout-progress-bar__fill {
  height: 100%;
  background: var(--pine);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.workout-progress-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  font-family: var(--font-mono);
  font-size: 0.71875rem;
  color: var(--muted);
}

/* Exercise card */
.card--exercise { padding: 0; overflow: clip; }

.exercise-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  min-height: 72px;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  background: var(--surface);
}
.exercise-summary::-webkit-details-marker { display: none; }
.exercise-summary__copy { min-width: 0; }
.exercise-summary__copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1rem; }
.exercise-summary__copy small { display: block; margin-top: 2px; color: var(--muted); font-family: var(--font-mono); font-size: 0.6875rem; }
.exercise-summary__status { color: var(--muted); font-family: var(--font-mono); font-size: 0.75rem; }
.exercise-summary__chevron { color: var(--muted); transition: transform 0.18s ease; }
.card--exercise[open] .exercise-summary__chevron { transform: rotate(180deg); }
.card--exercise.is-complete .exercise-summary__status { color: var(--success); }
.card--exercise.is-complete .exercise-counter { background: var(--success-tint); color: var(--success); }

.exercise-body { padding: 2px 14px 14px; border-top: 1px solid var(--line); }
.warmup-cue { margin: 8px 0 4px; color: var(--muted); font-size: 0.75rem; }

.workout-header {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-bottom: 8px;
}

.workout-header h3 {
  font-size: 1.125rem;
  font-weight: 750;
  letter-spacing: -0.015em;
  flex: 1 1 auto;
}

.exercise-counter {
  order: 2;
  font-family: var(--font-mono);
  font-size: 0.65625rem;
  color: var(--faint);
}

.exercise-target {
  flex-basis: 100%;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.exercise-suggest { margin-bottom: 8px; }

.suggested {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--pine-deep);
}

.exercise-increase-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--pine-tint);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  margin-bottom: 10px;
}

.increase-icon { color: var(--pine-deep); display: flex; }
.increase-text { flex: 1; font-size: 0.78125rem; color: var(--pine-deep); }
.increase-badge {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--pine-deep);
  white-space: nowrap;
}

.coaching-action {
  font-size: 0.84375rem;
  font-weight: 550;
  color: var(--ink-soft);
  margin-bottom: 10px;
}

.exercise-last-block { margin-bottom: 10px; }

.exercise-last-block__label {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 5px;
}

.exercise-last-block__sets { display: flex; flex-wrap: wrap; gap: 6px; }

.last-set-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 4px 10px 4px 5px;
}

.last-set-pill__num {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  background: var(--line);
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.last-set-pill__val {
  font-family: var(--font-mono);
  font-size: 0.71875rem;
  color: var(--ink-soft);
}

.exercise-last { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); margin-bottom: 10px; }

/* Set rows — one-thumb logging grid */
.set-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 0.9fr);
  gap: 6px;
  align-items: end;
  border-top: 1px solid var(--line);
  padding: 10px 0;
  transition: opacity 0.2s ease;
}

.set-row--done { background: color-mix(in srgb, var(--success-tint) 45%, transparent); }

.set-row.tap-flash { animation: tap-flash 0.35s ease; }

@keyframes tap-flash {
  0% { background: var(--pine-tint); }
  100% { background: transparent; }
}

.set-row__top {
  grid-column: 1;
  grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  align-self: stretch;
  margin: 0;
}

.set-row__top .set-index { flex: 1; align-items: flex-start; justify-content: center; }

.set-index { display: flex; align-items: center; }

.set-badge {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.btn-done {
  width: 42px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--faint);
  transition: all 0.15s ease;
}

.btn-done svg { width: 20px; height: 20px; }

.btn-done.completed {
  background: var(--success);
  border-color: var(--success);
  color: var(--bg);
}

.btn-done.just-completed { animation: done-pop 0.4s cubic-bezier(0.3, 1.6, 0.5, 1); }

@keyframes done-pop {
  0% { transform: scale(0.92); }
  55% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.set-row__weight { grid-column: 2; margin: 0; }
.set-row__bottom { display: contents; }
.set-row__reps { grid-column: 3; }
.set-row__rir { grid-column: 4; }

.stepper-label {
  display: block;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 4px;
}

.stepper {
  display: flex;
  align-items: stretch;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}

.stepper:focus-within { border-color: var(--pine); box-shadow: 0 0 0 3px var(--pine-tint); }

.stepper button {
  width: 30px;
  min-height: 44px;
  border: 0;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 1rem;
  font-weight: 500;
  flex-shrink: 0;
}

.stepper button:active { background: var(--line); }

.stepper input {
  flex: 1;
  width: 100%;
  min-width: 0;
  border: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--ink);
  background: transparent;
  padding: 8px 1px;
}

.stepper input:focus { outline: none; }

.stepper--rir button { width: 25px; }
.stepper--rir input { font-size: 0.9375rem; }

.rir-input {
  width: 100%;
  padding: 10px 4px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--ink);
}

.btn-clean {
  grid-column: 2 / 5;
  min-height: 34px;
  justify-self: start;
  padding: 5px 10px;
  border: 1px solid color-mix(in srgb, var(--success) 50%, var(--line));
  border-radius: 6px;
  background: var(--success-tint);
  color: var(--success);
  font-size: 0.75rem;
  font-weight: 700;
}
.btn-clean.is-unclean { border-color: var(--rust); background: var(--rust-tint); color: var(--rust); }

/* Rest timer */
.rest-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 4px 4px;
}

.rest-banner--with-ring {
  margin: 8px 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.rest-banner__label {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}

.rest-ring-wrap { position: relative; width: 52px; height: 52px; }

.rest-ring-svg { width: 100%; height: 100%; transform: rotate(-90deg); }

.rest-ring-track { fill: none; stroke: var(--line); stroke-width: 6; }

.rest-ring-fill {
  fill: none;
  stroke: var(--pine);
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.25s linear;
}

.rest-ring-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.rest-countdown {
  font-family: var(--font-mono);
  font-size: 0.71875rem;
  font-weight: 600;
  color: var(--muted);
}

.rest-countdown.active { color: var(--pine-deep); }

/* Per-exercise coaching fold */
.exercise-coaching__body p { font-size: 0.84375rem; color: var(--ink-soft); }
.exercise-coaching__why { font-family: var(--font-serif); font-size: 0.9375rem !important; }
.exercise-coaching__rule { margin: 10px 0; }
.exercise-coaching__rule strong { display: block; font-size: 0.78125rem; margin-bottom: 2px; }
.exercise-coaching__rule p { color: var(--muted); }
.exercise-coaching__form { margin-bottom: 8px; }
.exercise-coaching__effort { color: var(--muted) !important; }

.rir-rule {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  margin-top: 10px;
  font-size: 0.78125rem;
  color: var(--ink-soft);
}

.rir-rule__label {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.exercise-prescription {
  margin-top: 10px;
  font-size: 0.78125rem;
  line-height: 1.5;
  color: var(--muted);
}

.exercise-comment { margin-top: 10px; }

.exercise-comment-input {
  font-size: 0.875rem;
  background: var(--surface-2);
  border-color: transparent;
}

.exercise-comment-input:focus { background: var(--surface); }

.session-notes-input { font-size: 0.9375rem; }

/* Session notes fold */
.session-details {
  margin: 4px 0 14px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.session-details__body { padding: 0 0 14px; }

/* Sticky complete footer */
.sticky-footer {
  position: fixed;
  bottom: calc(67px + env(safe-area-inset-bottom));
  left: 50%;
  z-index: 15;
  transform: translateX(-50%);
  width: 100%;
  max-width: 560px;
  padding: 8px 16px 10px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}

.sticky-footer > .save-status { display: block; margin: 0 2px 6px; }

.footer-actions { display: flex; gap: 8px; }
.footer-actions .btn-secondary { flex: 1; }
.footer-actions .btn-primary { flex: 2; }

/* Completion summary */
.summary-celebration { text-align: center; padding: 40px 0 18px; }

.summary-celebration__icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--success-tint);
  color: var(--success);
}

.summary-celebration__title {
  font-size: 1.5rem;
  font-weight: 850;
  letter-spacing: 0.015em;
  text-transform: uppercase;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.summary-grid.compact { margin-bottom: 10px; }

.summary-stat {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  text-align: center;
}

.summary-stat strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.summary-stat span {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.summary-meta { font-size: 0.8125rem; color: var(--muted); margin: 3px 0; }

.next-list { display: flex; flex-direction: column; gap: 8px; }

.next-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}

.next-item__name { font-size: 0.84375rem; font-weight: 650; }
.next-item__action { grid-column: 1; font-size: 0.75rem; color: var(--muted); }
.next-item__change {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: center;
  font-family: var(--font-mono);
  font-size: 0.78125rem;
  font-weight: 600;
  color: var(--pine-deep);
}

/* ============================================================
   History / settings screen
   ============================================================ */
.history-switcher {
  position: sticky;
  top: 66px;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: 0 0 12px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.history-switcher button {
  min-height: 40px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 0.78125rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.history-switcher button.is-selected { background: var(--surface-2); color: var(--ink); }

.settings-section {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
}

.settings-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  padding: 11px 4px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.settings-section__head::-webkit-details-marker { display: none; }

.settings-section__head h3 { font-size: 0.9375rem; font-weight: 700; }

.settings-chevron { color: var(--faint); transition: transform 0.2s ease; }

.settings-section[open] > .settings-section__head .settings-chevron { transform: rotate(180deg); }

.settings-section__body { padding: 2px 4px 16px; }

.settings-head { font-size: 0.8125rem; color: var(--muted); margin-bottom: 10px; }
.settings-hint { font-size: 0.75rem; color: var(--faint); margin-top: 10px; }

.theme-toggle {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.theme-toggle__item {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease;
}

.theme-toggle__item.is-selected {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink);
}

.progress-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.progress-head {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.progress-stat {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.progress-stat span {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.progress-stat strong {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
}

.progress-chart-wrap { margin: 0 -4px; }

.progress-chart-svg { width: 100%; height: auto; }

.progress-guides line { stroke: var(--line); stroke-width: 1; }

.progress-line {
  fill: none;
  stroke: var(--pine);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.progress-points circle { fill: var(--pine-deep); stroke: var(--bg); stroke-width: 1.5; }

.progress-chart-axis {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.65625rem;
  color: var(--faint);
  margin: 6px 2px 12px;
}

.progress-history { margin-top: 6px; }

.progress-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 8px;
  padding: 7px 2px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-soft);
}

.progress-row:last-child { border-bottom: 0; }

.progress-row-head {
  font-family: var(--font-ui);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.chart-empty, .session-empty, .session-loading {
  padding: 20px 0;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--muted);
}

/* Past sessions */
.past-sessions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.show-older-sessions { margin-top: 10px; }
.past-session-detail:not(:empty) { scroll-margin-top: 126px; margin-bottom: 12px; }

.session-item {
  text-align: left;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color 0.15s ease;
}

.session-item:hover { border-color: var(--line-strong); }
.session-item.selected { border-color: var(--pine); background: var(--pine-tint); }

.session-item-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.84375rem;
  margin-bottom: 3px;
}

.session-item-top span { font-family: var(--font-mono); font-size: 0.71875rem; color: var(--muted); }

.session-item-meta { font-size: 0.71875rem; color: var(--muted); }

.session-detail-card {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.session-detail-card h4 { font-size: 1rem; margin-bottom: 4px; }

.session-detail-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 10px 0 14px;
}

.session-detail-summary > div {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
}

.session-detail-summary strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
}

.session-detail-summary span {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.session-detail-exercise { margin-bottom: 14px; }

.session-detail-ex-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}

.session-detail-ex-head h4 { font-size: 0.875rem; }
.session-detail-ex-head span { font-size: 0.6875rem; color: var(--muted); text-align: right; }

.session-detail-comment {
  font-family: var(--font-serif);
  font-size: 0.875rem;
  font-style: italic;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.session-detail-set {
  display: grid;
  grid-template-columns: 32px 1.2fr 1fr 0.7fr 0.5fr;
  gap: 6px;
  padding: 5px 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line);
}

.session-detail-set:last-child { border-bottom: 0; }

.session-detail-set-head {
  font-family: var(--font-ui);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Exercise settings */
.settings-row {
  display: grid;
  grid-template-columns: 1fr 84px 72px;
  gap: 8px;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}

.settings-row:last-of-type { border-bottom: 0; }

.settings-row .name {
  font-size: 0.84375rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-inc, .settings-unit {
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  text-align: center;
}

select.settings-unit { font-family: var(--font-ui); }

.codex-review-box {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.codex-review-pack-output {
  margin: 10px 0;
  font-family: var(--font-mono);
  font-size: 0.71875rem;
}

/* ============================================================
   Plan modal
   ============================================================ */
.plan-modal { position: fixed; inset: 0; z-index: 60; }

.plan-modal__backdrop {
  position: absolute;
  inset: 0;
  background: var(--backdrop);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.plan-modal__sheet {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 560px;
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  padding: 20px 18px calc(24px + env(safe-area-inset-bottom));
  animation: sheet-up 0.3s cubic-bezier(0.2, 0.8, 0.3, 1);
}

@keyframes sheet-up {
  from { transform: translate(-50%, 40px); opacity: 0; }
  to   { transform: translate(-50%, 0); opacity: 1; }
}

.plan-modal__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 4px;
}

.plan-modal__kicker {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.plan-modal__title {
  font-size: 1.5rem;
  font-weight: 850;
  letter-spacing: 0.015em;
  text-transform: uppercase;
}

.plan-modal__close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
}

.plan-modal__sub { font-size: 0.8125rem; color: var(--muted); margin-bottom: 16px; }

.plan-modal__grid { display: flex; flex-direction: column; gap: 10px; }

/* Rest-day confirmation, shown only when the skipped slot was a training day */
.skip-modal__sheet { max-height: 88dvh; }

.skip-modal__list {
  list-style: none;
  margin: 4px 0 20px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skip-modal__list li {
  position: relative;
  padding-left: 20px;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.skip-modal__list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pine);
}

.skip-modal__actions { display: flex; flex-direction: column; gap: 8px; }

.plan-day {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.plan-day--current { border-color: var(--pine); box-shadow: 0 0 0 3px var(--pine-tint); }
.plan-day--off { background: var(--surface-2); }
.plan-day--extra { border-style: dashed; }

.plan-day__head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.plan-day__pos {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 34px;
}

.plan-day__pos-label {
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}

.plan-day__pos-num {
  font-family: var(--font-mono);
  font-size: 1.125rem;
  font-weight: 600;
}

.plan-day__title { flex: 1; }

.plan-day__key {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.06em;
  color: var(--faint);
}

.plan-day__name { font-size: 1rem; font-weight: 700; }

.plan-day__badge {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--pine);
  color: var(--on-pine);
  font-size: 0.6875rem;
  font-weight: 700;
}

.plan-day__empty { font-size: 0.8125rem; color: var(--muted); margin-top: 8px; }

.plan-day__ex-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.plan-day__ex { border-top: 1px solid var(--line); padding-top: 8px; }

.plan-day__ex-main {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.plan-day__ex-name { font-size: 0.84375rem; font-weight: 600; }

.plan-day__ex-meta {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--muted);
  white-space: nowrap;
}

.plan-day__ex-note {
  display: block;
  margin-top: 3px;
  font-size: 0.71875rem;
  color: var(--faint);
  line-height: 1.45;
}

/* ============================================================
   Login
   ============================================================ */
.auth-body {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(120% 90% at 50% 0%, var(--bg-glow) 0%, var(--bg) 60%);
}

.login-page { width: 100%; max-width: 380px; padding: 24px; }

.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px 26px;
}

.login-header { text-align: center; margin-bottom: 22px; }

.brand-icon {
  display: inline-flex;
  color: var(--pine);
}

.brand-icon.huge svg { width: 44px; height: 44px; }

.login-header h1 {
  font-size: 1.375rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 10px;
}

.login-sub {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.9375rem;
  color: var(--muted);
  margin-top: 4px;
}

/* ============================================================
   Easy Cardio stopwatch
   ============================================================ */
.cardio-timer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 22px 16px 18px;
  margin: 6px 0 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.cardio-timer__clock {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 3.5rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.cardio-timer--running .cardio-timer__clock { color: var(--pine-deep); }

.cardio-timer__hint {
  font-size: 0.8125rem;
  color: var(--muted);
  text-align: center;
  max-width: 30ch;
}

.cardio-timer__btn {
  width: 100%;
  max-width: 280px;
}

.cardio-timer--running .cardio-timer__btn {
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--rust) 45%, transparent);
  color: var(--rust);
}
.cardio-timer--running .cardio-timer__btn:not(:disabled):hover { background: var(--rust-tint); }

.cardio-minutes-row .stepper-label { letter-spacing: 0.04em; }

/* ============================================================
   Narrow & wide screens
   ============================================================ */
@media (max-width: 370px) {
  .home-weight-gate__why { display: none; }
  .set-row { grid-template-columns: 38px minmax(0, 1.2fr) minmax(0, 1fr) 70px; gap: 4px; }
  .stepper button { width: 27px; }
  .stepper--rir button { width: 23px; }
}

@media (max-width: 350px) {
  .set-row { grid-template-columns: 38px minmax(0, 1.15fr) minmax(0, 1fr); }
  .set-row__weight { grid-column: 2; grid-row: 1; }
  .set-row__reps { grid-column: 3; grid-row: 1; }
  .set-row__rir { grid-column: 2; grid-row: 2; }
  .btn-clean {
    grid-column: 3;
    grid-row: 2;
    width: 100%;
    min-height: 44px;
    align-self: end;
    justify-self: stretch;
    justify-content: center;
  }
}

@media (min-width: 640px) {
  #app-shell:has(#tab-settings.active) { max-width: 980px; }
  #tab-content { padding-left: 0; padding-right: 0; }
  .today__title { font-size: 2.625rem; }
}
