/* ─────────────────────────────────────────────────────────────────
   Athlete Performance — design system.

   Committed look: near-black ground, ONE acid accent used only on the
   thing you are meant to act on, Space Grotesk for every number so
   weights, times and scores align in columns, IBM Plex Sans for reading.

   Dark only, deliberately: this is used at 05:00 before training and in
   a gym, and a single committed ground keeps the accent meaningful.
   ───────────────────────────────────────────────────────────────── */
/* ── tokens ──
   Two accent roles, deliberately separate:
     --accent       a FILL. The lime sits behind near-black text.
     --accent-text  the accent as TEXT or a chart stroke.
   They differ because #D9FB50 on white is ~1.3:1 — fine as a fill under
   dark text, unreadable as a link or a line. Light mode swaps the second
   for a dark olive; dark mode leaves them identical. */
:root {
  color-scheme: dark;

  --bg:        #0B0C0B;
  --surface:   #141614;
  --surface-2: #1A1D1A;
  --line:      #232723;
  --line-soft: #1C201C;

  --ink:       #F3F4F0;
  --ink-2:     #B9BEB8;
  --muted:     #7D847E;
  --muted-2:   #7B817C;      /* 4.57:1 on --surface, 4.92:1 on --bg (v24.2) */

  --accent:      #D9FB50;
  --accent-ink:  #0B0C0B;
  --accent-text: #D9FB50;
  --good:        #7CE0C3;
  --warn:        #FFB020;
  --warn-ink:    #100C00;
  --bad:         #FF8A73;

  --bar-idle:   #242924;
  --bar-on:     #D9FB50;
  --tabbar-bg:  rgba(11, 12, 11, 0.92);
  --danger-bg:  #1E1513;
  --danger-line:#3A2420;

  --r-card: 18px;
  --r-ctrl: 15px;

  --sans:    "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --display: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, sans-serif;

  /* ── WP3 design system tokens ──
     Documented once, here. Existing screens found their own sizes
     empirically before this scale existed and are left alone unless this
     release touches them directly (Trends, workout, the v2 check-in,
     empty/error states) — restyling a screen nobody asked to change is the
     "kitchen sink" CLAUDE.md warns against, not a free improvement.

     Type scale:
       page title      ~28–30px  (h1 stays 34px on the unchanged screens)
       card heading    17–18px / 600
       body            16–17px
       secondary       14–15px  (never below 13px)
       major metric    34–40px, Space Grotesk — .metric .unit is the unit
                        at ~40–45% size, muted colour
     Spacing scale: 4 / 8 / 12 / 16 / 24 / 32.
     Card radius ~18–20px (--r-card, already 18px). Control height >= 48px
     (inputs/buttons below already are). Touch targets >= 44px. */
  --fs-page-title:   30px;
  --fs-card-heading: 17px;
  --fs-body:         16px;
  --fs-secondary:    14px;
  --fs-metric:       36px;
  --fs-metric-unit:  0.42em;   /* relative to --fs-metric, via em on .metric */

  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px;
  --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;

  --ctrl-height: 48px;
  --touch-min:   44px;
}

/* Light. Follows the system unless the person has explicitly chosen dark. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;

    --bg:        #F6F6F2;
    --surface:   #FFFFFF;
    --surface-2: #F1F2ED;
    --line:      #E2E4DC;
    --line-soft: #EAEBE5;

    --ink:       #14170F;
    --ink-2:     #3C4239;
    --muted:     #5C635B;      /* 4.5:1+ on --bg for small text */
    --muted-2:   #6A7169;

    --accent-text: #44620B;    /* the lime, darkened until it is readable */
    --good:        #0F7A5A;
    --bad:         #B7321A;
    --warn:        #B26A00;
    --warn-ink:    #FFFFFF;

    --bar-idle:   #DCDED4;
    --bar-on:     #44620B;
    --tabbar-bg:  rgba(246, 246, 242, 0.92);
    --danger-bg:  #FDF2F0;
    --danger-line:#F0CFC8;
  }
}

/* Explicit choice wins over the system. */
:root[data-theme="light"] {
  color-scheme: light;

  --bg:        #F6F6F2;
  --surface:   #FFFFFF;
  --surface-2: #F1F2ED;
  --line:      #E2E4DC;
  --line-soft: #EAEBE5;

  --ink:       #14170F;
  --ink-2:     #3C4239;
  --muted:     #5C635B;
  --muted-2:   #6A7169;

  --accent-text: #44620B;
  --good:        #0F7A5A;
  --bad:         #B7321A;
  --warn:        #B26A00;
  --warn-ink:    #FFFFFF;

  --bar-idle:   #DCDED4;
  --bar-on:     #44620B;
  --tabbar-bg:  rgba(246, 246, 242, 0.92);
  --danger-bg:  #FDF2F0;
  --danger-line:#F0CFC8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  -webkit-text-size-adjust: 100%;
}
.hidden { display: none !important; }
/* Visually hidden but still in the accessibility tree (a label a screen
   reader must find). .hidden removes it from both. */
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

a { color: var(--accent-text); text-decoration: none; }

/* ── header ── */
header { padding: calc(24px + env(safe-area-inset-top)) 20px 12px; }
.head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
h1 {
  margin: 0; font-family: var(--display); font-size: 34px; font-weight: 700;
  letter-spacing: -0.02em; line-height: 1.05;
}
.header-date {
  margin-top: 4px; font-size: 12px; color: var(--muted);
  letter-spacing: 0.06em; text-transform: uppercase; font-weight: 500;
}
h2 { font-size: 15px; font-weight: 600; margin: 20px 2px 9px; letter-spacing: -0.01em; }
main { padding: 4px 20px calc(96px + env(safe-area-inset-bottom)); }

/* ── day strip ──
   A week of days rather than a date input: gaps in the log are visible at a
   glance, which is the point. Dot = an entry exists for that day. */
.daystrip {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px; margin-bottom: 14px;
}
.daystrip .day {
  min-height: 60px; padding: 8px 0 7px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: var(--surface); color: var(--muted);
  border: 1px solid var(--line); border-radius: 13px;
  font-family: inherit; -webkit-tap-highlight-color: transparent;
}
.daystrip .day .wd { font-size: 12px; letter-spacing: 0.06em; }
.daystrip .day .dn { font-family: var(--display); font-size: 16px; font-weight: 600; color: var(--ink-2); }
.daystrip .day .dot { width: 5px; height: 5px; border-radius: 99px; background: transparent; }
.daystrip .day.has .dot { background: var(--accent-text); }
.daystrip .day.on {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
}
.daystrip .day.on .dn { color: var(--accent-ink); }
.daystrip .day.on .dot { background: var(--accent-ink); opacity: 0.55; }

.backdate {
  background: var(--surface-2); border: 1px solid var(--line);
  border-left: 3px solid var(--warn); border-radius: 12px;
  padding: 11px 13px; margin-bottom: 12px;
  font-size: 12.5px; line-height: 1.5; color: var(--ink-2);
}
.backdate strong { color: var(--ink); }

/* ── cards ── */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-card); padding: 16px; margin-bottom: 12px;
}
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card-name { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.card-latest { font-size: 12px; color: var(--muted); white-space: nowrap; }
.card-latest strong {
  font-family: var(--display); font-size: 22px; font-weight: 600;
  color: var(--ink); letter-spacing: -0.02em; margin-right: 3px;
}
.card-sub { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.45; }

/* ── stat strip ── */
.stats { display: flex; gap: 9px; margin-bottom: 12px; }
.stat {
  flex: 1 1 0; min-width: 0; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-card); padding: 13px 12px;
}
.stat-k {
  font-size: 10px; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.stat-v {
  margin-top: 7px; font-family: var(--display); font-size: 25px; font-weight: 600;
  letter-spacing: -0.02em; display: flex; align-items: baseline; gap: 3px;
}
.stat-v small { font-family: var(--sans); font-size: 11px; color: var(--muted); font-weight: 400; }
.stat-d { margin-top: 4px; font-size: 11px; color: var(--good); }

/* ── inputs ── */
input, select, textarea {
  font-family: inherit; font-size: 16px;      /* 16px stops iOS zoom-on-focus */
  width: 100%; min-height: 48px; padding: 0 14px;
  background: var(--surface-2); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-ctrl);
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent-text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-text) 22%, transparent); }
input::placeholder, textarea::placeholder { color: var(--muted); }   /* --muted-2 on the input fill was under 4.5:1 in three palettes (v24.2) */
textarea { padding: 12px 14px; min-height: 84px; line-height: 1.5; }
/* iOS Safari gives an EMPTY date/time field its own intrinsic width and a
   shorter height, so in a two-column row it ran under its neighbour (seen on
   the iPhone simulator, 15-Oct). The picker still opens. */
input[type="date"], input[type="time"] { -webkit-appearance: none; appearance: none; min-width: 0; display: block; }
input::-webkit-date-and-time-value { text-align: left; }
select { appearance: none; background-image: none; }

label.fld { display: block; margin-bottom: 12px; }
label.fld > span {
  display: block; font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; margin-bottom: 7px;
}
.row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

/* ── 1–10 scale: a ramp of 44px-tall bars ──
   Replaces ten ~31px buttons: thumb-sized targets, and the ramp shows
   direction at a glance without reading the number. */
.scale-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.scale-head .lbl { font-size: 13px; font-weight: 500; color: var(--ink-2); text-transform: none; letter-spacing: 0; }
.scale-head .val { font-family: var(--display); font-size: 17px; font-weight: 600; color: var(--ink); }
.scale-head .val em { font-style: normal; font-size: 11px; color: var(--muted-2); font-weight: 500; }

.scale { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 3px; align-items: end; }
.scale button {
  height: 44px; padding: 0; border: 0; background: none; cursor: pointer;
  display: flex; align-items: flex-end; -webkit-tap-highlight-color: transparent;
}
.scale button i { display: block; width: 100%; background: var(--bar-idle); border-radius: 3px; }
.scale button:nth-child(1) i { height: 15px; }
.scale button:nth-child(2) i { height: 18px; }
.scale button:nth-child(3) i { height: 21px; }
.scale button:nth-child(4) i { height: 24px; }
.scale button:nth-child(5) i { height: 27px; }
.scale button:nth-child(6) i { height: 30px; }
.scale button:nth-child(7) i { height: 34px; }
.scale button:nth-child(8) i { height: 37px; }
.scale button:nth-child(9) i { height: 40px; }
.scale button:nth-child(10) i { height: 44px; }
.scale button.on i { background: var(--bar-on); }
/* higher = worse (fatigue, soreness): a different hue, so the ramp is not read as progress */
.scale.inverse button.on i { background: var(--warn); }

.scale-ends { display: flex; justify-content: space-between; margin-top: 7px; font-size: 10px; color: var(--muted-2); }
.card .fld + .fld:has(.scale) { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.scale-hint { font-size: 11px; color: var(--muted-2); margin-top: 6px; }

/* ── buttons ── */
.primary-btn, .secondary-btn, .small-btn {
  font-family: inherit; border-radius: var(--r-ctrl); cursor: pointer;
  border: 1px solid transparent; width: 100%; min-height: 52px;
  font-size: 15px; font-weight: 600; letter-spacing: -0.01em;
}
.primary-btn { background: var(--accent); color: var(--accent-ink); }
.primary-btn:disabled { opacity: 0.5; cursor: default; }
.secondary-btn { background: var(--surface); color: var(--ink-2); border-color: var(--line); }
.small-btn {
  width: auto; min-height: var(--touch-min); padding: 0 15px; font-size: 13px; font-weight: 500;   /* 44 px (was 40) */
  background: var(--surface); color: var(--ink-2); border-color: var(--line); border-radius: 999px;
}
.danger { color: var(--bad); border-color: var(--danger-line); background: var(--danger-bg); }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 13px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  color: var(--ink-2); font-family: inherit; font-size: 12px; font-weight: 500; cursor: pointer;
}

/* ── tab bar ── */
#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex;
  background: var(--tabbar-bg); border-top: 1px solid var(--line);
  backdrop-filter: saturate(160%) blur(20px);
  padding-bottom: env(safe-area-inset-bottom); z-index: 20;
}
#tabbar .tab {
  flex: 1; border: 0; background: none; color: var(--muted);
  font-family: inherit; font-size: 12px; font-weight: 500; letter-spacing: 0.04em;
  min-height: 56px; padding: 10px 0 8px;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  -webkit-tap-highlight-color: transparent;
}
#tabbar .tab svg { width: 21px; height: 21px; }
#tabbar .tab.active { color: var(--accent-text); }
#tabbar .tab { position: relative; }
/* pending access requests; a fill, so --accent with dark text is correct */
#tabbar .tab-badge {
  position: absolute; top: 6px; left: calc(50% + 8px);
  min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: #0B0C0B; font-size: 10px; font-weight: 700;
  line-height: 17px; text-align: center;
}

/* ── sign in ── */
.signin-wrap { max-width: 420px; margin: 0 auto; padding: 14vh 28px 40px; position: relative; }
.signin-mark {
  width: 46px; height: 46px; border-radius: 14px; background: var(--accent);
  display: flex; align-items: center; justify-content: center; margin-bottom: 26px;
}
.signin-title {
  font-family: var(--display); font-size: 38px; font-weight: 700;
  letter-spacing: -0.03em; line-height: 1.05; margin: 0;
}
.signin-sub { color: var(--muted); margin: 12px 0 30px; font-size: 14px; line-height: 1.55; }
.signin-wrap input { margin-bottom: 10px; }
.signin-wrap .primary-btn, .signin-wrap .secondary-btn { margin-bottom: 10px; }
.or { text-align: center; color: var(--muted-2); font-size: 12px; margin: 4px 0 12px; }
.signin-msg { margin-top: 12px; font-size: 13px; color: var(--muted); min-height: 19px; line-height: 1.5; }
.setup { margin-top: 34px; font-size: 13px; color: var(--muted); }
.setup summary { cursor: pointer; min-height: 30px; }
.setup input { margin-top: 8px; }
.hint { font-size: 13px; line-height: 1.6; color: var(--muted-2); }

.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.seg button {
  min-height: 44px; font-family: inherit; font-size: 13px; font-weight: 500;
  color: var(--ink-2); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 11px; cursor: pointer;
}
.seg button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }

/* ── misc ── */
.offline-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: var(--warn); color: var(--warn-ink); font-size: 12px; font-weight: 600;
  letter-spacing: 0.01em; text-align: center;
  padding: calc(6px + env(safe-area-inset-top)) 10px 6px;
}
body.has-bar header { padding-top: calc(46px + env(safe-area-inset-top)); }

.list-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0; border-top: 1px solid var(--line-soft);
}
.list-row:first-of-type { border-top: 0; }
/* A tappable row is a real <button> (v24.2), drawn as the row it replaced,
   so a keyboard or Switch Control reaches it and a screen reader names it a
   button. Its children are spans: a button holds phrasing content only. */
button.list-row {
  width: 100%; margin: 0; background: none; border: 0; border-top: 1px solid var(--line-soft);
  border-radius: 0; font: inherit; color: inherit; text-align: left; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
button.list-row > span, button.list-row span.meta { display: block; min-width: 0; }
/* :first-of-type counts buttons apart from the divs beside them; only a row
   that is truly first drops its rule, as a div row did. */
button.list-row:first-of-type { border-top: 1px solid var(--line-soft); }
button.list-row:first-child { border-top: 0; }
.meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 28px 12px; line-height: 1.6; }
.spark { display: block; width: 100%; height: 48px; overflow: visible; }
.saved { color: var(--good); }
.err { color: var(--bad); }
.disclaimer { color: var(--muted-2); font-size: 11px; line-height: 1.55; margin: 18px 2px 0; }
/* coach reviews as the athlete reads them (records.js renderMyReviews) */
.review-text { margin: 6px 0 0; font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.review-item { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }

.set-row {
  display: grid; grid-template-columns: 26px repeat(3, minmax(0, 1fr));
  gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line-soft);
}
.set-row .n { font-family: var(--display); font-size: 13px; color: var(--muted); font-weight: 600; }
.set-row .meta { font-family: var(--display); font-size: 15px; font-weight: 600; color: var(--ink); margin: 0; }

/* ── food picker (009/010) ──
   One search box over the master library and My Foods. "+ Add manually"
   is styled AS A RESULT ROW, not as a button elsewhere: if the manual
   path looks like a fallback it will be treated as one. */
.picker .p-results { margin-top: 10px; }
.p-head {
  font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; margin: 4px 0 2px;
}
.food-row { cursor: pointer; }
.food-row:hover { color: var(--ink); }
.food-row.add-manual > :first-child { color: var(--accent-text); font-weight: 500; }
.pill {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px;
  font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase; font-weight: 600;
  color: var(--accent-text); border: 1px solid var(--line); background: var(--surface-2);
}
/* .warn is a FILL on --warn, so it needs --warn-ink for contrast — the same
   reason --accent needs --accent-ink, never plain --ink. Used for a food
   missing one of the five macros ("Incomplete"). */
.pill.warn { color: var(--warn-ink); border-color: var(--warn); background: var(--warn); }
.p-chosen { margin-top: 4px; }
.p-macros {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  padding: 11px 0 14px; font-size: 13px; color: var(--ink-2);
}
.p-macros strong { font-family: var(--display); font-size: 16px; color: var(--ink); }
label.chk {
  display: flex; align-items: center; gap: 10px; margin: 4px 0 8px;
  font-size: 13px; color: var(--ink-2);
}
label.chk input { width: 24px; min-height: 24px; height: 24px; flex: 0 0 24px; padding: 0; }   /* WCAG 2.2 2.5.8 */

/* ── major metric (WP3 / WP6 Trends, workout header) ──
   ONE dominant number per card, not a row of equally-weighted stats.
   .unit is deliberately muted and small — it names the number, it does not
   compete with it. */
.metric {
  font-family: var(--display); font-size: var(--fs-metric); font-weight: 600;
  letter-spacing: -0.02em; color: var(--ink); line-height: 1.1;
  display: flex; align-items: baseline; gap: 6px;
}
.metric .unit {
  font-family: var(--sans); font-size: var(--fs-metric-unit); font-weight: 500;
  color: var(--muted); letter-spacing: 0;
}
.metric-row { display: flex; gap: var(--sp-5); flex-wrap: wrap; }
.metric-row .metric-block { display: flex; flex-direction: column; gap: 2px; }
.metric-row .metric-block .metric-label {
  font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}

/* ── scale7: the v2 provisional check-in (1–7, 1 = most favourable) ──
   Seven numbered toggle buttons, deliberately NOT the .scale (1–10) bar
   ramp and never sharing its class — a v1 row and a v2 row are validated
   against different ranges (ui.js RANGES vs RANGES_V2) and must look
   visibly different too. */
.scale7 { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.scale7 button {
  height: var(--touch-min); min-width: 0; padding: 0; cursor: pointer;
  font-family: var(--display); font-size: 14px; font-weight: 600;
  background: var(--surface-2); color: var(--ink-2);
  border: 1px solid var(--line); border-radius: 10px;
  -webkit-tap-highlight-color: transparent;
}
.scale7 button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
/* the live word under the row ("Excellent", "Extreme") — never just a number */
.descriptor {
  margin-top: 8px; font-size: 13px; font-weight: 500; color: var(--ink-2); min-height: 18px;
}

/* ── hero-card: the designed first-run / quiet-week state on Today ──
   A soft accent WASH (accent mixed into the card surface), so text stays
   --ink on it in both themes; the accent itself is never used as text. */
.hero-card {
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 22%, var(--surface)) 0%, var(--surface) 70%);
}
.hero-kicker { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.hero-title { font-family: var(--display); font-size: 24px; font-weight: 700; line-height: 1.2; margin: 4px 0 8px; color: var(--ink); }

/* ── chips: optional multi-select pills (check-in context) ──
   Same fill rule as .scale7: the selected state is an --accent FILL with
   --accent-ink text. No colour carries a meaning — no chip is "bad". */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 10px; }
.chips button {
  min-height: var(--touch-min); padding: 0 16px; cursor: pointer; border-radius: 999px;
  font-size: 14px; font-weight: 500; background: var(--surface-2); color: var(--ink-2);
  border: 1px solid var(--line); -webkit-tap-highlight-color: transparent;
}
.chips button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.context-summary { margin: 10px 0 4px; }
.context-summary .pill { margin: 0 6px 6px 0; font-size: 11px; }

/* ── notice: an inline callout that needs a decision, not just a read ──
   Same shape as .backdate but neutral — a warning banner would compete
   with an actual --warn state (offline, refused writes). */
.notice {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
  padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-3);
  font-size: 13px; line-height: 1.5; color: var(--ink-2);
}
.notice strong { color: var(--ink); }

/* ── stepper: a compact +/- control for a small adjustable number ──
   (rest-timer seconds, a plausibility-confirm step). Buttons are full
   touch targets; the value sits between them, never editable directly, so
   there is nothing to validate. */
.stepper { display: flex; align-items: center; gap: var(--sp-2); }
.stepper button {
  width: var(--touch-min); height: var(--touch-min); flex: 0 0 auto; padding: 0;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2); font-family: inherit; font-size: 16px; font-weight: 600; cursor: pointer;
}
.stepper .stepper-val {
  min-width: 64px; text-align: center; font-family: var(--display);
  font-size: 15px; font-weight: 600; color: var(--ink);
}

/* ── review-row: a label/value pair (onboarding's "Review your details"
   step, a pending request's summary). Two plain <span> children, styled
   structurally — first is the label, last is the value — rather than by
   sub-class, since a label/value row is often built as bare spans. ── */
.review-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--sp-3); padding: var(--sp-3) 0; border-top: 1px solid var(--line-soft);
  font-size: var(--fs-secondary);
}
.review-row:first-of-type { border-top: 0; }
.review-row > span:first-child { color: var(--muted); flex: 0 0 auto; }
.review-row > span:last-child { color: var(--ink); text-align: right; }

/* ── card-action: a contextual quick action living INSIDE a card, next to
   its heading — distinct from .primary-btn/.secondary-btn, which are
   full-width. This is what replaces a central "+" tab: every empty state
   is one action, in context, on the card it belongs to. ── */
.card-action {
  flex: 0 0 auto; min-height: var(--touch-min); padding: 0 var(--sp-4);
  border-radius: 999px; border: 1px solid transparent; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 600;
  background: var(--accent); color: var(--accent-ink);
}
.card-action.secondary { background: var(--surface-2); color: var(--ink-2); border-color: var(--line); }

/* ── summary-row: a compact label : value line inside a card (the v2
   check-in summary's four domains). Structural child selectors, same
   reasoning as .review-row above. A .metric nested here (a per-domain
   score) is the one-dominant-number-per-CARD pattern turned down to fit
   four-to-a-row — the bare .metric size stays for Trends/workout. */
.summary-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3);
  padding: 7px 0; border-top: 1px solid var(--line-soft); font-size: var(--fs-secondary);
}
.summary-row:first-of-type { border-top: 0; }
.summary-row > span:first-child { color: var(--muted); }
.summary-row > span:last-child { color: var(--ink); text-align: right; }
.summary-row .metric { font-size: 16px; gap: 3px; display: inline-flex; }
.summary-row .metric .unit { font-size: 0.7em; }
.summary-row .descriptor { display: inline; margin: 0 0 0 6px; min-height: 0; }

/* ── errstate: a load failure with a way out. Never a bare "nothing here",
   which is indistinguishable from an empty-but-successful load. ── */
.errstate {
  text-align: center; padding: var(--sp-5) var(--sp-3);
  border: 1px solid var(--danger-line); background: var(--danger-bg);
  border-radius: var(--r-card);
}
.errstate-msg { color: var(--bad); font-size: 13px; line-height: 1.55; margin-bottom: var(--sp-3); }
.errstate .errstate-retry { width: auto; min-width: 120px; margin: 0 auto; }

/* ── workout (WP4) ──
   A per-exercise SET | PREVIOUS | KG | REPS | RIR | ✓ table. A pending row
   (prefilled from the athlete's last session, not yet saved) is visibly
   muted; ticking it is the only thing that turns it into a record. */
.wo-row {
  display: grid; grid-template-columns: 28px 1fr 56px 52px 48px 44px;
  gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line-soft);
}
.wo-row:first-child { border-top: 0; }
.wo-head {
  font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; padding-bottom: 6px;
}
.wo-set { font-family: var(--display); font-size: 13px; font-weight: 600; color: var(--muted); }
.wo-prev { font-size: 12px; color: var(--muted); }
.wo-row.pending { opacity: 0.72; }
.wo-row.pending input {
  min-height: 40px; padding: 0 8px; font-size: 14px; text-align: center;
}
.wo-row.done .wo-cell {
  font-family: var(--display); font-size: 14px; font-weight: 600; color: var(--ink); text-align: center;
}
.wo-tick { display: flex; justify-content: center; }
.wo-tick-btn {
  width: var(--touch-min); height: var(--touch-min); border-radius: 999px; border: 0;
  background: var(--accent); color: var(--accent-ink); font-size: 16px; font-weight: 700; cursor: pointer;
}
.wo-tick-btn:disabled { opacity: 0.5; }
.wo-row.done .wo-tick { color: var(--good); font-size: 18px; }
.wo-rest { min-height: var(--touch-min); display: flex; align-items: center; gap: var(--sp-2); margin: var(--sp-2) 0; }
.wo-rest-time { font-family: var(--display); font-weight: 600; color: var(--accent-text); }
.wo-row-err { grid-column: 1 / -1; font-size: 12px; color: var(--bad); margin-top: 4px; }
/* the RIR explanation is said once, under the first exercise's table */
.wo-block ~ .wo-block .wo-rir-note { display: none; }

/* ══ v24 ═════════════════════════════════════════════════════════════
   WCAG 2.2: a visible focus ring on every control (2.4.7), and nothing
   focused may hide under the fixed tab bar or the header (2.4.11) — the
   scroll padding keeps a focused field clear of both. */
html { scroll-padding-top: 72px; scroll-padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
:where(button, a, summary, [role="button"], [tabindex]):focus-visible {
  outline: 3px solid var(--accent-text); outline-offset: 2px; border-radius: 8px;
}

/* Undo prompt (ui.js undoToast): above the tab bar, one at a time. */
.undo-toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 60;
  bottom: calc(84px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px);
  padding: 10px 10px 10px 16px; border-radius: 12px;
  background: var(--ink); color: var(--bg); box-shadow: 0 6px 24px rgba(0,0,0,.28);
  font-size: 14px;
}
.undo-toast .undo-btn {
  min-height: var(--touch-min); padding: 0 16px; border-radius: 10px; border: 0; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600;
}
.pending-remove { opacity: .45; text-decoration: line-through; }

/* Remove a meal line / a logged set. 44px targets (2.5.8 asks 24). */
.line-end { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: var(--touch-min); height: var(--touch-min); flex: 0 0 auto; padding: 0; cursor: pointer;
  border: 0; border-radius: 999px; background: none; color: var(--muted); font-size: 15px;
}
.wo-undo-set {
  width: var(--touch-min); height: var(--touch-min); border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: none; color: var(--ink); font-size: 16px;
}
.wo-rest-note { flex-basis: 100%; margin: 2px 0 0; }
.wo-rest { flex-wrap: wrap; }

/* Refused entries card, and small paired actions. */
.warn-card { border-color: var(--warn); }
.btn-pair { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
/* Trends "Partial": a 24px target at least (WCAG 2.2 2.5.8) */
.partial-disclosure > summary { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 10px; }
.link-btn {
  min-height: 24px; padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--accent-text); font: inherit; text-decoration: underline;
}

/* ══ Palette: Rose & Navy ══════════════════════════════════════════════
   An optional colour palette (More → Appearance → Colours), independent of
   light/dark. Colours from the Prasanthigram web palette: navy #003366,
   band pink #FFA299, rose-text #9B3329, gold #C8A84B. It borrows COLOURS
   only — no SSSIHMS logo, name or wording appears anywhere in the app.
   The same two-role accent rule as the standard palette:
     --accent (band pink) is a FILL, always with navy --accent-ink on it
       (6.53:1). White on band pink is 2.02:1 and must never be used.
     --accent-text is rose-text on light (7.24:1) / band pink on navy (7.86:1).
   Specificity: the dark block is (0,2,0) and sits after the standard light
   blocks, so the light blocks below need (0,3,0) to win in light mode. */
:root[data-palette="rose"] {
  --bg:#001B38; --surface:#00264D; --surface-2:#0A3360; --line:#1A4A75; --line-soft:#123D66;
  --ink:#F4F4F4; --ink-2:#D6E8F7; --muted:#9FB6CC; --muted-2:#7C96B0;
  --accent:#FFA299; --accent-ink:#003366; --accent-text:#FFA299; --bar-on:#FFA299; --bar-idle:#1A4A75;
  --good:#7CE0C3; --warn:#F4C542; --warn-ink:#1A1400; --bad:#FF9C8F;
  --tabbar-bg:rgba(0,27,56,.96); --danger-bg:#2A1B24; --danger-line:#4A2A33;
  --sans:"Lato", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --display:"Lato", ui-sans-serif, system-ui, -apple-system, sans-serif;
}
@media (prefers-color-scheme: light) {
  :root[data-palette="rose"]:not([data-theme="dark"]) {
    --bg:#F4F4F4; --surface:#FFFFFF; --surface-2:#EEF5FC; --line:#E3E7EB; --line-soft:#EEF1F4;
    --ink:#2C2C2C; --ink-2:#1A5276; --muted:#6C6C6C; --muted-2:#6A7076;
    --accent:#FFA299; --accent-ink:#003366; --accent-text:#9B3329; --bar-on:#D9564B; --bar-idle:#E3E7EB;
    --good:#1E8449; --warn:#D4AC0D; --warn-ink:#2C2C2C; --bad:#C0392B;
    --tabbar-bg:rgba(0,51,102,.97); --danger-bg:#FDECEA; --danger-line:#F2C4BE;
  }
}
:root[data-palette="rose"][data-theme="light"] {
  --bg:#F4F4F4; --surface:#FFFFFF; --surface-2:#EEF5FC; --line:#E3E7EB; --line-soft:#EEF1F4;
  --ink:#2C2C2C; --ink-2:#1A5276; --muted:#6C6C6C; --muted-2:#6A7076;
  --accent:#FFA299; --accent-ink:#003366; --accent-text:#9B3329; --bar-on:#D9564B; --bar-idle:#E3E7EB;
  --good:#1E8449; --warn:#D4AC0D; --warn-ink:#2C2C2C; --bad:#C0392B;
  --tabbar-bg:rgba(0,51,102,.97); --danger-bg:#FDECEA; --danger-line:#F2C4BE;
}
/* Playfair for page and section titles; every number stays in Lato (a serif
   numeral in a metric reads worse, not better). */
:root[data-palette="rose"] h1, :root[data-palette="rose"] h2,
:root[data-palette="rose"] .hero-title { font-family:"Playfair Display", Georgia, serif; }
:root[data-palette="rose"] .metric { font-weight: 900; }
:root[data-palette="rose"] header::after {
  content:""; display:block; height:4px; margin-top:10px; border-radius:2px; background:#C8A84B;
}
/* The same gold, short, as an accent under section headings, More group
   titles and sub-page titles (v24). Decorative only: it carries no meaning,
   so its contrast is not relied on. */
:root[data-palette="rose"] :is(#app h2, .gold-rule)::after {
  content:""; display:block; width:48px; height:3px; margin-top:6px; border-radius:2px; background:#C8A84B;
}
/* light: navy headings on white, and a navy tab bar whose labels are pale
   blue (10.05:1) with band pink for the active tab (6.24:1 on navy) */
@media (prefers-color-scheme: light) {
  :root[data-palette="rose"]:not([data-theme="dark"]) :is(h1, h2, .card-name) { color:#003366; }
  :root[data-palette="rose"]:not([data-theme="dark"]) #tabbar .tab { color:#D6E8F7; }
  :root[data-palette="rose"]:not([data-theme="dark"]) #tabbar .tab.active { color:#FFA299; }
}
:root[data-palette="rose"][data-theme="light"] :is(h1, h2, .card-name) { color:#003366; }
:root[data-palette="rose"][data-theme="light"] #tabbar .tab { color:#D6E8F7; }
:root[data-palette="rose"][data-theme="light"] #tabbar .tab.active { color:#FFA299; }

/* ══ v20 experience layer ═════════════════════════════════════════════
   Icons, the Today row, the one-question-per-step check-in, Train's type
   chips, charts with a previous-period line, and small parts. The accent
   rules above still hold: --accent is a FILL with --accent-ink on it;
   anything drawn as a line or text uses --accent-text. No colour says
   good or bad. */
.ico { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex: 0 0 auto; }
.card-ico { width: 18px; height: 18px; margin-right: 8px; color: var(--accent-text); vertical-align: -3px; }

/* Today row: four neutral marks */
.today-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 4px 0 12px; }
.today-mark {
  position: relative; min-height: 70px; padding: 10px 4px 8px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  color: var(--muted); font-family: inherit; -webkit-tap-highlight-color: transparent;
}
.today-ico .ico { width: 22px; height: 22px; }
.today-lbl { font-size: 11.5px; font-weight: 500; line-height: 1.2; text-align: center; color: var(--ink-2); }
.today-state { position: absolute; top: 6px; right: 6px; }
.today-state .ico { width: 15px; height: 15px; color: var(--accent-text); stroke-width: 2.6; }
.today-mark.done { border-color: color-mix(in srgb, var(--accent-text) 45%, var(--line)); }
.today-mark.done .today-ico { color: var(--accent-text); }
.sync-note { display: flex; align-items: center; gap: 8px; }

/* check-in, one question per step */
.ci-progress { height: 4px; border-radius: 4px; background: var(--bar-idle); overflow: hidden; margin-bottom: 12px; }
.ci-progress span { display: block; height: 100%; background: var(--bar-on); transition: width .2s ease; }
.ci-count { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.ci-q { font-family: var(--display); font-size: 22px; font-weight: 600; letter-spacing: -.01em; margin: 6px 0 2px; }
.ci-prompt { font-size: 13px; }
.ci-word { font-family: var(--display); font-size: 19px; font-weight: 600; text-align: center; color: var(--ink); margin: 16px 0 10px; min-height: 26px; }
.scale7.big button { height: 54px; font-size: 18px; border-radius: 12px; }
.ci-ends { display: flex; justify-content: space-between; gap: 12px; font-size: 11px; color: var(--muted); margin-top: 8px; }
.ci-nav { margin-top: 16px; }
.ci-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.ci-tile {
  display: flex; flex-direction: column; gap: 1px; text-align: left; padding: 10px 12px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
  font-family: inherit; color: var(--ink);
}
button.ci-tile { cursor: pointer; }
.ci-tile-k { font-size: 11px; color: var(--muted); letter-spacing: .03em; }
.ci-tile-v { font-family: var(--display); font-size: 20px; font-weight: 600; }
.ci-tile-v .unit { font-size: 12px; color: var(--muted); margin-left: 1px; }
.ci-tile-w { font-size: 12px; color: var(--ink-2); }

/* Train: session type chips with icons */
.type-chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 12px 0 12px; }
.type-chips button {
  min-height: 62px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); border-radius: 12px;
  font-family: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.type-chips button .ico { width: 21px; height: 21px; }
.type-chips button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.secondary-btn .ico, .primary-btn .ico { margin-right: 6px; }
.session-detail { padding: 0 0 10px; }
.wo-target { color: var(--ink-2); }

/* charts */
.chart { position: relative; padding-right: 50px; }
.chart .spark { height: 76px; }
.line-now { stroke: var(--accent-text); stroke-width: 2.4; }
.line-now-dot { fill: var(--accent-text); }
.line-prior { stroke: var(--muted); stroke-width: 1.6; stroke-dasharray: 3 3; }
.line-prior-dot { fill: var(--muted); }
.chart-scale { position: absolute; top: -2px; right: 0; bottom: -2px; width: 46px; display: flex; flex-direction: column;
  justify-content: space-between; font-size: 10px; color: var(--muted); pointer-events: none; text-align: right;
  white-space: nowrap; }
.legend { margin-left: 6px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.key-now, .key-prior { display: inline-block; width: 16px; height: 0; vertical-align: middle; margin: 0 4px 0 6px; }
.key-now { border-top: 2.5px solid var(--accent-text); }
.key-prior { border-top: 2px dashed var(--muted); }
.compare-line { line-height: 1.7; }

/* check-in week grid */
.ci-grid { display: grid; gap: 4px; margin-top: 10px; align-items: center; }
.ci-grid-h { font-size: 10px; color: var(--muted); text-align: center; }
.ci-grid-k { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-grid-c { height: 30px; display: flex; align-items: center; justify-content: center; border-radius: 8px;
  background: var(--surface-2); font-family: var(--display); font-size: 14px; font-weight: 600; color: var(--ink); }
.ci-grid-c.none { background: transparent; border: 1px dashed var(--line); }

/* skeleton */
.skel span { display: block; height: 12px; border-radius: 6px; margin: 8px 0; background: var(--surface-2);
  animation: skel 1.2s ease-in-out infinite; }
.skel span:first-child { width: 40%; height: 15px; }
.skel span:nth-child(2) { width: 85%; }
.skel span:nth-child(3) { width: 60%; }
@keyframes skel { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .skel span { animation: none; } .ci-progress span { transition: none; } }

/* reminders / install / repeat meal */
.steps { margin: 10px 0 0; padding-left: 20px; font-size: 14px; line-height: 1.7; color: var(--ink-2); }
/* Consent wording: the versioned text unchanged, at a size readable on a phone
   (usability audit 12-Oct, #16; it was 12.5px). */
.consent-text { white-space: pre-wrap; font-family: inherit; font-size: 15px; line-height: 1.6;
  margin: 12px 0 0; color: var(--ink-2); }
.setup p { line-height: 1.6; }
.rem-row { padding-top: 14px; margin-top: 14px; border-top: 1px solid var(--line-soft); }
.rem-row .lbl { font-weight: 600; }
.repeat-meal summary { cursor: pointer; list-style: none; min-height: 28px; display: flex; align-items: center; }
.repeat-meal summary::-webkit-details-marker { display: none; }
.repeat-meal[open] summary { margin-bottom: 6px; }
.wo-rest:empty { min-height: 0; margin: 0; }

/* ══ v21 routines ══ */
.row4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.row4 label.fld > span { font-size: 10px; letter-spacing: .04em; }
.row4 input { padding: 0 8px; text-align: center; }
.r-item { padding: 12px 0; border-top: 1px solid var(--line-soft); }
.r-item:first-child { border-top: 0; }
.r-item-ctl { display: flex; gap: 4px; }
.r-item-ctl .small-btn { min-height: 34px; padding: 0 10px; }
.r-item-ctl .small-btn:disabled { opacity: .35; }
.routine-ex { color: var(--ink-2); }
.routine-detail { margin-top: 8px; }
.routine-detail summary { cursor: pointer; }
/* meal chips as a tidy 3 × 2 grid instead of three ragged rows */
.log-food .chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.log-food .chips button { padding: 0 6px; }

/* ══ v23 coaching ══ */
.roster-row { padding: 12px 0; border-top: 1px solid var(--line-soft); }
.roster-row:first-of-type { border-top: 0; }
.roster-name { font-weight: 600; }
.roster-facts { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.roster-facts .done { color: var(--accent-text); }
.roster-new { display: inline-block; margin-left: 6px; font-size: 11.5px; font-weight: 600; color: var(--accent-text); border: 1px solid currentColor; border-radius: 6px; padding: 0 6px; vertical-align: 1px; }
.roster-squad { margin-top: 10px; }
.roster-act { display: flex; gap: 8px; margin-top: 8px; }
.tgt-edit { margin-top: 10px; padding: 12px; background: var(--surface-2); border-radius: 12px; }
.tgt-wrap { margin-top: 12px; }
.tgt { margin-top: 8px; }
.tgt-top { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); }
.tgt-bar { height: 8px; border-radius: 6px; background: var(--bar-idle); overflow: hidden; margin-top: 4px; }
.tgt-bar span { display: block; height: 100%; background: var(--bar-on); }
/* v22 food routes */
.p-routes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-bottom: 10px; }
.p-route { min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); border-radius: 12px;
  font-family: inherit; font-size: 12px; font-weight: 500; cursor: pointer; }
.p-route .ico { width: 20px; height: 20px; color: var(--accent-text); }
.file-btn { display: flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; }
/* the file input inside is visually hidden but focusable (audit 9 A20) */
.file-btn:focus-within { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.ph-row { padding: 10px 0; border-top: 1px solid var(--line-soft); }

/* ══ v24.3 tester feedback (02-Oct-2026) ══ */
/* Exercise search opens FULL SCREEN, above the tab bar, so the keyboard no
   longer squeezes the results against the form. */
.picker-open {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--r-ctrl); background: var(--surface-2);
  color: var(--muted); font: inherit; font-size: 15px; text-align: left; cursor: pointer;
}
.picker-open .ico { width: 18px; height: 18px; }
.sheet-full {
  position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column;
  background: var(--bg); padding-top: env(safe-area-inset-top);
}
.sheet-head {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  padding: 10px 16px; border-bottom: 1px solid var(--line);
}
.sheet-head .small-btn { justify-self: start; }
.sheet-title { font-family: var(--display); font-size: 16px; font-weight: 600; color: var(--ink); }
.sheet-tools { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px 6px; }
.sheet-tools .row2 { gap: 8px; }
.xs-filters select { min-height: 44px; font-size: 14px; text-align: center; text-align-last: center; }
.sheet-body {
  flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 0 16px calc(24px + env(safe-area-inset-bottom));
}
.ex-row { justify-content: flex-start; }
button.list-row > span.ex-thumb {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 999px; display: flex;
  align-items: center; justify-content: center;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--accent-text);
}
.ex-thumb .ico { width: 24px; height: 24px; }
button.list-row > span.ex-text { flex: 1; }

/* Workout: wider rows and larger inputs on small phones; done sets and
   finished exercises in green. */
.wo-block { margin-left: -10px; margin-right: -10px; padding-left: 12px; padding-right: 12px; }
.wo-row { grid-template-columns: 24px minmax(0, 1fr) 62px 54px 48px 44px; gap: 6px; }
.wo-row.pending input { min-height: var(--touch-min); font-size: 16px; padding: 0 4px; }
.wo-row.done {
  margin: 0 -6px; padding-left: 6px; padding-right: 6px; border-radius: 10px;
  border-top-color: transparent; background: color-mix(in srgb, var(--good) 22%, transparent);
}
.wo-row.done + .wo-row.done { margin-top: 3px; }
.wo-block.complete { border-color: var(--good); }
.pill.good { color: var(--good); border-color: var(--good); }
.wo-done-pill[hidden], .lf-time-wrap[hidden] { display: none; }
@media (max-width: 360px) {
  .wo-row { grid-template-columns: 20px minmax(0, 1fr) 56px 48px 44px 44px; gap: 4px; }
  .wo-prev { font-size: 11px; }
}
/* One rest timer, shown large above the tab bar */
.wo-restbar {
  position: fixed; left: 12px; right: 12px; z-index: 30; max-width: 560px; margin: 0 auto;
  bottom: calc(64px + env(safe-area-inset-bottom)); padding: 10px 14px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .35);
}
.wo-rb-label { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wo-rb-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) 56px 72px; align-items: center; gap: 8px; margin-top: 2px; }
.wo-rb-time {
  font-family: var(--display); font-size: 40px; font-weight: 700; line-height: 1.1; text-align: center;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.wo-rb-btn {
  min-height: var(--touch-min); border-radius: 12px; border: 1px solid var(--line); cursor: pointer;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; font-weight: 600;
}
.wo-rb-skip { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.wo-rb-track { height: 4px; margin-top: 8px; border-radius: 3px; background: var(--bar-idle); overflow: hidden; }
.wo-rb-track span { display: block; height: 100%; background: var(--bar-on); transition: width 1s linear; }
.wo-rb-note { margin-top: 6px; font-size: 11px; line-height: 1.4; color: var(--muted); }
body:has(.wo-restbar) main { padding-bottom: calc(240px + env(safe-area-inset-bottom)); }
body:has(.wo-restbar) .undo-toast { bottom: calc(220px + env(safe-area-inset-bottom)); }
html:has(.wo-restbar) { scroll-padding-bottom: calc(250px + env(safe-area-inset-bottom)); }
@media (prefers-reduced-motion: reduce) { .wo-rb-track span { transition: none; } }

/* Routines: one rep target per set (035) */
.r-sets { margin-top: 8px; }
.r-set { display: grid; grid-template-columns: 52px 84px auto 44px; align-items: center; gap: 8px; padding: 3px 0; }
.r-set-n { font-family: var(--display); font-size: 13px; font-weight: 600; color: var(--muted); }
.r-set input { min-height: var(--touch-min); padding: 0 6px; text-align: center; }
.r-set-foot { display: grid; grid-template-columns: auto minmax(0, 120px); align-items: end; gap: 12px; margin-top: 6px; }
.r-set-foot .fld { margin-bottom: 0; }
.r-set-foot input { text-align: center; }
.r-mode { margin-top: 10px; font-size: 13px; }
.icon-btn:disabled { opacity: .35; cursor: default; }

/* Fuel: time eaten */
.lf-time-wrap { margin-top: 10px; }
.lf-time-fld { margin-bottom: 4px; }
.lf-time-fld input { max-width: 170px; }
.meal-time-line { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 13px; color: var(--ink-2); }
.meal-time-line .ico { width: 15px; height: 15px; color: var(--muted); }
.meal-time-line .meta { margin: 0; }
.meal-time-ed { margin-top: 8px; }
.meal-time-ed .fld { margin-bottom: 6px; }
.meal-time-ed input { max-width: 170px; }

/* ══ v24.4 meeting actions (02-Oct-2026) ══ */
/* Today opens on the last seven days, before any entry */
.sum-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.sum-tile { display: flex; flex-direction: column; gap: 2px; padding: 10px 8px; border-radius: 12px; background: var(--surface-2); }
.sum-k { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.sum-v { font-family: var(--display); font-size: 24px; font-weight: 700; color: var(--ink); line-height: 1.1; }
.sum-s { font-size: 11px; color: var(--muted); }
.sum-weight { margin-top: 10px; }
.sum-weight strong { color: var(--ink); }
@media (max-width: 360px) { .sum-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Workout: session minutes and heart rate */
.wo-sd-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.wo-sd-fields .fld { margin-bottom: 6px; }
.wo-sd-fields .fld > span { font-size: 10px; }
.wo-sd-fields input { text-align: center; padding: 0 6px; }
.wo-details label.fld[hidden] { display: none; }
details.wo-details > summary { cursor: pointer; list-style: none; min-height: 28px; display: flex; align-items: center; gap: 6px; }
details.wo-details > summary::-webkit-details-marker { display: none; }
.sd-elapsed { font-size: 13px; }

/* ══ v24.5 Today: Summary, the Apple Health pattern (Dr. Nayanjeet, 02-Oct) ══
   Each category has its own colour, used for its label, icon and chart.
   Every value is ≥ 4.5:1 on the card surface of every palette (checked
   against #141614, #00264D, #0A3360 dark and #FFFFFF, #EEF5FC light). */
:root {
  --cat-training: #FF9F0A; --cat-nutrition: #4ADE80; --cat-weight: #C4A5FF;
  --cat-sleep: #7DD3FC;    --cat-heart: #FF8A80;     --cat-checkin: #FFD60A;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --cat-training: #B45309; --cat-nutrition: #15803D; --cat-weight: #7E22CE;
    --cat-sleep: #0369A1;    --cat-heart: #B91C1C;     --cat-checkin: #8A5A00;
  }
}
:root[data-theme="light"] {
  --cat-training: #B45309; --cat-nutrition: #15803D; --cat-weight: #7E22CE;
  --cat-sleep: #0369A1;    --cat-heart: #B91C1C;     --cat-checkin: #8A5A00;
}
.hs-training { --cat: var(--cat-training); }  .hs-nutrition { --cat: var(--cat-nutrition); }
.hs-weight { --cat: var(--cat-weight); }      .hs-sleep { --cat: var(--cat-sleep); }
.hs-heart { --cat: var(--cat-heart); }        .hs-checkin { --cat: var(--cat-checkin); }

.hs-head { display: flex; align-items: baseline; justify-content: space-between; margin: 16px 2px 8px; }
.hs-head h2 { margin: 0; }
.hs-edit { font-size: 15px; text-decoration: none; }
.hs-cards { display: flex; flex-direction: column; gap: 10px; }
button.hs-card {
  display: block; width: 100%; padding: 14px 16px; text-align: left; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface);
  color: var(--ink); font: inherit; -webkit-tap-highlight-color: transparent;
}
button.hs-card:active { background: var(--surface-2); }
.hs-card > span { display: flex; }
.hs-top { align-items: center; justify-content: space-between; gap: 8px; }
.hs-cat { display: flex; align-items: center; gap: 7px; font-size: 14.5px; font-weight: 700; color: var(--cat); }
.hs-cat .ico { width: 18px; height: 18px; }
.hs-when { display: flex; align-items: center; gap: 3px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.hs-when .ico { width: 14px; height: 14px; }
.hs-body { align-items: flex-end; justify-content: space-between; gap: 14px; margin-top: 12px; }
.hs-val {
  font-family: var(--display); font-size: 32px; font-weight: 700; line-height: 1; color: var(--ink);
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.hs-unit { margin-left: 5px; font-family: var(--sans); font-size: 14px; font-weight: 600; color: var(--muted); }
.hs-chart { flex: 0 0 44%; height: 40px; }
.hs-svg { display: block; width: 100%; height: 40px; overflow: visible; }
.hs-bar { fill: var(--cat); }
.hs-bar.floor { fill-opacity: .45; }
.hs-slot { fill: var(--line); }
.hs-line { stroke: var(--cat); stroke-width: 2.2; }
.hs-dot { fill: var(--cat); }
.hs-dots { display: flex; align-items: center; justify-content: flex-end; gap: 6px; height: 40px; width: 100%; }
.hs-dotday { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--line); }
.hs-dotday.on { background: var(--cat); border-color: var(--cat); }
.hs-sub { margin-top: 8px; font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.hs-hl p { margin: 0 0 8px; font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.hs-log { margin-top: 22px; }
.hs-erow { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line-soft); }
.hs-pin { display: flex; align-items: center; gap: 9px; font-size: 14.5px; cursor: pointer; }
.hs-pin input { width: 22px; height: 22px; min-height: 22px; padding: 0; }
.hs-pin .ico { width: 18px; height: 18px; color: var(--muted); }

/* Quick log "+" above the tab bar (Today only: it lives in Today's view) */
.fab-wrap { position: fixed; right: 16px; bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 25;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.fab { width: 56px; height: 56px; border: 0; border-radius: 50%; cursor: pointer; display: flex; align-items: center;
  justify-content: center; background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px rgba(0, 0, 0, .3); }
.fab .ico { width: 26px; height: 26px; }
.fab-menu { display: flex; flex-direction: column; gap: 4px; padding: 8px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--line); box-shadow: 0 8px 28px rgba(0, 0, 0, .3); }
.fab-menu[hidden] { display: none; }
.fab-menu button { display: flex; align-items: center; gap: 10px; min-height: var(--touch-min); padding: 0 14px; border: 0;
  border-radius: 10px; background: none; color: var(--ink); font: inherit; font-size: 15px; text-align: left; cursor: pointer; }
.fab-menu .ico { width: 18px; height: 18px; color: var(--accent-text); }
#view-today:has(.fab-wrap) { padding-bottom: 72px; }   /* the last card clears the "+" */

/* ── audit 9 A19: the v24.3–v24.5 controls reach the 44 px touch size ── */
details.wo-details > summary { min-height: var(--touch-min); }
.hs-edit, .meal-time-edit, .r-mode, .sd-elapsed { min-height: var(--touch-min); display: inline-flex; align-items: center; }
.r-item-ctl .small-btn { min-height: var(--touch-min); min-width: var(--touch-min); }
.hs-pin { min-height: var(--touch-min); flex: 1; }

/* v24.13: exercise notes (038) and the plate calculator on a workout card */
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.wo-note { margin: 6px 0 2px; }
.wo-note-text { font-size: 14px; color: var(--ink-2); overflow-wrap: anywhere; }
.wo-note-prev { margin: 0 0 2px; overflow-wrap: anywhere; }
.wo-note .link-btn { min-height: var(--touch-min); }
.wo-note-ed textarea { width: 100%; }
.wo-plates { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.wo-plates .pl-out { font-weight: 600; margin: 4px 0 2px; }
/* v24.15: My measures on the food picker (039) */
.p-measure { margin: 2px 0 6px; }
.p-measure .link-btn { min-height: var(--touch-min); margin-right: 12px; }
.p-my-form { margin-top: 6px; }
/* v24.16: values typed from a lab report (labs.js) */
.lab-toggle, .lab-add, .lab-rm { min-height: var(--touch-min); }
.lab-values-host { margin: 0 0 10px; padding-left: 10px; border-left: 2px solid var(--line-soft); }
.lab-value { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; overflow-wrap: anywhere; }
.lab-form { margin-top: 8px; }
.lab-series { margin-top: 12px; }
.lab-series-name { font-weight: 600; }
.lab-point { display: grid; grid-template-columns: 7.5em 1fr auto; gap: 8px; font-size: 14px; padding: 3px 0; }

/* Coach view label on Today (usability audit 12-Oct, #27) and the check-in
   shortcut near the greeting (#31). */
.coach-view { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: -4px 0 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px;
  font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.coach-view-k { display: block; font-size: 11px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--accent-text); }
.coach-view .small-btn { flex-shrink: 0; }
.today-ci-go { margin: -2px 0 12px; }
