/* 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); }
.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; }
.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); the desktop sidebar is section 12 ---------- */
.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: 8px 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; }
}
/* Language menu (2026-10-26): the languages button beside the theme switch opens a small popover with one row per
   language; a plain <details>, so it works without JavaScript (theme.js only closes it on an outside click). */
.lang-menu { position: relative; flex: none; }
.lang-menu summary { list-style: none; }
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu[open] summary { background: var(--muted); }
.lang-menu .menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 160px; padding: 4px; display: grid; gap: 2px; z-index: 30; background: var(--popover); color: var(--popover-foreground); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.lang-menu .menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--radius-sm); background: transparent; color: inherit; font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.lang-menu .menu button:hover, .lang-menu .menu button:focus-visible { background: var(--muted); }
.lang-menu .menu button:disabled { opacity: 0.5; cursor: default; }
.lang-menu .menu .tick { width: 16px; display: inline-grid; place-items: center; visibility: hidden; }
.lang-menu .menu button[aria-checked="true"] .tick { visibility: visible; }
.wrap { width: 100%; max-width: 880px; margin: 0 auto; padding: 4px 16px calc(76px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 12px; 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 { flex: none; 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)); }
/* Phones: the page itself does not scroll; the shell does, under a tab bar that is a plain flex child of a
   screen-high body (2026-10-21). The bar used to be position: fixed, and iOS Safari places fixed elements against
   the layout viewport while it animates its own toolbars in and out on a fast scroll, so the bar drifted up the
   screen with page content showing beneath it. With no document scroll Safari never animates its toolbars, and
   the bar cannot move. 100dvh is the visible height (iOS 15.4+, Chrome 108+); -webkit-fill-available covers
   older iOS; 100vh is the last resort. */
@media (max-width: 767px) {
  html { height: 100%; height: -webkit-fill-available; }
  body { height: 100vh; height: -webkit-fill-available; height: 100dvh; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
  /* position: relative makes the shell the containing block of the visually hidden inputs (.switch input, .file,
     .sr-only), which are position: absolute; against the page they would sit below the fold and make the document
     scrollable again. */
  .shell { position: relative; flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
  .wrap { padding-bottom: 24px; }
}
.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: 12px; }
.cols .actions.first, .cols .card.trends { order: -1; }
/* .main / .side group the two desktop columns; on phones they dissolve so the children stack in one list and `order` works. */
.cols > .main, .cols > .side { display: contents; }
.grid2 { display: flex; flex-direction: column; gap: 12px; }


/* ---------- 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; }
.card-header > .button.ghost.sm { flex: none; margin: -4px -8px -4px 0; color: var(--muted-foreground); }
.card-header > .button.ghost.sm:hover { color: var(--foreground); }

/* 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; padding-block: 16px; }
.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 { position: relative; 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; }
/* compact: icon-only on phones (the label stays in the DOM for screen readers), icon + label from 768px.
   The Manifest button in the Home / Pickups tables (2026-10-21): with its label the Pickups row was 350px
   wide inside a 343px card on a 375px phone, so the table wobbled sideways; on 320px phones it was cut off. */
.button.compact { width: 36px; height: 36px; padding: 0; }
.button.compact > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* Touch screens: a 44px hit area around the 32px to 36px controls (Apple HIG / Android 48dp), drawn nowhere.
   Chrome's ::before on .avatar is free (.avatar::after draws its ring); .button.link has no box to extend. */
@media (pointer: coarse) {
  .iconbtn::before, .avatar::before, .button.sm:not(.link)::before, .row .pick::before { content: ""; position: absolute; inset: -4px; }
  .avatar::before { inset: -6px; }
  .button.sm:not(.link)::before { inset: -6px 0; }   /* up and down only: row buttons sit 4px apart */
  .row .pick { position: relative; width: 36px; height: 44px; }
}
.actions { display: flex; flex-direction: column; gap: 8px; }
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); }
/* inbox selection (Messages): a 20px checkbox before the tile, a toolbar above the rows */
.row .pick { display: grid; place-items: center; width: 28px; height: 40px; flex: none; cursor: pointer; }
.row .pick input { width: 20px; height: 20px; margin: 0; accent-color: var(--primary); cursor: pointer; }
.toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
.toolbar [aria-pressed="true"] { background: var(--accent); color: var(--accent-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; }
.card > form.form { display: flex; flex-direction: column; gap: 16px; }   /* a form nested in a card (Settings → People) spaces its fields like the card does */
.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); }
/* chosen-file preview under the button (/assets/forms.js) */
.file-preview { display: flex; flex-direction: column; gap: 8px; }
.file-preview .thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.file-preview figure { margin: 0; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.file-preview img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-md); box-shadow: 0 0 0 1px var(--card-ring); background: var(--muted); }
.file-preview .chip { display: grid; place-items: center; aspect-ratio: 1; border-radius: var(--radius-md); background: var(--muted); color: var(--muted-foreground); font-size: 12px; padding: 8px; overflow-wrap: anywhere; text-align: center; }
.file-preview figcaption { font-size: 12px; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.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); }
/* Settings → How you get paid (2026-10-26): one panel per dropdown option; the current method's form sits behind a
   collapsed "Update ..." line, the other method's form is the switch itself. */
.pay-panel form.form { display: flex; flex-direction: column; gap: 16px; }
.pay-panel details.pay-update[open] > form.form { margin-top: 12px; }
.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 state: one compact line (tile · sentence · optional button), never a tall centred block (2026-10-08). */
.empty { color: var(--muted-foreground); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-height: 36px; }
.empty .tile { width: 36px; height: 36px; }
.empty p { flex: 1; min-width: 160px; }
.empty .button { margin-left: auto; }

/* ---------- 11. Trends chart (views/trends.js, re-cut 2026-10-21): a grid of month columns, plain HTML, no SVG ---------- */
.chart { display: grid; grid-template-columns: repeat(var(--n, 12), minmax(0, 1fr)); gap: 6px; height: 140px; }
.chart .col { display: flex; flex-direction: column; align-items: center; min-width: 0; gap: 4px; height: 100%; }
.chart .v { font-size: 12px; font-weight: 500; line-height: 1; color: var(--foreground); font-variant-numeric: tabular-nums; height: 12px; flex: none; }
.chart .plot { display: flex; align-items: flex-end; justify-content: center; width: 100%; flex: 1; min-height: 0; }
.chart .bar { display: block; width: 100%; max-width: 28px; height: 2px; border-radius: 4px 4px 0 0; background: var(--chart-1); }
.chart .dim .bar { background: color-mix(in oklab, var(--chart-1) 60%, var(--card)); }
.chart .zero .bar { background: var(--border); border-radius: 1px; }
.chart .x { font-size: 11px; line-height: 1; color: var(--muted-foreground); white-space: nowrap; height: 11px; flex: none; }
.chart .alt .x { visibility: hidden; }
.chart .strong .x { color: var(--foreground); font-weight: 500; }
.chart .col:hover .bar { background: var(--chart-1); }
.facts { display: flex; flex-direction: column; gap: 6px; margin: 0; border-top: 1px solid var(--border); padding-top: 12px; }
.facts > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-width: 0; font-size: 14px; }
.facts dt { color: var(--muted-foreground); }
.facts dd { margin: 0; font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; }
/* ---------- 12. Desktop ≥ 768px, inset sidebar, denser grid. Kept LAST so these rules beat the phone-first ones above (2026-10-08). ---------- */
@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: 220px; flex: none; padding: 14px 10px 12px; color: var(--sidebar-foreground); position: sticky; top: 0; height: 100vh; }
  .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: 8px 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; }
  .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: 12px 20px 8px; }
  .topbar .bar { height: 52px; max-width: none; }
  .wrap { padding: 4px 20px 28px; max-width: none; gap: 16px; }
  .wrap.narrow { max-width: 480px; }
  .wrap.medium { max-width: 760px; margin: 0 auto; }   /* the single-form pages (requests, code entry, payment review): one readable column, centered */
  .button.compact { width: auto; height: 32px; padding: 0 12px; }
  .button.compact > span { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .tabbar { display: none; }
  .card { padding-block: 20px; }
  .card > * { padding-inline: 20px; }
  .card.stat { padding-block: 18px; }
  .tbl th:first-child, .tbl td:first-child { padding-left: 20px; }
  .tbl th:last-child, .tbl td:last-child { padding-right: 20px; }
  .stats { gap: 16px; }
  .stat .value.md { font-size: 30px; }
  .tbl .hide-sm { display: table-cell; }
  .page-head { padding-top: 0; }
  .actions.inline-md { flex-direction: row; }
  .actions.inline-md > * { flex: 1; }
}

/* ---------- 13. Wide desktop ≥ 1024px: the two-column grids (2026-10-21). Between 768px and 1023px (an iPad held
   upright) the content column is about 500px wide, and splitting it 2:1 left a 161px side column where the
   Messages card broke one letter per line; those widths now keep the phone's single column under the sidebar. ---------- */
@media (min-width: 1024px) {
  .stats { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr); }
  .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, .cols .card.trends { order: 0; }
  .cols > .main, .cols > .side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
  .cols > aside.side { display: flex; }
  .grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
}

/* ---------- 14. Card grid that fills the screen (Settings, Help; 2026-10-26). One column on a phone. From 768px the
   cards flow into as many columns of at least 400px as fit: a laptop shows two, a 1440 screen three, a wide monitor
   five, so there is no empty strip to the right at any width. /assets/tiles.js then packs the cards (.packed): 2px
   rows, each card spanning as many as its own height needs, so a short card is not stretched to the tallest one in
   its row and the next card slides up under it. Without the script the rows are equal-height bands. Settings and
   Help dropped the 760px 'medium' cap for this; the single-form pages keep it. ---------- */
.tiles { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.tiles > * { min-width: 0; }
@media (min-width: 768px) {
  .tiles { grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 16px; }
  .tiles.packed { grid-auto-rows: 2px; align-items: start; }
}

/* People on this account (settings, t06s08/s09, 2026-10-09) */
.people { list-style: none; margin: 0 0 4px; padding-block: 0; }   /* padding-inline comes from .card > * */
.people li.person { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.people li.person:first-child { border-top: 0; padding-top: 0; }
.people .who { min-width: 0; }
.people .who .muted { font-size: 13px; overflow-wrap: anywhere; }
.people form { margin: 0; flex: none; }
.card .current { margin: 0; font-size: 14px; }
.card .current .muted { margin-right: 6px; }
.people .actions { display: flex; gap: 8px; flex: none; }
