
/* Veylark tokens. Theme: html[data-theme="light"|"dark"] wins; without it, the system preference decides. */
@font-face { font-family: "Inter"; src: url("/fonts/inter.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  --paper: #f5f5f7;      /* page ground */
  --paper-2: #e8e8ed;    /* segmented controls, tracks, quiet fills */
  --paper-3: #fbfbfd;    /* sidebar, landing ground */
  --white: #ffffff;      /* cards, inputs */
  --ink: #121212;        /* text and primary buttons */
  --ink-2: #424245;
  --muted: #6e6e73;      /* 4.6:1 on white */
  --hair: #e5e5ea;       /* card borders and row lines */
  --field: #86868b;      /* form field borders, >= 3:1 on white */
  --yellow: #ffd21f;     /* the one accent: score, selection, "fits you" */
  --yellow-2: #fff6d1;   /* soft yellow: test mode, unsure */
  --amber-ink: #7a5c00;  /* text on yellow-2 */
  --red: #d2231a;        /* fills: deleting, destructive */
  --red-ink: #b51d15;    /* red text */
  --red-2: #fdecea;      /* soft red: deleted */
  --green: #1f8a52;
  --green-ink: #1a6b3f;
  --green-2: #e6f4ec;
  --on-yellow: #121212;
  --island-bg: #121212;  /* dark cards that stay dark in both themes */
  --shadow: rgb(0 0 0 / .08);
  --shadow-2: rgb(0 0 0 / .14);
  --radius-s: 10px;
  --radius: 14px;
  --radius-l: 20px;
  --radius-xl: 28px;
  --pill: 980px;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --serif: var(--sans);  /* one typeface everywhere */
  --chat: var(--sans);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #000000; --paper-2: #2c2c2e; --paper-3: #0e0e10; --white: #1c1c1e;
    --ink: #f5f5f7; --ink-2: #d1d1d6; --muted: #a1a1a6; --hair: #2c2c2e; --field: #6e6e73;
    --yellow-2: #3a3212; --amber-ink: #ffd21f; --red-ink: #ff6b5e; --red-2: #3a1714; --green-ink: #4cd98a; --green-2: #12301f;
    --island-bg: #1c1c1e; --shadow: rgb(0 0 0 / .5); --shadow-2: rgb(0 0 0 / .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #000000; --paper-2: #2c2c2e; --paper-3: #0e0e10; --white: #1c1c1e;
  --ink: #f5f5f7; --ink-2: #d1d1d6; --muted: #a1a1a6; --hair: #2c2c2e; --field: #6e6e73;
  --yellow-2: #3a3212; --amber-ink: #ffd21f; --red-ink: #ff6b5e; --red-2: #3a1714; --green-ink: #4cd98a; --green-2: #12301f;
  --island-bg: #1c1c1e; --shadow: rgb(0 0 0 / .5); --shadow-2: rgb(0 0 0 / .7);
  color-scheme: dark;
}

/* Islands keep their contrast in both themes. */
.island-dark {
  --paper: var(--island-bg); --paper-2: #2c2c2e; --white: #2c2c2e; --ink: #f5f5f7; --ink-2: #d1d1d6; --muted: #a1a1a6; --hair: #3a3a3c; --field: #6e6e73;
  --yellow-2: #3a3212; --amber-ink: #ffd21f; --red-ink: #ff6b5e; --red-2: #3a1714;
  background: var(--paper); color: var(--ink);
}
.island-yellow {
  --paper: #ffd21f; --paper-2: #f5c400; --white: #ffffff; --ink: #121212; --ink-2: #2a2a2c; --muted: #3a3000; --hair: rgb(18 18 18 / .2); --red-ink: #8a160f;
  background: var(--yellow); color: var(--ink);
}
.island-yellow a:hover, a[aria-current="page"]:hover { color: inherit; }

/* Theme switch: three icon buttons as a segmented control */
.theme-switch { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--pill); background: var(--paper-2); }
.theme-switch button { display: inline-grid; place-content: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: var(--pill); background: transparent; color: var(--ink-2); cursor: pointer; min-height: 0; }
.theme-switch button[aria-pressed="true"] { background: var(--white); color: var(--ink); box-shadow: 0 1px 3px var(--shadow-2); }
.theme-switch button:hover:not([aria-pressed="true"]) { background: transparent; color: var(--ink); }
.theme-switch svg { width: 17px; height: 17px; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.5 var(--sans); letter-spacing: -.011em; -webkit-font-smoothing: antialiased; }
::selection { background: var(--yellow); color: var(--on-yellow); }
a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink-2); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
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 { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--yellow); color: var(--on-yellow); padding: 10px 16px; border-radius: var(--pill); font-weight: 600; }
.skip:focus { left: 8px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.serif { font-family: var(--sans); }

/* ---------- Shell: light sidebar + work area ---------- */
.shell { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100dvh; background: linear-gradient(90deg, var(--paper-3) 255px, var(--hair) 255px 256px, transparent 256px); }
.rail { position: sticky; top: 0; height: 100dvh; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; padding: 20px 14px; background: var(--paper-3); border-right: 1px solid var(--hair); }
.wordmark { display: inline-flex; align-items: center; gap: 10px; padding: 4px 10px; font: 700 18px/1 var(--sans); letter-spacing: -.02em; color: var(--ink); text-decoration: none; }
.wordmark-mark { width: 28px; height: 28px; flex: none; border-radius: 7px; }
.wordmark:hover { color: var(--ink); }
.channel { padding: 12px 14px; border-radius: var(--radius); background: var(--white); border: 1px solid var(--hair); }
.channel strong { display: block; font-size: 15px; font-weight: 600; }
.channel-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; font-size: 13px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: 0 0 8px; }
.dot-live { color: #30c46c; box-shadow: 0 0 0 3px rgb(48 196 108 / .2); }
.dot-sim { color: var(--yellow); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font: 700 11px var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 12px 6px; }
.nav-label:first-child { margin-top: 0; }
.nav a { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; border-radius: var(--radius-s); color: var(--ink-2); text-decoration: none; font-size: 14px; font-weight: 500; }
.nav a > span:first-of-type { flex: 1; }
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav a:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); }
.nav a[aria-current="page"], .nav a[aria-current="page"]:hover { background: var(--ink); color: var(--paper); font-weight: 600; }
.nav a[aria-current="page"] svg { color: var(--yellow); }
:root[data-theme="dark"] .nav a[aria-current="page"] svg { color: var(--paper); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .nav a[aria-current="page"] svg { color: var(--paper); } }
.nav .count { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; padding: 1px 8px; border-radius: var(--pill); background: var(--yellow); color: var(--on-yellow); }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 14px; font-size: 13px; color: var(--muted); padding: 12px 8px 0; border-top: 1px solid var(--hair); }
.rail-foot .theme-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.legal { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.legal a { color: var(--muted); text-decoration: none; }
.legal a:hover { color: var(--ink); }

.work { min-width: 0; padding: 36px clamp(16px, 3.5vw, 56px) 72px; }
.work-in { max-width: 1160px; }
.topbar, .menu { display: none; }

/* ---------- Page head ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 32px; margin-bottom: 28px; }
.page-head h1 { font: 800 34px/1.1 var(--sans); letter-spacing: -.035em; }
.lede { margin-top: 8px; max-width: 64ch; font: 400 16px/1.5 var(--sans); color: var(--muted); }
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }

/* ---------- Buttons: pills ---------- */
.btn, button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border: 0; border-radius: var(--pill); background: var(--ink); color: var(--paper); font: 600 15px/1 var(--sans); letter-spacing: -.01em; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background-color .15s var(--ease-out), color .15s var(--ease-out), transform .15s var(--ease-out); }
.btn:hover, button:hover { background: color-mix(in srgb, var(--ink) 84%, var(--paper)); color: var(--paper); }
.btn:active, button:active { transform: scale(.98); }
.btn-line, .secondary, button.secondary, .btn.secondary { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); }
.btn-line:hover, .secondary:hover, button.secondary:hover, .btn.secondary:hover { background: color-mix(in srgb, var(--ink) 11%, transparent); color: var(--ink); }
.btn-quiet { background: transparent; color: var(--ink-2); }
.btn-quiet:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); }
.btn-yellow, .btn-red { background: var(--yellow); color: var(--on-yellow); }
.btn-yellow:hover, .btn-red:hover { background: #ffdb4d; color: var(--on-yellow); }
.btn-danger, button.danger, .btn.danger { background: var(--red-2); color: var(--red-ink); }
.btn-danger:hover, button.danger:hover, .btn.danger:hover { background: var(--red); color: #fff; }
.btn-sm, button.small, .btn.small { min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn-lg { min-height: 52px; padding: 0 28px; font-size: 17px; }
.btn[disabled], .btn[aria-disabled="true"], button[disabled] { opacity: .4; cursor: not-allowed; pointer-events: none; }
.btn svg { width: 16px; height: 16px; }

/* ---------- Cards ---------- */
.panel, .card { background: var(--white); border: 1px solid var(--hair); border-radius: var(--radius-l); padding: 22px 24px; }
.panel + .panel { margin-top: 16px; }
.card { margin-bottom: 16px; }
.grid-2 > .panel + .panel, .grid-main > .panel + .panel { margin-top: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; margin-bottom: 14px; }
.panel-head h2, .card h2 { font: 700 17px/1.3 var(--sans); letter-spacing: -.015em; }
.card h2 { margin: 0 0 14px; }
.panel-head .side { font-size: 13px; color: var(--muted); }
.panel-flush { padding: 0; overflow: hidden; }
.panel-flush .panel-head { padding: 20px 24px 6px; }
.panel-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 14px 24px; border-top: 1px solid var(--hair); font-size: 14px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.help { font: 400 15px/1.5 var(--sans); color: var(--muted); }
.card.form { max-width: 820px; }
.card > .panel, .panel > .panel { padding: 0; border: 0; border-radius: 0; background: none; }
.card.bad, .danger { border-color: color-mix(in srgb, var(--red) 35%, var(--hair)); }

/* ---------- Status chips ---------- */
.stamp, .mode, .badge { display: inline-flex; align-items: center; gap: 6px; font: 600 12px/1 var(--sans); padding: 5px 10px; border-radius: var(--pill); white-space: nowrap; border: 0; }
.stamp-act { background: var(--red-2); color: var(--red-ink); }
.stamp-test { background: var(--yellow-2); color: var(--amber-ink); }
.stamp-unsure { background: #121212; color: var(--yellow); }
.stamp-keep { background: transparent; color: var(--muted); padding-left: 0; }
.stamp-undone { background: var(--paper-2); color: var(--muted); text-decoration: line-through; }
.score { display: inline-flex; align-items: center; font: 600 12px/1 var(--sans); font-variant-numeric: tabular-nums; padding: 5px 8px; border-radius: var(--pill); background: var(--paper-2); color: var(--ink-2); }
.score-hit { background: var(--yellow); color: var(--on-yellow); }
.verdictline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mode-live { background: #121212; color: var(--yellow); box-shadow: inset 0 0 0 1px var(--hair); }
.mode-live .dot { color: #30c46c; }
.mode-test { background: var(--yellow-2); color: var(--amber-ink); }
.mode-off { background: var(--paper-2); color: var(--ink-2); }
.badge.ok { background: var(--green-2); color: var(--green-ink); }
.badge.warn { background: var(--yellow-2); color: var(--amber-ink); }
.badge.bad { background: var(--red-2); color: var(--red-ink); }
.badge.neutral { background: var(--paper-2); color: var(--ink-2); }

/* ---------- Forms ---------- */
label, .label { display: block; font: 600 14px var(--sans); margin: 18px 0 8px; }
label:first-child, .label:first-child { margin-top: 0; }
.hint { font-size: 13px; line-height: 1.45; color: var(--muted); margin-top: 6px; }
input[type="text"], input[type="search"], input[type="password"], input[type="number"], input[type="email"], input:not([type]), select, textarea { width: 100%; min-height: 48px; padding: 11px 14px; border: 1px solid color-mix(in srgb, var(--field) 70%, transparent); border-radius: 12px; background: var(--white); color: var(--ink); font: 400 16px/1.4 var(--sans); transition: border-color .15s var(--ease-out), box-shadow .15s var(--ease-out); }
select { appearance: none; -webkit-appearance: none; padding-right: 40px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
input::placeholder, textarea::placeholder { color: var(--muted); }
input:hover, select:hover, textarea:hover { border-color: var(--field); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px color-mix(in srgb, var(--yellow) 60%, transparent); }
textarea { resize: vertical; }
textarea.sentence, input.sentence { font: 400 18px/1.45 var(--sans); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 180px; min-width: 0; }
.row > button, .row > .btn, .row > form, .row > .tabs, .row > .theme-switch, .row > span, .row > a { flex: 0 0 auto; }
.row > .grow { flex: 1 1 220px; min-width: 0; }
.full { flex-basis: 100% !important; }
.field-error { border-color: var(--red-ink) !important; }
.error-text { color: var(--red-ink); font-size: 13px; font-weight: 600; margin-top: 6px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 0; font-weight: 500; cursor: pointer; }
label:has(> input[type="checkbox"]), label:has(> input[type="radio"]) { display: flex; align-items: center; gap: 10px; font-weight: 500; margin: 8px 0; cursor: pointer; }
input[type="checkbox"], input[type="radio"] { appearance: none; -webkit-appearance: none; margin: 0; flex: 0 0 22px; width: 22px; height: 22px; border: 1.5px solid var(--field); border-radius: 7px; background: var(--white); display: grid; place-content: center; cursor: pointer; transition: background-color .15s var(--ease-out), border-color .15s var(--ease-out); }
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]::before { content: ""; width: 10px; height: 6px; border: solid var(--paper); border-width: 0 0 2.5px 2.5px; transform: rotate(-45deg) scale(0); margin-top: -2px; transition: transform .12s var(--ease-out); }
input[type="radio"]::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--paper); transform: scale(0); transition: transform .12s var(--ease-out); }
input:checked { background: var(--ink); border-color: var(--ink); }
input:checked::before { transform: rotate(-45deg) scale(1); }
input[type="radio"]:checked::before { transform: scale(1); }
.choice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--hair); border-radius: var(--radius); background: var(--white); cursor: pointer; margin: 0 0 8px; font-weight: 400; transition: border-color .15s var(--ease-out), box-shadow .15s var(--ease-out); }
.choice:hover { border-color: var(--field); }
.choice:has(input:checked) { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.choice strong { display: block; font-weight: 600; }
.choice span span { display: block; font-size: 14px; color: var(--muted); }
.choice.is-locked { opacity: .55; cursor: not-allowed; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font: 600 14px var(--sans); padding: 0; margin-bottom: 10px; }
input[type="range"] { width: 100%; accent-color: var(--ink); height: 44px; }
input.narrow { width: 6.5em; }
.meter-bar { height: 10px; border-radius: var(--pill); background: var(--paper-2); overflow: hidden; }
.meter-bar span { display: block; height: 100%; width: 0; border-radius: var(--pill); background: var(--ink); transition: width .3s var(--ease-out); }
.panel-pad { padding: 14px 24px 0; }
.compare-table th[scope="row"] { font-weight: 600; text-align: left; }
.compare-table td.is-best { font-weight: 700; box-shadow: inset 3px 0 0 var(--yellow); }
td.is-ok { color: var(--muted); }
td.is-bad, tr.is-bad-row td:first-child strong { color: var(--red-ink); font-weight: 700; }
.bundle-summary { font: 700 20px/1.3 var(--sans); letter-spacing: -.02em; margin: 8px 0 4px; font-variant-numeric: tabular-nums; }
.category-list { list-style: none; padding: 0; margin: 0; }
.category-list li { margin: 0 0 12px; }
.category-list li span { display: block; font-size: 14px; color: var(--muted); }

/* Segmented control (links in production, they filter by query string) */
.tabs { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: var(--pill); background: var(--paper-2); }
.tabs a { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: var(--pill); text-decoration: none; font-weight: 500; font-size: 14px; color: var(--ink-2); }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="true"] { background: var(--white); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px var(--shadow-2); }
.tabs .n { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; position: relative; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font: 600 12px var(--sans); color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--hair); white-space: nowrap; }
td { padding: 13px 14px; border-bottom: 1px solid var(--hair); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--ink) 2.5%, transparent); }
.panel-flush table th:first-child, .panel-flush table td:first-child { padding-left: 24px; }
.panel-flush table th:last-child, .panel-flush table td:last-child { padding-right: 24px; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { text-align: right; white-space: nowrap; }
td .sub { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.rule-sentence { font: 400 15px/1.45 var(--sans); color: var(--muted); }
.msg-text { overflow-wrap: anywhere; }
.msg-text.is-deleted { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--red) 55%, transparent); }
.user { font-weight: 600; }
.time { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.note { display: block; font-size: 13px; margin-top: 6px; color: var(--muted); }
.note-ok { color: var(--ink-2); }

/* ---------- Feedback ---------- */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 18px; border-radius: var(--radius); margin-bottom: 20px; font-size: 15px; line-height: 1.45; background: var(--white); border: 1px solid var(--hair); }
.alert svg { flex: 0 0 18px; width: 18px; height: 18px; margin-top: 2px; }
.alert-warn, .alert.warn { background: var(--yellow-2); border-color: transparent; }
.alert-bad, .alert.bad { background: var(--red-2); border-color: transparent; color: var(--ink); }
.alert-bad svg, .alert.bad svg { color: var(--red-ink); }
.alert-info, .alert.info { background: var(--white); }
.alert.ok { background: var(--green-2); border-color: transparent; }
.alert.ok svg { color: var(--green-ink); }
.alert p + p { margin-top: 4px; }
.alert ul { margin: 6px 0 0; padding-left: 20px; }
.empty { padding: 40px 20px; text-align: center; }
.empty strong { display: block; font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.empty p { font: 400 15px/1.5 var(--sans); color: var(--muted); max-width: 46ch; margin: 0 auto 16px; }
.ok { color: var(--green-ink); } .warn { color: var(--amber-ink); } .bad { color: var(--red-ink); }

/* Quota meter */
svg.meter { display: block; width: 100%; height: 10px; margin: 14px 0 8px; border-radius: var(--pill); overflow: hidden; }
.meter .meter-track { fill: var(--paper-2); }
.meter .meter-fill { fill: var(--ink); }
.meter.warn .meter-fill { fill: var(--yellow); }
.meter.bad .meter-fill { fill: var(--red); }
.big { font: 800 30px/1.1 var(--sans); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }

/* Bar chart (one measure per chart) */
figure { margin: 0; }
.chart { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--paper-2); rx: 3px; }
.chart .bar.is-today { fill: var(--ink); }
.chart .grid { stroke: var(--hair); stroke-dasharray: 2 4; vector-effect: non-scaling-stroke; }
.chart .axis { stroke: var(--hair); vector-effect: non-scaling-stroke; }
.chart-axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 8px; font-variant-numeric: tabular-nums; }
.chart-scale { font-size: 12px; color: var(--muted); }
.chart .bar:hover { fill: var(--ink-2); }

/* ---------- Setup path (overview before go-live) ---------- */
.setup { list-style: none; margin: 0; padding: 6px 24px; background: var(--white); border: 1px solid var(--hair); border-radius: var(--radius-l); }
.station { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 4px 16px; padding: 18px 0; border-bottom: 1px solid var(--hair); }
.station:last-child { border-bottom: 0; }
.station-n { width: 32px; height: 32px; display: grid; place-content: center; border: 2px solid var(--hair); border-radius: 50%; font: 700 14px/1 var(--sans); color: var(--muted); }
.station.is-done .station-n { background: var(--ink); border-color: var(--ink); color: var(--yellow); }
.station.is-done .station-n svg { width: 16px; height: 16px; }
.station.is-current .station-n { border-color: var(--ink); color: var(--ink); }
.station h2 { font: 600 16px/1.35 var(--sans); padding-top: 5px; }
.station.is-done h2 { color: var(--muted); }
.station.is-current h2 { font-weight: 700; font-size: 18px; }
.station .summary { font-size: 14px; color: var(--muted); margin-top: 2px; }
.station-body { grid-column: 2; margin-top: 12px; }
.station.is-current { padding-bottom: 24px; }
.progress-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; padding: 12px 18px; border-radius: var(--radius); background: var(--white); border: 1px solid var(--hair); margin-bottom: 20px; font-size: 14px; }
.progress-strip .done { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.progress-strip svg { width: 16px; height: 16px; }

/* Summary sentence */
.sentence-summary { font: 400 19px/1.5 var(--sans); max-width: 64ch; color: var(--ink-2); }
.sentence-summary strong { font: 700 19px var(--sans); color: var(--ink); font-variant-numeric: tabular-nums; }

/* Verdict box (reports) */
.verdict { padding: 22px 24px; border-radius: var(--radius-l); }
.verdict .label-cap { font: 700 12px var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.verdict p { margin-top: 10px; font: 600 17px/1.45 var(--sans); }
.verdict dl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--hair); }
.verdict dt { font: 500 13px var(--sans); color: var(--muted); }
.verdict dd { margin: 4px 0 0; font: 800 26px/1.1 var(--sans); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }

/* Rule tester score bars */
.tester-row { display: grid; grid-template-columns: minmax(0, 1fr) 220px auto; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--hair); }
svg.scorebar { display: block; width: 100%; height: 10px; overflow: visible; }
.scorebar .track { fill: var(--paper-2); rx: 5px; }
.scorebar .fill { fill: var(--ink); rx: 5px; }
.scorebar .mark { fill: var(--red); }

/* ---------- Login and operator access (no session) ---------- */
.auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px; align-items: center; }
.auth h1 { font: 800 clamp(36px, 5vw, 48px)/1.05 var(--sans); letter-spacing: -.04em; }
.auth .lede { font-size: 18px; margin-top: 14px; }
.auth-choices { display: flex; flex-direction: column; gap: 12px; margin-top: 32px; }
.auth-choice { display: flex; align-items: center; gap: 16px; padding: 18px 20px; border-radius: var(--radius-l); background: var(--white); border: 1px solid var(--hair); color: var(--ink); text-decoration: none; transition: border-color .15s var(--ease-out), box-shadow .15s var(--ease-out), transform .15s var(--ease-out); }
.auth-choice:hover { color: var(--ink); border-color: var(--field); box-shadow: 0 8px 24px var(--shadow); }
.auth-choice:active { transform: scale(.99); }
.auth-choice-main { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.auth-choice-main:hover { color: var(--paper); border-color: var(--ink); background: color-mix(in srgb, var(--ink) 88%, var(--paper)); }
.auth-icon { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-content: center; background: var(--paper-2); color: var(--ink); }
.auth-choice-main .auth-icon { background: var(--yellow); color: var(--on-yellow); }
.auth-icon svg { width: 22px; height: 22px; }
.auth-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.auth-text strong { font-size: 17px; font-weight: 700; }
.auth-text span { font-size: 14px; line-height: 1.45; color: var(--muted); }
.auth-choice-main .auth-text span { color: color-mix(in srgb, var(--paper) 72%, var(--ink)); }
.auth-chevron { flex: none; width: 18px; height: 18px; opacity: .6; }
.auth-note { display: flex; gap: 10px; align-items: flex-start; margin-top: 22px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.auth-note svg { flex: none; width: 16px; height: 16px; margin-top: 2px; }
.auth-preview { display: grid; place-items: center; }
.operator-link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-size: 13px; color: var(--muted); text-decoration: none; }
.operator-link:hover { color: var(--ink); }
.operator-link svg { width: 14px; height: 14px; }
.operator { max-width: 440px; margin: 0 auto; text-align: center; }
.operator-badge { width: 64px; height: 64px; margin: 0 auto; border-radius: 18px; display: grid; place-content: center; background: var(--island-bg); color: var(--yellow); box-shadow: 0 10px 30px var(--shadow-2); }
.operator-badge svg { width: 30px; height: 30px; }
.operator h1 { margin-top: 22px; font: 800 34px/1.1 var(--sans); letter-spacing: -.035em; }
.operator .lede { margin: 10px auto 0; }
.operator .auth-note { justify-content: center; }
.operator .auth-note span { text-align: left; max-width: 36ch; }
.operator-card { margin-top: 28px; padding: 28px; border-radius: 24px; background: var(--white); border: 1px solid var(--hair); box-shadow: 0 16px 48px var(--shadow); text-align: left; }
.operator-card .btn { width: 100%; min-height: 52px; font-size: 16px; }
.operator-sep { display: flex; align-items: center; gap: 12px; margin: 24px 0; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.operator-sep::before, .operator-sep::after { content: ""; flex: 1; height: 1px; background: var(--hair); }
.operator-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.operator-actions .btn { min-height: 48px; font-size: 15px; }

/* Chat preview (follows the theme) */
.twchat { --tw-bg: var(--white); --tw-fg: var(--ink); --tw-muted: var(--muted); --tw-line: var(--hair); width: min(100%, 420px); background: var(--tw-bg); color: var(--tw-fg); font: 400 15px/1.45 var(--sans); border: 1px solid var(--hair); border-radius: 24px; box-shadow: 0 24px 64px var(--shadow); overflow: hidden; }
.twchat-head { margin: 0; padding: 14px 20px; border-bottom: 1px solid var(--tw-line); font-size: 13px; font-weight: 600; line-height: 20px; color: var(--tw-muted); }
.twchat ol { list-style: none; margin: 0; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.twchat li { padding: 9px 12px; border-radius: 12px; overflow-wrap: anywhere; }
.twchat li:has(.del) { background: var(--red-2); }
.twchat li:has(.badge-mod) { background: var(--paper); margin-left: 20px; font-size: 14px; }
.twchat b { font-weight: 700; }
.twchat .del { color: var(--tw-muted); text-decoration: line-through; }
.twchat .reply { color: var(--tw-muted); font-size: 12px; }
.twchat .badge-mod { display: inline-block; width: 18px; height: 18px; border-radius: 5px; background: var(--yellow); vertical-align: -4px; margin-right: 6px; }
.twchat .c1 { color: #c4500f; } .twchat .c2 { color: #1f6fd1; } .twchat .c3 { color: #1f8a52; } .twchat .c4 { color: #8a6d00; }
:root[data-theme="dark"] .twchat .c1 { color: #ff9f6b; } :root[data-theme="dark"] .twchat .c2 { color: #6fb0ff; } :root[data-theme="dark"] .twchat .c3 { color: #4cd98a; } :root[data-theme="dark"] .twchat .c4 { color: #e8c547; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .twchat .c1 { color: #ff9f6b; } :root:not([data-theme="light"]) .twchat .c2 { color: #6fb0ff; }
  :root:not([data-theme="light"]) .twchat .c3 { color: #4cd98a; } :root:not([data-theme="light"]) .twchat .c4 { color: #e8c547; }
}

/* Simulator chat */
.twchat-sim { width: 100%; align-self: stretch; box-shadow: none; }
.tw-feed { padding: 10px; max-height: 70vh; overflow-y: auto; background: var(--paper-3); }
.tw-line { padding: 8px 12px; border-radius: 12px; overflow-wrap: anywhere; }
.tw-empty { color: var(--tw-muted); text-align: center; padding: 40px 0; }
.tw-time { color: var(--tw-muted); font-size: 11px; margin-right: 6px; font-variant-numeric: tabular-nums; }
.tw-role { display: inline-block; font-size: 10px; font-weight: 700; padding: 1px 6px; margin-right: 6px; border-radius: var(--pill); background: var(--paper-2); color: var(--ink-2); vertical-align: 1px; }
.tw-notes { display: inline-flex; gap: 6px; margin-left: 8px; vertical-align: 1px; }
.tw-notes .stamp, .tw-notes .score { font-size: 11px; padding: 3px 8px; }
.tw-mod { color: var(--tw-muted); font-style: italic; }

/* Log tables: give the message room, stack the row actions */
.log-table td:nth-child(2) { min-width: 220px; }
.log-table td.actions .stack-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.log-table td.actions form { display: block; }
.panel.island-yellow { background: var(--yellow); border-color: var(--yellow); }
.panel.island-dark { border-color: var(--island-bg); }
.station-body > .help { margin-top: 10px; }
.panel .grid-2 { margin-top: 18px; }
.panel .grid-2 label:first-child { margin-top: 0; }

/* Spacing and small helpers */
.mt { margin-top: 24px; }
.mt-s { margin-top: 16px; }
.sentence-summary + .grid-main { margin-top: 24px; }
.grid-main + .grid-2 { margin-top: 16px; }
.inline { display: inline; }
.checks { list-style: none; margin: 12px 0 16px; padding: 0; display: grid; gap: 8px; }
.checks li { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.checks svg { width: 16px; height: 16px; }
.mistakes { margin: 8px 0 0; padding-left: 20px; color: var(--ink-2); }
.review { border-top: 1px solid var(--hair); padding-top: 14px; margin-top: 14px; }
.review .row { margin-top: 10px; }
details.hint summary { cursor: pointer; min-height: 44px; display: inline-flex; align-items: center; }
tr.island-yellow th, tr.island-yellow td { background: var(--yellow); }
tr.island-yellow .stamp { margin-left: 8px; }
.actions:not(td) { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 20px; }
.page-head .actions { margin-top: 0; }
.chat-line { padding: 4px 0; }
.log-table .btn-line.btn-sm { min-width: 0; }

/* Admin stat tiles */
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 16px; }
.stat { background: var(--white); border: 1px solid var(--hair); border-radius: var(--radius-l); padding: 18px 20px; }
.stat-label { font-size: 13px; color: var(--muted); }
.stat-value { font: 800 30px/1.15 var(--sans); letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin-top: 6px; }
.stat-hint { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* Pages without a session (login, operator, legal, terms, errors) */
.public { max-width: 1080px; margin: 0 auto; padding: 24px 20px 48px; min-height: 100dvh; display: flex; flex-direction: column; }
.public > .public-body { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 32px 0; }
.public:has(.prose), .public:has(.narrow-page) { max-width: 860px; }
.public-brand { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0; }
.public .wordmark { padding: 0; }
.prose h2 { font: 700 19px/1.3 var(--sans); letter-spacing: -.015em; margin: 32px 0 8px; }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose li { max-width: 72ch; color: var(--ink-2); font: 400 16px/1.6 var(--sans); }
.prose ul { padding-left: 20px; margin: 0 0 12px; }
.prose li { margin-bottom: 6px; }
.prose p { margin-bottom: 12px; }
.prose table { font-size: 13px; }
footer.legal { font-size: 13px; color: var(--muted); padding-top: 20px; border-top: 1px solid var(--hair); display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
footer.legal a { color: inherit; text-decoration: none; min-height: 32px; display: inline-flex; align-items: center; }
footer.legal a:hover { color: var(--ink); }
footer.legal .theme-row { display: inline-flex; align-items: center; gap: 10px; margin-left: auto; }
.lang-switch { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.lang-switch span, .lang-switch a { min-height: 32px; display: inline-flex; align-items: center; }
.lang-switch span { color: var(--ink); font-weight: 700; }
.lang-switch a { text-decoration: none; color: var(--muted); }
.lang-switch a:hover { color: var(--ink); }

/* Mods: channel switcher, channel cards, permissions */
.login-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 20px; }
.login-choice .btn { width: 100%; }
.switcher label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 6px 6px; }
.switcher .row { flex-wrap: nowrap; gap: 6px; }
.switcher select { min-height: 40px; min-width: 0; font-size: 14px; font-weight: 600; }
.channel-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.channel-cards > .panel + .panel { margin-top: 0; }
.channel-card-status { align-items: center; gap: 8px; }
.perm-form { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; }
.perm-checks { display: flex; flex-wrap: wrap; gap: 0 16px; }
.audit-list { list-style: none; margin: 0; padding: 0; }
.audit-list li { padding: 10px 0; border-bottom: 1px solid var(--hair); font-size: 14px; }
.audit-list li:last-child { border-bottom: 0; }

/* ---------- Narrow screens: sidebar becomes a top bar with a menu ---------- */
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); background: none; }
  .rail { display: none; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 20; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: color-mix(in srgb, var(--paper-3) 82%, transparent); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--hair); }
  .topbar .wordmark { padding: 0; }
  .menu { display: block; }
  .menu > summary { list-style: none; cursor: pointer; min-height: 44px; display: inline-flex; align-items: center; gap: 8px; padding: 0 16px; border-radius: var(--pill); background: color-mix(in srgb, var(--ink) 6%, transparent); font-weight: 600; }
  .menu > summary::-webkit-details-marker { display: none; }
  .menu[open] > summary { background: var(--ink); color: var(--paper); }
  .menu-panel { position: fixed; left: 0; right: 0; top: 65px; max-height: calc(100dvh - 65px); overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 18px; background: var(--paper-3); border-bottom: 1px solid var(--hair); box-shadow: 0 24px 40px -20px var(--shadow-2); }
  .menu-panel .nav a { min-height: 48px; font-size: 16px; }
  .work { padding: 24px 16px 56px; }
  .grid-main, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .page-head h1 { font-size: 28px; }
  .auth { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .auth-preview { display: none; }
  .login-choice { grid-template-columns: minmax(0, 1fr); }
  .tester-row { grid-template-columns: minmax(0, 1fr) auto; }
  .tester-row .scorebar { grid-column: 1 / -1; grid-row: 2; }
  .verdict dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  /* Log and lists: rows become stacked records */
  .stack-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .stack-table, .stack-table tbody, .stack-table tr, .stack-table td { display: block; }
  .stack-table tr { padding: 14px 16px; border-bottom: 1px solid var(--hair); }
  .stack-table td { border: 0; padding: 3px 0 !important; }
  .stack-table td.actions { text-align: left; padding-top: 10px !important; }
  .log-table td:nth-child(2) { min-width: 0; width: auto; }
  .log-table td.actions .stack-actions { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .stack-table td[data-label]::before { content: attr(data-label) ": "; font-size: 12px; font-weight: 600; color: var(--muted); }
  .sentence-summary { font-size: 17px; }
  .panel, .card { padding: 18px; }
  .panel-flush { padding: 0; }
  .panel-flush .panel-head { padding: 18px 18px 4px; }
  .panel-foot { padding: 12px 18px; }
  .setup { padding: 4px 18px; }
  .operator-card { padding: 22px; }
  .operator-actions { grid-template-columns: minmax(0, 1fr); }
  footer.legal .theme-row { margin-left: 0; }
}
/* ---------- Busy: slow form posts (busy.ts) ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes busy-bar { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.btn.is-busy { opacity: 1; }
.btn.is-busy::before { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
.busy-note { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; margin-top: 10px; font-size: 14px; color: var(--ink-2); }
.busy-time { color: var(--muted); font-variant-numeric: tabular-nums; }
body.is-busy::before { content: ""; position: fixed; top: 0; left: 0; z-index: 100; width: 40%; height: 3px; border-radius: var(--pill); background: var(--yellow); animation: busy-bar 1.2s var(--ease-out) infinite; }
body.is-busy { cursor: progress; }
/* ---------- Info: short lead, details on demand ---------- */
details.info { margin: 0 0 20px; border: 1px solid var(--hair); border-radius: var(--radius); background: var(--white); }
details.info > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 16px; font-weight: 600; font-size: 14px; list-style: none; }
details.info > summary::-webkit-details-marker { display: none; }
details.info > summary::before { content: "i"; display: grid; place-content: center; width: 20px; height: 20px; border-radius: 50%; background: var(--paper-2); color: var(--ink); font: 700 12px/1 var(--sans); }
details.info > div { padding: 0 16px 14px; font-size: 14px; color: var(--ink-2); }
details.info ul { margin: 0; padding-left: 18px; }
details.info li + li { margin-top: 6px; }
details.more { margin-top: 12px; }
details.more > summary { cursor: pointer; min-height: 44px; display: inline-flex; align-items: center; font-weight: 600; font-size: 14px; list-style: none; }
details.more > summary::before { content: "›"; display: inline-block; width: 16px; font-size: 18px; transition: transform .15s var(--ease-out); }
details.more[open] > summary::before { transform: rotate(90deg); }
details.more > summary::-webkit-details-marker { display: none; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
