/* The page's own styles: the handoff's layouts (design/web/HANDOFF.md) as
   classes, on the tokens in theme.css. Dark only, 390 pt wide, iOS safe areas. */

* { box-sizing: border-box; }
/* hidden means hidden, even on an element whose class sets display. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body { margin: 0; height: 100%; font-size: 16px; line-height: 1.5; overscroll-behavior-y: none; }
h1, h2, h3, p, ol, ul { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--primary-30); outline-offset: 2px; }
input::placeholder, textarea::placeholder { color: var(--fg-2); }
.icon { display: block; flex: none; }
.muted { color: var(--fg-2); }
.fg { color: var(--fg-1); }
.row { display: flex; align-items: center; gap: var(--space-sm); }
.between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); }
.col { display: flex; flex-direction: column; gap: var(--space-xs); }
.stack { display: flex; flex-direction: column; gap: var(--space-md); }
.stack-sm { display: flex; flex-direction: column; gap: var(--space-sm); }
.center { text-align: center; }

/* ---- the shell: a scrolling screen above a fixed tab bar ---- */
#app { height: 100%; height: 100dvh; }
.shell { height: 100%; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); }
.scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.screen { max-width: 520px; margin: 0 auto; padding: 0 var(--space-md) var(--space-lg); display: flex; flex-direction: column; gap: var(--space-md); }
.screen > header { display: flex; flex-direction: column; gap: var(--space-xs); padding-top: var(--space-sm); }
.titlerow { display: flex; align-items: center; justify-content: space-between; min-height: var(--control-h-touch); }
.titlerow > h1 { min-height: var(--control-h-touch); display: flex; align-items: center; }
.subrow { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); min-height: 24px; }
.status { display: flex; align-items: center; gap: var(--space-xs); color: var(--fg-2); white-space: nowrap; }
.status.warn { color: var(--warning); }

/* ---- cards, buttons, inputs ---- */
.card {
  background: var(--surface-card); border: 1px solid var(--border); border-radius: var(--radius-xl);
  padding: var(--space-lg); display: flex; flex-direction: column; gap: var(--space-md);
}
.card.list { padding: var(--space-md); }
.btn {
  height: var(--control-h-touch); padding: 0 20px; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-sm);
  border-radius: var(--radius-lg); border: 1px solid transparent; font-size: 14px; font-weight: 600; transition: all 200ms ease; white-space: nowrap;
}
.btn:disabled { opacity: 0.5; }
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: var(--glow-primary); }
.btn-primary:hover { opacity: 0.9; }
.btn-primary:disabled:hover { opacity: 0.5; }
.btn-outline { background: transparent; border-color: var(--border); color: var(--fg-1); }
.btn-outline.dim { color: var(--fg-2); }
.btn-ghost { background: transparent; color: var(--fg-2); font-weight: 500; }
.btn-ghost.danger { color: var(--error); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-link { height: var(--control-h-touch); padding: 0 8px; display: inline-flex; align-items: center; gap: var(--space-xs); color: var(--primary); font-size: 14px; font-weight: 500; }
.btn-icon { width: var(--control-h-touch); height: var(--control-h-touch); display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-lg); color: var(--fg-2); }
.btn-icon.fg { color: var(--fg-1); }
.btn-icon:disabled { opacity: 0.3; }
.btn.wide { width: 100%; }
.input, .textarea {
  width: 100%; background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-lg);
  color: var(--fg-1); font-size: 16px; /* 16px stops iOS zooming the page on focus */ outline: none; transition: border-color 200ms ease, box-shadow 200ms ease;
}
.input { height: var(--control-h-touch); padding: 0 12px; }
.textarea { padding: 12px; line-height: 1.5; resize: none; display: block; }
.input:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary-30); }
.input.bad { border-color: var(--secondary); }
.input:disabled { opacity: 0.5; }
.field { display: flex; flex-direction: column; gap: var(--space-sm); }
.counter { align-self: flex-end; color: var(--fg-2); }
.problem { display: flex; align-items: center; gap: var(--space-sm); color: var(--secondary); }
.bar { height: 8px; border-radius: var(--radius-full); background: var(--surface-raised); overflow: hidden; }
.bar > .fill { height: 100%; border-radius: var(--radius-full); background: var(--primary); transition: width 200ms ease; }
.bar.thin { height: 4px; }
.bar.thin > .fill { background: var(--fg-1); }
.badge {
  height: 28px; padding: 0 12px; display: inline-flex; align-items: center; gap: var(--space-xs); border-radius: var(--radius-full);
  background: var(--surface-raised); border: 1px solid var(--border); color: var(--fg-2); white-space: nowrap;
}
.badge.small { height: 24px; padding: 0 8px; }
.tone-primary { background: var(--primary-10); border-color: var(--primary-20); color: var(--primary); }
.tone-success { background: var(--success-10); border-color: var(--success-20); color: var(--success); }
.tone-warning { background: var(--warning-10); border-color: var(--warning-20); color: var(--warning); }
.tone-error { background: var(--error-10); border-color: var(--error-20); color: var(--error); }
.tone-neutral { background: var(--surface-raised); border-color: var(--fg-2); color: var(--fg-1); }

/* A toggle chip: plain until chosen, then tinted with its icon showing, never colour alone. */
.chip {
  min-height: var(--control-h-touch); padding: 8px 12px; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-xs);
  border-radius: var(--radius-lg); background: transparent; border: 1px solid var(--border); color: var(--fg-2); font-size: 14px; font-weight: 500;
  text-align: left; transition: all 200ms ease;
}
.chip.on { font-weight: 600; }
.chip:disabled { opacity: 0.4; }
.chip.on.tone-primary { color: var(--primary); }
.chip.pill { border-radius: var(--radius-full); padding: 0 16px; }
.chip.fg { color: var(--fg-1); }
.chip.on.tone-primary.fg { color: var(--fg-1); }
.spin { display: inline-flex; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---- sign in ---- */
.signin { min-height: 100%; display: flex; flex-direction: column; justify-content: center; gap: var(--space-xl); padding: 0 var(--space-md) 48px; max-width: 420px; margin: 0 auto; }
.signin > .signin-legal { align-self: center; }
.signin-legal .btn-link { text-decoration: none; }
.lockup { display: flex; justify-content: center; align-items: center; gap: 10px; }
.lockup .word { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; line-height: 1; }
.lockup .word b { color: var(--primary); font-weight: 600; }

/* ---- the day strip ---- */
.strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--space-xs); }
.day {
  height: 72px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-xs);
  border-radius: var(--radius-lg); border: 1px solid transparent; color: var(--fg-1); transition: all 200ms ease;
}
.day.on { background: var(--primary-10); border-color: var(--primary); }
.day.before { color: var(--fg-disabled); cursor: default; }
.day.before .dn { color: var(--fg-disabled); }
.day .dn { font-weight: 600; line-height: 1; }
.g-empty { color: var(--fg-disabled); }
.g-started { color: var(--fg-1); }
.g-done { color: var(--primary); }
.g-on { color: var(--success); }
.g-partly { color: var(--warning); }
.g-off { color: var(--error); }
.skeleton { border-radius: var(--radius-xl); background: var(--surface-card); border: 1px solid var(--border); }
.pay-option { width: 100%; text-align: left; color: var(--fg-1); border: 1px solid var(--border); }
.pay-option.on { background: var(--primary-10); border-color: var(--primary); }
.pay-option.on .t-label-md { color: var(--primary); }
.pay-rows { margin: 0; display: flex; flex-direction: column; gap: var(--space-xs); }
.pay-rows dd { margin: 0; }
.locktile { width: 56px; height: 56px; border-radius: var(--radius-xl); display: flex; align-items: center; justify-content: center; background: var(--primary-10); color: var(--primary); }
.offline { color: var(--fg-1); }
.errtile { width: 48px; height: 48px; border-radius: var(--radius-xl); display: flex; align-items: center; justify-content: center; background: var(--error-10); color: var(--error); }

/* ---- summary and meals ---- */
.kcal-row { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--space-md); }
.kcal-row .col { gap: var(--space-sm); }
.kcal-row .right { align-items: flex-end; }
.figure { display: flex; align-items: baseline; gap: var(--space-xs); }
.macros { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-md); }
.macros > div { display: flex; flex-direction: column; gap: var(--space-sm); }
.guide { display: flex; gap: var(--space-sm); align-items: flex-start; color: var(--fg-2); }
.guide .icon { margin-top: 2px; }
.meals { display: flex; flex-direction: column; gap: var(--space-sm); }
.meal { padding: var(--space-md) var(--space-md) 0; gap: var(--space-md); }
.mealhead { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-sm); }
.choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-sm); }
.choices .chip { padding: 0 4px; }
.foot { margin: 0 calc(-1 * var(--space-md)); padding: 0 var(--space-sm); border-top: 1px solid var(--border); }
.foot > button { width: 100%; height: 48px; padding: 0 var(--space-sm); display: flex; align-items: center; justify-content: space-between; color: var(--fg-2); font-size: 14px; font-weight: 500; }
.contents { display: flex; flex-direction: column; gap: var(--space-md); padding-bottom: var(--space-md); margin-top: calc(-1 * var(--space-sm)); }
.item { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: var(--space-sm); }
.item.plan { grid-template-columns: 80px minmax(0, 1fr); }
.altchips { display: flex; flex-wrap: wrap; gap: var(--space-sm); padding-left: 96px; }
.whole { display: flex; flex-direction: column; gap: var(--space-sm); padding-top: var(--space-md); border-top: 1px solid var(--border); }
.whole .chip { margin-top: var(--space-sm); font-weight: 600; justify-content: center; }
.orinstead { display: flex; flex-direction: column; gap: var(--space-sm); padding: var(--space-md); border-radius: var(--radius-lg); background: var(--surface-raised); }
.marked { margin-top: var(--space-sm); display: flex; justify-content: center; align-items: center; gap: var(--space-sm); color: var(--fg-2); }
.marked.all { color: var(--fg-1); }
.noplan { flex-direction: row; align-items: flex-start; }
.noplan .icon { margin-top: 2px; color: var(--fg-2); }

/* ---- coffee, water, rating, note ---- */
.adds3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-sm); }
.adds3 .btn { padding: 0 4px; }
.waterform { display: flex; gap: var(--space-sm); align-items: center; }
.waterform .wrap { flex: 1; position: relative; }
.waterform .input { padding-right: 32px; }
.waterform .unit { position: absolute; right: 12px; top: 12px; color: var(--fg-2); }
.ratings { display: flex; flex-wrap: wrap; gap: var(--space-sm); }

/* ---- the tab bar ---- */
.tabbar { flex: none; background: var(--surface-elevated); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
.tabs { display: flex; max-width: 520px; margin: 0 auto; }
.tab { flex: 1; height: var(--tabbar-h); position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-xs); color: var(--fg-2); }
.tab.on { color: var(--primary); }
.tab.on .t-label-sm { color: var(--fg-1); }
.tab.on::before { content: ""; position: absolute; top: -1px; width: 32px; height: 2px; border-radius: var(--radius-full); background: var(--primary); }

/* ---- full-screen sheets: the calendar and Settings ---- */
.sheet { position: fixed; inset: 0; z-index: 20; background: var(--surface); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); }
.sheethead { flex: none; height: 56px; display: grid; align-items: center; gap: var(--space-xs); padding: 0 var(--space-sm); border-bottom: 1px solid var(--border); max-width: 520px; width: 100%; margin: 0 auto; }
.sheethead.cal { grid-template-columns: 44px minmax(0, 1fr) 44px 44px; }
.sheethead.back { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
.sheethead h2 { text-align: center; }
.sheetbody { flex: 1; min-height: 0; overflow-y: auto; padding: var(--space-md) var(--space-sm) calc(var(--space-lg) + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: var(--space-md); max-width: 520px; width: 100%; margin: 0 auto; }
.sheetbody.pad { padding-left: var(--space-md); padding-right: var(--space-md); }

/* ---- the month calendar ---- */
.cal-head { display: flex; color: var(--fg-2); }
.cal-head .names { flex: 1; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); text-align: center; }
.cal-head .wk { width: 60px; text-align: center; }
.cal-weeks { display: flex; flex-direction: column; gap: var(--space-xs); }
.cal-week { display: flex; align-items: center; }
.cal-days { flex: 1; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.cal-day { height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-xs); border-radius: var(--radius-lg); border: 1px solid transparent; color: var(--fg-1); }
.cal-day.dim { color: var(--fg-disabled); }
.cal-day.today { border-color: var(--primary); }
.cal-day.sel { background: var(--primary-10); }
.cal-day.sel:not(.today) { border-color: var(--primary-20); }
.cal-day:disabled { cursor: default; }
.cal-day .g { height: 16px; }
.cal-score { width: 60px; display: flex; flex-direction: column; align-items: center; gap: var(--space-xs); }
.cal-score .n { font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: var(--space-sm) var(--space-md); padding: 0 var(--space-sm); color: var(--fg-2); line-height: 1.4; }
.legend span { display: flex; align-items: center; gap: var(--space-xs); }
.cal-sum { margin: 0 var(--space-sm); }
.cal-meal { display: flex; flex-direction: column; gap: var(--space-xs); padding-bottom: var(--space-sm); border-bottom: 1px solid var(--border); }
.cal-meal .between { font-weight: 500; }
.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-sm); }
.three > div { display: flex; flex-direction: column; gap: var(--space-xs); }
.three .change { display: inline-flex; align-items: center; gap: 4px; }

/* ---- the Plan tab ---- */
.totals { display: flex; justify-content: space-between; gap: var(--space-sm); }
.totals > div { display: flex; flex-direction: column; gap: var(--space-xs); }
.pm-items { display: flex; flex-direction: column; gap: var(--space-sm); padding-top: var(--space-md); border-top: 1px solid var(--border); }
.earlier { overflow: hidden; padding: 0; gap: 0; }
.earlier > button { width: 100%; min-height: 64px; padding: 0 var(--space-md); display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); color: var(--fg-1); text-align: left; }
.earlier .body { padding: 0 var(--space-md) var(--space-md); display: flex; flex-direction: column; gap: var(--space-sm); }
.earlier .line { display: flex; justify-content: space-between; padding-top: var(--space-sm); border-top: 1px solid var(--border); }
.next { border-color: var(--primary-20); }

/* ---- Settings ---- */
.setrow { flex-direction: row; align-items: center; justify-content: space-between; }
.stepper { display: flex; align-items: center; gap: var(--space-xs); }
.stepper .btn-icon { background: var(--surface-raised); border: 1px solid var(--border); color: var(--fg-1); }
.stepper .val { min-width: 64px; text-align: center; }

/* ---- the empty Progress tab ---- */
.soon { color: var(--fg-2); }

/* ---- Progress: the weight trend and the weeks ---- */
.wrow { display: flex; align-items: center; gap: var(--space-md); }
.wleft { flex: none; gap: var(--space-sm); }
.wspark { flex: 1; min-width: 0; }
.spark { display: block; width: 100%; height: auto; }
.spark .line { fill: none; stroke: var(--primary); stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }
.spark .dot { fill: var(--surface-card); stroke: var(--primary); stroke-width: 1.75; }
.badge.change { align-self: flex-start; color: var(--fg-1); }
.axis { display: flex; justify-content: space-between; color: var(--fg-2); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: var(--space-xs); padding: var(--space-xs); border-radius: var(--radius-lg); background: var(--surface-raised); }
.seg > button { height: var(--control-h-touch); padding: 0 2px; border-radius: var(--radius-md); border: 1px solid transparent; color: var(--fg-2); font-size: 14px; font-weight: 600; transition: all 200ms ease; }
.seg > button.on { background: var(--surface-card); border-color: var(--border); color: var(--fg-1); }
.stepper .val.wide { min-width: 120px; }
.raterow { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); }
.unitwrap { position: relative; }
.unitwrap .unit { position: absolute; right: 12px; top: 12px; color: var(--fg-2); }
.goalkg { width: 128px; text-align: right; padding-right: 36px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; margin: var(--space-sm) calc(-1 * var(--space-lg)) calc(-1 * var(--space-lg)); border-top: 1px solid var(--border); }
.tile { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); padding: var(--space-md) var(--space-lg); min-width: 0; }
.tile + .tile { border-left: 1px solid var(--border); }
.tile .col { gap: var(--space-xs); min-width: 0; }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.swatch.primary { background: var(--primary); }
.swatch.secondary { background: var(--secondary); }
.arrow { width: 40px; height: 40px; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-full); background: var(--surface-raised); border: 1px solid var(--border); color: var(--fg-2); }
.arrow.tone-success { background: var(--success-10); border-color: var(--success-20); color: var(--success); }
.arrow.tone-warning { background: var(--warning-10); border-color: var(--warning-20); color: var(--warning); }

/* ---- progress photos ---- */
.thumbs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-sm); }
.tiles2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-sm); }
.thumb {
  aspect-ratio: 3 / 4; position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-xs);
  border-radius: var(--radius-md); background: var(--surface-raised); border: 1px solid var(--border); color: var(--fg-2);
}
.tiles2 .thumb { border-radius: var(--radius-xl); }
.thumb.empty { background: transparent; border-style: dashed; }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 8px; display: flex; flex-direction: column; gap: 2px; color: var(--fg-1); background: linear-gradient(to top, rgba(10, 10, 18, 0.85), rgba(10, 10, 18, 0)); }
.thumb.empty .cap { background: none; position: static; align-items: center; text-align: center; padding: 0 4px; }
.setbtn { width: 100%; text-align: left; align-items: stretch; color: var(--fg-1); }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-sm); }
.chips { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.chips button { height: var(--control-h-touch); padding: 0 8px; border-radius: var(--radius-md); border: 1px solid var(--border); color: var(--fg-2); font-size: 12px; font-weight: 500; }
.chips button.on { background: var(--primary-10); border-color: var(--primary-20); color: var(--primary); }

/* The capture, over everything */
.capture { z-index: 30; padding: env(safe-area-inset-top) var(--space-md) calc(var(--space-md) + env(safe-area-inset-bottom)); max-width: 520px; margin: 0 auto; width: 100%; }
.capture .head { flex: none; height: 56px; display: flex; align-items: center; justify-content: space-between; }
.segs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-xs); }
.segs span { height: 4px; border-radius: var(--radius-full); background: var(--surface-raised); }
.segs span.done { background: var(--primary); }
.segs span.now { background: var(--fg-1); }
.capbody { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--space-md); padding-top: 48px; overflow-y: auto; }
.capbody.review { padding-top: var(--space-md); }
.preview { flex: 1; min-height: 160px; border-radius: var(--radius-xl); background: var(--surface-raised); border: 1px solid var(--border); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.preview img { width: 100%; height: 100%; object-fit: contain; display: block; }
.capfoot { flex: none; display: flex; flex-direction: column; gap: var(--space-sm); padding-top: var(--space-md); }
.capfoot.two { flex-direction: row; display: grid; }
.weekdays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--space-xs); }
.weekdays .chip { padding: 0 2px; font-size: 13px; }
.seg > button .icon { margin-right: 4px; }
.seg > button { display: inline-flex; align-items: center; justify-content: center; }

/* ---- the reminder switch and the Home Screen hint ---- */
.switch { width: 52px; height: var(--control-h-touch); flex: none; position: relative; }
.switch .track { position: absolute; left: 0; right: 0; top: 6px; height: 32px; border-radius: var(--radius-full); background: var(--surface-raised); border: 1px solid var(--border); transition: all 200ms ease; }
.switch .knob { position: absolute; top: 10px; left: 4px; width: 24px; height: 24px; border-radius: var(--radius-full); background: var(--fg-2); transition: all 200ms ease; }
.switch.on .track { background: var(--primary-20); border-color: var(--primary); }
.switch.on .knob { left: 24px; background: var(--primary); }
.hintwrap { flex: none; padding: var(--space-sm) var(--space-md); max-width: 520px; width: 100%; margin: 0 auto; }
.hint { display: flex; gap: var(--space-md); align-items: flex-start; padding: var(--space-md); border-radius: var(--radius-xl); background: var(--surface-card); border: 1px solid var(--primary-20); }
.hinttile { width: 40px; height: 40px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-lg); background: var(--primary-10); color: var(--primary); }

/* ---- the weekly check-in ---- */
.weeknav { display: grid; grid-template-columns: var(--control-h-touch) minmax(0, 1fr) var(--control-h-touch); align-items: center; gap: var(--space-xs); }
.weeknav .col { align-items: center; gap: 2px; }
.wkrow { display: grid; grid-template-columns: 64px minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: var(--space-sm); min-height: var(--control-h-touch); }
.wkrow.head { min-height: 0; }
.wkrow.head > span + span, .wkrow .cellv { padding: 0 12px; }
.wkrow.today > .col > .t-label-md { color: var(--primary); }
.wkrow.sum { border-top: 1px solid var(--border); padding-top: var(--space-sm); }
.input.cell { width: 100%; min-width: 0; }
.scale { display: flex; flex-direction: column; gap: var(--space-sm); padding-top: var(--space-xs); }

/* ---- onboarding (onboard.js; design/onboarding/HANDOFF.md): full screen, no tab bar ---- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ob { height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.ob-body { max-width: 520px; min-height: 100%; margin: 0 auto; padding: 0 var(--space-lg); display: flex; flex-direction: column; gap: var(--space-lg); }
/* Back and the stepper stay in reach however far the screen scrolls; the bar covers the iPhone's status area. */
.ob-top { position: sticky; top: 0; z-index: 2; margin: 0 calc(-1 * var(--space-lg)); padding: calc(env(safe-area-inset-top) + var(--space-sm)) var(--space-lg) var(--space-sm); background: var(--surface); display: flex; flex-direction: column; gap: var(--space-sm); }
.ob-back { align-self: flex-start; color: var(--fg-2); font-size: 16px; padding-left: 0; }
.ob-head { display: flex; flex-direction: column; gap: var(--space-sm); }
.ob-head h1, .ob > .ob-body > h1 { outline: none; }
.ob-titlerow { align-items: flex-start; }
.ob-stepper { display: flex; flex-direction: column; }
.ob-stepbtn { display: flex; flex-direction: column; gap: var(--space-sm); min-height: var(--control-h-touch); justify-content: center; text-align: left; }
.ob-segs { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--space-xs); }
.ob-seg { height: 4px; border-radius: var(--radius-full); background: var(--border); overflow: hidden; }
.ob-seg > span { display: block; height: 100%; background: var(--primary); transition: width 200ms ease; }
.ob-steplabel { display: inline-flex; align-items: center; gap: var(--space-xs); line-height: 1.4; }
.ob-sheet { width: 100%; max-width: 520px; margin: auto auto 0; padding: var(--space-lg) var(--space-lg) var(--space-xl); border: 0; border-top: 1px solid var(--border); border-radius: var(--radius-xl) var(--radius-xl) 0 0; background: var(--surface-elevated); color: var(--fg-1); }
.ob-sheet::backdrop { background: rgba(0, 0, 0, 0.6); }
.ob-secs { list-style: none; padding: 0; margin: var(--space-md) 0 0; }
.ob-secs > li + li { border-top: 1px solid var(--border); }
.ob-secrow { width: 100%; min-height: 56px; display: flex; align-items: center; gap: var(--space-md); text-align: left; }
.ob-secname { flex: 1; font-size: 16px; }
.ob-badge { font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: var(--radius-full); color: var(--fg-2); }
.ob-badge.done { color: var(--success); background: var(--success-10); border: 1px solid var(--success-20); }
.ob-badge.cur { color: var(--primary); background: var(--primary-10); border: 1px solid var(--primary-20); }
.ob-group { display: flex; flex-direction: column; gap: var(--space-sm); }
.ob-group > h2 { margin-bottom: var(--space-xs); }
.ob-group > .ob-subhead { margin: var(--space-md) 0 0; }
.ob-group > .ob-subhead:first-child { margin-top: 0; }
.ob-opt { width: 100%; min-height: 56px; padding: var(--space-md); display: flex; align-items: center; gap: 12px; text-align: left; background: var(--surface-card); border: 1px solid var(--border); border-radius: var(--radius-lg); transition: all 200ms ease; }
.ob-opt.on { border-color: var(--primary); background: var(--primary-10); }
.ob-optlabel { font-size: 16px; font-weight: 500; }
.ob-ring { flex: none; width: 22px; height: 22px; border-radius: var(--radius-full); border: 2px solid var(--fg-2); display: inline-flex; align-items: center; justify-content: center; color: var(--primary); }
.ob-ring.square { width: 24px; height: 24px; border-radius: var(--radius-sm); }
.on > .ob-ring { border-color: var(--primary); background: var(--primary-10); }
.ob-check { width: 100%; min-height: var(--control-h-touch); display: flex; align-items: center; gap: 12px; text-align: left; }
.ob-consent { padding: var(--space-md); }
.ob-chips { display: flex; flex-wrap: wrap; gap: var(--space-sm); }
.ob-chip { height: var(--control-h-touch); padding: 0 var(--space-md); display: inline-flex; align-items: center; gap: var(--space-xs); border-radius: var(--radius-md); background: var(--surface-card); border: 1px solid var(--border); font-size: 16px; font-weight: 500; color: var(--fg-1); }
.ob-chip.on { border-color: var(--primary); background: var(--primary-10); }
.ob-chip.on .icon { color: var(--primary); }
.ob-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--space-xs); }
.ob-chip.square { height: var(--control-h-touch); padding: 0; justify-content: center; flex-direction: column; gap: 0; font-size: 13px; }
.ob-counter { flex-direction: row; align-items: center; justify-content: space-between; padding: var(--space-md); }
.ob-step { background: var(--surface-raised); border: 1px solid var(--border); }
.ob-count { min-width: 2.5ch; text-align: center; font-size: 18px; }
.ob-input { height: 52px; font-size: 17px; padding: 0 var(--space-md); }
.ob-unitwrap { position: relative; }
.ob-unitwrap > .ob-input { width: 100%; padding-right: 48px; }
.ob-unit { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 14px; color: var(--fg-2); pointer-events: none; }
.ob-err { color: var(--secondary); line-height: 1.4; }
.ob-dob { display: grid; grid-template-columns: 1fr 1.4fr 1.2fr; gap: var(--space-sm); }
.ob-imperial { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-sm); }
.ob-imperial > .field:last-child { grid-column: 1 / -1; }
.ob-small { height: var(--control-h-touch); padding: 0 12px; font-size: 13px; font-weight: 500; flex: none; }
.ob-foot { position: sticky; bottom: 0; margin-top: auto; padding: var(--space-md) 0 calc(var(--space-sm) + env(safe-area-inset-bottom)); background: var(--surface); display: flex; flex-direction: column; gap: var(--space-sm); }
.ob-foot .btn { height: 52px; font-size: 16px; }
.ob-legal { margin: 0; display: flex; justify-content: center; align-items: center; color: var(--fg-2); }
.ob-appicon { margin-top: var(--space-xl); border-radius: var(--radius-xl); border: 1px solid var(--border); }
.ob-tile { flex: none; width: 40px; height: 40px; border-radius: var(--radius-lg); background: var(--primary-10); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; }
.ob-tile.raised { background: var(--surface-raised); border: 1px solid var(--border); color: var(--fg-1); }
.ob-feat { gap: var(--space-md); }
.ob-banner { flex-direction: row; align-items: center; gap: 12px; padding: var(--space-md); color: var(--fg-2); }
.ob-banner .t-body-sm { color: var(--fg-1); }
.ob-review { padding: var(--space-md); gap: 0; }
.ob-review > h2 { margin-bottom: var(--space-xs); }
.ob-revrow { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: var(--space-sm) 0; border-top: 1px solid var(--border); }
.ob-revrow > .col { flex: 1; min-width: 0; gap: 2px; }
.ob-build { list-style: none; padding: 0; display: flex; flex-direction: column; gap: var(--space-md); }
.ob-buildring { flex: none; width: 28px; height: 28px; border-radius: var(--radius-full); border: 2px solid var(--border); display: inline-flex; align-items: center; justify-content: center; color: var(--primary); }
.ob-build .done .ob-buildring { border-color: var(--primary); background: var(--primary-10); }
.ob-build .now .ob-buildring { border-color: var(--primary); }
.ob-help { list-style: none; padding: 0; display: flex; flex-direction: column; gap: var(--space-sm); }
.ob-help > li { padding: var(--space-md); display: block; }
.ob-help a { color: var(--primary); }
.ob-switch { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: var(--radius-lg); background: var(--surface-raised); }
.ob-switch > button { height: 40px; border-radius: var(--radius-md); font-size: 14px; font-weight: 500; color: var(--fg-2); }
.ob-switch > button.on { background: var(--surface-card); box-shadow: inset 0 0 0 1px var(--border); color: var(--fg-1); }
.ob-kcal > .num { font-size: 36px; font-weight: 600; }
.ob-macros { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-sm); }
.ob-macro { display: flex; flex-direction: column; gap: var(--space-xs); padding: 12px; border-radius: var(--radius-lg); background: var(--surface-raised); }
.ob-macronum { font-size: 18px; }
.ob-how { width: 100%; min-height: var(--control-h-touch); }
.ob-howlist { padding-left: 20px; display: flex; flex-direction: column; gap: var(--space-xs); }
.ob-preview { flex-direction: row; align-items: center; gap: var(--space-md); padding: var(--space-md); }
.ob-preview img { border-radius: 14px; }
.ob-steps { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.ob-steps > li { gap: 12px; }

/* ---- Change My Plan (changeplan.js): one page over the app, Update My Plan always in reach ---- */
.cp-foot { flex: none; display: flex; flex-direction: column; gap: var(--space-sm); padding: var(--space-sm) var(--space-md) calc(var(--space-sm) + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); max-width: 520px; width: 100%; margin: 0 auto; }
.cp-select { position: relative; }
.cp-select > select { appearance: none; -webkit-appearance: none; padding-right: 40px; text-overflow: ellipsis; }
.cp-chev { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); display: flex; color: var(--fg-2); pointer-events: none; }
.cp-measures { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-sm); }
.cp-measure .input { padding-right: 40px; }
.cp-err { color: var(--secondary); }
.cp-kcal { font-size: 28px; font-weight: 600; line-height: 1.2; }

/* ---- the self-serve weekly check-in and its result (DEA-1530) ---- */
.wkrow.two { grid-template-columns: 64px minmax(0, 1fr); }
.wkrow .wk-span { grid-column: 2 / -1; padding: 0 12px; }
.wkrow .wk-aim { display: block; margin-top: 2px; white-space: nowrap; }
.wkrow .cellv { display: flex; flex-direction: column; }
.tone-text { color: var(--primary); display: inline-flex; }
.wk-arrow { border: 1px solid var(--border); border-radius: var(--radius-lg); }
.wk-stepper { flex: none; }
.wk-stepper .val { min-width: 40px; }
.wk-ans { gap: var(--space-md); }
.wk-ans > span:last-child { text-align: right; }
.wk-foot { position: sticky; bottom: 0; z-index: 2; margin: 0 calc(-1 * var(--space-md)); padding: 12px var(--space-md) var(--space-md); background: var(--surface); border-top: 1px solid var(--border); }
.wk-foot .btn, .wk-card .btn, .wk-proposal .btn, [data-sheet="week"] .btn { height: 52px; font-size: 16px; }
.wk-card, .wk-proposal { border-color: var(--primary-30); }
.wk-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-sm); }
.wk-tile { display: flex; flex-direction: column; gap: var(--space-xs); padding: 12px var(--space-md); border-radius: var(--radius-lg); background: var(--surface-card); border: 1px solid var(--border); min-width: 0; }
.wk-row { display: flex; flex-direction: column; gap: var(--space-sm); padding: 12px var(--space-md); border-radius: var(--radius-lg); background: var(--surface-raised); }
.wk-row .three .muted .t-label-sm { color: var(--fg-2); }
.wk-lines { display: flex; flex-direction: column; gap: var(--space-sm); padding: 0; margin: 0; list-style: none; }
.wk-lines a { color: var(--primary); }
.wk-tips { display: flex; flex-direction: column; gap: var(--space-xs); padding-left: 20px; margin: 0; }
.wk-said { padding-top: var(--space-md); border-top: 1px solid var(--border); }
#wk-reasons .stack-sm { margin: var(--space-md) 0; }
#wk-reasons .ob-opt { min-height: 52px; }
#wk-reasons .wk-mark { display: inline-flex; color: var(--primary); }
.wk-lines a.num { white-space: nowrap; }
.wk-row .three .t-mono-sm { white-space: nowrap; }
/* Why a change is suggested, on the result page (Abe, 28 Oct 2026). */
.wk-why { display: flex; flex-direction: column; gap: var(--space-xs); padding: 12px var(--space-md); border-radius: var(--radius-lg); background: var(--surface-raised); }
/* Progress (HANDOFF 2.5): the compact week cards and the Plan changes rows. */
.wk-week { gap: 12px; }
/* The first column is wider so "88% of meals" fits on one line on a phone. */
.wk-week .three { gap: 12px; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) minmax(0, 1fr); }
.wk-week .between { align-items: flex-start; }
.wk-week .between > .num { flex: none; white-space: nowrap; }
.wk-outcome { text-align: right; line-height: 1.3; }
.wk-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-sm); }
.wk-tile { display: flex; flex-direction: column; gap: var(--space-xs); padding: var(--space-sm) var(--space-md); border-radius: var(--radius-md); background: var(--surface-elevated); min-width: 0; }
.wk-aim { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-xs); border-top: 1px solid var(--border); padding-top: var(--space-md); }
.wk-aim .btn-ghost { padding: 0; }
.wk-change { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 12px; align-items: start; min-height: 44px; }
.wk-change > .num { padding-top: 2px; }
.wk-change .col { gap: 2px; }
/* A heading the page moves focus to (the result page's h1) needs no ring: it isn't a control. */
h1[tabindex="-1"]:focus { outline: none; }

/* The beta's 0 to 10 score under a week's result (result.js feedbackCard): eleven to a row. */
.seg.seg-11 { gap: 2px; }
.seg.seg-11 > button { padding: 0; font-size: 13px; }

/* The AI coach's reply in a week's result (result.js words): labelled as written by AI. */
.wk-ai { display: flex; flex-direction: column; gap: var(--space-xs); padding: 12px var(--space-md); border-left: 3px solid var(--primary); border-radius: var(--radius-md); background: var(--surface-raised); }
