:root {
  --bg: #05070d;
  --panel: #0b111c;
  --panel-2: #101827;
  --line: rgba(148, 163, 184, 0.14);
  --text: #e2e8f0;
  --muted: #8b98ab;
  --accent: #22d3ee;
  --nominal: #fb923c;
  --red: #ef4444;
  --amber: #f59e0b;
  --green: #22c55e;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 Inter, system-ui, sans-serif; }
a { color: var(--accent); text-decoration: none; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }
.hidden { display: none !important; }

.topbar { height: 48px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px;
  border-bottom: 1px solid var(--line); background: #070b13; position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; letter-spacing: .04em; display: flex; gap: 10px; align-items: center; }
.brand .muted { font-weight: 400; letter-spacing: 0; }
.brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.topbar nav a { margin-left: 18px; color: var(--muted); }
.topbar nav a.active, .topbar nav a:hover { color: var(--text); }

.layout { display: grid; grid-template-columns: 300px 1fr 420px; height: calc(100vh - 48px); }
.panel { background: var(--panel); overflow-y: auto; padding: 16px; }
.panel.left { border-right: 1px solid var(--line); }
.panel.right { border-left: 1px solid var(--line); }
.panel h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 0 0 12px; }
.panel h3 { font-size: 13px; margin: 18px 0 8px; color: var(--text); }

form label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
form input, form select { width: 100%; margin-top: 4px; padding: 7px 8px; background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px; font: inherit; }
form input[type=range] { padding: 0; accent-color: var(--accent); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
button { cursor: pointer; font: inherit; }
#go { width: 100%; padding: 10px; border: 0; border-radius: 6px; background: var(--accent); color: #031016; font-weight: 700; }
#go:disabled { opacity: .5; cursor: wait; }
.presets { margin-top: 14px; }
.presets button { display: block; width: 100%; text-align: left; margin-top: 6px; padding: 7px 9px; border-radius: 6px;
  border: 1px solid var(--line); background: transparent; color: var(--text); font-size: 12px; }
.presets button:hover { border-color: var(--accent); }
.provenance { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.provenance b { color: var(--text); font-weight: 600; }

.stage { position: relative; overflow: hidden; }
#scene { position: absolute; inset: 0; }
.hud { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; justify-content: space-between; pointer-events: none; }
#clock { background: rgba(5,7,13,.7); padding: 6px 10px; border-radius: 6px; border: 1px solid var(--line); font-size: 12px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; background: rgba(5,7,13,.7); padding: 6px 10px; border-radius: 6px;
  border: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.timeline { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; gap: 10px; align-items: center;
  background: rgba(5,7,13,.8); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.timeline input[type=range] { flex: 1; accent-color: var(--accent); }
.timeline button, .timeline select { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 4px 9px; }
.busy { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center;
  background: rgba(5,7,13,.55); backdrop-filter: blur(2px); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.verdict { padding: 10px 12px; border-radius: 8px; font-weight: 700; margin-bottom: 12px; border: 1px solid; }
.verdict.go { color: var(--green); border-color: rgba(34,197,94,.4); background: rgba(34,197,94,.08); }
.verdict.avoid { color: var(--accent); border-color: rgba(34,211,238,.4); background: rgba(34,211,238,.08); }
.verdict.nogo { color: var(--red); border-color: rgba(239,68,68,.4); background: rgba(239,68,68,.08); }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kpi { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.kpi .v { font-family: var(--mono); font-size: 17px; font-weight: 600; }
.kpi .l { font-size: 11px; color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { text-align: left; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--line); padding: 5px 4px; }
td { padding: 5px 4px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
td.num, th.num { text-align: right; font-family: var(--mono); }
.pill { font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; }
.pill.RED { background: rgba(239,68,68,.15); color: var(--red); }
.pill.AMBER { background: rgba(245,158,11,.15); color: var(--amber); }
.pill.GREEN { background: rgba(34,197,94,.12); color: var(--green); }
.trace { list-style: none; padding: 0; margin: 0; font-family: var(--mono); font-size: 12px; }
.trace li { padding: 5px 0; border-bottom: 1px dashed var(--line); display: flex; flex-direction: column; gap: 1px; }
.trace li .muted { font-size: 11px; }
.funnel { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.funnel b { color: var(--text); }
.error { color: var(--red); background: rgba(239,68,68,.08); border: 1px solid rgba(239,68,68,.3); padding: 10px; border-radius: 8px; }

/* evidence + report pages */
.doc { max-width: 1040px; margin: 0 auto; padding: 28px 16px 60px; }
.doc h1 { font-size: 26px; margin: 0 0 6px; }
.doc h2 { font-size: 18px; margin: 34px 0 10px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.doc .card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin: 12px 0; overflow-x: auto; }
.doc img { max-width: 100%; border-radius: 8px; background: #fff; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  .stage { height: 70vh; }
  .panel.left, .panel.right { border: 0; border-bottom: 1px solid var(--line); }
  .grid2 { grid-template-columns: 1fr; }
}
@media print {
  body { background: #fff; color: #111; }
  .topbar { display: none; }
  .doc .card { background: #fff; border-color: #ccc; }
}
