/* Steady — styles. Tokens and component classes are Nocturne (design/nocturne.css),
   copied unchanged; app-specific additions follow the "Steady" section below. */
@font-face {
  font-family: "Inter";
  src: url("/fonts/Inter-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
/* Nocturne — design-system tokens and component classes. This file is the source of truth for the system's look; retune it here and see readme.md. */

:root {
  --color-bg: #161826;
  --color-surface: #232532;
  --color-text: #e9e9ed;
  --color-accent: #9184d9; /* review round 7 (Barron): the accent moves to
     the product's blurple — OKLCH hue 289.2, the hue of the app's own Pro
     accent (#9a8fe0, --om-accent-pro) — at the same lightness the steel
     accent held (L 0.660, so the documented ratios survive) and chroma
     in the product blurple's own range (its token sits at C 0.118; the
     accent takes 0.125, from the old steel's 0.030):
     the accent now reads as an accent rather than another neutral. */
  --color-accent-2: #a7a1db; /* the machine-derived stand-in follows: same
     hue, same L 0.734, chroma at the same 2:3 proportion it held */
  --color-divider: color-mix(in srgb, #e9e9ed 16%, transparent);

  /* Tonal ramps — generated in OKLCH on one shared lightness scale, so the
     same step of any role matches the others in visual value. */
  --color-neutral-100: #f3f5fe;
  --color-neutral-200: #e4e7f5;
  --color-neutral-300: #cfd3e5;
  --color-neutral-400: #b2b6ca;
  --color-neutral-500: #9397ab;
  --color-neutral-600: #75798c;
  --color-neutral-700: #595d6c;
  --color-neutral-800: #3f424d;
  --color-neutral-900: #292b31;

  --color-accent-100: #f5f4ff;
  --color-accent-200: #e7e5fe;
  --color-accent-300: #d2cefd;
  --color-accent-400: #b5abfc;
  --color-accent-500: #968ae0;
  --color-accent-600: #796cbf;
  --color-accent-700: #5d5294;
  --color-accent-800: #423a6a;
  --color-accent-900: #2b2741;

  --color-accent-2-100: #f5f4ff;
  --color-accent-2-200: #e7e5fe;
  --color-accent-2-300: #d2cefd;
  --color-accent-2-400: #b5afe8;
  --color-accent-2-500: #9690c9;
  --color-accent-2-600: #7972a9;
  --color-accent-2-700: #5c5783;
  --color-accent-2-800: #423e5d;
  --color-accent-2-900: #2b293a;

  /* Deck section-divider ground — review round 3: saturation as presence.
     Dividers take a saturated deep indigo (hue 277, the neutral ramp's own
     family; C 0.094 — written when the accent held C 0.030, before the
     round-7 blurple raised it past the ground's) with a lighter bloom and
     a ghost tint of the same hue, while the slide grounds stay
     desaturated. Deck-scale fills only — not interface colors. */
  --color-section: #262a60;
  --color-section-glow: #353b80;
  --color-section-ghost: #4c5397;

  --font-heading: "Inter", system-ui, sans-serif;
  --font-heading-weight: 500;
  --font-body: "Inter", system-ui, sans-serif;

  --space-1: 2.8px;
  --space-2: 5.6px;
  --space-3: 8.4px;
  --space-4: 11.2px;
  --space-6: 16.8px;
  --space-8: 22.4px;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;

  /* Elevation — derived from the ground: soft ink-tinted shadows on a
     light theme, a hairline edge + ambient darkness on a dark one. */
  --shadow-sm: 0 0 0 1px #3f424d;
  --shadow-md: 0 0 0 1px #595d6c, 0 6px 18px rgba(0,0,0,0.55);
  --shadow-lg: 0 0 0 1px #9397ab, 0 16px 40px rgba(0,0,0,0.65);
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
}
h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: var(--font-heading-weight); }


/* ══════════════════════════════════════════════════════════════════════════
   Components — built with the tokens above. Plain CSS
   on plain HTML: no JavaScript, no build step. Each class is documented in
   readme.md and demonstrated in foundations/ and components/.
   ══════════════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-size: 15px; line-height: 1.55; font-weight: 400; }
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  line-height: 1.12; letter-spacing: -0.015em; margin: 0 0 var(--space-2);
}
h1 { font-size: 42px; }
h2 { font-size: 32px; }
h3 { font-size: 25px; }
h4 { font-size: 20px; }
h5 { font-size: 16px; }
h6 { font-size: 13px; }
h6 { letter-spacing: 0.08em; text-transform: uppercase; }
p { margin: 0 0 var(--space-3); }
a { color: var(--color-accent); text-underline-offset: 3px; }
img { display: block; max-width: 100%; }
figure { margin: 0; }
figcaption {
  font-size: 11px; margin-top: var(--space-1);
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
}
.text-muted { color: color-mix(in srgb, var(--color-text) 55%, transparent); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--color-accent) 30%, transparent); }

/* — rules — */
/* Rules fade to transparent at both ends instead of stopping cleanly — a
   Nocturne signature. The ramp is 48px an end (one deck baseline unit),
   painted from the same divider token. Freestanding rules fade; box
   outlines, in-control separators, and short accent marks stay solid. */
.hr {
  height: 1px; border: 0; margin: var(--space-4) 0;
  background: linear-gradient(to right,
    transparent, var(--color-divider) 48px,
    var(--color-divider) calc(100% - 48px), transparent);
}

/* — buttons — */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; text-decoration: none;
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 14px; line-height: 1.2; color: var(--color-text); /* matches the .input's 14px —
     the pair sits side by side in sign-up rows */
  background: transparent; border: 1px solid transparent;
  padding: var(--space-2) calc(var(--space-3) * 1.2);
  border-radius: var(--radius-md);
}
.btn svg { display: block; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { color: var(--color-accent); border-color: var(--color-accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--color-accent) 12%, transparent); }
.btn-primary:active { background: color-mix(in srgb, var(--color-accent) 22%, transparent); }
.btn-secondary { border-color: var(--color-divider); }
.btn-secondary:hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.btn-secondary:active { background: color-mix(in srgb, var(--color-text) 14%, transparent); }
.btn-ghost { color: var(--color-accent); padding-inline: var(--space-1); }
.btn-ghost:hover { background: color-mix(in srgb, var(--color-accent) 10%, transparent); }
.btn-ghost:active { background: color-mix(in srgb, var(--color-accent) 18%, transparent); }
.btn-icon { width: 36px; height: 36px; padding: 0; }
.btn-block { width: 100%; margin-top: var(--space-2); }

/* — forms — */
.field > label {
  display: block; font-size: 12px; margin-bottom: 5px;
  color: color-mix(in srgb, var(--color-text) 70%, transparent);
}
.input {
  width: 100%; min-height: 36px; padding: 6px 10px; font: inherit;
  font-size: 14px; color: var(--color-text); caret-color: var(--color-accent);
  background: var(--color-surface);
  border: 1px solid var(--color-divider); border-radius: var(--radius-md);
}
.input:hover { border-color: color-mix(in srgb, var(--color-text) 45%, transparent); }
.input:focus-visible { border-color: var(--color-accent); outline-offset: 0; }
textarea.input { min-height: 90px; resize: vertical; }
.radio { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.radio input, .seg-opt input {
  position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none;
}
.radio .dot {
  width: 16px; height: 16px; flex: none; border-radius: 50%;
  border: 1.5px solid var(--color-divider);
}
.radio:hover .dot { border-color: var(--color-accent); }
.radio input:checked + .dot {
  border-color: var(--color-accent); background: var(--color-accent);
  box-shadow: inset 0 0 0 4px var(--color-bg);
}
.radio input:focus-visible + .dot { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.seg {
  display: inline-flex; overflow: hidden;
  border: 1px solid var(--color-divider); border-radius: var(--radius-md);
}
.seg-opt {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; font-size: 13px; cursor: pointer;
}
.seg-opt + .seg-opt { border-left: 1px solid var(--color-divider); }
.seg-opt:has(input:checked) { color: var(--color-accent); box-shadow: inset 0 0 0 1px var(--color-accent); }
.seg-opt:not(:has(input:checked)):hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.seg-opt:has(input:focus-visible) { outline: 2px solid var(--color-accent); outline-offset: -2px; }

/* — cards — */
.card {
  display: flex; flex-direction: column; gap: var(--space-2);
  padding: var(--space-3); border-radius: var(--radius-md); background: var(--color-surface);
}
.card-kicker { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-accent); }
.card-title {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 17px; line-height: 1.2;
}
.card-body { margin: 0; font-size: 13px; opacity: 0.8; flex: 1; }
.card-meta {
  display: flex; align-items: center; gap: 6px; font-size: 11px;
  color: color-mix(in srgb, var(--color-text) 50%, transparent);
}
.elev-sm { box-shadow: var(--shadow-sm); }
.elev-md { box-shadow: var(--shadow-md); }
.elev-lg { box-shadow: var(--shadow-lg); }

/* — tags — */
.tag {
  display: inline-flex; align-items: center; font-size: 11px;
  letter-spacing: 0.02em; padding: 3px 10px;
  border-radius: calc(var(--radius-md) * 0.75);
}
.tag-accent { background: var(--color-accent-800); color: var(--color-accent-100); }
.tag-accent-2 { background: var(--color-accent-2-800); color: var(--color-accent-2-100); }
.tag-neutral { background: var(--color-neutral-800); color: var(--color-neutral-100); }
.tag-outline { border: 1px solid var(--color-accent); color: var(--color-accent); }

/* — navigation — */
.nav {
  display: flex; align-items: center; gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-bottom: none;
}
.nav-brand {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 18px; margin-right: auto;
}
.nav a { color: inherit; text-decoration: none; font-size: 14px; }
.nav a:hover, .nav a[aria-current='page'] { color: var(--color-accent); }

/* — tables — */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: color-mix(in srgb, var(--color-text) 60%, transparent);
  padding: var(--space-2); border-bottom: 1px solid transparent; /* keeps layout; the row paints the fading rule */
}
.table td {
  padding: var(--space-2);
  border-bottom: 1px solid transparent;
}
/* Row rules as row-level strips so the end-fade spans the row, not each cell. */
.table thead tr {
  background: linear-gradient(to right,
    transparent, var(--color-divider) 48px,
    var(--color-divider) calc(100% - 48px), transparent) no-repeat bottom / 100% 1px;
}
.table tbody tr {
  background: linear-gradient(to right,
    transparent, color-mix(in srgb, var(--color-text) 8%, transparent) 48px,
    color-mix(in srgb, var(--color-text) 8%, transparent) calc(100% - 48px), transparent) no-repeat bottom / 100% 1px;
}
.table tbody tr:hover {
  /* the hover tint layers over the row rule, which keeps painting */
  background:
    linear-gradient(color-mix(in srgb, var(--color-text) 4%, transparent),
                    color-mix(in srgb, var(--color-text) 4%, transparent)) no-repeat 0 0 / 100% 100%,
    linear-gradient(to right,
      transparent, color-mix(in srgb, var(--color-text) 8%, transparent) 48px,
      color-mix(in srgb, var(--color-text) 8%, transparent) calc(100% - 48px), transparent) no-repeat bottom / 100% 1px;
}

/* — dialog — */
.dialog-backdrop {
  position: fixed; inset: 0; display: grid; place-items: center;
  padding: var(--space-4);
  background: color-mix(in srgb, var(--color-neutral-900) 50%, transparent);
}
.dialog {
  width: min(440px, 100%); display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-4); border-radius: var(--radius-lg);
  background: var(--color-surface); box-shadow: var(--shadow-lg);
}
.dialog-title {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 20px;
}
.dialog-body { font-size: 14px; opacity: 0.85; }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-2); }


/* ══════════════════════════════════════════════════════════════════════════
   Steady — app additions (DESIGN.md). Tokens only, no raw hex.
   ══════════════════════════════════════════════════════════════════════ */
:root {
  --color-warn: oklch(0.80 0.11 75);
  --color-warn-text: oklch(0.85 0.09 75);
  --color-muted: var(--color-neutral-400);
  --color-meta: var(--color-neutral-500);
  --color-accent-text: var(--color-accent-300);
  --chip-on-bg: var(--color-accent-800);
  --chip-on-text: var(--color-accent-100);
  --ground: radial-gradient(120% 55% at 0% 0%, var(--color-accent-900), var(--color-bg) 60%);
  --tabbar-h: 84px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --color-bg: var(--color-neutral-100);
    --color-surface: var(--color-neutral-200);
    --color-text: var(--color-neutral-900);
    --color-divider: color-mix(in srgb, var(--color-neutral-900) 16%, transparent);
    --color-muted: var(--color-neutral-600);
    --color-meta: var(--color-neutral-700);
    --color-accent-text: var(--color-accent-700);
    --chip-on-bg: var(--color-accent-200);
    --chip-on-text: var(--color-accent-800);
    --color-warn-text: oklch(0.55 0.12 70);
    --ground: none;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.08);
    --shadow-md: 0 1px 2px rgba(0,0,0,.08);
    --shadow-lg: 0 1px 2px rgba(0,0,0,.08);
    color-scheme: light;
  }
}

html, body { min-height: 100%; }
body {
  background: var(--color-bg) var(--ground) no-repeat fixed;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.icon { width: 20px; height: 20px; flex: none; display: inline-block;
  background: currentColor; -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; }
.btn { min-height: 44px; }
.btn-lg { min-height: 56px; font-size: 17px; width: 100%; }
.kicker { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-accent); }

/* — shell — */
.screen { padding: 16px 16px calc(var(--tabbar-h) + 16px); max-width: 560px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 12px; }
.screen-head { padding-top: max(16px, env(safe-area-inset-top)); }
.screen-head h1 { font-size: 28px; margin: 0; }
.screen-head .sub { font-size: 14px; color: var(--color-muted); }
.placeholder { color: var(--color-meta); font-size: 14px; }
.screen > .btn:not(.btn-lg) { align-self: flex-start; }

.tabbar { position: fixed; inset: auto 0 0 0; height: var(--tabbar-h);
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--color-bg) 90%, transparent);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  box-shadow: 0 -1px 0 var(--color-neutral-900); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 44px; font-size: 11px; color: var(--color-muted); text-decoration: none; padding-bottom: 12px; }
.tabbar a .icon { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--color-accent); }

/* — login — */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login form { width: min(360px, 100%); display: flex; flex-direction: column; gap: 24px; }
.wordmark { display: flex; align-items: center; gap: 12px; font-size: 32px; font-weight: 500; letter-spacing: -0.02em; }
.wordmark img { width: 36px; height: 36px; }
.login .row { display: flex; gap: 8px; }
.login .input { min-height: 44px; font-size: 16px; }
.login .error { font-size: 13px; color: var(--color-warn-text); min-height: 1.5em; margin: -12px 0 0; }

/* — text bits — */
.card { padding: 16px; gap: 12px; }
.card-text { margin: 0; font-size: 15px; line-height: 1.45; }
.card-meta { font-size: 12px; color: var(--color-meta); margin: 0; }
.warn-text { color: var(--color-warn-text); }
.warn-line { margin: 0; font-size: 14px; color: var(--color-warn-text); }
.screen h6, .day-head { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-muted); margin: 8px 0 4px; }
.inline-row { display: flex; gap: 8px; align-items: center; }
.grow { flex: 1; }
.btn-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; }
.btn-pair .btn { min-height: 48px; font-size: 15px; }
.btn .icon { width: 18px; height: 18px; }
.btn-lg .icon { width: 20px; height: 20px; }

/* — progress ring — */
.ring-row { display: flex; align-items: center; gap: 24px; }
.ring { position: relative; width: 132px; height: 132px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; }
.ring-track { stroke: var(--color-neutral-800); }
.ring-bar { stroke: var(--color-accent); stroke-linecap: round; transition: stroke-dashoffset 400ms ease-out, stroke 200ms; }
.ring.at .ring-bar { stroke: var(--color-accent-300); }
.ring.over .ring-bar { stroke: var(--color-warn); }
.ring.over .ring-count { color: var(--color-warn-text); }
.ring-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-count { font-size: 40px; font-weight: 500; line-height: 1; }
.ring-sub { font-size: 12px; color: var(--color-muted); margin-top: 4px; text-align: center; max-width: 96px; }
.ring-stats { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.ring-stats dt { font-size: 12px; color: var(--color-muted); }
.ring-stats dd { margin: 0; font-size: 16px; }

/* — stepper — */
.stepper { display: inline-flex; align-items: center; height: 44px; border-radius: var(--radius-md);
  box-shadow: inset 0 0 0 1px var(--color-divider); }
.stepper output { min-width: 36px; text-align: center; font-size: 17px; }
.btn-step { width: 44px; height: 44px; display: grid; place-items: center; background: none; border: 0;
  color: var(--color-text); cursor: pointer; border-radius: var(--radius-md); }
.btn-step:active { background: color-mix(in srgb, var(--color-text) 12%, transparent); }
.btn-step .icon { width: 18px; height: 18px; }

/* — chips — */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips-scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.chips-scroll::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; flex: none;
  border: 0; border-radius: var(--radius-md); background: none; color: var(--color-text); font: inherit; font-size: 14px;
  box-shadow: inset 0 0 0 1px var(--color-divider); cursor: pointer; transition: background 150ms ease-out; }
.chip .chip-check { display: none; width: 16px; height: 16px; }
.chip[aria-pressed="true"], .chip[aria-checked="true"] { background: var(--chip-on-bg); color: var(--chip-on-text); box-shadow: none; }
.chip[aria-pressed="true"] .chip-check { display: inline-block; }

/* — list rows — */
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 6px 0;
  background: linear-gradient(to right, transparent, var(--color-divider) 48px, var(--color-divider) calc(100% - 48px), transparent) no-repeat bottom / 100% 1px;
  border: 0; color: var(--color-text); font: inherit; text-align: left; cursor: pointer;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.row:active { background-color: color-mix(in srgb, var(--color-text) 5%, transparent); }
.row-time { width: 46px; flex: none; font-size: 14px; color: var(--color-muted); }
.row-icon { width: 20px; height: 20px; margin: 0 4px; color: var(--color-text); }
.row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-title { font-size: 15px; }
.row-meta { font-size: 12px; color: var(--color-meta); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-chev { width: 16px; height: 16px; color: var(--color-meta); }
.setting-row { padding: 0; }
.setting-value { margin-left: auto; color: var(--color-muted); font-size: 15px; }
.setting-row .row-title { flex: 1; }

.day-group { display: flex; flex-direction: column; }
.day-head { display: flex; justify-content: space-between; gap: 8px; }
.day-sum { text-transform: none; letter-spacing: 0; font-size: 12px; }

/* — forms — */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--color-muted); }
.field .input { color: var(--color-text); }
.field-label { font-size: 13px; }
.field-hint { font-size: 12px; color: var(--color-meta); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.input { min-height: 44px; font-size: 16px; }
.form-error { font-size: 13px; color: var(--color-warn-text); margin: 0; min-height: 0; }
.form-error:empty { display: none; }

/* — bottom sheet — */
.sheet-backdrop { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center;
  background: color-mix(in srgb, var(--color-neutral-900) 70%, transparent); opacity: 0; transition: opacity 200ms ease-out; }
.sheet-backdrop.open { opacity: 1; }
.sheet-backdrop.closing { opacity: 0; }
.sheet { width: min(560px, 100%); max-height: 92dvh; overflow-y: auto; background: var(--color-surface);
  border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lg);
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform 240ms ease-out; }
.sheet-backdrop.open .sheet { transform: none; }
.sheet-backdrop.closing .sheet { transform: translateY(100%); }
.grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--color-neutral-700); margin: 0 auto 12px; }
.sheet-body { display: flex; flex-direction: column; gap: 14px; }
.sheet-title { font-size: 20px; margin: 0; }
.sheet-actions { display: flex; justify-content: space-between; }

/* — toast — */
.toast { position: fixed; z-index: 30; left: 16px; right: 16px; bottom: calc(var(--tabbar-h) + 12px);
  max-width: 528px; margin: 0 auto; display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 4px 12px 4px 14px;
  background: var(--color-surface); border-radius: var(--radius-md); box-shadow: var(--shadow-md);
  opacity: 0; transform: translateY(8px); transition: opacity 180ms ease-out, transform 180ms ease-out; }
.toast.show { opacity: 1; transform: none; }
.toast-msg { flex: 1; font-size: 14px; }
.toast-ring { width: 24px; height: 24px; flex: none; }
.toast-ring circle { fill: none; stroke-width: 1.5; }
.toast-ring .track { stroke: var(--color-accent-700); }
.toast-ring .bar { stroke: var(--color-accent); transform: rotate(-90deg); transform-origin: center;
  animation: toast-countdown linear forwards; stroke-dashoffset: 0; }
.toast-ring text { fill: var(--color-muted); font-size: 10px; text-anchor: middle; dominant-baseline: central; }
@keyframes toast-countdown { to { stroke-dashoffset: 56.55; } }

/* — sleep — */
.sleep-card, .sleep-form { display: flex; flex-direction: column; gap: 14px; }
.sleep-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sleep-head .card-title { margin: 0; }
.sleep-dur { font-size: 14px; color: var(--color-muted); }
.stepper-time { display: flex; justify-content: space-between; width: 100%; }
.quality { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.quality-opt { height: 48px; display: grid; place-items: center; border: 0; border-radius: var(--radius-md); cursor: pointer;
  background: none; color: var(--color-text); box-shadow: inset 0 0 0 1px var(--color-divider); }
.quality-opt .icon { width: 24px; height: 24px; }
.quality-opt[aria-checked="true"] { color: var(--color-accent); box-shadow: inset 0 0 0 1px var(--color-accent);
  background: color-mix(in srgb, var(--color-accent) 14%, transparent); }
.toggles { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.toggles li { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 15px; }
.toggle-label { flex: 1; }
.switch { position: relative; width: 44px; height: 26px; flex: none; border: 0; border-radius: 13px; cursor: pointer;
  background: var(--color-neutral-800); transition: background 150ms ease-out; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--color-neutral-400); transition: transform 150ms ease-out, background 150ms ease-out; }
.switch[aria-checked="true"] { background: var(--color-accent-700); }
.switch[aria-checked="true"]::after { transform: translateX(18px); background: var(--color-accent-200); }
.switch::before { content: ""; position: absolute; inset: -9px -0px; } /* 44px touch target */
.last-evening { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.last-evening .field-label { color: var(--color-muted); margin-right: 4px; }
.tag .icon { width: 12px; height: 12px; margin-right: 4px; }
.card-headrow { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.card-meta .icon { width: 14px; height: 14px; vertical-align: -2px; }
.chip .icon { width: 16px; height: 16px; }
.token { display: block; padding: 12px; border-radius: var(--radius-md); background: var(--color-bg);
  font-size: 13px; word-break: break-all; -webkit-user-select: all; user-select: all; }
code { font-size: 0.92em; }

/* — cravings — */
.snack-plain { width: 100%; min-height: 48px; }
.snack-card { flex-direction: row; align-items: center; gap: 12px;
  box-shadow: 0 0 0 1px var(--color-accent-700), 0 0 28px color-mix(in srgb, var(--color-accent) 16%, transparent); }
.snack-icon { width: 24px; height: 24px; color: var(--color-accent-text); }
.snack-text { flex: 1; min-width: 0; }
.snack-text .card-title { font-size: 16px; }
.snack-card .btn { min-height: 44px; }
.choice-list { display: flex; flex-direction: column; gap: 8px; }
.choice { display: flex; align-items: center; gap: 14px; min-height: 68px; padding: 0 16px; width: 100%; text-align: left;
  border: 0; border-radius: var(--radius-md); background: none; color: var(--color-text); font: inherit; cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--color-divider); }
.choice:active { background: color-mix(in srgb, var(--color-text) 8%, transparent); }
.choice .icon { width: 22px; height: 22px; }
.choice > span { display: flex; flex-direction: column; }
.choice-title { font-size: 16px; font-weight: 500; }
.choice-sub { font-size: 13px; color: var(--color-muted); }
.choice-preferred { box-shadow: inset 0 0 0 1px var(--color-accent); }
.choice-preferred .icon, .choice-preferred .choice-title { color: var(--color-accent-text); }
.choice-preferred:active { background: color-mix(in srgb, var(--color-accent) 18%, transparent); }
.snack-options { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.snack-option { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--color-text) 4%, transparent); }
.snack-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.snack-name { font-size: 15px; }
.snack-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--color-muted); }
.chip[aria-checked="false"] { text-transform: none; }

/* — urge timer — */
body.timer-open { overflow: hidden; }
body.timer-open .tabbar, body.timer-open .toast { visibility: hidden; }
.timer-screen { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column;
  padding: max(16px, env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
  background: var(--color-bg) radial-gradient(120% 55% at 50% 42%, var(--color-accent-900), var(--color-bg) 60%) no-repeat; }
.timer-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.timer-top .btn-icon { width: 44px; height: 44px; }
.timer-top .btn-icon .icon { width: 22px; height: 22px; }
.timer-seg .seg-opt { min-height: 36px; }
.timer-main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; }
.timer-count { font-size: 56px; font-weight: 500; line-height: 1; }
.breath { width: 250px; height: 250px; display: grid; place-items: center; max-width: 70vw; max-height: 70vw; }
.breath-circle { width: 100%; height: 100%; border-radius: 50%;
  border: 1.5px solid var(--color-accent); background: color-mix(in srgb, var(--color-accent) 10%, transparent);
  transform: scale(0.72); animation: breathe 10s ease-in-out infinite; }
@keyframes breathe { 0% { transform: scale(0.72); } 40% { transform: scale(1); } 100% { transform: scale(0.72); } }
.breath-label { font-size: 15px; color: var(--color-accent-text); min-height: 1.5em; }
.timer-tip { font-size: 15px; color: var(--color-muted); max-width: 300px; min-height: 3em; margin: 0; }
.timer-actions { display: flex; flex-direction: column; gap: 8px; max-width: 528px; width: 100%; margin: 0 auto; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
