/* Bodiyo (prototype v2). Tokens follow Vance's design notes: platform font + tabular numbers, 4/8 spacing, 44px targets,
   near-black surfaces (#161719 / #1F1F1F) and one blue accent. Contrast ratios in DESIGN-AUDIT.md. */
:root {
  --bg: #000;
  --s1: #161719;          /* cards, rows */
  --s2: #1F1F1F;          /* inputs, raised controls */
  --s3: #2A2A2C;          /* pressed / separators on s1 */
  --sep: #2A2A2A;
  --t1: #FFFFFF;
  --t2: #A0A0A5;          /* 6.9:1 on s1 */
  --t3: #8E8E93;          /* 5.1:1 on s2, captions only */
  --accent: #3D9BE9;      /* text, icons, focus: 6.0:1 on s1 */
  --accent-fill: #1D6FBF; /* filled buttons: white text 5.2:1 */
  --accent-tint: rgba(61, 155, 233, .14);
  --danger: #FF6B6B;
  --m1: #E5484D;          /* primary muscle */
  --m2: #4F7FB0;          /* secondary muscle */
  --m0: #34353A;          /* untrained muscle */
  --body: #3A3B40;        /* V-11: 1.6:1 vs --s1 so the silhouette reads */
  --f: system-ui, -apple-system, "SF Pro Text", "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --r: 12px; --r-xs: 6px;   /* V-16: three radii — --r-xs 6 (small/inner), --r 12 (cards, sheets, inputs), 999px (pills) */
  /* V-15: one type scale — caption 12 · label 13 · body 16 · title 20 · stat 24 · screen 28 (.oneliner keeps 17 per V-04) */
  --fs-caption: 12px; --fs-label: 13px; --fs-body: 16px; --fs-title: 20px; --fs-stat: 24px; --fs-screen: 28px;
  --tab-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--t1); font-family: var(--f); font-size: var(--fs-body); line-height: 1.45; -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; }
::selection { background: rgba(61, 155, 233, .35); }
input, textarea, select, button { font: inherit; color: inherit; caret-color: var(--accent); }
a { color: var(--accent); text-decoration: none; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--fs-label); color: var(--t2); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-xs); }
[tabindex="-1"]:focus { outline: none; }   /* headings focused on route change / sheet open: announced to screen readers, no ring */
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--t2); }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round; }

.app { max-width: 480px; margin: 0 auto; min-height: 100dvh; position: relative; }
.screen { padding: 8px 16px calc(var(--tab-h) + var(--safe-b) + 32px); outline: none; }
body.no-tabs .screen { padding-bottom: calc(var(--safe-b) + 32px); }
body.has-rest .screen { padding-bottom: calc(var(--safe-b) + 120px); }
body.has-mini .screen { padding-bottom: calc(var(--tab-h) + var(--safe-b) + 96px); }
::-webkit-scrollbar { width: 6px; } ::-webkit-scrollbar-thumb { background: #333; border-radius: 999px; } ::-webkit-scrollbar-track { background: transparent; }

/* ---------- type ---------- */
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: var(--fs-screen); line-height: 1.15; letter-spacing: -0.02em; }
p { margin: 0; }
.lt { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 0 16px; }
.lt-sub { margin-top: 4px; color: var(--t2); font-size: var(--fs-body); }
.sec { font-weight: 700; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: var(--fs-title); line-height: 1.25; margin: 32px 0 12px; }
.sec-why { min-height: 44px; margin-bottom: 4px; }
.sec-link { color: var(--t1); min-height: 44px; }
.sec-link .chev { color: var(--t3); }
h3.sec { font-size: var(--fs-body); color: var(--t2); font-weight: 600; margin: 20px 0 8px; }
.sub { font-size: var(--fs-body); margin: 24px 0 8px; display: flex; gap: 8px; align-items: center; }
.fine { color: var(--t2); font-size: var(--fs-label); line-height: 1.45; margin-top: 12px; }
.fine.center { text-align: center; }
.hint { color: var(--t2); font-size: var(--fs-label); margin: 8px 0 0; display: block; }
.lead { display: flex; align-items: flex-start; gap: 12px; justify-content: space-between; }
.lead p, .lead-p { font-size: var(--fs-body); line-height: 1.4; }
.lead-p { color: var(--t2); }

/* ---------- top bar ---------- */
.topbar { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 8px; min-height: 52px; position: sticky; top: 0; z-index: 5; background: rgba(0,0,0,.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); margin: -8px -16px 0; padding: 4px 12px; }
.tb-title { font-size: var(--fs-body); font-weight: 600; text-align: center; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-sp { width: 44px; height: 44px; display: block; }
.iconbtn { width: 44px; height: 44px; display: inline-grid; place-items: center; border: 0; background: none; color: var(--t1); border-radius: 999px; cursor: pointer; flex: none; padding: 0; }
.iconbtn:active { background: var(--s2); }
.iconbtn:disabled { color: #4a4a4e; cursor: default; }
.iconbtn .ic { width: 22px; height: 22px; }
.avatar .ic { width: 28px; height: 28px; stroke-width: 1.6; color: var(--t2); }

/* ---------- buttons ---------- */
.btn { min-height: 48px; padding: 0 20px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: var(--r); border: 0; font-weight: 600; font-size: var(--fs-body); cursor: pointer; text-align: center; }
.btn .ic { width: 18px; height: 18px; }
.btn-primary { background: var(--accent-fill); color: #fff; }
.btn-primary:active { background: #185EA3; }
.btn-secondary { background: var(--s2); color: var(--t1); }
.btn-secondary:active { background: var(--s3); }
.btn-quiet { background: none; color: var(--accent); }
.btn-danger { background: none; color: var(--danger); }
.btn-block { width: 100%; }
.btn-sm-h { min-height: 36px; padding: 0 16px; font-size: var(--fs-body); border-radius: 999px; position: relative; }
.btn-sm-h::after { content: ""; position: absolute; inset: -4px 0; }
.btn-sm { min-height: 44px; min-width: 44px; padding: 0 12px; border: 0; border-radius: var(--r); background: var(--s2); color: var(--t1); font-weight: 600; font-size: var(--fs-label); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.btn-text { min-height: 44px; display: inline-flex; align-items: center; gap: 6px; padding: 0 4px; border: 0; background: none; color: var(--accent); font-weight: 600; font-size: var(--fs-body); cursor: pointer; }
.btn-text .ic { width: 18px; height: 18px; }
.btn-text.quiet { color: var(--t2); }
.btn-text.danger { color: var(--danger); margin-top: 24px; }
.cta-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.cta-pair .btn { padding: 0 12px; }
.sticky-cta { position: sticky; bottom: 0; margin: 24px -16px 0; padding: 12px 16px calc(12px + var(--safe-b)); background: linear-gradient(to top, #000 70%, rgba(0,0,0,0)); }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 20px; }

/* "Why?" affordance: plain accent text, 44px hit area, never a pill */
.why { flex: none; min-height: 44px; min-width: 44px; padding: 0 2px; border: 0; background: none; color: var(--accent); font-size: var(--fs-label); font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: flex-end; }
.why.as-text { min-height: 0; }
.fine .why, .sheet-sub .why { min-height: 0; min-width: 0; display: inline; padding: 0; position: relative; font-size: inherit; }
.fine .why::after, .sheet-sub .why::after { content: ""; position: absolute; inset: -14px -10px; }

.tag { display: inline-block; font-size: var(--fs-caption); font-weight: 600; line-height: 1; padding: 4px 6px; border-radius: var(--r-xs); background: var(--s3); color: var(--t2); vertical-align: 2px; }
.tag-accent { background: var(--accent-tint); color: var(--accent); }

/* ---------- surfaces: tint OR border, never both, no shadows on cards ---------- */
.card { background: var(--s1); border-radius: var(--r); padding: 16px; }
.card-t, .next-t { font-size: var(--fs-title); line-height: 1.25; }
.next .btn-primary { margin-top: 16px; }
.next .btn-quiet { margin-top: 4px; min-height: 44px; }
.next .row-s + .row-s { margin-top: 2px; }
.rows { background: var(--s1); border-radius: var(--r); overflow: hidden; }
.rows-flat { background: none; margin: 12px -16px 0; border-radius: 0; list-style: none; padding: 0; }
ol.rows, ul.rows { list-style: none; padding: 0; margin: 0; }
.rows-flat { margin: 12px 0 0; }
.row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 16px; color: var(--t1); text-align: left; width: 100%; background: none; border: 0; }
.rows > .row + .row, .rows > * + .row, .rows > .row-d + .row-d { border-top: 1px solid var(--sep); }
.rows-flat .row { padding-left: 0; padding-right: 0; }
.row-btn { cursor: pointer; }
.row-btn:active { background: var(--s2); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-t { font-size: var(--fs-body); font-weight: 600; color: var(--t1); }
.row-t.link { color: var(--t1); }
.row-s { font-size: var(--fs-label); color: var(--t2); line-height: 1.4; }
.row-v { font-size: var(--fs-body); white-space: nowrap; color: var(--t1); }
.row-wd { width: 32px; color: var(--t2); font-size: var(--fs-label); font-weight: 600; flex: none; }
.row-ic { width: auto; height: auto; background: none; color: var(--accent); display: grid; place-items: center; flex: none; }   /* V-13: plain inline icon, no tile */
.row-ic svg { width: 20px; height: 20px; }
.chev { color: var(--t3); width: 18px; height: 18px; }
.row-d summary { list-style: none; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 16px; cursor: pointer; }
.row-d summary::-webkit-details-marker { display: none; }
.row-d[open] summary .chev { transform: rotate(180deg); }
.row-d .plain { padding: 0 16px; }
.row-d .btn { margin: 8px 16px 16px; width: calc(100% - 32px); }
.deload { background: var(--s1); border-radius: var(--r); margin-top: 32px; }
.resume { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--accent-tint); border-radius: var(--r); color: var(--t1); margin-bottom: 16px; min-height: 56px; }
.resume > .ic:first-child { color: var(--accent); }
.empty { text-align: center; padding: 48px 16px 24px; }
.empty h2 { font-size: var(--fs-title); }
.empty p { color: var(--t2); margin: 8px auto 20px; max-width: 32ch; }
.empty-inline { color: var(--t2); font-size: var(--fs-label); padding: 4px 0; }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--sep); font-size: var(--fs-body); }
ul.plain li:first-child { border-top: 0; }
.cues li { color: var(--t1); }
.conv-li { align-items: flex-start; }
.conv-li span { color: var(--t2); font-size: var(--fs-label); padding-top: 2px; }
.conv-li .why { align-self: center; }

/* ---------- notes (reminders, coaching) ---------- */
.notes { list-style: none; padding: 0; margin: 16px 0 0; background: var(--s1); border-radius: var(--r); }
.note { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; }
.note + .note { border-top: 1px solid var(--sep); }
.note-text { flex: 1; font-size: var(--fs-body); line-height: 1.45; padding-top: 1px; }
.note-acts { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }   /* T15 deload nudge */
.note .why { margin: -12px 0 -12px; align-self: center; }

/* ---------- stats ---------- */
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--sep); border-radius: var(--r); overflow: hidden; }
.stats3.two { grid-template-columns: repeat(2, 1fr); }   /* V-05/V-06 */
.week-twice { font-size: var(--fs-body); color: var(--t2); margin: 10px 2px 0; }
.week-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 24px 0 0; padding: 14px 16px; background: var(--s1); border-radius: var(--r); color: var(--t1); font-size: var(--fs-body); font-weight: 600; text-decoration: none; }
.week-line .chev { color: var(--t3, var(--t2)); flex: none; }
.stats3 > div { background: var(--s1); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.stats3 b { font-size: var(--fs-stat); line-height: 1.1; font-weight: 700; }
.stats3 small { font-size: var(--fs-label); font-weight: 600; color: var(--t2); }
.stats3 span { font-size: var(--fs-label); color: var(--t2); line-height: 1.3; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; background: var(--s1); border-radius: var(--r); padding: 4px 16px; margin-top: 12px; }
.kv { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--sep); font-size: var(--fs-body); }
.kv:nth-last-child(-n+2) { border-bottom: 0; }
.kv span { color: var(--t2); }
.kvs { margin: 0 0 16px; }
.kvs div { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--sep); }
.kvs dt { color: var(--t2); } .kvs dd { margin: 0; font-weight: 600; }

.bars { background: var(--s1); border-radius: var(--r); padding: 8px 16px; }
.bar { display: grid; grid-template-columns: 112px 1fr 36px; align-items: center; gap: 12px; min-height: 44px; }
.bar + .bar { border-top: 1px solid var(--sep); }
.bar-l { font-size: var(--fs-body); display: flex; flex-direction: column; line-height: 1.25; }
.bar-l small { font-size: var(--fs-caption); color: var(--t2); }
.bar-t { height: 8px; background: var(--s2); border-radius: 999px; overflow: hidden; }
.bar-t i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar-t i.ind { background: #4F7FB0; }   /* V-19: ≥3:1 vs track (WCAG 1.4.11); "helper only" label kept */
.bar b { text-align: right; font-size: var(--fs-body); }
.bar.zero .bar-l, .bar.zero b { color: var(--t3); }

.weeknav { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; background: none; padding: 0; margin-bottom: 8px; }   /* V-14: plain header row */
.wn-mid { text-align: center; display: flex; flex-direction: column; }
.wn-mid b { font-size: var(--fs-body); } .wn-mid span { font-size: var(--fs-label); color: var(--t2); }

/* ---------- segmented ---------- */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--s1); border-radius: var(--r); padding: 3px; margin: 24px 0 12px; gap: 2px; }
.seg button { min-height: 40px; border: 0; background: none; color: var(--t2); font-weight: 600; font-size: var(--fs-label); border-radius: var(--r-xs); cursor: pointer; position: relative; }
.seg button::after { content: ""; position: absolute; inset: -2px 0; }
.seg button[aria-selected=true], .seg button[aria-pressed=true] { background: var(--s3); color: var(--t1); }
.seg-sm { margin: 8px 0 0; }

/* ---------- onboarding ---------- */
.q { border: 0; padding: 0; margin: 0 0 24px; }
.q legend { display: flex; width: 100%; align-items: center; justify-content: space-between; font-size: var(--fs-body); font-weight: 600; padding: 0; margin-bottom: 4px; }
.opts { display: grid; gap: 8px; }
.opts-row { grid-template-columns: repeat(auto-fit, minmax(56px, 1fr)); }
.opt { min-height: 52px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; padding: 10px 14px; background: var(--s1); border: 1px solid transparent; border-radius: var(--r); color: var(--t1); cursor: pointer; text-align: left; }
.opts-row .opt { align-items: center; padding: 10px 4px; }
.opt-l { font-size: var(--fs-body); font-weight: 600; }
.opt-s { font-size: var(--fs-label); color: var(--t2); }
.opt[aria-pressed=true] { border-color: var(--accent); background: var(--accent-tint); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin: 16px 0 0; border: 0; padding: 0; }
.field > span, .field legend { font-size: var(--fs-body); font-weight: 600; padding: 0; margin-bottom: 6px; }
.field small { color: var(--t2); font-weight: 400; font-size: var(--fs-label); margin-left: 4px; }
.field input, .field textarea, .bday-name { min-height: 48px; background: var(--s2); border: 1px solid transparent; border-radius: var(--r-xs); padding: 10px 14px; font-size: var(--fs-body); width: 100%; }
.field textarea { resize: vertical; }
.field input:focus, .field textarea:focus, .bday-name:focus { outline: none; border-color: var(--accent); }
.field input[aria-invalid=true] { border-color: var(--danger); }
.err { color: var(--danger) !important; font-size: var(--fs-label) !important; margin: 0 !important; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--sep); background: none; color: var(--t1); font-size: var(--fs-label); cursor: pointer; position: relative; }
.chip::after { content: ""; position: absolute; inset: -2px 0; }
.chip[aria-pressed=true] { background: var(--accent-tint); border-color: var(--accent); color: var(--t1); }
.chip:disabled { opacity: .35; cursor: default; }
.check { display: flex; align-items: center; gap: 12px; min-height: 48px; margin-top: 16px; font-size: var(--fs-body); }
.check input { width: 22px; height: 22px; accent-color: var(--accent-fill); }
.search { display: flex; align-items: center; gap: 8px; background: var(--s2); border-radius: var(--r-xs); padding: 0 12px; min-height: 44px; color: var(--t2); }
.search input { flex: 1; min-height: 44px; border: 0; background: none; outline: none; font-size: var(--fs-body); color: var(--t1); }
.search:focus-within { box-shadow: inset 0 0 0 1px var(--accent); }
.selectrow { display: flex; align-items: center; justify-content: space-between; min-height: 44px; margin: 8px 0; font-size: var(--fs-body); color: var(--t2); }
/* V-17: 44px target, custom Lucide chevron (local file; CSP img-src 'self') */
.selectrow select { -webkit-appearance: none; appearance: none; background: var(--s2) url("vendor/lucide/chevron-down.svg") no-repeat right 10px center / 18px 18px; border: 0; border-radius: var(--r-xs); min-height: 44px; padding: 0 36px 0 12px; font-size: var(--fs-body); color: var(--t1); max-width: 60%; }

/* ---------- builder ---------- */
.bday { margin-top: 24px; }
.bday-head { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.bday-name { font-weight: 600; font-size: var(--fs-body); flex: 1; }
.bex { list-style: none; margin: 0; padding: 0; background: var(--s1); border-radius: var(--r); }
.bex li { display: flex; align-items: center; gap: 4px; padding: 6px 4px 6px 16px; min-height: 60px; }
.bex li + li { border-top: 1px solid var(--sep); }
.bex .row-t { font-size: var(--fs-body); }
.bex .row-s { font-size: var(--fs-label); }
.stepper { display: inline-flex; align-items: center; background: var(--s2); border-radius: var(--r-xs); }
.stepper button { width: 36px; height: 44px; border: 0; background: none; color: var(--t1); display: grid; place-items: center; cursor: pointer; }
.stepper button:disabled { color: #4a4a4e; }
.stepper .ic { width: 16px; height: 16px; }
.stepper b { min-width: 18px; text-align: center; font-size: var(--fs-body); }
.bex .iconbtn { width: 40px; }
.bday .btn-text { margin-top: 4px; }

/* ---------- workout ---------- */
.tb-name { font-size: var(--fs-body); }
.wstats { display: flex; gap: 16px; align-items: baseline; font-size: var(--fs-label); color: var(--t2); padding: 8px 0 4px; flex-wrap: wrap; }
.wstats b { color: var(--t1); font-size: var(--fs-body); font-weight: 600; }
.wsrc { margin-left: auto; color: var(--t3); }
.exb { padding: 16px 0 8px; border-top: 1px solid var(--sep); margin-top: 16px; }
.exb:first-of-type { border-top: 0; }
.exb-head { display: flex; align-items: flex-start; gap: 12px; }
.mini { width: 26px; height: 52px; flex: none; display: block; margin-top: 2px; }
.mini svg { width: 100%; height: 100%; display: block; }
.exb-title { flex: 1; min-width: 0; }
.exname { font-size: var(--fs-body); font-weight: 700; color: var(--t1); display: inline-block; box-sizing: border-box; min-height: 44px; padding: 8px 0; margin: -8px 0; }   /* V-18: ≥44px hit area, same layout */
/* V-08: the rx line is tappable text (opens the rx sheet, which carries the per-line Why?s); no separate Why? chip */
.rxline { display: flex; align-items: center; width: 100%; min-height: 36px; padding: 0; margin: -6px 0 -4px; background: none; border: 0; color: var(--t2); font: inherit; font-size: var(--fs-label); text-align: left; cursor: pointer; }
.rxline:active span { color: var(--t1); }
.exb-count { font-size: var(--fs-label); color: var(--t2); padding-top: 13px; }
.exb-head .iconbtn { margin: -2px -10px 0 -4px; }
.sugg { display: flex; align-items: center; gap: 10px; background: var(--s1); border-radius: var(--r); padding: 6px 10px 6px 12px; margin: 12px 0 4px; }
.sugg > .ic { color: var(--accent); width: 18px; height: 18px; }
.sugg div { flex: 1; display: flex; flex-direction: column; font-size: var(--fs-label); color: var(--t2); line-height: 1.35; }
.sugg b { color: var(--t1); font-size: var(--fs-body); font-weight: 600; }
.sets { width: 100%; border-collapse: separate; border-spacing: 0 4px; margin-top: 8px; table-layout: fixed; }
.sets th { font-size: var(--fs-caption); font-weight: 600; color: var(--t2); text-align: center; padding: 0 2px 2px; }
.sets th:nth-child(1) { width: 36px; } .sets th:nth-child(2) { width: 74px; text-align: left; } .sets th:nth-child(6) { width: 48px; }
.sets td { padding: 0 2px; text-align: center; }
.sets tr.done td { background: var(--accent-tint); }
.sets tr.done td:first-child { border-radius: var(--r-xs) 0 0 var(--r-xs); } .sets tr.done td:last-child { border-radius: 0 var(--r-xs) var(--r-xs) 0; }
.c-set { font-weight: 700; font-size: var(--fs-body); height: 48px; }
.c-prev { font-size: var(--fs-label); color: var(--t2); text-align: left !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-in { width: 100%; min-height: 44px; text-align: center; border: 1px solid transparent; background: var(--s2); border-radius: var(--r-xs); font-size: var(--fs-body); font-weight: 600; padding: 0 2px; }
::placeholder { color: #8E8E93; opacity: 1; }   /* 5.06:1 on #1F1F1F */
.cell-in::placeholder { color: #8E8E93; font-weight: 500; }
.cell-in:focus { outline: none; border-color: var(--accent); }
.cell-in.bad { border-color: var(--danger); }
tr.done .cell-in { background: transparent; }
.tick { width: 44px; height: 44px; border-radius: var(--r-xs); border: 0; background: var(--s2); color: #6e6e73; display: grid; place-items: center; cursor: pointer; margin: 0 auto; }
.tick[aria-pressed=true] { background: var(--accent-fill); color: #fff; }
.tick .ic { width: 20px; height: 20px; stroke-width: 2.5; }
.err-row td { color: var(--danger); font-size: var(--fs-label); text-align: left !important; padding: 0 4px 6px 40px; }
.exb-foot { display: flex; justify-content: space-between; gap: 8px; }
.wfoot { display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin-top: 24px; border-top: 1px solid var(--sep); padding-top: 24px; }
.wfoot .btn-text.danger { margin: 0 auto; }

/* ---------- rest timer + mini bar + tab bar ---------- */
.restbar { position: fixed; left: 50%; transform: translateX(-50%); width: min(480px, 100%); bottom: 0; z-index: 20; background: var(--s1); border-top: 1px solid var(--sep); padding: 0 12px calc(8px + var(--safe-b)); }
.rest-track { height: 3px; background: var(--s2); margin: 0 -12px; }
.rest-track i { display: block; height: 100%; background: var(--accent); transition: width 1s linear; }
.rest-row { display: flex; align-items: center; gap: 8px; padding-top: 8px; }
.rest-row > .ic { color: var(--accent); }
.rest-label { flex: 1; font-size: var(--fs-body); color: var(--t2); }
.rest-label b { color: var(--t1); font-size: var(--fs-title); margin-left: 4px; }
.restbar.over .rest-label b { color: var(--accent); }
.minibar { position: fixed; left: 50%; transform: translateX(-50%); width: min(480px, 100%); bottom: calc(var(--tab-h) + var(--safe-b)); z-index: 19; padding: 0 8px 8px; }
.minibar a { display: flex; align-items: center; gap: 12px; background: #1d2a36; border-radius: var(--r); padding: 8px 12px; min-height: 56px; color: var(--t1); }
.minibar a > .ic { color: var(--accent); }
.mini-cta { color: var(--accent); font-weight: 600; font-size: var(--fs-body); }
.tabbar { position: fixed; left: 50%; transform: translateX(-50%); width: min(480px, 100%); bottom: 0; z-index: 18; display: grid; grid-template-columns: repeat(5, 1fr); background: rgba(22, 23, 25, .94); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--sep); padding-bottom: var(--safe-b); }
.tabbar a { min-height: var(--tab-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--t3); font-size: var(--fs-caption); font-weight: 600; }
.tabbar a .ic { width: 24px; height: 24px; }
.tabbar a.on { color: var(--accent); }

/* ---------- sheet + dialog + toast ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); z-index: 30; }
.sheet { position: fixed; left: 50%; bottom: 0; width: min(480px, 100%); max-height: 86dvh; overflow-y: auto; overscroll-behavior: contain; transform: translate(-50%, 16px); opacity: 0; transition: transform .22s cubic-bezier(.2, .8, .2, 1), opacity .18s; background: var(--s1); border-radius: var(--r) var(--r) 0 0; z-index: 31; padding: 0 20px calc(24px + var(--safe-b)); }
.sheet.show { transform: translate(-50%, 0); opacity: 1; }
.sheet.tall { height: 86dvh; }
.grab { width: 36px; height: 5px; border-radius: 999px; background: #3a3a3d; margin: 8px auto 0; }
.sheet-head { display: flex; justify-content: space-between; margin: 0 -12px; position: sticky; top: 0; background: var(--s1); z-index: 1; }
.sheet h2 { font-size: var(--fs-title); line-height: 1.2; outline: none; }
.sheet-sub { margin-top: 8px; font-size: var(--fs-label); line-height: 1.45; }
.sheet-sub .why { min-height: 0; display: inline; padding: 0; font-size: var(--fs-label); }
.why-title { font-size: var(--fs-title) !important; color: var(--t1); font-weight: 700 !important; }   /* V-04: the question is the heading */
.oneliner { font-size: 17px; line-height: 1.45; font-weight: 400; margin-top: 8px; }
.grade { font-size: var(--fs-label); font-weight: 600; color: var(--t2); margin-top: 8px; }   /* V-03: evidence grade under the one-liner */
.oneliner.pending { font-size: 17px; font-weight: 600; color: var(--t2); }
.conv { margin-top: 20px; padding: 12px 14px; background: var(--s2); border-radius: var(--r); }
.conv h3, .research h3 { font-size: var(--fs-label); color: var(--t2); font-weight: 600; margin: 0 0 6px; }
.conv ul { margin: 0; padding-left: 18px; font-size: var(--fs-label); } .conv li + li { margin-top: 6px; }
.disclose { margin-top: 20px; width: 100%; min-height: 48px; display: flex; align-items: center; gap: 10px; background: none; border: 0; border-top: 1px solid var(--sep); border-bottom: 1px solid var(--sep); color: var(--accent); font-weight: 600; font-size: var(--fs-body); padding: 0; cursor: pointer; }
.disclose span:nth-of-type(1) { flex: 1; text-align: left; }
.disclose-n { color: var(--t2); font-weight: 400; font-size: var(--fs-label); }
.disclose[aria-expanded=true] .chev { transform: rotate(180deg); }
.research { padding-top: 8px; font-size: var(--fs-body); line-height: 1.5; }
.research h3 { margin-top: 20px; }
.research p { color: #D6D6DA; }
.cites { padding-left: 20px; margin: 0; }
.cites li { margin-bottom: 16px; color: var(--t2); }
.cite-main { color: var(--t1) !important; font-size: var(--fs-label); }
.cite-tags { font-size: var(--fs-caption); color: var(--t2) !important; margin-top: 2px; }   /* (d) study type · population · n · duration */
.cite-detail { font-size: var(--fs-label); color: var(--t2) !important; margin-top: 4px; }
.cite-note { font-size: var(--fs-label); color: var(--t2) !important; margin-top: 6px; display: flex; gap: 6px; }
.cite-note .ic { width: 16px; height: 16px; color: var(--accent); margin-top: 2px; }
.cite-links { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 4px; font-size: var(--fs-label); }
.cite-links a { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; }
.cite-links .ic { width: 14px; height: 14px; }
.rx-list { margin-top: 16px; background: var(--s2); border-radius: var(--r); }
.rx-row { display: grid; grid-template-columns: 1fr auto 18px; grid-template-areas: "k v c" "o o c"; gap: 2px 8px; align-items: center; width: 100%; padding: 12px 14px; background: none; border: 0; text-align: left; cursor: pointer; color: var(--t1); min-height: 56px; }
.rx-row + .rx-row { border-top: 1px solid #303033; }
.rx-k { grid-area: k; font-weight: 600; font-size: var(--fs-body); } .rx-v { grid-area: v; font-size: var(--fs-body); color: var(--t1); } .rx-row .chev { grid-area: c; }
.rx-1 { grid-area: o; font-size: var(--fs-label); color: var(--t2); line-height: 1.35; }
.rx-card { display: flex; align-items: center; gap: 12px; width: 100%; background: var(--s1); border: 0; border-radius: var(--r); padding: 12px 16px; margin-top: 16px; text-align: left; color: var(--t1); cursor: pointer; min-height: 60px; }
.rx-card + .row { background: var(--s1); border-radius: var(--r); margin-top: 8px; }
.menu { margin-top: 12px; background: var(--s2); border-radius: var(--r); overflow: hidden; }
.menu-row { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 52px; padding: 0 16px; border: 0; background: none; color: var(--t1); font-size: var(--fs-body); cursor: pointer; text-align: left; }
.menu-row + .menu-row { border-top: 1px solid #303033; }
.menu-row .ic { color: var(--t2); }
.menu-row.danger, .menu-row.danger .ic { color: var(--danger); }
.menu-row:disabled { color: #5a5a5e; } .menu-row:disabled .ic { color: #4a4a4e; }
.pick-list { margin-top: 4px; }
.pick-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 8px 0; border: 0; border-bottom: 1px solid var(--sep); background: none; color: var(--t1); text-align: left; cursor: pointer; }
.pick-row:disabled { opacity: .45; cursor: default; }
.pick-row .mini { width: 22px; height: 44px; margin: 0; }
.pr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pr-name { font-size: var(--fs-body); font-weight: 600; }
.pr-sub { font-size: var(--fs-label); color: var(--t2); line-height: 1.35; }
.pick-row.best { background: var(--accent-tint); border-radius: var(--r); padding: 10px 12px; border-bottom: 0; }
.pick-row.create { color: var(--accent); }
.pick-row.create > .ic { width: 22px; margin: 0; }
.pick-row.create .pr-name { color: var(--accent); }
.sheet .btn-quiet { width: 100%; margin-top: 12px; }
.dialog { position: fixed; inset: 0; display: grid; place-items: center; z-index: 40; padding: 24px; pointer-events: none; }
.dlg { pointer-events: auto; width: min(340px, 100%); background: #232325; border-radius: var(--r); padding: 20px 20px 12px; }
.dlg h2 { font-size: var(--fs-title); line-height: 1.3; }
.dlg p { color: var(--t2); margin-top: 8px; font-size: var(--fs-body); }
.dlg-actions { display: flex; flex-direction: column; gap: 4px; margin-top: 16px; }
.dlg-actions .btn { width: 100%; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + var(--safe-b) + 16px); z-index: 50; width: min(448px, calc(100% - 32px)); background: #2C2C2E; color: var(--t1); border-radius: var(--r); padding: 6px 6px 6px 16px; min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: var(--fs-body); }
body.no-tabs .toast { bottom: calc(var(--safe-b) + 16px); }
body.has-rest .toast { bottom: calc(var(--safe-b) + 92px); }
body:has(#sheet:not([hidden])) .toast { top: calc(env(safe-area-inset-top, 0px) + 12px); bottom: auto; z-index: 80; }   /* never cover an open sheet */
.toast-act { min-height: 44px; padding: 0 12px; border: 0; background: none; color: var(--accent); font-weight: 700; display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.toast-act .ic { width: 18px; height: 18px; }
body:has(#toast:not([hidden])) .update-bar { visibility: hidden; }   /* L-11: a short toast wins; the update bar comes back after it */

/* ---------- muscle map ---------- */
.mmap { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; background: var(--s1); border-radius: var(--r); padding: 16px 24px 8px; }
.mmap figure { margin: 0; text-align: center; }
.mmap svg { height: 200px; width: auto; max-width: 100%; }
.mmap figcaption { font-size: var(--fs-caption); color: var(--t2); margin-top: 4px; }
.legend { margin: 8px 0 0; display: grid; gap: 8px; }
.legend div { display: grid; grid-template-columns: 128px 1fr; gap: 8px; font-size: var(--fs-label); }
.legend dt { color: var(--t2); display: flex; align-items: center; gap: 8px; } .legend dd { margin: 0; }
.sw { width: 10px; height: 10px; border-radius: var(--r-xs); display: inline-block; } .sw1 { background: var(--m1); } .sw2 { background: var(--m2); }

@media (prefers-reduced-motion: reduce) { .sheet, .rest-track i { transition: none; } }
@media (min-width: 520px) { .app { border-left: 1px solid #111; border-right: 1px solid #111; } }

/* ---------- i18n: text up to ~40% longer than English (tested with ?lang=pseudo) ---------- */
html[lang="vi"] body, html[lang="vi"] input, html[lang="vi"] textarea, html[lang="vi"] select, html[lang="vi"] button { line-height: 1.45; }  /* stacked Vietnamese diacritics need a little more leading */
.loading { color: var(--t2); padding: 48px 16px; text-align: center; }
.err-msg { display: block; }
.err-msg + .err-msg { margin-top: 2px; }
.btn { line-height: 1.2; padding-top: 6px; padding-bottom: 6px; overflow-wrap: anywhere; }
.cta-pair .btn, .seg button, .chip, .tag { overflow-wrap: anywhere; hyphens: auto; }
.seg button { padding: 4px 6px; line-height: 1.2; }
.tabbar a span { max-width: 100%; padding: 0 2px; text-align: center; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats3 span, .row-t, .row-s, .pr-name, .pr-sub, .card-t, h1, h2, h3, dd, dt, .bar-l { overflow-wrap: anywhere; }
.lang-seg { margin: 8px 0 8px; }
/* compliance 1: legal pages + first-launch notice */
.tag-warn { background: rgba(255, 196, 0, .16); color: #FFD25E; }
.legal-draft { margin: 4px 0 0; color: var(--t2); font-size: var(--fs-label); }
.legal-body p { margin: 8px 0 0; line-height: 1.5; }
.legal-body .lead-p { margin-top: 4px; }
.legal-notice a { color: var(--accent); text-decoration: none; display: inline-block; padding: 12px 0; margin: -12px 0; }
/* compliance 2: optional age / bodyweight */
.about .sec { display: flex; align-items: center; gap: 8px; }
.about-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.about .btn-block { margin-top: 16px; }
/* compliance 3: age / bodyweight hooks */
.note-older { display: block; margin-top: 6px; color: var(--t2); }
.relstr { margin: 0 0 8px; color: var(--t1); }
.relstr-hint a { color: var(--accent); text-decoration: none; display: inline-block; padding: 12px 0; margin: -12px 0; }
