@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/hanken-grotesk-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/hanken-grotesk-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/jetbrains-mono-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/jetbrains-mono-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Daily OS — a dark canvas, smoked glass, and room to breathe.
 * All views share these tokens. Phase describes when; mood describes what. */
@property --scene-accent {
  syntax: '<color>';
  inherits: true;
  initial-value: #d5b88f;
}
:root {
  color-scheme: dark;
  --bg: #101614; --bg-raised: #19221f; --surface: #ffffff09; --surface-2: #2a3731;
  --ink: #eeeae2; --ink-dim: #b7c0be; --ink-faint: #98aaa4; --on-accent: #14201a;
  --dawn: #d5b88f; --morning: #d8ac90; --midday: #aebc9a; --evening: #b7a6cc; --night: #9dafcd;
  --dawn-ink: var(--dawn); --morning-ink: var(--morning); --midday-ink: var(--midday);
  --evening-ink: var(--evening); --night-ink: var(--night);
  --mo-rise: #d5b88f; --mo-train: #dba18b; --mo-move: #96c5b2; --mo-food: #adc69c;
  --mo-supp: #92c2c7; --mo-focus: #9dafcd; --mo-social: #d0a3ba; --mo-rest: #b7a6cc; --mo-goal: #d6bf87;
  /* Meter strip colours (Keto-Mojo glucose and ketone foils, Nova lactate strip), lifted for dark glass. */
  --reading-glucose: #c98f55; --reading-ketone: #5cc3d6; --reading-lactate: #b467e6;
  --positive: #a6cfb5; --alert: #e9aaa2; --gold: #d6bf87;
  --line: #dce8df1f; --line-strong: #dce8df70;
  /* Glass has three levels: the ambient scene, translucent cards, and quiet
   * inset rows inside a card. Only cards and navigation blur what is behind. */
  --glass: linear-gradient(160deg, #ffffff14, #ffffff06 70%);
  --glass-quiet: #ffffff08; --glass-edge: #ffffff1c; --inset-edge: #ffffff0f;
  --glass-shadow: 0 18px 48px -24px #000000a6, inset 0 1px 0 #ffffff24;
  --glass-blur: blur(24px) saturate(150%);
  --veil: #050a08a6;
  --scene-duration: 760ms; --shimmer-duration: 900ms;
  --glass-texture: repeating-linear-gradient(0deg, #ffffff08 0 1px, transparent 1px 3px);
  --selection-shadow: 0 5px 15px #00000026;
  --font-body: 'Hanken Grotesk', system-ui, sans-serif;
  --font-display: var(--font-body); --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --r-sm: 12px; --r-md: 18px; --r-lg: 24px; --r-xl: 32px; --r-pill: 999px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 20px; --s5: 28px; --s6: 40px; --s7: 48px; --s8: 64px;
  --ease: cubic-bezier(.2, .7, .3, 1); --rise: .35s;
  --accent: var(--midday); --accent-ink: var(--midday-ink);
}
.ph-dawn { --accent: var(--dawn); --accent-ink: var(--dawn-ink); }
.ph-morning { --accent: var(--morning); --accent-ink: var(--morning-ink); }
.ph-midday { --accent: var(--midday); --accent-ink: var(--midday-ink); }
.ph-evening { --accent: var(--evening); --accent-ink: var(--evening-ink); }
.ph-night { --accent: var(--night); --accent-ink: var(--night-ink); }
.mo-rise { --accent: var(--mo-rise); --accent-ink: var(--mo-rise); }
.mo-train { --accent: var(--mo-train); --accent-ink: var(--mo-train); }
.mo-move { --accent: var(--mo-move); --accent-ink: var(--mo-move); }
.mo-food { --accent: var(--mo-food); --accent-ink: var(--mo-food); }
.mo-supp { --accent: var(--mo-supp); --accent-ink: var(--mo-supp); }
.mo-focus { --accent: var(--mo-focus); --accent-ink: var(--mo-focus); }
.mo-social { --accent: var(--mo-social); --accent-ink: var(--mo-social); }
.mo-rest { --accent: var(--mo-rest); --accent-ink: var(--mo-rest); }
.mo-goal { --accent: var(--mo-goal); --accent-ink: var(--mo-goal); }

* { box-sizing: border-box; }
html { min-height: 100%; scroll-padding-top: var(--s5); scroll-padding-bottom: calc(96px + env(safe-area-inset-bottom)); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font-body);
  --glass: linear-gradient(160deg, color-mix(in srgb, var(--scene-accent) 12%, #ffffff12), color-mix(in srgb, var(--scene-accent) 3%, #ffffff05) 70%);
  --glass-quiet: color-mix(in srgb, var(--scene-accent) 3%, #ffffff07);
  --glass-edge: color-mix(in srgb, var(--scene-accent) 18%, #ffffff14);
  /* Category colors are muted for text; the ambient glow uses a deeper, more
   * saturated version so translucent cards have color to frost. */
  --scene-glow: var(--scene-accent);
  --scene-wash: radial-gradient(75% 50% at 5% 0%, color-mix(in srgb, var(--scene-glow) 55%, transparent), transparent 72%), radial-gradient(60% 45% at 100% 34%, color-mix(in srgb, color-mix(in srgb, var(--scene-glow) 55%, var(--mo-focus)) 26%, transparent), transparent 72%), radial-gradient(75% 50% at 15% 100%, color-mix(in srgb, color-mix(in srgb, var(--scene-glow) 50%, var(--mo-rest)) 20%, transparent), transparent 72%), linear-gradient(180deg, #131b18, #0b100e);
  --shimmer-wash: linear-gradient(110deg, transparent 25%, color-mix(in srgb, var(--scene-accent) 5%, transparent) 44%, color-mix(in srgb, var(--scene-accent) 16%, transparent) 50%, color-mix(in srgb, var(--ink) 8%, transparent) 54%, transparent 70%);
}
@supports (color: oklch(from red l c h)) {
  body { --scene-glow: oklch(from var(--scene-accent) .5 calc(c * 2.6) h); }
}
body[data-scene-motion='true'] { transition: --scene-accent var(--scene-duration) var(--ease) 80ms; }
body.dialog-open { overflow: hidden; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
button, summary { cursor: pointer; touch-action: manipulation; }
button { color: inherit; }
button:disabled { opacity: .55; cursor: wait; }
svg { flex-shrink: 0; vertical-align: middle; }
a { color: var(--accent-ink); text-underline-offset: 4px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-weight: 500; }
button, h1, h2, h3, p, .note, .sub { overflow-wrap: anywhere; }
.skip-link { position: fixed; top: -100px; left: var(--s4); z-index: 100; background: var(--bg-raised); padding: var(--s3) var(--s4); border-radius: var(--r-sm); }
.skip-link:focus { top: var(--s3); }
#glow { position: fixed; inset: 0; pointer-events: none; z-index: -1; background: var(--scene-wash); }
#glow::after { content: ''; position: absolute; inset: 0; opacity: .18; background: var(--glass-texture); }
#shimmer { position: fixed; inset: 0; z-index: 31; overflow: hidden; pointer-events: none; }
#shimmer-band { position: absolute; inset: 0; opacity: 0; background: var(--shimmer-wash); }
#app { width: 100%; max-width: 1200px; margin: auto; padding: calc(var(--s5) + env(safe-area-inset-top)) max(var(--s4), env(safe-area-inset-right)) calc(112px + env(safe-area-inset-bottom)) max(var(--s4), env(safe-area-inset-left)); }
#app:focus { outline: none; }
#r-head:empty, #r-oura:empty, #r-calendar:empty, #r-day:empty, #r-library:empty, #r-insights:empty { display: none; }
.today-grid { display: grid; gap: var(--s5); align-items: start; }
.today-grid > *, .insight-column, .library-content { min-width: 0; }
.insight-column { display: grid; gap: var(--s5); }
.insight-column:has(#r-oura:empty):has(#r-calendar:empty), body[data-view='library'] .today-grid { display: none; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s5); }
.topbar-title { min-width: 0; }
.page-title { font-size: clamp(32px, 5vw, 44px); line-height: 1.15; letter-spacing: -.045em; margin: var(--s2) 0 0; }
.screen-title { font-size: 32px; line-height: 1.2; letter-spacing: -.035em; margin-bottom: var(--s3); }
.card-title { font-size: 24px; line-height: 1.25; letter-spacing: -.03em; margin-bottom: var(--s4); }
.activity-title { font-size: clamp(28px, 4.5vw, 48px); line-height: 1.12; letter-spacing: -.045em; margin: var(--s3) 0 var(--s4); }
.hero-title { font-size: clamp(36px, 5vw, 54px); line-height: 1.1; letter-spacing: -.045em; }
.kicker { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-dim); line-height: 1.5; }
.kicker-accent, .is-accent { color: var(--accent-ink); }
.kicker-wide { letter-spacing: .14em; }
.note { font-size: 15px; line-height: 1.65; color: var(--ink-dim); margin: var(--s3) 0 var(--s4); }
.note-tight { margin: var(--s2) 0; }
.sub { font-size: 13px; line-height: 1.55; color: var(--ink-dim); }
.data { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.is-dim { color: var(--ink-dim); }
.is-good, .is-positive { color: var(--positive); }
.is-warn, .is-alert { color: var(--alert); }
.pill, .badge { display: inline-flex; align-items: center; padding: var(--s1) var(--s3); border-radius: var(--r-pill); font-size: 12px; color: var(--accent-ink); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.card, .dayring, .calendar, .modalcard, .panel { background: var(--glass); border: 1px solid var(--glass-edge); box-shadow: var(--glass-shadow); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); border-radius: var(--r-xl); padding: var(--s5); }
.card-hero { background: var(--glass-quiet); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.note-alert, .pill-alert { color: var(--alert); }
.pill-positive, .sub-positive { color: var(--positive); }
.pill-gold { color: var(--gold); }
.pill-plain, .sub-dim, .note-faint { color: var(--ink-dim); }
.sub-accent { color: var(--accent-ink); }
.pill-alert { background: color-mix(in srgb, var(--alert) 8%, transparent); }
.pill-positive { background: color-mix(in srgb, var(--positive) 8%, transparent); }
.pill-gold { background: color-mix(in srgb, var(--gold) 8%, transparent); }
.card .note:last-child, .calendar p:last-child { margin-bottom: 0; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--s1); margin: 0 0 var(--s5); max-width: 520px; }
.week-day { display: flex; flex-direction: column; align-items: center; gap: var(--s2); padding: var(--s3) var(--s1); border-radius: var(--r-pill); color: var(--ink-dim); font-size: 12px; }
.week-date { font-size: 17px; color: var(--ink); }
.week-day.is-today { background: var(--ink); color: var(--on-accent); box-shadow: var(--selection-shadow); }
.week-day.is-today .week-date { color: var(--on-accent); }
.week-dot { width: 4px; height: 4px; background: var(--line-strong); border-radius: 50%; }
.week-dot.is-part { background: var(--accent); }
.week-dot.is-full { background: var(--positive); }
.is-today .week-dot { background: var(--on-accent); }
.dayring { display: flex; flex-direction: row-reverse; align-items: center; justify-content: space-between; gap: var(--s4); padding: clamp(24px, 4vw, 48px); margin-bottom: var(--s4); }
.dayring-now { flex: 1; min-width: 0; }
.dayring-face { position: relative; flex: 0 0 120px; aspect-ratio: 1; }
.dayring-face > svg { width: 100%; height: auto; transform: rotate(-90deg); }
.dayring-track { stroke: color-mix(in srgb, var(--accent) 12%, transparent); }
.dayring-arc { stroke: var(--accent); transition: stroke-dashoffset .5s var(--ease); }
.dayring-inner { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.dayring-num { font-size: 34px; line-height: 1.1; font-weight: 500; letter-spacing: -.06em; }
.dayring-of { font-size: 11px; color: var(--ink-dim); margin-top: var(--s1); }
.dayring .ghost { padding: 0; text-align: left; justify-content: flex-start; border: 0; min-height: var(--s7); }
.checkin { display: flex; gap: var(--s3); align-items: center; width: 100%; text-align: left; padding: var(--s4); margin-bottom: var(--s5); border: 1px solid var(--glass-edge); border-radius: var(--r-lg); background: var(--glass-quiet); color: var(--ink-dim); font-size: 14px; }
.checkin-dot { width: 8px; height: 8px; flex-shrink: 0; border: 1px solid var(--accent); border-radius: 50%; }
.checkin.is-set .checkin-dot { background: var(--accent); }
.checkin-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: var(--s3); }
.field-tile { min-width: 0; color: var(--ink-dim); font-size: 13px; }
.field-tile:last-child { grid-column: 1 / -1; }
.field-tile input { margin-top: var(--s2); }
#sleep-checkin-form { padding: var(--s4); margin-bottom: var(--s5); border-radius: var(--r-lg); background: var(--glass-quiet); }
.plan-panel { background: var(--glass-quiet); border: 1px solid var(--glass-edge); border-radius: var(--r-xl); padding: var(--s5); }
.statusbox { display: flex; flex-direction: column; gap: var(--s2); margin: 0 0 var(--s5); padding-bottom: var(--s4); border-bottom: 1px solid var(--line); }
.statusbox .kicker:last-child { font-size: 13px; text-transform: none; letter-spacing: 0; font-weight: 400; }
.statusbox.is-late .status-lead { color: var(--alert); }
.statusbox.is-ok .status-lead { color: var(--positive); }
.timeline { position: relative; }
.timeline-spine { position: absolute; top: var(--s5); bottom: var(--s5); width: 1px; left: 8px; background: linear-gradient(var(--dawn), var(--midday), var(--night)); opacity: .25; }
.step { position: relative; }
.step-row { display: flex; align-items: center; gap: var(--s4); width: 100%; min-height: 76px; padding: var(--s3) 0; text-align: left; border: 0; background: transparent; }
.step-node { width: 17px; height: 17px; flex: 0 0 17px; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 50%; background: var(--bg-raised); display: grid; place-items: center; }
.step-node svg { width: 11px; height: 11px; }
.is-now .step-node { background: var(--accent); border: 4px solid var(--bg-raised); box-shadow: 0 0 0 1px var(--accent); }
.is-done .step-node { background: var(--accent); color: var(--on-accent); }
.step-label { flex: 1; min-width: 0; font-size: 16px; line-height: 1.4; }
.is-now .step-label { font-weight: 600; color: var(--accent-ink); }
.is-done .step-label, .is-skipped .step-label { color: var(--ink-dim); }
.step-time { color: var(--ink-dim); font-size: 12px; text-align: right; white-space: nowrap; }
.is-now .step-time { color: var(--accent-ink); }
.step-body { margin: 0 0 var(--s4) 37px; padding-bottom: var(--s4); }
.step-body > .note:first-child { margin-top: 0; }
.step-actions { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s4); }
.timer { margin: var(--s5) 0; }
.timer-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); }
.timer-head .data { font-size: 28px; letter-spacing: -.04em; }
.timer-sub, .hint { font-size: 12px; color: var(--ink-dim); }
.timer-bar { height: 4px; overflow: hidden; background: var(--line); border-radius: var(--r-pill); margin: var(--s3) 0; }
.timer-bar > span { display: block; height: 100%; background: var(--accent); }
.timer-bar > span.is-warn { background: var(--alert); }
.payload { background: color-mix(in srgb, var(--accent) 5%, transparent); border-radius: var(--r-md); padding: var(--s4); margin: var(--s4) 0; }
.payload-title { font-weight: 600; color: var(--accent-ink); }
.payload-cap { font-size: 12px; font-weight: 600; color: var(--accent-ink); margin-bottom: var(--s3); }
.suppline.sep { border-top: 1px solid var(--line); margin-top: var(--s3); padding-top: var(--s3); }
.macro { display: flex; flex-direction: column; gap: var(--s1); }
.macro b { font-size: 22px; font-weight: 500; }
.exrow { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s2); padding: var(--s3) 0; border-bottom: 1px solid var(--line); }
.exrow:last-child { border: 0; }
.ex-meta { font-size: 13px; color: var(--ink-dim); }
.dish + .dish { margin-top: var(--s4); padding-top: var(--s4); border-top: 1px solid var(--line); }
.macros { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s3); }
.macro { font-size: 12px; color: var(--ink-dim); }
.macro b { color: var(--accent-ink); }
.suppline { padding: var(--s2) 0; font-size: 14px; }
.logbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s2); margin-top: var(--s3); }
.logbar .lbl { flex: 1 1 64px; width: 64px; }
.setlist { font-size: 13px; color: var(--ink-dim); margin-top: var(--s3); }
.logged-tag { color: var(--positive); font-size: 12px; }
.rating { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s3); }
.stats { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); margin: var(--s6) 0; gap: var(--s4); }
.stat { display: flex; flex-direction: column; }
.stat b { font-size: 36px; font-weight: 500; }
.stat span { font-size: 13px; color: var(--ink-dim); }
.done-mark { width: 80px; height: 80px; margin: var(--s5) auto; border-radius: 50%; background: var(--surface); display: grid; place-items: center; color: var(--positive); }

/* Navigation becomes a top bar only when there is room for desktop navigation. */
#tabs { position: fixed; z-index: 20; bottom: calc(var(--s3) + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: var(--s2); width: calc(100% - 32px); max-width: 440px; padding: var(--s2); border: 1px solid var(--glass-edge); border-radius: var(--r-pill); background: color-mix(in srgb, var(--bg) 55%, transparent); box-shadow: var(--glass-shadow); backdrop-filter: blur(28px) saturate(160%); -webkit-backdrop-filter: blur(28px) saturate(160%); }
.nav-brand { display: none; }
.tab { display: flex; flex: 1; flex-direction: column; gap: var(--s1); align-items: center; justify-content: center; background: transparent; border: 0; border-radius: var(--r-pill); min-height: 56px; padding: var(--s2) var(--s3); color: var(--ink-dim); font-size: 12px; }
.tab svg { width: 20px; height: 20px; }
.tab.is-sel { background: color-mix(in srgb, var(--scene-accent) 50%, var(--ink)); color: var(--on-accent); }
.tab:hover:not(.is-sel) { background: var(--surface); }
.btn, .ghost, .mini, .seg, .iconbtn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: var(--s7); border-radius: var(--r-pill); padding: var(--s3) var(--s4); font-size: 14px; line-height: 1.4; text-decoration: none; transition: background .15s var(--ease), box-shadow .15s var(--ease); }
.btn { width: 100%; background: var(--accent); color: var(--on-accent); border: 1px solid transparent; font-weight: 600; margin-top: var(--s4); }
.btn:hover { box-shadow: 0 4px 16px color-mix(in srgb, var(--accent) 20%, transparent); }
.btn-flush, .ghost-flush { margin-top: 0; }
.ghost, .mini { background: transparent; border: 1px solid var(--line-strong); color: var(--ink-dim); }
.ghost:hover, .mini:hover, .iconbtn:hover { background: var(--surface); }
.ghost { margin-top: var(--s3); }
.ghost-flush { margin-top: 0; }
.ghost-sm, .mini { font-size: 13px; padding: var(--s2) var(--s3); }
.ghost-block { display: flex; width: 100%; }
.ghost-accent { color: var(--accent-ink); }
.mini-on { color: var(--on-accent); background: var(--accent); border-color: transparent; }
.mini-on:hover { background: var(--accent); }
.mini-danger { color: var(--alert); }
.mini-push { margin-left: auto; }
.iconbtn { width: var(--s7); min-width: var(--s7); padding: var(--s3); border: 1px solid var(--glass-edge); background: var(--surface); }
.iconbtn svg { width: 22px; height: 22px; }
.privacy-link { display: inline-block; padding-block: var(--s3); font-size: 13px; }
.row { display: flex; width: 100%; align-items: center; gap: var(--s3); padding: var(--s4) 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.row-main { flex: 1; min-width: 0; }
.row-main .sub { display: block; margin-top: var(--s1); }
.row-title { font-size: 16px; font-weight: 500; }
.row-sub { font-size: 13px; color: var(--ink-dim); }
.row-stack { flex-direction: column; align-items: stretch; }
.row-top { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); }
.row-strike { text-decoration: line-through; color: var(--ink-dim); }
.dot { width: 8px; height: 8px; flex-shrink: 0; border: 1px solid var(--accent); border-radius: 50%; }
.dot.is-on { background: var(--accent); }
.empty { padding: var(--s5); text-align: center; color: var(--ink-dim); font-size: 15px; background: var(--glass-quiet); border: 1px dashed var(--line-strong); border-radius: var(--r-lg); margin: var(--s4) 0; }
input, textarea, select { width: 100%; min-width: 0; min-height: var(--s7); border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: var(--s3); background: var(--surface); color: var(--ink); margin: 0 0 var(--s3); font-size: 16px; }
textarea { resize: vertical; line-height: 1.6; }
input::placeholder, textarea::placeholder { color: var(--ink-faint); }
input[type='checkbox'] { width: 22px; min-width: 22px; min-height: 22px; height: 22px; margin: 0; accent-color: var(--accent); }
.lbl { display: flex; flex-direction: column; gap: var(--s2); min-width: 0; font-size: 13px; color: var(--ink-dim); }
.lbl:has(input[type='checkbox']) { min-height: var(--s7); }
.lbl input, .lbl select, .lbl textarea { margin-bottom: 0; }
.fieldrow { display: flex; gap: var(--s3); flex-wrap: wrap; align-items: flex-end; }
.fieldrow > .lbl { flex: 1 1 96px; }
.fieldrow + .fieldrow { margin-top: var(--s4); }
.w-xs { width: 64px; } .w-sm { width: 88px; } .w-md { width: 116px; } .w-lg { width: 152px; }
.editcard { background: var(--glass-quiet); border: 1px solid var(--inset-edge); border-radius: var(--r-lg); padding: var(--s4); margin-bottom: var(--s3); }
.editcard-head { display: flex; width: 100%; min-height: var(--s7); justify-content: space-between; align-items: center; gap: var(--s3); text-align: left; background: transparent; border: 0; padding: 0; font-size: 16px; font-weight: 500; }
.editcard-body { margin-top: var(--s4); }
.strong { font-weight: 600; }
.segment { display: flex; gap: var(--s2); flex-wrap: wrap; margin: 0 0 var(--s5); }
.seg { background: transparent; border: 1px solid var(--line-strong); color: var(--ink-dim); text-transform: capitalize; }
.seg.is-sel { background: var(--accent); border-color: transparent; color: var(--on-accent); }
.library-content > .screen-title { margin-top: var(--s2); }
.library-content { max-width: 760px; }

/* Dialogs are scrollable within the visible viewport, including landscape. */
.modal { position: fixed; inset: 0; z-index: 30; background: var(--veil); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; padding: max(var(--s3), env(safe-area-inset-top)) max(var(--s3), env(safe-area-inset-right)) max(var(--s3), env(safe-area-inset-bottom)) max(var(--s3), env(safe-area-inset-left)); }
.modalcard { width: 100%; max-width: 560px; max-height: calc(100dvh - 40px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; background: color-mix(in srgb, var(--bg-raised) 96%, transparent); text-align: center; padding: clamp(24px, 4vw, 40px); animation: rise var(--rise) var(--ease) both; }
.modalcard.is-refresh { animation: none; }
.modalcard [data-oura-diagnostic] { scroll-margin-top: var(--s8); }
.modalcard.is-left { text-align: left; }
.modal-countdown { font-size: 48px; letter-spacing: -.04em; color: var(--accent); margin: var(--s4) 0; }
.modal-actions { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s5); }
.modal-actions.is-stacked { flex-direction: column; }
.errline { color: var(--alert); font-size: 13px; margin-top: var(--s3); }
.busyline { color: var(--ink-dim); font-size: 13px; margin-top: var(--s3); }
.setrow { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); width: 100%; min-height: 76px; padding: var(--s4); margin-bottom: var(--s3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); text-align: left; }
.setrow-l { display: block; font-size: 16px; font-weight: 500; }
.setrow-dot { width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%; background: var(--line-strong); }
.setrow.is-on .setrow-dot { background: var(--positive); }
.settings-section .actions + .actions { margin-top: 0; }
.settings-section .section-head { margin-top: 0; }
#oura-setup-form > .lbl + .lbl { margin-top: var(--s4); }
.oura-setup-details { margin: var(--s4) 0 var(--s5); }
.oura-setup-details .lbl { margin-top: var(--s3); }
.detail { display: flex; align-items: flex-start; gap: var(--s3); margin: var(--s3) 0; }
.detail-dot { width: 6px; height: 6px; flex-shrink: 0; border-radius: 50%; margin-top: var(--s2); background: var(--accent); }
.detail.is-positive .detail-dot { background: var(--positive); }
.detail.is-alert .detail-dot { background: var(--alert); }
.detail .note { margin: 0; flex: 1; }
.detail b { font-weight: 600; color: var(--accent-ink); }
.detail.is-positive b { color: var(--positive); }
.detail.is-alert b { color: var(--alert); }
.oura-card { margin: 0; }
.oura-card, .calendar { border-color: color-mix(in srgb, var(--accent) 18%, transparent); }
.oura-card .pill, .calendar .card-title { color: var(--accent-ink); }
.insight-heading { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); margin-bottom: var(--s4); }
.insight-heading .card-title { margin: 0; }
.oura-sleep { font-size: 44px; font-weight: 500; letter-spacing: -.05em; line-height: 1.2; margin: var(--s5) 0 var(--s3); }
.oura-sleep .sub { letter-spacing: 0; font-weight: 400; }
.oura-metrics { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: var(--s5) var(--s3); margin: var(--s5) 0; padding: var(--s5) 0; border-block: 1px solid var(--line); }
.oura-metrics dd { font-size: 24px; letter-spacing: -.03em; margin: var(--s2) 0 0; }
.oura-metrics dt { overflow-wrap: anywhere; }
.calendar { margin: 0; }
.calendar .stack { align-items: center; justify-content: space-between; }
.calendar-list { list-style: none; padding: 0; margin: var(--s4) 0; }
.calendar-event { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s4) 0; border-bottom: 1px solid var(--line); }
.calendar-event:last-child { border: 0; padding-bottom: 0; }
.calendar-time { font-size: 12px; color: var(--ink-dim); }
.calendar-label { font-size: 16px; overflow-wrap: anywhere; }
.calendar-warning { color: var(--alert); }
.sleep-history { margin-block: var(--s4) var(--s5); }
.sleep-days-detail { margin-top: var(--s3); }
.sleep-days { list-style: none; padding: 0; margin: var(--s4) 0; }
.sleep-days li { padding-block: var(--s4); border-bottom: 1px solid var(--line); }
.sleep-toggle { display: flex; align-items: center; gap: var(--s3); min-height: var(--s7); font-size: 15px; }
.sleep-conflict { margin-block: var(--s3); }
.sleep-conflict .stack { flex-wrap: wrap; align-items: stretch; }

/* Shared composition, also used by the standalone privacy and backup pages. */
.contents { display: contents; }
.privacy-page { max-width: 760px; margin: auto; padding: var(--s6) var(--s4) var(--s8); }
.privacy-page section { margin-top: var(--s6); }
.preview-notice { padding-inline: var(--s4); font-size: 12px; line-height: 20px; color: var(--ink-dim); text-align: center; }
.stack { display: flex; gap: var(--s3); }
.stack-wrap { flex-wrap: wrap; }
.stack-center { justify-content: center; }
.stack-between { justify-content: space-between; align-items: center; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-2 { margin-top: var(--s2); } .mt-4 { margin-top: var(--s4); } .mt-5 { margin-top: var(--s5); }
.mb-2 { margin-bottom: var(--s2); } .mb-3 { margin-bottom: var(--s3); }
.section-head { margin: var(--s5) 0 var(--s3); }
.bar { height: 5px; border-radius: var(--r-pill); background: var(--line); margin: var(--s4) 0 var(--s3); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.rise { animation: rise var(--rise) var(--ease) both; }
:is(a, button, input, textarea, select, summary, [tabindex]):focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
@media (min-width: 720px) {
  #app { padding-inline: var(--s5); }
  .today-grid { grid-template-columns: minmax(0,.9fr) minmax(0,1.1fr); }
  .today-grid:has(.insight-column > #r-oura:empty):has(.insight-column > #r-calendar:empty) { grid-template-columns: 1fr; }
  .dayring-face { flex-basis: 156px; }
  .dayring-num { font-size: 44px; }
  .dayring-of { font-size: 12px; }
}
@media (min-width: 1024px) {
  html { scroll-padding-top: var(--s5); }
  #app { padding-top: var(--s6); padding-bottom: calc(var(--s8) + var(--s7)); padding-inline: var(--s6); }
  .nav-brand svg { width: 28px; height: 28px; }
  .tab { flex: 1; flex-direction: row; padding-inline: var(--s4); font-size: 14px; min-height: var(--s7); gap: var(--s2); }
  .topbar .iconbtn { display: none; }
  .today-grid { grid-template-columns: minmax(0,.7fr) minmax(0,1.3fr); gap: var(--s6); }
}
@media (max-width: 379px) {
  #app { padding-inline: var(--s3); }
  .card, .calendar, .plan-panel { padding: var(--s4); border-radius: var(--r-lg); }
  .dayring { padding: var(--s4); gap: var(--s3); }
  .dayring-face { flex-basis: 88px; }
  .dayring-num { font-size: 28px; }
  .activity-title { font-size: 26px; }
  .step-row { gap: var(--s3); }
  .step-body { margin-left: 29px; }
  .modalcard { padding: var(--s4); }
}
@media (max-height: 600px) {
  .modalcard { max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .card, .dayring, .calendar, .modalcard, .panel, .agenda-now, .journal-protein, .journal-editor, #tabs { background: var(--bg-raised); }
}
@media (prefers-contrast: more) {
  :root, body { --line: #dce8df77; --line-strong: #dce8df99; --glass-edge: #dce8df77; --glass: var(--bg-raised); --glass-quiet: var(--bg-raised); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  #shimmer { display: none; }
}
@media (forced-colors: active) {
  #glow, #shimmer { display: none; }
  .tab.is-sel, .seg.is-sel, .week-day.is-today { outline: 2px solid Highlight; }
  .dayring-track { stroke: GrayText; } .dayring-arc { stroke: Highlight; }
}
/* Health records and checks use the app's existing glass and typography tokens. */
.health-source{padding:var(--s4) 0;border-bottom:1px solid var(--line)}

.health-entry > summary{padding-block:var(--s3)}
.health-entry[open]{padding-bottom:var(--s4)}
.health-ask > summary{min-height:var(--s7)}
.health-timeline .health-source:last-child{border-bottom:0}
.health-entry form{display:grid;gap:var(--s3);padding:var(--s3) 0}
.health-entry input,.health-entry select,.health-entry textarea{min-width:0;width:100%;min-height:var(--s7)}
.health-timeline{list-style:none;padding:0}

.health-answer{white-space:pre-wrap;overflow-wrap:anywhere;max-width:70ch}
.health-evidence{white-space:pre-wrap;overflow-wrap:anywhere;font-family:var(--font-mono);font-size:12px;max-height:24rem;overflow:auto}
/* Daily journal: one clock-based hub, with actual records beside the plan. */
#r-journal { margin-bottom: var(--s6); }
#r-journal[hidden] { display: none; }
.journal-toolbar, .journal-add, .journal-actions, .journal-section-head { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s3); }
.journal-toolbar { align-items: end; }
.journal-status { min-height: var(--s4); margin: var(--s3) 0 var(--s5); }
.journal-focus, .journal-protein, .journal-editor { padding: var(--s5); border: 1px solid var(--glass-edge); border-radius: var(--r-xl); background: var(--glass); box-shadow: var(--glass-shadow); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); }
.journal-focus { padding-block: var(--s6); border-top-color: var(--accent); }
.journal-focus h2 { font-weight: 500; font-size: clamp(28px, 5vw, 44px); line-height: 1.15; margin: var(--s3) 0 var(--s4); }
.journal-focus .btn { margin-top: var(--s5); }
.journal-next { display: flex; flex-direction: column; gap: var(--s2); margin-top: var(--s5); }
.journal-protein { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s5); margin-top: var(--s4); }
.journal-protein p { margin: 0; }
.journal-protein-value { font-size: 40px; font-weight: 500; line-height: 1.4; }
.journal-protein-value span { font-size: 18px; color: var(--ink-dim); margin-left: var(--s2); }
.journal-protein-detail { flex: 1; min-width: 160px; }
.journal-add { margin-block: var(--s5); }
.journal-editor { margin-block: var(--s5); scroll-margin-top: var(--s4); }
.journal-editor h3, .journal-timeline h2 { font-weight: 500; font-size: 22px; margin: 0 0 var(--s4); }
.journal-editor h4 { font-weight: 500; margin: var(--s5) 0 var(--s3); }
.journal-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: var(--s4); }
.journal-field { display: flex; flex-direction: column; gap: var(--s2); min-width: 0; margin-bottom: var(--s4); color: var(--ink-dim); font-size: 13px; }
.journal-field input, .journal-field textarea, .journal-field select { width: 100%; min-width: 0; min-height: var(--s7); padding: var(--s3); background: var(--bg-raised); color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--r-sm); font: 16px/1.5 var(--font-body); }
.journal-field textarea { resize: vertical; }
.journal-toolbar .journal-field { margin: 0; }
.journal-section-head { justify-content: space-between; margin-top: var(--s6); }
.journal-section-head h2 { margin: 0; }
.journal-entry { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: var(--s4); padding-block: var(--s5); border-bottom: 1px solid var(--line); }
.journal-entry-time { color: var(--accent); font-family: var(--font-mono); font-size: 14px; padding-top: var(--s1); }
.journal-entry-time span { display: block; font-family: var(--font-body); font-size: 12px; color: var(--ink-dim); margin-top: var(--s2); }
.journal-entry-body { min-width: 0; }
.journal-entry h3 { font-size: 20px; line-height: 1.4; font-weight: 500; margin: var(--s1) 0 var(--s2); }
.journal-note { white-space: pre-wrap; }
.journal-entry-body p, .journal-entry-body h3, .journal-conflict { overflow-wrap: anywhere; }
.journal-entry .journal-actions { margin-top: var(--s4); }
.journal-checklist { display: grid; gap: var(--s2); margin-top: var(--s3); }
.journal-checklist label { display: flex; align-items: center; gap: var(--s3); min-height: var(--s7); font-size: 15px; }
.journal-checklist input { accent-color: var(--accent); width: 22px; height: 22px; flex-shrink: 0; }
.journal-checklist .check-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.journal-checklist .check-protein { color: var(--ink-dim); }
.journal-checklist .check-half { min-height: var(--s7); }
/* A warm-up in a workout: one tick, no set boxes. */
.warmup-check { display: flex; align-items: center; gap: var(--s3); min-height: var(--s7); cursor: pointer; }
.warmup-check input { accent-color: var(--accent); width: 22px; height: 22px; flex-shrink: 0; margin: 0; }
.warmup-check .workout-head { flex: 1; margin: 0; }
.journal-photos, .journal-draft-photos { display: flex; flex-wrap: wrap; gap: var(--s3); margin-block: var(--s4); }
.journal-photos img, .journal-draft-photos img { display: block; width: 120px; height: 120px; object-fit: cover; border-radius: var(--r-md); background: var(--surface); color: var(--ink-dim); font-size: 12px; }
.journal-draft-photos > div { display: grid; gap: var(--s2); }
.journal-upload { position: relative; cursor: pointer; overflow: hidden; }
.journal-upload input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.journal-upload:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
.journal-check-edit { display: flex; align-items: center; gap: var(--s2); }
.journal-check-edit .journal-field { flex: 1; }
.journal-set-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(60px, .4fr) minmax(60px, .4fr); gap: var(--s2); align-items: start; margin-bottom: var(--s4); }
.journal-set-row .journal-field:first-child { grid-column: 1 / -1; }
.journal-set-row .ghost { grid-column: 3; }
.journal-attention { color: var(--alert); }
.journal-conflict { border: 1px solid var(--alert); padding: var(--s4); border-radius: var(--r-md); margin-block: var(--s4); }
.journal-conflict button { margin: var(--s2) var(--s2) 0 0; }
.journal-settings, .journal-calendar, .journal-routine { margin-block: var(--s5); }
.journal-legacy { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--s3); padding-block: var(--s3); }
@media (max-width: 380px) {
  .journal-focus, .journal-protein, .journal-editor { padding: var(--s4); }
  .journal-entry { grid-template-columns: minmax(0, 1fr); gap: var(--s2); }
  .journal-entry-time { display: flex; align-items: baseline; gap: var(--s3); }
}

/* The default Day surface is a glanceable agenda; detail is opt-in. */
.journal-timeline { margin-top: var(--s4); }
.agenda-group { margin-block: var(--s5); }
.agenda-group > h2, .agenda-summary > h2 { margin: 0 0 var(--s2); font-size: 12px; font-weight: 600; }
.agenda-now { padding: var(--s4); border: 1px solid var(--glass-edge); border-radius: var(--r-lg); background: var(--glass); box-shadow: var(--glass-shadow); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); }
.agenda-open h3 { font-size: 24px; font-weight: 500; margin: var(--s2) 0; }
.agenda-open p { margin: 0; }
.journal-entry { display: block; padding: 0; }
.journal-entry-summary { display: grid; grid-template-columns: 64px minmax(0, 1fr) 20px; align-items: center; gap: var(--s3); padding-block: var(--s4); }
.journal-entry-summary::after { justify-self: center; margin: 0; }
.journal-entry-heading { display: flex; flex-direction: column; gap: var(--s1); min-width: 0; }
.journal-entry-title { font-size: 18px; line-height: 1.4; overflow-wrap: anywhere; }
.journal-entry-summary .journal-entry-time { display: block; padding: 0; font-size: 13px; }
.journal-entry-body { padding: var(--s2) 0 var(--s4); }
.agenda-now .journal-entry:last-child { border-bottom: 0; }
.journal-tools { margin-block: 0 var(--s5); }
.journal-status[hidden] { display: none; }
body:not([data-view='today']) :is(.day-insights, #log-fab) { display: none; }
.agenda-empty { margin-block: var(--s5); }
@media (max-width: 380px) {
  .journal-entry-summary { grid-template-columns: 64px minmax(0, 1fr) 16px; gap: var(--s2); }
  .journal-entry-summary .journal-entry-time { font-size: 12px; }
}

.agenda-summary > h2 { margin: 0; flex: 1; }

/* Weekly routine editor shares agenda tokens and touch targets. */
.routine-fields { border: 0; padding: 0; margin: 0; min-width: 0; }
.routine-week { display: flex; flex-wrap: wrap; gap: var(--s2); margin-block: var(--s3); }
.routine-extras { display: grid; gap: var(--s2); margin-block: var(--s3); }
.routine-week label { display: flex; align-items: center; gap: var(--s2); min-height: var(--s7); padding-inline: var(--s2); }
.routine-week input { accent-color: var(--accent); width: 22px; height: 22px; }

/* Daily, Library and Settings are peer pages with persistent bottom navigation. */
#daily-journal-host .journal-tools { display: none; }
#planning-host .agenda-protein, #planning-host .journal-tools > summary { display: none; }
#planning-host .journal-tools { border-top: 0; margin-top: 0; }
.settings-page { width: 100%; min-width: 0; padding-bottom: var(--s4); }
.settings-page [data-oura-diagnostic] { scroll-margin-bottom: calc(var(--s8) + var(--s7)); }

/* Manual measurements: a quiet first step, with expanded fields only on request. */
#morning-check[hidden] { display: none; }
.measurement-check { min-width: 0; margin-bottom: var(--s4); }
#morning-check > .measurement-check { background: var(--glass); border: 1px solid var(--glass-edge); border-radius: var(--r-lg); padding: var(--s3) var(--s4); }
.measurement-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
.measurement-check input,.measurement-check select { min-width: 0; max-width: 100%; width: 100%; min-height: var(--s7); }
.measurement-confirm { display: flex; align-items: center; gap: var(--s3); min-height: var(--s7); }
.measurement-confirm input { width: var(--s4); min-height: var(--s4); flex-shrink: 0; }
.measurement-check h3 { margin: 0; }
.measurement-check .lbl { margin-bottom: var(--s3); }
.measurement-points { display: grid; gap: var(--s3); }
@media (min-width: 720px) { .measurement-points { grid-template-columns: repeat(2,minmax(0,1fr)); } }

/* ===== Design system components (October 2026) =====
 * One look per role, so structure reads the same on every page:
 * - Section label (.section-head, small caps): never interactive.
 * - Card title (.panel-title): names a card; never interactive.
 * - Disclosure (any <details>): a chevron on the right that turns when open.
 * - Link row (.link-row): goes somewhere else; a right-pointing chevron.
 * - Status row (.status-row): information only; a colored dot, no chevron.
 * - Buttons: .btn (one filled primary per view), .ghost (outlined), .text-btn (quiet). */
summary { display: flex; align-items: center; gap: var(--s3); min-height: var(--s7); list-style: none; cursor: pointer; }
summary::-webkit-details-marker { display: none; }
summary::after, .link-row::after, .editcard-head::after {
  content: ''; flex: none; width: 8px; height: 8px; margin: 0 var(--s1) 3px auto;
  border-right: 2px solid var(--ink-faint); border-bottom: 2px solid var(--ink-faint);
  transform: rotate(45deg); transition: transform .2s var(--ease);
}
details[open] > summary::after, .editcard-head[aria-expanded='true']::after { transform: rotate(-135deg); margin-bottom: -3px; }
.link-row::after { transform: rotate(-45deg); margin-bottom: 0; }
summary:hover::after, .link-row:hover::after { border-color: var(--ink-dim); }
.summary-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.summary-title { color: var(--ink); font-size: 16px; font-weight: 500; line-height: 1.4; }
.summary-main .sub { display: block; }

/* Cards: the main translucent container. Rows inside use spacing and hairlines, not nested glass. */
.panel { margin-bottom: var(--s4); padding: var(--s4) var(--s5); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: var(--s7); }
.panel-title { margin: 0; font-size: 20px; font-weight: 500; line-height: 1.3; letter-spacing: -.02em; }
.panel > .note:first-of-type, .panel-head + .note, .panel-head + .sub { margin-top: 0; }
.rows > * + * { border-top: 1px solid var(--line); }
.rows > details[open] { padding-bottom: var(--s4); }
.rows > details > summary { padding-block: var(--s3); }
.disclosure { background: var(--glass-quiet); border: 1px solid var(--inset-edge); border-radius: var(--r-lg); padding: 0 var(--s4); margin-bottom: var(--s3); }
.disclosure > summary { padding-block: var(--s3); }
.disclosure[open] { padding-bottom: var(--s4); }
.disclosure[open] > summary { margin-bottom: var(--s2); }
.status-row { display: flex; align-items: center; gap: var(--s3); min-height: 56px; padding-block: var(--s3); }
.status-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--ink-faint); opacity: .6; }
.status-dot.is-ok { background: var(--positive); opacity: 1; }
.status-dot.is-warn { background: var(--gold); opacity: 1; }
.status-dot.is-alert { background: var(--alert); opacity: 1; }
summary .status-dot { order: -1; }
.link-row { display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: 56px; padding: var(--s3) 0; border: 0; background: transparent; color: var(--ink); font-size: 16px; text-align: left; text-decoration: none; }
.text-btn { display: inline-flex; align-items: center; min-height: 44px; padding: var(--s2) 0; border: 0; background: transparent; color: var(--accent-ink); font-size: 14px; font-weight: 600; text-decoration: none; }
.text-btn:hover { text-decoration: underline; text-underline-offset: 4px; }
.text-btn.is-danger { color: var(--alert); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); margin-top: var(--s3); }
.actions > .ghost, .actions > .btn { margin-top: 0; }
.actions > .btn { width: auto; }
.section-label { margin: var(--s5) 0 var(--s3); }
.page-intro { margin: calc(-1 * var(--s3)) 0 var(--s5); }

/* Daily: sleep is one card whose header is the disclosure. */
.day-insights { margin-bottom: var(--s4); }
.day-insights > summary .summary-title, .insights-section > summary .summary-title { font-size: 20px; letter-spacing: -.02em; }
.day-insights[open] > summary, .insights-section[open] > summary { margin-bottom: var(--s2); }
.day-insights .oura-card { background: none; border: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; padding: 0; }
.day-insights .oura-sleep { margin-top: var(--s2); }
.day-insights .checkin { margin: var(--s4) 0 0; }
.oura-metrics { gap: var(--s3); padding: 0; border: 0; }
.oura-metrics > div { padding: var(--s3) var(--s4); border-radius: var(--r-md); background: var(--glass-quiet); border: 1px solid var(--inset-edge); }
.oura-metrics dd { font-size: 22px; }
.checkin { border-color: var(--inset-edge); }
.checkin-edit { color: var(--accent-ink); font-weight: 600; font-size: 14px; }
#morning-check > .measurement-check { padding: 0 var(--s5); border-radius: var(--r-xl); box-shadow: var(--glass-shadow); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); }
#morning-check > .measurement-check > summary { min-height: 64px; }
#morning-check > .measurement-check[open] { padding-bottom: var(--s4); }
.measurement-check .disclosure { margin-top: var(--s2); }

.editcard-head .kicker { margin-left: auto; }
.editcard-head::after { margin-left: var(--s2); }
/* A width class sizes a field but never pushes it past its label. */
.lbl > :is(input, select) { max-width: 100%; }
/* A checkbox with its label beside it: the whole label is the target. */
.check-label { display: inline-flex; align-items: center; gap: var(--s2); min-height: 44px; font-size: 15px; color: var(--ink); cursor: pointer; }

/* Library → Training: each exercise is a compact block. Name, then
 * Sets / Reps / Load (Load takes its own line when the row is narrow), then flags. */
.workout-editor .section-head { margin: var(--s5) 0 var(--s2); }
.workout-editor .fieldrow > .lbl { flex-basis: 150px; }
.exercise-list { list-style: none; margin: 0; padding: 0; }
.exercise-edit { padding-block: var(--s4); }
.exercise-edit:first-child { padding-top: var(--s2); }
.exercise-metrics { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s3); }
.exercise-metrics > .lbl { flex: 1 1 72px; }
.exercise-metrics > .lbl:nth-child(2) { flex: 1 1 96px; }
.exercise-metrics > .lbl:nth-child(3) { flex: 2 1 140px; }
.exercise-flags { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--s4); margin-top: var(--s2); }
.exercise-flags .text-btn { margin-left: auto; }
.workout-editor .actions { margin-top: var(--s3); }
.progress-list, .supp-list { list-style: none; margin: 0; padding: 0; }
.progress-row { display: flex; align-items: flex-start; gap: var(--s3); padding-block: var(--s3); }
.progress-row .pill { flex: none; margin-top: 2px; }

/* Library → Supplements: a reference list by time of day; editing opens in place. */
.supp-row { padding-block: var(--s3); }
.supp-row-line { display: flex; align-items: flex-start; gap: var(--s3); }
.supp-row-line .text-btn { flex: none; min-height: 44px; padding-block: 0; }
.supp-row .row-title { display: block; overflow-wrap: anywhere; }
.supp-edit { display: grid; gap: var(--s3); margin-top: var(--s3); padding: var(--s4); border-radius: var(--r-lg); background: var(--glass-quiet); border: 1px solid var(--inset-edge); }
.supp-edit .fieldrow + .fieldrow { margin-top: 0; }
.supp-edit .actions { margin-top: 0; }
.supp-manage .rows > details > summary { min-height: 56px; }
.supp-manage .supp-row-past:first-child { padding-top: 0; }
.supp-sequence { margin-top: var(--s3); }
@media (max-width: 379px) {
  .library-content .panel { padding-inline: var(--s4); }
  .workout-editor, .supp-edit { padding: var(--s3); }
}
.list-row { display: flex; align-items: center; gap: var(--s3); }
.list-row > .row { flex: 1; border-bottom: 0; }
#planning-host .journal-timeline { margin-top: 0; }
.planning-only { display: none; }
#planning-host .planning-only { display: block; }

/* Settings: grouped cards instead of stacked full-width buttons. */
.settings-page .page-title { margin-bottom: var(--s5); }
.settings-page .setrow { margin: 0; min-height: 64px; border: 0; border-radius: 0; background: transparent; padding: var(--s3) 0; }
.settings-page .privacy-link { margin-right: var(--s4); }
.rows .measurement-check { margin: 0; }
.settings-page .rows > .setrow + .setrow { border-top: 1px solid var(--line); }
.panel .editcard:last-of-type, .panel > .ghost-block:last-child { margin-bottom: 0; }
.panel-title .sub { margin-left: var(--s1); font-size: 14px; }

/* Quick capture: photo and voice first; typed details are optional. */
.capture-btn > svg { flex: none; color: var(--accent-ink); }
.quick-capture { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); margin-bottom: var(--s3); }
.capture-btn { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s2); min-height: 96px; padding: var(--s3); border: 1px solid var(--inset-edge); border-radius: var(--r-lg); background: var(--glass-quiet); color: var(--ink); font-size: 15px; font-weight: 500; cursor: pointer; overflow: hidden; }
.capture-btn > svg { width: 26px; height: 26px; }
.capture-btn input[type='file'] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.capture-btn:focus-within { outline: 3px solid var(--accent); outline-offset: 4px; }
.capture-btn.is-recording { border-color: var(--alert); color: var(--alert); background: color-mix(in srgb, var(--alert) 10%, transparent); }
.capture-btn.is-recording > svg { color: var(--alert); }
.capture-primary { flex-direction: row; min-height: 64px; width: 100%; margin-bottom: var(--s2); border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.measurement-check .photo-picker { margin-bottom: var(--s3); }
.measurement-check .photo-picker .capture-btn:not(.capture-primary) { flex-direction: row; min-height: var(--s7); }
.photo-picker-primary .capture-primary { margin-bottom: 0; }
.journal-audio { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s3); margin-block: var(--s3); }
.journal-audio audio { width: 100%; max-width: 360px; height: var(--s7); color-scheme: dark; }
.journal-suggestion { margin-block: var(--s3); padding: var(--s4); border-radius: var(--r-md); background: color-mix(in srgb, var(--accent) 8%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.journal-suggestion p { margin: var(--s2) 0 0; }
.journal-suggestion .journal-actions { margin-top: var(--s3); }
.quick-meal .journal-actions { margin-top: var(--s4); }
.quick-meal .journal-actions .btn { width: auto; margin-top: 0; flex: 1 1 160px; }
input.is-filled { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.measurement-more { margin-top: var(--s4); }

/* Off-routine logging: a floating button above the navigation, bottom right. */
#log-fab { position: fixed; z-index: 21; right: max(var(--s4), env(safe-area-inset-right)); bottom: calc(96px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: flex-end; gap: var(--s2); }
body:has(.log-sheet) #log-fab, body.dialog-open #log-fab { display: none; }
.log-fab-toggle { width: 56px; height: 56px; border-radius: 50%; border: 1px solid var(--glass-edge); background: color-mix(in srgb, var(--scene-accent) 70%, var(--ink)); color: var(--on-accent); box-shadow: var(--glass-shadow), 0 8px 24px #00000066; display: grid; place-items: center; cursor: pointer; transition: transform .2s var(--ease); }
#log-fab.is-open .log-fab-toggle { transform: rotate(45deg); }
.log-fab-menu { display: flex; flex-direction: column; align-items: flex-end; gap: var(--s2); }
.log-fab-menu[hidden] { display: none; }
.log-fab-menu button { min-height: var(--s7); padding: var(--s2) var(--s4); border-radius: var(--r-pill); border: 1px solid var(--glass-edge); background: color-mix(in srgb, var(--bg-raised) 88%, transparent); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); color: var(--ink); font-size: 15px; font-weight: 500; box-shadow: var(--glass-shadow); }
@media (min-width: 1024px) { #log-fab { right: max(var(--s6), calc((100vw - 1200px) / 2)); } }

/* Unplanned entries open as a sheet; routine entries open inside their row. */
.log-sheet { position: fixed; z-index: 22; left: max(var(--s3), env(safe-area-inset-left)); right: max(var(--s3), env(safe-area-inset-right)); bottom: calc(88px + env(safe-area-inset-bottom)); max-width: 640px; margin-inline: auto; max-height: calc(100dvh - 120px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; border-radius: var(--r-xl); animation: rise var(--rise) var(--ease) both; }
.log-sheet > .journal-editor { margin: 0; background: var(--bg-raised); box-shadow: 0 -12px 48px #000000b3, inset 0 1px 0 #ffffff24; }
.journal-entry.is-editing > .journal-entry-body > .journal-editor { margin-block: var(--s2) var(--s4); }
.photo-picker { position: relative; display: grid; }
.photo-choice { position: absolute; z-index: 2; top: calc(100% + var(--s2)); left: 0; right: 0; display: grid; gap: 2px; padding: var(--s1); border-radius: var(--r-lg); border: 1px solid var(--glass-edge); background: var(--bg-raised); box-shadow: var(--glass-shadow); }
.photo-choice[hidden] { display: none; }
.choice-option { position: relative; display: flex; align-items: center; min-height: var(--s7); padding: var(--s2) var(--s4); border-radius: var(--r-md); color: var(--ink); font-size: 15px; cursor: pointer; }
.choice-option:hover, .choice-option:focus-within { background: var(--glass-quiet); }
.choice-option input[type='file'] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.quick-capture-single { grid-template-columns: 1fr; }
.quick-capture-single .capture-btn { flex-direction: row; min-height: 64px; }

/* Effort: a 1-10 tap scale. Exercise type: single-choice chips. */
.effort-scale, .choice-chips { border: 0; padding: 0; margin: 0 0 var(--s4); min-width: 0; }
.effort-scale legend, .choice-chips legend { padding: 0; margin-bottom: var(--s2); color: var(--ink-dim); font-size: 13px; }
.effort-options { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: var(--s1); }
.effort-options label, .choice-chips label { position: relative; display: grid; place-items: center; min-height: var(--s7); border-radius: var(--r-sm); border: 1px solid var(--line-strong); color: var(--ink-dim); font-size: 15px; cursor: pointer; }
.effort-options input, .choice-chips input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.effort-options label:has(input:checked), .choice-chips label:has(input:checked) { background: var(--accent); border-color: transparent; color: var(--on-accent); font-weight: 600; }
.effort-options label:has(input:focus-visible), .choice-chips label:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.effort-labels { display: flex; justify-content: space-between; margin-top: var(--s1); }
.choice-chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.choice-chips legend { width: 100%; }
.choice-chips label { padding-inline: var(--s4); border-radius: var(--r-pill); }
.other-name { display: none; }
.choice-chips:has(input[value='Other']:checked) + .other-name { display: grid; }
.journal-takeaway { margin: var(--s3) 0; font-size: 15px; }
.journal-takeaway .kicker { margin-right: var(--s2); }
@media (max-width: 379px) { .effort-options { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.journal-recover { margin-block: var(--s3) var(--s4); }
.journal-recover p { margin: 0; }
.journal-recover .journal-actions { margin-top: var(--s3); }

/* Morning readings: one row per measurement with its own unit and time.
 * Phones: name and unit on top, value and time below. 480px+: one line each. */
.reading-rows { display: grid; gap: var(--s2); margin: var(--s3) 0 var(--s2); min-width: 0; }
.reading-head { display: none; }
.reading-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "name unit" "value time"; align-items: center; gap: var(--s2) var(--s3); padding: var(--s3); border-radius: var(--r-md); background: var(--glass-quiet); border: 1px solid var(--inset-edge); min-width: 0; }
.reading-name { grid-area: name; font-weight: 500; line-height: 1.3; }
.reading-name .sub { font-weight: 400; }
.reading-row > input:not([type='time']) { grid-area: value; }
.reading-row > input[type='time'] { grid-area: time; }
.reading-row > select, .reading-row > .reading-unit { grid-area: unit; justify-self: end; }
.reading-row input, .reading-row select { width: 100%; margin: 0; min-width: 0; min-height: var(--s7); padding-inline: var(--s3); }
.reading-row > .reading-low { grid-column: 1 / -1; min-height: var(--s6, 40px); font-size: 14px; }
.reading-row .reading-low input { width: var(--s4); min-height: var(--s4); padding: 0; }
.reading-row select { width: auto; min-width: 7.5em; }
.reading-unit { color: var(--ink-dim); font-size: 14px; }
@media (min-width: 480px) {
  .reading-head { display: grid; font-size: 12px; padding-inline: var(--s3); }
  .reading-head, .reading-row { grid-template-columns: minmax(80px, 1fr) minmax(72px, 1fr) minmax(108px, auto) minmax(120px, auto); grid-template-areas: "name value unit time"; gap: var(--s3); }
  .reading-head > span:nth-child(3) { justify-self: start; }
  .reading-row > select, .reading-row > .reading-unit { justify-self: start; }
}
/* Daily keeps room below the last control for the floating + button. */
body[data-view='today'] #app { padding-bottom: calc(176px + env(safe-area-inset-bottom)); }
/* Buttons sharing an action row align on one line; outlined buttons drop their
 * standalone top margin there, matching filled and small buttons. */
:is(.journal-actions, .journal-add, .journal-toolbar, .actions, .modal-actions, .stack) > :is(.ghost, .mini) { margin-top: 0; }
.settings-notif-status { margin: 0; padding-block: var(--s3); }
.journal-entry-time.is-planned { color: var(--ink-faint); }
/* Logged rows: a green check before the title and a light green tint; skipped: a dash, dimmed. */
.entry-mark { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: var(--s2); border-radius: 50%; vertical-align: -3px; flex: none; }
.entry-mark.is-done { background: var(--positive); color: var(--on-accent); }
.entry-mark.is-skipped { border: 1px solid var(--ink-faint); color: var(--ink-dim); font-size: 13px; line-height: 1; }
.journal-entry.journal-done { background: color-mix(in srgb, var(--positive) 15%, transparent); border-radius: var(--r-md); border-bottom-color: transparent; margin-block: var(--s1); padding-inline: var(--s3); margin-inline: calc(var(--s3) * -1); }
.journal-entry.journal-skipped .journal-entry-heading, .journal-entry.journal-skipped .journal-entry-time { opacity: .6; }

/* Push back: +15/+30/+60 chips under a planned row; the Undo bar sits above the agenda. */
.push-choice, .switch-choice { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s3); }
.push-choice[hidden], .switch-choice[hidden] { display: none; }
.push-note { display: block; margin-top: 2px; font-size: 13px; color: var(--accent); }
.push-note .text-btn { font-size: 13px; padding: 0; min-height: 0; }

/* Agenda day switcher: ‹ date › with the native picker under the date. */
.day-nav { display: flex; align-items: center; gap: var(--s2); margin-block: var(--s2) var(--s3); }
.day-nav-step { min-width: var(--s7); font-size: 20px; line-height: 1; }
.day-nav-date { position: relative; flex: 1; text-align: center; font-weight: 600; color: var(--ink); }
.day-nav-date input { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0; border: 0; opacity: 0; cursor: pointer; }
.day-nav-date:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-md); }

/* Tap a logged photo to see it full screen. */
.photo-thumb { padding: 0; border: 0; background: none; border-radius: var(--r-md); cursor: zoom-in; }
.photo-thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.photo-viewer { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: #000000f5; touch-action: pan-y; animation: photo-fade 160ms ease-out both; }
@keyframes photo-fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .photo-viewer { animation: none; } }

/* Still working (reading a voice note or photo): the three dots pulse in turn. */
.working-dots span { animation: working-dot 1.2s infinite ease-in-out both; }
.working-dots span:nth-child(2) { animation-delay: .2s; }
.working-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes working-dot { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .working-dots span { animation-duration: 2.4s; } }
.photo-viewer:focus { outline: none; } /* The whole screen is the dialog; focus lands on it so keyboard users can press Escape. */
.photo-viewer img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.photo-viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); width: var(--s7); height: var(--s7); border: 1px solid var(--glass-edge); border-radius: var(--r-pill); background: color-mix(in srgb, var(--bg) 55%, transparent); color: var(--ink); font-size: 24px; }
.photo-viewer-nav.prev { left: max(var(--s3), env(safe-area-inset-left)); }
.photo-viewer-nav.next { right: max(var(--s3), env(safe-area-inset-right)); }
.photo-viewer-count { position: absolute; bottom: max(var(--s4), env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; }
#planning-host .day-nav { display: none; }

/* Insights → Meals: one row per day, photo cards in a grid. */
.insights-page { display: grid; gap: var(--s4); }
.meal-day + .meal-day { margin-top: var(--s5); padding-top: var(--s4); border-top: 1px solid var(--glass-edge); }
.meal-day-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s1) var(--s3); margin-bottom: var(--s3); }
.meal-day-title { margin: 0; font-size: 17px; font-weight: 600; }
.meal-day-head .text-btn { margin-left: auto; }
.meal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--s3); }
.meal-card { min-width: 0; }
.meal-card-photo { position: relative; display: block; width: 100%; aspect-ratio: 1; overflow: hidden; border-radius: var(--r-md); background: var(--surface); }
.meal-card-photo img { display: block; width: 100%; height: 100%; object-fit: cover; color: var(--ink-dim); font-size: 12px; }
.meal-card-photo.meal-card-nophoto { aspect-ratio: auto; min-height: var(--s8); }
.meal-card-nophoto { display: flex; align-items: center; justify-content: center; color: var(--ink-dim); font-size: 13px; }
.meal-card-more { position: absolute; right: var(--s2); bottom: var(--s2); padding: 2px var(--s2); border-radius: var(--r-pill); background: #000000a6; color: #fff; font-size: 12px; }
.meal-card-title { margin: var(--s2) 0 0; font-weight: 500; overflow-wrap: anywhere; }
.meal-card .sub { margin: 2px 0 0; }
.insights-more, .readings-more { margin-top: var(--s4); }
/* Insights → Readings: a card per day (its first session at a glance); open it for every session. */
.reading-day > summary { min-height: var(--s7); cursor: pointer; list-style: none; }
.reading-day .editcard-body { margin-top: var(--s2); }
.reading-session + .reading-session { margin-top: var(--s4); }
.reading-session > .kicker { margin: 0; }
.reading-trends { margin-bottom: var(--s4); }
.reading-trends > .kicker, .reading-days-head { margin: 0 0 var(--s1); }
.lab-row.trend-glucose { --lab-tone: var(--reading-glucose); }
.lab-row.trend-ketone { --lab-tone: var(--reading-ketone); }
.lab-row.trend-lactate { --lab-tone: var(--reading-lactate); }
.lab-row.trend-bed { --lab-tone: var(--mo-rest); }
.lab-row.trend-up { --lab-tone: var(--mo-rise); }
.lab-row.trend-linger { --lab-tone: var(--mo-move); }
.sleep-trends { margin: var(--s3) 0; }
.up-check { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); margin: 0 0 var(--s4); padding: var(--s3) var(--s4); border: 1px solid var(--glass-edge); border-radius: var(--r-lg); background: var(--glass-quiet); }
.up-check.is-set .checkin-dot { background: var(--accent); }
.up-check .up-now { flex: none; width: auto; margin: 0; } /* .btn's top margin would sit it below the note */
.up-check > .sub { margin: 0; }
.journal-entry.is-running { border-color: var(--accent); }
.journal-entry.is-running .journal-entry-heading .sub { color: var(--accent); }
.run-actions { margin-top: var(--s2); }
.up-check.is-editing .journal-field { flex: 1 1 160px; margin: 0; }
.trend-notes { list-style: none; margin: var(--s2) 0 0; padding: 0; display: grid; gap: var(--s2); }
.trend-notes li { display: grid; gap: 2px; padding-left: var(--s3); border-left: 2px solid var(--lab-tone); }
.reading-note { margin: var(--s1) 0 0; padding-left: var(--s3); border-left: 2px solid var(--accent); color: var(--ink); white-space: pre-line; }
.reading-note-form { display: grid; gap: var(--s2); justify-items: start; margin-top: var(--s3); }
.reading-note-form .lbl { width: 100%; }
.reading-list { list-style: none; margin: 0; padding: 0; }
.reading-entry { padding-block: var(--s3); }
.reading-entry p { margin: 0; }
.reading-entry-value { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--s2); }
.reading-entry-kind { color: var(--ink-dim); font-size: 15px; }
.reading-entry-value strong { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.reading-entry-unit { color: var(--ink-dim); font-size: 14px; }
.reading-entry .sub { margin-top: 2px; overflow-wrap: anywhere; }

/* Another day's readings on Daily: one line each, read-only. */
.day-reading { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); padding-block: var(--s2); }
.day-reading + .day-reading { border-top: 1px solid var(--glass-edge); }
.day-reading .sub { text-align: right; }
.measurement-check .day-readings-list { margin: var(--s2) 0; }
p.checkin-static { margin: 0; cursor: default; }
.day-nav { flex-wrap: wrap; }
.day-nav .text-btn { flex: 1 0 100%; min-height: 44px; justify-content: center; text-align: center; }

/* Goals → Sleep consistency: one row per measure, streak on the right. */
.sleep-metric { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding-block: var(--s3); }
.sleep-metric + .sleep-metric { border-top: 1px solid var(--glass-edge); }
.sleep-streak { display: flex; flex-direction: column; align-items: flex-end; flex: none; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sleep-streak .sub { font-size: 12px; font-weight: 400; }

/* Tracked workout in the log sheet: one block per exercise, a box per set. */
.workout { border: 0; padding: 0; margin: 0 0 var(--s4); min-width: 0; }
.workout legend { font-weight: 600; font-size: 17px; margin-bottom: var(--s2); }
.workout-exercise { padding-block: var(--s3); border-top: 1px solid var(--glass-edge); }
.workout-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s1) var(--s3); }
.workout-exercise > .sub { margin: var(--s1) 0 var(--s2); }
.workout-ready { margin: 0 0 var(--s2); color: var(--accent); font-weight: 500; }
.workout-sets { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: var(--s2); margin-top: var(--s2); }
.workout-sets label { display: grid; gap: 2px; font-size: 12px; color: var(--ink-dim); }
.workout-sets input { width: 100%; min-width: 0; text-align: center; font-size: 18px; font-variant-numeric: tabular-nums; }
.workout-sets input { -moz-appearance: textfield; appearance: textfield; }
.workout-sets input::-webkit-inner-spin-button, .workout-sets input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* Insights → Lab trends: a row per marker with a sparkline; open for the full chart. */
.lab-row { border-top: 1px solid var(--glass-edge); --lab-tone: var(--accent); }
.lab-row.lab-high, .lab-row.lab-low { --lab-tone: var(--alert, #e0896f); }
.lab-row > summary { display: flex; align-items: center; gap: var(--s3); padding-block: var(--s3); cursor: pointer; list-style: none; }
.lab-row > summary::-webkit-details-marker { display: none; }
.lab-row-main { display: grid; gap: 2px; flex: 1; min-width: 0; }
.lab-row-name { font-weight: 600; }
.lab-row-value { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--s2); color: var(--ink-dim); }
.lab-row-value strong { font-size: 20px; color: var(--ink); font-variant-numeric: tabular-nums; }
.lab-pill { display: inline-block; padding: 1px var(--s2); border-radius: var(--r-pill); font-size: 12px; background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--ink); }
.lab-pill-high, .lab-pill-low { background: color-mix(in srgb, var(--alert, #e0896f) 26%, transparent); }
.lab-chart { color: var(--lab-tone); overflow: visible; }
.lab-chart-compact { flex: none; width: 96px; height: 36px; }
.lab-detail .lab-chart { width: 100%; height: auto; max-width: 440px; display: block; margin: var(--s2) 0; }
.lab-band { fill: color-mix(in srgb, var(--ink) 7%, transparent); }
.lab-goal { stroke: var(--ink-dim); stroke-width: 1; stroke-dasharray: 4 4; }
.lab-goal-label, .lab-date { fill: var(--ink-dim); font-size: 10px; }
.lab-value { fill: var(--ink); font-size: 11px; font-weight: 600; paint-order: stroke; stroke: var(--bg-raised, #1b1d1f); stroke-width: 3px; stroke-linejoin: round; }
.lab-end { fill: var(--ink-faint); font-size: 10px; }
.lab-line { fill: none; stroke: currentColor; stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; }
.lab-chart-compact .lab-line { stroke-width: 1.75; }
.lab-dot { fill: var(--bg-raised, #1b1d1f); stroke: currentColor; stroke-width: 2; }
.lab-dot.is-active { fill: currentColor; stroke-width: 4; }
.lab-hit { fill: transparent; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.lab-grid { stroke: var(--glass-edge); stroke-width: 1; }
.lab-tick { fill: var(--ink-faint); font-size: 9.5px; font-variant-numeric: tabular-nums; }
.lab-band-label { fill: var(--ink-faint); font-size: 9.5px; }
.lab-band-ok { fill: color-mix(in srgb, var(--positive) 12%, transparent); }
.lab-strip-ok { fill: var(--positive); }
.lab-strip-out { fill: var(--alert, #e0896f); opacity: .55; }
.lab-grid-edge { stroke: color-mix(in srgb, var(--positive) 45%, transparent); stroke-dasharray: 3 3; }
.lab-tick-edge { fill: var(--positive); font-weight: 600; }
.lab-tick-goal { fill: var(--ink); font-weight: 600; }
.lab-tick-goal-word { fill: var(--ink-dim); font-size: 9px; text-transform: uppercase; letter-spacing: .04em; }
.lab-detail, .mob-bench-body { position: relative; }
/* Tapped point: its day, value and any note, floating beside it. */
.chart-tip { position: absolute; z-index: 5; display: grid; gap: 1px; max-width: 220px; padding: var(--s2) var(--s3); border-radius: var(--r-md); background: var(--bg-raised, #1b1d1f); border: 1px solid var(--glass-edge); box-shadow: 0 6px 20px rgb(0 0 0 / .35); color: var(--ink-dim); font-size: 12px; pointer-events: none; }
.chart-tip strong { color: var(--ink); font-size: 15px; font-variant-numeric: tabular-nums; }
.chart-tip-note { color: var(--ink); margin-top: 2px; }
.lab-dot.lab-high, .lab-dot.lab-low { stroke: var(--alert, #e0896f); fill: var(--alert, #e0896f); }
.lab-detail { padding-bottom: var(--s3); }
.lab-points { list-style: none; margin: var(--s2) 0; padding: 0; display: grid; gap: var(--s2); }
.lab-points li { display: grid; grid-template-columns: 1fr auto; gap: 2px var(--s3); align-items: baseline; }
.lab-points li .sub { grid-column: 1 / -1; }

/* Lab categories: a disclosure each, like a lab portal's sections. */
.lab-category { border-top: 1px solid var(--glass-edge); }
.lab-category > summary { padding-block: var(--s3); }
.lab-category[open] > summary { padding-bottom: var(--s2); }
.lab-category .lab-row { margin-left: var(--s3); }
.lab-once-head { margin: var(--s3) 0 0 var(--s3); }

/* Mobility sessions in the log sheet: block line, 1-5 ratings, phase headings, hold timers. */
.mobility-block { margin: 0 0 var(--s3); }
.mobility-ratings { display: grid; gap: var(--s2); }
.rating-chips { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--s2); margin-bottom: var(--s2); }
.rating-chips label { padding-inline: 0; }
.rating-ends { grid-column: 1 / -1; display: flex; justify-content: space-between; font-size: 12px; }
.mobility-eased, .mobility-due { margin: 0 0 var(--s3); padding: var(--s3) var(--s4); border-radius: var(--r-md); background: var(--glass-quiet); border: 1px solid var(--inset-edge); }
.mobility-eased { color: var(--positive); }
.mobility-stall { margin: 0 0 var(--s3); color: var(--gold); }
.workout-phase { margin: var(--s4) 0 0; }
.workout-sets label:has(.hold-start) { grid-template-columns: 1fr auto; align-items: center; }
.workout-sets label:has(.hold-start) > input { margin: 0; }
.workout-sets label:has(.hold-start) > span { grid-column: 1 / -1; }
.hold-start { min-width: 44px; min-height: 44px; border-radius: var(--r-pill); border: 1px solid var(--line-strong); background: transparent; color: var(--accent); font-size: 15px; }
.hold-start:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.workout-exercise:has(.hold-start) .workout-sets { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); }
.hold-timer { margin-top: var(--s3); padding: var(--s4); border-radius: var(--r-md); background: var(--glass-quiet); border: 1px solid var(--inset-edge); text-align: center; }
.hold-timer p { margin: 0; }
.hold-timer-label { color: var(--ink-dim); font-size: 15px; }
.hold-timer-clock { font-size: 44px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; color: var(--accent); }

/* Library → Training → Mobility program and Insights → Training this week. */
.mobility-status { margin: 0 0 var(--s1); }
.mob-bench { border-top: 1px solid var(--glass-edge); }
.mob-bench > summary { display: flex; align-items: center; gap: var(--s3); padding-block: var(--s3); min-height: var(--s7); cursor: pointer; }
.mob-bench-body { padding-bottom: var(--s3); }
.mob-bench-body .lab-chart { max-width: 440px; width: 100%; height: auto; }
.mob-results { list-style: none; margin: var(--s2) 0 0; padding: 0; }
.mob-results li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s1) var(--s3); padding-block: var(--s2); border-top: 1px solid var(--glass-edge); }
.mob-change.is-better { color: var(--positive); }
.mob-change.is-worse { color: var(--alert); }
.mob-tests { margin-top: var(--s3); }
.mob-test-form .lbl { margin-top: var(--s3); }
.mob-test-form .sub { margin: var(--s1) 0 0; }
.mob-bench-edit .fieldrow > .lbl { flex-basis: 120px; }
.mob-bench-edit textarea { width: 100%; }
.tw-sessions { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); margin: 0; font-size: 17px; }
.tw-sessions strong { font-size: 24px; font-variant-numeric: tabular-nums; }
.tw-areas { list-style: none; margin: var(--s3) 0 var(--s4); padding: 0; }
.tw-area { padding-block: var(--s2); }
.tw-area-head { display: flex; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.tw-area .bar { margin: var(--s2) 0 0; }
.bar.is-full > span { background: var(--positive); }
.tw-benchmarks li { display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--s1) var(--s3); padding-block: var(--s2); }
.tw-benchmarks { list-style: none; margin: 0; padding: 0; }
.journal-entry-time .ampm { display: inline; margin: 0; font-family: inherit; font-size: 10px; letter-spacing: .02em; color: inherit; }
.journal-entry-summary .journal-entry-time { white-space: nowrap; }
/* An exercise's guide in the log sheet: a quiet disclosure with the steps and a demo link. */
.how-to { margin: var(--s1) 0 var(--s2); }
.how-to > summary { min-height: 44px; display: flex; align-items: center; color: var(--accent); font-size: 14px; cursor: pointer; }
.how-to > p { margin: 0 0 var(--s2); }
.how-to > .text-btn { min-height: 44px; }
.mob-test-field { padding-block: var(--s2); border-top: 1px solid var(--glass-edge); }
.mob-test-field:first-of-type { border-top: 0; }
.mob-results .mob-note { flex: 1 0 100%; margin: 0; }
.workout-note { margin-top: var(--s2); }
/* Unilateral sets: one row per set under a single Left / Right heading. */
.side-table { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: var(--s2) var(--s3); max-width: 520px; margin-top: var(--s2); }
.side-head { justify-content: center; text-align: center; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-dim); }
.side-set { font-size: 13px; color: var(--ink-dim); white-space: nowrap; }
.side-cell { display: flex; align-items: center; gap: var(--s1); min-width: 0; }
.side-cell input { flex: 1; width: 100%; min-width: 0; text-align: center; font-size: 18px; font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield; }
.side-cell input::-webkit-inner-spin-button, .side-cell input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.side-cell .hold-start { flex: none; }
.side-head > span:first-child { flex: 1; }
.side-spacer { flex: none; width: 44px; }
.hold-timer-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s2); }
.hold-timer-clock.is-over { color: var(--positive); }
.hold-timer-target { margin: 0 0 var(--s2); }
/* The dial: -5/-15 and +5/+15 stacked either side of the time; tapping the time starts it. */
.hold-timer-dial { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--s2); margin: var(--s2) 0; }
.hold-timer-dial > .hold-live { grid-column: 1 / -1; }
.hold-steps { display: grid; gap: var(--s2); }
.hold-step { min-width: 52px; min-height: 44px; font-variant-numeric: tabular-nums; }
.hold-go { display: grid; justify-items: center; padding: var(--s2) var(--s3); min-height: 96px; border-radius: var(--r-md); border: 1px solid var(--accent); background: transparent; color: var(--accent); cursor: pointer; }
.hold-go:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.hold-go:active { background: var(--glass-quiet); }
.hold-go .hold-timer-clock { font-size: 52px; line-height: 1.1; }
.hold-go-hint { font-size: 13px; color: var(--ink-dim); }
.hold-cancel { margin-top: var(--s2); }
.hold-timer [hidden] { display: none !important; }

/* ===== Ask: a chat over everything in Daily OS ===== */
.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; }
.ask-page .drawer-main { display: grid; gap: var(--s4); max-width: 760px; }
.ask-thread { display: grid; gap: var(--s3); }
.ask-msg { max-width: 92%; padding: var(--s3) var(--s4); border-radius: var(--r-lg); line-height: 1.55; font-size: 15px; }
.ask-msg p, .ask-msg ul, .ask-msg ol, .ask-msg .md-h, .ask-msg pre, .ask-msg hr, .ask-msg .md-table { margin: 0; }
.ask-msg > :not(:first-child) { margin-top: var(--s2); }
.ask-msg > .ask-cites { margin-top: var(--s3); }
.ask-msg ul, .ask-msg ol { padding-left: var(--s4); display: grid; gap: var(--s1); }
.ask-msg li > ul, .ask-msg li > ol { margin-top: var(--s1); }
.ask-msg .md-h { font-size: 16px; font-weight: 600; line-height: 1.35; color: var(--ink); }
.ask-msg > .md-h:not(:first-child) { margin-top: var(--s3); }
.ask-msg strong { font-weight: 600; color: var(--ink); }
.ask-msg code { font-family: var(--font-mono, ui-monospace, monospace); font-size: 0.9em; padding: 0 4px; border-radius: 4px; background: var(--glass-quiet); }
.ask-msg pre { overflow-x: auto; padding: var(--s2) var(--s3); border-radius: var(--r-sm, 6px); background: var(--glass-quiet); }
.ask-msg pre code { padding: 0; background: none; }
.ask-msg hr { border: 0; border-top: 1px solid var(--glass-edge); }
.ask-msg a { color: var(--accent); }
.ask-msg .md-table { overflow-x: auto; }
.ask-msg table { border-collapse: collapse; font-size: 14px; min-width: 100%; }
.ask-msg th, .ask-msg td { text-align: left; padding: 4px var(--s2); border-bottom: 1px solid var(--glass-edge); vertical-align: top; }
.ask-msg th { font-weight: 600; }
.ask-msg.is-me { justify-self: end; background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--ink); border-bottom-right-radius: var(--r-sm, 6px); }
.ask-msg.is-app { justify-self: start; background: var(--glass-quiet); border: 1px solid var(--glass-edge); color: var(--ink); border-bottom-left-radius: var(--r-sm, 6px); }
.ask-cites { display: flex; flex-wrap: wrap; gap: var(--s1); margin-top: var(--s3); }
.ask-cite { font-size: 12px; padding: 4px 10px; min-height: 28px; border-radius: var(--r-pill); border: 1px solid var(--glass-edge); background: transparent; color: var(--accent); }
.ask-cite.is-static { color: var(--ink-dim); display: inline-flex; align-items: center; }
.ask-empty { display: grid; gap: var(--s3); }
.ask-suggestions { display: flex; flex-wrap: wrap; gap: var(--s2); }
.ask-suggestions .ghost { text-align: left; }
/* The question box stays in reach above the tab bar. */
.ask-compose { position: sticky; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 5; display: flex; gap: var(--s2); align-items: flex-end; padding: var(--s2); border-radius: var(--r-lg); background: var(--bg-raised, #1b1d1f); border: 1px solid var(--glass-edge); }
.ask-compose textarea { flex: 1; min-height: 48px; max-height: 160px; resize: vertical; margin: 0; }
.ask-compose .ask-send { width: auto; margin: 0; flex: none; }
/* Five tabs: labels stay on one line; padding and type tighten on narrow screens. */
.tab span { white-space: nowrap; }
@media (max-width: 480px) { #tabs .tab { padding-inline: var(--s1); min-width: 0; } }
@media (max-width: 360px) { #tabs .tab { font-size: 11px; } }

/* ===== Weekly reviews (Insights) ===== */
.review { display: grid; gap: var(--s2); }
.review-week { margin: 0; }
.review-headline { font-size: 18px; line-height: 1.45; color: var(--ink); margin: 0 0 var(--s2); }
.review-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: var(--s2); margin-bottom: var(--s2); }
.review-tile { display: grid; gap: 2px; padding: var(--s3); border-radius: var(--r-md); background: var(--glass-quiet); border: 1px solid var(--glass-edge); }
.review-tile strong { font-size: 17px; color: var(--ink); font-variant-numeric: tabular-nums; }
.review .kicker { margin: var(--s3) 0 0; }
.review-body { margin: 0; line-height: 1.6; color: var(--ink); }
.review-suggestions { margin: 0; padding-left: var(--s5); display: grid; gap: var(--s1); line-height: 1.55; }
.review-gaps { display: grid; gap: var(--s2); padding: var(--s3) var(--s4) var(--s4); border-radius: var(--r-md); background: var(--glass-quiet); border: 1px solid var(--glass-edge); }
.review-gaps .kicker { margin: 0; }
.review-gaps > .sub { margin: 0; }
.gap-day { display: grid; gap: var(--s1); padding-top: var(--s2); border-top: 1px solid var(--glass-edge); }
.gap-day-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); color: var(--ink); }
.gap-day .sub { margin: 0; }
.gap-item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s1) var(--s2); }
.gap-item .gap-title { color: var(--ink); display: inline-flex; align-items: center; gap: var(--s1); }
.gap-item.is-filled > .sub { flex: 1 1 100%; margin: 0; }
.gap-item.is-filled .entry-mark { font-size: 12px; }
.gap-acts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1); }
.gap-form { display: grid; justify-content: stretch; padding: var(--s2) 0; }
.gap-form .journal-field { width: 100%; }
.gap-photos { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s2); }
.gap-photo { display: grid; justify-items: center; gap: 2px; }
.gap-photo img { width: 72px; height: 72px; object-fit: cover; border-radius: var(--r-sm, 6px); background: var(--glass-quiet); }
.gap-photo-add { cursor: pointer; }
.gap-photo-add:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.gap-refresh { display: grid; gap: var(--s2); justify-items: start; }
.gap-refresh .sub:empty { display: none; }
.review-older > summary .sub { display: block; }
/* A new review waiting: a small dot on the Insights tab. */
.tab.has-dot { position: relative; }
.tab.has-dot svg { overflow: visible; }
.tab.has-dot::after { content: ""; position: absolute; top: 8px; left: calc(50% + 8px); width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--bg-raised, #1b1d1f); }
/* I'm up and the tapped time, inside Sleep & recovery under the check-in. */
.up-check.up-in-sleep { margin: 0 0 var(--s4); }
.up-check.up-in-sleep .sub { margin-left: var(--s1); }
.up-check.up-in-sleep .up-now + .sub { flex: 1 1 0; min-width: 0; margin-left: 0; } /* the note wraps beside the button in the narrower card */

/* ===== Section drawer: Library, Insights and Ask (js/drawer.js) =====
 * Narrow: a sheet that slides over the page from "☰ Section". Wide: docked on the
 * left, headed by the page title, sticking at the page's own top padding so it never
 * shifts; « (under the items) collapses it to a slim handle. */
.drawer-pagehead { margin-bottom: var(--s4); justify-content: flex-start; }
.drawer-trigger { display: inline-flex; align-items: center; gap: var(--s2); max-width: 100%; min-height: 44px; padding: 0 var(--s4); border-radius: var(--r-pill); border: 1px solid var(--line-strong); background: var(--glass-quiet); color: var(--ink); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-layout { min-width: 0; }
.drawer-main { min-width: 0; }
.drawer { position: fixed; inset: 0 auto 0 0; z-index: 40; width: min(86vw, 340px); display: flex; flex-direction: column; gap: var(--s3); padding: calc(var(--s4) + env(safe-area-inset-top)) var(--s4) calc(var(--s4) + env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain;
  background: color-mix(in srgb, var(--bg-raised) 97%, transparent); border-right: 1px solid var(--glass-edge); box-shadow: 0 0 40px #0008;
  transform: translateX(-105%); visibility: hidden; transition: transform 240ms var(--ease), visibility 0s linear 240ms; }
.drawer.is-open { transform: none; visibility: visible; transition: transform 240ms var(--ease), visibility 0s; }
.drawer-scrim { position: fixed; inset: 0; z-index: 39; background: var(--veil); opacity: 0; pointer-events: none; transition: opacity 240ms var(--ease); }
.drawer-scrim.is-shown { opacity: 1; pointer-events: auto; }
html.drawer-locked { overflow: hidden; }
/* The tab bar and + button sit in their own layer; they step aside while the drawer is over the page. */
html.drawer-locked #tabs, html.drawer-locked #log-fab { visibility: hidden; }
/* « sits under the items, on their left edge. */
.drawer-hide { flex: none; align-self: flex-start; width: 44px; height: 44px; margin-left: -6px; border-radius: 50%; border: 0; background: transparent; color: var(--ink-dim); font-size: 22px; line-height: 1; }
.drawer-hide:hover { background: var(--glass-quiet); color: var(--ink); }
.drawer-items { display: grid; gap: var(--s2); align-content: start; min-height: 0; overflow-y: auto; }
.drawer-item { justify-content: flex-start; text-align: left; position: relative; text-transform: none; }
.drawer-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); margin-left: var(--s2); flex: none; }
.drawer-handle { display: none; }
@media (min-width: 720px) {
  .drawer-trigger, .drawer-pagehead { display: none; }
  .drawer-layout { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: var(--s5); align-items: start; transition: grid-template-columns 300ms var(--ease); }
  .drawer-layout > * { grid-row: 1; }
  .drawer-main { grid-column: 2; }
  .drawer, .drawer-handle { grid-column: 1; }
  /* Sticks exactly where it starts (the page's top padding), so scrolling never moves it. */
  .drawer { position: sticky; inset: auto; top: calc(var(--s5) + env(safe-area-inset-top)); z-index: auto; width: 180px; max-height: calc(100dvh - var(--s5) - 120px); overflow: visible; padding: 0; background: none; border: 0; box-shadow: none; transform: none; opacity: 1; visibility: visible;
    transition: transform 300ms var(--ease), opacity 220ms var(--ease), visibility 0s; }
  .drawer-scrim { display: none; }
  /* Collapsing slides the drawer out to the left while the content widens; the handle
   * then fades in where it went. Opening runs the same in reverse. */
  .drawer-layout.is-collapsed { grid-template-columns: 16px minmax(0, 1fr); }
  .drawer-layout.is-collapsed .drawer { transform: translateX(calc(-100% - var(--s5))); opacity: 0; visibility: hidden; pointer-events: none;
    transition: transform 300ms var(--ease), opacity 220ms var(--ease), visibility 0s linear 300ms; }
  /* The handle: a slim tab at the left edge, with a 44px-wide touch area. */
  .drawer-handle { display: flex; align-items: center; justify-content: flex-start; position: sticky; top: 40dvh; width: 44px; height: 88px; margin-left: -20px; padding: 0 0 0 20px; border: 0; background: transparent;
    opacity: 0; visibility: hidden; pointer-events: none; transform: translateX(-8px); transition: opacity 160ms var(--ease), transform 160ms var(--ease), visibility 0s linear 160ms; }
  .drawer-layout.is-collapsed .drawer-handle { opacity: 1; visibility: visible; pointer-events: auto; transform: none; transition: opacity 220ms var(--ease) 200ms, transform 220ms var(--ease) 200ms, visibility 0s; }
  .drawer-handle span { display: block; width: 6px; height: 64px; border-radius: var(--r-pill); background: var(--line-strong); transition: background 160ms var(--ease), width 160ms var(--ease); }
  .drawer-handle:hover span, .drawer-handle:focus-visible span { background: var(--accent); width: 8px; }
}
@media (min-width: 1024px) { .drawer-layout { grid-template-columns: 200px minmax(0, 1fr); gap: var(--s6); } .drawer { top: var(--s6); width: 200px; } }
/* The docked drawer already offers New conversation. */
@media (min-width: 720px) { .drawer-layout:not(.is-collapsed) .ask-new-inline { display: none; } }
@media (prefers-reduced-motion: reduce) { .drawer, .drawer.is-open, .drawer-scrim, .drawer-layout, .drawer-handle, .drawer-layout.is-collapsed .drawer, .drawer-layout.is-collapsed .drawer-handle { transition: none; } }

/* Insights: one section at a time. */
.insights-section > .section-title { font-size: 20px; letter-spacing: -.02em; margin: 0 0 var(--s3); }

/* Ask: conversations in the drawer, newest first, with options on the row itself. */
.ask-new-btn { width: 100%; margin: 0; }
.ask-threads { display: grid; gap: 2px; }
.ask-group { margin: var(--s3) 0 var(--s1); }
.ask-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; border-radius: var(--r-md); }
.ask-row.is-current, .ask-row.is-menu { background: var(--glass-quiet); }
.ask-row-open { display: grid; gap: 2px; min-height: 52px; padding: var(--s2) var(--s3); border: 0; background: transparent; color: var(--ink); text-align: left; min-width: 0; }
.ask-row-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.ask-row-open .sub { font-size: 12px; }
.ask-row-more { width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--ink-dim); font-size: 18px; }
.ask-row-more:hover, .ask-row-more[aria-expanded="true"] { color: var(--ink); background: var(--glass-quiet); }
.ask-row-acts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); padding: 0 var(--s3) var(--s3); }
.ask-row.is-editing, .ask-row.is-confirm { display: grid; gap: var(--s2); padding: var(--s3); background: var(--glass-quiet); border: 1px solid var(--glass-edge); }
.ask-row.is-editing input { width: 100%; margin: 0; }
.ask-row.is-editing .ask-row-acts, .ask-row.is-confirm .ask-row-acts { padding: 0; }
.ask-row-q { margin: 0; font-size: 14px; color: var(--ink); }
.ask-row .is-danger { color: var(--alert); }
.ask-row .mini.is-danger { background: var(--alert); color: var(--bg); border-color: transparent; }
.ask-row-error { margin: 0; color: var(--alert); }
.ask-convo-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); }
.ask-convo-head > div { min-width: 0; }
.ask-convo-head .ask-new-inline { flex: none; margin: 0; white-space: nowrap; min-width: 64px; }
.ask-convo-title { margin: 0; font-size: 18px; line-height: 1.35; letter-spacing: -.01em; overflow-wrap: anywhere; }
.ask-convo-head .sub { margin: 2px 0 0; font-size: 13px; }
.ask-day { justify-self: center; margin: var(--s2) 0 0; font-size: 12px; color: var(--ink-dim); }
.ask-msg > .ask-time { display: block; margin-top: var(--s1); font-size: 11px; color: var(--ink-dim); text-align: right; }
.ask-msg.is-app > .ask-time { text-align: left; }
/* Ask search: a box under New conversation; results show the name, an excerpt with the
 * matched words marked, and when. The opened message glows briefly. */
.ask-search { position: relative; }
.ask-search input { width: 100%; margin: 0; min-height: 44px; padding-left: 40px; }
.ask-search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-dim); pointer-events: none; }
.ask-result { display: grid; gap: 2px; width: 100%; padding: var(--s2) var(--s3); border: 0; border-radius: var(--r-md); background: transparent; color: var(--ink); text-align: left; }
.ask-result:hover, .ask-result:focus-visible { background: var(--glass-quiet); }
.ask-result-text { font-size: 13px; line-height: 1.45; color: var(--ink-dim); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ask-result .sub { font-size: 12px; }
.ask-result mark, .ask-row-title mark { background: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--ink); border-radius: 3px; padding: 0 1px; font-weight: 600; }
.ask-msg { transition: box-shadow 800ms var(--ease); }
.ask-msg.is-found { box-shadow: 0 0 0 2px var(--accent); }
/* Insights → Labs → Reports: under the charts. */
.lab-reports { display: grid; gap: var(--s2); margin-top: var(--s5); padding-top: var(--s4); border-top: 1px solid var(--glass-edge); }
.lab-reports .kicker, .lab-reports > .note:empty { margin: 0; }
.lab-reports > .note:empty { display: none; }
.lab-report-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
.lab-report { display: grid; gap: 2px; justify-items: start; padding: var(--s3); border-radius: var(--r-md); background: var(--glass-quiet); border: 1px solid var(--glass-edge); }
.lab-report-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); color: var(--ink); }
.lab-report-state { font-size: 12px; padding: 2px 8px; border-radius: var(--r-pill); border: 1px solid var(--line-strong); color: var(--ink-dim); text-transform: capitalize; }
.lab-report-state.is-final { color: var(--positive); border-color: color-mix(in srgb, var(--positive) 50%, transparent); }
.lab-report .sub { margin: 0; }
.lab-report .disclosure { width: 100%; margin-top: var(--s1); }
.lab-report-results { margin: var(--s2) 0 0; padding-left: var(--s4); display: grid; gap: var(--s1); }
.lab-report-results p { margin: 0; }
.lab-import-form { display: grid; gap: var(--s2); }

/* No visible titles (Chris, 25 October 2026): the tab bar names the page and the highlighted
 * drawer item names the section, so section headings stay for screen readers only. */
.drawer-main .screen-title, .drawer-main .insights-section > .section-title { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.drawer-main .page-intro { margin-top: 0; }
/* Activity log: Started and Finished side by side; the duration reads under them. */
.activity-times { grid-template-columns: 1fr 1fr; }
.activity-duration { margin: calc(-1 * var(--s1)) 0 var(--s2); }
/* Sign-in: password + authenticator. */
.pw-form { display: grid; gap: var(--s2); margin-top: var(--s4); padding-top: var(--s3); border-top: 1px solid var(--glass-edge); text-align: left; }
.pw-form .lbl input { width: 100%; }
.pw-secret { font-family: var(--font-mono); letter-spacing: .06em; overflow-wrap: anywhere; user-select: all; }
.btn-ghost-link { display: inline-flex; justify-content: center; text-decoration: none; }

/* Saved. Syncing… beside what changed (js/sync-note.js): floats over the end of its row, so
 * nothing moves; fades in only if a sync takes a moment. Not synced stays until it lands. */
.has-sync-note { position: relative; }
.sync-note { position: absolute; right: 0; top: 50%; transform: translateY(-50%); z-index: 1; pointer-events: none;
  padding: 2px var(--s2); border-radius: 999px; background: var(--bg-raised, #1b1d1f); border: 1px solid var(--glass-edge);
  color: var(--ink-dim); font-size: 12px; line-height: 1.5; white-space: nowrap; opacity: 0; animation: sync-note-in .2s ease-out .6s forwards; }
.sync-note[data-state="failed"] { color: var(--alert, #e0896f); animation-delay: 0s; }
.journal-entry-summary > .sync-note { right: var(--s7); }
.sync-dots i { font-style: normal; animation: sync-dot 1.2s infinite; opacity: .2; }
.sync-dots i:nth-child(2) { animation-delay: .2s; }
.sync-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes sync-note-in { to { opacity: 1; } }
@keyframes sync-dot { 0%, 60%, 100% { opacity: .2; } 30% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .sync-note { animation-duration: 0s; } /* still waits a moment, then appears without a fade */
  .sync-dots i { animation: none; opacity: 1; }
}
