/*
 * HealthTrends design system (ported from the original Tailwind theme).
 * Warm, domestic, precise: a family notebook that can draw charts.
 * Teal for primary action and structure, ochre for selected attention,
 * red only for destructive or out-of-range states.
 */

@font-face {
  font-family: "Fraunces";
  src: url("/assets/fonts/fraunces-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Inter Tight";
  src: url("/assets/fonts/inter-tight-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --radius: 0.5rem;
  --font-display: "Fraunces", ui-serif, Georgia, serif;
  --font-sans: "Inter Tight", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --background: oklch(0.985 0.004 200);
  --surface: oklch(1 0 0);
  --surface-2: oklch(0.965 0.006 200);
  --foreground: oklch(0.22 0.04 200);
  --ink-soft: oklch(0.42 0.03 200);
  --border: oklch(0.9 0.012 200);
  --border-strong: oklch(0.82 0.018 200);
  --primary: oklch(0.5 0.09 195);
  --primary-foreground: oklch(0.985 0.004 200);
  --primary-soft: oklch(0.93 0.028 195);
  --primary-soft-foreground: oklch(0.32 0.06 195);
  --highlight: oklch(0.78 0.13 75);
  --highlight-foreground: oklch(0.25 0.05 75);
  --destructive: oklch(0.55 0.18 25);
  --destructive-foreground: oklch(0.985 0.004 200);
  --success: oklch(0.55 0.1 160);
  --success-foreground: oklch(0.985 0.004 200);
  --warning: oklch(0.7 0.14 70);
  --warning-foreground: oklch(0.2 0.05 70);
  --chart-1: oklch(0.5 0.09 195);
  --chart-2: oklch(0.63 0.08 200);
  --chart-5: oklch(0.78 0.13 75);
  --sidebar: oklch(0.965 0.006 200);
  --sidebar-accent: oklch(0.93 0.012 200);
  --shadow-1: 0 1px 2px 0 oklch(0.22 0.04 200 / 0.04), 0 1px 1px 0 oklch(0.22 0.04 200 / 0.03);
  --shadow-2: 0 4px 10px -2px oklch(0.22 0.04 200 / 0.08), 0 2px 4px -2px oklch(0.22 0.04 200 / 0.05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: oklch(0.18 0.022 200);
    --surface: oklch(0.22 0.025 200);
    --surface-2: oklch(0.26 0.028 200);
    --foreground: oklch(0.96 0.006 200);
    --ink-soft: oklch(0.78 0.012 200);
    --border: oklch(0.32 0.025 200);
    --border-strong: oklch(0.4 0.03 200);
    --primary: oklch(0.72 0.1 195);
    --primary-foreground: oklch(0.18 0.04 200);
    --primary-soft: oklch(0.3 0.05 195);
    --primary-soft-foreground: oklch(0.9 0.04 195);
    --highlight: oklch(0.8 0.14 75);
    --highlight-foreground: oklch(0.2 0.05 75);
    --destructive: oklch(0.7 0.17 25);
    --destructive-foreground: oklch(0.18 0.04 200);
    --success: oklch(0.72 0.1 160);
    --success-foreground: oklch(0.18 0.04 200);
    --warning: oklch(0.78 0.14 70);
    --chart-1: oklch(0.72 0.1 195);
    --chart-2: oklch(0.8 0.08 200);
    --chart-5: oklch(0.8 0.14 75);
    --sidebar: oklch(0.22 0.025 200);
    --sidebar-accent: oklch(0.28 0.03 200);
  }
}

*, ::before, ::after { box-sizing: border-box; }
html {
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--background);
  color: var(--foreground);
  font-size: 0.9375rem;
  line-height: 1.5;
}
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.022em;
  text-wrap: balance;
  margin: 0;
  line-height: 1.2;
}
h1 { font-size: 1.75rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: oklch(0.5 0.09 195 / 0.18); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.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;
}

.icon { width: 1rem; height: 1rem; flex-shrink: 0; }
.icon-lg { width: 1.25rem; height: 1.25rem; }
.brand { color: var(--primary); }
.wordmark {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-variation-settings: "opsz" 36, "SOFT" 50, "wght" 500;
  letter-spacing: -0.01em;
  color: var(--foreground);
}
.muted { color: var(--ink-soft); }
.small { font-size: 0.8125rem; }
.tiny { font-size: 0.75rem; }
.mono, .tnum { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.tnum { font-family: inherit; }
.nowrap { white-space: nowrap; }
.stack > * + * { margin-top: 1rem; }
.stack-sm > * + * { margin-top: 0.5rem; }
.stack-lg > * + * { margin-top: 2rem; }
.row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.grid-2 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }
.grid-3 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: 15rem minmax(0, 1fr); min-height: 100dvh; }
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 1rem 0.75rem;
  display: flex; flex-direction: column; gap: 1rem;
  position: sticky; top: 0; height: 100dvh; overflow-y: auto;
}
.sidebar .home { display: flex; align-items: center; gap: 0.625rem; text-decoration: none; padding: 0 0.5rem; }
.nav-group { display: flex; flex-direction: column; gap: 0.125rem; }
.nav-label { font-size: 0.6875rem; font-weight: 500; color: var(--ink-soft); padding: 0.25rem 0.5rem; }
.nav-link {
  display: flex; align-items: center; gap: 0.625rem;
  padding: 0.4rem 0.5rem; border-radius: 0.375rem;
  text-decoration: none; font-size: 0.9rem; color: var(--foreground);
  background: none; border: 0; cursor: pointer; width: 100%; text-align: left;
}
.nav-link:hover { background: var(--sidebar-accent); }
.nav-link[aria-current="page"] { background: var(--primary-soft); color: var(--primary-soft-foreground); }
.sidebar-foot { margin-top: auto; }
.main { padding: 1.5rem clamp(1rem, 3vw, 2.5rem) 4rem; max-width: 72rem; width: 100%; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 1.5rem; }
.mobile-bar { display: none; }

@media (max-width: 52rem) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; position: fixed; inset: 0 auto 0 0; width: min(18rem, 85vw); z-index: 40; box-shadow: var(--shadow-2); }
  .shell.nav-open .sidebar { display: flex; }
  .mobile-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
    padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); background: var(--surface);
    position: sticky; top: 0; z-index: 30;
  }
  .main { padding-top: 1rem; }
}

/* ---------- Person switcher ---------- */
.switcher { position: relative; }
.switcher select { min-width: 12rem; max-width: 100%; }

/* ---------- Surfaces ---------- */
.surface { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.surface-inset { background: var(--surface-2); border-radius: var(--radius); }
.pad { padding: 1.25rem; }
.pad-sm { padding: 0.875rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.75rem; flex-wrap: wrap; }
.section-head p { color: var(--ink-soft); font-size: 0.8125rem; }
.eyebrow { font-size: 0.75rem; font-weight: 500; color: var(--ink-soft); letter-spacing: 0.02em; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-head p { color: var(--ink-soft); margin-top: 0.25rem; max-width: 60ch; }
.empty { color: var(--ink-soft); font-size: 0.875rem; padding: 0.75rem 0; }
.divider { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 2.25rem; padding: 0.4rem 0.85rem;
  border-radius: 0.375rem; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--foreground);
  font-size: 0.875rem; font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color 120ms, border-color 120ms;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover { background: oklch(from var(--primary) calc(l - 0.04) c h); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { color: var(--destructive); border-color: color-mix(in oklab, var(--destructive) 40%, var(--border)); }
.btn-danger:hover { background: color-mix(in oklab, var(--destructive) 10%, var(--surface)); }
.btn-danger-solid { background: var(--destructive); border-color: var(--destructive); color: var(--destructive-foreground); }
.btn-sm { min-height: 1.875rem; padding: 0.25rem 0.6rem; font-size: 0.8125rem; }
.btn-lg { min-height: 2.75rem; padding: 0.6rem 1.2rem; font-size: 1rem; }
.btn-icon { padding: 0.35rem; min-height: 0; }
.link { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }
form.inline { display: inline; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.field > label, .label { font-size: 0.8125rem; font-weight: 500; }
.hint { font-size: 0.75rem; color: var(--ink-soft); }
.input, select, textarea, input:not([type]), input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="number"], input[type="url"], input[type="search"] {
  width: 100%; min-height: 2.25rem; padding: 0.4rem 0.65rem;
  border: 1px solid var(--border-strong); border-radius: 0.375rem;
  background: var(--surface); font-size: 0.875rem;
}
textarea { min-height: 5.5rem; resize: vertical; line-height: 1.5; }
input[type="file"] { font-size: 0.875rem; }
input[type="checkbox"] { width: 1rem; height: 1rem; accent-color: var(--primary); }
.form-grid { display: grid; gap: 0.875rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); align-items: end; }
.form-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-top: 1rem; }
.check { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.875rem; }
fieldset { border: 0; padding: 0; margin: 0; }

/* ---------- Flash ---------- */
.flash {
  border-radius: var(--radius); padding: 0.75rem 1rem; font-size: 0.875rem; margin-bottom: 1rem;
  border: 1px solid var(--border); background: var(--surface);
  display: flex; gap: 0.6rem; align-items: flex-start;
}
.flash-error { border-color: color-mix(in oklab, var(--destructive) 45%, var(--border)); background: color-mix(in oklab, var(--destructive) 7%, var(--surface)); }
.flash-ok { border-color: color-mix(in oklab, var(--success) 45%, var(--border)); background: color-mix(in oklab, var(--success) 8%, var(--surface)); }
.flash-note { border-color: color-mix(in oklab, var(--highlight) 55%, var(--border)); background: color-mix(in oklab, var(--highlight) 10%, var(--surface)); }

/* ---------- Status pill and range bar ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.75rem; font-weight: 500; padding: 0.1rem 0.5rem; border-radius: 999px;
  border: 1px solid var(--border); white-space: nowrap; background: var(--surface);
}
.pill::before { content: ""; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--ink-soft); }
.pill-normal::before { background: var(--success); }
.pill-borderline { border-color: color-mix(in oklab, var(--warning) 55%, var(--border)); }
.pill-borderline::before { background: var(--warning); }
.pill-low, .pill-high { border-color: color-mix(in oklab, var(--destructive) 50%, var(--border)); color: var(--destructive); }
.pill-low::before, .pill-high::before { background: var(--destructive); }
.badge { display: inline-block; font-size: 0.7rem; font-weight: 500; padding: 0.05rem 0.45rem; border-radius: 999px; background: var(--surface-2); color: var(--ink-soft); }
.badge-attn { background: color-mix(in oklab, var(--highlight) 25%, var(--surface)); color: var(--highlight-foreground); }
@media (prefers-color-scheme: dark) { .badge-attn { color: var(--highlight); } }

.rangebar { width: 100%; max-width: 12rem; height: 18px; color: var(--ink-soft); }
.rangebar .band { fill: color-mix(in oklab, var(--success) 22%, transparent); }
.rangebar .track { fill: var(--surface-2); }
.rangebar .dot { fill: var(--foreground); stroke: var(--surface); stroke-width: 1.5; }
.rangebar .dot.out { fill: var(--destructive); }
.rangebar .dot.warn { fill: var(--warning); }
.spark { width: 6rem; height: 1.75rem; color: var(--chart-1); }
.spark path { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.spark circle { fill: currentColor; }

/* ---------- Trend chart ---------- */
.chart { width: 100%; max-width: 44rem; height: auto; overflow: visible; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis-label { fill: var(--ink-soft); font-size: 11px; font-family: var(--font-mono); }
.chart .band { fill: color-mix(in oklab, var(--success) 14%, transparent); }
.chart .band-edge { stroke: color-mix(in oklab, var(--success) 55%, transparent); stroke-dasharray: 3 3; }
.chart .line { fill: none; stroke: var(--chart-1); stroke-width: 2; stroke-linejoin: round; }
.chart .pt { fill: var(--surface); stroke: var(--chart-1); stroke-width: 2; }
.chart .pt.out { stroke: var(--destructive); fill: var(--destructive); }
.chart .pt.warn { stroke: var(--warning); fill: var(--warning); }
.chart .pt-label { fill: var(--foreground); font-size: 11px; font-family: var(--font-mono); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th { text-align: left; font-weight: 500; font-size: 0.75rem; color: var(--ink-soft); padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.edit-row td { background: var(--surface-2); }
tr.flagged td:first-child { box-shadow: inset 3px 0 0 var(--highlight); }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 0.65rem 0; border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: 0; }
.door {
  display: flex; flex-direction: column; gap: 0.35rem; text-decoration: none;
  padding: 1rem; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface);
  transition: border-color 120ms, box-shadow 120ms;
}
.door:hover { border-color: var(--border-strong); box-shadow: var(--shadow-1); }
.door .name { font-family: var(--font-display); font-size: 1.1rem; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; overflow-x: auto; }
.tab { padding: 0.5rem 0.75rem; text-decoration: none; font-size: 0.875rem; color: var(--ink-soft); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab[aria-current="page"] { color: var(--foreground); border-bottom-color: var(--primary); font-weight: 500; }

/* ---------- Markdown output ---------- */
.prose { font-size: 0.9375rem; line-height: 1.6; }
.prose > * + * { margin-top: 0.75rem; }
.prose h1, .prose h2, .prose h3, .prose h4 { font-size: 1.05rem; margin-top: 1.25rem; }
.prose ul, .prose ol { padding-left: 1.25rem; margin: 0.5rem 0; }
.prose li + li { margin-top: 0.25rem; }
.prose code { font-family: var(--font-mono); font-size: 0.85em; background: var(--surface-2); padding: 0.05rem 0.3rem; border-radius: 0.25rem; }
.prose table { margin: 0.5rem 0; }
.disclaimer { font-size: 0.75rem; color: var(--ink-soft); border-top: 1px dashed var(--border); padding-top: 0.5rem; margin-top: 0.75rem; }

/* ---------- Chat ---------- */
.chat { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.threads { display: flex; flex-direction: column; gap: 0.25rem; }
.thread-link { display: block; padding: 0.45rem 0.6rem; border-radius: 0.375rem; text-decoration: none; font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-link:hover { background: var(--surface-2); }
.thread-link[aria-current="page"] { background: var(--primary-soft); color: var(--primary-soft-foreground); }
.messages { display: flex; flex-direction: column; gap: 0.875rem; min-height: 16rem; }
.msg { max-width: 46rem; padding: 0.75rem 1rem; border-radius: 0.75rem; }
.msg-user { align-self: flex-end; background: var(--primary-soft); color: var(--primary-soft-foreground); white-space: pre-wrap; }
.msg-assistant { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); }
.msg-error { border-color: color-mix(in oklab, var(--destructive) 45%, var(--border)); }
.composer { display: flex; gap: 0.5rem; align-items: flex-end; margin-top: 1rem; }
.composer textarea { min-height: 2.75rem; }
.coach { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.75rem; }
@media (max-width: 52rem) { .chat { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Command palette ---------- */
dialog {
  border: 1px solid var(--border); border-radius: 0.75rem; padding: 0;
  background: var(--surface); color: var(--foreground); box-shadow: var(--shadow-2);
  width: min(34rem, calc(100vw - 2rem));
}
dialog::backdrop { background: oklch(0.22 0.04 200 / 0.35); }
.palette input { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; min-height: 3rem; padding: 0.75rem 1rem; font-size: 1rem; }
.palette ul { list-style: none; margin: 0; padding: 0.4rem; max-height: 22rem; overflow-y: auto; }
.palette li a { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.65rem; border-radius: 0.375rem; text-decoration: none; font-size: 0.9rem; }
.palette li[aria-selected="true"] a, .palette li a:hover { background: var(--surface-2); }
.palette .group { font-size: 0.7rem; color: var(--ink-soft); padding: 0.5rem 0.65rem 0.2rem; }
.kbd { font-family: var(--font-mono); font-size: 0.7rem; border: 1px solid var(--border); border-radius: 0.25rem; padding: 0 0.3rem; color: var(--ink-soft); }

/* ---------- Public pages ---------- */
.public-header { border-bottom: 1px solid var(--border); }
.public-inner { max-width: 64rem; margin: 0 auto; padding: 1rem 1.5rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.hero { position: relative; overflow: hidden; padding: clamp(2rem, 6vw, 4rem) clamp(1.5rem, 5vw, 3rem); }
.hero h1 { font-size: clamp(2.1rem, 5vw, 3rem); max-width: 18ch; margin-top: 1.5rem; }
.hero p { font-size: 1.125rem; color: var(--ink-soft); max-width: 44ch; margin-top: 1.25rem; }
.hero-orb { position: absolute; right: -4rem; top: -4rem; width: 16rem; height: 16rem; border-radius: 50%; background: var(--primary-soft); opacity: 0.6; pointer-events: none; }
.public-section { max-width: 64rem; margin: 0 auto; padding: 3.5rem 1.5rem; }
.feature { padding: 1.25rem; }
.feature h3 { font-family: var(--font-sans); font-weight: 500; font-size: 0.95rem; margin-top: 0.75rem; letter-spacing: 0; }
.feature p { font-size: 0.875rem; color: var(--ink-soft); margin-top: 0.25rem; }
.auth-card { max-width: 24rem; margin: 3rem auto; padding: 2rem; }
.public-footer { border-top: 1px solid var(--border); }

/* ---------- Review ---------- */
.review-row.uncertain { background: color-mix(in oklab, var(--highlight) 8%, var(--surface)); }
.review-row.ignored { opacity: 0.55; }
.review-row input:not([type="checkbox"]) { min-width: 5.5rem; }
.review-row select { min-width: 11rem; }
.spinner { width: 1.25rem; height: 1.25rem; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@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;
  }
}

@media print {
  .sidebar, .mobile-bar, .no-print, .composer, .coach { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
}

/* ---------- Avatars (hue picked from the profile id) ---------- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 2.25rem; height: 2.25rem; border-radius: 50%;
  font-size: 0.8rem; font-weight: 500; font-feature-settings: "ss01";
  --hue: var(--chart-1);
  background: color-mix(in oklab, var(--hue) 18%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--hue) 35%, transparent);
}
.avatar-sm { width: 1.5rem; height: 1.5rem; font-size: 0.6rem; }
.avatar-lg { width: 3rem; height: 3rem; font-size: 1.05rem; }
.avatar-1 { --hue: var(--chart-2); }
.avatar-2 { --hue: oklch(0.4 0.085 190); }
.avatar-3 { --hue: oklch(0.7 0.07 210); }
.avatar-4 { --hue: var(--highlight); }
.spark .sband { fill: color-mix(in oklab, var(--success) 18%, transparent); stroke: none; }
.door-name { font-family: var(--font-display); font-size: 1.1rem; display: block; }
.stat { font-family: var(--font-display); font-size: 1.6rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .unit { font-family: var(--font-sans); font-size: 0.75rem; color: var(--ink-soft); margin-left: 0.25rem; }
.text-danger { color: var(--destructive); }
.text-warn { color: oklch(from var(--warning) calc(l - 0.12) c h); }
@media (prefers-color-scheme: dark) { .text-warn { color: var(--warning); } }
details > summary { cursor: pointer; }
details.inline-edit > summary { list-style: none; display: inline-flex; }
details.inline-edit > summary::-webkit-details-marker { display: none; }
details.inline-edit[open] { display: block; }
.chip { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.8rem; padding: 0.1rem 0.25rem 0.1rem 0.6rem; border-radius: 999px; background: var(--surface-2); }
.chip .btn { min-height: 0; padding: 0.1rem; }
.pre { white-space: pre-wrap; }
.mobile-bar a, .public-inner a.row, a.row.grow, .sidebar .home { text-decoration: none; }
.row > input.input-auto { width: auto; }
.align-start { align-items: start; }
.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface); padding: 1.5rem; }
.dropzone-inner { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; text-align: center; padding: 1.5rem 1rem; cursor: pointer; }
.dropzone-title { font-weight: 500; }
.dropzone.dragging { border-color: var(--primary); background: var(--primary-soft); }
.review-table td { vertical-align: top; }

.review-table .label-cell { min-width: 10rem; }
.review-table .reasons { font-size: 0.7rem; color: oklch(from var(--highlight) calc(l - 0.3) c h); margin-top: 0.2rem; }
@media (prefers-color-scheme: dark) { .review-table .reasons { color: var(--highlight); } }
.group-row td { font-size: 0.75rem; font-weight: 500; color: var(--ink-soft); background: var(--surface-2); }
.range-pair { display: flex; align-items: center; gap: 0.3rem; }
.range-pair input { width: 5rem; }
.working { display: flex; align-items: center; gap: 0.75rem; }
.dropzone .form-actions, .dropzone > p { justify-content: center; text-align: center; }

/* ---------- Dashboard ---------- */
.desk-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.desk-head h1 { font-size: clamp(1.75rem, 4vw, 2.25rem); max-width: 22ch; margin-top: 0.35rem; text-wrap: balance; }
.desk-head p.muted { max-width: 56ch; margin-top: 0.4rem; font-size: 0.875rem; }
.grid-tight { gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); }
.list > li > a { text-decoration: none; color: inherit; }
.list > li > a:hover strong, .list > li > a:hover .door-name { color: var(--primary); }
a.stack-sm, span.stack-sm { display: flex; flex-direction: column; }
a.stack-sm > * + *, span.stack-sm > * + * { margin-top: 0.2rem; }
.inline-form { flex-wrap: nowrap; }
.inline-form > select, .inline-form > input { min-width: 0; }

/* ---------- Compare ---------- */
.compare-table { table-layout: fixed; min-width: 36rem; }
.compare-table .c-val { width: 6.5rem; }
.compare-table .c-change { width: 10rem; }
.compare-table .c-status { width: 8rem; }
.compare-table th.num, .compare-table td.num, .compare-table .end { text-align: right; }
.compare-table td:first-child { overflow-wrap: anywhere; }
.compare-table tr.changed td { background: color-mix(in oklab, var(--warning) 9%, transparent); }
.block { display: block; }
.compare-more { margin-top: 1rem; }
.msg.working { color: var(--ink-soft); }
.disclaimer > .icon { flex: none; margin-top: 0.1rem; }
p.disclaimer:has(> .icon) { display: flex; gap: 0.4rem; align-items: flex-start; }

/* ---------- Privacy ---------- */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: 0.75rem 1.25rem; margin: 0 0 0.75rem; }
.facts dt { font-size: 0.75rem; color: var(--ink-soft); }
.facts dd { margin: 0.15rem 0 0; font-size: 0.875rem; overflow-wrap: anywhere; }
code { font-family: var(--font-mono); font-size: 0.85em; background: var(--surface-2); padding: 0.05rem 0.3rem; border-radius: 0.25rem; }
