/* T1Q — ported verbatim from personal Apex v3 (Amendment B1: same theme, same idioms). */
:root {
  --bg0: #070a0f;
  --bg1: #0b0f17;
  --surface: #10151f;
  --surface-2: #161c28;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --text: #eef2f8;
  --muted: #93a0b4;
  --faint: #5d6a82;
  --acc: #4fd1ff;
  --low: #ff5c6c;
  --urgent: #ff3b47;
  --inrange: #34d399;
  --high: #fbbf24;
  --vhigh: #fbbf24;  /* user rule: ONE high color — anything >180 is amber-orange; red belongs to LOWS only */
  --radius: 20px;
  --radius-sm: 13px;
  font-size: 16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body {
  margin: 0;
  background:
    radial-gradient(130% 70% at 50% -15%, rgba(79, 209, 255, 0.12) 0%, transparent 58%),
    linear-gradient(180deg, var(--bg1) 0%, var(--bg0) 40%) var(--bg0);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
.num { font-family: "SF Mono", ui-monospace, "JetBrains Mono", "Roboto Mono", monospace; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.app { max-width: 460px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 16px 0; }
.tabspacer { height: 86px; }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.brand { display: flex; align-items: center; gap: 9px; }
.brand .mark { width: 22px; height: 22px; }
.brand .word { font-weight: 700; letter-spacing: 0.32em; font-size: 13px; padding-left: 2px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); padding: 5px 10px; border-radius: 999px; white-space: nowrap; }
#freshChip { cursor: pointer; }
#freshChip.spinning .dot { animation: chipspin 0.8s linear infinite; }
@keyframes chipspin { from { transform: rotate(0deg) scale(1); } 50% { transform: rotate(180deg) scale(0.6); } to { transform: rotate(360deg) scale(1); } }
/* phone widths: the top bar carried five controls and wrapped the fresh chip onto two
   lines (owner's iPhone, 2026-09-18). Email and Sign out already live in Settings. */
@media (max-width: 520px) {
  #emailChip { display: none; }
  .topbar .signout span { display: none; }
  .topbar .signout { padding: 6px 9px; }
  .topright { gap: 7px; }
  .brand .word { letter-spacing: 0.22em; }
}
.chip.dim { color: var(--faint); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--inrange); box-shadow: 0 0 8px currentColor; }
.dot.stale { background: var(--high); }
.dot.gap { background: var(--high); animation: gappulse 1.6s ease-in-out infinite; }
@keyframes gappulse { 50% { opacity: .45; } }
#freshChip { cursor: pointer; -webkit-tap-highlight-color: transparent; }
#freshChip:active { transform: scale(0.96); }
.topright { display: flex; align-items: center; gap: 9px; }
.signout { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); font: inherit; font-size: 12px; padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.signout svg { width: 14px; height: 14px; }
.signout:active { transform: scale(0.96); }
.signout:hover { color: var(--text); border-color: var(--line-2); }

/* ---------- BG hero ---------- */
.hero { position: relative; background: linear-gradient(180deg, var(--surface) 0%, #0d121b 100%); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 6px; overflow: hidden; }
.hero-head { display: flex; align-items: flex-start; justify-content: space-between; position: relative; z-index: 2; }
.reading { display: flex; align-items: baseline; gap: 10px; }
.bgval { font-size: 72px; font-weight: 700; line-height: 0.9; }
.arrow { font-size: 34px; font-weight: 600; line-height: 1; }
.sub { font-size: 13px; color: var(--muted); margin-top: 6px; }
.sub .rate { color: var(--text); }
.headingto { font-size: 13px; color: var(--muted); margin-top: 4px; }
.headingto b { color: var(--text); font-weight: 600; }
.tier-pill { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; padding: 4px 9px; border-radius: 999px; white-space: nowrap; flex: none; }
.t-in-range .bgval, .t-in-range .arrow { color: var(--inrange); text-shadow: 0 0 26px rgba(52, 211, 153, 0.35); }
.t-low .bgval, .t-low .arrow { color: var(--low); text-shadow: 0 0 26px rgba(255, 92, 108, 0.4); }
.t-urgent-low .bgval, .t-urgent-low .arrow { color: var(--urgent); text-shadow: 0 0 30px rgba(255, 59, 71, 0.55); }
.t-high .bgval, .t-high .arrow { color: var(--high); text-shadow: 0 0 26px rgba(251, 191, 36, 0.35); }
.t-very-high .bgval, .t-very-high .arrow { color: var(--vhigh); text-shadow: 0 0 26px rgba(251, 191, 36, 0.35); }
.t-unknown .bgval { color: var(--muted); }
.t-in-range .tier-pill { color: var(--inrange); background: rgba(52, 211, 153, 0.12); }
.t-low .tier-pill, .t-urgent-low .tier-pill { color: var(--low); background: rgba(255, 92, 108, 0.14); }
.t-high .tier-pill, .t-very-high .tier-pill { color: var(--high); background: rgba(251, 191, 36, 0.14); }
.t-unknown .tier-pill { color: var(--muted); background: var(--surface-2); }

/* ---------- the chart: Apex trace vocabulary, ported verbatim ---------- */
.tracewrap { position: relative; }
.trace { display: block; width: 100%; height: auto; margin-top: 6px; touch-action: none; cursor: crosshair; }
#trace { touch-action: pan-y; }   /* one finger scrubs/scrolls; two fingers are ours */
.axislbl { fill: var(--faint); font-size: 14px; font-family: "SF Mono", ui-monospace, monospace; }
.thlbl { font-size: 12px; font-family: "SF Mono", ui-monospace, monospace; paint-order: stroke; stroke: var(--bg1); stroke-width: 3.5px; stroke-linejoin: round; font-weight: 600; }
.evlbl { font-size: 15px; font-family: "SF Mono", ui-monospace, monospace; }
.rangebar { display: flex; gap: 6px; justify-content: flex-end; align-items: center; margin-top: 4px; flex-wrap: nowrap; min-width: 0; }
.rangebar button { background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); font: inherit; font-size: 12px; padding: 4px 11px; border-radius: 999px; cursor: pointer; }
.rangebar button.active { color: var(--bg0); background: var(--acc); border-color: var(--acc); font-weight: 600; }
.rangebar .daynav { padding: 4px 9px; font-size: 13px; line-height: 1; }
/* Phone widths: the two day arrows are what Apex's bar doesn't have, so the same seven
   controls must fit in ~340px on one row — tighter pills, a narrower Today select, and
   a hard nowrap (a second row under the chart was the reported bug). */
@media (max-width: 520px) {
  .rangebar { gap: 4px; }
  .rangebar button { padding: 4px 8px; font-size: 11.5px; }
  .rangebar .daynav { padding: 4px 6px; }
  .rangebar .minisel { padding: 2px 15px 2px 5px; font-size: 11px; max-width: 86px; text-overflow: ellipsis; }
}
@media (max-width: 360px) {
  .rangebar .daynav { display: none; }   /* the select still reaches every day */
}
.minisel { background-color: var(--surface-2); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='12' viewBox='0 0 9 12' fill='none' stroke='%239aa4b2' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 4.3 4.5 2 7 4.3'/%3E%3Cpath d='M2 7.7 4.5 10 7 7.7'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 5px center; color: var(--text); border: 1px solid var(--line-2); border-radius: 8px; font: inherit; font-size: 11px; padding: 2px 18px 2px 6px; cursor: pointer; -webkit-appearance: none; appearance: none; }
.whendt { margin-top: 8px; width: 100%; background: var(--surface); border: 1px solid var(--acc); border-radius: var(--radius-sm); padding: 11px 12px; color: var(--text); font: inherit; font-size: 15px; color-scheme: dark; }
.daydt { margin-top: 0; width: auto; padding: 5px 9px; font-size: 12.5px; border-color: var(--line-2); }
.scrub { position: absolute; z-index: 6; transform: translateX(-50%); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 9px; padding: 6px 10px; font-size: 12.5px; pointer-events: none; white-space: nowrap; color: var(--text); box-shadow: 0 4px 16px rgba(0,0,0,0.4); }
.scrub b { font-weight: 600; } .scrub .tm { color: var(--muted); }
.zoomreset { position: absolute; top: 10px; right: 12px; z-index: 3; background: rgba(16,21,31,.85); border: 1px solid var(--line-2); color: var(--muted); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 12px; cursor: pointer; backdrop-filter: blur(4px); }
.chart-msg { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; padding: 0 24px; pointer-events: none; }
.ce-t { font-size: 15px; font-weight: 600; }
.ce-b { font-size: 12.5px; color: var(--muted); line-height: 1.5; }

/* ---------- status / CTA block (Apex .action) ---------- */
.action { margin-top: 12px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); padding: 15px 16px; }
.action .status { font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.action .cta { margin-top: 11px; display: flex; align-items: center; gap: 11px; font-size: 15.5px; font-weight: 600; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); }
.action .cta svg { width: 20px; height: 20px; flex: none; }
.k-urgent .status { color: var(--urgent); } .k-urgent .cta { background: rgba(255, 59, 71, 0.12); border-color: rgba(255, 59, 71, 0.35); color: #ffd9dc; }
.k-warn .status { color: var(--high); } .k-warn .cta { background: rgba(251, 191, 36, 0.1); border-color: rgba(251, 191, 36, 0.3); color: #ffe8b3; }
.k-ok .status { color: var(--inrange); } .k-ok .cta { background: rgba(52, 211, 153, 0.09); border-color: rgba(52, 211, 153, 0.26); color: #bff3df; }
.k-info .cta { background: var(--surface-2); color: var(--text); }

/* ---------- drivers ---------- */
.drivers-sum { font-size: 13.5px; color: var(--muted); margin: -2px 0 11px; line-height: 1.45; }
.drivers-sum b { color: var(--text); font-weight: 600; }
.drivers { display: flex; flex-direction: column; gap: 8px; }
.driver { display: flex; align-items: center; gap: 11px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 13px; }
.driver .ar { font-size: 17px; font-weight: 700; width: 16px; text-align: center; flex: none; }
.driver.up .ar { color: var(--high); } .driver.down .ar { color: var(--acc); }
.driver .dtxt { display: flex; flex-direction: column; gap: 2px; }
.driver .nm { font-size: 14.5px; font-weight: 500; }
.driver .det { font-size: 12px; color: var(--muted); line-height: 1.35; }

/* ---------- rings / stat cards / TIR gauge ---------- */
.ring { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 4px 9px; text-align: center; }
.ringwrap { position: relative; width: 100%; max-width: 62px; aspect-ratio: 1; margin: 0 auto; }
.ringwrap svg { width: 100%; height: 100%; display: block; }
.ringval { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 700; line-height: 1; pointer-events: none; }
.ringval small { font-size: 9.5px; font-weight: 600; margin-left: 1px; opacity: 0.8; }
.ringk { font-size: 10.5px; color: var(--faint); margin-top: 7px; letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.statcard { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; }
.statcard .statbig { font-size: clamp(16px, 5vw, 26px); font-weight: 700; color: var(--text); }
.gtir { display: flex; flex-direction: column; justify-content: center; }
.tircap { font-size: 11px; text-align: center; margin-top: 6px; min-height: 14px; font-weight: 500; }

/* ---------- body & activity (wearable) ---------- */
.bodyrow { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
/* tap-a-ring detail (2026-09-18): Recovery / Strain / Sleep cells are buttons that
   open one panel under the row; the open cell gets the accent outline */
.bodyrow .ring[role="button"] { cursor: pointer; -webkit-tap-highlight-color: transparent; transition: border-color 0.15s, background 0.15s; }
.bodyrow .ring[role="button"]:hover { border-color: var(--line-2); }
.bodyrow .ring[role="button"]:focus-visible { outline: 2px solid var(--acc); outline-offset: 1px; }
.bodyrow .ring.open { border-color: var(--acc); background: var(--surface-2); }
.body-detail { margin-top: 8px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 11px 13px 12px; overflow: hidden; }
.body-detail[hidden] { display: none; }
.bd-title { font-size: 12.5px; font-weight: 600; color: var(--muted); letter-spacing: 0.02em; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.bd-grid { display: grid; grid-template-columns: auto 1fr auto 1fr; column-gap: 12px; row-gap: 6px; align-items: baseline; }
.bd-k { font-size: 12px; color: var(--faint); white-space: nowrap; }
.bd-v { font-size: 13.5px; font-weight: 600; color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.bd-empty { font-size: 12.5px; color: var(--faint); }
@media (max-width: 430px) {
  /* phone: one label/value pair per row — two columns, no sideways scroll */
  .bd-grid { grid-template-columns: auto 1fr; column-gap: 10px; }
  .body-detail { padding: 10px 11px 11px; }
}
.actline { margin-top: 10px; font-size: 13.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.actline b { color: var(--text); font-weight: 600; }
.whoop-tgl { display: block; margin-top: 8px; background: none; border: 0; color: var(--faint); font: inherit; font-size: 12px; cursor: pointer; padding: 2px 0; }
.whoop-tgl:hover { color: var(--muted); }
.srctag { font-size: 10px; color: var(--muted); background: var(--surface-2); padding: 1px 6px; border-radius: 999px; font-weight: 500; letter-spacing: 0.02em; }

/* ---------- blocks / gauges / timeline ---------- */
.block { margin-top: 14px; }
.block-h { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); margin-bottom: 9px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; row-gap: 4px; }
.block-h .src { font-size: 10px; color: var(--muted); background: var(--surface-2); padding: 2px 7px; border-radius: 999px; letter-spacing: 0.04em; white-space: nowrap; }
.block-sub { font-size: 12.5px; color: var(--muted); margin: -4px 0 10px; line-height: 1.45; }
.gauges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.gauges.g2 { grid-template-columns: repeat(2, 1fr); }
.gauge { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; }
.gauge .lbl { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.gauge .val { font-size: 24px; font-weight: 700; margin-top: 5px; }
.gauge .val small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.gauge .cap { font-size: 10px; color: var(--faint); margin-top: 4px; }
.meals { display: flex; flex-direction: column; gap: 8px; }
.meal { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 13px; }
.meal .nm { font-size: 14px; font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meal .cb { font-size: 13px; color: var(--acc); font-weight: 600; flex: none; }
.meal .ag { font-size: 12px; color: var(--faint); flex: none; }
.emptybox { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 15px; font-size: 13.5px; color: var(--muted); line-height: 1.55; }
.emptybox b { color: var(--text); font-weight: 600; }

/* ---------- ask/info cards (v3 coachnudge + carbask look) ---------- */
.coachnudge { margin-top: 12px; background: var(--surface); border: 1px solid var(--line-2); border-left: 3px solid var(--acc); border-radius: var(--radius-sm); padding: 12px 14px; }
.cn-h { font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.cn-h small { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--faint); }
.cn-t { font-size: 14.5px; font-weight: 700; margin-top: 6px; }
.cn-b { font-size: 13px; color: var(--muted); line-height: 1.5; margin-top: 4px; }
.carbask { margin-top: 12px; background: var(--surface); border: 1px solid var(--line-2);
           border-left: 3px solid var(--acc); border-radius: var(--radius-sm); padding: 12px 15px; }
/* source-health cards ("Whoop hasn't sent data since…"): amber edge; compact —
   one bold line + Details + a × (44px tap target) that dismisses this outage */
.coachnudge.src-card { border-left-color: var(--high); position: relative; }
.src-card .cn-t { margin-top: 0; padding-right: 34px; }
.src-x { position: absolute; top: 0; right: 0; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
         background: none; border: 0; color: var(--faint); font: inherit; font-size: 22px; line-height: 1; cursor: pointer; border-radius: var(--radius-sm); }
.src-x:hover { color: var(--text); }
.src-x:active { transform: scale(0.94); }
.src-more { background: none; border: 0; padding: 6px 0; color: var(--acc); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.src-more:hover { text-decoration: underline; }
.src-card .cn-act { margin-top: 2px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.src-card .cn-b { margin-top: 2px; }
.cn-act { margin-top: 9px; }

/* ---------- footer note ---------- */
.foot { margin-top: 16px; font-size: 11.5px; color: var(--faint); display: flex; align-items: center; gap: 7px; line-height: 1.4; }
.foot svg { width: 13px; height: 13px; flex: none; }

/* ---------- bottom tab bar ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around; background: rgba(10, 13, 19, 0.92); backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding: 8px 6px calc(8px + env(safe-area-inset-bottom)); z-index: 40; }
.tab { background: none; border: 0; color: var(--faint); display: flex; flex-direction: column; align-items: center; gap: 3px; font: inherit; font-size: 10.5px; cursor: pointer; padding: 4px 6px; }
.tab svg { width: 22px; height: 22px; }
.tab.active { color: var(--acc); }

/* ---------- coming-soon empty views ---------- */
.soon { margin-top: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 46px 22px; text-align: center; }
.soon-ic { font-size: 30px; opacity: 0.85; }
.soon-t { font-size: 17px; font-weight: 700; margin-top: 10px; }
.soon-b { font-size: 13.5px; color: var(--muted); line-height: 1.55; margin-top: 6px; }
.soon-tag { display: inline-block; margin-top: 14px; font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--acc); background: rgba(79, 209, 255, 0.12); border: 1px solid rgba(79, 209, 255, 0.3); padding: 4px 11px; border-radius: 999px; }

/* ---------- fields & buttons (v3 sheet idioms) ---------- */
.field { margin-top: 11px; }
.field label { display: block; font-size: 11px; color: var(--faint); margin-bottom: 5px; letter-spacing: 0.04em; }
.field input { width: 100%; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 12px 13px; color: var(--text); font: inherit; font-size: 15px; }
.field input:focus { outline: none; border-color: var(--acc); }
.primary { width: 100%; margin-top: 14px; background: var(--inrange); color: #04261a; border: 0; border-radius: var(--radius-sm); padding: 15px; font: inherit; font-size: 16px; font-weight: 700; cursor: pointer; }
.primary:active { transform: scale(0.99); }
.primary:disabled { opacity: 0.55; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 100px; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text); padding: 11px 18px; border-radius: 999px; font-size: 14px; z-index: 80; opacity: 0; transition: opacity 0.25s, transform 0.25s; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-6px); }

/* ---------- auth view ---------- */
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: max(24px, env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom)); }
.auth-brand { display: flex; align-items: center; gap: 11px; }
.auth-brand svg { width: 34px; height: 34px; }
.auth-brand span { font-weight: 700; letter-spacing: 0.34em; font-size: 22px; padding-left: 4px; }
.auth-sub { font-size: 13px; color: var(--muted); margin-top: 9px; }
.auth-card { width: 100%; max-width: 380px; margin-top: 26px; background: linear-gradient(180deg, var(--surface) 0%, #0d121b 100%); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 18px 18px; }
.auth-code-sub { font-size: 13px; color: var(--muted); line-height: 1.5; }
.auth-code-sub b { color: var(--text); font-weight: 600; }
.codeinput { font-family: "SF Mono", ui-monospace, "JetBrains Mono", monospace; font-size: 24px !important; letter-spacing: 0.35em; text-align: center; font-variant-numeric: tabular-nums; }
.devhint { margin-top: 10px; font-size: 11.5px; color: var(--faint); text-align: center; font-family: "SF Mono", ui-monospace, monospace; }
.authnote { font-size: 12.5px; color: var(--muted); margin-top: 10px; text-align: center; min-height: 16px; }
.authnote.err { color: var(--low); }
.authnote.ok { color: var(--inrange); }
.linkbtn { display: block; width: 100%; margin-top: 12px; background: none; border: 0; color: var(--faint); font: inherit; font-size: 12.5px; cursor: pointer; text-align: center; }
.linkbtn:hover { color: var(--muted); }
.linkrow { display: flex; justify-content: center; gap: 24px; margin-top: 14px; }
.linkrow .linkbtn { display: inline-block; width: auto; margin-top: 0; }
.auth-foot { margin-top: 22px; font-size: 11.5px; color: var(--faint); display: flex; align-items: center; gap: 7px; line-height: 1.4; }
.auth-foot svg { width: 13px; height: 13px; flex: none; }

/* ---------- devices / connections ---------- */
.conns { display: flex; flex-direction: column; gap: 10px; }
.conncard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 13px 14px 14px; }
.conn-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.conn-main { min-width: 0; }
.conn-t { font-size: 14.5px; font-weight: 600; }
.conn-fresh { font-size: 12px; color: var(--faint); margin-top: 3px; }
.statpill { font-size: 10.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; padding: 4px 9px; border-radius: 999px; white-space: nowrap; flex: none; }
.st-ok { color: var(--inrange); background: rgba(52, 211, 153, 0.12); }
.st-sync { color: var(--acc); background: rgba(79, 209, 255, 0.12); }
.st-warn { color: var(--high); background: rgba(251, 191, 36, 0.14); }
.st-bad { color: var(--low); background: rgba(255, 92, 108, 0.14); }
.st-off { color: var(--muted); background: var(--surface-2); }
.conn-err { margin-top: 9px; font-size: 12.5px; color: var(--low); line-height: 1.45; word-break: break-word; }
.conn-actions { display: flex; gap: 8px; margin-top: 11px; flex-wrap: wrap; }
.btn-mini { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 600; padding: 7px 13px; border-radius: 999px; cursor: pointer; }
.btn-mini:hover { color: var(--text); }
.btn-mini:active { transform: scale(0.97); }
.btn-mini:disabled { opacity: 0.55; }
.btn-mini.acc { color: var(--acc); border-color: rgba(79, 209, 255, 0.35); background: rgba(79, 209, 255, 0.08); }
.btn-mini.danger { color: var(--low); border-color: rgba(255, 92, 108, 0.3); background: rgba(255, 92, 108, 0.07); }
.btn-mini.danger.armed { color: #fff; background: var(--low); border-color: var(--low); }
.conn-form { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 2px; }
.conn-formerr { text-align: left; min-height: 0; }
.field select { width: 100%; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 12px 13px; color: var(--text); font: inherit; font-size: 15px; appearance: none; -webkit-appearance: none; }
.field select:focus { outline: none; border-color: var(--acc); }
.primary.slim { padding: 12px; font-size: 14.5px; }

/* ---------- settings ---------- */
.setcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 15px 15px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.set-lbl { font-size: 13px; color: var(--muted); flex: none; }
.set-val { font-size: 13.5px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-divider { height: 1px; background: var(--line); margin: 14px -15px 13px; }
.set-sub { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.signout.wide { width: 100%; justify-content: center; margin-top: 14px; padding: 12px; font-size: 14px; border-radius: var(--radius-sm); }
.set-more { margin-top: 14px; margin-bottom: 6px; font-size: 12px; color: var(--faint); text-align: center; }

.loading .hero, .loading .action { opacity: 0.6; }
.recent-side { display: none; }   /* desktop-only side column */

/* ---- desktop: Apex's left sidebar (ported verbatim from v3 @880px) ---- */
.sidebar { display: none; }
@media (min-width: 880px) {
  .tabbar { display: none; }
  .tabspacer { display: none; }
  .sidebar {
    display: flex; flex-direction: column; gap: 3px;
    position: fixed; left: 0; top: 0; bottom: 0; width: 212px;
    background: rgba(9, 12, 18, 0.7); border-right: 1px solid var(--line); padding: 22px 14px; z-index: 30;
  }
  .sb-brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 20px; }
  .sb-brand svg { width: 24px; height: 24px; }
  .sb-brand span { font-weight: 700; letter-spacing: 0.3em; font-size: 14px; }
  .snav { display: flex; align-items: center; gap: 12px; background: none; border: 0; color: var(--muted);
    font: inherit; font-size: 15px; padding: 11px 13px; border-radius: var(--radius-sm); cursor: pointer; text-align: left; }
  .snav svg { width: 21px; height: 21px; }
  .snav:hover { background: var(--surface); color: var(--text); }
  .snav.active { background: rgba(79, 209, 255, 0.14); color: var(--acc); }
  .app { margin-left: 212px; max-width: 1020px; padding: 26px 30px 40px; }
  /* main column + a recent-activity side column (Apex desktop grid) */
  #homeView { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }
  #homeMain { grid-column: 1; min-width: 0; }
  #recentSide { grid-column: 2; }
  .recent-side { display: flex; flex-direction: column; gap: 14px; }
  #mealsBlock { display: none !important; }
  .mobonly { display: none !important; }
  .bgval { font-size: 84px; }
  .topbar .brand { display: none; }
}

/* ---------- detail sheets (Apex v3 bottom sheet, ported verbatim; same
   presentation on desktop — centered at max-width like Apex) ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; display: none; }
.sheet-wrap.open { display: block; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-width: 460px; margin: 0 auto; background: var(--bg1); border-top-left-radius: 22px; border-top-right-radius: 22px; border: 1px solid var(--line); padding: 10px 16px calc(20px + env(safe-area-inset-bottom)); max-height: 88vh; overflow-y: auto; }
.sheet-grab { width: 38px; height: 4px; border-radius: 2px; background: var(--line-2); margin: 4px auto 12px; }
.sheet-h { display: flex; align-items: center; justify-content: space-between; font-size: 18px; font-weight: 600; margin-bottom: 14px; }
.sheet-h .x { background: var(--surface-2); border: 0; color: var(--muted); width: 30px; height: 30px; border-radius: 50%; font-size: 14px; cursor: pointer; }
.sheet-sub { font-size: 13px; color: var(--muted); margin: -2px 0 12px; line-height: 1.4; }
.sheet-note { font-size: 12.5px; color: var(--muted); margin-top: 10px; text-align: center; min-height: 16px; }
.wk-bgline { font-size: 14.5px; color: var(--text); margin-top: 8px; }
.wk-bgline b { font-size: 16px; }
#wkSpark { margin-top: 10px; }
#wkStats:empty, #mealStats:empty { display: none; margin: 0; }
/* the "how it actually went" block (v3 .mi-* idiom) */
.mi-h { font-size: 12.5px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.mi-h small { display: block; font-weight: 400; font-size: 10.5px; color: var(--faint); margin-top: 2px; }
.mi-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mi-chip { background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px; font-size: 11.5px; color: var(--muted); }
.mi-chip b { color: var(--text); }
/* tappable rows open detail sheets */
/* Food tab · "How foods hit YOUR glucose": tap to open — full name wraps, detail line shows */
.meal.impactrow { cursor: pointer; flex-wrap: wrap; transition: border-color .12s ease, background .12s ease; }
.meal.impactrow .chev { color: var(--faint); font-size: 16px; line-height: 1; flex: none; transition: transform .15s ease; }
.meal.impactrow.open .chev { transform: rotate(90deg); }
.meal.impactrow.open { border-color: var(--line-2); }
.meal.impactrow.open .nm { white-space: normal; }
.meal.impactrow .impact-d { display: none; flex-basis: 100%; font-size: 12.5px; color: var(--muted); line-height: 1.5; padding-top: 6px; border-top: 1px solid var(--line); margin-top: 4px; }
.meal.impactrow.open .impact-d { display: block; }
.tapwk, .tapmeal { cursor: pointer; }
.tapwk:active, .tapmeal:active { transform: scale(0.99); }

/* ---------- coach chat (Apex v3 .chat idiom, ported verbatim; no photo /
   mic / search styles — those features didn't port this round) ---------- */
.coach-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.clearbtn { background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); font: inherit; font-size: 12.5px; padding: 7px 14px; border-radius: 999px; cursor: pointer; margin-top: 14px; }
.clearbtn:hover { color: var(--text); border-color: var(--line-2); }
.chat { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.chat-log { display: flex; flex-direction: column; gap: 10px; min-height: 180px; }
.msg { max-width: 88%; padding: 11px 14px; border-radius: 16px; font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: var(--acc); color: #04222e; font-weight: 500; border-bottom-right-radius: 5px; }
.msg.bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.msg.think { color: var(--muted); }
.msg.rest { border-color: rgba(251, 191, 36, 0.35); color: var(--muted); }   /* budget wall / friendly errors */
.cquick { display: flex; flex-wrap: wrap; gap: 7px; }
.cquick button { background: var(--surface); border: 1px solid var(--line); color: var(--muted); font: inherit; font-size: 12.5px; padding: 7px 11px; border-radius: 999px; cursor: pointer; }
.cquick button:hover { border-color: var(--acc); color: var(--text); }
.chat-input { display: flex; gap: 8px; align-items: center; min-width: 0; }
.chat-input > input { min-width: 0; }
.chat-input > button:last-child { flex: none; }
.chat-input input { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--line-2); border-radius: 999px; padding: 12px 16px; color: var(--text); font: inherit; font-size: 15px; }
.chat-input input:focus { outline: none; border-color: var(--acc); }
.chat-input button { background: var(--acc); color: #04222e; border: 0; border-radius: 999px; padding: 0 18px; font: inherit; font-weight: 700; cursor: pointer; }

/* ---------- trends (Apex v3 idiom, ported verbatim minus .scorecard) ---------- */
.trends-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.tirstack { display: flex; height: 26px; border-radius: 7px; overflow: hidden; border: 1px solid var(--line); }
.tirstack > span { display: block; }
.tirlegend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 9px; font-size: 12px; color: var(--muted); }
.tirlegend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.agp { width: 100%; height: auto; display: block; touch-action: none; cursor: crosshair; }
.agp-wrap { position: relative; }
/* low rows tap through to the wkWrap sheet */
.meal.taplow { cursor: pointer; transition: border-color .12s ease, background .12s ease; }
.meal.taplow:hover { border-color: var(--line-2); background: var(--surface-2); }
.meal.taplow:active { border-color: var(--acc); }
/* pattern-highlight rows (reuse .meal chrome; text wraps, never truncates) */
.patrow { cursor: default; align-items: flex-start; }
.patrow .pi { font-size: 16px; flex: none; line-height: 1.3; }
.patrow .pt { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); line-height: 1.45; white-space: normal; }
.patrow .pt b { color: var(--text); font-weight: 600; }

/* topbar gear (Settings lives behind it, like Apex — not a nav tab) */
.gearbtn { background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted); cursor: pointer; padding: 0; }
.gearbtn svg { width: 18px; height: 18px; }
.gearbtn:hover { color: var(--text); border-color: var(--line-2); }

/* ==================================================================
   ACTIVITY / FOOD / INSIGHTS — Apex v3 classes, ported verbatim
   (same owner; no runtime imports). Sections keep v3's names so the
   ported view builders drop in unchanged.
   ================================================================== */

/* ---- big "log a …" buttons (Food + workout control) ---- */
.logmeal { width: 100%; margin-top: 12px; display: flex; align-items: center; gap: 12px; background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 14px 16px; color: var(--text); font: inherit; cursor: pointer; }
.logmeal:active { transform: scale(0.99); }
.logmeal svg { width: 24px; height: 24px; color: var(--acc); flex: none; }
.logmeal span { font-size: 16px; font-weight: 600; }
.logmeal em { margin-left: auto; font-style: normal; font-size: 12px; color: var(--faint); }

/* ---- range / metric chips (Insights + Food windows) ---- */
.ins-range { display: flex; gap: 7px; margin-bottom: 4px; flex-wrap: wrap; }
.rgc, .mtc { background: var(--surface); border: 1px solid var(--line); color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 13px; border-radius: 999px; cursor: pointer; }
.rgc.on, .mtc.on { background: rgba(79, 209, 255, 0.14); border-color: var(--acc); color: var(--acc); }
.ins-metric { display: flex; gap: 7px; margin-bottom: 8px; }
.catn { font-size: 11px; color: var(--faint); margin-top: 4px; }

/* ---- today's macros row (Food tab + Home body block second row) ---- */
.macros-today { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.macros-today.m5 { grid-template-columns: repeat(5, 1fr); gap: 7px; }
.macros-today .mt { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 8px; text-align: center; }
.macros-today.m5 .mt { background: var(--surface-2); }
.macros-today .mt-v { font-size: 19px; font-weight: 700; color: var(--text); }
.macros-today .mt-v small { font-size: 12px; font-weight: 600; color: var(--muted); }
.macros-today .mt-l { font-size: 10.5px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--faint); margin-top: 3px; }

/* ---- meal list cues ---- */
.tagcue { font-size: 11px; color: var(--acc); font-weight: 600; opacity: 0.8; margin-left: 2px; }
.photochip { font-size: 11px; opacity: 0.85; margin-left: 1px; cursor: pointer; }
.photochip:hover { opacity: 1; }

/* ---- log-a-meal composer ---- */
.photo-row { display: flex; gap: 9px; margin-top: 4px; }
.photo-btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 9px; background: var(--acc); color: #04222e; font-weight: 700; border-radius: var(--radius-sm); padding: 14px; cursor: pointer; font-size: 14.5px; }
.photo-btn.alt { background: var(--surface-2); color: var(--text); border: 1px solid var(--line-2); }
.photo-btn svg { width: 21px; height: 21px; }
.photo-strip { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 10px; }
.photo-strip .pthumb { position: relative; }
.photo-strip .pthumb img { width: 76px; height: 76px; object-fit: cover; border-radius: var(--radius-sm); display: block; border: 1px solid var(--line-2); cursor: zoom-in; }
.photo-strip .pdel { position: absolute; top: -7px; right: -7px; width: 21px; height: 21px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); font-size: 11px; line-height: 1; padding: 0; cursor: pointer; }
.photo-strip.view .pthumb img { width: 92px; height: 92px; }
.reana { align-self: center; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--acc); font-size: 16px; cursor: pointer; }
.reana:active { transform: rotate(180deg); transition: transform .25s; }
/* "Restored your unlogged meal…" — the reload-survival line at the top of the composer */
.restore-note { font-size: 12.5px; color: var(--acc); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px; margin: -4px 0 12px; line-height: 1.45; }
.dishmatch { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding: 10px 12px; border: 1px dashed var(--line-2); border-radius: var(--radius-sm); font-size: 13.5px; color: var(--muted); }
.dishmatch b { color: var(--text); }
.dishmatch button { flex-shrink: 0; }
.dm-btns { display: flex; gap: 7px; flex-shrink: 0; }
.vis-items { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.vis-item { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px; font-size: 12px; color: var(--text); cursor: pointer; }
.vis-item small { color: var(--faint); }
.vis-item b { color: var(--acc); }
.vis-item.off { opacity: 0.4; text-decoration: line-through; }
.vis-learn { margin-top: 7px; font-size: 11.5px; color: var(--faint); }
.portionrow { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 8px; }
.two { display: flex; gap: 9px; }
.two .half { flex: 2; } .two .qtr { flex: 1; } .two .third { flex: 1; }
.field label small { text-transform: none; letter-spacing: 0; }
.results { max-height: 200px; overflow-y: auto; margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.results .r { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; cursor: pointer; }
.results .r:active { border-color: var(--acc); }
.results .r .rn { font-size: 13.5px; }
.results .r .rm { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.gihint { font-size: 12.5px; color: var(--muted); margin-top: 8px; min-height: 0; }
.addfood { width: 100%; margin-top: 8px; background: transparent; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 10px; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.addfood:active { transform: scale(0.99); }
.mealitems { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.mealitems:empty { margin-top: 0; }
.fitem { display: inline-flex; align-items: center; gap: 7px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 6px 11px; font-size: 13px; }
.fitem .fx { cursor: pointer; color: var(--muted); font-weight: 700; padding: 0 2px; }
.fitem .fx:hover { color: var(--low); }
.fitem-total { flex-basis: 100%; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
/* ---- log-a-bolus sheet: units stepper + kind chips ---- */
.bolus-row { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.bolus-step { width: 46px; height: 46px; flex: none; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text); font: inherit; font-size: 22px; line-height: 1; cursor: pointer; }
.bolus-step:active { transform: scale(0.94); border-color: var(--acc); }
.bolus-row input { flex: 1; min-width: 0; text-align: center; font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 10px 8px; color: var(--text); font-family: inherit; }
.bolus-row input:focus { outline: none; border-color: var(--acc); }
.bolus-u { color: var(--muted); font-weight: 600; }
.bolus-kind.active { border-color: var(--acc); color: var(--acc); border-style: solid; background: rgba(79, 209, 255, 0.08); }

.treatrow { display: flex; align-items: center; gap: 7px; margin-top: 12px; flex-wrap: wrap; }
.treat-l { font-size: 12.5px; color: var(--muted); margin-right: 2px; }
.treatchip { background: var(--surface); border: 1px solid var(--low); color: var(--low); border-radius: 999px; padding: 7px 14px; font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; }
.treatchip:active { transform: scale(0.97); }
.treatchip:disabled { opacity: 0.5; }
.whenchip { background: var(--surface); border: 1px solid var(--line-2); color: var(--muted); border-radius: 999px; padding: 6px 11px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.whenchip.on { border-color: var(--acc); color: var(--acc); }
.whenchip:active { transform: scale(0.97); }
.meal-advice { margin-top: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 13px; }
.ma-h { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin-bottom: 7px; }
.ma-b { display: flex; gap: 8px; font-size: 12.5px; color: var(--muted); line-height: 1.5; margin-top: 5px; }
.ma-b b { color: var(--text); }
.meal-analyze { margin-top: 12px; }
.meal-analyze:empty { margin-top: 0; }
.meal-risk { margin-top: 8px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.meal-risk small { color: var(--faint); }
.meal-score { display: flex; align-items: center; gap: 9px; margin-top: 10px; cursor: pointer; }
.ms-pill { border: 1.5px solid; border-radius: 999px; padding: 3px 11px; font-size: 14px; }
.ms-pill b { font-size: 16px; }
.ms-sub { font-size: 12px; color: var(--muted); }
.ms-car { color: var(--faint); font-size: 11px; margin-left: auto; }
.ms-facts { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.ms-f { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.ms-f b { color: var(--text); }
.ms-d { display: inline-block; min-width: 24px; font-weight: 700; }
.mi-sug { margin-top: 7px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.mi-chip.best { border-color: var(--acc); color: var(--acc); }
.intent-ask { position: fixed; left: 12px; right: 12px; bottom: 74px; z-index: 90; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 9px; font-size: 13.5px; box-shadow: 0 12px 34px rgba(0,0,0,.45); max-width: 460px; margin: 0 auto; }
.ia-btns { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ia-x { margin-left: auto; background: none; border: none; color: var(--faint); font-size: 13px; cursor: pointer; }
.lightbox { position: fixed; inset: 0; z-index: 95; background: rgba(0,0,0,.82); display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.lightbox img { max-width: 94vw; max-height: 90vh; border-radius: 12px; }

/* ---- meals-by-size (shared Food + Insights renderer) ---- */
.mbs-list { display: flex; flex-direction: column; gap: 8px; }
.mbs-row .meal { margin: 0; }
.mbs-dp { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 4px 2px 12px; }
.mbs-cell { font-size: 11.5px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px; }
.mbs-cell small { color: var(--faint); margin-left: 3px; }
.mbs-stats { display: flex; flex-wrap: wrap; gap: 12px; padding: 4px 4px 2px 12px; }
.mbs-stat { font-size: 12px; color: var(--muted); }
.mbs-act { margin-top: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 7px; }
.mbs-act-h { font-size: 12.5px; color: var(--muted); font-weight: 600; }

/* ---- what-moves cards (Insights + body↔glucose) ---- */
.wm-list { display: flex; flex-direction: column; gap: 10px; }
.wm-card { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--acc); border-radius: var(--radius-sm); padding: 13px 14px; }
.wm-head { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.wm-ic { font-size: 17px; }
.wm-stat { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.wm-stat small { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: 0; font-family: inherit; }
.wm-title { font-weight: 700; font-size: 14.5px; color: var(--text); margin-left: auto; text-align: right; }
.wm-more { font-size: 11px; color: var(--acc); }
.wm-jump { cursor: pointer; }
.wm-text { margin-top: 7px; font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.wm-hours { display: flex; align-items: flex-end; gap: 2px; margin-top: 10px; height: 44px; }
.wm-hr { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.wm-hr i { width: 100%; max-width: 8px; border-radius: 2px; display: block; }
.wm-hr em { font-style: normal; font-size: 8px; color: var(--faint); height: 10px; margin-top: 2px; }
.wm-pair { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.wm-pr { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.wm-pr .l { flex: 0 0 84px; color: var(--muted); }
.wm-pr .track { flex: 1; height: 8px; background: rgba(255,255,255,.04); border-radius: 4px; overflow: hidden; }
.wm-pr .track i { display: block; height: 100%; border-radius: 4px; }
.wm-pr .v { flex: 0 0 auto; font-weight: 700; color: var(--text); }
.wm-bars { display: flex; align-items: flex-end; gap: 8px; margin-top: 10px; height: 52px; }
.wm-bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.wm-bar i { width: 100%; max-width: 26px; border-radius: 3px 3px 0 0; display: block; }
.wm-bar em { font-style: normal; font-size: 9px; color: var(--faint); margin-top: 3px; white-space: nowrap; }
.wm-why { margin-top: 9px; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.wm-why b { color: var(--faint); font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; margin-right: 4px; }
.wm-tip { margin-top: 5px; font-size: 12.5px; color: var(--text); line-height: 1.45; }
.wm-tip b { color: var(--acc); font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; margin-right: 4px; }

/* ---- by-hour bars / activity sparkline / scenarios ---- */
.ins-hours { display: flex; align-items: flex-end; gap: 2px; height: 84px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 8px 4px; }
.ihr { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 2px; height: 100%; }
.ihr-val { font-size: 8.5px; color: var(--muted); line-height: 1; }
.ihr-bar { width: 100%; max-width: 9px; border-radius: 2px; }
.ihr-h { font-size: 8.5px; color: var(--faint); height: 10px; }
.sparkline { width: 100%; height: 130px; display: block; }
.axl { font-size: 9px; fill: var(--muted); }
.spark-cap { font-size: 11px; color: var(--faint); text-align: center; margin-top: 2px; }
.insact { cursor: pointer; }
.insact .ihow { font-size: 12px; flex: none; }
.insact .chev { color: var(--faint); font-size: 16px; flex: none; transition: transform .15s; }
.insact.open .chev { transform: rotate(90deg); }
.insact-detail { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px 6px; }
.scen-list { display: flex; flex-direction: column; gap: 10px; }
.scen { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 13px; }
.scen-l { font-size: 12.5px; font-weight: 600; margin-bottom: 8px; }
.scen-g { display: flex; align-items: center; gap: 9px; padding: 3px 0; }
.sg-n { font-size: 12.5px; color: var(--muted); width: 92px; flex: none; }
.sg-bar { flex: 1; height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.sg-bar i { display: block; height: 100%; border-radius: 999px; }
.sg-v { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; width: 76px; text-align: right; flex: none; }
.sg-v small { color: var(--faint); font-weight: 500; font-size: 10.5px; }

/* ---- debrief + hypo post-mortem cards ---- */
.debrief-list { display: flex; flex-direction: column; gap: 0; }
.db-card { cursor: pointer; }
.db-scope { font-weight: 400; color: var(--faint); font-size: 11px; text-transform: none; letter-spacing: 0; margin-left: auto; }
.hypo-pm { cursor: pointer; position: relative; padding-right: 34px; }
.hypo-pm .hp-line { font-weight: 400; color: var(--faint); font-size: 12px; text-transform: none; letter-spacing: 0; }
.hp-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; align-items: center; }
.hp-chip { font-size: 11.5px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--text); background: var(--surface); }
.hp-more { font-size: 11px; color: var(--acc); margin-left: 2px; }
.hp-detail { margin-top: 6px; }
.hypo-pm .hp-x { position: absolute; top: 8px; right: 8px; width: 21px; height: 21px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); font-size: 11px; line-height: 1; padding: 0; cursor: pointer; }

/* ---- workout control (manual sessions) ---- */
.wk-live { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--inrange); border-radius: var(--radius-sm); padding: 12px 14px; margin-top: 14px; }
.wk-live-sport { cursor: pointer; }
.wk-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--inrange); box-shadow: 0 0 10px currentColor; }
.wk-el { color: var(--muted); font-variant-numeric: tabular-nums; }
.wk-plan { color: var(--faint); font-size: 11px; }
.wk-stop { margin-left: auto; background: rgba(255,92,108,.14); border: 1px solid var(--low); color: var(--low); border-radius: 999px; padding: 7px 16px; font: inherit; font-weight: 700; cursor: pointer; }
.wk-start { display: flex; align-items: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.wk-body .wk-start { margin-top: 10px; }
.wk-go { background: rgba(52,211,153,.14); border: 1px solid var(--inrange); color: var(--inrange); border-radius: 999px; padding: 8px 15px; font: inherit; font-weight: 700; cursor: pointer; }
.wk-past { background: transparent; border: 1px dashed var(--line-2); color: var(--muted); border-radius: 999px; padding: 8px 13px; font: inherit; font-size: 13px; cursor: pointer; }
.wk-planrow { margin-top: 6px; font-size: 12px; color: var(--faint); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.wk-planrow .whendt { margin-top: 0; padding: 5px 8px; font-size: 13px; }
.wk-planrow small { color: var(--faint); opacity: .75; font-size: 10.5px; }
.wk-tlabel { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.wk-tlabel .whendt { margin-top: 0; padding: 8px 10px; }
.wk-bigbtn em { margin-left: auto; }
.wk-body { margin-top: 2px; }
.wk-imp { margin-top: 10px; }
.mi-hist { margin-top: 8px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.mi-hist b { color: var(--text); }
.wk-delbtn { display: block; width: 100%; margin-top: 14px; background: transparent; border: 1px dashed var(--line-2); color: var(--faint); border-radius: var(--radius-sm); padding: 10px; font: inherit; font-size: 13px; cursor: pointer; }
.wk-delbtn.armed { border: 1px solid var(--low); color: var(--low); background: rgba(255,92,108,.08); font-weight: 700; }

/* ---- weekly plan strip ---- */
.plan-head { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; }
.plan-nav { display: flex; gap: 6px; }
.plan-nav button { background: var(--surface); border: 1px solid var(--line-2); color: var(--muted); border-radius: 999px; padding: 3px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.plan-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-top: 9px; }
.plan-cell { background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 7px 2px 8px; text-align: center; cursor: pointer; min-width: 0; }
.plan-cell.today { border-color: var(--acc); }
.plan-cell.picking { background: var(--surface-2); border-color: var(--line-2); }
.plan-cell.past:not(.done) { opacity: .55; }
.pc-dow { font-size: 9.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .03em; }
.pc-lab { font-size: 11px; font-weight: 700; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-cell.done .pc-lab { color: var(--inrange); }
.pc-lab.ghost { color: var(--muted); font-weight: 500; font-style: italic; }
.pc-lab.none { color: var(--faint); font-weight: 400; }
.pc-miss { color: var(--faint); font-weight: 500; }
.plan-accept { display: block; width: 100%; margin-top: 9px; background: rgba(79,209,255,.09); border: 1px dashed var(--acc); color: var(--acc); border-radius: var(--radius-sm); padding: 9px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.plan-pick { margin-top: 9px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 11px 12px; }
.pp-cap { font-size: 12px; color: var(--muted); }
.pp-cap small { color: var(--faint); }
.pp-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.plan-chip { background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text); border-radius: 999px; padding: 7px 13px; font: inherit; font-size: 13px; cursor: pointer; }
.plan-chip.on { border-color: var(--acc); color: var(--acc); font-weight: 700; }
.plan-chip.sug { border-style: dashed; border-color: var(--acc); }
.plan-chip.clear { color: var(--faint); border-style: dashed; }
.plan-chip.done { border-color: var(--inrange); color: var(--inrange); }
.plan-chip.armed { border-color: var(--high); color: var(--high); }
.pp-sess { margin-top: 9px; display: flex; flex-direction: column; gap: 5px; }
.pp-wk { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px; cursor: pointer; font-size: 13px; flex-wrap: wrap; }
.pp-wk .nm { font-weight: 600; }
.pp-wk-stats { color: var(--muted); font-size: 12px; }
.pp-wk .ag { margin-left: auto; color: var(--faint); font-size: 11.5px; }
.pp-none { margin-top: 9px; color: var(--faint); font-size: 12.5px; }
.pp-prog { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.pp-partial { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 8px; }
.pp-partial .treat-l { font-size: 12px; color: var(--faint); }
.pp-half.on { border-color: var(--high); color: var(--high); }

/* ---- today's training + program ---- */
.train-rec { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; }
.train-pick { font-size: 16px; font-weight: 600; color: var(--acc); margin-bottom: 8px; display: flex; align-items: center; }
.train-pick.tappable { cursor: pointer; }
.train-why { font-size: 13.5px; color: var(--muted); line-height: 1.5; margin-top: 5px; }
.train-why b { color: var(--text); font-weight: 600; }
.train-why.warn { color: var(--high); }
.tr-chev { margin-left: auto; color: var(--faint); font-size: 18px; transition: transform .15s; transform: rotate(90deg); }
.tr-chev.open { transform: rotate(270deg); }
.tr-exs { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 9px; }
.tr-exh { font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.prog-day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 8px; }
.prog-day summary { padding: 13px 14px; cursor: pointer; font-weight: 600; font-size: 15px; list-style: none; display: flex; align-items: center; gap: 8px; }
.prog-day summary::-webkit-details-marker { display: none; }
.prog-n { font-size: 12px; color: var(--faint); font-weight: 500; }
.prog-chev { margin-left: auto; color: var(--faint); font-size: 18px; line-height: 1; transition: transform .16s ease; }
.prog-day[open] summary .prog-chev { transform: rotate(90deg); color: var(--muted); }
.prog-exs { padding: 0 14px 10px; }
.prog-ex { padding: 9px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.prog-ex > div:first-child { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.pe-name { font-size: 14px; font-weight: 500; }
.pe-scheme { font-size: 12.5px; color: var(--acc); font-family: "SF Mono", ui-monospace, monospace; text-align: right; flex: none; }
.pe-notes { font-size: 12px; color: var(--muted); }
.editbtn { margin-left: auto; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--acc); font: inherit; font-size: 12px; font-weight: 600; text-transform: none; letter-spacing: 0; padding: 4px 12px; border-radius: 999px; cursor: pointer; }
.prog-day-ed { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 12px; margin-bottom: 8px; }
.pde-day { font-size: 12.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.pe-edit { display: flex; align-items: center; gap: 7px; padding: 5px 0; }
.pe-i { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; color: var(--text); font: inherit; font-size: 14px; min-width: 0; }
.pe-name-i { flex: 1; }
.pe-scheme-i { width: 72px; flex: none; text-align: center; font-family: "SF Mono", ui-monospace, monospace; font-size: 13px; }
.pe-opt { flex: none; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--faint); font: inherit; font-size: 11px; font-weight: 600; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.pe-opt.on { color: var(--acc); border-color: var(--acc); background: rgba(79, 209, 255, 0.12); }
.pe-del { flex: none; background: none; border: none; color: var(--low); font-size: 15px; cursor: pointer; padding: 4px 6px; }
.pe-add { margin-top: 6px; background: none; border: 1px dashed var(--line-2); color: var(--muted); font: inherit; font-size: 13px; padding: 9px; width: 100%; border-radius: 8px; cursor: pointer; }
.pe-add:hover { color: var(--text); border-color: var(--acc); }

/* ---- settings: collapsed change-password row ---- */
.set-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; background: none; border: 0; padding: 2px 0; font: inherit; cursor: pointer; color: inherit; }
.set-chev { color: var(--faint); font-size: 17px; line-height: 1; transition: transform .15s ease; }
.set-toggle.open .set-chev { transform: rotate(90deg); }

/* ---- devices grouped by category ---- */
.conn-cat { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); margin: 6px 0 0; }
.conn-cat:first-child { margin-top: 0; }

/* ---- CSV history import card (staged preview -> confirm/cancel) ---- */
.imp-preview { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.imp-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.imp-unit { font-size: 11.5px; color: var(--faint); }
.imp-span { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.imp-counts { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 6px; }
.imp-count { font-size: 12.5px; color: var(--muted); }
.imp-count b { color: var(--text); }
.imp-sample { font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.imp-note { font-size: 11.5px; color: var(--muted); margin-top: 6px; line-height: 1.45; }
.wk-imp { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 13px; }
.wk-imp[style*="display: none"], .wk-imp:empty { border: 0; padding: 0; }
.ma-ic { flex: 0 0 auto; }
.wk-resport { margin-top: 8px; }

/* program meta rows (warm-up / finisher) + the reset escape hatch */
.pe-meta { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.pe-meta label { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); flex: 0 0 68px; }
.pe-meta .pe-i { flex: 1; }
.pe-reset { margin-top: 12px; background: none; border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 13px; font: inherit; font-size: 12.5px; color: var(--faint); cursor: pointer; }
.pe-reset:hover { color: var(--text); border-color: var(--line-2); }
.pe-reset.armed { color: var(--low); border-color: var(--low); }

/* ---- program editor round: payload-driven sections, reorder, AI lane ---- */
/* day-section header: name + ▲▼ reorder + ✨ suggest chip */
.pde-day { display: flex; align-items: center; gap: 7px; }
.pde-name { flex: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.pde-ord { display: inline-flex; gap: 3px; }
.pde-mv { background: none; border: 1px solid var(--line-2); color: var(--muted); border-radius: 7px; font-size: 9.5px; line-height: 1; padding: 4px 6px; cursor: pointer; }
.pde-mv:hover:not(:disabled) { color: var(--acc); border-color: var(--acc); }
.pde-mv:disabled { opacity: 0.3; cursor: default; }
.sg-chip { margin-left: auto; flex: none; background: none; border: 1px dashed var(--line-2); color: var(--acc); font: inherit; font-size: 11.5px; font-weight: 600; text-transform: none; letter-spacing: 0; padding: 4px 10px; border-radius: 999px; cursor: pointer; }
.sg-chip:hover:not(:disabled) { border-color: var(--acc); }
.sg-chip.busy, .editbtn.busy { color: var(--faint); border-color: var(--line); cursor: default; }
/* exercise-name typeahead dropdown */
.pe-edit { position: relative; }
.ac-list { position: absolute; left: 0; right: 0; top: calc(100% - 3px); z-index: 30; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35); }
.ac-item { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; width: 100%; background: none; border: 0; border-top: 1px solid var(--line); color: var(--text); font: inherit; font-size: 13.5px; padding: 9px 11px; cursor: pointer; text-align: left; }
.ac-item:first-child { border-top: 0; }
.ac-item.hi, .ac-item:hover { background: rgba(79, 209, 255, 0.10); }
.ac-nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-sc { flex: none; color: var(--acc); font-family: "SF Mono", ui-monospace, monospace; font-size: 12px; }
/* AI ghost suggestion rows — dashed like every other "suggested, not saved" */
.pe-ghost { display: flex; align-items: center; gap: 7px; padding: 6px 8px; margin: 4px 0; border: 1px dashed var(--acc); border-radius: 10px; background: rgba(79, 209, 255, 0.05); }
.pg-name { flex: 1; font-size: 14px; font-style: italic; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-scheme { flex: none; color: var(--acc); font-family: "SF Mono", ui-monospace, monospace; font-size: 12.5px; }
.pg-acc { flex: none; background: rgba(52, 211, 153, 0.14); border: 1px solid var(--inrange); color: var(--inrange); border-radius: 8px; font: inherit; font-size: 12px; font-weight: 700; padding: 5px 9px; cursor: pointer; }
.pg-dis { flex: none; background: none; border: none; color: var(--faint); font-size: 14px; cursor: pointer; padding: 4px 6px; }
.pg-all { margin: 2px 0 4px; background: none; border: 1px dashed var(--inrange); color: var(--inrange); font: inherit; font-size: 12px; font-weight: 600; padding: 7px; width: 100%; border-radius: 8px; cursor: pointer; }
/* AI resting / hiccup note — same amber tone as the coach's rest bubble */
.sg-rest { margin: 6px 0; padding: 8px 11px; border: 1px solid rgba(251, 191, 36, 0.35); border-radius: 10px; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
/* "+ Add warm-up note" / "+ Add finisher note" */
.pe-metaadd { display: block; margin-top: 8px; background: none; border: 1px dashed var(--line-2); color: var(--muted); font: inherit; font-size: 12.5px; padding: 8px 12px; border-radius: 999px; cursor: pointer; }
.pe-metaadd:hover { color: var(--text); border-color: var(--acc); }
/* reset refused (409): the server's explanation + the honest ways forward */
.reset-409 { margin-top: 8px; padding: 10px 12px; border: 1px solid rgba(251, 191, 36, 0.35); border-radius: var(--radius-sm); background: var(--surface); }
.r409-msg { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.r409-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.r409-row .pe-reset { margin-top: 0; }
.r409-go { color: var(--acc); border-color: var(--acc); }

/* macros row, nothing-logged-yet state — present but visibly quiet */
.mt-empty .mt-v { color: var(--faint); }

/* ================================================================
   YOUR DATA — export + guarded account deletion (Settings), the
   signup legal gate, and the /terms + /privacy static pages.
   Same tokens, same card idiom as the rest of Settings.
   ================================================================ */

/* signup: "I agree to the Terms and Privacy Policy" */
.agree { display: flex; align-items: flex-start; gap: 9px; margin-top: 14px; font-size: 12.5px; color: var(--muted); line-height: 1.45; cursor: pointer; }
.agree input { flex: none; width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--inrange); cursor: pointer; }
.agree a { color: var(--acc); text-decoration: none; }
.agree a:hover { text-decoration: underline; }
.primary.needsagree { opacity: 0.45; }          /* dimmed, but still pressable */
.agree.shake { animation: t1qshake 0.4s ease; }
.agree.shake input { outline: 2px solid var(--low); outline-offset: 2px; border-radius: 4px; }
@keyframes t1qshake { 25% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }

/* legal links under the auth card and at the foot of Settings */
.auth-legal, .set-legal { margin-top: 12px; font-size: 11.5px; color: var(--faint); text-align: center; }
.set-legal { margin-top: 18px; }
.auth-legal a, .set-legal a { color: var(--faint); text-decoration: none; }
.auth-legal a:hover, .set-legal a:hover { color: var(--muted); text-decoration: underline; }
.auth-legal .sep, .set-legal .sep { padding: 0 6px; opacity: 0.6; }

/* export row */
.set-note { margin-top: 9px; font-size: 12px; color: var(--faint); line-height: 1.5; }
.set-note.err { color: var(--low); }
.set-note.ok { color: var(--inrange); }
.spin { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: t1qspin 0.7s linear infinite; }
@keyframes t1qspin { to { transform: rotate(360deg); } }

/* delete: the row itself reads as dangerous before it is opened */
.set-toggle .set-sub.danger { color: var(--low); }
.del-warn { margin-top: 12px; background: rgba(255, 92, 108, 0.06); border: 1px solid rgba(255, 92, 108, 0.22); border-radius: var(--radius-sm); padding: 12px 13px; font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.del-warn b { color: var(--text); font-weight: 600; }
.del-list { margin: 8px 0 0; padding-left: 17px; }
.del-list li { margin-top: 4px; }
.del-cool { margin-top: 10px; }
.primary.danger { background: var(--low); color: #2a0409; }
.primary.danger:disabled { opacity: 0.4; }

/* delete: scheduled state */
.del-sched { background: rgba(255, 92, 108, 0.06); border: 1px solid rgba(255, 92, 108, 0.22); border-radius: var(--radius-sm); padding: 12px 13px; }
.del-sched-h { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--low); margin-bottom: 6px; }
.del-sched-b { font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.del-sched-b b { color: var(--text); font-weight: 600; }

/* ---- the standalone legal pages (terms.html / privacy.html) ---- */
.legal { max-width: 640px; margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 18px 64px; }
.legal-brand { display: flex; align-items: center; gap: 9px; margin-bottom: 18px; }
.legal-brand svg { width: 22px; height: 22px; }
.legal-brand span { font-weight: 700; letter-spacing: 0.32em; font-size: 13px; }
.legal-draft { background: rgba(251, 191, 36, 0.09); border: 1px solid rgba(251, 191, 36, 0.35); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 12.5px; color: var(--high); line-height: 1.55; }
.legal-draft b { display: block; font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 4px; }
.legal h1 { font-size: 24px; margin: 22px 0 4px; letter-spacing: -0.01em; }
.legal .legal-date { font-size: 12px; color: var(--faint); margin-bottom: 4px; }
.legal h2 { font-size: 15.5px; margin: 26px 0 8px; color: var(--text); }
.legal p, .legal li { font-size: 14px; color: var(--muted); line-height: 1.62; }
.legal p { margin: 0 0 11px; }
.legal ul { margin: 0 0 11px; padding-left: 19px; }
.legal li { margin-bottom: 6px; }
.legal b, .legal strong { color: var(--text); font-weight: 600; }
.legal a { color: var(--acc); text-decoration: none; }
.legal a:hover { text-decoration: underline; }
.legal-note { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 13px 14px; margin: 0 0 11px; }
.legal-note p:last-child { margin-bottom: 0; }
/* unfilled blanks a reviewer must close before launch — deliberately loud */
.legal .legal-ph { color: var(--high); font-size: 12.5px; }
.legal .legal-ph b { color: var(--high); }
.legal-foot { margin-top: 34px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--faint); }
.legal-foot a { color: var(--faint); }
.legal-foot .sep { padding: 0 6px; opacity: 0.6; }

/* ---------- onboarding wizard (the first five minutes) ---------- */
.ob-card { text-align: left; }
.ob-h { font-size: 17px; font-weight: 700; margin-bottom: 3px; }
.ob-h small { font-weight: 500; color: var(--muted); font-size: 12px; }
.ob-sub { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin-bottom: 4px; }
.ob-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 14px; }
.ob-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); }
.ob-dots span.on { background: var(--acc); }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice.choice-1col { grid-template-columns: 1fr; }
.choice button { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 12px 10px; color: var(--muted); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-align: center; }
.choice button:active { transform: scale(0.98); }
.choice button.sel { color: var(--acc); border-color: rgba(79, 209, 255, 0.55); background: rgba(79, 209, 255, 0.08); }
.ob-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ob-inline { display: flex; align-items: center; gap: 9px; }
.ob-inline input { flex: 1; min-width: 0; }
.ob-unit { color: var(--muted); font-size: 13px; white-space: nowrap; }
.ob-note { margin-top: 8px; font-size: 12px; line-height: 1.5; color: #fbbf24; background: rgba(251, 191, 36, 0.07); border: 1px solid rgba(251, 191, 36, 0.25); border-radius: var(--radius-sm); padding: 9px 11px; }
.ob-nav { display: flex; gap: 10px; align-items: center; margin-top: 16px; }
.ob-nav .ob-next { flex: 1; }
#obConnList { margin-top: 10px; }

.mt-note { flex-basis: 100%; font-size: 11.5px; color: var(--faint); margin-top: 4px; }

/* ---------- Settings → Therapy: pump-style segment tables (Apex v3 segCard
   port — real time-of-day rows here, not meal buckets). The faint accent
   border keeps the block visually apart from the Devices cards below it. */
#therapyBody { display: grid; gap: 10px; }
.thcard { border-color: rgba(79, 209, 255, 0.22); }
.th-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.th-lbl { font-size: 13.5px; font-weight: 600; }
.th-unit { font-size: 11px; color: var(--faint); white-space: nowrap; }
.thseg { width: 100%; border-collapse: collapse; margin-top: 10px; }
.thseg th { text-align: left; font-size: 10.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--faint); padding: 0 8px 6px 0; }
.thseg td { padding: 3px 8px 3px 0; border-top: 1px solid var(--line); }
.thseg .c-from { width: 42%; }
.thseg .c-del { width: 34px; padding-right: 0; text-align: right; }
.thseg input { width: 100%; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 9px; color: var(--text); font: inherit; font-size: 14px; }
.thseg input:focus { outline: none; border-color: var(--acc); }
.thseg input:disabled { opacity: 0.6; }
.thseg input[type="time"] { color-scheme: dark; -webkit-appearance: none; appearance: none; display: block; }
/* iOS WebKit gives a time input its own intrinsic width and ignores the 42% cell — the
   "12:00 AM" box ran under the value box (2026-09-18 screenshot). Fixed layout + box-sizing
   pins every input inside its cell. */
.thseg { table-layout: fixed; }
.thseg td, .thseg th { overflow: hidden; }
.thseg input { min-width: 0; max-width: 100%; box-sizing: border-box; }
.thcard { min-height: 0; }
.th-del { background: none; border: 0; color: var(--faint); font-size: 17px; line-height: 1; cursor: pointer; padding: 6px; }
.th-del:hover { color: var(--low); }
.th-add { margin-top: 10px; }
.th-allrow { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.th-allin { width: 96px; min-width: 0; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 9px; color: var(--text); font: inherit; font-size: 14px; }
.th-allin:focus { outline: none; border-color: var(--acc); }
.th-foot { display: flex; align-items: center; gap: 10px; margin-top: 0; min-height: 0; }
.th-foot:has(.th-save:not([hidden])), .th-foot:has(.th-note:not(:empty)) { margin-top: 12px; min-height: 18px; }
.th-foot .set-note, .th-note { margin-top: 0; }

/* ---------- Settings → Alarms (threshold notifications) ---------- */
.al-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.al-row:last-of-type { border-bottom: 0; }
.al-main { min-width: 0; flex: 1; }
.al-lbl { font-size: 13.5px; font-weight: 600; }
.al-sub { font-size: 12px; color: var(--faint); margin-top: 2px; line-height: 1.4; }
.al-ctl { display: flex; align-items: center; gap: 8px; flex: none; }
.al-ctl input[type="number"] { width: 74px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 8px 9px; color: var(--text); font: inherit; font-size: 14px; text-align: right; }
.al-ctl input[type="number"]:focus { outline: none; border-color: var(--acc); }
.al-unit { font-size: 11.5px; color: var(--faint); min-width: 38px; }
.al-ctl input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--acc); }
/* quiet hours sit on their own full-width line under the alarm (a phone can't fit
   label + two time pickers beside the threshold controls; iOS gave the pickers their
   own width and wrapped "off" onto a third line) */
.al-quiet { display: flex; align-items: center; gap: 8px; margin-top: 2px; font-size: 12px; color: var(--muted); flex-wrap: nowrap; flex-basis: 100%; white-space: nowrap; }
.al-quiet input[type="time"] { width: 96px; min-width: 0; box-sizing: border-box; -webkit-appearance: none; appearance: none; display: block; color-scheme: dark; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 6px 8px; color: var(--text); font: inherit; font-size: 13px; }
.al-quiet .linkbtn { display: inline; width: auto; margin: 0; font-size: 12px; }
.al-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.al-push { font-size: 12px; color: var(--faint); line-height: 1.45; flex: 1; min-width: 180px; }
.al-push.on { color: var(--inrange); }

/* Google Calendar card: sign-in button + calendar picker */
.btn-mini.gbtn { gap: 8px; }
.gmark { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; background: #fff; color: #1a73e8; font-weight: 800; font-size: 12px; line-height: 1; }
.gcal-pick { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.gcal-pick-h { font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--faint); margin-bottom: 6px; }
.gcal-cal { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 14px; color: var(--text); cursor: pointer; }
.gcal-cal input { width: 18px; height: 18px; margin: 0; accent-color: var(--acc); flex: none; }
.gcal-cal span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gcal-cal em { font-style: normal; font-size: 11px; color: var(--faint); margin-left: 4px; }
