/* Metabofit — dark-first, thumb-first. Tuned for iPhone 15 Pro Max (430×932pt)
   but fluid enough for any phone or a desktop browser. */

:root {
  --bg:        #0B0E13;
  --surface:   #151A23;
  --surface-2: #1E2530;
  --line:      #2A3340;

  --text:      #E8ECF2;
  --muted:     #8A94A6;

  --accent:    #FF6B35;
  --accent-dim:#3A2318;
  --done:      #3DDC84;
  --partial:   #FFB020;
  --skipped:   #FF5A5A;
  --unlogged:  #4A5666;
  /* Time between things — gaps between sessions, minutes between machines. */
  --cool:      #7FB4E8;

  --radius:    16px;
  --radius-sm: 10px;

  /* Nothing interactive is smaller than this. Sweaty thumbs, bad lighting. */
  --tap: 56px;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);

  --tabbar-h: 64px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg:        #F4F6FA;
    --surface:   #FFFFFF;
    --surface-2: #EDF1F7;
    --line:      #DCE3ED;
    --text:      #131922;
    --muted:     #61708A;
    --accent-dim:#FFEDE4;
    --unlogged:  #B4BECC;
    --cool:      #3A7FC4;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  /* Kill iOS rubber-band so the app feels native, not like a web page. */
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

body { -webkit-user-select: none; user-select: none; }
[hidden] { display: none !important; }

h1 { font-size: 1.65rem; font-weight: 700; margin: 0; letter-spacing: -0.02em; }
h2 { font-size: 1rem; font-weight: 600; margin: 0; }
p  { margin: 0; }

.muted  { color: var(--muted); }
.sm     { font-size: 0.82rem; }
.center { text-align: center; }
.mono   { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.error  { color: var(--skipped); font-size: 0.9rem; }

/* ---------------------------------------------------------------- layout */

.view {
  position: fixed;
  inset: 0;
  bottom: calc(var(--tabbar-h) + var(--safe-b));
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: calc(var(--safe-t) + 14px) calc(var(--safe-r) + 18px) 12px calc(var(--safe-l) + 18px);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px calc(var(--safe-r) + 16px) 32px calc(var(--safe-l) + 16px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.section-title { color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; font-size: 0.72rem; margin-top: 6px; }

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

/* ---------------------------------------------------------------- buttons */

.btn {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  min-height: var(--tap);
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: transform .08s ease, filter .15s ease;
}
.btn:active { transform: scale(.97); filter: brightness(1.15); }
.btn-sm { min-height: 40px; font-size: .88rem; padding: 0 12px; }
.btn-lg { min-height: 60px; font-size: 1.05rem; }
.btn-xl { min-height: 76px; font-size: 1.2rem; flex-direction: column; gap: 2px; }
.btn-xl small { font-weight: 500; font-size: .78rem; opacity: .85; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #14100D; }
.btn-warn    { background: var(--partial); border-color: var(--partial); color: #19120A; color: #1A1205; }
.btn-ghost   { background: transparent; }
.btn-ghost.danger { color: var(--skipped); border-color: transparent; }

.btn-done    { background: var(--done);    border-color: var(--done);    color: #06210F; flex: 1.4; }
.btn-partial { background: var(--surface-2); border-color: var(--partial); color: var(--partial); flex: 1; }
.btn-skip    { background: var(--surface-2); border-color: var(--line);    color: var(--muted);   flex: 1; }

.icon-btn {
  background: none; border: 0; color: var(--muted);
  font-size: 1.3rem; width: 44px; height: 44px; cursor: pointer;
}

.chip {
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; min-height: 32px; padding: 0 12px; font-size: .78rem;
  font-weight: 600; cursor: pointer;
}
.chip.ok      { color: var(--done);     border-color: color-mix(in srgb, var(--done) 40%, transparent); }
.chip.pending { color: var(--partial);  border-color: color-mix(in srgb, var(--partial) 40%, transparent); }
.chip.offline { color: var(--muted); }

/* ---------------------------------------------------------------- tabbar */

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tab {
  background: none; border: 0; color: var(--muted);
  font-family: inherit; font-size: .76rem; font-weight: 600; cursor: pointer;
}
.tab.active { color: var(--accent); }

/* ---------------------------------------------------------------- gate */

.gate { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; }
.gate-inner { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 46px; height: 46px; border-radius: 13px;
  background: var(--accent); color: #14100D;
  display: grid; place-items: center; font-weight: 800; font-size: 1.5rem;
}
.field { position: relative; display: block; }

.gate input {
  font-family: inherit;
  /* 16px minimum: anything smaller makes iOS Safari zoom on focus. */
  font-size: 16px;
  width: 100%;
  min-height: var(--tap);
  /* Right padding clears the reveal button so text never runs under it. */
  padding: 0 56px 0 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  -webkit-user-select: text; user-select: text;
}

.reveal {
  position: absolute;
  right: 4px; top: 50%; transform: translateY(-50%);
  width: 48px; height: 48px;
  display: grid; place-items: center;
  background: none; border: 0; color: var(--muted);
  cursor: pointer; border-radius: var(--radius-sm);
}
.reveal svg { width: 22px; height: 22px; }
.reveal:active { color: var(--accent); }
.reveal[aria-pressed="true"] { color: var(--accent); }

/* ---------------------------------------------------------------- today */

.streak { display: flex; align-items: center; gap: 16px; }
.streak-num { font-size: 2.6rem; font-weight: 800; line-height: 1; letter-spacing: -.03em; }
.streak.warn .streak-num { color: var(--partial); }
.streak.cold .streak-num { color: var(--skipped); }
.streak.hot  .streak-num { color: var(--done); }

#resume-banner { display: flex; flex-direction: column; gap: 8px; }

.routine-preview { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.routine-preview li {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 11px 14px;
}
.routine-preview .idx {
  width: 24px; height: 24px; flex: none; border-radius: 7px;
  background: var(--surface-2); color: var(--muted);
  display: grid; place-items: center; font-size: .72rem; font-weight: 700;
}
.routine-preview .nm { flex: 1; font-weight: 600; font-size: .94rem; }
.routine-preview .tg { color: var(--muted); font-size: .8rem; font-family: var(--mono); }
.routine-preview li.is-rest { opacity: .6; }

/* ---------------------------------------------------------------- stats */

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px 10px; text-align: center;
}
.stat b { display: block; font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; }
.stat span { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

/* ---------------------------------------------------------------- history */

.history-list { display: flex; flex-direction: column; gap: 8px; }
.session-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 13px 14px; cursor: pointer;
  text-align: left; width: 100%; font-family: inherit; color: inherit;
}
.session-row:active { filter: brightness(1.2); }
.session-row .d { font-weight: 700; font-size: .95rem; }
.session-row .meta { flex: 1; }
.session-row .loc { color: var(--muted); font-size: .78rem; }
.session-row.rest-day { opacity: .55; }

.bars { display: flex; gap: 2px; align-items: center; }
.bars i { width: 4px; height: 18px; border-radius: 2px; display: block; }
.b-done { background: var(--done); }
.b-partial { background: var(--partial); }
.b-skipped { background: var(--skipped); }
.b-unlogged { background: var(--unlogged); }

/* ---------------------------------------------------------------- runner */

.runner {
  position: fixed; inset: 0; z-index: 40;
  background: var(--bg);
  display: flex; flex-direction: column;
}
.runner-top {
  display: flex; align-items: center; gap: 12px;
  padding: calc(var(--safe-t) + 8px) calc(var(--safe-r) + 12px) 10px calc(var(--safe-l) + 12px);
  border-bottom: 1px solid var(--line);
}
.runner-progress { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }

/* Slot picker. appearance:none restyles the closed control to match the app;
   iOS still opens its native wheel, so we keep the good picker and lose the
   grey system chrome. */
.select-wrap { position: relative; display: block; }
.select-wrap::after {
  content: '';
  position: absolute;
  right: 12px; top: 50%;
  width: 7px; height: 7px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.select-wrap select {
  appearance: none; -webkit-appearance: none;
  width: 100%;
  /* 16px minimum or iOS zooms the whole page on focus. */
  font-family: inherit; font-size: 16px; font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  min-height: 44px;
  padding: 0 32px 0 12px;
  text-overflow: ellipsis;
  cursor: pointer;
}
.select-wrap select:active { filter: brightness(1.2); }
.progress-track { height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width .25s ease; }
.elapsed { font-size: .9rem; color: var(--muted); min-width: 48px; text-align: right; }

.runner-card {
  flex: 1 1 auto;
  /* Without min-height:0 a flex child grows to fit its content instead of
     scrolling, which is what let the card push the footer off-screen and drag
     the whole runner into a scroll. */
  min-height: 0;
  overflow-y: auto;
  padding: 16px calc(var(--safe-r) + 18px) 10px calc(var(--safe-l) + 18px);
  display: flex; flex-direction: column; gap: 12px;
}

.ex-head { display: flex; flex-direction: column; gap: 4px; }
.ex-name { font-size: 1.6rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.ex-sub  { color: var(--muted); font-size: .88rem; }

.lasttime {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px 14px;
  display: flex; justify-content: space-between; align-items: center; font-size: .88rem;
}
.lasttime b { font-family: var(--mono); }
.pr-flag { color: var(--accent); font-weight: 700; font-size: .8rem; }

/* Big value stepper: the primary interaction in the whole app. */
.stepper { display: flex; flex-direction: column; gap: 5px; }
.stepper-label { color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; }
.stepper-row { display: flex; align-items: stretch; gap: 10px; }
.stepper-btn {
  width: 68px; flex: none;
  font-size: 1.8rem; font-weight: 300; line-height: 1;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); color: var(--text); cursor: pointer;
}
.stepper-btn:active { background: var(--accent); color: #14100D; }
.stepper-val {
  flex: 1; display: flex; align-items: baseline; justify-content: center; gap: 5px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); min-height: 60px;
}
.stepper-val b { font-size: 2rem; font-weight: 800; font-family: var(--mono); letter-spacing: -.02em; }
.stepper-val span { color: var(--muted); font-size: .9rem; }

/* Derived summary — accent border, distinct from the user's own blue note */
.evaluation {
  background: var(--surface-2); border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 14px; margin-top: 14px;
}
.evaluation .lbl {
  display: block; font-size: .68rem; text-transform: uppercase;
  letter-spacing: .07em; color: var(--accent); margin-bottom: 6px;
}
.eval-headline { font-size: .98rem; font-weight: 700; margin-bottom: 8px; }
.eval-body { font-size: .88rem; line-height: 1.55; margin-bottom: 8px; color: var(--text); }
.eval-insight {
  font-size: .88rem; line-height: 1.55; margin-bottom: 8px;
  padding-left: 10px; border-left: 2px solid var(--cool); color: var(--text);
}
/* An unmeasured symptom. Warm-toned and bordered so it is not read past on the
   way to the encouragement, but not alarm-red either — it says "we cannot
   answer this", which is not the same as "something is wrong". */
.eval-caution {
  font-size: .88rem; line-height: 1.55; margin-bottom: 10px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--partial) 45%, transparent);
  background: color-mix(in srgb, var(--partial) 10%, transparent);
  color: var(--text);
}
.eval-encouragement { font-size: .9rem; line-height: 1.5; font-weight: 600; color: var(--done); }

/* Summary popup */
.eval-sheet-title { font-size: 1.2rem; margin-bottom: 2px; }
.eval-sheet .evaluation { margin-top: 12px; }
.eval-loading { padding: 18px 0 6px; text-align: center; }
.eval-loading-bar {
  height: 4px; border-radius: 2px; margin: 0 auto 14px; max-width: 220px;
  background: linear-gradient(
    90deg,
    transparent, var(--accent), transparent
  );
  background-size: 60% 100%;
  background-repeat: no-repeat;
  animation: sweep 1.25s ease-in-out infinite;
}
@keyframes sweep {
  0%   { background-position: -60% 0; }
  100% { background-position: 160% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .eval-loading-bar { animation: none; background-position: 20% 0; }
}
.eval-error { font-size: .92rem; line-height: 1.5; font-weight: 600; margin-top: 14px; }
.eval-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--line);
  font-size: .68rem; color: var(--muted);
}
.eval-clear {
  background: none; border: 0; color: var(--muted); cursor: pointer;
  font-family: inherit; font-size: .68rem; text-decoration: underline; padding: 4px;
}

/* Session note */
.note-form { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.note-form textarea {
  font-family: inherit;
  /* 16px minimum or iOS zooms the page when the keyboard opens. */
  font-size: 16px;
  line-height: 1.45;
  padding: 12px 14px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  resize: none;
  /* body sets user-select:none for app-like feel; prose needs it back. */
  -webkit-user-select: text; user-select: text;
}
.session-note {
  background: var(--surface-2); border: 1px solid var(--line);
  border-left: 3px solid var(--cool);
  border-radius: var(--radius-sm);
  padding: 10px 14px; margin-top: 12px;
  font-size: .9rem; line-height: 1.5;
  width: 100%; text-align: left; font-family: inherit; color: var(--text);
  cursor: pointer;
}
.session-note:active { filter: brightness(1.2); }
.session-note .lbl {
  display: block; font-size: .68rem; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted); margin-bottom: 4px;
}

/* Add-a-machine form */
.add-form { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.add-form input {
  font-family: inherit;
  /* 16px minimum or iOS zooms the page when the keyboard opens. */
  font-size: 16px;
  min-height: var(--tap);
  padding: 0 14px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  -webkit-user-select: text; user-select: text;
}
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice-row { display: flex; gap: 8px; }
.choice {
  flex: 1; min-height: 62px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); color: var(--muted);
  font-family: inherit; font-size: .74rem; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 6px;
}
.choice b { font-size: .95rem; color: var(--text); font-weight: 600; }
.choice.on { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.choice.on b { color: var(--accent); }

/* Rower benchmark — last session's duration, the thing you're chasing */
.benchmark {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px 14px;
}
.benchmark b { font-size: 1.5rem; font-variant-numeric: tabular-nums; }

/* Carried-forward resistance / stroke rate, out of the primary flow */
.settings-toggle {
  width: 100%; background: none; border: 0; cursor: pointer;
  font-family: var(--mono); font-size: .82rem; color: var(--muted);
  padding: 10px 0;
}
.settings-toggle .muted { opacity: .7; text-decoration: underline; }

/* Picker state — before the first machine and between exercises */
.empty-state {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  gap: 6px; padding: 40px 0;
}
.empty-state .ex-name { font-size: 1.5rem; }

/* Tappable rows in "Done so far" */
button.detail-entry {
  width: 100%; font-family: inherit; color: inherit; text-align: left;
  background: none; border: 0; border-bottom: 1px solid var(--line);
  cursor: pointer;
}
button.detail-entry:active { background: var(--surface-2); }
.detail-entry .chev { color: var(--muted); font-size: 1.1rem; padding-left: 2px; }

/* Where the session's time went */
.breakdown {
  margin-top: 14px; padding: 10px 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.breakdown-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: .86rem; }
.breakdown-row .dot { width: 8px; height: 8px; border-radius: 2px; }
.breakdown-row .nm { flex: 1; }
.breakdown-row .vv { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.breakdown-row .pct { width: 40px; text-align: right; color: var(--muted); font-size: .76rem; }

/* Between-machines clock */
.transition-banner {
  display: flex; align-items: baseline; gap: 10px;
  background: var(--surface); border: 1px dashed var(--line);
  border-radius: var(--radius-sm); padding: 10px 14px;
  font-size: .86rem; color: var(--muted);
}
.transition-banner b { font-size: 1.35rem; color: var(--text); font-variant-numeric: tabular-nums; }
.transition-banner .sm { margin-left: auto; }

.order-num {
  width: 20px; height: 20px; flex: none; border-radius: 6px;
  background: var(--surface-2); color: var(--muted);
  display: grid; place-items: center; font-size: .68rem; font-weight: 700;
}

/* Set / rest stopwatch */
.set-timer { text-align: center; }
.set-clock { font-size: 2.7rem; line-height: 1; }
.set-clock.resting { color: var(--partial); }
.set-caption { font-size: .84rem; margin-top: 6px; color: var(--muted); }
.set-caption.working { color: var(--done); font-weight: 600; }
.set-caption.resting { color: var(--partial); font-weight: 600; }

.setpills { display: flex; gap: 8px; flex-wrap: wrap; }
.setpill {
  flex: 1; min-width: 84px; min-height: 54px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); color: var(--muted);
  font-family: inherit; font-size: .8rem; font-weight: 600; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.setpill b { font-size: 1.05rem; color: var(--text); }
.setpill .pill-val { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* Recorded */
.setpill.on { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.setpill.on b { color: var(--accent); }

/* Currently on the clock — the one thing on screen that should pull the eye. */
.setpill.active {
  background: color-mix(in srgb, var(--done) 16%, transparent);
  border-color: var(--done); color: var(--done);
  animation: pulse 1.6s ease-in-out infinite;
}
.setpill.active b { color: var(--done); }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--done) 45%, transparent); }
  50%      { box-shadow: 0 0 0 5px color-mix(in srgb, var(--done) 0%, transparent); }
}

/* Countdown / interval timer */
.timer-face { text-align: center; padding: 8px 0; }
.timer-time { font-size: 3.6rem; font-weight: 800; font-family: var(--mono); letter-spacing: -.04em; line-height: 1; }
.timer-time.done { color: var(--done); }
.timer-ring { width: 100%; height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin-top: 12px; }
.timer-ring i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.timer-controls { display: flex; gap: 10px; margin-top: 14px; }
.timer-controls .btn { flex: 1; }

.runner-actions {
  display: flex; gap: 10px;
  flex: 0 0 auto;
  padding: 8px calc(var(--safe-r) + 16px) 0 calc(var(--safe-l) + 16px);
}
.runner-actions .btn { min-height: 50px; font-size: 1rem; }
.runner-nav {
  display: flex; gap: 6px;
  flex: 0 0 auto;
  padding: 6px calc(var(--safe-r) + 12px) calc(var(--safe-b) + 8px) calc(var(--safe-l) + 12px);
}
/* Equal widths and no wrapping: a nav label breaking onto a second line was
   another way the bottom grew and squeezed the card. */
.runner-nav .btn {
  flex: 1 1 0; min-width: 0; min-height: 34px;
  font-size: .78rem; padding: 0 6px; white-space: nowrap;
}

/* Elapsed-time-between numbers */
.gap-marker {
  text-align: center; font-size: .82rem; color: var(--muted);
  /* Sits in the space between two session rows, so it needs room on both sides
     rather than hugging the row below it. */
  padding: 6px 0;
}
.gap-marker b { color: var(--cool); font-weight: 700; font-variant-numeric: tabular-nums; }
.transition-banner b { color: var(--cool); }

.review-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.sheet-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.sheet-actions .btn { width: 100%; }

/* ---------------------------------------------------------------- progress */

.pr-list { display: flex; flex-direction: column; gap: 0; padding: 4px 0; }
.pr-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 16px; border-bottom: 1px solid var(--line);
}
.pr-row:last-child { border-bottom: 0; }
.pr-row .nm { font-weight: 600; font-size: .92rem; }
.pr-row .when { color: var(--muted); font-size: .74rem; }
.pr-row .val { font-family: var(--mono); font-weight: 700; font-size: 1.05rem; }
.pr-row .delta { font-size: .72rem; color: var(--done); }

.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.chart-head .nm { font-weight: 600; font-size: .92rem; }
.chart-head .rng { color: var(--muted); font-size: .76rem; font-family: var(--mono); }
.chart-card svg { width: 100%; height: 92px; display: block; overflow: visible; }

.cal-grid { display: flex; gap: 3px; overflow-x: auto; padding-bottom: 4px; }
.cal-week { display: flex; flex-direction: column; gap: 3px; }
.cal-day { width: 13px; height: 13px; border-radius: 3px; background: var(--surface-2); flex: none; }
.cal-day.has { background: var(--done); }
.cal-day.rest { background: var(--unlogged); }
.cal-months { display: flex; gap: 3px; margin-bottom: 5px; font-size: .62rem; color: var(--muted); }
.cal-legend { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: .72rem; color: var(--muted); }

/* ---------------------------------------------------------------- sheet */

.sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.6); }
.sheet-body {
  position: relative; width: 100%; max-height: 86vh; overflow-y: auto;
  background: var(--surface); border-radius: 22px 22px 0 0;
  border-top: 1px solid var(--line);
  padding: 8px calc(var(--safe-r) + 18px) calc(var(--safe-b) + 22px) calc(var(--safe-l) + 18px);
  animation: slideup .22s ease;
}
@keyframes slideup { from { transform: translateY(22px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 6px auto 14px; }

.detail-entry {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .9rem;
}
.detail-entry:last-child { border-bottom: 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.detail-entry .nm { flex: 1; }
.detail-entry .vv { font-family: var(--mono); color: var(--muted); font-size: .84rem; }
.detail-splits {
  font-family: var(--mono); font-size: .72rem; color: var(--muted);
  padding: 0 0 9px 18px; margin-top: -6px; opacity: .85;
}

/* ---------------------------------------------------------------- misc */

.setting-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.setting-row:last-child { border-bottom: 0; }

.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 999px; transition: .2s; cursor: pointer;
}
.switch span::after {
  content: ''; position: absolute; width: 24px; height: 24px; left: 2px; top: 2px;
  background: var(--muted); border-radius: 50%; transition: .2s;
}
.switch input:checked + span { background: var(--accent); border-color: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); background: #14100D; }

.card > .btn { width: 100%; margin-bottom: 8px; }
.card > .btn:last-child { margin-bottom: 0; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 18px); z-index: 60;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 11px 20px; font-size: .88rem; font-weight: 600;
  box-shadow: 0 8px 28px rgba(0,0,0,.45); animation: slideup .2s ease;
  max-width: calc(100vw - 32px); text-align: center;
}
.toast.pr { background: var(--accent); border-color: var(--accent); color: #14100D; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
