/* The Bridge Program — neutral graphite.
   Greys carry the interface; colour is kept for what it means. Amber is
   pull, cyan is push, green legs, violet core; done is green and alert is
   red-orange. One typeface, Inter, with tabular figures wherever numbers
   line up. Every text colour is 4.5:1 or better on every surface, in both
   themes. */

:root {
  /* Tells the browser which way to paint native controls — date pickers,
     number spinners, scrollbars — so they match the theme. */
  color-scheme: dark;

  --ground:      #0F1012;
  --surface:     #17181B;
  --surface-2:   #1F2024;
  --rule:        #2C2E33;
  --rule-soft:   #222428;

  --ink:         #EDEDEF;
  --ink-dim:     #A6A7AD;
  --ink-faint:   #8B8D94;   /* 4.5:1 or better on every surface */

  /* The main action: ink on ground, so it never competes with the
     meaning colours. */
  --primary:     #EDEDEF;
  --on-primary:  #0F1012;
  /* Text on a filled meaning colour (a done set, the current week). */
  --on-accent:   #0F1012;

  --pull:        #E3AE4A;
  --pull-soft:   rgba(227, 174, 74, 0.12);
  --push:        #5FBFCB;
  --push-soft:   rgba(95, 191, 203, 0.12);
  --legs:        #8CBB6E;
  --legs-soft:   rgba(140, 187, 110, 0.12);
  --core:        #A994D4;
  --core-soft:   rgba(169, 148, 212, 0.12);
  --alert:       #F2775A;
  --alert-soft:  rgba(242, 119, 90, 0.12);
  --done:        #6CC88A;

  --shadow: none;
  --shadow-float: 0 8px 28px rgba(0, 0, 0, 0.45);

  --font-display: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  /* Numbers and small labels: the same face, with figures that line up. */
  --font-mono: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --tab-h: 60px;
  --timer-h: 64px;
  --content: 720px;
  --pad: 16px;
  --radius: 8px;      /* controls */
  --radius-lg: 12px;  /* cards and panels */

  --ease: cubic-bezier(0.2, 0, 0, 1);
  --t-fast: 150ms;
  --t: 200ms;
}

/* Light: reachable two ways — the OS setting, or the manual toggle, which
   matters outdoors where a dark screen washes out in direct sun. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --ground:    #F6F6F4;
    --surface:   #FFFFFF;
    --surface-2: #F0F0EE;
    --rule:      #E2E2DF;
    --rule-soft: #ECECE9;
    --ink:       #16171A;
    --ink-dim:   #4A4C52;
    --ink-faint: #63656B;
    --primary:    #16171A;
    --on-primary: #FFFFFF;
    --on-accent:  #FFFFFF;
    --pull:      #8A5A0E;
    --pull-soft: rgba(138, 90, 14, 0.09);
    --push:      #136570;
    --push-soft: rgba(19, 101, 112, 0.09);
    --legs:      #3E6A25;
    --legs-soft: rgba(62, 106, 37, 0.09);
    --core:      #5B4786;
    --core-soft: rgba(91, 71, 134, 0.09);
    --alert:     #B03A1E;
    --alert-soft: rgba(176, 58, 30, 0.08);
    --done:      #24693D;
    --shadow: 0 1px 2px rgba(22, 23, 26, 0.05);
    --shadow-float: 0 8px 28px rgba(22, 23, 26, 0.14);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --ground:    #F6F6F4;
  --surface:   #FFFFFF;
  --surface-2: #F0F0EE;
  --rule:      #E2E2DF;
  --rule-soft: #ECECE9;
  --ink:       #16171A;
  --ink-dim:   #4A4C52;
  --ink-faint: #63656B;
  --primary:    #16171A;
  --on-primary: #FFFFFF;
  --on-accent:  #FFFFFF;
  --pull:      #8A5A0E;
  --pull-soft: rgba(138, 90, 14, 0.09);
  --push:      #136570;
  --push-soft: rgba(19, 101, 112, 0.09);
  --legs:      #3E6A25;
  --legs-soft: rgba(62, 106, 37, 0.09);
  --core:      #5B4786;
  --core-soft: rgba(91, 71, 134, 0.09);
  --alert:     #B03A1E;
  --alert-soft: rgba(176, 58, 30, 0.08);
  --done:      #24693D;
  --shadow: 0 1px 2px rgba(22, 23, 26, 0.05);
  --shadow-float: 0 8px 28px rgba(22, 23, 26, 0.14);
}
:root[data-theme="dark"] { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  font-feature-settings: "cv11", "ss01";   /* Inter: single-storey a, open digits */
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
  overflow-x: hidden;
}

/* The rest timer floats over the tab bar; make room so it never hides the
   last card or the Finish button. */
body.timing { padding-bottom: calc(var(--tab-h) + var(--timer-h) + 16px + env(safe-area-inset-bottom)); }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 0;
}

p { margin: 0 0 0.85em; }
p:last-child { margin-bottom: 0; }

a { color: var(--push); text-underline-offset: 2px; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--primary); color: var(--on-primary); padding: 10px 16px;
  font-size: 14px; font-weight: 500; border-radius: 0 0 var(--radius) 0;
}
.skip:focus { left: 0; }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* Every number that sits in a column or ticks on a clock. */
.ruler, .ex__spec, .ex__num, .ex__last, .setbox, .setinput, .progress, td.num,
.warmup__count, .gauge__pct, .gauge__val, .resttimer__clock, .resttimer__btn,
.emr__clock, .emr__reps, .histrow .vol, .hiitlist__spec, .step__n, .modetoggle--emom {
  font-variant-numeric: tabular-nums;
}

/* ── Top bar ─────────────────────────────────────────────────────────── */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  /* Edges line up with the content column on wide screens. It scrolls
     away: on a phone it wraps to two lines, too much to pin mid-workout. */
  padding: 12px max(var(--pad), calc((100% - var(--content)) / 2 + var(--pad)));
  border-bottom: 1px solid var(--rule-soft);
  background: var(--ground);
}

.topbar__title {
  display: block;
  font-family: var(--font-display);
  font-weight: 600; font-size: 17px; letter-spacing: -0.01em;
}

.topbar__rev, .topbar__meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-faint);
}

.topbar__right { display: flex; align-items: center; gap: 8px; position: relative; }

.themetoggle {
  appearance: none; -webkit-appearance: none;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
  color: var(--ink-dim); cursor: pointer;
  width: 40px; height: 40px;
  transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
  display: flex; align-items: center; justify-content: center;
}
.themetoggle:hover { color: var(--ink); border-color: var(--ink-faint); }
.themetoggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.themetoggle .sun { display: none; }
:root[data-theme="light"] .themetoggle .sun { display: block; }
:root[data-theme="light"] .themetoggle .moon { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .themetoggle .sun { display: block; }
  :root:not([data-theme="dark"]) .themetoggle .moon { display: none; }
}

/* ── Views ───────────────────────────────────────────────────────────── */

.view { padding: var(--pad) var(--pad) 32px; max-width: var(--content); margin: 0 auto; }
.view[hidden] { display: none; }

.eyebrow {
  font-family: var(--font-mono); font-weight: 600;
  font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 6px;
}

/* ── Cycle ruler — where you are in the 5-week cycle ─────────────────── */

.ruler { margin-bottom: 18px; }

.ruler__caption {
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-faint); margin-bottom: 5px;
}
.ruler__caption span:first-child { color: var(--ink); }

.ruler__scale {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border: 1px solid var(--rule); border-radius: var(--radius-lg); overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.ruler__week {
  appearance: none; -webkit-appearance: none;
  background: none; border: 0;
  border-right: 1px solid var(--rule-soft);
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: 12px; font-weight: 500;
  padding: 0 2px 5px; margin: 0;
  min-height: 58px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  gap: 4px; cursor: pointer;
  position: relative;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.ruler__week:last-child { border-right: 0; }
.ruler__week::before {
  content: ""; display: block;
  width: 1px; height: 10px; background: var(--rule);
  margin-bottom: auto; margin-top: 0;
}
.ruler__week small {
  font-size: 11px;
  line-height: 1.15; text-align: center;
}
.ruler__week:hover { background: var(--surface-2); color: var(--ink); }

.ruler__week[aria-current="true"] {
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
}
.ruler__week[aria-current="true"]::before { background: var(--on-primary); }

.ruler__week[data-done="true"] .ruler__dot { opacity: 1; }
.ruler__dot {
  position: absolute; top: 5px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--done); opacity: 0;
}

/* ── Day selector ────────────────────────────────────────────────────── */

.days { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin-bottom: 20px; }

.day {
  appearance: none; -webkit-appearance: none;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink-dim);
  font-family: var(--font-mono); font-size: 11px;
  padding: 8px 2px 9px;
  min-height: 54px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  cursor: pointer; border-radius: var(--radius);
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.day strong {
  font-family: var(--font-display); font-size: 12px; font-weight: 600;
  color: var(--ink);
}
.day:hover { background: var(--surface-2); }
.day[data-side="pull"][aria-pressed="true"] { border-color: var(--pull); background: var(--pull-soft); }
.day[data-side="pull"][aria-pressed="true"] strong { color: var(--pull); }
.day[data-side="push"][aria-pressed="true"] { border-color: var(--push); background: var(--push-soft); }
.day[data-side="push"][aria-pressed="true"] strong { color: var(--push); }
.day[data-side="rest"][aria-pressed="true"] { border-color: var(--ink-faint); background: var(--surface-2); }
/* A mixed day carries both colours: the split rule is the whole point of v3. */
.day[data-side="mixed"][aria-pressed="true"] {
  background: var(--surface-2);
  border-color: var(--ink-faint);
  box-shadow: inset 0 -3px 0 -1px var(--push), inset 0 3px 0 -1px var(--pull);
}
.day[data-side="mixed"][aria-pressed="true"] strong { color: var(--ink); }
.day[data-side="test"][aria-pressed="true"] { border-color: var(--ink); background: var(--surface-2); }
.day[data-side="test"][aria-pressed="true"] strong { color: var(--ink); }
.days--one { grid-template-columns: 1fr; }
.day[data-today="true"]::after {
  content: "today"; font-size: 11px; color: var(--ink-faint);
}
.day[data-draft="true"] { position: relative; }
.day[data-draft="true"]::before {
  content: ""; position: absolute; top: 6px; right: 6px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--done);
}

/* ── Session header ──────────────────────────────────────────────────── */

.sessionhead {
  border-left: 3px solid var(--rule);
  border-radius: 2px;
  padding: 2px 0 2px 14px;
  margin-bottom: 18px;
}
.sessionhead[data-side="pull"] { border-left-color: var(--pull); }
.sessionhead[data-side="push"] { border-left-color: var(--push); }
.sessionhead[data-side="mixed"] {
  border-left-color: transparent;
  border-image: linear-gradient(var(--pull) 0 50%, var(--push) 50% 100%) 1;
}
.sessionhead[data-side="test"] { border-left-style: dashed; border-left-color: var(--ink); }

.sessionhead h2 { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; color: var(--ink); }

.sessionhead__sub {
  font-family: var(--font-mono); font-size: 13px; color: var(--ink-dim);
  margin-top: 4px;
}

.sessionhead__time {
  font-family: var(--font-mono); font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-dim);
  margin-top: 6px;
}
.sessionhead__time span { font-size: 12px; color: var(--ink-faint); }

.sessionnote {
  font-size: 14px; color: var(--ink-dim);
  border-left: 2px solid var(--rule);
  padding: 2px 0 2px 12px;
  margin: 14px 0 18px;
}

.badge {
  display: inline-block;
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.04em; text-transform: uppercase;
  font-weight: 600;
  padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--rule); color: var(--ink-faint);
  margin-top: 8px;
}
.badge--derived { border-color: var(--pull); color: var(--pull); background: var(--pull-soft); }
.badge--gate { border-color: var(--alert); color: var(--alert); background: var(--alert-soft); }

/* ── Cards ───────────────────────────────────────────────────────────── */

.card {
  border: 1px solid var(--rule);
  background: var(--surface);
  border-radius: var(--radius-lg);
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.card__body { padding: 14px 16px 16px; }

.ex__top { display: flex; gap: 10px; align-items: baseline; }

.ex__num {
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint);
  min-width: 20px; padding-top: 2px; font-variant-numeric: tabular-nums;
}

.ex__name {
  font-family: var(--font-display); font-weight: 600; font-size: 16px; letter-spacing: -0.01em;
  line-height: 1.25; flex: 1;
}
.card[data-emphasis="true"] .ex__name { font-weight: 700; }
.card[data-emphasis="true"][data-side="pull"] { box-shadow: inset 3px 0 0 var(--pull), var(--shadow); }
.card[data-emphasis="true"][data-side="push"] { box-shadow: inset 3px 0 0 var(--push), var(--shadow); }
.card[data-emphasis="true"][data-side="legs"] { box-shadow: inset 3px 0 0 var(--legs), var(--shadow); }
.card[data-emphasis="true"][data-side="core"] { box-shadow: inset 3px 0 0 var(--core), var(--shadow); }

/* Every card carries a hairline of its own side, so a mixed session still reads
   at a glance as pull / push / legs / core rather than as one undifferentiated list. */
.card[data-side="pull"] .ex__num { color: var(--pull); }
.card[data-side="push"] .ex__num { color: var(--push); }
.card[data-side="legs"] .ex__num { color: var(--legs); }
.card[data-side="core"] .ex__num { color: var(--core); }

.card[data-skill="true"] { background: var(--surface-2); }
.card[data-skill="true"] .ex__num { font-size: 13px; opacity: 0.7; }

.card[data-locked="true"] .ex__top .ex__name { color: var(--ink-dim); }
.card[data-test="true"] .ex__spec { text-transform: none; letter-spacing: 0; font-size: 12px; }

.ex__spec {
  font-family: var(--font-mono); font-size: 13px; font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
}

.ex__meta {
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint);
  margin-top: 4px; padding-left: 30px;
}

.ex__notes {
  font-size: 13px; color: var(--ink-dim); margin-top: 8px; padding-left: 30px;
}

/* What you did last time on this exact variation: the number to beat. */
.ex__last {
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
  margin-top: 4px; padding-left: 30px;
}

/* ── Set tally — drafting checklist squares ──────────────────────────── */

.sets { display: flex; flex-wrap: wrap; gap: 8px 10px; margin-top: 6px; padding-left: 30px; }
.sets__head {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink-faint);
  margin-top: 12px; padding-left: 30px;
}

/* One set is one unit: a raised tick button joined to the sunken field(s)
   you type into, so the pair can't be misread as two inputs. */
.setrow {
  display: flex; align-items: stretch;
  border: 1px solid var(--rule); border-radius: var(--radius);
  overflow: hidden;
}
.setrow > * { outline-offset: -3px; }
.setrow .setbox {
  width: 44px; height: 46px;
  border: 0; border-right: 1px solid var(--rule); border-radius: 0;
  background: var(--surface-2); color: var(--ink-dim); font-weight: 600;
}
.setrow .setbox:hover { background: var(--rule); color: var(--ink); }
.setrow .setbox[aria-pressed="true"] { background: var(--done); border-right-color: var(--done); }
.setrow .setinput { border: 0; border-radius: 0; width: 52px; background: var(--surface); }
.setrow .setinput + .setinput { border-left: 1px solid var(--rule-soft); }
.setrow:has(.setbox[aria-pressed="true"]) { border-color: var(--done); }

.setbox__tick { display: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.setbox[aria-pressed="true"] .setbox__tick { display: block; }
.setbox[aria-pressed="true"] .setbox__n { display: none; }

.setbox {
  appearance: none; -webkit-appearance: none;
  width: 46px; height: 46px;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink-faint);
  font-family: var(--font-mono); font-size: 12px; font-variant-numeric: tabular-nums;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.setbox:hover { border-color: var(--ink-faint); }
.setbox:active { transform: scale(0.96); }
.setbox[aria-pressed="true"] {
  background: var(--done); border-color: var(--done); color: var(--on-accent); font-weight: 600;
}

.setinput {
  width: 46px; height: 46px;
  border: 1px solid var(--rule); background: var(--ground); color: var(--ink);
  /* 16px: below that, iOS zooms the page when the field takes focus. */
  font-family: var(--font-mono); font-size: 16px; font-weight: 500; font-variant-numeric: tabular-nums;
  text-align: center; border-radius: var(--radius);
  -moz-appearance: textfield;
  transition: border-color var(--t-fast) var(--ease);
}
.setinput::-webkit-outer-spin-button, .setinput::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0;
}
.setinput:disabled { opacity: 0.45; cursor: not-allowed; }
/* A target, not a logged value: dimmer and italic so the two never look alike. */
.setinput::placeholder { color: var(--ink-faint); opacity: 0.85; font-weight: 400; font-size: 14px; }

/* ── Pairs: two non-competing movements alternated ───────────────────── */

.pair {
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius-lg);
  padding: 10px;
  margin-bottom: 14px;
  background: var(--surface-2);
}
.pair .card { margin-bottom: 8px; }
.pair .card:last-child { margin-bottom: 0; }

/* Adding an exercise to the session on screen. */
details.about.addex { margin: 10px 0 0; }
.addex__form { margin-top: 12px; }
.addex__row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
details.about.addex .sessionnote { margin: 4px 0 12px; }

/* A weight set by hand in the Program tab's Your loads. */
.loadform { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.loadform .setinput { width: 72px; height: 36px; }
.loadtable td:nth-child(2) .btn { white-space: nowrap; }
/* The status is a sentence: left, where .table--tight puts a last cell right. */
.table--tight.loadtable td:last-child { text-align: left; min-width: 12em; }

.pair__head, .solo__head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: 13px; line-height: 1.4;
  color: var(--ink-faint);
  padding: 2px 4px 8px;
}
.pair__tag {
  color: var(--ink); background: var(--surface); border: 1px solid var(--rule);
  border-radius: 999px; padding: 2px 9px; font-weight: 600;
  font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase;
}
.solo[data-power="true"] { margin-bottom: 14px; }
.solo[data-power="true"] .solo__head { color: var(--pull); }

/* ── Gates: locked movement, with the fallback you do instead ─────────── */

.lock {
  border: 1px dashed var(--alert);
  border-radius: var(--radius-lg);
  padding: 10px 12px;
  margin: 10px 0;
  font-size: 13px;
  color: var(--ink-dim);
}
.lock__head { margin-bottom: 6px; color: var(--ink); }
.lock__head strong { color: var(--alert); }
.lock p { margin: 6px 0 0; }
.lock__sub {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-faint); margin-top: 10px !important;
}
.badge--locked { border-color: var(--alert); color: var(--alert); background: transparent; }
.badge--gate { border-color: var(--pull); color: var(--pull); background: transparent; }
.badge--ready { border-color: var(--done); color: var(--done); background: transparent; }
.badge--gym { border-color: var(--rule); color: var(--ink-faint); background: transparent; }

/* Variation picker: any rung up to your level, the next one shown but disabled. */

.pickers { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; padding-left: 30px; }
.picker { display: flex; flex-direction: column; gap: 3px; flex: 1 1 180px; min-width: 0; }
.picker > span {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink-faint);
}
.picker select {
  width: 100%; min-height: 40px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--rule); border-radius: var(--radius);
  font-family: var(--font-body); font-size: 14px; padding: 6px 10px;
}

/* Away from the gym: a collapsed swap on every gym-dependent card. */

.alt { margin: 10px 0 0; }
.alt summary {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; list-style: none;
  padding: 3px 0;
}
.alt summary::-webkit-details-marker { display: none; }
.alt__cue {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.04em; color: var(--ink-faint);
  text-decoration: underline; text-decoration-style: dotted;
  text-underline-offset: 3px;
}
.alt[open] .alt__cue { text-decoration: none; color: var(--ink-dim); }
.alt > p {
  margin: 8px 0 0;
  padding-left: 12px;
  border-left: 1px solid var(--rule);
  font-size: 13px; color: var(--ink-dim);
}

/* ── Test sessions ───────────────────────────────────────────────────── */

.testresult { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.testfield { display: flex; flex-direction: column; gap: 4px; flex: 1 1 130px; }
.testfield > span {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-faint);
}
.testfield .setinput { width: 100%; }

.recal {
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  box-shadow: inset 3px 0 0 var(--done), var(--shadow);
  background: var(--surface);
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.5;
}
.recal strong { color: var(--done); }
.recal ul { margin: 8px 0 4px; padding-left: 18px; }
.recal li { margin-bottom: 4px; color: var(--ink-dim); }
.recal li b { color: var(--ink); font-weight: 600; }
.recal .btn { margin-top: 6px; }

.sessionnote--quiet { color: var(--ink-faint); font-size: 13px; }
.sessionnote--warn { border-left-color: var(--alert); color: var(--ink-dim); }
.sessionnote--warn a { color: var(--pull); }

.subhead {
  font-family: var(--font-display);
  font-size: 15px; letter-spacing: 0.01em;
  margin-top: 18px; margin-bottom: 4px;
}

/* ── Ladders (program view) ──────────────────────────────────────────── */

.ladders { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.lad { border: 1px solid var(--rule); background: var(--surface); border-radius: var(--radius-lg); }
.lad { overflow: hidden; box-shadow: var(--shadow); }
.lad__head {
  display: flex; justify-content: space-between; gap: 8px;
  font-family: var(--font-display); font-weight: 600; font-size: 15px;
  padding: 11px 14px; border-bottom: 1px solid var(--rule-soft);
  box-shadow: inset 3px 0 0 var(--rule);
}
.lad__head[data-side="pull"] { box-shadow: inset 3px 0 0 var(--pull); }
.lad__head[data-side="push"] { box-shadow: inset 3px 0 0 var(--push); }
.lad__head[data-side="core"] { box-shadow: inset 3px 0 0 var(--core); }
.lad__head[data-side="legs"] { box-shadow: inset 3px 0 0 var(--legs); }
.lad__head span { font-family: var(--font-mono); font-size: 11px; font-weight: 500; color: var(--ink-faint); }
.lad__list { list-style: none; margin: 0; padding: 4px 0; }
.lad__rung {
  appearance: none; -webkit-appearance: none; background: none; border: 0;
  width: 100%; text-align: left; cursor: pointer; color: var(--ink-dim);
  display: grid; grid-template-columns: 14px 1fr; column-gap: 8px;
  padding: 8px 14px; font-family: var(--font-body); font-size: 14px;
  transition: background var(--t-fast) var(--ease);
}
.lad__rung:hover:not(:disabled) { background: var(--surface-2); }
.lad__rung:disabled { cursor: not-allowed; }
.lad__mark {
  grid-row: span 2; width: 10px; height: 10px; margin-top: 4px;
  border: 1px solid var(--rule); border-radius: 50%;
}
.lad__spec { grid-column: 2; font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint); }
li[data-status="done"] .lad__mark { background: var(--done); border-color: var(--done); }
li[data-status="done"] .lad__name { color: var(--ink-faint); }
li[data-status="current"] .lad__mark { background: var(--ink); border-color: var(--ink); box-shadow: 0 0 0 3px var(--surface-2); }
li[data-status="current"] .lad__name { color: var(--ink); font-weight: 600; }
li[data-status="locked"] .lad__name { color: var(--ink-faint); }
li[data-status="locked"] .lad__mark { border-style: dashed; border-color: var(--alert); }
li[data-status="locked"] .lad__spec { color: var(--alert); }

tr.row--current td { background: var(--surface-2); color: var(--ink); }

/* ── EMOM grid ───────────────────────────────────────────────────────── */

.emom { margin-top: 12px; padding-left: 30px; }
.emom__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 5px; }
.emom__min { width: 100%; }
.emom__start {
  margin-top: 10px; width: 100%;
}

/* ── Buttons ─────────────────────────────────────────────────────────── */

.btn {
  appearance: none; -webkit-appearance: none; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink);
  font-family: var(--font-body); font-size: 14px; font-weight: 500; line-height: 1.2;
  padding: 11px 18px; min-height: 44px;
  border-radius: var(--radius); cursor: pointer;
  box-shadow: var(--shadow);
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.btn:hover { border-color: var(--ink-faint); background: var(--surface-2); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn--primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 600; }
.btn--primary:hover { background: var(--primary); border-color: var(--primary); opacity: 0.88; }
.btn--ghost { background: transparent; box-shadow: none; }
.btn--danger { color: var(--alert); border-color: color-mix(in srgb, var(--alert) 45%, var(--rule)); background: transparent; box-shadow: none; }
.btn--danger:hover { background: var(--alert-soft); border-color: var(--alert); }
.btn--sm { padding: 7px 12px; min-height: 36px; font-size: 13px; }
.btn--block { width: 100%; }

.btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* ── Warm-up ─────────────────────────────────────────────────────────── */

details.warmup { border: 1px solid var(--rule); background: var(--surface); border-radius: var(--radius-lg); margin-bottom: 16px; }
details.warmup > summary {
  padding: 13px 14px; cursor: pointer; list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-family: var(--font-display); font-weight: 600; font-size: 15px;
}
details.warmup { box-shadow: var(--shadow); }
details.warmup > summary::-webkit-details-marker { display: none; }
.warmup__count {
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.warmup__count[data-complete="true"] { color: var(--done); }
.warmup__list { padding: 0 14px 14px; }
.warmup__item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 0; border-top: 1px solid var(--rule-soft);
  min-height: 44px;
  cursor: pointer;
  position: relative;
}
/* A real checkbox, visually replaced by .tick. */
.warmup__check {
  position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0;
}
.warmup__check:focus-visible + .tick { outline: 2px solid var(--ink); outline-offset: 2px; }
.warmup__item .label { flex: 1; font-size: 14px; }
.warmup__item em {
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint);
  font-style: normal; font-variant-numeric: tabular-nums;
}
.tick {
  width: 22px; height: 22px; flex: 0 0 22px;
  border: 1.5px solid var(--ink-faint); border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.warmup__check:checked + .tick { background: var(--done); border-color: var(--done); }
.warmup__check:checked + .tick::after { content: ""; width: 9px; height: 5px; border-left: 2px solid var(--on-accent); border-bottom: 2px solid var(--on-accent); transform: rotate(-45deg) translate(1px, -1px); }
.warmup__check:checked ~ .label { color: var(--ink-faint); text-decoration: line-through; }
.warmup__all { margin-top: 10px; }

/* Session guidance, folded away so the first set is closer to the top. The
   summary is drawn as a button with a chevron, so it reads as something to tap. */
details.about { margin: 0 0 16px; }
details.about > summary {
  cursor: pointer; list-style: none;
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px;
  padding: 0 14px 0 10px;
  border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface);
  font-family: var(--font-body); font-size: 14px; font-weight: 500; color: var(--ink);
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
details.about > summary:hover { border-color: var(--ink-faint); background: var(--surface-2); }
details.about > summary::-webkit-details-marker { display: none; }
details.about > summary::before {
  content: ""; width: 7px; height: 7px; flex: none; margin: 0 2px;
  border-right: 2px solid var(--ink-dim); border-bottom: 2px solid var(--ink-dim);
  transform: rotate(-45deg); transition: transform var(--t-fast) var(--ease);
}
details.about[open] > summary::before { transform: rotate(45deg) translate(-1px, -1px); }
details.about .sessionnote { margin: 8px 0 0; }

.warmup__warn {
  font-size: 13px; color: var(--alert); border-top: 1px solid var(--rule-soft);
  padding-top: 10px; margin-top: 4px;
}

/* ── Session footer ──────────────────────────────────────────────────── */

.sessionfoot { margin-top: 22px; border-top: 1px solid var(--rule); padding-top: 16px; }

.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block;
  font-family: var(--font-body); font-size: 13px; font-weight: 500;
  color: var(--ink-dim); margin-bottom: 6px;
}
.field textarea, .field input, .field select {
  width: 100%; background: var(--surface); color: var(--ink);
  border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 10px 12px; font-family: var(--font-body); font-size: 16px;
  min-height: 44px;
  transition: border-color var(--t-fast) var(--ease);
}
.field textarea:hover, .field input:hover, .field select:hover, .setinput:hover:not(:disabled) { border-color: var(--ink-faint); }
.field textarea::placeholder, .field input::placeholder { color: var(--ink-faint); }
.field textarea { resize: vertical; min-height: 74px; }

/* Pinned while you scroll through the session: how far along you are. */
.progress {
  position: sticky; top: 0; z-index: 5;
  margin: 0 calc(-1 * var(--pad)) 12px;
  padding: 9px var(--pad) 8px;
  background: color-mix(in srgb, var(--ground) 92%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule-soft);
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.progress b { color: var(--done); font-weight: 600; }
.progress__bar { display: block; height: 4px; margin-top: 6px; background: var(--rule-soft); border-radius: 2px; overflow: hidden; }
.progress__bar > span { display: block; height: 100%; background: var(--done); transition: width var(--t) var(--ease); }

.restday {
  border: 1px dashed var(--rule); border-radius: var(--radius-lg);
  padding: 28px 18px; text-align: center; color: var(--ink-dim);
}
.restday h2 {
  font-size: 20px;
  color: var(--ink-dim); margin-bottom: 8px;
}

/* ── Balance gauge — the signature ───────────────────────────────────── */

.gauge {
  border: 1px solid var(--rule); background: var(--surface);
  border-radius: var(--radius-lg); padding: 16px 14px 14px; margin-bottom: 18px;
}
.gauge__head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; gap: 10px; }
.gauge__title {
  font-family: var(--font-display); font-weight: 600; font-size: 15px;
}
.gauge__pct {
  font-family: var(--font-mono); font-size: 20px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.gauge__bars { display: grid; gap: 10px; }
.gauge__row { display: grid; grid-template-columns: 38px 1fr 44px; align-items: center; gap: 10px; }
.gauge__key {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink-faint);
}
.gauge__track { position: relative; height: 12px; background: var(--rule-soft); display: block; border-radius: 6px; }
.gauge__fill { border-radius: 6px; }
.gauge__fill { position: absolute; inset: 0 auto 0 0; display: block; }
.gauge__fill[data-side="pull"] { background: var(--pull); }
.gauge__fill[data-side="push"] { background: var(--push); }
.gauge__target {
  position: absolute; top: -4px; bottom: -4px; width: 0;
  border-left: 1px dashed var(--push);
}
.gauge__val {
  font-family: var(--font-mono); font-size: 13px; font-weight: 600;
  font-variant-numeric: tabular-nums; text-align: right;
}
.gauge__legend {
  display: flex; justify-content: space-between; margin-top: 8px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase;
}
.gauge__legend .pull { color: var(--pull); }
.gauge__legend .push { color: var(--push); }
.gauge__caption { font-size: 13px; color: var(--ink-dim); margin-top: 10px; }

/* ── Tables ──────────────────────────────────────────────────────────── */

.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 18px; border: 1px solid var(--rule); border-radius: var(--radius-lg); }

table { border-collapse: collapse; width: 100%; font-size: 14px; background: var(--surface); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
thead th {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink-faint); font-weight: 600;
  background: var(--surface); white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
td.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
td.real { color: var(--pull); font-weight: 500; }
td.weightval { color: var(--core); font-weight: 500; }
td.was { color: var(--ink-faint); text-decoration: line-through; }

/* ── Prose sections ──────────────────────────────────────────────────── */

.section { margin-bottom: 30px; }
.section > h2 {
  font-size: 18px; letter-spacing: -0.01em;
  padding-bottom: 10px; border-bottom: 1px solid var(--rule-soft); margin-bottom: 14px;
}
.section p { font-size: 14.5px; color: var(--ink-dim); }
.section p strong { color: var(--ink); font-weight: 600; }

.rules { counter-reset: rule; display: grid; gap: 12px; }
.rule-item {
  border-left: 2px solid var(--rule); padding-left: 14px; position: relative;
}
.rule-item h3 { font-size: 15px; }
.rule-item p { font-size: 13.5px; color: var(--ink-dim); margin-top: 4px; }

.warnlist { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.warnlist li {
  border: 1px solid var(--alert); background: var(--alert-soft);
  border-radius: var(--radius-lg); padding: 11px 13px; font-size: 14px;
}
.warnfoot { font-size: 13.5px; color: var(--ink-dim); margin-top: 12px; }

.protocol { list-style: none; counter-reset: p; padding: 0; margin: 0; display: grid; gap: 8px; }
.protocol li {
  counter-increment: p; display: flex; gap: 10px; font-size: 14px; color: var(--ink-dim);
}
.protocol li::before {
  content: counter(p); font-family: var(--font-mono); font-size: 12px; font-weight: 600;
  color: var(--ink-faint); flex: 0 0 18px; padding-top: 1px;
}

/* ── Log view ────────────────────────────────────────────────────────── */

.miniform { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; align-items: end; }
.miniform .field { margin-bottom: 0; }
/* The date needs its own row; squeezed into a 72px column it reads "19/0". */
.miniform .field:first-child { grid-column: 1 / -1; max-width: 220px; }

/* Narrow enough to fit a phone without scrolling sideways to the delete button. */
.table--tight th, .table--tight td { padding-left: 8px; padding-right: 8px; }
.table--tight td:last-child { text-align: right; padding-top: 4px; padding-bottom: 4px; vertical-align: middle; }

.empty {
  font-size: 14px; color: var(--ink-faint);
  border: 1px dashed var(--rule); border-radius: var(--radius-lg);
  padding: 18px 14px; text-align: center;
}

/* One small chart per max: they are counted on very different scales, so
   each gets its own axis rather than sharing one. */
.charts { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); margin-bottom: 16px; }
.chartcard { border: 1px solid var(--rule); background: var(--surface); border-radius: var(--radius-lg); padding: 12px 14px 8px; box-shadow: var(--shadow); }
.chartcard__head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-dim);
}
.chartcard__head b { font-size: 15px; color: var(--ink); font-weight: 600; letter-spacing: 0; }
/* Capped: the viewBox scales its own text, so letting this fill a wide
   column would blow the labels up to headline size. */
.chart { width: 100%; max-width: 420px; height: auto; display: block; }
.chart circle.hit { fill: transparent; }

/* The current weigh-in, read before the chart under it. */
.weightnow {
  font-family: var(--font-mono); font-size: 13px; color: var(--ink-dim);
  margin: 0 0 14px; letter-spacing: 0.01em;
}
.weightnow b { font-size: 18px; color: var(--ink); font-weight: 600; }

/* Whether the browser will keep the log. Neutral when it said yes, and
   coloured like a warning when it did not, because that is what it is. */
.persistnote {
  font-size: 13px; line-height: 1.5; margin: 10px 0 0;
  border-left: 2px solid var(--rule); padding-left: 10px; color: var(--ink-dim);
}
.persistnote[data-persist="granted"] { border-left-color: var(--done); }
.persistnote[data-persist="denied"],
.persistnote[data-persist="unsupported"] {
  border-left-color: var(--alert); background: var(--alert-soft);
  padding: 8px 10px; color: var(--ink);
}

/* What a ladder card says about your history on it: sits under the rungs,
   quieter than them, because it is the record and not the instruction. */
/* The card itself has no padding; the head and the rungs bring their own, so
   this brings its own too. */
.lad__hist { border-top: 1px solid var(--rule-soft); padding: 10px 12px 12px; }
.lad__facts {
  display: flex; flex-wrap: wrap; gap: 4px 14px;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--ink-faint);
}
.lad__chart { margin-top: 10px; max-width: 420px; }
.lad__trail { margin-top: 8px; }
.lad__trail summary {
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-dim); cursor: pointer; padding: 3px 0;
}
.lad__trail ol, .trail { list-style: none; margin: 6px 0 0; padding: 0; }
.lad__trail li, .trail li {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px;
  padding: 7px 0 7px 12px; border-bottom: 1px solid var(--rule-soft);
  font-size: 13px; position: relative;
}
.lad__trail li:last-child, .trail li:last-child { border-bottom: 0; }

/* The direction of the move, as a mark in the gutter. Up is the common case
   and stays quiet; a step back is worth seeing. */
.lad__trail li::before, .trail li::before {
  content: ""; position: absolute; left: 0; top: 13px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--ink-faint);
}
.lad__trail li[data-dir="up"]::before, .trail li[data-dir="up"]::before { background: var(--done); }
.lad__trail li[data-dir="down"]::before, .trail li[data-dir="down"]::before { background: var(--alert); }

.lad__trail .when, .trail .when {
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint);
  min-width: 80px; flex-shrink: 0;
}
.lad__trail .what, .trail .what { color: var(--ink-dim); flex: 1 1 180px; }
.trail .what b { color: var(--ink); font-weight: 600; }
.lad__trail .how, .trail .how {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink-faint);
  border: 1px solid var(--rule); border-radius: 999px; padding: 1px 7px;
}

/* The stall notice carries an action, so it is a block rather than a line. */
.stallnote { display: grid; gap: 10px; justify-items: start; }
.stallnote p { margin: 0; }

.formmsg { font-size: 13px; color: var(--alert); margin: 10px 0 0; }
.formmsg[hidden] { display: none; }

.histrow {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  padding: 12px 0; border-bottom: 1px solid var(--rule-soft); font-size: 14px;
}
.histrow:last-child { border-bottom: 0; }
.histrow .when { font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint); white-space: nowrap; }
.histrow .what { flex: 1; }
.histrow .vol { font-family: var(--font-mono); font-size: 12px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.histrow .btn { min-height: 30px; padding: 4px 9px; }
/* The label opens the session under its row. */
.histrow__open {
  appearance: none; background: none; border: 0; padding: 0 16px 0 0; margin: 0; position: relative;
  font: inherit; color: inherit; text-align: left; cursor: pointer; min-height: 30px;
}
.histrow__open::after { content: "▸"; color: var(--ink-faint); position: absolute; top: 0; right: 0; }
.histrow__open[aria-expanded="true"]::after { content: "▾"; }
.histrow__note { font-family: var(--font-body); font-style: italic; white-space: pre-line; }

.histedit {
  margin: 0 0 12px; padding: 14px; border: 1px solid var(--rule); border-radius: var(--radius-lg);
  background: var(--surface-2);
}
.histedit__date input { max-width: 200px; }
.histedit__row { padding: 10px 0; border-top: 1px solid var(--rule-soft); }
.histedit__row:first-of-type { border-top: 0; }
.histedit__head { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; font-weight: 500; margin-bottom: 8px; }
.histedit__unit { font-family: var(--font-mono); font-size: 12px; font-weight: 400; color: var(--ink-faint); }
.histedit__cells { display: flex; flex-wrap: wrap; gap: 8px 12px; }
.histedit__cell { display: inline-flex; align-items: center; gap: 4px; }
.histedit__n { font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint); min-width: 1.2ch; }
.histedit__cell .setinput { width: 56px; }
.histedit__cell .histedit__time { width: 72px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Rest timer ──────────────────────────────────────────────────────── */

.resttimer {
  position: fixed;
  left: 10px; right: 10px;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 8px);
  z-index: 40;
  display: flex; align-items: center; gap: 8px;
  height: var(--timer-h);
  padding: 4px 10px 0 16px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  overflow: hidden;
  max-width: calc(var(--content) - 20px); margin: 0 auto;
}
.resttimer[hidden] { display: none; }
/* Drains left to right as the rest runs out. */
.resttimer__bar { position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--rule-soft); }
.resttimer__bar > span { display: block; height: 100%; background: var(--ink); transition: background var(--t) var(--ease); }
.resttimer[data-done="true"] .resttimer__bar > span { background: var(--done); }
.resttimer__btn {
  appearance: none; background: var(--surface-2); border: 1px solid var(--rule);
  color: var(--ink-dim); font-family: var(--font-mono); font-size: 13px; font-weight: 500;
  font-variant-numeric: tabular-nums;
  min-width: 44px; min-height: 40px; padding: 0 6px;
  border-radius: var(--radius); cursor: pointer;
}
.resttimer__btn:hover { border-color: var(--ink-faint); color: var(--ink); }
.resttimer__label {
  font-family: var(--font-body); font-size: 13px; font-weight: 500; color: var(--ink-dim); flex: 1;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.resttimer__clock {
  font-family: var(--font-mono); font-size: 24px; font-weight: 600; letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums; color: var(--ink);
  min-width: 3.2ch; text-align: center;
}
.resttimer[data-done="true"] .resttimer__clock { color: var(--done); }
/* HIIT holds: the hold itself reads in the core colour and larger, the
   count-in and side switch in a quieter tone. */
.resttimer[data-kind="work"] { background: color-mix(in srgb, var(--core) 12%, var(--surface)); border-color: color-mix(in srgb, var(--core) 45%, var(--rule)); }
.resttimer[data-kind="work"] .resttimer__bar > span { background: var(--core); }
.resttimer[data-kind="work"] .resttimer__clock { color: var(--core); font-size: 28px; }
.resttimer[data-kind="work"] .resttimer__label { color: var(--core); }
.resttimer[data-kind="ready"] .resttimer__clock,
.resttimer[data-kind="switch"] .resttimer__clock { color: var(--ink); }
.resttimer[data-kind="ready"] .resttimer__bar > span,
.resttimer[data-kind="switch"] .resttimer__bar > span { background: var(--ink-faint); }
.resttimer[data-done="true"] .resttimer__bar > span { background: var(--done); }
.resttimer[data-done="true"] .resttimer__clock { color: var(--done); }
.resttimer__skip {
  appearance: none; background: var(--primary); border: 1px solid var(--primary);
  color: var(--on-primary); font-family: var(--font-body); font-size: 13px; font-weight: 600;
  padding: 0 14px; border-radius: var(--radius); cursor: pointer; min-height: 40px;
}
.resttimer__skip:hover { opacity: 0.88; }
/* A timed block's clock (EMOM, AMRAP, for time) can't be nudged or skipped
   without falling out of step, so it drops those and the label gets the room. */
.resttimer[data-clock="true"] .resttimer__btn,
.resttimer[data-clock="true"] .resttimer__skip { display: none; }
.resttimer[data-clock="true"] .resttimer__label {
  white-space: normal; line-height: 1.25;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
}

/* ── Toast — confirms an action and offers to undo it ────────────────── */

.toast {
  position: fixed; z-index: 60;
  left: var(--pad); right: var(--pad);
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 10px);
  max-width: calc(var(--content) - 2 * var(--pad)); margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 8px 8px 16px; min-height: 48px;
  background: var(--primary); color: var(--on-primary);
  border-radius: var(--radius-lg);
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-float);
}
.toast[hidden] { display: none; }
body.timing .toast { bottom: calc(var(--tab-h) + var(--timer-h) + env(safe-area-inset-bottom) + 18px); }
.toast__msg { flex: 1; }
.toast__undo {
  appearance: none; background: none; border: 0; cursor: pointer;
  color: inherit; font-family: var(--font-body); font-size: 14px; font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px;
  min-height: 36px; padding: 0 10px;
}
.toast__undo[hidden] { display: none; }

/* ── Timed blocks in a custom workout ────────────────────────────────── */

.timed { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; margin: 12px 0 4px; padding-left: 30px; }
.timed .btn { align-self: center; }
.timed__note { font-size: 13px; color: var(--ink-faint); align-self: center; flex: 1 1 160px; }
.timed__time { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; align-self: center; }
/* The AMRAP count is tapped mid-round, out of breath: a big number and a big
   button. */
.amrap { flex: 1 1 100%; display: grid; grid-template-columns: auto 56px 1fr; gap: 8px; align-items: stretch; }
.amrap__count { display: flex; flex-direction: column; gap: 2px; }
.amrap__count > span { font-size: 12px; font-weight: 500; color: var(--ink-dim); }
.amrap__n.setinput { width: 3.4ch; height: 52px; font-size: 32px; font-weight: 600; text-align: center; padding: 0 4px; }
.amrap .btn { min-height: 64px; font-size: 18px; }
.amrap__more { font-weight: 600; }
.emb__ctl.timed__reps { flex: 1 1 100%; flex-direction: row; align-items: center; gap: 10px; }
.timed__reps .setinput { width: 72px; }

.templates { margin-bottom: 22px; }
.templates__group { margin-top: 12px; }
.templates__group .sets__head { padding-left: 0; margin-top: 0; }
.templates__group .btnrow { margin-top: 6px; }

/* ── Training calendar ───────────────────────────────────────────────── */
/* Shaded by how many sessions a day had, in ink, not in a side's colour:
   the colours mean pull, push, legs and core everywhere else. */

.cal__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.cal__head strong { font-size: 15px; font-weight: 600; }
.cal__head .btn { min-width: 44px; font-size: 18px; padding: 0 10px; }
.cal__stats { font-size: 13px; color: var(--ink-dim); margin: 0 0 10px; font-variant-numeric: tabular-nums; }
.cal__stats b { color: var(--ink); font-weight: 600; }
.cal__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal__dow { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-faint); text-align: center; padding-bottom: 2px; }
.cal__cell {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  min-height: 44px; padding: 5px 2px 4px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 1px;
  border: 1px solid var(--rule-soft); border-radius: var(--radius);
  background: var(--surface); color: var(--ink-dim);
  font-family: var(--font-body); font-variant-numeric: tabular-nums;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.cal__cell:hover { border-color: var(--ink-faint); }
.cal__cell--pad { border: 0; background: none; min-height: 0; cursor: default; }
.cal__num { font-size: 13px; font-weight: 500; }
.cal__modes { font-size: 10px; font-weight: 600; letter-spacing: 0.02em; line-height: 1.1; }
.cal__cell[data-n="1"] { background: color-mix(in srgb, var(--ink) 12%, var(--surface)); color: var(--ink); }
.cal__cell[data-n="2"] { background: color-mix(in srgb, var(--ink) 24%, var(--surface)); color: var(--ink); }
.cal__cell[data-n="3"] { background: color-mix(in srgb, var(--ink) 36%, var(--surface)); color: var(--ink); }
.cal__cell[aria-current="date"] { border-color: var(--ink); }
.cal__cell[aria-pressed="true"] { outline: 2px solid var(--ink); outline-offset: 1px; }
.cal__list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.cal__tag {
  display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-faint); border: 1px solid var(--rule); border-radius: 999px; padding: 1px 8px; margin-right: 4px;
}
.cal__key { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 10px 0 0; font-size: 11px; color: var(--ink-faint); }

/* ── Progress charts ─────────────────────────────────────────────────── */

.progresspick { max-width: 360px; }

/* ── Full backup ─────────────────────────────────────────────────────── */

.backup { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--rule-soft); }
.backupnote { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.backupnote > span:first-child { flex: 1 1 220px; }
.backupnote .btnrow { margin-top: 0; }

/* ── Update bar — a new version is installed and waiting ────────────── */
/* At the top, so it never sits on the rest timer or the toast. */

.updatebar {
  position: fixed; z-index: 80;
  top: calc(env(safe-area-inset-top) + 10px);
  left: var(--pad); right: var(--pad);
  max-width: calc(var(--content) - 2 * var(--pad)); margin: 0 auto;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 6px 6px 16px; min-height: 48px;
  background: var(--primary); color: var(--on-primary);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-float);
  font-size: 14px; font-weight: 500;
}
.updatebar span { flex: 1; }
.updatebar button {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  border: 0; border-radius: var(--radius); min-height: 36px;
  font-family: var(--font-body); font-size: 14px; font-weight: 600;
}
.updatebar__go { background: var(--on-primary); color: var(--primary); padding: 0 14px; }
.updatebar__later { background: none; color: inherit; width: 36px; font-size: 18px; opacity: 0.7; }

/* ── Tab bar ─────────────────────────────────────────────────────────── */

.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--rule-soft);
  padding-bottom: env(safe-area-inset-bottom);
  /* The bar spans the screen; the tabs stay over the content column. */
  padding-inline: max(0px, calc((100% - var(--content)) / 2));
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; height: var(--tab-h);
  text-decoration: none; color: var(--ink-faint);
  font-family: var(--font-body); font-size: 11px; font-weight: 500;
  transition: color var(--t-fast) var(--ease);
}
.tab:hover { color: var(--ink-dim); }
.tab svg { box-sizing: content-box; padding: 3px 14px; border-radius: 999px; transition: background var(--t-fast) var(--ease); }
.tab svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tab[aria-current="page"] { color: var(--ink); font-weight: 600; }
.tab[aria-current="page"] svg { background: var(--surface-2); stroke-width: 1.9; }

/* ── Banner ──────────────────────────────────────────────────────────── */

.banner {
  background: var(--alert-soft); border-bottom: 1px solid color-mix(in srgb, var(--alert) 40%, transparent);
  color: var(--alert); padding: 10px var(--pad); font-size: 13px;
}
.banner[hidden] { display: none; }

/* ── Touch targets ───────────────────────────────────────────────────── */
/* Compact controls keep their size on screen but take a 44px tall tap,
   through an invisible extension: in a gym the phone is held with chalky
   hands, often at arm length. Selects cannot carry a pseudo-element, so
   they are 44px outright. */

.btn--sm, .chip, .hiitlist__go, .modetoggle, .themetoggle, .emb__del, .resttimer__btn, .resttimer__skip, .toast__undo, .updatebar button {
  position: relative;
}
.btn--sm::after, .chip::after, .hiitlist__go::after, .modetoggle::after, .themetoggle::after,
.emb__del::after, .resttimer__btn::after, .resttimer__skip::after, .toast__undo::after, .updatebar button::after {
  content: ""; position: absolute; left: 0; right: 0;
  top: 50%; height: max(100%, 44px); transform: translateY(-50%);
}
.themetoggle { flex: none; }
.picker select, .emb__unit, .emb__ctl select, .cb__settings select { min-height: 44px; height: auto; }
details.about > summary, details.warmup > summary, .alt summary { min-height: 44px; }
.lad__trail summary { display: flex; align-items: center; min-height: 44px; }

/* ── Motion ──────────────────────────────────────────────────────────── */

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

@media (min-width: 560px) {
  :root { --pad: 24px; }
  .sessionhead h2 { font-size: 28px; }
}

/* ── Program switch and the Brieuc program ───────────────────────────── */

.modetoggle {
  appearance: none; -webkit-appearance: none;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
  color: var(--ink-dim); cursor: pointer;
  height: 40px; padding: 0 12px; white-space: nowrap;
  font-family: var(--font-body); font-size: 13px; font-weight: 500;
  transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.modetoggle:hover { color: var(--ink); border-color: var(--ink-faint); }

.days--week { grid-template-columns: repeat(7, 1fr); gap: 4px; }
.days--week .day { font-size: 10px; padding-left: 0; padding-right: 0; }
.days--week .day strong { font-size: 10px; }

.warmup__group {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink-faint);
  padding: 12px 0 6px; border-top: 1px solid var(--rule-soft);
}
.warmup__group:first-child { border-top: 0; padding-top: 0; }

.topups { display: grid; gap: 8px; margin-top: 10px; padding-left: 30px; }
.topup { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--alert); }
.topup span { flex: 1; }

.hiitlist { list-style: none; margin: 8px 0 0; padding: 0 0 0 30px; }
.hiitlist li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--rule-soft); font-size: 14px;
}
.hiitlist li:last-child { border-bottom: 0; }
.hiitlist small { display: block; font-size: 12px; color: var(--ink-faint); }
.hiitlist__spec { font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: var(--ink-dim); white-space: nowrap; }
.hiitlist__name { font-weight: 500; }
.hiitlist__name { flex: 1; }
.hiitlist li:has(.hiitlist__go) { align-items: center; }
.hiitlist__go {
  appearance: none; display: inline-flex; align-items: center; gap: 5px;
  background: var(--core-soft); border: 1px solid color-mix(in srgb, var(--core) 50%, transparent); color: var(--core);
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
  min-height: 36px; padding: 0 12px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  transition: background var(--t-fast) var(--ease);
}
.hiitlist__go:hover { background: color-mix(in srgb, var(--core) 20%, transparent); }
.hiitlist__go svg { width: 12px; height: 12px; fill: currentColor; }
.hiitlist__go:active { transform: translateY(1px); }

.histrow__sub { display: block; font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint); margin-top: 2px; }

.btn[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); background: var(--surface-2); font-weight: 600; }

/* ── EMOM timer ──────────────────────────────────────────────────────── */
/* A full-screen panel over either program. The run screen is read from a
   bar or a dip station a couple of metres away: the clock and the reps are
   the biggest things on it. */

.modetoggle--emom { color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.modetoggle--emom[data-active="true"] { color: var(--ink); border-color: var(--ink); background: var(--surface-2); }

body.emom-open { overflow: hidden; }

.emomtool {
  position: fixed; inset: 0; z-index: 70;
  display: flex; flex-direction: column;
  background: var(--ground);
}
.emomtool[hidden] { display: none; }

.emomtool__bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px max(var(--pad), calc((100% - var(--content)) / 2 + var(--pad)));
  padding-top: max(10px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--rule);
}
.emomtool__title {
  font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: -0.01em;
}
.emomtool__sub {
  flex: 1; min-width: 0;
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint);
}
.emomtool__bar .themetoggle { font-size: 20px; line-height: 1; }

.emomtool__body {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  width: 100%; max-width: var(--content); margin: 0 auto;
  padding: var(--pad) var(--pad) calc(32px + env(safe-area-inset-bottom));
}

/* Chips: presets and quick-add */
.emb__presets, .emb__add { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.emb__add { margin: 10px 0 18px; }
.chip, .chip--saved button {
  appearance: none; -webkit-appearance: none;
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink);
  border-radius: 999px; cursor: pointer;
  font-family: var(--font-body); font-size: 13px; font-weight: 500;
  padding: 7px 13px; min-height: 36px;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.chip:hover, .chip--saved button:hover { border-color: var(--ink-faint); }
.chip--saved { display: inline-flex; padding: 0; border-color: var(--rule); background: var(--surface-2); overflow: hidden; }
.chip--saved button { border: 0; border-radius: 0; background: transparent; }
.chip--saved .chip__x { color: var(--ink-faint); border-left: 1px solid var(--rule); }
.chip--add { color: var(--ink-dim); background: transparent; }
.chip--add[data-side="pull"] { border-color: var(--pull); }
.chip--add[data-side="push"] { border-color: var(--push); }
.chip--add[data-side="legs"] { border-color: var(--legs); }
.chip--add[data-side="core"] { border-color: var(--core); }

.emomtool .sets__head { padding-left: 0; }
.emb__slots { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; }
.emb__slot {
  display: flex; align-items: center; gap: 4px;
  border: 1px solid var(--rule);
  box-shadow: inset 3px 0 0 var(--core);
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 6px 6px 6px 12px;
}
.emb__slot[data-side="pull"] { box-shadow: inset 3px 0 0 var(--pull); }
.emb__slot[data-side="push"] { box-shadow: inset 3px 0 0 var(--push); }
.emb__slot[data-side="legs"] { box-shadow: inset 3px 0 0 var(--legs); }
.emb__min { font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); width: 36px; flex: none; }
.emb__slot .setinput { min-width: 0; }
.emb__name { flex: 1; min-width: 80px; text-align: left; padding-left: 10px; font-size: 15px; }
.emb__reps { width: 50px; flex: none; }
.emb__unit, .emb__ctl select {
  height: 40px; border: 1px solid var(--rule); background: var(--surface-2); color: var(--ink);
  border-radius: var(--radius); font-family: var(--font-body); font-size: 14px; padding: 0 4px;
}
.emb__del {
  appearance: none; -webkit-appearance: none;
  width: 32px; height: 40px; flex: none;
  border: 0; background: none; color: var(--ink-faint); font-size: 18px; cursor: pointer;
  border-radius: var(--radius); transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.emb__del:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.emb__del:disabled { opacity: 0.3; cursor: default; }

.emb__row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.emb__ctl { display: flex; flex-direction: column; gap: 4px; }
.emb__ctl > span {
  font-family: var(--font-body); font-size: 12px; font-weight: 500; color: var(--ink-dim);
}
.stepper { display: flex; }
.stepper button {
  appearance: none; -webkit-appearance: none;
  width: 44px; height: 44px; border: 1px solid var(--rule); background: var(--surface-2);
  color: var(--ink); font-size: 18px; cursor: pointer;
  transition: background var(--t-fast) var(--ease);
}
.stepper button:hover:not(:disabled) { background: var(--rule); }
.stepper button:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.stepper button:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.stepper button:disabled { opacity: 0.4; cursor: default; }
.stepper .setinput { width: 56px; height: 44px; border-radius: 0; border-left: 0; border-right: 0; }

.emb__sum { margin: 16px 0 0; font-family: var(--font-mono); font-size: 13px; color: var(--ink-dim); }
.emb__hist { margin-top: 34px; }

/* The run screen */
.emr {
  --accent: var(--core);
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 10px; padding-top: 2vh;
}
.emr[data-side="pull"] { --accent: var(--pull); }
.emr[data-side="push"] { --accent: var(--push); }
.emr[data-side="legs"] { --accent: var(--legs); }

.emr__count {
  font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink-dim);
}
.emr__clock {
  font-family: var(--font-mono); font-weight: 600;
  font-size: clamp(72px, 26vw, 168px); line-height: 1;
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
}
.emr[data-phase="lead"] .emr__clock { color: var(--ink-dim); }
.emr[data-paused="true"] .emr__clock { opacity: 0.4; }
.emr__bar { width: 100%; height: 6px; background: var(--rule-soft); border-radius: 3px; overflow: hidden; }
.emr__bar span { display: block; height: 100%; background: var(--accent); }

.emr__what { display: flex; flex-direction: column; align-items: center; margin-top: 8px; }
.emr__first {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink-faint);
}
.emr__reps {
  font-family: var(--font-display); font-weight: 600; letter-spacing: -0.03em; color: var(--accent);
  font-size: clamp(64px, 20vw, 120px); line-height: 1;
}
.emr__name {
  font-family: var(--font-display); font-weight: 700; color: var(--accent);
  font-size: clamp(26px, 8vw, 44px); font-weight: 600; letter-spacing: -0.01em;
}
.emr__next { font-family: var(--font-mono); font-size: 13px; color: var(--ink-faint); }

.emr__btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; margin-top: 12px; }
.emr .btn[data-miss][aria-pressed="true"] { border-color: var(--alert); color: var(--alert); background: var(--alert-soft); }

.emr__strip {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(18px, 1fr)); gap: 3px;
  width: 100%; margin-top: 14px;
}
.emr__cell {
  height: 10px; border-radius: 3px; background: var(--rule-soft);
  font-family: var(--font-mono); font-size: 11px; color: var(--ink);
}
.emr__cell[data-st="done"] { background: var(--done); }
.emr__cell[data-st="missed"] { background: var(--alert); }
.emr__cell[data-st="now"] { background: var(--ink-faint); }

.emr__mute {
  appearance: none; -webkit-appearance: none; background: none; border: 0; cursor: pointer;
  margin-top: 10px; font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint);
}

/* The review: the strip grows into tappable minutes */
.emv h2 { font-size: 28px; margin: 4px 0 6px; }
.emv__score { font-family: var(--font-mono); font-size: 14px; color: var(--ink-dim); }
.emv__score b { color: var(--done); font-size: 20px; }
.emv .emr__strip { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 5px; margin: 10px 0 14px; }
.emv .emr__cell {
  appearance: none; -webkit-appearance: none;
  height: 44px; border: 1px solid var(--rule); border-radius: var(--radius); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.emv .emr__cell[data-st="done"] { color: var(--on-accent); border-color: var(--done); }
.emv .emr__cell[data-st="missed"] { color: var(--on-accent); border-color: var(--alert); }
.emv .emr__cell[data-st="todo"] { color: var(--ink-faint); cursor: default; }
.emv__totals { font-family: var(--font-mono); font-size: 13px; color: var(--ink-dim); margin-bottom: 16px; }

/* ── Brieuc phase 2 ──────────────────────────────────────────────────── */

.phaseswitch { margin: 0 0 18px; }

details.about--inline { margin: 6px 0 0; padding-left: 30px; }
details.about--inline > summary { min-height: 44px; }

.circlist li { display: block; }
.circlist__row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.circlist__sets { padding-left: 0; margin-top: 8px; }
/* What a program adds to an exercise row: its level, where it stands on its
   goal, how to do it, a movement logged alongside, top-ups. */
.circlist__pick { margin-top: 8px; }
.circlist .ex__notes, .circlist .sets__head, .circlist .topups { padding-left: 0; }
/* A card done more than one way: its style menu. A card's sets for the day:
   − and + around the count. An EMOM's settings before its clock starts. */
.stylepick { padding-left: 30px; margin-top: 10px; }
.setcount { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.setcount > span { font-size: 12px; font-weight: 500; color: var(--ink-dim); }
.setcount output.setinput { display: inline-flex; align-items: center; justify-content: center; }
.emomset { display: flex; flex-wrap: wrap; gap: 10px 14px; padding-left: 30px; margin-top: 12px; }
.exhow { margin-top: 6px; font-size: 13px; color: var(--ink-dim); }
.exhow summary { cursor: pointer; font-size: 12px; color: var(--ink-faint); min-height: 24px; }
.exhow p { margin: 4px 0 0; }

.lad__prereq { margin: 0; padding: 8px 12px 0; font-size: 12px; color: var(--ink-faint); }
.lad__list li[data-optional="true"] .lad__name { font-style: italic; }
.lad__foot { padding: 0 12px 10px; }
details.about .ladders { margin-top: 10px; }

/* The recommended week as steps to follow, not days. */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 6px; margin-bottom: 8px; }
.step {
  appearance: none; -webkit-appearance: none; cursor: pointer; text-align: left;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--surface); color: var(--ink-dim);
  padding: 10px 12px 11px; display: grid; gap: 3px; position: relative;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.step:hover { background: var(--surface-2); }
.step:active { transform: translateY(1px); }
.step__n {
  font-family: var(--font-mono); font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink-faint);
}
.step[data-next="true"] .step__n { color: var(--done); }
.step strong { font-family: var(--font-display); font-size: 14px; font-weight: 600; line-height: 1.3; color: var(--ink); }
.step small { font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint); }
.step[aria-pressed="true"] { border-color: var(--ink); background: var(--surface-2); }
.step[aria-pressed="true"] strong { color: var(--ink); }
.step[data-draft="true"]::before {
  content: ""; position: absolute; top: 9px; right: 9px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--done);
}

/* ── Mode menu ───────────────────────────────────────────────────────── */

.modemenu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 40;
  display: grid; min-width: 150px; padding: 4px;
  border: 1px solid var(--rule); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow-float);
}
.modemenu[hidden], .modetoggle[hidden] { display: none; }
.modemenu button {
  appearance: none; -webkit-appearance: none; cursor: pointer; text-align: left;
  border: 0; border-radius: var(--radius); background: none; color: var(--ink-dim);
  padding: 10px 12px; min-height: 44px;
  font-family: var(--font-body); font-size: 14px; font-weight: 500;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.modemenu button:hover { background: var(--surface-2); color: var(--ink); }
.modemenu button[aria-checked="true"] { color: var(--ink); font-weight: 600; background: var(--surface-2); }
.modemenu .modemenu__more { border-top: 1px solid var(--rule); border-radius: 0 0 var(--radius) var(--radius); margin-top: 4px; font-size: 13px; color: var(--ink-faint); }
.modemenu__picks { display: grid; padding: 2px 4px 4px; }
.modemenu__pick {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 8px;
  font-size: 14px; color: var(--ink-dim); cursor: pointer;
}
.modemenu__pick input { width: 18px; height: 18px; accent-color: var(--ink); }
.modemenu__pick:has(input:disabled) { cursor: default; color: var(--ink-faint); }
.scopeswitch { margin: 0 0 12px; }

/* ── Custom workouts ─────────────────────────────────────────────────── */

.cw__list, .cb__list { display: grid; gap: 10px; margin-bottom: 18px; }
.cw .ex__top { justify-content: space-between; }
.cw__blocks { margin: 8px 0 12px; padding-left: 20px; font-size: 13px; color: var(--ink-dim); }
.cw__blocks li { margin: 2px 0; }
.cw__blocks span { font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint); }

.cb__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.cb__name { width: 100%; margin-bottom: 10px; }
.cb__settings { margin-bottom: 12px; }
.cb__settings .setinput { width: 64px; height: 44px; }
.cb__add { margin-bottom: 18px; }

.cbx__list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.cbx {
  display: grid; gap: 6px;
  border: 1px solid var(--rule-soft); border-radius: var(--radius);
  background: var(--surface-2); padding: 8px;
}
.cbx__name { width: 100%; text-align: left; padding-left: 8px; min-width: 0; }
.cbx__row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cbx__target { width: 64px; }
.cbx__side {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-body); font-size: 13px; color: var(--ink-dim); cursor: pointer;
  min-height: 40px;
}
.cbx__tools { display: inline-flex; margin-left: auto; }

.cbx__tools .emb__del { width: auto; min-width: 34px; font-size: 15px; }
.cw__list .card, .cb__list .card { margin-bottom: 0; }
