@font-face { font-family: "Host Grotesk"; src: url("/assets/fonts/host-grotesk-300-800.woff2") format("woff2"); font-weight: 300 800; font-display: swap; }
/* Genesis portal (docs/design-admin.md): a workplace, not a destination. Grey rail, white work surface, one purple voice.
   Purple is state: active nav, primary buttons, focus, queue badges. Everything else is neutral ink and grey. */
.theme-admin {
  --brand-500: 92 48 150;   /* the logo's purple, lighter: icons, focus, charts */
  --brand-600: 66 23 115;   /* #421773, the logo. Primary buttons: white text at 12:1 */
  --brand-700: 50 15 92;    /* primary hover darkens, so contrast only improves */
  --brand-fg: 82 36 140;    /* brand as text on white, 8:1 */
  --brand-50: 243 238 250;  /* selected page, brand pill */
  --green-500: 10 211 90;   /* the logo's green. A signal, with ink text, never white */
  --green-100: 220 248 231;
  --poster: 34 12 62;       /* deepest purple: scrims and shadows */
  --ink-900: 26 16 46;
  --ink-700: 59 50 79;
  --ink-500: 102 94 120;
  --ink-400: 112 104 128;
  --ink-200: 230 227 237;
  --ink-100: 241 239 245;
  --soft: 247 246 250;      /* the grey: rail, panel frame, hovered rows */
  --surface: 255 255 255;
  --success: 14 122 62;
  --warning: 154 91 0;
  --danger: 180 35 49;
  --button-radius: 10px;
  --chip: 241 239 245;      /* unselected chips and tags */
  color-scheme: light;
}
/* Dark: the same structure, the grey frame now a little lighter than the page, so panels still read as panels.
   Chosen in the topbar (stored per browser), or following the device when nothing has been chosen. */
.theme-admin[data-theme="dark"] {
  --brand-500: 168 132 232; --brand-600: 118 70 194; --brand-700: 100 56 172; --brand-fg: 200 176 245; --brand-50: 52 36 84;
  --green-500: 60 214 120; --green-100: 24 64 44; --poster: 0 0 0;
  --ink-900: 240 236 248; --ink-700: 208 201 224; --ink-500: 160 152 182; --ink-400: 132 124 156; --ink-200: 62 55 82; --ink-100: 44 38 60;
  --soft: 28 24 40; --surface: 20 17 30; --chip: 44 38 60;
  --success: 92 210 140; --warning: 236 178 72; --danger: 246 112 122;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  .theme-admin:not([data-theme="light"]) {
    --brand-500: 168 132 232; --brand-600: 118 70 194; --brand-700: 100 56 172; --brand-fg: 200 176 245; --brand-50: 52 36 84;
    --green-500: 60 214 120; --green-100: 24 64 44; --poster: 0 0 0;
    --ink-900: 240 236 248; --ink-700: 208 201 224; --ink-500: 160 152 182; --ink-400: 132 124 156; --ink-200: 62 55 82; --ink-100: 44 38 60;
    --soft: 28 24 40; --surface: 20 17 30; --chip: 44 38 60;
    --success: 92 210 140; --warning: 236 178 72; --danger: 246 112 122;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: "Host Grotesk", system-ui, -apple-system, sans-serif; font-size: 14px; color: rgb(var(--ink-900)); background: rgb(var(--surface)); -webkit-font-smoothing: antialiased; }
a { color: rgb(var(--brand-fg)); }
h1, h2, h3, p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: 12px; top: 12px; z-index: 100; background: rgb(var(--surface)); padding: 8px 12px; border-radius: 8px; }
:focus-visible { outline: 2px solid rgb(var(--brand-500)); outline-offset: 2px; }
.icon { width: 1.05rem; height: 1.05rem; flex: none; }
[hidden] { display: none !important; }

/* Shell */
.shell { display: flex; min-height: 100vh; }
.rail { width: 272px; flex: none; background: rgb(var(--soft)); color: rgb(var(--ink-900)); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; border-right: 1px solid rgb(var(--ink-200) / .6); }
.rail-logo { display: block; padding: 22px 20px 14px; }
.rail-logo img { width: 150px; height: auto; }
.rail-jump { position: relative; margin: 0 12px 8px; display: flex; align-items: center; color: rgb(var(--ink-400)); }
.rail-jump .icon { position: absolute; left: 10px; }
.rail-jump input { width: 100%; height: 36px; padding: 0 44px 0 32px; border: 1px solid rgb(var(--ink-200)); border-radius: 8px; background: rgb(var(--surface)); font: inherit; color: rgb(var(--ink-900)); }
.rail-jump input::placeholder { color: rgb(var(--ink-400)); }
.rail-jump kbd { position: absolute; right: 8px; font: inherit; font-size: 11px; color: rgb(var(--ink-400)); }
.rail-nav { flex: 1; overflow-y: auto; padding: 4px 12px 12px; scrollbar-width: thin; }
.rail-group { margin-top: 16px; }
.rail-group-label { font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: rgb(var(--ink-500)); padding: 0 12px 6px; }
.rail-item { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 12px; border-radius: 8px; color: rgb(var(--ink-700)); font-weight: 500; text-decoration: none; transition: background-color 150ms, color 150ms, box-shadow 150ms; }
.rail-item .icon { color: rgb(var(--ink-400)); transition: color 150ms; }
.rail-item:hover { background: rgb(var(--surface) / .7); color: rgb(var(--ink-900)); }
.rail-item.is-active { background: rgb(var(--surface)); font-weight: 600; color: rgb(var(--ink-900)); box-shadow: 0 1px 2px rgb(var(--poster) / .08), 0 2px 8px rgb(var(--poster) / .06); }
.rail-item.is-active .icon { color: rgb(var(--brand-500)); }
.rail-badge { margin-left: auto; min-width: 20px; border-radius: 999px; background: rgb(var(--brand-600)); color: #fff; font-size: 0.6875rem; font-weight: 600; text-align: center; padding: 2px 6px; font-variant-numeric: tabular-nums; }
.rail-none { padding: 12px; color: rgb(var(--ink-700)); line-height: 1.5; }
.rail-foot { border-top: 1px solid rgb(var(--ink-200) / .7); padding: 12px 20px 16px; }
.rail-me strong { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-me span { display: block; font-size: 13px; color: rgb(var(--ink-500)); margin-bottom: 8px; }
.rail-link { display: block; background: none; border: 0; padding: 4px 0; font: inherit; color: rgb(var(--ink-700)); text-decoration: none; cursor: pointer; }
.rail-link:hover { color: rgb(var(--ink-900)); text-decoration: underline; }
.work { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; height: 56px; display: flex; align-items: center; gap: 8px; padding: 0 20px; background: rgb(var(--surface) / .95); border-bottom: 1px solid rgb(var(--ink-200) / .7); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar-word { font-weight: 600; }
.only-mobile { display: none !important; }
.icon-btn { position: relative; width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: none; border-radius: 8px; color: rgb(var(--ink-700)); cursor: pointer; transition: background-color 150ms; }
.icon-btn:hover { background: rgb(var(--ink-100)); }
.bell-dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: rgb(var(--brand-600)); }
.account-btn { border: 0; background: none; padding: 0; cursor: pointer; border-radius: 50%; }
.avatar { display: inline-flex; width: 32px; height: 32px; align-items: center; justify-content: center; border-radius: 50%; background: rgb(var(--ink-100)); color: rgb(var(--ink-700)); font-weight: 600; flex: none; object-fit: cover; }
main#page, .page-pad { padding: 32px 40px; flex: 1; animation: route-fade 200ms ease; outline: none; min-width: 0; }
@keyframes route-fade { from { opacity: 0; } to { opacity: 1; } }

/* Page anatomy */
.breadcrumb { font-size: 13px; font-weight: 500; color: rgb(var(--ink-500)); margin-bottom: 6px; }
.page-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; justify-content: space-between; padding-bottom: 28px; }
.page-title { font-size: clamp(1.75rem, 2.6vw, 2.5rem); font-weight: 700; line-height: 1.06; letter-spacing: -0.035em; }
.page-desc { font-size: 0.9375rem; color: rgb(var(--ink-500)); margin-top: 4px; }
.page-action { display: flex; flex-wrap: wrap; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 24px; }
.grid-panels { display: grid; gap: 20px; }
.notice { display: flex; gap: 8px; align-items: center; padding: 10px 14px; border-radius: 10px; background: rgb(var(--soft)); color: rgb(var(--ink-700)); margin-bottom: 16px; }

/* Panel: one frame, one title, one optional action */
.panel { background: rgb(var(--soft)); border-radius: 16px; padding: 6px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 0 12px; gap: 8px; }
.panel-title { font-size: 1rem; font-weight: 600; letter-spacing: -0.012em; }
.panel-body { background: rgb(var(--surface)); border: 1px solid rgb(var(--ink-200) / .6); border-radius: 12px; padding: 20px; min-width: 0; }
.panel-body.flush { padding: 0; }
.panel-body.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 10px; background: none; border: 0; }

/* StatCard */
.stat { background: rgb(var(--surface)); border: 1px solid rgb(var(--ink-200) / .6); border-radius: 12px; padding: 14px; min-width: 0; }
.stat-label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: rgb(var(--ink-500)); }
.stat-tile { width: 32px; height: 32px; border-radius: 8px; background: rgb(var(--soft)); display: inline-flex; align-items: center; justify-content: center; color: rgb(var(--ink-500)); }
.stat-value { font-size: 1.875rem; font-weight: 700; line-height: 1; letter-spacing: -0.035em; margin-top: 12px; font-variant-numeric: tabular-nums; }
.stat-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-size: 13px; color: rgb(var(--ink-500)); }
.delta { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.delta .tip { width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; }
.delta .tip .icon { width: 12px; height: 12px; }
.delta.up { color: rgb(var(--success)); } .delta.up .tip { background: rgb(var(--success)); }
.delta.down { color: rgb(var(--danger)); } .delta.down .tip { background: rgb(var(--danger)); }

/* Status pill */
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 500; text-transform: capitalize; white-space: nowrap; }
.pill.neutral { background: rgb(var(--ink-100)); color: rgb(var(--ink-700)); }
.pill.success { background: rgb(var(--success) / .1); color: rgb(var(--success)); }
.pill.warning { background: rgb(var(--warning) / .1); color: rgb(var(--warning)); }
.pill.danger { background: rgb(var(--danger) / .1); color: rgb(var(--danger)); }
.pill.brand { background: rgb(var(--brand-50)); color: rgb(var(--brand-fg)); }

/* Controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: var(--button-radius); border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; transition: background-color 150ms, border-color 150ms, transform 120ms; white-space: nowrap; touch-action: manipulation; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-sm { height: 36px; padding: 0 12px; }
/* A compact 36px button reads fine with a precise mouse pointer, but a finger needs the full 44px target.
   Both conditions matter: pointer:coarse catches a real touch device at any width, max-width catches a phone
   whose browser doesn't reliably report pointer capability (headless Chrome's own device emulation included). */
@media (pointer: coarse), (max-width: 500px) { .btn-sm { height: 44px; padding: 0 14px; } }
.btn-block { width: 100%; }
.btn-primary { background: rgb(var(--brand-600)); color: #fff; }
.btn-primary:hover:not(:disabled) { background: rgb(var(--brand-700)); }
.btn-outline { background: rgb(var(--surface)); border-color: rgb(var(--ink-200)); color: rgb(var(--ink-900)); }
.btn-outline:hover:not(:disabled) { background: rgb(var(--soft)); }
.btn-ghost { background: none; color: rgb(var(--ink-700)); }
.btn-ghost:hover:not(:disabled) { background: rgb(var(--ink-100)); }
.btn-danger { background: rgb(var(--danger)); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(.9); }
.input, select.input, textarea.input { width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid rgb(var(--ink-200)); border-radius: 8px; font: inherit; color: inherit; background: rgb(var(--surface)); }
textarea.input { min-height: 88px; resize: vertical; }
textarea.input.is-tall { min-height: 280px; }
.richtext-toolbar { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.richtext-btn { min-height: 32px; padding: 0 10px; border: 1px solid rgb(var(--ink-200)); border-radius: 6px; background: rgb(var(--surface)); color: rgb(var(--ink-700)); font: inherit; font-size: .8125rem; cursor: pointer; transition: background-color 140ms, border-color 140ms, color 140ms; }
.richtext-btn:hover { border-color: rgb(var(--ink-900) / .4); }
.richtext-btn.is-on { background: rgb(var(--brand-600)); border-color: rgb(var(--brand-600)); color: #fff; }
.richtext-editor { min-height: 280px; overflow-y: auto; cursor: text; line-height: 1.55; }
.richtext-editor:empty::before { content: attr(data-placeholder); color: rgb(var(--ink-400)); }
.richtext-editor h2, .richtext-editor h3, .richtext-editor h4 { font-weight: 700; letter-spacing: -0.02em; margin: .8em 0 .4em; }
.richtext-editor h2 { font-size: 1.375rem; }
.richtext-editor h3 { font-size: 1.1875rem; }
.richtext-editor h4 { font-size: 1.0625rem; }
.richtext-editor p { margin: 0 0 .8em; }
.richtext-editor ul, .richtext-editor ol { margin: 0 0 .8em; padding-left: 1.4em; }
.richtext-editor blockquote { margin: 0 0 .8em; padding-left: 14px; border-left: 3px solid rgb(var(--ink-200)); color: rgb(var(--ink-500)); }
.check-row { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px; cursor: pointer; }
.check-row input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: rgb(var(--brand-600)); flex: none; }
.check-row strong { display: block; font-weight: 500; }
.check-row .hint { display: block; margin-top: 2px; }
.field { margin-bottom: 14px; min-width: 0; }
.field label, .field-label { display: block; font-weight: 500; margin-bottom: 6px; }
.field .hint, .hint { font-size: 13px; color: rgb(var(--ink-500)); margin-top: 4px; }
.ticks { border: 0; padding: 0; margin: 0 0 14px; }
.ticks legend { font-weight: 500; margin-bottom: 6px; padding: 0; }
.tick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px 12px; }
.tick { display: flex; gap: 8px; align-items: center; font-size: 14px; cursor: pointer; }
.tick input { width: 16px; height: 16px; accent-color: rgb(var(--brand-600)); flex: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.form-grid .span-2 { grid-column: span 2; }
.form-error { color: rgb(var(--danger)); margin-bottom: 12px; }
.form-ok { color: rgb(var(--success)); margin-bottom: 12px; }

/* Filters */
.filterbar { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 16px; align-items: center; }
.search { position: relative; flex: 1 1 220px; max-width: 320px; color: rgb(var(--ink-400)); display: flex; align-items: center; }
.search .icon { position: absolute; left: 10px; }
.search input { width: 100%; height: 36px; padding: 0 12px 0 32px; border: 1px solid rgb(var(--ink-200)); border-radius: 8px; font: inherit; color: rgb(var(--ink-900)); }
.filter-select { height: 36px; border-radius: 999px; border: 1px solid rgb(var(--ink-200)); background: rgb(var(--surface)); padding: 0 28px 0 14px; font: inherit; color: rgb(var(--ink-700)); max-width: 220px; }
.quiet-tabs { display: flex; gap: 20px; overflow-x: auto; border-bottom: 1px solid rgb(var(--ink-200) / .7); margin-bottom: 16px; }
.quiet-tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 0; font: inherit; font-weight: 500; color: rgb(var(--ink-500)); cursor: pointer; white-space: nowrap; }
.quiet-tab[aria-checked="true"] { color: rgb(var(--ink-900)); border-bottom-color: rgb(var(--ink-900)); }
.segmented { display: inline-flex; background: rgb(var(--ink-100)); border-radius: 999px; padding: 3px; gap: 2px; }
.segment { border: 0; background: none; padding: 4px 12px; border-radius: 999px; font: inherit; font-weight: 500; color: rgb(var(--ink-700)); cursor: pointer; }
.segment[aria-checked="true"] { background: rgb(var(--surface)); color: rgb(var(--ink-900)); box-shadow: 0 1px 2px rgb(var(--poster) / .06); }

/* DataTable: one table, no zebra, no vertical rules */
.table-wrap { position: relative; border: 1px solid rgb(var(--ink-200) / .7); border-radius: 12px; background: rgb(var(--surface)); overflow-x: auto; overscroll-behavior-x: contain; }
.table-wrap.bare { border: 0; border-radius: 0; }
.dt { width: 100%; min-width: 600px; border-collapse: collapse; }
.dt th { background: rgb(var(--soft) / .6); font-size: 0.8125rem; font-weight: 500; color: rgb(var(--ink-500)); text-align: left; padding: 10px 14px; white-space: nowrap; }
.dt td { padding: 14px; border-top: 1px solid rgb(var(--ink-100)); vertical-align: middle; }
.dt tbody tr { animation: row-in 200ms ease backwards; }
.dt tbody tr:hover { background: rgb(var(--soft) / .7); }
.dt tbody tr.clickable { cursor: pointer; }
.dt .right { text-align: right; font-variant-numeric: tabular-nums; }
@keyframes row-in { from { opacity: 0; } to { opacity: 1; } }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who-text { min-width: 0; }
.who-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.who-sub, .sub { font-size: 13px; color: rgb(var(--ink-500)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.when { white-space: nowrap; color: rgb(var(--ink-500)); }
.thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: rgb(var(--soft)); flex: none; display: block; }
.table-foot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 12px 4px 0; font-size: 13px; color: rgb(var(--ink-500)); font-variant-numeric: tabular-nums; }
.pager { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.pager button { min-width: 36px; height: 36px; border: 0; border-radius: 8px; background: none; font: inherit; color: rgb(var(--ink-700)); cursor: pointer; }
.pager button:hover:not(:disabled) { background: rgb(var(--ink-100)); }
.pager button:disabled { color: rgb(var(--ink-400)); opacity: .6; cursor: default; }
.pager button[aria-current="page"] { background: rgb(var(--brand-50)); color: rgb(var(--brand-fg)); font-weight: 600; }
.state { padding: 40px 20px; text-align: center; }
.state-icon { width: 44px; height: 44px; border-radius: 12px; background: rgb(var(--soft)); display: inline-flex; align-items: center; justify-content: center; color: rgb(var(--ink-500)); margin-bottom: 10px; }
.state-title { font-weight: 600; font-size: 15px; }
.state-desc { color: rgb(var(--ink-500)); margin: 4px 0 12px; }
.bone { height: 12px; border-radius: 6px; background: rgb(var(--ink-100)); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }

/* Row menu: rendered on <body> so no row's stacking context can trap it */
.menu { position: fixed; z-index: 60; min-width: 190px; background: rgb(var(--surface)); border: 1px solid rgb(var(--ink-200)); border-radius: 12px; box-shadow: 0 10px 30px rgb(var(--poster) / .14); padding: 4px; animation: menu-in 150ms ease; }
@keyframes menu-in { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: none; } }
.menu button, .menu a { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 8px; font: inherit; color: rgb(var(--ink-900)); cursor: pointer; text-decoration: none; }
.menu button:hover, .menu button:focus, .menu a:hover { background: rgb(var(--ink-100)); outline: none; }
.menu button.destructive { color: rgb(var(--danger)); }
.menu-scrim { position: fixed; inset: 0; z-index: 59; }

/* Dialog: built on the native <dialog>, which gives focus trapping, Esc and inertness */
dialog.dlg { border: 0; padding: 0; border-radius: 16px; width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: 0 24px 60px rgb(var(--poster) / .24); color: inherit; }
dialog.dlg.wide { width: min(760px, calc(100vw - 32px)); }
dialog.dlg::backdrop { background: rgb(var(--poster) / .35); }
.dlg-inner { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.dlg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 20px 8px; }
.dlg-title { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.dlg-sub { color: rgb(var(--ink-500)); font-size: 13px; margin-top: 2px; }
.dlg-body { padding: 8px 20px 16px; overflow-y: auto; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 20px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.kv dt { font-size: 13px; color: rgb(var(--ink-500)); }
.kv dd { margin: 2px 0 0; font-weight: 500; overflow-wrap: anywhere; }
.subhead { font-size: 15px; font-weight: 600; margin: 20px 0 8px; }
.mini { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini td, .mini th { padding: 6px 8px; border-top: 1px solid rgb(var(--ink-100)); text-align: left; }
.mini th { color: rgb(var(--ink-500)); font-weight: 500; border-top: 0; }
.decision { padding: 12px; border-radius: 10px; background: rgb(var(--soft)); margin-top: 12px; }
.token-box { font-family: ui-monospace, Menlo, monospace; font-size: 13px; background: rgb(var(--soft)); padding: 10px; border-radius: 8px; overflow-wrap: anywhere; user-select: all; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.pretty { font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: rgb(var(--soft)); padding: 10px; border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow: auto; }
.perm-group { margin-bottom: 14px; }
.perm-group h3 { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.perm { display: flex; gap: 8px; align-items: center; padding: 3px 0; }
.perm.off { color: rgb(var(--ink-500)); }

/* Switch */
.switch { width: 38px; height: 22px; border-radius: 999px; border: 0; background: rgb(var(--ink-200)); position: relative; cursor: pointer; transition: background-color 150ms; flex: none; padding: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform 150ms; }
.switch[aria-checked="true"] { background: rgb(var(--brand-600)); }
.switch[aria-checked="true"]::after { transform: translateX(16px); }
.switch:disabled { opacity: .55; cursor: not-allowed; }
.setting { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; justify-content: space-between; padding: 12px 0; border-top: 1px solid rgb(var(--ink-100)); }
.setting:first-child { border-top: 0; padding-top: 0; }
.setting-text { flex: 1 1 16rem; min-width: 0; }
.setting-label { font-weight: 600; }
.setting-image { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.setting-image .thumb { width: 160px; height: 90px; border-radius: 10px; }
.setting-image span.thumb { display: flex; align-items: center; justify-content: center; color: rgb(var(--ink-400)); font-size: .8125rem; }

/* Charts */
.chart { color: rgb(var(--brand-500)); width: 100%; position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: rgb(var(--ink-500)); font-size: 11px; font-family: inherit; }
.chart .gridline { stroke: rgb(var(--ink-200)); stroke-dasharray: 3 4; }
.chart-tip { position: absolute; pointer-events: none; background: rgb(var(--surface)); border: 1px solid rgb(var(--ink-200)); border-radius: 12px; padding: 6px 10px; box-shadow: 0 8px 20px rgb(var(--poster) / .12); font-size: 12px; white-space: nowrap; transform: translate(-50%, -110%); }
.chart-tip strong { display: block; font-size: 14px; color: rgb(var(--brand-fg)); }
.chart-empty { background: rgb(var(--soft)); border-radius: 12px; height: 200px; display: flex; align-items: center; justify-content: center; color: rgb(var(--ink-500)); }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; border-top: 1px solid rgb(var(--ink-100)); }
.feed li:first-child { border-top: 0; }
.attn a { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid rgb(var(--ink-100)); color: inherit; text-decoration: none; }
.attn a:first-child { border-top: 0; }
.attn a:hover { background: rgb(var(--soft)); }
.attn .num { margin-left: auto; font-weight: 700; }

/* Toasts */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: rgb(var(--ink-900)); color: #fff; border-radius: 12px; padding: 12px 14px; box-shadow: 0 8px 24px rgb(var(--poster) / .24); animation: menu-in 150ms ease; }
.toast strong { display: block; }
.toast.bad { background: rgb(var(--danger)); }

/* Sign-in */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: rgb(var(--soft)); padding: 20px; }
.auth-card { background: rgb(var(--surface)); border: 1px solid rgb(var(--ink-200) / .7); border-radius: 16px; padding: 32px; width: min(440px, 100%); box-shadow: 0 10px 30px rgb(var(--poster) / .06); }
.auth-lead { color: rgb(var(--ink-500)); margin: -8px 0 18px; line-height: 1.5; }
.auth-card > img { width: 180px; height: auto; }
.auth-title { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.03em; margin: 20px 0 20px; }
.auth-foot { margin-top: 14px; font-size: 13px; text-align: center; }

/* Grids used by dashboard */
.dash { display: grid; gap: 20px; }
.dash > *, .settings-grid > *, .stack > * { min-width: 0; }
@media (min-width: 1280px) {
  .dash { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; } .span-7 { grid-column: span 7; } .span-12 { grid-column: span 12; }
}
.settings-grid { display: grid; gap: 20px; }
@media (min-width: 1280px) { .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Phone and tablet: the rail becomes a drawer. Secondary columns hide. No page ever scrolls sideways. */
@media (max-width: 1023px) {
  .only-mobile { display: inline-flex !important; }
  .rail { position: fixed; inset: 0 auto 0 0; z-index: 40; transform: translateX(-100%); transition: transform 250ms cubic-bezier(.22,1,.36,1); }
  .rail.is-open { transform: none; }
  .rail-scrim { position: fixed; inset: 0; background: rgb(var(--poster) / .3); z-index: 39; }
  main#page, .page-pad { padding: 24px 20px; }
  .dt .secondary { display: none; }
  .dt { min-width: 0; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
  .kv { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Who did what */
.activity { align-items: flex-start; }
.activity-main { min-width: 0; }
.changes { display: grid; grid-template-columns: minmax(90px, max-content) minmax(0, 1fr); gap: 4px 12px; margin: 6px 0 0; font-size: 13px; }
.changes dt { color: rgb(var(--ink-500)); }
.changes dd { margin: 0; overflow-wrap: anywhere; }
.changes .was { color: rgb(var(--ink-500)); text-decoration: line-through; }
details.raw { margin-top: 14px; font-size: 13px; }
details.raw summary { cursor: pointer; color: rgb(var(--ink-500)); margin-bottom: 8px; }
details.raw .pretty + .pretty { margin-top: 8px; }

/* Report preview */
.report-preview .num, .dt th.num, .dt td.num { text-align: right; font-variant-numeric: tabular-nums; }
.takeaways { margin: 0; padding-left: 18px; }
.takeaways li + li { margin-top: 6px; }

/* Two-step sign-in */
.auth-step[hidden] { display: none; }
.auth-step p { font-size: 14px; line-height: 1.5; margin: 0 0 12px; }
.qr-box { width: 180px; height: 180px; margin: 0 auto 12px; padding: 8px; background: #fff; border: 1px solid rgb(var(--ink-200)); border-radius: 10px; }
.qr-box img { display: block; width: 100%; height: 100%; }
.secret-text { display: block; margin-bottom: 12px; padding: 8px 10px; background: rgb(var(--soft)); border-radius: 8px; font-family: ui-monospace, Menlo, monospace; font-size: 12px; word-break: break-all; }
.recovery-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin: 0 0 14px; padding: 10px 12px; list-style: none; background: rgb(var(--soft)); border-radius: 8px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.icon-sprite { display: none; }
.two-step-status { margin: 0 0 12px; }

/* ---------- Today ---------- */
.today-title { font-size: clamp(2.5rem, 6vw, 5rem); font-weight: 700; letter-spacing: -0.05em; line-height: .96; }
.today-line { font-size: clamp(1.0625rem, 1.5vw, 1.25rem); color: rgb(var(--ink-500)); margin-top: 10px; }
.today-head { padding-bottom: 28px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat-row .stat { border-radius: 14px; padding: 16px; background: rgb(var(--soft)); border: 0; }
.stat-row .stat.is-brand { background: rgb(var(--brand-600)); color: #fff; }
.stat-row .stat.is-brand .stat-label, .stat-row .stat.is-brand .stat-foot { color: rgb(255 255 255 / .84); }
.agenda { list-style: none; margin: 0; padding: 0; }
.agenda li { border-top: 1px solid rgb(var(--ink-100)); }
.agenda li:first-child { border-top: 0; }
.agenda button { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 14px; align-items: center; width: 100%; padding: 12px 16px; background: none; border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; transition: background-color 150ms; }
.agenda button:hover { background: rgb(var(--soft)); }
.agenda-time { font-weight: 700; font-size: 1.0625rem; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.agenda-who { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agenda-what { color: rgb(var(--ink-500)); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Calendar: one diary, drawn to scale ---------- */
.cal-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-bottom: 14px; }
.cal-title { font-size: clamp(1.625rem, 3.2vw, 2.75rem); font-weight: 700; letter-spacing: -0.04em; line-height: 1.04; min-width: 0; }
.cal-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px 24px; padding-bottom: 16px; }
.cal-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.cal-spacer { flex: 1; }
.cal { --hour: 76px; --gutter: 56px; position: relative; border: 1px solid rgb(var(--ink-200) / .8); border-radius: 14px; background: rgb(var(--surface)); overflow: auto; max-height: calc(100vh - 256px); min-height: 460px; overscroll-behavior: contain; }
.cal-grid { display: grid; grid-template-columns: var(--gutter) repeat(var(--cols), minmax(var(--col-min, 110px), 1fr)); min-width: min-content; }
.cal-corner, .cal-col-head { position: sticky; top: 0; z-index: 4; background: rgb(var(--surface) / .97); border-bottom: 1px solid rgb(var(--ink-200)); }
.cal-corner { left: 0; z-index: 6; }
.cal-col-head { padding: 8px 10px; text-align: left; border: 0; border-bottom: 1px solid rgb(var(--ink-200)); border-left: 1px solid rgb(var(--ink-100)); font: inherit; color: inherit; cursor: pointer; transition: background-color 150ms; }
.cal-col-head:hover { background: rgb(var(--soft)); }
.cal-col-head.is-static { cursor: default; }
.cal-col-head.is-static:hover { background: rgb(var(--surface) / .97); }
.cal-dow { display: block; font-size: 12px; color: rgb(var(--ink-500)); }
.cal-dom { display: block; font-size: 1.375rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.cal-col-head.is-today .cal-dom { color: rgb(var(--brand-fg)); }
.cal-col-head.is-closed .cal-dom { color: rgb(var(--ink-400)); font-weight: 500; }
.cal-times { position: sticky; left: 0; z-index: 3; background: rgb(var(--surface)); }
.cal-time { height: var(--hour); font-size: 12px; color: rgb(var(--ink-500)); text-align: right; padding: 2px 8px 0 0; font-variant-numeric: tabular-nums; transform: translateY(-9px); }
.cal-time:first-child { visibility: hidden; }
.cal-col { position: relative; border-left: 1px solid rgb(var(--ink-100)); height: calc(var(--hour) * var(--hours)); background-image: linear-gradient(rgb(var(--ink-100)) 1px, transparent 1px), linear-gradient(rgb(var(--ink-100) / .5) 1px, transparent 1px); background-size: 100% var(--hour), 100% calc(var(--hour) / 2); }
.cal-col.is-today { background-color: rgb(var(--brand-50) / .35); }
.cal-closed { position: absolute; left: 0; right: 0; background-color: rgb(var(--soft)); background-image: repeating-linear-gradient(135deg, transparent 0 7px, rgb(var(--ink-200) / .45) 7px 8px); pointer-events: none; }
.cal-slot { position: absolute; left: 0; right: 0; height: calc(var(--hour) / 4); border: 0; background: none; padding: 0; cursor: pointer; }
.cal-slot:hover, .cal-slot:focus-visible { background: rgb(var(--brand-600) / .1); outline: none; box-shadow: inset 0 0 0 1px rgb(var(--brand-600) / .5); }
.cal-event { position: absolute; z-index: 2; display: block; overflow: hidden; padding: 3px 7px 3px 9px; border: 0; border-left: 3px solid var(--tone); border-radius: 6px; background: var(--tone-bg); color: rgb(var(--ink-900)); font: inherit; font-size: 12.5px; line-height: 1.22; text-align: left; cursor: pointer; touch-action: none; transition: box-shadow 150ms, filter 150ms; }
.cal-event:hover { box-shadow: 0 4px 14px rgb(var(--poster) / .18); z-index: 3; }
.cal-event strong { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event:has(.ev-paid) strong { padding-right: 18px; }
.cal-event span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: rgb(var(--ink-700)); }
.cal-event .ev-time { font-variant-numeric: tabular-nums; font-size: 11.5px; }
.cal-event.is-provisional, .cal-event.is-awaiting_payment { border-left-style: dashed; }
.cal-event.is-awaiting_payment { background-image: repeating-linear-gradient(135deg, transparent 0 6px, rgb(255 255 255 / .6) 6px 12px); }
.cal-event.is-arrived { box-shadow: inset 0 0 0 2px var(--tone); }
.cal-event.is-completed { opacity: .62; }
.cal-event.is-no_show { opacity: .7; }
.cal-event.is-no_show strong { text-decoration: line-through; }
.cal-event.is-cancelled { opacity: .5; }
.cal-event.is-cancelled strong { text-decoration: line-through; }
.cal-event.is-dragging { opacity: .85; box-shadow: 0 10px 28px rgb(var(--poster) / .3); z-index: 5; cursor: grabbing; }
.ev-paid { position: absolute; top: 3px; right: 4px; width: 15px; height: 15px; border-radius: 50%; background: rgb(var(--success)); color: #fff; display: inline-flex !important; align-items: center; justify-content: center; }
.ev-paid .icon { width: 10px; height: 10px; stroke-width: 3; }
.cal-block { position: absolute; z-index: 1; left: 2px; right: 2px; border-radius: 6px; padding: 3px 7px; font: inherit; font-size: 12px; text-align: left; border: 0; color: rgb(var(--ink-700)); cursor: pointer; background-color: rgb(var(--ink-200)); background-image: repeating-linear-gradient(135deg, transparent 0 6px, rgb(255 255 255 / .55) 6px 12px); overflow: hidden; }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: rgb(var(--danger)); z-index: 3; pointer-events: none; }
.cal-now::before { content: ""; position: absolute; left: -4px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: rgb(var(--danger)); }
.cal-tone-0 { --tone: rgb(var(--brand-600)); --tone-bg: rgb(var(--brand-50)); }
.cal-tone-1 { --tone: rgb(6 120 58); --tone-bg: rgb(var(--green-100)); }
.cal-tone-2 { --tone: rgb(var(--warning)); --tone-bg: rgb(var(--warning) / .14); }
.cal-tone-3 { --tone: rgb(var(--ink-700)); --tone-bg: rgb(var(--ink-100)); }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; padding-top: 12px; font-size: 13px; color: rgb(var(--ink-500)); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg-swatch { width: 18px; height: 12px; border-radius: 3px; border-left: 3px solid var(--tone, rgb(var(--ink-400))); background: var(--tone-bg, rgb(var(--ink-100))); }
.lg-swatch.is-dashed { border-left-style: dashed; }
.lg-swatch.is-closed { border: 0; background-color: rgb(var(--soft)); background-image: repeating-linear-gradient(135deg, transparent 0 3px, rgb(var(--ink-200)) 3px 4px); }
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); min-width: 720px; }
.cal-month-dow { position: sticky; top: 0; z-index: 2; background: rgb(var(--surface)); padding: 8px 10px; font-size: 12px; color: rgb(var(--ink-500)); border-bottom: 1px solid rgb(var(--ink-200)); }
.cal-cell { min-height: 118px; padding: 6px; background: none; border: 0; border-top: 1px solid rgb(var(--ink-100)); border-left: 1px solid rgb(var(--ink-100)); text-align: left; font: inherit; color: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 3px; min-width: 0; transition: background-color 150ms; }
.cal-cell:hover { background: rgb(var(--soft)); }
.cal-cell.is-other { color: rgb(var(--ink-400)); background: rgb(var(--soft) / .5); }
.cal-cell-day { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; letter-spacing: -0.02em; font-size: 1.0625rem; }
.cal-cell.is-today .cal-cell-day b { background: rgb(var(--brand-600)); color: #fff; border-radius: 6px; padding: 0 6px; }
.cal-cell-count { font-size: 11.5px; font-weight: 500; color: rgb(var(--ink-500)); letter-spacing: 0; }
.cal-dot { display: block; padding: 1px 5px; border-radius: 4px; border-left: 2px solid var(--tone); background: var(--tone-bg); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-more { font-size: 11.5px; color: rgb(var(--ink-500)); }
.cal-loading { position: absolute; top: 10px; right: 12px; font-size: 12px; color: rgb(var(--ink-500)); z-index: 7; background: rgb(var(--surface)); padding: 2px 8px; border-radius: 999px; }

/* ---------- Records in a dialog ---------- */
.sheet-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0; }
.sheet-time { font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 700; letter-spacing: -0.04em; line-height: 1.04; }
.sheet-sub { color: rgb(var(--ink-500)); margin-top: 4px; }
.sheet-section { margin-top: 18px; border-top: 1px solid rgb(var(--ink-100)); padding-top: 14px; }
.sheet-section h3 { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.alert-line { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-radius: 8px; background: rgb(var(--danger) / .08); color: rgb(var(--danger)); font-weight: 600; margin-bottom: 12px; }
.note-card { border-top: 1px solid rgb(var(--ink-100)); padding: 12px 0; }
.note-card:first-child { border-top: 0; padding-top: 0; }
.note-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; color: rgb(var(--ink-500)); font-size: 13px; margin-bottom: 6px; }
.note-body dt { font-size: 12px; color: rgb(var(--ink-500)); margin-top: 8px; }
.note-body dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-amend { font-size: 12px; font-weight: 600; color: rgb(var(--warning)); }
.team-card { display: flex; align-items: center; gap: 12px; min-width: 0; }
.team-thumb { width: 52px; height: 64px; object-fit: cover; object-position: 50% 18%; border-radius: 8px; background: rgb(var(--brand-50)); flex: none; }
.team-order { display: flex; gap: 2px; }
.hours-row { display: grid; grid-template-columns: 124px auto repeat(2, 110px) auto repeat(2, 110px); gap: 8px; align-items: center; padding: 10px 0; border-top: 1px solid rgb(var(--ink-100)); }
.hours-row:first-child { border-top: 0; }
.hours-row.is-closed .input { opacity: .35; }
.hours-day { font-weight: 600; }
.hours-gap { color: rgb(var(--ink-500)); font-size: 13px; text-align: center; }
.report-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; padding-bottom: 16px; }
.report-tools label { font-size: 13px; color: rgb(var(--ink-500)); display: block; margin-bottom: 4px; }
.pay-mode { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.pay-mode p { color: rgb(var(--ink-500)); max-width: 54ch; }
@media (max-width: 1023px) {
  .cal { max-height: none; min-height: 0; --hour: 64px; }
  .hours-row { grid-template-columns: 76px auto minmax(0, 1fr) minmax(0, 1fr); gap: 6px; }
  .hours-row .input { min-width: 0; padding: 8px 4px; }
  .hours-row .hours-gap, .hours-row .is-break { display: none; }
}
@media print { .rail, .topbar, .no-print { display: none !important; } }

/* ---------- Invoice ---------- */
.invoice-page { background: rgb(var(--soft)); padding: 24px 12px; font-size: 15px; }
.invoice { background: rgb(var(--surface)); max-width: 800px; margin: 0 auto; padding: clamp(24px, 5vw, 56px); }
.invoice-tools { display: flex; justify-content: flex-end; margin-bottom: 24px; }
.invoice-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 40px; }
.invoice-head h1 { font-size: 3rem; font-weight: 700; letter-spacing: -0.05em; line-height: 1; text-align: right; }
.invoice-head p { text-align: right; color: rgb(var(--ink-500)); margin-top: 8px; }
.invoice-parties { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 20px; margin-bottom: 36px; }
.invoice-parties h2 { font-size: 13px; color: rgb(var(--ink-500)); font-weight: 500; margin-bottom: 4px; }
.invoice-lines { width: 100%; border-collapse: collapse; }
.invoice-lines th { text-align: left; font-size: 13px; font-weight: 500; color: rgb(var(--ink-500)); border-bottom: 1px solid rgb(var(--ink-900)); padding: 8px 0; }
.invoice-lines td { padding: 12px 0; border-bottom: 1px solid rgb(var(--ink-200)); vertical-align: top; }
.invoice-lines small { color: rgb(var(--ink-500)); }
.invoice-lines .num { text-align: right; font-variant-numeric: tabular-nums; }
.invoice-due td { font-size: 1.375rem; font-weight: 700; letter-spacing: -0.02em; border-bottom: 0; }
.invoice-note { margin-top: 24px; color: rgb(var(--ink-700)); }
@media print { .invoice-page { background: #fff; padding: 0; } .invoice { padding: 0; max-width: none; } }
.chip-row.is-wide { flex: 1 1 100%; }
.chip-row.is-wide textarea { flex: 1 1 100%; }

/* ================================================================ November 2026 additions */

/* Logo: the white one on dark */
.logo-dark { display: none !important; }
.theme-admin[data-theme="dark"] .logo-light { display: none !important; }
.theme-admin[data-theme="dark"] .logo-dark { display: block !important; }
@media (prefers-color-scheme: dark) {
  .theme-admin:not([data-theme="light"]) .logo-light { display: none !important; }
  .theme-admin:not([data-theme="light"]) .logo-dark { display: block !important; }
}

/* Topbar: who is signed in, and the light/dark switch */
.topbar { gap: 4px; }
.account-chip { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 8px 0 4px; border: 0; background: none; border-radius: 999px; font: inherit; font-weight: 600; color: rgb(var(--ink-900)); cursor: pointer; transition: background-color 150ms; }
.account-chip:hover { background: rgb(var(--ink-100)); }
.account-chip .icon { color: rgb(var(--ink-500)); width: 16px; height: 16px; }
.account-chip .avatar { background: rgb(var(--brand-50)); color: rgb(var(--brand-fg)); }
.theme-btn .icon-sun { display: none; }
.theme-admin[data-theme="dark"] .theme-btn .icon-sun { display: block; }
.theme-admin[data-theme="dark"] .theme-btn .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  .theme-admin:not([data-theme="light"]) .theme-btn .icon-sun { display: block; }
  .theme-admin:not([data-theme="light"]) .theme-btn .icon-moon { display: none; }
}
@media (max-width: 640px) { .account-chip .account-name, .account-chip .icon { display: none; } }

/* Dialogs follow the theme */
dialog.dlg { background: rgb(var(--surface)); }

/* ---------- Checkboxes and radios: one custom look, everywhere ---------- */
.theme-admin input[type="checkbox"], .theme-admin input[type="radio"] {
  appearance: none; -webkit-appearance: none; flex: none; margin: 0; width: 18px; height: 18px; display: inline-grid; place-content: center;
  border: 1.5px solid rgb(var(--ink-400)); border-radius: 5px; background: rgb(var(--surface)) center / 12px 12px no-repeat; cursor: pointer;
  transition: background-color 120ms, border-color 120ms, box-shadow 120ms;
}
.theme-admin input[type="radio"] { border-radius: 50%; }
.theme-admin input[type="checkbox"]:hover, .theme-admin input[type="radio"]:hover { border-color: rgb(var(--brand-500)); }
.theme-admin input[type="checkbox"]:checked {
  background-color: rgb(var(--brand-600)); border-color: rgb(var(--brand-600));
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}
.theme-admin input[type="radio"]:checked { border-color: rgb(var(--brand-600)); box-shadow: inset 0 0 0 4px rgb(var(--surface)); background-color: rgb(var(--brand-600)); }
.theme-admin input[type="checkbox"]:focus-visible, .theme-admin input[type="radio"]:focus-visible { outline: 2px solid rgb(var(--brand-500)); outline-offset: 2px; }
.check-row { padding: 12px 14px; border: 1px solid rgb(var(--ink-200)); border-radius: 12px; transition: border-color 150ms, background-color 150ms; }
.check-row:hover { border-color: rgb(var(--ink-400)); }
.check-row:has(input:checked) { border-color: rgb(var(--brand-500)); background: rgb(var(--brand-50) / .6); }

/* Many choices (levels, days, programmes): chips you tap, not a wall of boxes */
.tick-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.tick { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px 0 10px; border: 1px solid rgb(var(--ink-200)); border-radius: 999px;
  background: rgb(var(--surface)); font-weight: 500; color: rgb(var(--ink-700)); user-select: none; transition: background-color 150ms, border-color 150ms, color 150ms; }
.tick:hover { border-color: rgb(var(--ink-400)); color: rgb(var(--ink-900)); }
.tick input[type="checkbox"] { width: 16px; height: 16px; border-radius: 50%; background-size: 10px 10px; }
.tick:has(input:checked) { background: rgb(var(--brand-50)); border-color: rgb(var(--brand-500)); color: rgb(var(--brand-fg)); }
.tick:has(input:focus-visible) { outline: 2px solid rgb(var(--brand-500)); outline-offset: 2px; }
.tick input:focus-visible { outline: 0; }
.ticks-tools { display: flex; gap: 12px; margin: -2px 0 8px; font-size: 13px; }
.ticks-tools button { background: none; border: 0; padding: 0; font: inherit; color: rgb(var(--brand-fg)); cursor: pointer; }
.ticks-tools button:hover { text-decoration: underline; }

/* Space above "add another" buttons, so they never touch the row above */
.add-row { margin-top: 12px; }
.add-row .icon { width: 16px; height: 16px; }

/* ---------- Money: ₦ in front, thousands separated as you type ---------- */
.money { position: relative; display: flex; align-items: center; }
.money > span { position: absolute; left: 12px; color: rgb(var(--ink-500)); font-weight: 600; pointer-events: none; }
.money .input { padding-left: 30px; font-variant-numeric: tabular-nums; }

/* ---------- Combobox: a select you can type into ---------- */
.combo { position: relative; }
.combo-field { position: relative; display: flex; align-items: center; }
.combo-field .input { padding-right: 36px; }
.combo-field > .icon { position: absolute; right: 12px; color: rgb(var(--ink-500)); pointer-events: none; transition: transform 150ms; }
.combo.is-open .combo-field > .icon { transform: rotate(180deg); }
.combo-list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); max-height: 280px; overflow-y: auto; margin: 0; padding: 4px; list-style: none;
  background: rgb(var(--surface)); border: 1px solid rgb(var(--ink-200)); border-radius: 12px; box-shadow: 0 12px 32px rgb(var(--poster) / .16); animation: menu-in 120ms ease; }
.combo-group { padding: 8px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: rgb(var(--ink-500)); }
.combo-option { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.combo-option[aria-selected="true"], .combo-option:hover { background: rgb(var(--ink-100)); }
.combo-option.is-chosen { font-weight: 600; color: rgb(var(--brand-fg)); }
.combo-option small { display: block; color: rgb(var(--ink-500)); font-size: 12px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 380px; }
.combo-option .pill { flex: none; }
.combo-empty { padding: 12px 10px; color: rgb(var(--ink-500)); }

/* ---------- Step-by-step dialogs ---------- */
.steps-head { display: flex; gap: 6px; margin: 4px 0 18px; padding: 0; }
.steps-head li { flex: 1; list-style: none; min-width: 0; }
.steps-bar { display: block; height: 4px; border-radius: 4px; background: rgb(var(--ink-100)); overflow: hidden; position: relative; }
.steps-bar::after { content: ""; position: absolute; inset: 0; background: rgb(var(--brand-600)); transform: scaleX(0); transform-origin: left; transition: transform 300ms cubic-bezier(.22,1,.36,1); }
.steps-head li.is-done .steps-bar::after, .steps-head li.is-current .steps-bar::after { transform: none; }
.steps-label { display: block; margin-top: 6px; font-size: 12px; color: rgb(var(--ink-500)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.steps-head li.is-current .steps-label { color: rgb(var(--ink-900)); font-weight: 600; }
.steps-head ol { display: contents; }
.step-pane { animation: step-in 220ms cubic-bezier(.22,1,.36,1); }
@keyframes step-in { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }
.step-count { margin-right: auto; align-self: center; font-size: 13px; color: rgb(var(--ink-500)); }
.review-list { display: grid; grid-template-columns: minmax(110px, max-content) minmax(0, 1fr); gap: 8px 16px; margin: 0; }
.review-list dt { color: rgb(var(--ink-500)); font-size: 13px; }
.review-list dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
@media (max-width: 640px) { .steps-label { display: none; } }

/* ---------- Dashboard ---------- */
.greet { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; padding-bottom: 24px; }
.greet-crumb { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: rgb(var(--ink-500)); margin-bottom: 8px; }
.greet-crumb b { color: rgb(var(--ink-900)); font-weight: 500; }
.greet h1 { font-size: clamp(1.75rem, 2.6vw, 2.25rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.greet p { color: rgb(var(--ink-500)); margin-top: 6px; font-size: 15px; }
.period { height: 40px; padding: 0 36px 0 16px; border-radius: 12px; border: 1px solid rgb(var(--ink-200)); background: rgb(var(--surface)); font: inherit; font-weight: 600; color: rgb(var(--ink-900)); }
.dash-grid { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) {
  .dash-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .dash-grid .c-5 { grid-column: span 5; } .dash-grid .c-7 { grid-column: span 7; } .dash-grid .c-4 { grid-column: span 4; } .dash-grid .c-12 { grid-column: span 12; }
}
.dash-grid > * { min-width: 0; }
.dash-grid .panel { display: flex; flex-direction: column; }
.dash-grid .panel-body { flex: 1; }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.kpi { background: rgb(var(--surface)); border: 1px solid rgb(var(--ink-200) / .6); border-radius: 12px; padding: 18px; min-width: 0; }
.kpi-label { display: flex; align-items: center; gap: 10px; color: rgb(var(--ink-500)); font-weight: 500; }
.kpi-label .stat-tile { width: 34px; height: 34px; border-radius: 50%; }
.kpi-value { font-size: clamp(1.5rem, 2.4vw, 2rem); font-weight: 700; letter-spacing: -0.035em; margin-top: 16px; font-variant-numeric: tabular-nums; line-height: 1.1; overflow-wrap: anywhere; }
.kpi-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 10px; font-size: 13px; color: rgb(var(--ink-500)); }
.panel-head .segmented { background: none; padding: 0; }
.panel-head .segment[aria-checked="true"] { background: rgb(var(--surface)); }
.chart.is-tall svg { min-height: 220px; }
.feed-dot { width: 7px; height: 7px; border-radius: 50%; background: rgb(var(--ink-400)); flex: none; }
.feed-dot.is-payment, .feed-dot.is-placement { background: rgb(var(--success)); }
.feed-dot.is-request, .feed-dot.is-comment { background: rgb(var(--brand-500)); }
.feed-dot.is-application, .feed-dot.is-result { background: rgb(var(--warning)); }
.live-feed { list-style: none; margin: 0; padding: 0; }
.live-feed a { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid rgb(var(--ink-100)); color: inherit; text-decoration: none; }
.live-feed li:first-child a { border-top: 0; }
.live-feed a:hover { background: rgb(var(--soft)); }
.live-feed .feed-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.live-feed .when { font-size: 13px; }
.live-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: rgb(var(--success)); }
.live-tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: live 2s ease-in-out infinite; }
@keyframes live { 50% { opacity: .35; } }
.week-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.week-num { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.week-bars { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; align-items: end; height: 190px; margin-top: 18px; }
.week-col { display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.week-col svg { width: 100%; flex: 1; display: block; }
.week-col span { font-size: 12px; color: rgb(var(--ink-500)); }
.week-col.is-today span { color: rgb(var(--ink-900)); font-weight: 600; }
.wk-track { fill: rgb(var(--soft)); }
.wk-booked { fill: rgb(var(--brand-50)); }
.wk-held { fill: rgb(var(--brand-600)); }
.attn-list a { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-top: 1px solid rgb(var(--ink-100)); color: inherit; text-decoration: none; font-weight: 500; }
.attn-list a:first-child { border-top: 0; }
.attn-list a:hover { background: rgb(var(--soft)); }
.attn-list .stat-tile { border-radius: 50%; width: 34px; height: 34px; }
.attn-list .num { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.attn-list a.is-zero .num { color: rgb(var(--ink-400)); font-weight: 500; }
.view-all { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: rgb(var(--brand-fg)); text-decoration: none; font-size: 14px; }
.view-all .icon { width: 15px; height: 15px; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 13px; letter-spacing: .01em; }

/* ---------- Results ---------- */
.score-grid { display: grid; gap: 8px; }
.score-row { display: grid; grid-template-columns: minmax(0, 2fr) 90px 90px 70px 56px 36px; gap: 8px; align-items: center; }
.score-row.is-head { font-size: 12px; color: rgb(var(--ink-500)); font-weight: 500; }
.score-row .input { min-width: 0; }
.score-total { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.grade-chip { display: inline-flex; justify-content: center; min-width: 40px; padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: rgb(var(--chip)); color: rgb(var(--ink-700)); }
.grade-chip.g-a { background: rgb(var(--success) / .14); color: rgb(var(--success)); }
.grade-chip.g-b { background: rgb(var(--brand-50)); color: rgb(var(--brand-fg)); }
.grade-chip.g-c { background: rgb(var(--warning) / .14); color: rgb(var(--warning)); }
.grade-chip.g-f { background: rgb(var(--danger) / .12); color: rgb(var(--danger)); }
.result-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.result-summary div { background: rgb(var(--soft)); border-radius: 12px; padding: 12px 14px; }
.result-summary dt { font-size: 12px; color: rgb(var(--ink-500)); }
.result-summary dd { margin: 4px 0 0; font-size: 1.375rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.subject-bars { display: grid; gap: 9px; }
.subject-bar { display: grid; grid-template-columns: minmax(90px, 160px) minmax(0, 1fr) 40px; gap: 12px; align-items: center; font-size: 13px; }
.subject-bar > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: rgb(var(--ink-700)); }
.subject-bar b { text-align: right; font-variant-numeric: tabular-nums; font-size: 12px; color: rgb(var(--ink-500)); }
.sb-track { width: 100%; height: 8px; border-radius: 999px; overflow: hidden; background: rgb(var(--ink-100)); }
.sb-fill { height: 100%; background: rgb(var(--brand-600)); }
.sb-fill.is-low { background: rgb(var(--warning)); }
@media (max-width: 720px) {
  .score-row { grid-template-columns: minmax(0, 1fr) 64px 64px 44px; }
  .score-row .grade-cell, .score-row.is-head .grade-cell { display: none; }
  .score-row > :last-child { grid-column: 4; }
  .result-summary { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Family overview: one card per child ---------- */
.child-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.child-head { display: flex; align-items: center; gap: 12px; }
.child-head .avatar { width: 44px; height: 44px; font-size: 18px; background: rgb(var(--brand-50)); color: rgb(var(--brand-fg)); }
.child-head h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }
.child-head p { color: rgb(var(--ink-500)); font-size: 13px; margin-top: 2px; }
.child-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 16px 0; }
.child-stats div { background: rgb(var(--soft)); border-radius: 12px; padding: 12px; min-width: 0; }
.child-stats dt { font-size: 12px; color: rgb(var(--ink-500)); }
.child-stats dd { margin: 4px 0 0; font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.child-stats small { display: block; font-size: 12px; font-weight: 500; color: rgb(var(--ink-500)); letter-spacing: 0; }
.child-section { border-top: 1px solid rgb(var(--ink-100)); padding-top: 14px; margin-top: 14px; }
.child-section h3 { font-size: 13px; font-weight: 600; color: rgb(var(--ink-500)); margin-bottom: 10px; }
.trend svg { width: 100%; height: 90px; display: block; overflow: visible; }
.trend-line { fill: none; stroke: rgb(var(--brand-500)); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.trend-area { fill: rgb(var(--brand-500) / .12); }
.trend-dot { fill: rgb(var(--surface)); stroke: rgb(var(--brand-500)); stroke-width: 2; }
.trend text { fill: rgb(var(--ink-500)); font-size: 11px; font-family: inherit; }

/* Report card (print) */
.report-card .rc-summary .rc-average { font-size: 2.75rem; font-weight: 700; letter-spacing: -0.05em; line-height: 1; }
.report-card .rc-summary .rc-average span { font-size: 1rem; color: rgb(var(--ink-500)); letter-spacing: 0; margin-left: 2px; }
.rc-chart { margin-top: 36px; }
.rc-chart h2 { font-size: 13px; color: rgb(var(--ink-500)); font-weight: 500; margin-bottom: 10px; }
.rc-label, .rc-value { font-size: 13px; fill: rgb(var(--ink-900)); font-family: inherit; }
.rc-track { fill: rgb(var(--ink-100)); }
.rc-bar { fill: rgb(var(--brand-600)); }
.rc-bar.is-low { fill: rgb(var(--warning)); }
.rc-note { margin-top: 10px; color: rgb(var(--ink-700)); }
.rc-foot { margin-top: 28px; font-size: 12px; color: rgb(var(--ink-500)); }
.invoice-page { color-scheme: light; }
@media print { .rc-bar, .wk-held { print-color-adjust: exact; -webkit-print-color-adjust: exact; } }

/* Danger zone in a record dialog */
.danger-zone { margin-top: 20px; padding-top: 14px; border-top: 1px solid rgb(var(--ink-100)); display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.danger-zone p { color: rgb(var(--ink-500)); font-size: 13px; max-width: 46ch; }
.btn-danger-quiet { background: none; color: rgb(var(--danger)); border-color: rgb(var(--danger) / .4); }
.btn-danger-quiet:hover:not(:disabled) { background: rgb(var(--danger) / .08); }
@media (min-width: 1100px) { .dash-grid .c-3 { grid-column: span 3; } }
@media (min-width: 1100px) and (max-width: 1400px) { .dash-grid .c-3 { grid-column: span 12; } .dash-grid .c-4 { grid-column: span 7; } .dash-grid .c-5:nth-child(3) { grid-column: span 5; } }
.panel-body.stats-body { padding: 8px; background: none; border: 0; }
.dash-grid .table-wrap.bare .dt { min-width: 640px; }
