/* Corey Mathie, 2026 — Secure Voice Agent console. Warm cream and green, the repo's colors since 0.4.0. */
:root {
  --bg: #F3EEE4;
  --surface: #FBF8F2;
  --surface-2: #EFE8DB;
  --surface-3: #E7DECD;
  --white: #FFFFFF;
  --ink: #1F2A24;
  --ink-2: #4A554E;
  --ink-3: #5F6861;
  --line: #DED5C4;
  --line-2: #CFC4B0;
  --accent: #0F6B4F;
  --accent-2: #0B5640;
  --accent-ink: #FFFFFF;
  --accent-soft: #DCEBE3;
  --warm: #A8461F;
  --warm-soft: #F6E1D6;
  --amber: #7E5200;
  --amber-soft: #F5E8C8;
  --indigo: #3A4A8C;
  --indigo-soft: #E4E7F5;
  --muted-soft: #E9E4DA;
  /* chart roles (validated categorical slots 1–5 on this surface; see demo/charts.js) */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --grid: #E6DECF;
  --axis: #CFC4B0;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(31, 42, 36, .06), 0 4px 16px rgba(31, 42, 36, .06);
  --nav-w: 232px;
  --top-h: 60px;
  --tip-bg: #1F2A24;
  --mark-bg: #CFE6DA;
  --bar-track: #D8E7DF;
  --scrim: rgba(31, 42, 36, .28);
  color-scheme: light;
}
/* Dark theme: follows the system unless the theme button picked one. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12171A; --surface: #182024; --surface-2: #1F292E; --surface-3: #283338; --white: #1B2428;
    --ink: #E8EDEA; --ink-2: #BAC5BF; --ink-3: #93A09A; --line: #2B373D; --line-2: #3A4850;
    --accent: #4CC29A; --accent-2: #6AD3AE; --accent-ink: #0C1714; --accent-soft: #173A2F;
    --warm: #F08A5D; --warm-soft: #3D2419; --amber: #E8B44D; --amber-soft: #3A2E12; --indigo: #9AA8F2; --indigo-soft: #232A4A; --muted-soft: #263035;
    --grid: #26323A; --axis: #3A4850; --tip-bg: #0B0F11; --mark-bg: #1E4A3B; --bar-track: #20352D; --scrim: rgba(0, 0, 0, .5);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12171A; --surface: #182024; --surface-2: #1F292E; --surface-3: #283338; --white: #1B2428;
  --ink: #E8EDEA; --ink-2: #BAC5BF; --ink-3: #93A09A; --line: #2B373D; --line-2: #3A4850;
  --accent: #4CC29A; --accent-2: #6AD3AE; --accent-ink: #0C1714; --accent-soft: #173A2F;
  --warm: #F08A5D; --warm-soft: #3D2419; --amber: #E8B44D; --amber-soft: #3A2E12; --indigo: #9AA8F2; --indigo-soft: #232A4A; --muted-soft: #263035;
  --grid: #26323A; --axis: #3A4850; --tip-bg: #0B0F11; --mark-bg: #1E4A3B; --bar-track: #20352D; --scrim: rgba(0, 0, 0, .5);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: var(--accent); }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.005em; }
h1 { font-size: clamp(22px, 3vw, 28px); line-height: 1.2; }
h2 { font-size: 17px; line-height: 1.3; }
h3 { font-size: 14px; line-height: 1.3; }
p { margin: 0; }
code, pre, .mono { font-family: var(--mono); }
code { font-size: .92em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.eyebrow { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); font-weight: 700; margin: 0 0 4px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.spacer { flex: 1 1 auto; }
[hidden] { display: none !important; }

/* ---------- controls ---------- */
button, select, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); padding: 7px 12px; font-weight: 600; font-size: 13px; line-height: 1.3; }
button:hover:not(:disabled) { border-color: var(--accent); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.primary:hover:not(:disabled) { background: var(--accent-2); }
button.warn { color: var(--warm); border-color: var(--warm); background: var(--surface); }
button.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
button.ghost:hover:not(:disabled) { background: var(--surface-2); border-color: transparent; }
button.sm { padding: 4px 9px; font-size: 12px; }
button:disabled { opacity: .5; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input, select, textarea { border: 1px solid var(--line-2); background: var(--white); border-radius: 8px; padding: 7px 9px; font-size: 14px; width: 100%; min-width: 0; }
textarea { resize: vertical; }
label { display: block; font-size: 12px; color: var(--ink-2); font-weight: 600; margin: 10px 0 4px; }
label .opt { font-weight: 400; color: var(--ink-3); }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; font-size: 13px; color: var(--ink-2); margin: 10px 0 0; }
.check input { width: auto; margin: 3px 0 0; flex: none; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > * { flex: none; }
.row > p, .row > .hint { flex: 1 1 240px; min-width: 0; }
.row > h3 { flex: 0 1 auto; min-width: 0; }
.row.fill > input, .row.fill > textarea { flex: 1 1 200px; width: auto; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: var(--surface); }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

/* ---------- shell ---------- */
.topbar { position: sticky; top: 0; z-index: 30; height: var(--top-h); display: flex; align-items: center; gap: 12px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand span { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; overflow: hidden; }
.brand b { overflow: hidden; text-overflow: ellipsis; }
.brand b { font-size: 15px; white-space: nowrap; }
.brand small { font-size: 12px; color: var(--ink-3); }
.logo { width: 30px; height: 30px; flex: none; }
.logo rect { fill: var(--accent); }
.logo path { fill: var(--bg); }
.logo .logo-wave { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; min-width: 0; }
.mode-badge { font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 999px; background: var(--amber-soft); color: var(--amber); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42vw; }
.mode-badge .short { display: none; }
@media (max-width: 560px) { .mode-badge .long { display: none; } .mode-badge .short { display: inline; } }
.mode-badge.demo { background: var(--accent-soft); color: var(--accent); }
.mode-badge.live { background: var(--indigo-soft); color: var(--indigo); }
.mode-badge.error { background: var(--warm-soft); color: var(--warm); }
.policy-chip { font-family: var(--mono); font-size: 12px; color: var(--ink-2); background: var(--surface-2); padding: 4px 8px; border-radius: 6px; white-space: nowrap; }
.policy-chip.modified { background: var(--amber-soft); color: var(--amber); }
.repo-link { font-weight: 600; font-size: 13px; text-decoration: none; border: 1px solid var(--accent); padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.repo-link:hover { background: var(--accent); color: var(--accent-ink); }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border-radius: 8px; background: transparent; border: 1px solid transparent; }
.icon-btn:hover:not(:disabled) { background: var(--surface-2); border-color: transparent; }
.icon-btn svg, .menu-btn svg { width: 20px; height: 20px; fill: none; stroke: var(--ink-2); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.menu-btn { display: none; width: 38px; height: 38px; padding: 0; place-items: center; background: transparent; border-color: var(--line); }

.shell { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); min-height: calc(100vh - var(--top-h)); }
.sidenav { position: sticky; top: var(--top-h); align-self: start; height: calc(100vh - var(--top-h)); background: var(--surface); border-right: 1px solid var(--line); padding: 14px 10px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }
.sidenav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.sidenav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: 14px; }
.sidenav a svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sidenav a:hover { background: var(--surface-2); color: var(--ink); }
.sidenav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.nav-note { margin-top: auto; font-size: 12px; color: var(--ink-2); background: var(--surface-2); border-radius: 8px; padding: 10px; display: grid; gap: 6px; }
.view { padding: 24px clamp(16px, 3vw, 32px) 64px; min-width: 0; outline: none; }
.view > * + * { margin-top: 16px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: inline-grid; }
  .sidenav { position: fixed; top: var(--top-h); left: 0; right: 0; height: auto; max-height: calc(100vh - var(--top-h)); z-index: 25; border-right: 0; border-bottom: 1px solid var(--line); box-shadow: var(--shadow); transform: translateY(-120%); transition: transform .18s ease; visibility: hidden; }
  .sidenav.open { transform: none; visibility: visible; }
  .repo-link, .policy-chip { display: none; }
  .view { padding-top: 18px; }
}
@media (max-width: 480px) {
  .brand small { display: none; }
  .brand > span { display: none; }
  .topbar { gap: 8px; padding: 0 12px; }
  .mode-badge { max-width: 46vw; }
}

/* ---------- page heading, cards, tiles ---------- */
.page-head { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-end; justify-content: space-between; }
.page-head .lede { color: var(--ink-2); margin-top: 6px; max-width: 70ch; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head p { width: 100%; }
.hint { color: var(--ink-3); font-size: 13px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) { .grid.two, .grid.three { grid-template-columns: minmax(0, 1fr); } }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
/* balanced rows instead of a lone tile on the last row: 8 tiles as 4 + 4, 7 as one row or 4 + 3, 5 as one row */
.tiles:has(> :nth-child(8):last-child), .tiles:has(> :nth-child(7):last-child) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (min-width: 1340px) { .tiles:has(> :nth-child(7):last-child) { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
@media (min-width: 700px) { .tiles:has(> :nth-child(5):last-child) { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (max-width: 560px) {
  .tiles, .tiles:has(> :nth-child(8):last-child), .tiles:has(> :nth-child(7):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.tile .k { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.tile .v { font-size: 26px; font-weight: 700; line-height: 1.15; margin-top: 4px; }
.tile .v small { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.tile .v .nw { white-space: nowrap; }
.tile .s { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.tile.measured { border-top: 3px solid var(--accent); }
.tile.sim { border-top: 3px solid var(--line-2); }
.tag { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; background: var(--muted-soft); color: var(--ink-2); white-space: nowrap; }
.tag.measured { background: var(--accent-soft); color: var(--accent); }
.tag.sim { background: var(--surface-3); color: var(--ink-2); }
.tag.live { background: var(--indigo-soft); color: var(--indigo); }
.callout { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; font-size: 13px; color: var(--ink-2); }
.callout.warn { background: var(--amber-soft); color: var(--amber); }
.callout.bad { background: var(--warm-soft); color: var(--warm); }
.callout.ok { background: var(--accent-soft); color: var(--accent); }
.empty { color: var(--ink-3); font-size: 14px; text-align: center; padding: 28px 12px; border: 1px dashed var(--line-2); border-radius: 10px; background: var(--surface); }
.empty b { display: block; color: var(--ink-2); margin-bottom: 4px; }
.error-box { border: 1px solid var(--warm); background: var(--warm-soft); color: var(--warm); border-radius: 10px; padding: 14px 16px; }
.loading { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 14px; padding: 24px 4px; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } .sidenav { transition: none; } }

.boot { max-width: 560px; margin: 8vh auto; text-align: center; display: grid; justify-items: center; gap: 12px; }
.boot .spinner { width: 28px; height: 28px; border-width: 3px; }
.boot-steps { text-align: left; color: var(--ink-2); font-size: 14px; margin: 0; padding-left: 20px; }
.boot-steps li.done { color: var(--ink-3); }
.boot.error .spinner { display: none; }

/* ---------- badges for outcomes ---------- */
.badge { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; white-space: nowrap; }
.b-allowed { background: var(--accent-soft); color: var(--accent); }
.b-blocked { background: var(--warm-soft); color: var(--warm); }
.b-handoff { background: var(--amber-soft); color: var(--amber); }
.b-step_up { background: var(--indigo-soft); color: var(--indigo); }
.b-rejected { background: var(--muted-soft); color: var(--ink-2); }
.b-error { background: #2b2b2b; color: #fff; }
.tier { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 7px; border-radius: 999px; background: var(--muted-soft); color: var(--ink-2); white-space: nowrap; }
.tier.high { background: var(--warm-soft); color: var(--warm); }
.tier.medium { background: var(--amber-soft); color: var(--amber); }
.tier.low { background: var(--accent-soft); color: var(--accent); }
.tier.none { background: #2b2b2b; color: #fff; }
.chips { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.chip { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--warm-soft); color: var(--warm); white-space: nowrap; }
.chip.none { background: var(--muted-soft); color: var(--ink-3); font-weight: 500; }
.chip.ok { background: var(--accent-soft); color: var(--accent); }
.chip.neutral { background: var(--surface-2); color: var(--ink-2); }
.pill { font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; background: var(--muted-soft); color: var(--ink-2); white-space: nowrap; }
.pill.ok { background: var(--accent-soft); color: var(--accent); }
.pill.bad { background: var(--warm-soft); color: var(--warm); }
.pill.warn { background: var(--amber-soft); color: var(--amber); }
.statuses { display: inline-flex; flex-wrap: wrap; gap: 3px; align-items: center; font-family: var(--mono); font-size: 12px; }
.statuses .arrow { color: var(--ink-3); }
.ok-mark { color: var(--accent); font-weight: 800; }
.bad-mark { color: var(--warm); font-weight: 800; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--white); max-width: 100%; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { background: var(--surface-2); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
td.mono { white-space: nowrap; }
td.mono.wrap { white-space: normal; }
.drawer td.mono.wrap { overflow-wrap: anywhere; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.click { cursor: pointer; }
tr.click:hover td, tr.click:focus-visible td { background: var(--surface); }
tr.sel td { background: var(--amber-soft) !important; }
tr.broken td { background: var(--warm-soft) !important; }
td .sub { display: block; color: var(--ink-3); font-size: 12px; }
td .src { display: block; margin-top: 6px; }
td.wrap { overflow-wrap: break-word; word-break: normal; }
.show-sm { display: none !important; }
@media (max-width: 640px) { .hide-sm { display: none; } .show-sm { display: block !important; } }

/* ---------- filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.filters > div { min-width: 0; }
.filters label { margin-top: 0; }
.filters .grow { flex: 1 1 220px; }
.filters select { width: auto; min-width: 150px; }
@media (max-width: 480px) { .filters > div { flex: 1 1 100%; } .filters select { width: 100%; } }

/* ---------- overview ---------- */
.try { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 1200px) { .try { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .try { grid-template-columns: minmax(0, 1fr); } }
.try-card { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.try-card p { font-size: 13px; color: var(--ink-2); }
.try-card button { margin-top: auto; align-self: flex-start; }

/* ---------- charts ---------- */
.viz { position: relative; }
.viz svg { display: block; width: 100%; height: auto; overflow: visible; }
.viz text { font-family: var(--sans); font-size: 12px; fill: var(--ink-2); }
.viz .val { fill: var(--ink); font-weight: 600; }
.viz .gridline { stroke: var(--grid); stroke-width: 1; }
.viz .baseline { stroke: var(--axis); stroke-width: 1; }
.viz .mark { cursor: default; transition: opacity .12s; }
.viz .mark:hover, .viz .mark:focus { opacity: .82; outline: none; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--ink-2); margin: 4px 0 10px; padding: 0; list-style: none; }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.viz-tip { position: fixed; z-index: 90; pointer-events: none; background: var(--tip-bg); color: #fff; border-radius: 8px; padding: 7px 10px; font-size: 12px; line-height: 1.35; box-shadow: var(--shadow); max-width: 260px; }
.viz-tip b { font-size: 14px; display: block; }
.viz-tip .k { display: inline-block; width: 12px; height: 2px; margin-right: 6px; vertical-align: middle; }
details.table-view { margin-top: 8px; }
details.table-view summary { cursor: pointer; font-size: 12px; color: var(--ink-3); }
details.table-view .table-wrap { margin-top: 8px; }
details.table-view th { white-space: normal; letter-spacing: 0; }
details.table-view table { font-size: 12px; }
details.table-view th, details.table-view td { padding: 6px; }
@media (max-width: 480px) { th, td { padding: 8px; } }

/* ---------- playground ---------- */
.tabs { display: flex; flex: none; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: thin; }
.tabs a, .tabs button { padding: 9px 12px; font-weight: 600; font-size: 14px; color: var(--ink-2); text-decoration: none; border: 0; background: none; border-bottom: 2px solid transparent; border-radius: 0; white-space: nowrap; margin-bottom: -1px; }
.tabs a[aria-selected="true"], .tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.play { display: grid; grid-template-columns: 280px minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 1440px) { .play { grid-template-columns: minmax(0, 1fr) 300px; } .play .setup { grid-column: 1 / -1; } }
@media (max-width: 900px) { .play { grid-template-columns: minmax(0, 1fr); } .play .chat-card { order: -1; } }
.setup .fields { display: grid; grid-template-columns: 1fr; gap: 0 10px; }
@media (max-width: 1440px) { .setup .fields { grid-template-columns: repeat(4, minmax(0, 1fr)); } .setup .checks { display: flex; flex-wrap: wrap; gap: 0 18px; } }
@media (max-width: 1100px) { .setup .fields { grid-template-columns: 1fr 1fr; } }
@media (max-width: 420px) { .setup .fields { grid-template-columns: 1fr; } }
.idrow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 0; }
.idrow div { background: var(--surface-2); border-radius: 8px; padding: 6px 10px; font-size: 12px; color: var(--ink-2); min-width: 0; }
.idrow b { display: block; font-family: var(--mono); font-size: 13px; color: var(--ink); overflow-wrap: anywhere; }
.chat-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface); }
.chat-head .clock { font-family: var(--mono); font-weight: 700; font-size: 13px; }
.chat-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.chat { display: flex; flex-direction: column; gap: 10px; padding: 14px; min-height: 360px; max-height: 68vh; overflow-y: auto; background: var(--bg); }
.msg { max-width: 82%; padding: 9px 12px; border-radius: 12px; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.msg .who { display: block; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 2px; }
.msg.caller { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.msg.caller .who { color: rgba(255, 255, 255, .8); }
.msg.caller .chips { display: flex; margin-top: 6px; }
.msg.caller .chip { background: rgba(255, 255, 255, .92); }
.msg.caller.dropped { background: var(--surface-3); color: var(--ink-2); }
.msg.caller.dropped .who { color: var(--ink-3); }
.msg.agent { align-self: flex-start; background: var(--white); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.system { align-self: center; max-width: 92%; background: transparent; color: var(--ink-3); font-size: 12px; text-align: center; padding: 2px 8px; }
.msg.start { align-self: stretch; max-width: none; background: var(--surface); border: 1px dashed var(--line-2); font-size: 13px; }
.msg.start .quote { font-size: 14px; color: var(--ink); margin: 4px 0; }
.toolcard { align-self: stretch; background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.toolcard .head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolcard .tool { font-family: var(--mono); font-weight: 700; font-size: 13px; overflow-wrap: anywhere; }
.toolcard .when { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.toolcard .why { color: var(--ink-3); font-size: 12px; margin-top: 3px; }
.toolcard.mismatch { border-color: var(--warm); }
.stages { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0 4px; align-items: center; }
.stage { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); white-space: nowrap; }
.stage b { font-weight: 700; }
.stage.s-allow, .stage.s-clean, .stage.s-ok, .stage.s-verified { border-color: #A9CDBB; }
.stage.s-deny, .stage.s-rejected, .stage.s-locked, .stage.s-error { border-color: var(--warm); color: var(--warm); }
.stage.s-handoff { border-color: #D2AE62; color: var(--amber); }
.stage.s-scrubbed { border-color: var(--accent); background: var(--accent-soft); }
.stage.s-step_up { border-color: #8E9AD0; color: var(--indigo); }
.stages .arrow { color: var(--ink-3); font-size: 12px; }
.reason { font-size: 12px; color: var(--ink-2); margin-top: 4px; overflow-wrap: anywhere; }
details.more summary { cursor: pointer; font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
@media (max-width: 640px) { .two { grid-template-columns: 1fr; } }
.box h4 { margin: 0 0 3px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
pre { margin: 0; font-family: var(--mono); font-size: 12px; line-height: 1.45; background: var(--surface-2); border-radius: 6px; padding: 8px; white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; max-height: 320px; overflow: auto; }
mark { background: var(--mark-bg); color: var(--accent); border-radius: 3px; padding: 0 2px; font-weight: 700; }
.proposals { align-self: stretch; border: 1px dashed var(--indigo); background: var(--indigo-soft); border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.proposals .prop { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; }
.proposals textarea { font-family: var(--mono); font-size: 12px; min-height: 60px; flex: 1 1 100%; }
.composer { border-top: 1px solid var(--line); padding: 12px 14px; background: var(--surface); display: grid; gap: 8px; }
.composer form { display: flex; gap: 8px; }
.composer form input { flex: 1 1 auto; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.quick button { font-weight: 500; font-size: 12px; padding: 5px 9px; background: var(--white); }
.side > .card + .card { margin-top: 16px; }
.play + .card { margin-top: 16px; }
.meters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.meter { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; min-width: 0; }
.meter .k { font-size: 12px; color: var(--ink-2); }
.meter .v { font-size: 17px; font-weight: 700; }
.meter .v small { font-size: 12px; color: var(--ink-3); font-weight: 500; }
.bar { height: 6px; background: var(--bar-track); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .3s ease; }
.bar.hot { background: var(--warm-soft); }
.bar.hot i { background: var(--warm); }
.inbox { border: 1px dashed var(--line-2); border-radius: 8px; padding: 8px 10px; font-size: 13px; background: var(--white); min-height: 40px; display: grid; gap: 6px; }
.inbox .sms { font-family: var(--mono); font-size: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inbox .sms b { font-size: 15px; letter-spacing: .08em; }
.inbox .sms button { font-family: var(--sans); }
.scen-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.scen { display: flex; flex-direction: column; gap: 8px; }
.scen p { font-size: 13px; color: var(--ink-2); }
.scen .result { font-size: 12px; }
.scen .foot { margin-top: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- drawer ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100vw); z-index: 50; }
.drawer-panel { height: 100%; background: var(--surface); border-left: 1px solid var(--line); box-shadow: -8px 0 32px rgba(31, 42, 36, .12); display: flex; flex-direction: column; }
.drawer-head { display: flex; align-items: flex-start; gap: 12px; justify-content: space-between; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { overflow-wrap: anywhere; }
.drawer-body { padding: 14px 18px 40px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; flex: 1 1 auto; min-height: 0; }
.drawer-body > * { flex: none; min-width: 0; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--ink-2); }
.meta b { color: var(--ink); font-weight: 600; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.timeline > li { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; }
.timeline .t { font-family: var(--mono); font-size: 12px; color: var(--ink-3); padding-top: 3px; }
.steps { list-style: none; margin: 8px 0 0; padding: 0 0 0 12px; border-left: 2px solid var(--line); display: grid; gap: 6px; }
.steps li { position: relative; font-size: 12px; color: var(--ink-2); padding-left: 6px; overflow-wrap: anywhere; }
.steps li::before { content: ""; position: absolute; left: -19px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-2); }
.steps li.s-allow::before, .steps li.s-ok::before, .steps li.s-clean::before, .steps li.s-verified::before { border-color: var(--accent); background: var(--accent-soft); }
.steps li.s-scrubbed::before { border-color: var(--accent); background: var(--accent); }
.steps li.s-deny::before, .steps li.s-rejected::before, .steps li.s-locked::before, .steps li.s-error::before { border-color: var(--warm); background: var(--warm-soft); }
.steps li.s-handoff::before { border-color: var(--amber); background: var(--amber-soft); }
.steps li.s-step_up::before { border-color: var(--indigo); background: var(--indigo-soft); }
.steps b { color: var(--ink); }
.verdict { padding: 8px 10px; border-radius: 8px; font-size: 13px; font-weight: 600; }
.verdict.ok { background: var(--accent-soft); color: var(--accent); }
.verdict.bad { background: var(--warm-soft); color: var(--warm); }
.hash { color: var(--ink-3); font-family: var(--mono); font-size: 11px; }

/* ---------- policies ---------- */
.pol-grid > .card:first-child { display: flex; flex-direction: column; }
.pol-grid .editor { flex: 1 1 auto; }
@media (max-width: 1240px) { .grid.two.pol-grid { grid-template-columns: minmax(0, 1fr); } }
.kv-pair { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.editor { width: 100%; min-height: 520px; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; tab-size: 2; white-space: pre; overflow: auto; background: var(--white); }
.editor.invalid { border-color: var(--warm); }
.errors { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.errors li { font-family: var(--mono); font-size: 12px; color: var(--warm); background: var(--warm-soft); border-radius: 6px; padding: 6px 8px; overflow-wrap: anywhere; }
.diff { list-style: none; margin: 6px 0 0; padding: 0; font-family: var(--mono); font-size: 12px; display: grid; gap: 2px; }
.diff li { padding: 2px 8px; border-radius: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.diff .add { background: var(--accent-soft); color: var(--accent-2); }
.diff .del { background: var(--warm-soft); color: var(--warm); }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; font-size: 13px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .compare { grid-template-columns: 1fr; } }
.compare .side-col { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--white); min-width: 0; }

/* ---------- tour, toast ---------- */
.tour { position: fixed; z-index: 70; width: min(360px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 12px 40px rgba(31, 42, 36, .22); padding: 16px; display: grid; gap: 8px; }
.tour p { font-size: 14px; color: var(--ink-2); }
.tour-target { position: relative; z-index: 60; box-shadow: 0 0 0 3px var(--accent), 0 0 0 7px rgba(15, 107, 79, .18); border-radius: 8px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--tip-bg); color: #fff; padding: 10px 14px; border-radius: 10px; font-size: 13px; z-index: 80; max-width: calc(100vw - 32px); box-shadow: var(--shadow); }
.toast.bad { background: var(--warm); }

/* ---------- navigation shell (demo/shell.js): workspace, search, groups, breadcrumbs, palette ---------- */
.workspace { position: relative; flex: none; }
.workspace summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 5px 8px 5px 5px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); font-weight: 600; font-size: 13px; white-space: nowrap; }
.workspace summary::-webkit-details-marker { display: none; }
.workspace summary:hover { border-color: var(--line-2); }
.ws-mark { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; background: var(--indigo); color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .02em; }
.chev { width: 14px; height: 14px; fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ws-pop { position: absolute; top: calc(100% + 8px); left: 0; z-index: 60; width: min(360px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 14px; display: grid; gap: 8px; }
.tag.sample { background: var(--indigo-soft); color: var(--indigo); }
.search-btn { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 0 1 300px; margin-left: 4px; padding: 6px 8px 6px 10px; border: 1px solid var(--line); background: var(--white); color: var(--ink-3); font-weight: 500; font-size: 13px; border-radius: 10px; }
.search-btn:hover:not(:disabled) { border-color: var(--line-2); color: var(--ink-2); }
.search-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; flex: none; }
.search-text { flex: 1 1 auto; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
kbd { font-family: var(--sans); font-size: 11px; font-weight: 600; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; line-height: 18px; white-space: nowrap; }
@media (min-width: 901px) { .brand { flex: none; } }
@media (max-width: 1500px) { .search-btn { flex: none; } .search-btn .search-text { display: none; } .policy-chip { display: none; } }
@media (max-width: 1180px) { .search-btn kbd { display: none; } }
@media (max-width: 760px) { .workspace .ws-name, .workspace .chev { display: none; } }
@media (max-width: 480px) { .workspace .tag { display: none; } .search-btn { padding: 7px; } }

.nav-group { display: grid; gap: 4px; }
.nav-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding: 0 10px; }
.sidenav { gap: 14px; }
.sidenav a span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidenav a.in-section { color: var(--ink); }
.sidenav .sub { padding-left: 28px; margin-top: 2px; display: grid; gap: 1px; }
.sidenav .sub a { font-size: 13px; font-weight: 500; padding: 6px 10px; position: relative; }
.sidenav .sub a::before { content: ""; position: absolute; left: -10px; top: 6px; bottom: 6px; width: 2px; border-radius: 2px; background: var(--line); }
.sidenav .sub a[aria-current="page"]::before { background: var(--accent); }
.sidenav .count { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--ink-2); background: var(--surface-2); border-radius: 999px; padding: 1px 7px; }
.sidenav a[aria-current="page"] .count { background: var(--white); color: var(--accent); }
.nav-note { margin-top: auto; }
.nav-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; border-top: 1px solid var(--line); padding-top: 10px; }
.nav-foot kbd { margin-right: 4px; }
@media (min-width: 901px) {
  body.nav-collapsed { --nav-w: 64px; }
  body.nav-collapsed .sidenav { padding: 14px 8px; }
  body.nav-collapsed .sidenav a { justify-content: center; padding: 10px 0; }
  body.nav-collapsed .sidenav a span, body.nav-collapsed .sidenav .count, body.nav-collapsed .sidenav .sub,
  body.nav-collapsed .nav-note, body.nav-collapsed #keys-btn { display: none; }
  body.nav-collapsed .nav-label { font-size: 0; padding: 0; height: 1px; background: var(--line); margin: 4px 8px; }
  body.nav-collapsed .nav-foot { justify-content: center; }
  body.nav-collapsed #nav-collapse svg { transform: rotate(180deg); }
}
@media (max-width: 900px) { #nav-collapse { display: none; } }

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-3); margin-bottom: 6px; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.crumbs i { font-style: normal; color: var(--line-2); }
.crumbs [aria-current] { color: var(--ink); font-weight: 600; }
.view > .crumbs + .page-head { margin-top: 0; }

.palette, .keys { position: fixed; inset: 0; z-index: 80; background: rgba(31, 42, 36, .32); display: grid; justify-items: center; align-items: start; padding: 10vh 16px 16px; }
.palette-panel, .keys-panel { width: min(620px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 24px 64px rgba(31, 42, 36, .24); overflow: hidden; }
.palette-search { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.palette-search svg { width: 18px; height: 18px; fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round; flex: none; }
.palette-search input { border: 0; background: transparent; padding: 4px 0; font-size: 16px; outline: none; }
.palette-list { list-style: none; margin: 0; padding: 6px; max-height: min(420px, 55vh); overflow-y: auto; }
.palette-list li[role=option] { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.palette-list li[aria-selected="true"] { background: var(--accent-soft); }
.pal-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.pal-hint { color: var(--ink-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.pal-section { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding: 10px 10px 4px; }
.pal-empty { padding: 18px 10px; color: var(--ink-3); text-align: center; }
.palette-foot { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 9px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); background: var(--surface-2); }
.palette-foot kbd { margin-right: 3px; }
.keys-panel { padding: 16px; display: grid; gap: 10px; }
.keys-panel td { padding: 7px 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
.keys-panel td:first-child { width: 110px; }

/* ---------- business view (sample company) ---------- */
.sample-banner { display: flex; gap: 12px; align-items: flex-start; background: var(--indigo-soft); color: var(--indigo); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; font-size: 13px; }
.sample-banner a { color: var(--indigo); font-weight: 600; }
.sample-banner code { background: var(--surface); }
.sample-banner p { flex: 1 1 auto; }
.sample-banner button { color: var(--indigo); flex: none; }
.period { margin-top: 8px !important; }
.tiles.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .tiles.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .tiles.kpis { grid-template-columns: minmax(0, 1fr); } }
.tile.sample { border-top: 3px solid var(--indigo); }
.tile.kpi .v { font-size: 25px; }
.kpi-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; min-width: 0; }
.spark { flex: 0 1 120px; max-width: 50%; height: 28px; }
.delta { font-size: 12px; font-weight: 700; white-space: nowrap; border-radius: 999px; padding: 1px 7px; }
.delta.good { background: var(--accent-soft); color: var(--accent); }
.delta.bad { background: var(--warm-soft); color: var(--warm); }
.delta.flat { background: var(--surface-2); color: var(--ink-3); font-weight: 600; }
.card-head .tag { margin-left: auto; }
.card-head h2 + .tag { margin-left: 8px; }
.card-head .tag + p.hint { width: 100%; }
.card-link { display: inline-block; margin-top: 10px; font-weight: 600; font-size: 13px; text-decoration: none; }
.card-link:hover { text-decoration: underline; }
table.intents td { vertical-align: middle; }
table.intents .share { display: block; font-size: 12px; color: var(--ink-3); }
.meter-bar { display: inline-block; vertical-align: middle; width: 90px; max-width: 40vw; height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.meter-bar i { display: block; height: 100%; background: var(--series-3); border-radius: 4px; }
.nw { white-space: nowrap; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.checklist li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.checklist li:last-child { border-bottom: 0; }
.checklist .ck { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 800; }
.checklist b { display: block; font-size: 14px; }
.checklist .hint { display: block; }
.checklist .cv { font-weight: 700; font-variant-numeric: tabular-nums; }
.events { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.events li { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 10px; }
.ev-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; background: var(--ink-3); }
.ev-fraud .ev-dot { background: var(--warm); }
.ev-ops .ev-dot { background: var(--accent); }
.ev-compliance .ev-dot { background: var(--indigo); }
.ev-meta { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.events h3 { font-size: 14px; margin: 1px 0 2px; }
.events p:not(.ev-meta) { font-size: 13px; color: var(--ink-2); }
.facts { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; }
.facts div { min-width: 0; }
.facts dt { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.facts dd { margin: 1px 0 0; font-size: 14px; overflow-wrap: anywhere; }
@media (max-width: 480px) { .facts { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { #nav-collapse svg { transition: none; } }
.stack { display: grid; gap: 16px; align-content: start; min-width: 0; }
.facts.wide { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .facts.wide { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .facts.wide { grid-template-columns: minmax(0, 1fr); } }

/* ---------- business / technical view ---------- */
body:not(.tech) .tech-only { display: none !important; }
body.tech .biz-only { display: none !important; }
.view-switch button { padding: 5px 10px; font-size: 12px; }
@media (max-width: 1240px) { .view-switch { display: none; } }
.mode-badge.starting::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; margin-right: 6px; vertical-align: 1px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .mode-badge.starting::before { animation: none; } }
.icon-btn .moon { fill: none; }
:root[data-theme="dark"] .icon-btn .moon { fill: var(--ink-2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .icon-btn .moon { fill: var(--ink-2); } }

/* ---------- engine wait, not found ---------- */
.engine-wait { max-width: 620px; margin: 6vh auto; text-align: center; display: grid; justify-items: center; gap: 12px; }
.engine-wait .spinner { width: 28px; height: 28px; border-width: 3px; }
.engine-wait p { color: var(--ink-2); }
.engine-wait.error { text-align: left; justify-items: start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.engine-wait .row { gap: 14px; }
.notfound { margin-top: 8vh !important; }

/* ---------- calls ---------- */
.strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.strip > div { padding: 10px 14px; border-left: 1px solid var(--line); min-width: 0; }
.strip > div:first-child { border-left: 0; }
.strip .k { display: block; font-size: 12px; color: var(--ink-3); font-weight: 600; }
.strip b { font-size: 20px; }
.strip b small { font-size: 12px; color: var(--ink-3); font-weight: 600; }
@media (max-width: 900px) { .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } .strip > div { border-left: 0; border-top: 1px solid var(--line); } .strip > div:nth-child(-n+2) { border-top: 0; } .strip > div:last-child { grid-column: 1 / -1; } }
table.calls td { vertical-align: middle; }
table.calls .member { font-weight: 600; }
.pager { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.stars { color: var(--amber); letter-spacing: 1px; white-space: nowrap; }
.stars .off { color: var(--line-2); }
.call-head h1 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.call-head .h-sub { font-size: 16px; font-weight: 500; color: var(--ink-2); }
.call-head .lede { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.meta-line { color: var(--ink-2); font-size: 14px; }
.replay { display: grid; gap: 10px; }
.replay-head { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.replay-head .legend { margin: 0 0 0 auto; }
.rp-time { font-size: 13px; color: var(--ink-2); }
.track { position: relative; height: 34px; border-radius: 8px; background: var(--surface-2); cursor: pointer; overflow: hidden; }
.track > i { position: absolute; top: 8px; bottom: 8px; border-radius: 3px; }
.track .seg-agent { background: var(--accent); }
.track .seg-member { background: var(--indigo); top: 11px; bottom: 11px; }
.track .seg-system { background: var(--line-2); top: 13px; bottom: 13px; }
.track .mk { position: absolute; top: 2px; width: 3px; bottom: 2px; margin-left: -1px; border-radius: 2px; background: var(--warm); }
.track .mk.k-handoff { background: var(--amber); }
.track .mk.k-scrub { background: var(--accent-2); }
.track .cursor { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--ink); pointer-events: none; }
.legend .lg-mk { width: 3px; height: 12px; background: var(--warm); border-radius: 2px; }
.call-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .call-grid { grid-template-columns: minmax(0, 1fr); } }
.transcript { list-style: none; margin: 0; padding: 4px 4px 4px 0; display: grid; gap: 10px; max-height: 70vh; overflow-y: auto; }
.ti { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 8px; align-items: start; cursor: pointer; transition: opacity .15s; }
.transcript.playing .ti:not(.past) { opacity: .4; }
.ti .ts { font-family: var(--mono); font-size: 12px; color: var(--ink-3); padding-top: 9px; text-align: right; }
.ti .bubble { max-width: 88%; padding: 8px 12px; border-radius: 12px; font-size: 14px; line-height: 1.45; background: var(--white); border: 1px solid var(--line); border-bottom-left-radius: 4px; overflow-wrap: anywhere; }
.ti .who { display: block; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 2px; }
.ti.member .bubble { justify-self: end; background: var(--indigo-soft); border-color: transparent; border-bottom-left-radius: 12px; border-bottom-right-radius: 4px; }
.ti.system .bubble { justify-self: center; background: transparent; border: 0; color: var(--ink-3); font-size: 12px; text-align: center; }
.ti.system .who { display: none; }
.ti.current .bubble { box-shadow: 0 0 0 2px var(--accent); }
.ti.guard > div { font-size: 12px; color: var(--ink-2); background: var(--surface-2); border-radius: 8px; padding: 6px 10px; justify-self: start; overflow-wrap: anywhere; }
.ti.guard.k-block > div { background: var(--warm-soft); color: var(--warm); }
.ti.guard.k-handoff > div { background: var(--amber-soft); color: var(--amber); }
.ti.guard.k-scrub > div { background: var(--accent-soft); color: var(--accent); }
.ti.guard .ts { padding-top: 6px; }
.gi { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; font-size: 11px; font-weight: 800; margin-right: 6px; background: var(--accent-soft); color: var(--accent); flex: none; }
.k-block .gi { background: var(--warm-soft); color: var(--warm); }
.k-handoff .gi { background: var(--amber-soft); color: var(--amber); }
.summary { font-size: 15px; margin-bottom: 12px; }
.chips.qa { margin-top: 12px; }
.acts, .guards { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.acts li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; font-size: 14px; }
.acts .sub { display: block; font-size: 12px; color: var(--ink-3); }
.guards li { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 6px; align-items: start; font-size: 13px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.guards li:last-child { border-bottom: 0; padding-bottom: 0; }
.guards .hint { display: block; }
.guards .ts { font-size: 12px; color: var(--ink-3); }

/* ---------- tour invite, tour sheet on phones ---------- */
.tour-invite { position: fixed; right: 18px; bottom: 18px; z-index: 65; width: min(340px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow); padding: 14px; display: grid; gap: 10px; font-size: 14px; }
.tour { right: 18px; bottom: 18px; left: auto; top: auto; }
@media (max-width: 640px) {
  .tour, .tour-invite { left: 0; right: 0; bottom: 0; width: 100%; border-radius: 14px 14px 0 0; }
}
