/* THE PORTAL STYLESHEET — the shadcn/ui "neutral" theme as the AdminCN template renders it,
   written as plain CSS (portal redesign 2026-10-07, DESIGN_SPEC_PORTAL_2026-10-07.md §D, §H).

   Rules (spec §D5): every colour is a token below; the only hex literals are the two brand
   tokens; one font pair (Geist / Geist Mono); one radius token; 14px body in cards; muted text
   is --muted-foreground, never opacity; icons are lucide at stroke 2 (views/icons.js).
   portal/test/run_tokens_pin.js pins the token values to ui.shadcn.com/docs/theming (neutral).

   src/assets/ui.js is GENERATED from this file by scripts/tokens-build.mjs (a Worker cannot
   import a .css file). Edit here, run the script, commit both; run-portal-tests.sh --checks it.

   Theme: light by default; dark when the device prefers it (and no explicit choice), or when
   <html data-theme="dark"> (cookie gg_theme, set from Settings or the header switch). */

/* ---------- 1. Tokens (ui.shadcn.com/docs/theming, Neutral, verbatim) ---------- */
:root {
  --radius: 0.625rem;
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --background: oklch(1 0 0);
  --foreground: oklch(0.145 0 0);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.145 0 0);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.145 0 0);
  --primary: oklch(0.205 0 0);
  --primary-foreground: oklch(0.985 0 0);
  --secondary: oklch(0.97 0 0);
  --secondary-foreground: oklch(0.205 0 0);
  --muted: oklch(0.97 0 0);
  --muted-foreground: oklch(0.556 0 0);
  --accent: oklch(0.97 0 0);
  --accent-foreground: oklch(0.205 0 0);
  --destructive: oklch(0.577 0.245 27.325);
  --destructive-fill: oklch(0.577 0.245 27.325);
  --border: oklch(0.922 0 0);
  --input: oklch(0.922 0 0);
  --ring: oklch(0.708 0 0);
  --chart-1: #F5B81C;
  --chart-2: oklch(0.6 0.118 184.704);
  --chart-3: oklch(0.398 0.07 227.392);
  --chart-4: oklch(0.828 0.189 84.429);
  --chart-5: oklch(0.769 0.188 70.08);
  --sidebar: oklch(0.985 0 0);
  --sidebar-foreground: oklch(0.145 0 0);
  --sidebar-primary: oklch(0.205 0 0);
  --sidebar-primary-foreground: oklch(0.985 0 0);
  --sidebar-accent: oklch(0.97 0 0);
  --sidebar-accent-foreground: oklch(0.205 0 0);
  --sidebar-border: oklch(0.922 0 0);
  --sidebar-ring: oklch(0.708 0 0);
  --brand: #F5B81C;
  --brand-ink: #1A1612;
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --card-ring: color-mix(in oklab, var(--foreground) 10%, transparent);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --background: oklch(0.145 0 0);
    --foreground: oklch(0.985 0 0);
    --card: oklch(0.205 0 0);
    --card-foreground: oklch(0.985 0 0);
    --popover: oklch(0.205 0 0);
    --popover-foreground: oklch(0.985 0 0);
    --primary: oklch(0.922 0 0);
    --primary-foreground: oklch(0.205 0 0);
    --secondary: oklch(0.269 0 0);
    --secondary-foreground: oklch(0.985 0 0);
    --muted: oklch(0.269 0 0);
    --muted-foreground: oklch(0.708 0 0);
    --accent: oklch(0.269 0 0);
    --accent-foreground: oklch(0.985 0 0);
    --destructive: oklch(0.704 0.191 22.216);
    --destructive-fill: color-mix(in oklab, oklch(0.704 0.191 22.216) 60%, transparent);
    --border: oklch(1 0 0 / 10%);
    --input: oklch(1 0 0 / 15%);
    --ring: oklch(0.556 0 0);
    --chart-2: oklch(0.696 0.17 162.48);
    --chart-3: oklch(0.769 0.188 70.08);
    --chart-4: oklch(0.627 0.265 303.9);
    --chart-5: oklch(0.645 0.246 16.439);
    --sidebar: oklch(0.205 0 0);
    --sidebar-foreground: oklch(0.985 0 0);
    --sidebar-primary: oklch(0.488 0.243 264.376);
    --sidebar-primary-foreground: oklch(0.985 0 0);
    --sidebar-accent: oklch(0.269 0 0);
    --sidebar-accent-foreground: oklch(0.985 0 0);
    --sidebar-border: oklch(1 0 0 / 10%);
    --sidebar-ring: oklch(0.556 0 0);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --background: oklch(0.145 0 0);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.205 0 0);
  --card-foreground: oklch(0.985 0 0);
  --popover: oklch(0.205 0 0);
  --popover-foreground: oklch(0.985 0 0);
  --primary: oklch(0.922 0 0);
  --primary-foreground: oklch(0.205 0 0);
  --secondary: oklch(0.269 0 0);
  --secondary-foreground: oklch(0.985 0 0);
  --muted: oklch(0.269 0 0);
  --muted-foreground: oklch(0.708 0 0);
  --accent: oklch(0.269 0 0);
  --accent-foreground: oklch(0.985 0 0);
  --destructive: oklch(0.704 0.191 22.216);
  --destructive-fill: color-mix(in oklab, oklch(0.704 0.191 22.216) 60%, transparent);
  --border: oklch(1 0 0 / 10%);
  --input: oklch(1 0 0 / 15%);
  --ring: oklch(0.556 0 0);
  --chart-2: oklch(0.696 0.17 162.48);
  --chart-3: oklch(0.769 0.188 70.08);
  --chart-4: oklch(0.627 0.265 303.9);
  --chart-5: oklch(0.645 0.246 16.439);
  --sidebar: oklch(0.205 0 0);
  --sidebar-foreground: oklch(0.985 0 0);
  --sidebar-primary: oklch(0.488 0.243 264.376);
  --sidebar-primary-foreground: oklch(0.985 0 0);
  --sidebar-accent: oklch(0.269 0 0);
  --sidebar-accent-foreground: oklch(0.985 0 0);
  --sidebar-border: oklch(1 0 0 / 10%);
  --sidebar-ring: oklch(0.556 0 0);
  color-scheme: dark;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; max-width: 100%; overflow-x: hidden; }
html { height: 100%; }
body { min-height: 100%; background: var(--background); color: var(--foreground); font-family: var(--font-sans); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { color: inherit; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; text-wrap: balance; }
h1 { font-size: 22px; }
h2 { font-size: 18px; letter-spacing: -0.01em; }
h3 { font-size: 15px; }
.muted { color: var(--muted-foreground); }
.mono { font-family: var(--font-mono); }
.num, .tabular { font-variant-numeric: tabular-nums; }
.icon { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; fill: none; flex: none; vertical-align: -3px; }
.icon.lg { width: 20px; height: 20px; }
.icon.sm { width: 14px; height: 14px; }
:focus-visible { outline: 3px solid color-mix(in oklab, var(--ring) 50%, transparent); outline-offset: 0; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------- 3. Shell: header bar, content column, tab bar (phone), inset sidebar (desktop) ---------- */
.shell { display: flex; flex-direction: column; min-height: 100%; }
.sidebar { display: none; }
.inset { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.topbar { position: sticky; top: 0; z-index: 20; padding: 12px 16px 8px; background: linear-gradient(var(--background) 55%, transparent); }
.topbar .bar { height: 56px; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 12px; border-radius: var(--radius-xl); background: var(--card); color: var(--card-foreground); box-shadow: 0 0 0 1px var(--card-ring), var(--shadow-xs); max-width: 880px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; color: inherit; flex: 1; }
.brand-tile { width: 32px; height: 32px; border-radius: var(--radius-md); background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; flex: none; }
.brand-tile .icon { width: 18px; height: 18px; }
.brand-tile.lg { width: 44px; height: 44px; }
.brand-tile.lg .icon { width: 24px; height: 24px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.brand-text b { font-size: 14px; font-weight: 600; }
.brand-text span { font-size: 12px; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iconbtn { position: relative; width: 36px; height: 36px; padding: 0; border-radius: var(--radius-md); display: inline-grid; place-items: center; color: inherit; background: transparent; border: 0; text-decoration: none; cursor: pointer; font: inherit; }
.iconbtn:hover { background: var(--muted); }
.iconbtn .badge.count { position: absolute; top: 2px; right: 2px; height: 16px; min-width: 16px; padding: 0 4px; font-size: 10px; box-shadow: 0 0 0 2px var(--card); }
.iconbtn[aria-current="page"] { background: var(--muted); }
.avatar { width: 32px; height: 32px; border-radius: 999px; background: var(--muted); color: var(--foreground); display: grid; place-items: center; font-size: 12px; font-weight: 600; letter-spacing: 0.02em; position: relative; text-decoration: none; flex: none; }
.avatar::after { content: ""; position: absolute; inset: 0; border-radius: inherit; border: 1px solid var(--border); }
.avatar[aria-current="page"] { box-shadow: 0 0 0 2px var(--ring); }
.theme-switch { display: contents; }
.theme-switch .only-light, .theme-switch .only-dark { display: none; }
:root:not([data-theme="dark"]) .theme-switch .only-light { display: block; }
:root[data-theme="dark"] .theme-switch .only-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-switch .only-light { display: none; }
  :root:not([data-theme="light"]) .theme-switch .only-dark { display: block; }
}
.wrap { width: 100%; max-width: 880px; margin: 0 auto; padding: 8px 16px calc(96px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 16px; flex: 1; }
.wrap.narrow { max-width: 480px; padding-top: 32px; }
.wrap.no-nav { padding-bottom: 32px; }
.brand-mark { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding-top: 16px; }
.brand-mark b { font-size: 14px; font-weight: 600; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--sidebar); color: var(--sidebar-foreground); border-top: 1px solid var(--sidebar-border); padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px)); }
.tabbar ul { list-style: none; margin: 0 auto; padding: 0; max-width: 640px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px 5px; border-radius: var(--radius-md); font-size: 11px; font-weight: 500; color: var(--muted-foreground); text-decoration: none; min-height: 48px; }
.tabbar a .icon { width: 20px; height: 20px; }
.tabbar a[aria-current="page"] { background: var(--sidebar-accent); color: var(--sidebar-accent-foreground); }

.cols { display: flex; flex-direction: column; gap: 16px; }
.cols .actions.first { order: -1; }

@media (min-width: 768px) {
  .shell { flex-direction: row; background: var(--sidebar); color: var(--foreground); }
  .shell.plain { background: var(--background); }
  .sidebar { display: flex; flex-direction: column; gap: 8px; width: 232px; flex: none; padding: 12px 10px; color: var(--sidebar-foreground); position: sticky; top: 0; height: 100vh; }
  .sidebar .brand { padding: 6px 8px; flex: 0 0 auto; }
  .sb-group { display: flex; flex-direction: column; gap: 2px; }
  .sb-label { font-size: 11px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-foreground); padding: 10px 8px 6px; }
  .sb-item { display: flex; align-items: center; gap: 10px; padding: 0 8px; height: 32px; border-radius: var(--radius-md); font-size: 14px; color: var(--sidebar-foreground); text-decoration: none; }
  .sb-item:hover { background: var(--sidebar-accent); }
  .sb-item[aria-current="page"] { background: var(--sidebar-accent); color: var(--sidebar-accent-foreground); font-weight: 500; }
  .sb-item .badge { margin-left: auto; }
  .sb-foot { margin-top: auto; }
  .inset { margin: 8px 8px 8px 0; border-radius: var(--radius-xl); background: var(--background); box-shadow: var(--shadow-sm); min-height: calc(100vh - 16px); }
  .shell.plain .inset { margin: 0; border-radius: 0; box-shadow: none; }
  .topbar { padding: 16px 24px 8px; }
  .topbar .bar { height: 52px; max-width: none; }
  .wrap { padding: 8px 24px 40px; max-width: none; }
  .wrap.narrow { max-width: 480px; }
  .tabbar { display: none; }
  .card { padding-block: 24px; }
  .card > * { padding-inline: 24px; }
  .tbl th:first-child, .tbl td:first-child { padding-left: 24px; }
  .tbl th:last-child, .tbl td:last-child { padding-right: 24px; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tbl .hide-sm { display: table-cell; }
  .stats .card.stat.hero { grid-column: auto; }
  .cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
  .cols .actions.first { order: 0; }
  .stat .value.md { font-size: 30px; }
  .actions.inline-md { flex-direction: row; }
  .actions.inline-md > * { flex: 1; }
}

/* ---------- 4. Page heading, eyebrow, alerts ---------- */
.page-head { display: flex; flex-direction: column; gap: 2px; padding: 4px 4px 0; }
.page-head p { color: var(--muted-foreground); }
.center { text-align: center; }
.page-head.center { align-items: center; }
.eyebrow { font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-foreground); padding: 0 4px; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--card); color: var(--card-foreground); font-size: 14px; }
.alert .icon { margin-top: 2px; }
.alert b { font-weight: 500; }
.alert.destructive { color: var(--destructive); border-color: color-mix(in oklab, var(--destructive) 30%, transparent); }

/* ---------- 5. Card ---------- */
.card { background: var(--card); color: var(--card-foreground); border-radius: var(--radius-xl); box-shadow: 0 0 0 1px var(--card-ring), var(--shadow-xs); padding-block: 20px; display: flex; flex-direction: column; gap: 16px; min-width: 0; margin: 0; }
.card > * { padding-inline: 20px; }
.card > .table-wrap { padding-inline: 0; }
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-header .titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.card-title { font-size: 18px; font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; }
.card-desc { color: var(--muted-foreground); font-size: 14px; }
.card-footer { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* stat card (template pattern C5(b)) */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stats .card.stat.hero { grid-column: 1 / -1; }
.card.stat { gap: 8px; }
.stat .label { color: var(--muted-foreground); font-size: 14px; }
.stat .value { font-size: 30px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat .value.md { font-size: 24px; }
.stat .value.text { font-size: 18px; letter-spacing: -0.01em; color: var(--muted-foreground); }
.stat .meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--muted-foreground); font-size: 13px; }

/* ---------- 6. Badge ---------- */
.badge { display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; border: 1px solid transparent; width: fit-content; vertical-align: middle; }
.badge .icon { width: 12px; height: 12px; }
.badge.default { background: var(--primary); color: var(--primary-foreground); }
.badge.secondary { background: var(--secondary); color: var(--secondary-foreground); }
.badge.outline { border-color: var(--border); color: var(--foreground); }
.badge.destructive { border-color: color-mix(in oklab, var(--destructive) 40%, transparent); color: var(--destructive); }
.badge.count { background: var(--primary); color: var(--primary-foreground); min-width: 20px; padding: 0 6px; font-variant-numeric: tabular-nums; }

/* ---------- 7. Button ---------- */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 16px; border-radius: var(--radius-md); font: inherit; font-size: 14px; font-weight: 500; line-height: 1; white-space: nowrap; border: 1px solid transparent; cursor: pointer; text-decoration: none; color: var(--foreground); background: transparent; transition: background 0.15s ease, color 0.15s ease; }
.button:focus-visible { border-color: var(--ring); }
.button.lg { height: 44px; padding: 0 20px; font-size: 15px; }
.button.xl { height: 56px; padding: 0 24px; font-size: 17px; font-weight: 600; }
.button.sm { height: 32px; padding: 0 12px; font-size: 13px; gap: 6px; }
.button.block { width: 100%; }
.button.default { background: var(--primary); color: var(--primary-foreground); }
.button.default:hover { background: color-mix(in oklab, var(--primary) 90%, transparent); }
.button.secondary { background: var(--secondary); color: var(--secondary-foreground); }
.button.secondary:hover { background: color-mix(in oklab, var(--secondary) 80%, transparent); }
.button.outline { border-color: var(--input); background: var(--background); }
.button.outline:hover { background: var(--accent); color: var(--accent-foreground); }
.button.ghost { color: var(--muted-foreground); }
.button.ghost:hover { background: var(--accent); color: var(--accent-foreground); }
/* "danger" is shadcn's destructive variant; the class is named for the acceptance suite (run_home.js: one red control = Emergency). */
.button.danger { background: var(--destructive-fill); color: oklch(1 0 0); }
.button.danger:hover { background: color-mix(in oklab, var(--destructive) 90%, transparent); }
.button.link { height: auto; padding: 0; text-decoration: underline; text-underline-offset: 3px; font-weight: 500; }
.button[disabled], .button[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }
.actions { display: flex; flex-direction: column; gap: 10px; }
form.inline { display: contents; }

/* ---------- 8. List rows (template pattern C7) ---------- */
.rows { display: flex; flex-direction: column; gap: 4px; }
.row { display: flex; align-items: center; gap: 12px; padding: 8px 0; min-width: 0; text-decoration: none; color: inherit; border-radius: var(--radius-md); }
a.row:hover { background: var(--muted); margin-inline: -8px; padding-inline: 8px; }
.tile { width: 40px; height: 40px; border-radius: var(--radius-md); display: grid; place-items: center; flex: none; background: color-mix(in oklab, var(--primary) 10%, transparent); color: var(--foreground); }
.tile .icon { width: 18px; height: 18px; }
.tile.brand { background: color-mix(in oklab, var(--brand) 18%, transparent); color: var(--brand-ink); }
:root[data-theme="dark"] .tile.brand { color: var(--brand); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tile.brand { color: var(--brand); } }
.tile.danger { background: color-mix(in oklab, var(--destructive) 15%, transparent); color: var(--destructive); }
.row .text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; gap: 2px; }
.row .text b { font-weight: 500; font-size: 14px; overflow-wrap: anywhere; }
.row .text span { font-size: 13px; color: var(--muted-foreground); }
.row .right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-variant-numeric: tabular-nums; flex: none; }
.row .right b { font-weight: 500; }
.row .right span { font-size: 12px; color: var(--muted-foreground); }
.row .chev { color: var(--muted-foreground); }
.row.unread .text b { font-weight: 600; }
.row .links { display: flex; flex-wrap: wrap; gap: 6px; }
.progress { display: block; width: 100%; height: 6px; border-radius: 999px; background: color-mix(in oklab, var(--primary) 20%, transparent); overflow: hidden; border: 0; appearance: none; -webkit-appearance: none; }
.progress::-webkit-progress-bar { background: transparent; }
.progress::-webkit-progress-value { background: var(--primary); border-radius: 999px; }
.progress::-moz-progress-bar { background: var(--primary); border-radius: 999px; }

/* ---------- 9. Table (template pattern C8) ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { height: 40px; padding: 0 8px; text-align: left; color: var(--muted-foreground); font-weight: 500; white-space: nowrap; border-bottom: 1px solid var(--border); }
.tbl td { padding: 10px 8px; vertical-align: middle; border-bottom: 1px solid var(--border); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl th:first-child, .tbl td:first-child { padding-left: 20px; }
.tbl th:last-child, .tbl td:last-child { padding-right: 20px; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .stack { display: flex; flex-direction: column; line-height: 1.3; gap: 1px; }
.tbl .stack b { font-weight: 500; white-space: nowrap; }
.tbl .stack span { font-size: 12px; color: var(--muted-foreground); }
.tbl .stack span.mono { font-size: 12px; }
.tbl .mono { font-family: var(--font-mono); font-size: 13px; }
.tbl tr.total td { font-weight: 600; background: color-mix(in oklab, var(--muted) 50%, transparent); }
.tbl .act { text-align: right; white-space: nowrap; }
.tbl .act .button + .button, .tbl .act form + .button, .tbl .act .button + form, .tbl .act .iconbtn + .button { margin-left: 4px; }
.tbl .act .iconbtn { vertical-align: middle; color: var(--muted-foreground); }
.tbl .act .iconbtn:hover { color: var(--foreground); }
.tbl .act-stack { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.hide-sm { display: none; }
.tfoot { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted-foreground); font-size: 13px; }
.tfoot .pager { display: flex; gap: 6px; }

/* ---------- 10. Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, label.lbl { font-size: 14px; font-weight: 500; }
.input, .textarea, .select { width: 100%; font: inherit; font-size: 16px; color: var(--foreground); background: transparent; border: 1px solid var(--input); border-radius: var(--radius-md); padding: 0 12px; height: 44px; box-shadow: var(--shadow-xs); }
.textarea { height: auto; min-height: 112px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; padding-right: 36px; }
.select option { color: initial; }
.input:focus-visible, .textarea:focus-visible, .select:focus-visible { border-color: var(--ring); }
.input::placeholder, .textarea::placeholder { color: var(--muted-foreground); }
.input[readonly] { color: var(--muted-foreground); }
.hint { font-size: 13px; color: var(--muted-foreground); }
.file { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.file-btn { justify-content: flex-start; color: var(--muted-foreground); font-weight: 400; height: 44px; }
.file:focus-visible + .file-btn { outline: 3px solid color-mix(in oklab, var(--ring) 50%, transparent); border-color: var(--ring); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.switch .text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.switch .text b { font-weight: 500; }
.switch .text span { font-size: 13px; color: var(--muted-foreground); }
.switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.toggle { width: 32px; height: 18px; border-radius: 999px; background: var(--input); position: relative; flex: none; transition: background 0.15s ease; }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 999px; background: var(--background); transition: left 0.15s ease; }
.switch input:checked ~ .toggle { background: var(--primary); }
.switch input:checked ~ .toggle::after { left: 16px; background: var(--primary-foreground); }
.switch input:focus-visible ~ .toggle { outline: 3px solid color-mix(in oklab, var(--ring) 50%, transparent); }
.tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--radius-lg); background: var(--muted); max-width: 100%; overflow-x: auto; }
.tabs a, .tabs button { font: inherit; font-size: 13px; font-weight: 500; padding: 5px 12px; border-radius: var(--radius-md); color: var(--muted-foreground); text-decoration: none; border: 0; background: transparent; cursor: pointer; white-space: nowrap; min-height: 32px; display: inline-flex; align-items: center; gap: 6px; }
.tabs a[aria-current="true"], .tabs button[aria-pressed="true"] { background: var(--background); color: var(--foreground); box-shadow: var(--shadow-xs); }
details.details summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-weight: 500; color: var(--muted-foreground); font-size: 14px; min-height: 32px; }
details.details summary::-webkit-details-marker { display: none; }
details.details[open] summary { color: var(--foreground); }
details.details .note { margin-top: 8px; color: var(--muted-foreground); }
.arith { font-family: var(--font-mono); font-size: 14px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.arith b { color: var(--foreground); font-weight: 600; }
.empty { text-align: center; color: var(--muted-foreground); display: flex; flex-direction: column; gap: 10px; align-items: center; padding-block: 4px; }

/* ---------- 11. Charts (template pattern C6; drawn by views/trends.js) ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid line { stroke: var(--border); stroke-dasharray: 3 3; }
.chart .tick { fill: var(--muted-foreground); font-size: 11px; font-family: var(--font-sans); }
.chart .lbl { fill: var(--foreground); font-size: 11px; font-weight: 500; font-family: var(--font-sans); font-variant-numeric: tabular-nums; }
.chart .bar { fill: var(--chart-1); }
.chart .bar.dim { fill: color-mix(in oklab, var(--chart-1) 72%, var(--card)); }
