/* The Agent Console's styles. A light page around a dark console: the morning and a session's terminal are the machine's
   own record and sit on the night colors, and the policy, the log and the explanations sit on white. One icon set marks
   the tools and the verdicts, and every verdict has its own color and its own icon, so color is never the only signal.
   Positions the script sets go through the CSSOM, never inline styles. */
@font-face { font-family: Inter; src: url(fonts/inter-latin.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: Mono; src: url(fonts/jetbrains-mono-latin.woff2) format("woff2"); font-weight: 100 800; font-display: swap; }

:root {
  /* the page */
  --bg: #f6f7f9; --ink: #0b0d10; --ink2: #3a3f47; --muted: #626a74; --line: #e4e7ec; --line2: #eef0f3; --soft: #f6f7f9;
  --cyan: #0e7490; --cyan2: #0891b2; --cyan-bg: #e0f7fb; --cyan-ink: #075e72;
  --allow: #8a929c; --done: #15803d; --done-bg: #dcfce7;
  --ask: #b45309; --ask2: #d97706; --ask-bg: #fef3c7; --deny: #b91c1c; --deny2: #dc2626; --deny-bg: #fee2e2;
  --budget-ink: #3f47a8; --budget-bg: #eef0ff;
  /* the night console */
  --night: #0a0e14; --night2: #111722; --night-tile: #151c27; --night-line: #1c2531; --night-rail: #2a3646;
  --night-ink: #e8edf3; --night-ink2: #b4bfcc; --night-muted: #8592a3;
  --n-allow: #9aa6b4; --n-ask: #f5a524; --n-deny: #f87171; --n-quarantine: #22d3ee; --n-done: #34d399; --n-budget: #a5b4fc;
  --n-ask-bg: #2b2316; --n-deny-bg: #2b1c21; --n-quarantine-bg: #0d2830; --n-done-bg: #0f2825; --n-budget-bg: #1e2432;
  --n-ask-ink: #fcd34d; --n-deny-ink: #fca5a5; --n-quarantine-ink: #67e8f9; --n-done-ink: #6ee7b7;
  --radius: 14px; --mono: Mono, ui-monospace, monospace;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font: 14px/1.5 Inter, system-ui, sans-serif; color: var(--ink); background: var(--bg); min-height: 100vh;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
select { font: inherit; }
a { color: var(--cyan); }
code, .mono, pre { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--cyan2); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 6px 10px; border-radius: 6px; z-index: 30; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
.grow { flex: 1; }

/* One icon set, drawn on a 24-unit grid with round strokes. */
.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.i.solid { fill: currentColor; stroke: none; }

/* ------------------------------------------------------------------ the top bar */
.top { height: 56px; display: flex; align-items: center; gap: 14px; padding: 0 26px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10; background: rgba(255, 255, 255, .88);
  -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px); }
.brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; color: inherit; text-decoration: none; border-radius: 10px;
  padding: 4px 8px 4px 4px; margin-left: -4px; transition: background .15s; }
.brand:hover { background: var(--soft); }
.brand:hover svg { filter: drop-shadow(0 2px 8px rgba(8, 145, 178, .45)); }
.brand svg { filter: drop-shadow(0 2px 6px rgba(8, 145, 178, .25)); }
.brand b { font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.tabs { display: flex; gap: 2px; margin-left: 20px; align-self: stretch; }
.tab { position: relative; display: flex; align-items: center; font-size: 13.5px; font-weight: 550; color: var(--muted); padding: 0 11px;
  white-space: nowrap; transition: color .15s; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); }
.tab.on::after { content: ""; position: absolute; left: 11px; right: 11px; bottom: -1px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, #06b6d4, #0e7490); }
.picker { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.picker select { -webkit-appearance: none; appearance: none; border: 1px solid var(--line); border-radius: 9px; padding: 6px 30px 6px 11px;
  font-weight: 550; color: var(--ink); box-shadow: var(--shadow); cursor: pointer; background-color: #fff;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; background: var(--ink); color: #fff; border-radius: 9px;
  padding: 8px 14px; font-weight: 600; font-size: 13px; white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .14), inset 0 1px 0 rgba(255, 255, 255, .08); transition: background .15s, transform .1s; }
.btn:hover { background: #1f242b; }
.btn:active { transform: translateY(1px); }
.btn .i { width: 14px; height: 14px; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow); }
.btn.ghost:hover { background: var(--soft); }
.btn[disabled] { opacity: .45; cursor: default; transform: none; }
.link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--cyan); white-space: nowrap; }
.link[disabled] { opacity: .45; cursor: default; }
.preview { background: var(--deny2); color: #fff; text-align: center; font-size: 12.5px; font-weight: 600; padding: 4px; }

main { padding: 20px 26px 8px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.pill { display: inline-block; font: 650 10.5px/1.6 Inter, sans-serif; border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.p-allow { background: #eef0f2; color: #3f4650; }
.p-done { background: var(--done-bg); color: var(--done); }
.p-ask, .p-waiting, .p-approve, .p-wait { background: var(--ask-bg); color: var(--ask); }
.p-deny, .p-stopped-denial, .p-refused, .p-decline, .p-error, .p-stopped-budget, .p-step-cap, .p-turn-cap, .p-time-cap { background: var(--deny-bg); color: var(--deny); }
.p-quarantine, .p-masked, .p-you { background: var(--cyan-bg); color: var(--cyan-ink); }
.route { background: var(--cyan-bg); color: var(--cyan-ink); margin-left: 6px; }

/* ------------------------------------------------------------------ the morning: the night console */
.trace { position: relative; overflow: hidden; padding: 16px 20px 0; color: var(--night-ink); border: 1px solid #141b26; border-radius: 16px;
  background: radial-gradient(1100px 340px at 0% 0%, rgba(34, 211, 238, .10), transparent 62%),
    radial-gradient(900px 320px at 100% 0%, rgba(129, 140, 248, .08), transparent 60%), var(--night);
  box-shadow: 0 1px 2px rgba(2, 6, 23, .2), 0 24px 48px -24px rgba(2, 6, 23, .55); }
.progress { position: absolute; left: 0; right: 0; top: 0; height: 2px; opacity: 0; transition: opacity .3s; }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #22d3ee, #818cf8); box-shadow: 0 0 14px rgba(34, 211, 238, .7); }
.replaying .progress { opacity: 1; }
.th { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.th h1 { font-size: 18px; font-weight: 650; letter-spacing: -.015em; color: #fff; }
.mchip { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--night-ink); white-space: nowrap;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--night-line); border-radius: 999px; padding: 4px 11px; }
.mchip::before { content: ""; width: 6px; height: 6px; border-radius: 2px; background: linear-gradient(135deg, #22d3ee, #818cf8); }
.clock { display: none; font: 600 12.5px var(--mono); color: var(--n-quarantine-ink); font-variant-numeric: tabular-nums; margin-left: auto; }
.replaying .clock { display: inline-block; }
.rec { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 500; color: var(--night-ink2);
  border: 1px solid var(--night-line); background: rgba(255, 255, 255, .03); border-radius: 999px; padding: 5px 12px; white-space: nowrap; }
.rec::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--n-quarantine); box-shadow: 0 0 0 3px rgba(34, 211, 238, .18); }
.replaying .rec { margin-left: 0; }
.trace .lead { font-size: 13px; color: var(--night-ink2); margin: 4px 0 0; }

/* The counts double as the legend: each swatch is the tile it counts, and a click finds the next one. */
.kpis { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; margin: 14px 0 6px; border: 1px solid var(--night-line);
  border-radius: 12px; overflow: hidden; background: var(--night-line); }
.kpi { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px 14px 9px; text-align: left; background: #0d1219;
  color: var(--night-ink); transition: background .15s; min-width: 0; }
button.kpi:hover { background: #121925; }
.kpi b { font-size: 21px; font-weight: 650; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi > span { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--night-muted); white-space: nowrap; }
.k-ask b { color: var(--n-ask); }
.k-deny b { color: var(--n-deny); }
.k-quarantine b { color: var(--n-quarantine); }
.k-done b { color: var(--n-done); }
.sw { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; border: 1px solid var(--night-rail);
  background: var(--night-tile); color: var(--n-allow); }
.sw .i { width: 11px; height: 11px; stroke-width: 2.2; }
.sw-ask { background: var(--n-ask-bg); border-color: #684a1a; color: var(--n-ask); }
.sw-deny { background: var(--n-deny-bg); border-color: #693639; color: var(--n-deny); }
.sw-quarantine { background: var(--n-quarantine-bg); border-color: #145d6b; color: var(--n-quarantine); }
.sw-done { background: var(--n-done-bg); border-color: #1b5d49; color: var(--n-done); border-radius: 50%; }

/* The lanes: one row per session, its calls in the order they ran, and its cost and time at the end. */
.lanes { margin-top: 0; }
.lrow { display: grid; grid-template-columns: 228px minmax(0, 1fr) 160px; grid-template-areas: "lab lane meta"; align-items: center;
  border-top: 1px solid var(--night-line); transition: background .2s; }
.lrow:first-child { border-top: 0; }
.lrow:hover { background: rgba(255, 255, 255, .015); }
.lrow.live { background: rgba(34, 211, 238, .045); }
.lrow.idle .lab { opacity: .45; }
.lab { grid-area: lab; display: flex; flex-direction: column; align-items: flex-start; gap: 5px; padding: 9px 12px 9px 0; text-align: left;
  color: var(--night-ink); min-width: 0; }
.lname { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.lab b { display: flex; align-items: center; gap: 7px; font: 600 13.5px var(--mono); color: #fff; }
.lab .kind { font-size: 11px; font-weight: 500; color: var(--night-muted); border: 1px solid var(--night-line); border-radius: 5px; padding: 0 6px; }
.lab b { transition: color .15s; }
.lab:hover b, .lab:focus-visible b { color: var(--n-quarantine-ink); text-decoration: underline; text-underline-offset: 3px;
  text-decoration-color: rgba(103, 232, 249, .45); }
.lab .pill { transition: opacity .3s; }
.lrow.live .lab b::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--n-quarantine); animation: live 1.4s ease-out infinite; }
@keyframes live { 0% { box-shadow: 0 0 0 0 rgba(34, 211, 238, .6); } 100% { box-shadow: 0 0 0 7px rgba(34, 211, 238, 0); } }
.trace .p-done { background: var(--n-done-bg); color: var(--n-done-ink); }
.trace .p-waiting, .trace .p-ask { background: var(--n-ask-bg); color: var(--n-ask-ink); }
.trace .p-stopped-denial, .trace .p-stopped-budget, .trace .p-step-cap, .trace .p-turn-cap, .trace .p-time-cap, .trace .p-error,
.trace .p-deny { background: var(--n-deny-bg); color: var(--n-deny-ink); }
.lane { grid-area: lane; position: relative; display: flex; align-items: center; min-width: 0; padding: 10px 10px 10px 2px; }
.seq { flex: 1; display: flex; align-items: center; flex-wrap: wrap; row-gap: 10px; min-width: 0; }
.seq > * { position: relative; flex: none; }
.seq > * + * { margin-left: 4px; }
/* A turn's calls sit together as one block, and the rail runs through the turn rings between the blocks. */
.seq > .turn, .seq > .turn + * { margin-left: 13px; }
.seq > .turn:not(:first-child)::before, .seq > .turn + *::before { content: ""; position: absolute; top: 50%; right: 100%; width: 14px;
  height: 1.5px; margin-top: -.75px; background: var(--night-rail); pointer-events: none; }
.seq > .tail { flex: 1; min-width: 24px; height: 0; margin-left: 10px; border-top: 1.5px dotted rgba(148, 163, 184, .2); transition: opacity .4s ease; }
.seq > .tail::before { display: none; }
.turn { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid #52627a; background: var(--night);
  transition: opacity .35s ease, border-color .15s, transform .15s; }
.seq > .turn:hover { border-color: var(--n-quarantine); transform: scale(1.25); }
.tk, .mk { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--night-tile);
  border: 1px solid var(--night-rail); color: var(--n-allow);
  transition: opacity .35s ease, transform .35s cubic-bezier(.2, .9, .3, 1.3), background .15s, border-color .15s, color .15s, box-shadow .15s; }
.tk .i, .mk .i { width: 15px; height: 15px; }
.tk:hover { background: #1b2432; border-color: #3d4d63; color: #fff; transform: translateY(-2px); }
.mk:hover { transform: translateY(-2px); }
.mk.ask { background: var(--n-ask-bg); border-color: #684a1a; color: var(--n-ask); }
.mk.wait { background: var(--n-ask); border-color: var(--n-ask); color: #241703; box-shadow: 0 6px 18px -6px rgba(245, 165, 36, .7); }
.mk.wait::after { content: ""; position: absolute; inset: -1px; border-radius: inherit; animation: beacon 2.2s ease-out infinite; pointer-events: none; }
@keyframes beacon { 0% { box-shadow: 0 0 0 0 rgba(245, 165, 36, .6); } 70%, 100% { box-shadow: 0 0 0 11px rgba(245, 165, 36, 0); } }
.mk.deny { background: var(--n-deny-bg); border-color: #693639; color: var(--n-deny); }
.mk.stop { background: #ef4444; border-color: #ef4444; color: #fff; box-shadow: 0 6px 18px -6px rgba(239, 68, 68, .75); }
.mk.refused { background: transparent; border: 1.5px dashed var(--n-deny); color: var(--n-deny); }
.mk.quarantine { background: var(--n-quarantine-bg); border-color: #145d6b; color: var(--n-quarantine); box-shadow: 0 0 16px -4px rgba(34, 211, 238, .45); }
.mk.budget { background: var(--n-budget-bg); border-color: #485071; color: var(--n-budget); }
.mk.done { border-radius: 50%; background: var(--n-done-bg); border-color: #1b5d49; color: var(--n-done); }
.tk.sel, .mk.sel { box-shadow: 0 0 0 2px var(--night), 0 0 0 4px #e8edf3; z-index: 2; }
.mk.stop.sel { box-shadow: 0 0 0 2px var(--night), 0 0 0 4px #e8edf3, 0 6px 18px -6px rgba(239, 68, 68, .75); }
.lane .later { opacity: 0; transform: scale(.4); pointer-events: none; }
.lab .later { opacity: 0; transform: none; }
.lmeta { grid-area: meta; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; padding-left: 10px; text-align: right; }
.lmeta b { font: 600 13.5px var(--mono); color: var(--night-ink); font-variant-numeric: tabular-nums; }
.lmeta span { font-size: 11.5px; color: var(--night-muted); white-space: nowrap; }
.tfoot { display: flex; align-items: center; gap: 22px; padding: 10px 0 11px; border-top: 1px solid var(--night-line);
  font-size: 12px; color: var(--night-muted); }
.tturn { display: inline-flex; align-items: center; gap: 8px; }
.tfoot .hint { margin-left: auto; }

/* The tooltip over a tile or a turn. */
#pop { position: absolute; z-index: 35; width: max-content; max-width: 330px; transform: translate(-50%, calc(-100% - 12px)); pointer-events: none;
  background: #111722; color: var(--night-ink); border: 1px solid #263142; border-radius: 10px; padding: 9px 12px 10px; font-size: 12.5px;
  line-height: 1.45; box-shadow: 0 14px 34px rgba(2, 6, 23, .45); }
#pop::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 9px; height: 9px; margin-left: -4.5px; background: #111722;
  border-right: 1px solid #263142; border-bottom: 1px solid #263142; transform: rotate(45deg); }
#pop .pt { font: 500 11px var(--mono); color: var(--night-muted); }
#pop code { display: block; font: 500 12px/1.45 var(--mono); color: #fff; margin: 4px 0 6px; overflow-wrap: anywhere; }
#pop .pv { display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--night-ink2); }
#pop .pv .i { width: 13px; height: 13px; }
#pop .said { margin-top: 6px; color: var(--night-ink2); font-style: italic; }
#pop .c-ask, #pop .c-wait { color: var(--n-ask-ink); }
#pop .c-deny, #pop .c-stop, #pop .c-refused { color: var(--n-deny-ink); }
#pop .c-quarantine { color: var(--n-quarantine-ink); }
#pop .c-done { color: var(--n-done-ink); }

/* ------------------------------------------------------------------ the inspector: the selected event */
.detail { margin-top: 12px; position: relative; }
.ihead { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 12px 8px 18px; border-bottom: 1px solid var(--line); }
.vchip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; border-radius: 999px; padding: 3px 10px 3px 7px; white-space: nowrap; }
.vchip .i { width: 14px; height: 14px; }
.c-allow { background: #eef0f3; color: #3f4650; }
.c-ask, .c-wait { background: var(--ask-bg); color: var(--ask); }
.c-deny, .c-stop, .c-refused { background: var(--deny-bg); color: var(--deny); }
.c-quarantine { background: var(--cyan-bg); color: var(--cyan-ink); }
.c-done { background: var(--done-bg); color: var(--done); }
.c-budget { background: var(--budget-bg); color: var(--budget-ink); }
.ititle { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.ititle b { font: 600 13px var(--mono); white-space: nowrap; }
.ititle code { font-size: 12.5px; color: var(--ink2); overflow-wrap: anywhere; }
.itime { font: 500 12px var(--mono); color: var(--muted); white-space: nowrap; }
.ihead .hash { margin: 0; white-space: nowrap; }
.steps { display: inline-flex; gap: 4px; }
.stepb { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink2); }
.stepb:hover { background: var(--soft); color: var(--ink); }
.stepb[disabled] { opacity: .4; cursor: default; }
.stepb .i { width: 14px; height: 14px; }
.icols { display: grid; grid-template-columns: 1fr 1fr .9fr; }
.icols.two { grid-template-columns: 1fr 1fr; }
.box { padding: 12px 18px 14px; min-width: 0; border-left: 1px solid var(--line2); }
.box:first-child { border-left: 0; }
.box h3 { display: flex; align-items: center; gap: 7px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  font-weight: 700; margin-bottom: 10px; }
.box h3 .i { width: 14px; height: 14px; color: var(--cyan2); }
.threads { position: absolute; left: 0; top: 0; pointer-events: none; }
.threads svg { overflow: visible; display: block; }
.threads path { fill: none; stroke-width: 1.75; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw .8s ease .15s forwards; }
.threads path.still { animation: none; stroke-dashoffset: 0; }
.threads .a { fill: #ef4444; }
.threads .b { fill: #06b6d4; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.page { font-size: 13.5px; line-height: 1.65; color: var(--ink2); background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 14px 12px; white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
.page .url { display: flex; align-items: center; gap: 10px; margin: -10px -14px 10px; padding: 7px 12px; border-bottom: 1px solid var(--line2);
  background: var(--soft); border-radius: 9px 9px 0 0; font: 500 11.5px var(--mono); color: var(--muted); white-space: normal; }
.page .url::before { content: ""; flex: none; width: 31px; height: 9px;
  background: radial-gradient(circle at 4.5px 4.5px, #d3d8df 3.5px, transparent 4px) 0 0 / 11px 9px repeat-x; }
.inj { background: var(--deny-bg); color: #7f1d1d; text-decoration: line-through; text-decoration-color: rgba(220, 38, 38, .65);
  border-radius: 4px; padding: 1px 3px; }
.cut { background: #ecfeff; color: var(--cyan-ink); border: 1px solid #a5e9f3; border-radius: 6px; padding: 1px 6px; font: 600 12px var(--mono); }
.note { font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.why { list-style: none; }
.why li { position: relative; display: grid; grid-template-columns: 24px 1fr; gap: 10px; font-size: 13px; color: var(--ink2); padding-bottom: 12px; }
.why li:not(:last-child)::before { content: ""; position: absolute; left: 11.5px; top: 27px; bottom: 3px; width: 1px; background: #cdeaf0; }
.why .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font: 700 11px var(--mono); background: var(--cyan-bg);
  color: var(--cyan-ink); border: 1px solid #b6e3ec; }
.why .n .i { width: 12px; height: 12px; stroke-width: 2.6; }
.why .n.ok { background: var(--done-bg); color: var(--done); border-color: #b5e8c6; }
.why .n.bad { background: var(--deny-bg); color: var(--deny); border-color: #f6c4c4; }
.hash { margin-top: 10px; font: 500 11.5px var(--mono); color: var(--muted); overflow-wrap: anywhere; }
.callline { display: flex; align-items: flex-start; gap: 10px; font: 500 12.5px/1.55 var(--mono); color: #e6edf3; background: var(--night);
  border: 1px solid #1d2633; border-radius: 10px; padding: 10px 12px; overflow-wrap: anywhere; }
.callline .tag { flex: none; font: 650 10px/1.6 Inter, sans-serif; text-transform: uppercase; letter-spacing: .07em; color: var(--night-ink2);
  border: 1px solid var(--night-rail); border-radius: 5px; padding: 1px 6px; margin-top: 1px; }
.callline code { min-width: 0; }
.callline code::before { content: "❯ "; color: var(--n-quarantine); }
.out { font: 12px/1.55 var(--mono); color: #c4ccd6; background: var(--night); border: 1px solid #1d2633; border-radius: 10px; padding: 10px 12px;
  margin-top: 10px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 210px; overflow: auto; }
.rulecard b { display: block; font-size: 16px; font-weight: 650; letter-spacing: -.01em; margin-bottom: 4px; }
.rulecard p { font-size: 13px; color: var(--ink2); margin-top: 6px; }
.rulecard p.note { color: var(--muted); font-size: 12.5px; margin-top: 8px; }
.rulepos { display: flex; gap: 3px; margin-top: 14px; }
.rulepos i { width: 11px; height: 11px; border-radius: 3px; border: 1px solid var(--line); background: #fff; }
.rulepos i.past { background: #e3e7ec; border-color: #e3e7ec; }
.rulepos i.hit { width: 22px; border: 0; }
.rulepos .r-allow { background: #64748b; }
.rulepos .r-ask { background: var(--ask2); }
.rulepos .r-deny { background: var(--deny2); }
.answers { display: flex; gap: 8px; margin-top: 14px; }
.answers .btn { padding: 8px 16px; }

/* ------------------------------------------------------------------ a session */
.sessions { display: grid; grid-template-columns: 220px 1fr 330px; gap: 16px; }
.slist { display: flex; flex-direction: column; gap: 8px; }
.slist button { text-align: left; border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px 12px; background: #fff; box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s; }
.slist button:hover { border-color: #cfd5dc; }
.slist button.on { border-color: var(--cyan2); box-shadow: 0 0 0 1px var(--cyan2), 0 6px 16px -10px rgba(8, 145, 178, .5); }
.slist b { font: 700 13px var(--mono); display: block; }
.slist .who { font-size: 12px; color: var(--muted); display: block; }
.slist .pill { display: inline-block; margin-top: 5px; }
.slist .strip { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 9px; }
.strip i { width: 7px; height: 7px; border-radius: 2px; background: #cbd2db; }
.strip .s-ask, .strip .s-wait { background: var(--ask2); }
.strip .s-deny, .strip .s-stop, .strip .s-refused { background: var(--deny2); }
.strip .s-quarantine { background: var(--cyan2); }
.strip .s-budget { background: #6366f1; }
.strip .s-done { background: var(--done); border-radius: 50%; }
.term { background: var(--night); color: #d8dde3; border-radius: var(--radius); overflow: hidden; border: 1px solid #141b26;
  box-shadow: 0 24px 48px -28px rgba(2, 6, 23, .6); }
.thead { display: flex; align-items: center; gap: 12px; font: 500 12px var(--mono); color: #9aa3ad; padding: 11px 14px; border-bottom: 1px solid #1d2633;
  background: #0d1219; }
.thead::before { content: ""; flex: none; width: 34px; height: 10px;
  background: radial-gradient(circle at 5px 5px, #3a4656 4px, transparent 4.5px) 0 0 / 12px 10px repeat-x; }
.tbody { padding: 12px 14px 16px; font: 12.5px/1.6 var(--mono); max-height: 760px; overflow: auto; }
.tbody p, .tbody .cl { margin: 6px 0; overflow-wrap: anywhere; }
.prompt { color: #fff; }
.say { color: #b8c0c9; font-family: Inter, sans-serif; font-size: 13px; }
.cl .ico { display: inline-grid; place-items: center; width: 19px; height: 19px; border-radius: 5px; vertical-align: -5px; margin-right: 9px;
  background: var(--night-tile); border: 1px solid var(--night-rail); color: var(--n-allow); }
.cl .ico .i { width: 11px; height: 11px; stroke-width: 2.2; }
.cl b { color: #fff; margin-right: 6px; }
.cl .v { margin-left: 8px; font-size: 11.5px; }
.v-allow .v { color: #8f99a3; }
.v-ask .ico, .v-wait .ico { background: var(--n-ask-bg); border-color: #684a1a; color: var(--n-ask); }
.v-ask .v, .v-wait .v { color: #fbbf24; }
.v-deny .ico, .v-refused .ico { background: var(--n-deny-bg); border-color: #693639; color: var(--n-deny); }
.v-stop .ico { background: #ef4444; border-color: #ef4444; color: #fff; }
.v-deny .v, .v-refused .v, .v-stop .v { color: #f87171; }
.v-quarantine .ico { background: var(--n-quarantine-bg); border-color: #145d6b; color: var(--n-quarantine); }
.v-quarantine .v { color: #67e8f9; }
.tout { color: #9aa3ad; white-space: pre-wrap; border-left: 2px solid #2a3038; padding-left: 10px; margin: 4px 0 8px 9px; max-height: 160px; overflow: auto; }
.toggle { color: #67e8f9; font-size: 11.5px; margin-left: 16px; }
.toggle:hover { text-decoration: underline; }
.pause { border: 1px solid #5c4410; background: #1f1a0e; border-radius: 10px; padding: 11px 13px; margin: 10px 0; font-family: Inter, sans-serif; color: #fde68a; }
.pause .answers .btn { background: #fff; color: var(--ink); }
.pause .answers .btn.ghost { background: transparent; color: #fde68a; border-color: #5c4410; box-shadow: none; }
.endline { color: #8f99a3; font-family: Inter, sans-serif; border-top: 1px solid #1d2633; padding-top: 8px; }
.typing::after { content: "▍"; color: #67e8f9; }
.side { display: flex; flex-direction: column; gap: 16px; }
.side .card { padding: 14px 16px; }
.side h3, .pol h3 { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-bottom: 8px; }
.kv { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 3px 0; }
.meter { position: relative; height: 8px; border-radius: 4px; background: #eceef1; margin: 8px 0 6px; overflow: hidden; }
.meter i { position: absolute; left: 0; top: 0; bottom: 0; min-width: 3px; background: linear-gradient(90deg, #22d3ee, #0891b2); border-radius: 4px; }
.meter b { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ask2); }
.evlist { list-style: none; max-height: 330px; overflow: auto; }
.evlist li { display: grid; grid-template-columns: 52px 1fr; gap: 8px; font-size: 12.5px; padding: 7px 0; border-top: 1px solid var(--line2); }
.evlist li:first-child { border-top: 0; }
.evlist .t { font: 500 11.5px var(--mono); color: var(--muted); }
.evlist code { font-size: 11.5px; overflow-wrap: anywhere; }
.evlist small { display: block; color: var(--muted); }
.evlist .e-ask small, .evlist .e-wait small { color: var(--ask); }
.evlist .e-deny small, .evlist .e-stop small, .evlist .e-refused small { color: var(--deny); }
.evlist .e-quarantine small { color: var(--cyan-ink); }

/* ------------------------------------------------------------------ the policy */
.pol { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.pol .lead { font-size: 12.5px; }
.pol > * { min-width: 0; }
.pol .card { padding: 16px 18px; }
.pol h2 { font-size: 15.5px; font-weight: 650; margin-bottom: 4px; }
.lead { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.pol h4 { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 14px 0 4px; }
.rule { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: start; padding: 8px 6px; margin: 0 -6px; border-top: 1px solid var(--line2);
  border-radius: 6px; transition: background .15s; }
.rule:hover { background: #fafbfc; }
.rule .num { font: 600 11px var(--mono); color: var(--muted); padding-top: 3px; }
.rule .what { font-size: 13px; font-weight: 600; }
.rule .tag { font: 600 10.5px var(--mono); color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; margin-left: 8px; }
.pol h3 { margin: 16px 0 6px; }
.pol h3:first-child { margin-top: 0; }
.rule .pat { grid-column: 2 / 4; display: flex; flex-wrap: wrap; gap: 4px; }
.rule .pat code { font-size: 11px; background: var(--soft); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; }
.rule.changed { background: #f0fbfd; }
.rule.changed .what::after { content: " · changed"; color: var(--cyan); font-weight: 500; }
.tri { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.tri button { font-size: 11.5px; font-weight: 600; padding: 3px 9px; color: var(--muted); transition: background .15s, color .15s; }
.tri button + button { border-left: 1px solid var(--line2); }
.tri button:hover { color: var(--ink); }
.tri button[aria-pressed="true"].a { background: #eef0f2; color: var(--ink); }
.tri button[aria-pressed="true"].k { background: var(--ask-bg); color: var(--ask); }
.tri button[aria-pressed="true"].d { background: var(--deny-bg); color: var(--deny); }
.verdict { background: var(--soft); border: 1px solid var(--line2); border-left: 3px solid var(--cyan2); border-radius: 10px; padding: 10px 12px;
  font-size: 13.5px; margin-bottom: 12px; }
.verdict p + p { margin-top: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chips button { font: 600 12px var(--mono); border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; background: #fff; transition: background .15s; }
.chips button:hover { background: var(--soft); }
.chips button.on { border-color: var(--ink); background: var(--ink); color: #fff; }
.calls { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.calls th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 600; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.calls td { padding: 6px; border-bottom: 1px solid var(--line2); vertical-align: top; }
.calls td.arg { font-family: var(--mono); font-size: 11.5px; overflow-wrap: anywhere; max-width: 330px; }
.calls tr.chg td { background: #f0fbfd; }
.calls tr.dim td { opacity: .45; }
.risk { list-style: none; }
.risk li { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; padding: 6px 0; border-top: 1px solid var(--line2); }
.risk li:first-child { border-top: 0; }
.chain div { font: 11.5px var(--mono); color: var(--ink2); padding: 3px 0; overflow-wrap: anywhere; }
.chain .h { color: var(--cyan); margin-right: 6px; }

/* ------------------------------------------------------------------ the audit log */
.audit { padding: 18px 20px; }
.audit h2 { font-size: 17px; font-weight: 650; }
.auditbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 14px 0 12px; }
.result { font-size: 13.5px; font-weight: 500; border-radius: 10px; padding: 9px 12px; margin-bottom: 10px; }
.result.ok { background: var(--done-bg); color: var(--done); }
.result.bad { background: var(--deny-bg); color: var(--deny); }
.ledger { width: 100%; border-collapse: collapse; font-size: 12px; }
.ledger th { text-align: left; font-size: 11px; color: var(--muted); padding: 6px; border-bottom: 1px solid var(--line); background: #fff; }
.ledger td { padding: 5px 6px; border-bottom: 1px solid var(--line2); vertical-align: top; overflow-wrap: anywhere; }
.ledger tbody tr:hover td { background: #fafbfc; }
.ledger td.m { font-family: var(--mono); font-size: 11px; }
.ledger td .pill { font-size: 10px; }
.ledger tr.bad td { background: var(--deny-bg); }
.ledger tr.mine td { background: var(--cyan-bg); }
.ledger tr.changed td { background: #fff7e6; }

/* ------------------------------------------------------------------ how it works */
.how { max-width: 980px; padding: 10px 0 30px; }
.how h1 { font-size: 22px; font-weight: 650; letter-spacing: -.01em; margin-bottom: 10px; }
.how h2 { font-size: 16.5px; font-weight: 650; margin: 28px 0 8px; }
.how p { font-size: 14.5px; line-height: 1.65; color: var(--ink2); margin: 8px 0; max-width: 820px; }
.how ol, .how ul { margin: 8px 0 8px 22px; color: var(--ink2); font-size: 14.5px; line-height: 1.6; max-width: 820px; }
.how li { margin: 4px 0; }
.scroll { overflow-x: auto; }
table.grid { width: 100%; font-size: 13.5px; margin: 8px 0; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
table.grid th { text-align: left; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); padding: 7px 10px; }
table.grid td { border-bottom: 1px solid var(--line2); padding: 7px 10px; vertical-align: top; }
table.grid tr:last-child td { border-bottom: 0; }
table.map thead { display: none; }
table.map td:first-child { font-weight: 600; width: 34%; }
table.map td:nth-child(2) { width: 22%; }
.feats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 12px 0; }
.cfeat { text-align: left; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff; box-shadow: var(--shadow); }
.cfeat b { display: block; font: 700 13px var(--mono); }
.cfeat span { font-size: 11.5px; color: var(--muted); }
.cfeat.on { border-color: var(--cyan2); box-shadow: 0 0 0 1px var(--cyan2); }
.codebox { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 12px; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px;
  background: #fff; }
#code-tree { max-height: 540px; overflow: auto; font-size: 12px; }
#code-tree p { font: 700 11px var(--mono); color: var(--muted); margin: 8px 0 2px; }
#code-tree button { display: block; width: 100%; text-align: left; font: 12px var(--mono); padding: 2px 6px; border-radius: 6px; }
#code-tree button.on { background: var(--cyan-bg); color: var(--cyan-ink); }
#code-path { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
#code-body { font-size: 12px; line-height: 1.5; background: var(--soft); border-radius: 10px; padding: 12px; max-height: 540px; overflow: auto; white-space: pre; }

/* ------------------------------------------------------------------ the tour and the footer */
#tour { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 40; pointer-events: none; }
#trace, #detail, .term, #rules, .audit, .how { scroll-margin-top: 76px; }
#tour .shade { fill: rgba(6, 9, 14, .6); }
#tour.glide .hole { transition: x .45s ease, y .45s ease, width .45s ease, height .45s ease; }
#tour-box { position: fixed; z-index: 41; width: 340px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 15px 17px;
  box-shadow: 0 18px 50px rgba(2, 6, 23, .3); font-size: 14px; line-height: 1.55; }
#tour-box .tcount { font: 600 11px var(--mono); color: var(--cyan); }
#tour-box .tnav { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 12px; }
.foot { padding: 18px 26px 70px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; margin-top: 24px; }
.foot p + p { margin-top: 6px; }
.foot a { white-space: nowrap; }
.screens { display: none; }

.code-main { min-width: 0; }
@media (max-width: 1400px) {
  .picker span { display: none; }
  .top { gap: 10px; }
  .tabs { margin-left: 8px; }
  .tab { padding: 0 8px; }
  .tab.on::after { left: 8px; right: 8px; }
}

/* ------------------------------------------------------------------ one screen on a desktop */
/* The page itself never scrolls on a desktop: the top bar, the view and the footer's line always fit the window, and
   anything longer scrolls inside its own card (the inspector's columns, the terminal, the rules, the log and How it
   works). If a window is too short for even that, the view scrolls under the top bar. */
@media (min-width: 901px) {
  html, body { height: 100%; }
  body { display: flex; flex-direction: column; overflow: hidden; }
  .top, .preview, .foot { flex: none; }
  main { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; padding: 12px 24px 10px; }
  .view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .foot { display: flex; align-items: center; gap: 24px; margin: 0; padding: 8px 24px; font-size: 12px; background: #fff; }
  .foot p + p { margin: 0 0 0 auto; }

  /* the morning and its inspector */
  #v-trace .trace { flex: none; }
  #v-trace .detail { flex: 1; min-height: 190px; display: flex; flex-direction: column; }
  .ihead { flex: none; }
  .icols { flex: 1; min-height: 0; grid-template-rows: minmax(0, 1fr); }
  .box { min-height: 0; overflow-y: auto; }

  /* a session */
  .sessions { flex: 1; min-height: 0; grid-template-columns: 220px minmax(0, 1fr) 330px; grid-template-rows: minmax(0, 1fr); }
  .slist { min-height: 0; overflow-y: auto; padding: 2px; margin: -2px; }
  .term { display: flex; flex-direction: column; min-height: 0; }
  .thead { flex: none; }
  .tbody { flex: 1; min-height: 0; max-height: none; }
  .side { min-height: 0; overflow-y: auto; }
  .side .card { flex: none; }
  .side .card:nth-child(2) { flex: 1 1 auto; min-height: 150px; display: flex; flex-direction: column; }
  .side .card:nth-child(2) .evlist { flex: 1; min-height: 0; max-height: none; padding-bottom: 14px; margin-bottom: -4px; }
  .side .card:nth-child(2) { padding-bottom: 14px; }
  .side .card:nth-child(3) .evlist { max-height: 170px; }

  /* the policy */
  .pol { flex: 1; min-height: 0; grid-template-rows: minmax(0, 1fr); align-items: stretch; }
  .pol > .card { min-height: 0; }
  #rules, .pol > .card:nth-child(2) { display: flex; flex-direction: column; }
  .rlist { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -18px; padding: 0 18px; border-bottom: 1px solid var(--line2); }
  #rules > p:last-child { flex: none; padding-top: 12px; }
  .pol .scroll { flex: 1; min-height: 0; overflow: auto; }
  .pol > .card:last-child { overflow-y: auto; }

  /* the audit log, with its header row in place while the entries scroll */
  #v-audit .audit { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .audit > * { flex: none; }
  .audit > .scroll { flex: 1; min-height: 0; overflow: auto; margin: 0 -20px -18px; padding: 0 20px 12px; }
  .ledger th { position: sticky; top: 0; z-index: 1; border-bottom: 0; box-shadow: inset 0 -1px 0 var(--line); }

  /* How it works reads as a document that scrolls inside its own card */
  #v-how .how { flex: 1; min-height: 0; overflow-y: auto; width: 100%; max-width: 1120px; margin: 0 auto; padding: 22px 32px 32px; background: #fff;
    border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
}
/* A shorter window, which most laptops are once the browser's own bars take their share: the counts sit on one line, the
   lanes are tighter, and the hint under them waits for a taller window. */
@media (min-width: 901px) and (max-height: 860px) {
  .kpi { flex-direction: row; align-items: center; gap: 8px; padding: 8px 12px; }
  .kpi b { font-size: 17px; }
  .lab { padding: 6px 12px 6px 0; gap: 4px; }
  .lane { padding: 6px 10px 6px 2px; }
  .page { line-height: 1.6; }
  .page .url { padding-top: 6px; padding-bottom: 6px; }
  .tfoot { display: none; }
  .trace { padding-bottom: 6px; }
}
@media (min-width: 901px) and (max-height: 720px) {
  .trace .lead { display: none; }
  .kpis { margin-top: 10px; }
  .box h3 { margin-bottom: 6px; }
}

/* ------------------------------------------------------------------ narrower screens and the phone */
@media (max-width: 1280px) {
  .lrow { grid-template-columns: 226px minmax(0, 1fr) 134px; }
  .sessions { grid-template-columns: 196px minmax(0, 1fr) 286px; }
  .pol { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 270px; }
  .feats { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpi:last-child { grid-column: span 2; }
  .tfoot .hint { display: none; }
}
/* A narrow desktop window: a session's side cards and the policy's guardrails go under the first two columns. */
@media (min-width: 901px) and (max-width: 1100px) {
  .sessions { grid-template-columns: 180px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .sessions .side { grid-column: 1 / 3; display: grid; grid-template-columns: 1fr 1fr 1fr; max-height: 220px; }
  .sessions .side .card:nth-child(2) .evlist, .sessions .side .card:nth-child(3) .evlist { max-height: 120px; }
  .pol { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .pol > :last-child { grid-column: 1 / 3; max-height: 230px; }
}
@media (max-width: 900px) {
  .rlist { margin: 0 -6px; padding: 0 6px; }
  /* the phone standard (11/19): no text under 11px and no tap target under 24px */
  .pill, .callline .tag, .rule .tag, .ledger td .pill { font-size: 11px; }
  .tri button { padding: 7px 12px; font-size: 12.5px; }
  .link, .toggle { min-height: 32px; }
  .toggle { display: inline-flex; align-items: center; }
  .foot a { display: inline-block; padding: 6px 0; }
  .picker select { font-size: 16px; }
  small { font-size: 11px; }
  #code-tree button { padding: 6px 8px; }
  .top { height: auto; flex-wrap: wrap; padding: 10px 14px; gap: 8px; }
  .tabs, #tour-start { display: none; }
  .brand b { font-size: 15px; }
  main { padding: 12px 12px 4px; }
  .trace { padding: 16px 14px 0; border-radius: 14px; }
  .th h1 { font-size: 17px; }
  .rec { margin-left: 0; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 14px; }
  .kpi b { font-size: 20px; }
  .lrow { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "lab meta" "lane lane"; }
  .lab { padding: 12px 0 6px; }
  .lmeta { padding: 12px 0 6px; align-self: start; }
  .lane { padding: 4px 0 14px; }
  .tk, .mk { width: 28px; height: 28px; }
  .seq > .turn:not(:first-child)::before, .seq > .turn + *::before { display: none; }
  .tfoot { flex-wrap: wrap; gap: 8px; }
  .ihead { padding: 12px 14px; gap: 8px 10px; }
  .ihead .grow { display: none; }
  .ititle { flex-wrap: wrap; width: 100%; order: 2; }
  .itime { order: 3; }
  .ihead .hash { order: 4; width: 100%; white-space: normal; }
  .steps { margin-left: auto; }
  .icols, .icols.two { grid-template-columns: 1fr; }
  .box { border-left: 0; border-top: 1px solid var(--line2); min-height: 0; padding: 14px; }
  .box:first-child { border-top: 0; }
  .sessions, .pol { grid-template-columns: 1fr; }
  .sessions .side, .pol > :last-child { grid-column: auto; grid-template-columns: 1fr; }
  .slist { flex-direction: row; overflow-x: auto; }
  .slist button { min-width: 160px; }
  .feats, .codebox { grid-template-columns: 1fr; }
  .screens { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: rgba(255, 255, 255, .94);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
  .screens button { flex: 1; padding: 12px 2px; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
  .screens button.on { color: var(--cyan); box-shadow: inset 0 2px 0 var(--cyan2); }
  #tour-box { width: auto; left: 12px; right: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .threads path { stroke-dashoffset: 0; }
}

/* ------------------------------------------------------------------ dark mode (11/20)
   Light stays the default. The switch in the top bar puts the class "dark" on the body. The night console already sits
   on dark, so the day surfaces move toward it, and every text color keeps 4.5 to 1 on the surface it sits on
   (tests/test_palette.py reads these values). */
body.dark {
  --bg: #0b0f15; --ink: #e8edf3; --ink2: #c3ccd6; --muted: #98a3b1; --line: #1f2834; --line2: #19212c; --soft: #111722;
  --card: #111722; --raise: #1b2430;
  --cyan: #38bdf8; --cyan2: #22d3ee; --cyan-bg: #0d2830; --cyan-ink: #7dd3fc;
  --allow: #8592a3; --done: #34d399; --done-bg: #0f2825;
  --ask: #fbbf24; --ask2: #f59e0b; --ask-bg: #2b2316; --deny: #f87171; --deny2: #ef4444; --deny-bg: #2b1c21;
  --budget-ink: #a5b4fc; --budget-bg: #1e2432;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 0 0 1px rgba(255, 255, 255, .02);
  color-scheme: dark;
}
body.dark .top { background: rgba(11, 15, 21, .88); }
body.dark .card, body.dark .stepb, body.dark .page, body.dark .slist button, body.dark .tri, body.dark .chips button,
body.dark .ledger th, body.dark table.grid, body.dark .cfeat, body.dark .codebox, body.dark #tour-box, body.dark .foot,
body.dark #v-how .how, body.dark .btn.ghost, body.dark .picker select, body.dark .pause .answers .btn,
body.dark .rulepos i { background: var(--card); }
body.dark .p-allow, body.dark .c-allow, body.dark .tri button[aria-pressed="true"].a, body.dark .meter { background: var(--raise); }
body.dark .p-allow, body.dark .c-allow { color: var(--ink2); }
body.dark .inj { color: #fca5a5; }
body.dark .cut { background: var(--cyan-bg); }
body.dark .why li:not(:last-child)::before { background: #1f3a44; }
body.dark .why .n.ok { border-color: #1f5c45; }
body.dark .why .n.bad { border-color: #6b2b2b; }
body.dark .rule:hover, body.dark .ledger tbody tr:hover td { background: #151c27; }
body.dark .rule.changed, body.dark .calls tr.chg td { background: var(--cyan-bg); }
body.dark .ledger tr.changed td { background: #2b2316; }
body.dark .rulepos i.past, body.dark .strip i { background: #2a3646; border-color: #2a3646; }
body.dark .slist button:hover { border-color: #2a3646; }
body.dark .screens { background: rgba(11, 15, 21, .94); }
body.dark .btn:not(.ghost) { background: #e8edf3; color: #0b0f15; }
body.dark .btn:not(.ghost):hover { background: #cfd8e3; }
body.dark .chips button.on { background: #e8edf3; color: #0b0f15; }

/* The switch beside Take the tour. */
.theme { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex: none;
  border-radius: 10px; border: 1px solid var(--line); background: var(--card, #fff); color: var(--ink2); }
.theme:hover { border-color: var(--muted); color: var(--ink); }
body.dark .theme .sun { display: inline; } body.dark .theme .moon, .theme .sun { display: none; }

/* How it would deploy: the three places, then the standards. */
.how .places { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin: 12px 0 6px; max-width: 860px; }
.how .place { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--soft); }
.how .place h3 { font-size: 14.5px; font-weight: 650; }
.how .place p { font-size: 13.5px; margin: 6px 0 8px; }
.how .place ul { margin: 0 0 0 16px; font-size: 13px; }
.how .std { margin-top: 6px; }
.how .std b { color: var(--ink); font-weight: 650; }
.how h3.sub { font-size: 14.5px; font-weight: 650; margin: 18px 0 4px; }
