/* Daily OS stylesheet.
 *
 * The design system (daily-os-design-system.md) lives HERE, in code. Every
 * token in section 2 of that doc is declared below; every component in section
 * 4 has a class. Views compose classes and set exactly ONE dynamic custom
 * property, --accent, from the activity's phase. No view hardcodes a hex, a px,
 * or a radius.
 */

/* ===== fonts =====
 * Self-hosted. The service worker deliberately skips cross-origin requests, so
 * while these came from a CDN the installed PWA fell back to system fonts
 * whenever it was offline: exactly the case the PWA exists for. Two families,
 * variable weights, latin + latin-ext, about 97KB cached once. */
@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;
}

/* ===== 2. Tokens ===== */
:root {
  /* surfaces. Deeper canvas, cards separated by elevation and space rather
   * than by outlines: the calm near-black reading the Oura app gets right. */
  --bg: #06070d;
  --bg-raised: #0d0f18;
  --surface: #141726;
  --surface-2: #1b1f31;

  /* ink */
  --ink: #eef0fb;
  --ink-dim: #a6abcf;
  --ink-faint: #8a91bd;

  /* phase accents: the semantic core */
  --dawn: #ffb84d;
  --morning: #ff9e64;
  --midday: #e0a35b;
  --evening: #9b7fc4;
  --night: #6d6bc0;

  /* Text-safe variants. Identity for every phase except night: #6d6bc0 is too
   * dark to clear WCAG AA as small mono text, so small text reads the -ink
   * variant while fills, borders, glow and gradients keep the brand accent. */
  --dawn-ink: #ffb84d;
  --morning-ink: #ff9e64;
  --midday-ink: #e0a35b;
  --evening-ink: #9b7fc4;
  --night-ink: #8a88d6;

  /* support */
  --positive: #7fd6c5;
  --alert: #ff8d8d;
  --gold: #ffc94d;

  /* borders */
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .14);

  /* glass: the frosted-pane surface treatment */
  --glass: linear-gradient(165deg, rgba(72, 80, 122, .30), rgba(28, 33, 58, .26));
  --glass-quiet: linear-gradient(165deg, rgba(72, 80, 122, .18), rgba(28, 33, 58, .16));
  --glass-edge: rgba(255, 255, 255, .10);
  --glass-shadow: 0 10px 34px -14px rgba(0, 0, 0, .75), inset 0 1px 0 rgba(255, 255, 255, .07);

  /* type. Display and body are the same sans; the display role is carried by
   * size, weight and tighter tracking rather than by a second family. */
  --font-display: 'Hanken Grotesk', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --font-body: 'Hanken Grotesk', system-ui, sans-serif;

  /* radius */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-pill: 50px;

  /* spacing (4-base) */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 22px;
  --s6: 30px;
  --s7: 44px;

  /* motion */
  --ease: cubic-bezier(.2, .7, .3, 1);
  --rise: .6s;

  /* default accent, overridden per element from the activity phase */
  --accent: var(--midday);
  --accent-ink: var(--midday-ink);
}

/* Phase classes set the ambient accent: WHEN in the day you are. Put
 * .ph-<phase> on a container and everything inside reads --accent. */
.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); }

/* The late phases genuinely dim: the glass carries less light as the day
 * winds down, so evening and night feel like dusk rather than a recolored noon. */
.ph-evening { --glass: linear-gradient(165deg, rgba(64, 70, 108, .24), rgba(24, 28, 50, .22)); }
.ph-night {
  --glass: linear-gradient(165deg, rgba(54, 60, 96, .20), rgba(20, 24, 44, .20));
  --glass-edge: rgba(255, 255, 255, .07);
}

/* ===== mood =====
 * The second axis: WHAT the thing is. Phase stays ambient (glow, day ring, tab
 * bar, the timeline spine); mood colors the individual activity's own surface,
 * so a training block reads hot and a wind-down reads calm even though both
 * sit in the same hour. Put .mo-<key> on the element and it overrides --accent
 * for that subtree only. */
:root {
  --mo-rise:   #ffb84d;  /* waking, sunlight, first light */
  --mo-train:  #ff6b5a;  /* strength work: intense, energetic */
  --mo-move:   #66d9c0;  /* mobility, easy movement, walking */
  --mo-food:   #8ccc6e;  /* meals, fuelling, the eating window */
  --mo-supp:   #6fcfe0;  /* supplements and peptides: clinical */
  --mo-focus:  #8fa8d8;  /* the work block: cool concentration */
  --mo-social: #f08fb0;  /* face-to-face, parasympathetic recovery */
  --mo-rest:   #7d7ad4;  /* wind-down, landing sequence, bed */
  --mo-rest-ink: #9a97e2;
  --mo-goal:   #ffc94d;  /* what it is all for: aspiration */
}
.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-ink); }
.mo-goal   { --accent: var(--mo-goal);   --accent-ink: var(--mo-goal); }

/* ===== base ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}
body { min-height: 100vh; min-height: 100dvh; }

::-webkit-scrollbar { width: var(--s2); }
::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: var(--s2); }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* The phase glow. It reaches well down the page on purpose: the glass surfaces
 * frost whatever is behind them, so this is what gives them the accent of the
 * moment without any surface having to know its own color. */
#glow {
  position: fixed;
  top: -25%;
  left: 50%;
  transform: translateX(-50%);
  width: 170%;
  height: 115%;
  pointer-events: none;
  transition: background .8s ease;
  z-index: 0;
}

#app {
  position: relative;
  z-index: 2;
  max-width: 560px;
  margin: 0 auto;
  padding: 0 var(--s4);
  padding-top: env(safe-area-inset-top);
  /* clear the fixed tab bar */
  padding-bottom: calc(var(--s7) * 2 + env(safe-area-inset-bottom));
}

/* ===== tab bar =====
 * Navigation is visible and permanent instead of hidden behind a gear: Today
 * is where you live, Library is where you change the setup. */
#tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  gap: var(--s2);
  padding: var(--s2) var(--s4) calc(var(--s2) + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1;
  max-width: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-height: var(--s7);
  padding: var(--s2) var(--s3);
  border: none;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  cursor: pointer;
}
.tab svg { display: block; }
.tab.is-sel { color: var(--accent-ink); background: color-mix(in srgb, var(--accent) 10%, transparent); }

.rise { animation: rise .5s var(--ease) both; }

/* ===== 3. Type scale ===== */
.kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.kicker-accent { color: var(--accent-ink); }
.kicker-wide { letter-spacing: .28em; }

.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(34px, 8vw, 46px);
  line-height: 1.06;
  letter-spacing: -.03em;
}
.activity-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 30px;
  line-height: 1.12;
  letter-spacing: -.03em;
}
.screen-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(26px, 4.5vw, 34px);
  line-height: 1.1;
  letter-spacing: -.03em;
  margin: var(--s1) 0 var(--s3);
}
.card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  line-height: 1.24;
  letter-spacing: -.02em;
  margin: var(--s2) 0 var(--s3);
}
.note {
  color: var(--ink-dim);
  font-size: 14px;
  line-height: 1.62;
  margin-top: var(--s3);
}
.note-tight { margin-top: var(--s1); }
.note-faint { color: var(--ink-faint); }
.note-alert { color: var(--alert); }
.data {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 500;
}

/* ===== 4. Component patterns ===== */

/* ===== glass =====
 * Surfaces are frosted panes, not filled boxes: they are translucent, they
 * blur what sits behind them, and a one-pixel light edge along the top catches
 * the light. Because the phase glow lives behind the whole app, every glass
 * surface picks up the accent of the moment without being told to.
 *
 * Blur is not free, so the full treatment is reserved for the few large
 * surfaces; the many small ones (editor cards, rows) get the translucency and
 * the light edge without the blur. */
.glass, .card, .modalcard, .statusbox, .checkin, .stat, .week-day, .field-tile {
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shadow);
}

/* Card: the large frosted pane. */
.card {
  border-radius: var(--r-xl);
  padding: var(--s5);
}
/* Phase hero: the card, wearing its accent. One per screen. */
.card-hero {
  border-color: color-mix(in srgb, var(--accent) 28%, transparent);
  box-shadow: 0 30px 70px -36px color-mix(in srgb, var(--accent) 60%, transparent);
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--s3);
}

/* Buttons. */
.btn {
  width: 100%;
  margin-top: var(--s5);
  padding: var(--s4);
  border-radius: var(--r-md);
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 16px;
  color: var(--bg);
  background: var(--accent);
  box-shadow: 0 14px 30px -16px color-mix(in srgb, var(--accent) 80%, transparent);
}
.btn-flush { margin-top: 0; }
.ghost {
  margin-top: var(--s4);
  padding: var(--s3) var(--s5);
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink-dim);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.ghost-accent { border-color: color-mix(in srgb, var(--accent) 34%, transparent); color: var(--accent-ink); }
.ghost-sm { font-size: 11px; padding: var(--s2) var(--s4); margin-top: 0; }
.ghost-flush { margin-top: 0; }
.ghost-block { width: 100%; }
/* mini: inline chip-sized action inside editors and payloads. */
.mini {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 6px var(--s3);
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, .04);
  color: var(--ink-dim);
  cursor: pointer;
}
.mini-on { background: var(--accent); border-color: transparent; color: var(--bg); }
.mini-danger { color: var(--alert); }
.mini-push { margin-left: auto; }
.iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--s2) 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, .04);
  color: var(--ink-dim);
  cursor: pointer;
}
.iconbtn:active { transform: scale(.94); }

/* Pill / tag. */
.pill {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px var(--s2);
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  color: var(--accent-ink);
  display: inline-block;
}
.pill-positive { background: color-mix(in srgb, var(--positive) 13%, transparent); color: var(--positive); }
.pill-alert { background: color-mix(in srgb, var(--alert) 14%, transparent); color: var(--alert); }
.pill-gold { background: color-mix(in srgb, var(--gold) 13%, transparent); color: var(--gold); }
.pill-plain { background: rgba(255, 255, 255, .06); border: 1px solid var(--line); color: var(--ink-dim); }

/* ===== topbar ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s5) 2px var(--s3);
}
.topbar-title { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }

/* ===== week strip ===== */
.week {
  display: flex;
  gap: 6px;
  justify-content: space-between;
  margin: 0 0 var(--s4);
}
.week-day {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: var(--s2) 0;
  border-radius: var(--r-md);
}
.week-day.is-today { border-color: color-mix(in srgb, var(--accent) 42%, transparent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.week-day > span {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.week-dot { width: 9px; height: 9px; border-radius: var(--r-pill); background: var(--surface-2); }
.week-dot.is-part { background: color-mix(in srgb, var(--positive) 45%, transparent); }
.week-dot.is-full { background: var(--positive); }

/* ===== check-in chip (replaces the old start gate) ===== */
.checkin {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  text-align: left;
  padding: var(--s3) var(--s4);
  margin-bottom: var(--s4);
  border-radius: var(--r-md);
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .06em;
  cursor: pointer;
}
.checkin-dot { width: 9px; height: 9px; border-radius: var(--r-pill); background: var(--surface-2); flex-shrink: 0; }
.checkin.is-set { border-color: color-mix(in srgb, var(--positive) 25%, transparent); }
.checkin.is-set .checkin-dot { background: var(--positive); }
.checkin-fields { display: flex; gap: var(--s3); margin-bottom: var(--s4); }
.field-tile {
  flex: 1;
  text-align: left;
  border-radius: var(--r-md);
  padding: var(--s3) var(--s4);
}
.field-tile > span {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 6px;
}
.field-tile input {
  width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 22px;
  color: var(--ink);
}

/* ===== timeline (the primary Today surface) ===== */
.timeline { position: relative; margin-top: var(--s2); }
.timeline-spine {
  position: absolute;
  left: 6px;
  top: var(--s3);
  bottom: var(--s3);
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(var(--dawn), var(--morning), var(--midday), var(--evening), var(--night));
  opacity: .32;
}
.step { position: relative; margin-bottom: var(--s1); }
.step-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s4);
  width: 100%;
  min-height: var(--s7);
  padding: var(--s2) 0;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  cursor: pointer;
}
/* Every node wears its own mood, so the shape of the day reads as a string of
 * colored beads: amber waking, hot training, green meals, indigo landing. */
.step-node {
  flex-shrink: 0;
  z-index: 1;
  width: 14px;
  height: 14px;
  border-radius: var(--r-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg);
  background: color-mix(in srgb, var(--accent) 26%, transparent);
  border: 1.5px solid color-mix(in srgb, var(--accent) 55%, transparent);
}
.step-label { flex: 1; line-height: 1.3; color: var(--ink-dim); }
.step-time { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); }

.step.is-done .step-node { background: var(--positive); border-color: transparent; }
.step.is-done .step-label { color: var(--ink-faint); text-decoration: line-through; }
.step.is-done .step-time { color: var(--positive); }

.step.is-now .step-row {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-color: color-mix(in srgb, var(--accent) 26%, transparent);
  border-radius: var(--r-md);
  padding: var(--s2) var(--s3);
  margin-left: calc(var(--s3) * -1);
}
.step.is-now .step-node { background: var(--accent); border-color: transparent; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.step.is-now .step-label { color: var(--ink); font-weight: 600; }
.step.is-now .step-time { color: var(--accent-ink); }

.step.is-skipped .step-node { border-style: dashed; }
.step.is-skipped .step-label { color: var(--ink-faint); }

/* Expanded step body: the detail that used to require the peek modal. Its rule
 * carries the activity's mood. */
.step-body {
  margin: var(--s2) 0 var(--s4) var(--s6);
  padding-left: var(--s3);
  border-left: 2px solid color-mix(in srgb, var(--accent) 32%, transparent);
}
.step-body > .note:first-child { margin-top: var(--s2); }
.step-actions { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s3); }

/* Module payload sub-panel (workout, cook, fueling, thaw, supps). */
.payload {
  margin-top: var(--s4);
  border-radius: var(--r-md);
  padding: var(--s4);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 16%, transparent);
}
.payload-cap {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin-bottom: var(--s3);
}
.exrow {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s3);
  padding: 7px 0;
  font-size: 14px;
  line-height: 1.4;
}
.exrow .ex-meta { font-family: var(--font-mono); font-size: 12px; color: var(--ink-dim); white-space: nowrap; }
.dish { font-family: var(--font-display); font-weight: 600; font-size: 19px; line-height: 1.18; }
.macros { display: flex; gap: var(--s2); margin-top: var(--s3); }
.macro {
  flex: 1;
  text-align: center;
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: var(--s3) var(--s2);
}
.macro b { display: block; font-family: var(--font-mono); font-size: 18px; font-weight: 500; color: var(--ink); }
.macro.is-protein b { color: var(--positive); }
.macro span {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-top: var(--s1);
}
.suppline { font-family: var(--font-mono); font-size: 11px; line-height: 1.6; margin-top: var(--s3); color: var(--accent-ink); }
.suppline.sep { padding-top: var(--s3); border-top: 1px solid var(--line); }

/* Inline logging (sets on the workout step, meals on the cook step). */
.logbar { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: flex-end; margin-top: var(--s3); }
.logbar .lbl { flex: 0 0 auto; }
.logbar input { width: 68px; margin-bottom: 0; }
.setlist { font-family: var(--font-mono); font-size: 11px; color: var(--ink-dim); margin-top: var(--s2); line-height: 1.7; }
.logged-tag { font-family: var(--font-mono); font-size: 11px; color: var(--positive); }
.rating { display: flex; gap: 6px; margin-top: var(--s2); }

/* ===== hero day ring =====
 * The one glanceable thing at the top of Today: how much of the day is behind
 * you, the phase you are in, and the step you are on. Everything else is one
 * scroll away. */
.dayring {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--s3) 0 var(--s6);
}
.dayring-face {
  position: relative;
  width: 196px;
  height: 196px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dayring-face svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.dayring-track { stroke: rgba(255, 255, 255, .06); }
.dayring-arc { stroke: var(--accent); transition: stroke-dashoffset .8s var(--ease), stroke .8s var(--ease); }
.dayring-inner { display: flex; flex-direction: column; align-items: center; gap: var(--s1); }
.dayring-num {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 62px;
  line-height: 1;
  letter-spacing: -.02em;
}
.dayring-of {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.dayring-now {
  margin-top: var(--s4);
  text-align: center;
  max-width: 300px;
}
.dayring-now .activity-title { font-size: 26px; }

/* ===== step timer =====
 * A readout and a bar, not a second ring: the day ring is the only ring. */
.timer { margin-top: var(--s4); }
.timer-head { display: flex; align-items: baseline; gap: var(--s2); }
.timer-head .data.is-warn { color: var(--alert); }
.timer-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.timer-bar {
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .07);
  margin-top: var(--s2);
  overflow: hidden;
}
.timer-bar > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 1s linear, background .4s var(--ease);
}
.timer-bar > span.is-warn { background: var(--alert); }
.hint { font-family: var(--font-mono); font-size: 12px; min-height: 16px; margin-top: var(--s2); }
.hint .is-good { color: var(--positive); }
.hint .is-warn { color: var(--alert); }
.hint .is-accent { color: var(--accent-ink); }
.hint .is-dim { color: var(--ink-dim); }

/* ===== status boxes + stat tiles ===== */
.statusbox {
  padding: var(--s3) var(--s4);
  border-radius: var(--r-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s3);
  margin-bottom: var(--s3);
}
.statusbox.is-ok { border-color: color-mix(in srgb, var(--positive) 22%, transparent); }
.statusbox.is-late { border-color: color-mix(in srgb, var(--gold) 26%, transparent); }
.statusbox .kicker { text-transform: none; letter-spacing: 0; color: var(--ink-dim); text-align: right; }
.statusbox .status-lead { text-transform: uppercase; letter-spacing: .18em; white-space: nowrap; }
.statusbox.is-ok .status-lead { color: var(--positive); }
.statusbox.is-late .status-lead { color: var(--gold); }

.done-mark {
  width: 64px;
  height: 64px;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--s5);
}

.stats { display: flex; gap: var(--s3); margin: var(--s5) 0 var(--s1); }
.stat {
  flex: 1;
  border-radius: var(--r-lg);
  padding: var(--s4) var(--s3);
  text-align: center;
}
.stat.is-positive { background: color-mix(in srgb, var(--positive) 6%, transparent); border-color: color-mix(in srgb, var(--positive) 20%, transparent); }
.stat b { display: block; font-family: var(--font-display); font-weight: 600; font-size: 32px; }
.stat.is-positive b { color: var(--positive); }
.stat span {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-top: 6px;
}

/* ===== list rows (pantry, log, supps today, biomarkers) ===== */
.row {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  text-align: left;
  min-height: var(--s7);
  padding: var(--s3);
  border-radius: var(--r-md);
  margin-bottom: 6px;
  font-size: 13.5px;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  font-family: var(--font-body);
  transition: background .15s var(--ease);
}
button.row { cursor: pointer; }
button.row:active { transform: scale(.99); }
.row-static { cursor: default; }
.row-stack { flex-direction: column; align-items: flex-start; gap: 3px; }
.row-top { align-items: flex-start; }
.row-main { flex: 1; }
.row-strike { text-decoration: line-through; opacity: .6; }
.dot { width: 9px; height: 9px; border-radius: var(--r-pill); flex-shrink: 0; background: var(--surface-2); }
.dot.is-on { background: var(--positive); }
.dot.is-accent { background: var(--accent); }
.sub {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 2px;
  line-height: 1.5;
}
.sub-dim { color: var(--ink-dim); }
.sub-accent { color: var(--accent-ink); }
.sub-positive { color: var(--positive); }

/* ===== forms ===== */
input, textarea, select {
  width: 100%;
  padding: var(--s3);
  margin-bottom: 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: rgba(0, 0, 0, .25);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
}
textarea { font-family: var(--font-body); resize: vertical; line-height: 1.5; }
input[type="checkbox"] { width: auto; margin: 6px 0 0; }
.lbl {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.lbl input, .lbl select, .lbl textarea { margin-bottom: 0; }
.fieldrow { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: flex-end; }
.fieldrow + .fieldrow { margin-top: var(--s2); }
.w-xs { width: 56px; }
.w-sm { width: 70px; }
.w-md { width: 100px; }
.w-lg { width: 128px; }

/* The quiet glass: translucency and the light edge, no blur. Editors show
 * dozens of these at once and blurring every one is not worth the frames. */
.editcard {
  background: var(--glass-quiet);
  border: 1px solid var(--glass-edge);
  border-radius: var(--r-md);
  padding: var(--s4);
  margin-bottom: var(--s3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}
.editcard-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s2);
  width: 100%;
  background: transparent;
  border: none;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  min-height: var(--s7);
}
.editcard-body { margin-top: var(--s3); }
.strong { font-weight: 600; }

/* ===== segmented control (Library) ===== */
.segment {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 6px 0 var(--s4);
}
/* Unselected chips keep a trace of their own mood, so the control reads as a
 * palette of the pillars rather than five identical grey pills. */
.seg {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: var(--s2) var(--s4);
  min-height: var(--s7);
  display: inline-flex;
  align-items: center;
  border-radius: var(--r-pill);
  cursor: pointer;
  text-transform: capitalize;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  color: color-mix(in srgb, var(--accent-ink) 72%, var(--ink-dim));
}
.seg.is-sel { background: var(--accent); border-color: transparent; color: var(--bg); }

/* ===== modals ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(5, 6, 15, .78);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s5);
}
.modalcard {
  max-width: 380px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  border-color: color-mix(in srgb, var(--accent) 27%, transparent);
  border-radius: var(--r-xl);
  padding: var(--s6) 28px;
  text-align: center;
  animation: rise .35s var(--ease) both;
}
.modalcard.is-left { text-align: left; }
.modalcard.pop { animation: pop .28s var(--ease) both; }
.modal-countdown {
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 600;
  margin: var(--s3) 0 10px;
  color: var(--accent);
  animation: pulse 2s infinite;
}
.modal-actions { display: flex; gap: var(--s2); margin-top: var(--s5); }
.modal-actions.is-stacked { flex-direction: column; }
.errline { margin-top: var(--s3); font-family: var(--font-mono); font-size: 11px; color: var(--alert); }
.busyline { margin-top: var(--s3); font-family: var(--font-mono); font-size: 11px; color: var(--ink-dim); }

/* Settings rows. */
.setrow {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  text-align: left;
  padding: var(--s4);
  margin-bottom: 10px;
  min-height: var(--s7);
  border-radius: var(--r-md);
  border: 1px solid var(--glass-edge);
  background: var(--glass-quiet);
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-body);
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.setrow:active { transform: scale(.99); }
.setrow.is-on { background: color-mix(in srgb, var(--positive) 9%, transparent); border-color: color-mix(in srgb, var(--positive) 25%, transparent); }
.setrow-l { display: block; font-weight: 600; font-size: 14.5px; line-height: 1.3; }
.setrow-dot { width: 9px; height: 9px; border-radius: var(--r-pill); flex-shrink: 0; background: var(--surface-2); }
.setrow.is-on .setrow-dot { background: var(--positive); }

/* Replan proposal detail rows. */
.detail { display: flex; gap: 11px; align-items: flex-start; margin: var(--s2) 0; }
.detail-dot { width: 6px; height: 6px; border-radius: var(--r-pill); margin-top: 7px; flex-shrink: 0; 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); }

/* ===== utility ===== */
/* A phase wrapper that sets --accent without becoming a layout box. */
.contents { display: contents; }
.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; }
.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) 2px var(--s2); letter-spacing: .16em; }
.bar { height: 5px; border-radius: 5px; background: rgba(255, 255, 255, .08); margin: var(--s3) 0 10px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ===== 6. Accessibility ===== */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 10px;
}
/* tap targets >= 44px on every standalone control */
.btn, .ghost, .iconbtn, .setrow, .mini, .seg, .step-row, button.row, .checkin { min-height: var(--s7); }
.iconbtn { min-width: var(--s7); }
.mini { display: inline-flex; align-items: center; justify-content: center; }

@media (prefers-reduced-motion: reduce) {
  .rise, .modalcard, .modalcard.pop, .modal-countdown { animation: none; }
  * {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
