/* ════════════════════════════════════════════════════════════════════
   VESTA DESIGN SYSTEM
   One flame. Two rooms: the Watch never sleeps, the Desk clocks out.
   Hand-written CSS, no build step: none would pay rent here.
   ════════════════════════════════════════════════════════════════════ */

/* ── reset ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }
::selection { background: color-mix(in srgb, var(--flame) 30%, transparent); }
[id] { scroll-margin-top: 88px; }
[hidden] { display: none !important; }
dialog { color: inherit; }
dialog::backdrop { background: var(--backdrop-medium); }

/* ── the one focus treatment ───────────────────────────────────────── */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--flame-deep); outline-offset: 2px; border-radius: 3px; } /* raw flame is ~3.4:1 on white, at the 3:1 focus-indicator floor; flame-deep clears it with real margin. Dark rooms use raw flame below, ~5.5:1. */
[data-theme="dark"] :focus-visible, .watch :focus-visible { outline-color: var(--flame); }

/* ════════════════════════════════════════════════════════════════════
   TOKENS
   The whole accent palette derives from --flame (the one knob) via
   color-mix(). Set to the brand primary, rgb(255, 69, 0) — the shipped
   logomark below still carries the earlier sampled tone (#EA7910).
   ════════════════════════════════════════════════════════════════════ */
:root {
  /* ── the one knob ──────────────────────────────────────────────────
     Flame orange-red, the brand primary: rgb(255, 69, 0). Every accent,
     on both rooms, derives from it. */
  --flame: #FF4500;
  --flame-deep: color-mix(in oklab, var(--flame) 65%, #200d02);   /* text/links, light room:  ~6.7:1 on canvas */
  --flame-lift: color-mix(in oklab, var(--flame) 55%, #fff3e0);   /* text/links, dark rooms:  ~9.3:1 on canvas */
  --flame-ink:  color-mix(in oklab, var(--flame) 10%, #0a0704);   /* text sitting ON a flame fill: ~5.5:1 */
  --flame-soft: color-mix(in srgb, var(--flame) 14%, #ffffff);    /* light chip fill */
  --flame-wash: color-mix(in srgb, var(--flame) 7%, var(--canvas)); /* faint section tint */
  --flame-glow: color-mix(in srgb, var(--flame) 42%, transparent); /* live-pulse halo */

  /* the wordmark's own gradient, sampled from all three shipped PNGs.
     Reserved for the mark alone: the favicon, the hero glyph, the
     live-ring sweep. It is never a token for interface state. */
  --flame-gradient: linear-gradient(135deg, #cd0027 0%, #ea7910 55%, #fab804 100%);

  /* ── smoke · the one pinned bad-news color ───────────────────────────
     Fire tended is health; smoke is neglect. Cool and desaturated on
     purpose, so it can never be mistaken for the warm flame family.
     Pinned, not knob-derived: it does not retint with the brand. */
  --smoke: #4b5a6e;      /* ~6.7:1 on light canvas */
  --smoke-lift: #93a3b8; /* ~7.4:1 on dark canvas */
  --smoke-soft: color-mix(in srgb, var(--smoke) 12%, #ffffff);

  /* ── semantic set · closed extension, pinned like smoke ──────────────
     Four fixed hues for ordinary app chrome (alerts, badges, validation)
     outside the flame/smoke hearth narrative. Same shape as flame's
     family: base swatch, -deep (light-room text), -lift (dark-room
     text), -ink (text on a filled swatch), -soft (chip/tint fill). */
  --success: #16a34a;
  --success-deep: #15803d;
  --success-lift: #4ade80;
  --success-ink:  #052e16;
  --success-soft: color-mix(in srgb, var(--success) 10%, #ffffff); /* 14% put success-deep-on-soft at ~4.29:1, below AA; 10% clears 4.5:1 */

  --danger: #dc2626;
  --danger-deep: #b91c1c;
  --danger-lift: #f87171;
  --danger-ink:  #450a0a;
  --danger-soft: color-mix(in srgb, var(--danger) 14%, #ffffff);

  --warning: #d97706;
  --warning-deep: #b45309;
  --warning-lift: #fbbf24;
  --warning-ink:  #451a03;
  --warning-soft: color-mix(in srgb, var(--warning) 10%, #ffffff); /* 14% put warning-deep-on-soft at ~4.33:1, below AA; 10% clears 4.5:1 */

  --info: #2563eb;
  --info-deep: #1d4ed8;
  --info-lift: #60a5fa;
  --info-ink:  #172554;
  --info-soft: color-mix(in srgb, var(--info) 14%, #ffffff);

  /* ── surfaces · the Desk, light (default) ────────────────────────── */
  --canvas:   #ffffff;
  --surface:  #ffffff;
  --elevated: #f5f4ef;
  --sunken:   #eae7df;
  --border:   #e3e0d6;

  /* ── text ramp, strongest to faintest ────────────────────────────── */
  --fg:        #1c1a17;
  --strong:    #2b2823;
  --heading:   #3d3a34;
  --muted:     #57534a;
  --secondary: #6b675d;
  --subtle:    #8a8579;
  --faint:     #b5afa0;
  --disabled:  #d8d3c5;

  /* ── motion · scarce, named ───────────────────────────────────────── */
  --dur-fast: 120ms;
  --dur-base: 200ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* ── z-ladder ─────────────────────────────────────────────────────── */
  --z-canvas: 0; --z-sticky: 10; --z-rail: 15; --z-panel: 20;
  --z-dropdown: 50; --z-overlay: 100; --z-toast: 200; --z-tooltip: 210;

  /* ── the named measures beside the 4px steps ─────────────────────── */
  --gutter: 20px;
  --gap-section: 88px;

  /* ── type scale ───────────────────────────────────────────────────── */
  --text-2xs: 0.6875rem;  /* 11px */
  --text-xs:  0.75rem;    /* 12px */
  --text-sm:  0.8125rem;  /* 13px */
  --text-base: 0.875rem;  /* 14px */
  --text-md:  1rem;       /* 16px */
  --text-lg:  1.25rem;    /* 20px */
  --text-xl:  1.75rem;    /* 28px */
  --text-2xl: 2.25rem;    /* 36px */
  --text-numeral: 3.5rem; /* 56px, the Watch's big stat */

  /* ── shape ────────────────────────────────────────────────────────── */
  --radius-sm: 2px;
  --radius: 2px;
  --radius-lg: 6px;
  --radius-full: 999px;

  /* ── shadow (light room) ─────────────────────────────────────────── */
  --shadow-card: 0 1px 2px rgba(28, 26, 23, 0.035);
  --shadow-panel: 0 0 0 1px rgba(28, 26, 23, 0.06), 0 1px 2px rgba(28, 26, 23, 0.04), 0 8px 24px rgba(28, 26, 23, 0.08);

  /* ── backdrop tiers ───────────────────────────────────────────────── */
  --backdrop-light: rgba(20, 17, 13, 0.28);
  --backdrop-medium: rgba(20, 17, 13, 0.48);
  --backdrop-heavy: rgba(12, 10, 8, 0.78);

  color-scheme: light;
  accent-color: var(--flame);
}

/* ── dark mode · the Desk, flipped ────────────────────────────────── */
[data-theme="dark"] {
  --canvas:   #121110;
  --surface:  #1a1917;
  --elevated: #232120;
  --sunken:   #2e2b28;
  --border:   #34312b;

  --fg:        #f2f0ea;
  --strong:    #e8e4db;
  --heading:   #d5d1c4;
  --muted:     #b5afa0;
  --secondary: #999382;
  --subtle:    #787263;
  --faint:     #565248;
  --disabled:  #3d3a34;

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.18);
  --shadow-panel: 0 0 0 1px rgba(0, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.35), 0 12px 32px rgba(0, 0, 0, 0.4);
  --backdrop-light: rgba(0, 0, 0, 0.4);
  --backdrop-medium: rgba(0, 0, 0, 0.6);
  --backdrop-heavy: rgba(0, 0, 0, 0.85);

  color-scheme: dark;
}

/* ── the Watch · constant, own token namespace ───────────────────────
   Never flips: components inside .watch read --watch-* aliases, never
   the room-flipping --canvas/--fg pair, so they never carry a dark flag
   of their own; they are simply always dark, like the ops-center wall. */
.watch {
  --watch-bg: #0e0d0c;
  --watch-panel: #191715;
  --watch-elevated: #211e1b;
  --watch-line: #2a2724;
  --watch-fg: #f2f0ea;
  --watch-muted: #b5afa0;
  --watch-subtle: #9a9484;
  --watch-faint: #5c584c;
  color-scheme: dark;
}

/* ── reduced motion ───────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ════════════════════════════════════════════════════════════════════
   TYPE
   Two faces, both the platform's own: system-ui for every voice and
   label; ui-monospace for anything a keeper might read back (times,
   IDs, zone codes, percentages).
   ════════════════════════════════════════════════════════════════════ */
.font-sans {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, Helvetica, Arial, sans-serif;
}
.mono {
  font-family: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
  font-feature-settings: "tnum" 1;
}
.tabular-nums { font-variant-numeric: tabular-nums; }
.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;
}
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.text-2xs { font-size: var(--text-2xs); }
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-md { font-size: var(--text-md); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-numeral { font-size: var(--text-numeral); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.italic { font-style: italic; }
.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.04em; }
.tracking-wider { letter-spacing: 0.08em; }
.tracking-tight { letter-spacing: -0.01em; }
.leading-tight { line-height: 1.2; }
.leading-relaxed { line-height: 1.6; }
.underline { text-decoration: underline; }
.no-underline { text-decoration: none; }
.list-none { list-style: none; margin: 0; padding: 0; }

/* ════════════════════════════════════════════════════════════════════
   COLOR UTILITIES
   ════════════════════════════════════════════════════════════════════ */
.bg-canvas { background: var(--canvas); }
.bg-surface { background: var(--surface); }
.bg-elevated { background: var(--elevated); }
.bg-sunken { background: var(--sunken); }
.bg-flame { background: var(--flame); }
.bg-flame\/6 { background: color-mix(in srgb, var(--flame) 6%, transparent); }
.bg-flame\/10 { background: color-mix(in srgb, var(--flame) 10%, transparent); }
.bg-flame\/15 { background: color-mix(in srgb, var(--flame) 15%, transparent); }
.bg-flame\/20 { background: color-mix(in srgb, var(--flame) 20%, transparent); }
.bg-smoke\/10 { background: color-mix(in srgb, var(--smoke) 10%, transparent); }
.bg-smoke\/15 { background: color-mix(in srgb, var(--smoke) 15%, transparent); }
.bg-gradient-flame { background: var(--flame-gradient); }

.text-fg { color: var(--fg); }
.text-strong { color: var(--strong); }
.text-heading { color: var(--heading); }
.text-muted { color: var(--muted); }
.text-secondary { color: var(--secondary); }
.text-subtle { color: var(--subtle); }
.text-faint { color: var(--faint); }
.text-disabled { color: var(--disabled); }
.text-flame { color: var(--flame-deep); }
[data-theme="dark"] .text-flame, .watch .text-flame { color: var(--flame-lift); }
.text-flame-ink { color: var(--flame-ink); }
.text-smoke { color: var(--smoke); }
[data-theme="dark"] .text-smoke, .watch .text-smoke { color: var(--smoke-lift); }
.text-success { color: var(--success-deep); }
[data-theme="dark"] .text-success, .watch .text-success { color: var(--success-lift); }
.text-danger { color: var(--danger-deep); }
[data-theme="dark"] .text-danger, .watch .text-danger { color: var(--danger-lift); }
.text-warning { color: var(--warning-deep); }
[data-theme="dark"] .text-warning, .watch .text-warning { color: var(--warning-lift); }
.text-info { color: var(--info-deep); }
[data-theme="dark"] .text-info, .watch .text-info { color: var(--info-lift); }
.text-white { color: #fff; }

.border-border { border-color: var(--border); }
.border-border\/50 { border-color: color-mix(in srgb, var(--border) 50%, transparent); }
.border-flame { border-color: var(--flame); }
.border-smoke { border-color: var(--smoke); }
.border-success { border-color: var(--success); }
.border-danger { border-color: var(--danger); }
.border-warning { border-color: var(--warning); }
.border-info { border-color: var(--info); }
.border-transparent { border-color: transparent; }

/* the Watch's own local ramp */
.watch-bg { background: var(--watch-bg); }
.watch-panel { background: var(--watch-panel); }
.watch-elevated { background: var(--watch-elevated); }
.text-watch-fg { color: var(--watch-fg); }
.text-watch-muted { color: var(--watch-muted); }
.text-watch-subtle { color: var(--watch-subtle); }
.text-watch-faint { color: var(--watch-faint); }
.border-watch-line { border-color: var(--watch-line); }

/* ════════════════════════════════════════════════════════════════════
   LAYOUT
   ════════════════════════════════════════════════════════════════════ */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.inline-block { display: inline-block; }
.block { display: block; }
.hidden { display: none; }
.relative { position: relative; }
.absolute { position: absolute; }
.sticky { position: sticky; }
.fixed { position: fixed; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.mx-auto { margin-left: auto; margin-right: auto; }
.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }
.w-full { width: 100%; }
.w-20 { width: 80px; }
.h-full { height: 100%; }
.h-10 { height: 40px; }
.h-16 { height: 64px; }
.min-w-0 { min-width: 0; }
.shrink-0 { flex-shrink: 0; }
.grow { flex-grow: 1; }
.whitespace-nowrap { white-space: nowrap; }
.place-items-center { place-items: center; }
.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }
.inset-0 { inset: 0; }
.top-0 { top: 0; }
.bottom-0 { bottom: 0; }
.pointer-events-none { pointer-events: none; }
.pointer-events-auto { pointer-events: auto; }
.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }
.z-sticky { z-index: var(--z-sticky); }
.z-rail { z-index: var(--z-rail); }
.z-panel { z-index: var(--z-panel); }
.z-dropdown { z-index: var(--z-dropdown); }
.z-overlay { z-index: var(--z-overlay); }
.z-toast { z-index: var(--z-toast); }

.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.rounded-sm { border-radius: var(--radius-sm); }
.rounded { border-radius: var(--radius); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }
.border { border: 1px solid var(--border); }
.border-t { border-top: 1px solid var(--border); }
.border-b { border-bottom: 1px solid var(--border); }
.border-l { border-left: 1px solid var(--border); }
.border-2 { border-width: 2px; }
.border-dashed { border-style: dashed; }
.shadow-panel { box-shadow: var(--shadow-panel); }

/* ── spacing (4px base) ───────────────────────────────────────────── */
.gap-0\.5 { gap: 2px; } .gap-1 { gap: 4px; } .gap-1\.5 { gap: 6px; }
.gap-2 { gap: 8px; } .gap-2\.5 { gap: 10px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.gap-5 { gap: 20px; } .gap-6 { gap: 24px; } .gap-8 { gap: 32px; }
.space-y-1 > * + * { margin-top: 4px; }
.space-y-1\.5 > * + * { margin-top: 6px; }
.space-y-2 > * + * { margin-top: 8px; }
.space-y-3 > * + * { margin-top: 12px; }
.space-y-4 > * + * { margin-top: 16px; }
.space-y-section > * + * { margin-top: var(--gap-section); }

.p-1 { padding: 4px; } .p-2 { padding: 8px; } .p-3 { padding: 12px; }
.p-4 { padding: 16px; } .p-5 { padding: 20px; } .p-6 { padding: 24px; } .p-8 { padding: 32px; }
.px-1 { padding-inline: 4px; } .px-2 { padding-inline: 8px; } .px-3 { padding-inline: 12px; } .px-4 { padding-inline: 16px; }
.px-5 { padding-inline: var(--gutter); } .px-6 { padding-inline: 24px; }
.py-1 { padding-block: 4px; } .py-1\.5 { padding-block: 6px; } .py-2 { padding-block: 8px; } .py-2\.5 { padding-block: 10px; }
.py-3 { padding-block: 12px; } .py-4 { padding-block: 16px; } .py-8 { padding-block: 32px; }
.py-10 { padding-block: 40px; } .py-16 { padding-block: 64px; } .py-20 { padding-block: 80px; }
.pt-2 { padding-top: 8px; } .pt-4 { padding-top: 16px; } .pt-8 { padding-top: 32px; }
.pb-4 { padding-bottom: 16px; }
.pl-3 { padding-left: 12px; } .pl-4 { padding-left: 16px; }
.mt-0\.5 { margin-top: 2px; } .mt-1 { margin-top: 4px; } .mt-1\.5 { margin-top: 6px; } .mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-5 { margin-top: 20px; } .mt-6 { margin-top: 24px; } .mt-8 { margin-top: 32px; }
.mb-1 { margin-bottom: 4px; } .mb-1\.5 { margin-bottom: 6px; } .mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-5 { margin-bottom: 20px; } .mb-6 { margin-bottom: 24px; } .mb-8 { margin-bottom: 32px; } .mb-12 { margin-bottom: 48px; }

.max-w-page { max-width: 1220px; }
.max-w-prose { max-width: 62ch; }

/* ── responsive (named breakpoints: sm 640 md 768 lg 1024 xl 1280) ─── */
@media (min-width: 640px) {
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sm\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sm\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .sm\:grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .sm\:col-span-2 { grid-column: span 2 / span 2; }
  .sm\:flex { display: flex; }
}
@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\:flex { display: flex; }
  .md\:hidden { display: none; }
  .md\:block { display: block; }
  .md\:py-28 { padding-block: 112px; }
  .md\:text-2xl { font-size: var(--text-2xl); }
}
@media (min-width: 1024px) {
  .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .lg\:grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .lg\:grid-cols-9 { grid-template-columns: repeat(9, minmax(0, 1fr)); }
  .lg\:col-span-2 { grid-column: span 2 / span 2; }
  .lg\:inline { display: inline; }
}

/* ════════════════════════════════════════════════════════════════════
   ICONS
   ════════════════════════════════════════════════════════════════════ */
.icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.icon-dense { stroke-width: 2; }

/* ════════════════════════════════════════════════════════════════════
   CORE COMPONENTS
   ════════════════════════════════════════════════════════════════════ */

/* the skip link */
.skip-link {
  position: absolute; z-index: 300; top: -100px; left: 12px;
  background: var(--flame); color: var(--flame-ink);
  font-size: var(--text-sm); font-weight: 700;
  padding: 10px 16px; border-radius: var(--radius-sm);
  transition: top var(--dur-fast) var(--ease-out);
}
.skip-link:focus { top: 12px; }

/* card · resting content surface */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-card);
}

/* empty state · resolved unhappy path */
.empty-state { text-align: center; padding: 32px 16px; }
.empty-state .icon { color: var(--faint); margin: 0 auto 12px; }

/* top bar and section navigation */
header {
  box-shadow: 0 1px 0 color-mix(in srgb, var(--fg) 4%, transparent);
}
header nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}
header nav[aria-label="Primary"] a {
  height: 56px;
}
header nav a:hover { color: var(--fg); }
header nav[aria-label="Primary"] a::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  border-radius: var(--radius-full);
  background: var(--flame);
  opacity: 0;
  transform: scaleX(0.45);
  transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
header nav[aria-label="Primary"] a[aria-current="true"] {
  color: var(--flame-deep);
}
[data-theme="dark"] header nav[aria-label="Primary"] a[aria-current="true"] {
  color: var(--flame-lift);
}
header nav[aria-label="Primary"] a[aria-current="true"]::after,
header nav[aria-label="Primary"] a:hover::after {
  opacity: 1;
  transform: scaleX(1);
}
header nav[aria-label="Primary, compact"] a {
  min-height: 38px;
  padding-block: 10px;
}
header nav[aria-label="Primary, compact"] a[aria-current="true"] {
  color: var(--flame-deep);
}
[data-theme="dark"] header nav[aria-label="Primary, compact"] a[aria-current="true"] {
  color: var(--flame-lift);
}
header nav[aria-label="Primary, compact"] > div {
  scrollbar-width: none;
}
header nav[aria-label="Primary, compact"] > div::-webkit-scrollbar { display: none; }

/* tiny visual rhythm marker used by every section intro */
main > section > .mono:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
}
main > section > .mono:first-child::before {
  content: "";
  width: 22px;
  height: 1px;
  flex: 0 0 22px;
  background: currentColor;
  opacity: 0.55;
}

/* panel · elevated floating chrome (topbar, dropdowns, modal frame) */
.panel {
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
}

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 16px; border-radius: var(--radius-sm);
  font-size: var(--text-sm); font-weight: 600; white-space: nowrap;
  border: 1px solid transparent; transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.btn-primary { background: var(--flame); color: var(--flame-ink); }
.btn-primary:hover { background: color-mix(in oklab, var(--flame) 88%, #fff3e0); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--fg); }
.btn-ghost:hover { border-color: var(--subtle); }
.btn-danger { background: transparent; border-color: var(--border); color: var(--fg); }
.btn-danger:hover { border-color: var(--smoke); color: var(--smoke); }
[data-theme="dark"] .btn-danger:hover, .watch .btn-danger:hover { color: var(--smoke-lift); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-sm { height: 30px; padding: 0 12px; font-size: var(--text-xs); }

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px;
  border-radius: var(--radius-sm); border: 1px solid var(--border); color: var(--muted);
  transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.icon-btn:hover { color: var(--fg); border-color: var(--subtle); }
.icon-btn.active { background: var(--flame-soft); border-color: var(--flame); color: var(--flame-deep); }
[data-theme="dark"] .icon-btn.active, .watch .icon-btn.active { color: var(--flame-lift); background: color-mix(in srgb, var(--flame) 18%, transparent); }
.icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.icon-btn-sm { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: var(--radius-sm); color: var(--muted); }
.icon-btn-sm:hover { color: var(--fg); background: var(--elevated); }
.icon-btn-xs { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: var(--radius-sm); color: var(--subtle); }

/* chips / pills */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px; border-radius: var(--radius-full);
  font-size: var(--text-2xs); font-weight: 600; letter-spacing: 0.02em;
  border: 1px solid var(--border); color: var(--secondary); background: var(--elevated);
}
.chip-flame { border-color: var(--flame); color: var(--flame-deep); background: var(--flame-soft); }
[data-theme="dark"] .chip-flame, .watch .chip-flame { color: var(--flame-lift); background: color-mix(in srgb, var(--flame) 16%, transparent); }
.chip-success { border-color: var(--success); color: var(--success-deep); background: var(--success-soft); }
[data-theme="dark"] .chip-success, .watch .chip-success { color: var(--success-lift); background: color-mix(in srgb, var(--success) 16%, transparent); }
.chip-danger { border-color: var(--danger); color: var(--danger-deep); background: var(--danger-soft); }
[data-theme="dark"] .chip-danger, .watch .chip-danger { color: var(--danger-lift); background: color-mix(in srgb, var(--danger) 16%, transparent); }
.chip-warning { border-color: var(--warning); color: var(--warning-deep); background: var(--warning-soft); }
[data-theme="dark"] .chip-warning, .watch .chip-warning { color: var(--warning-lift); background: color-mix(in srgb, var(--warning) 16%, transparent); }
.chip-info { border-color: var(--info); color: var(--info-deep); background: var(--info-soft); }
[data-theme="dark"] .chip-info, .watch .chip-info { color: var(--info-lift); background: color-mix(in srgb, var(--info) 16%, transparent); }
.chip-smoke { border-color: var(--smoke); color: var(--smoke); background: var(--smoke-soft); }
[data-theme="dark"] .chip-smoke, .watch .chip-smoke { color: var(--smoke-lift); background: color-mix(in srgb, var(--smoke) 16%, transparent); }
.chip[aria-pressed="true"] { border-color: var(--flame); color: var(--flame-deep); background: var(--flame-soft); }
[data-theme="dark"] .chip[aria-pressed="true"], .watch .chip[aria-pressed="true"] { color: var(--flame-lift); background: color-mix(in srgb, var(--flame) 16%, transparent); }
.zone-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px 0 8px; border-radius: var(--radius-full);
  font-size: var(--text-2xs); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  background: var(--sunken); color: var(--muted);
}
.watch .zone-chip { background: var(--watch-elevated); color: var(--watch-muted); }
.badge-count {
  display: inline-grid; place-items: center; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: var(--radius-full); font-size: 9px; font-weight: 700;
  background: var(--sunken); color: var(--secondary);
}

/* avatar · initials bubble */
.avatar {
  display: inline-grid; place-items: center; flex-shrink: 0;
  width: 28px; height: 28px; border-radius: var(--radius-full);
  background: var(--sunken); color: var(--secondary);
  font-size: var(--text-2xs); font-weight: 700;
}
.avatar-sm { width: 22px; height: 22px; font-size: 9px; }
.avatar-unassigned {
  border: 1.5px dashed var(--border); background: transparent; color: var(--faint);
}

/* kbd */
.kbd {
  display: inline-flex; align-items: center; height: 20px; padding: 0 6px;
  border-radius: 4px; border: 1px solid var(--border); border-bottom-width: 2px;
  font-family: ui-monospace, monospace; font-size: 10.5px; color: var(--secondary); background: var(--elevated);
}

/* dot texture, for the Watch hero */
.dot-grid {
  background-image: radial-gradient(color-mix(in srgb, var(--watch-fg) 14%, transparent) 1px, transparent 1px);
  background-size: 18px 18px;
}

/* ════════════════════════════════════════════════════════════════════
   FORMS
   ════════════════════════════════════════════════════════════════════ */
.field-label {
  display: block; font-size: var(--text-xs); font-weight: 600; color: var(--heading); margin-bottom: 6px;
}
.field-help { font-size: var(--text-2xs); color: var(--subtle); margin-top: 6px; }
.field-error { font-size: var(--text-2xs); color: var(--smoke); margin-top: 6px; display: flex; align-items: center; gap: 4px; }
[data-theme="dark"] .field-error, .watch .field-error { color: var(--smoke-lift); }
.required-mark { color: var(--flame-deep); }
[data-theme="dark"] .required-mark, .watch .required-mark { color: var(--flame-lift); }

.vs-input, .vs-textarea, .vs-select {
  appearance: none; -webkit-appearance: none;
  width: 100%; height: 38px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--fg);
  font-size: var(--text-sm); transition: border-color var(--dur-fast) var(--ease-out);
}
.vs-input[type="search"]::-webkit-search-decoration,
.vs-input[type="search"]::-webkit-search-cancel-button { appearance: none; -webkit-appearance: none; }
.vs-input::-webkit-calendar-picker-indicator { filter: invert(0.5); }
.vs-textarea { height: auto; padding: 10px 12px; min-height: 88px; resize: vertical; }
.vs-input:hover, .vs-textarea:hover, .vs-select:hover { border-color: var(--subtle); }
.vs-input:focus-visible, .vs-textarea:focus-visible, .vs-select:focus-visible { border-color: var(--flame); }
.vs-input.invalid, .vs-textarea.invalid { border-color: var(--smoke); }
.vs-input::placeholder, .vs-textarea::placeholder { color: var(--faint); }
.vs-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238a8579'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 30px; }

.vs-check, .vs-radio {
  appearance: none; width: 18px; height: 18px; border: 1.5px solid var(--border); background: var(--surface);
  display: inline-grid; place-items: center; flex-shrink: 0; cursor: pointer;
}
.vs-check { border-radius: var(--radius-sm); }
.vs-radio { border-radius: 50%; }
.vs-check:checked, .vs-radio:checked { border-color: var(--flame); background: var(--flame); }
.vs-check:checked::after { content: ""; width: 10px; height: 10px; background: var(--flame-ink); clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 45% 62%); }
.vs-radio:checked::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--flame-ink); }

.form-summary {
  border: 1px solid var(--smoke); border-radius: var(--radius); padding: 14px 16px;
  background: var(--smoke-soft);
}
[data-theme="dark"] .form-summary, .watch .form-summary { background: color-mix(in srgb, var(--smoke-lift) 12%, transparent); }

/* vs-table · record lists (requests, AODM assets, checklist history) */
.vs-table { width: 100%; border-collapse: collapse; font-size: var(--text-xs); }
.vs-table th {
  text-align: left; padding: 8px 12px; font-weight: 600; color: var(--subtle);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.vs-table th[aria-sort] { cursor: pointer; }
.vs-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); color: var(--secondary); }
.vs-table tbody tr:hover td { background: var(--elevated); }
.vs-table tbody tr[data-selected="true"] td { background: var(--flame-wash); }
.vs-table tbody tr[data-selected="true"] td:first-child { box-shadow: inset 2px 0 0 var(--flame); }
.vs-table tr[data-state="due-soon"] td:first-child { box-shadow: inset 3px 0 0 var(--flame); }
.vs-table tr[data-state="overdue"] td:first-child { box-shadow: inset 3px 0 0 var(--smoke); }

/* ════════════════════════════════════════════════════════════════════
   STATUS · TOAST
   ════════════════════════════════════════════════════════════════════ */
.toast {
  display: flex; align-items: center; gap: 12px;
  width: 340px; max-width: calc(100vw - 40px); padding: 12px 14px;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-panel);
}
.toast-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: var(--radius-sm);
  background: var(--elevated);
  color: var(--muted);
}
.toast-flame .toast-icon {
  background: var(--flame-soft);
  color: var(--flame-deep);
}
.toast-trouble .toast-icon {
  background: var(--smoke-soft);
  color: var(--smoke);
}
[data-theme="dark"] .toast-flame .toast-icon, .watch .toast-flame .toast-icon {
  background: color-mix(in srgb, var(--flame) 16%, transparent);
  color: var(--flame-lift);
}
[data-theme="dark"] .toast-trouble .toast-icon, .watch .toast-trouble .toast-icon {
  background: color-mix(in srgb, var(--smoke-lift) 14%, transparent);
  color: var(--smoke-lift);
}
.toast-success .toast-icon { background: var(--success-soft); color: var(--success-deep); }
[data-theme="dark"] .toast-success .toast-icon, .watch .toast-success .toast-icon { background: color-mix(in srgb, var(--success) 16%, transparent); color: var(--success-lift); }
.toast-danger .toast-icon { background: var(--danger-soft); color: var(--danger-deep); }
[data-theme="dark"] .toast-danger .toast-icon, .watch .toast-danger .toast-icon { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger-lift); }
.toast-warning .toast-icon { background: var(--warning-soft); color: var(--warning-deep); }
[data-theme="dark"] .toast-warning .toast-icon, .watch .toast-warning .toast-icon { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning-lift); }
.toast-info .toast-icon { background: var(--info-soft); color: var(--info-deep); }
[data-theme="dark"] .toast-info .toast-icon, .watch .toast-info .toast-icon { background: color-mix(in srgb, var(--info) 16%, transparent); color: var(--info-lift); }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.tab {
  padding: 10px 4px; margin-bottom: -1px; font-size: var(--text-sm); font-weight: 600;
  color: var(--subtle); border-bottom: 2px solid transparent; margin-right: 20px;
}
.tab[aria-selected="true"] { color: var(--flame-deep); border-bottom-color: var(--flame); }
[data-theme="dark"] .tab[aria-selected="true"], .watch .tab[aria-selected="true"] { color: var(--flame-lift); }

/* pagination */
.page-btn {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: var(--radius-sm);
  font-size: var(--text-xs); font-weight: 600; color: var(--secondary);
}
.page-btn[aria-current="true"] { background: var(--flame); color: var(--flame-ink); }

/* ════════════════════════════════════════════════════════════════════
   PRODUCT KIT
   ════════════════════════════════════════════════════════════════════ */

/* task row · the atom */
.task-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  border-left: 3px solid var(--border);
}
.task-row[data-state="due-soon"] { border-left-color: var(--flame); }
.task-row[data-state="overdue"] { border-left-color: var(--smoke); }
.task-row[data-state="done"] { opacity: 0.7; }
.task-row[data-state="rotted"] { border-style: dashed; opacity: 0.75; }

/* checklist */
.checklist-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.checklist-item:last-child { border-bottom: 0; }
.progress-bar { height: 6px; border-radius: var(--radius-full); background: var(--sunken); overflow: hidden; }
.progress-bar > span { display: block; height: 100%; background: var(--flame); border-radius: var(--radius-full); transition: width var(--dur-base) var(--ease-out); }
.watch .progress-bar { background: var(--watch-elevated); }

/* progress ring */
.ring-track { stroke: var(--sunken); fill: none; }
.watch .ring-track { stroke: var(--watch-elevated); }
.ring-value { stroke: var(--flame); fill: none; stroke-linecap: round; transition: stroke-dashoffset var(--dur-base) var(--ease-out); }

/* feedback kiosk */
.kiosk { display: flex; gap: 10px; justify-content: center; }
.kiosk-face {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--border); color: var(--subtle); background: var(--surface);
  transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.kiosk-face:hover { transform: translateY(-2px); }
.kiosk-face[aria-pressed="true"] { border-color: var(--flame); color: var(--flame-deep); background: var(--flame-soft); }
[data-theme="dark"] .kiosk-face[aria-pressed="true"], .watch .kiosk-face[aria-pressed="true"] { color: var(--flame-lift); background: color-mix(in srgb, var(--flame) 18%, transparent); }

/* ledger */
.ledger-row {
  display: grid; grid-template-columns: 84px 1fr auto; gap: 12px; align-items: baseline;
  padding: 8px 0; border-bottom: 1px solid var(--border); font-size: var(--text-xs);
}
.watch .ledger-row { border-bottom-color: var(--watch-line); }

/* comment row · a timeline entry, interleaves with ledger-row */
.comment-row { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.comment-row:last-child { border-bottom: 0; }

/* stat tile · Desk-side KPI, flips light/dark unlike watch-tile */
.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 16px; }

/* record header · zone/breadcrumb + title + status + actions */
.record-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* fact row · key-value attribute list */
.fact-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: var(--text-xs); }
.fact-row:last-child { border-bottom: 0; }

/* breadcrumb */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--subtle); }
.breadcrumb a { color: var(--subtle); text-decoration: none; }
.breadcrumb a:hover { color: var(--fg); }
.breadcrumb [aria-current="page"] { color: var(--fg); font-weight: 600; }
.breadcrumb svg { color: var(--faint); flex-shrink: 0; }

/* app rail · left sidebar nav for a desktop sub-app */
.app-rail { width: 220px; flex-shrink: 0; border-right: 1px solid var(--border); background: var(--surface); padding: 12px; }
.app-rail a {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px;
  border-radius: var(--radius-sm); color: var(--muted); text-decoration: none; font-size: var(--text-sm); font-weight: 500;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.app-rail a:hover { background: var(--elevated); color: var(--fg); }
.app-rail a[aria-current="true"] { background: var(--flame-soft); color: var(--flame-deep); }
[data-theme="dark"] .app-rail a[aria-current="true"], .watch .app-rail a[aria-current="true"] { color: var(--flame-lift); background: color-mix(in srgb, var(--flame) 18%, transparent); }

/* shift strip */
.shift-slot {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: var(--radius); border: 1px solid var(--border);
}
.shift-slot[data-now="true"] { border-color: var(--flame); background: var(--flame-wash); }

/* watch tile · bespoke surfaces for the always-dark ops wall, so the
   generic card/task-row never needs to carry a dark flag of its own */
.watch-tile {
  background: var(--watch-panel); border: 1px solid var(--watch-line);
  border-radius: var(--radius); padding: 16px;
}
.watch-feed-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  background: var(--watch-panel); border: 1px solid var(--watch-line);
  border-left: 3px solid var(--watch-line); border-radius: var(--radius);
}
.watch-feed-row[data-state="due-soon"] { border-left-color: var(--flame); }
.watch-feed-row[data-state="overdue"] { border-left-color: var(--smoke-lift); }

/* live dot */
.live-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--flame); flex-shrink: 0; }
.live-dot::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  background: var(--flame-glow); animation: live-pulse 2.4s var(--ease-out) infinite;
}
@keyframes live-pulse {
  0% { transform: scale(0.6); opacity: 0.9; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* the scrollspy side rail */
.vs-rail {
  position: fixed; top: 50%; right: 20px; transform: translateY(-50%); z-index: var(--z-rail);
  display: none; flex-direction: column; gap: 10px;
}
.vs-rail a {
  width: 8px; height: 8px; border-radius: 50%; background: var(--border);
  transition: background-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.vs-rail a[aria-current="true"] { background: var(--flame); transform: scale(1.4); }
@media (min-width: 1280px) { .vs-rail { display: flex; } }

/* port notes code block */
.port-pre {
  font-family: ui-monospace, monospace; font-size: 11.5px; line-height: 1.7; color: var(--secondary);
  white-space: pre-wrap; margin: 0;
}
.port-pre .c { color: var(--faint); }

/* narrow desks keep dense component examples readable without making the
   page itself wider than the device */
@media (max-width: 639px) {
  .card > table { min-width: 520px; }
  .task-row { align-items: flex-start; gap: 10px; }
  .task-row .zone-chip { max-width: 34%; height: auto; min-height: 24px; padding-block: 5px; white-space: normal; }
  .watch-feed-row { align-items: flex-start; }
  .watch-feed-row > span:last-child { flex-shrink: 0; }
  .ledger-row { grid-template-columns: 56px minmax(0, 1fr) auto; gap: 8px; }
}
