/* Tethra console. Dark-first operational UI; light theme via [data-theme="light"]. */
:root {
  color-scheme: dark;
  --bg: #070b12;
  --panel: #0d1420;
  --panel-2: #111b2a;
  --panel-3: #16223450;
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.28);
  --text: #e6edf7;
  --text-2: #b4c0d3;
  --muted: #8392a8;
  --accent: #38e1c6;
  --accent-ink: #04201b;
  --accent-soft: rgba(56, 225, 198, 0.12);
  --focus: #7cc4ff;
  /* Status palette: reserved for risk/state, always paired with a text label. */
  --critical: #ff5c6c;
  --high: #ff9f43;
  --medium: #f5c542;
  --low: #3dd68c;
  --info: #6ea8ff;
  --critical-soft: rgba(255, 92, 108, 0.14);
  --high-soft: rgba(255, 159, 67, 0.14);
  --medium-soft: rgba(245, 197, 66, 0.14);
  --low-soft: rgba(61, 214, 140, 0.14);
  --info-soft: rgba(110, 168, 255, 0.14);
  --neutral-soft: rgba(148, 163, 184, 0.14);
  /* Categorical series (validated for this dark surface). */
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  /* Sequential (heatmap) ramp, blue */
  --seq-0: rgba(148, 163, 184, 0.06);
  --seq-1: #184f95;
  --seq-2: #256abf;
  --seq-3: #3987e5;
  --seq-4: #6da7ec;
  --seq-5: #9ec5f4;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6f9; --panel: #ffffff; --panel-2: #f6f8fb; --panel-3: #eef2f7;
  --border: rgba(15, 23, 42, 0.10); --border-strong: rgba(15, 23, 42, 0.2);
  --text: #0f172a; --text-2: #334155; --muted: #64748b;
  --accent: #0e9f8a; --accent-ink: #ffffff; --accent-soft: rgba(14, 159, 138, 0.10); --focus: #2563eb;
  --critical: #d42a3c; --high: #c2610c; --medium: #a37a00; --low: #138a52; --info: #2a63c9;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --seq-0: rgba(15, 23, 42, 0.04); --seq-1: #cde2fb; --seq-2: #9ec5f4; --seq-3: #6da7ec; --seq-4: #3987e5; --seq-5: #1c5cab;
  --shadow: 0 12px 40px rgba(15, 23, 42, 0.16);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---- Shell ---- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { background: var(--panel); border-right: 1px solid var(--border); padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent-soft); display: grid; place-items: center; color: var(--accent); }
.brand-name { font-weight: 800; letter-spacing: 0.14em; font-size: 15px; }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: 0.04em; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; }
.nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav a .count { margin-left: auto; background: var(--high-soft); color: var(--high); font-size: 11px; font-weight: 700; border-radius: 999px; padding: 0 7px; }
.nav svg { width: 17px; height: 17px; flex: none; }
.sidebar-foot { margin-top: auto; padding: 12px 10px 0; font-size: 11px; color: var(--muted); border-top: 1px solid var(--border); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 28px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20; }
.topbar h1 { font-size: 17px; margin: 0; font-weight: 700; }
.topbar .crumb { color: var(--muted); font-size: 12px; }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; }
.content { padding: 24px 28px 48px; max-width: 1480px; width: 100%; }

.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 4px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel); cursor: pointer; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.user-chip .who { line-height: 1.15; font-size: 12px; }
.user-chip .role { color: var(--muted); font-size: 11px; }

/* ---- Primitives ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border-strong); background: var(--panel-2); color: var(--text); padding: 7px 13px; border-radius: var(--radius-sm); font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; transition: background 0.12s, border-color 0.12s; }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn.danger { background: var(--critical-soft); border-color: color-mix(in srgb, var(--critical) 50%, transparent); color: var(--critical); }
.btn.warn { background: var(--high-soft); border-color: color-mix(in srgb, var(--high) 45%, transparent); color: var(--high); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--panel-2); border-color: var(--border); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn svg { width: 15px; height: 15px; }
.icon-btn { position: relative; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border); background: var(--panel); display: grid; place-items: center; cursor: pointer; color: var(--text-2); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn .dot { position: absolute; top: -3px; right: -3px; min-width: 17px; height: 17px; border-radius: 999px; background: var(--critical); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { margin: 0; font-size: 14px; font-weight: 700; }
.card-head .sub { color: var(--muted); font-size: 12px; font-weight: 400; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.mt { margin-top: 16px; }
.section-title { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 0 0 16px; flex-wrap: wrap; }
.section-title h2 { margin: 0; font-size: 20px; }
.section-title p { margin: 4px 0 0; color: var(--muted); }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; position: relative; overflow: hidden; text-align: left; cursor: default; }
button.kpi { cursor: pointer; }
button.kpi:hover { border-color: var(--border-strong); }
button.kpi.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--kpi-accent, var(--accent)); }
.kpi .label { color: var(--muted); font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .hint { color: var(--muted); font-size: 12px; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 650; white-space: nowrap; background: var(--neutral-soft); color: var(--text-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.b-critical { background: var(--critical-soft); color: var(--critical); }
.b-high { background: var(--high-soft); color: var(--high); }
.b-medium { background: var(--medium-soft); color: var(--medium); }
.b-low { background: var(--low-soft); color: var(--low); }
.b-info { background: var(--info-soft); color: var(--info); }
.b-accent { background: var(--accent-soft); color: var(--accent); }
.chip { display: inline-block; padding: 1px 7px; border-radius: var(--radius-sm); background: var(--panel-2); border: 1px solid var(--border); font-size: 11.5px; color: var(--text-2); margin: 0 4px 4px 0; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 650; background: var(--panel-2); position: sticky; top: 0; }
tbody tr:last-child td { border-bottom: none; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--panel-2); }
td .title { font-weight: 600; }
td .subtitle { color: var(--muted); font-size: 12px; }
.actions-cell { white-space: nowrap; text-align: right; }
.actions-cell .btn + .btn { margin-left: 4px; }
.empty { text-align: center; color: var(--muted); padding: 36px 12px; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .label-text { font-size: 12px; font-weight: 650; color: var(--text-2); }
.field .help { font-size: 11.5px; color: var(--muted); }
.req::after { content: " *"; color: var(--critical); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search], input[type=url], select, textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 8px 10px; outline: none; min-width: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 76px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px 16px; margin: 0 0 14px; }
legend { font-weight: 700; font-size: 13px; padding: 0 6px; }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--accent); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters input[type=search] { max-width: 300px; }
.filters select { width: auto; min-width: 140px; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { border: none; background: transparent; padding: 6px 10px; cursor: pointer; color: var(--text-2); font-weight: 600; font-size: 12.5px; }
.seg button.on { background: var(--accent-soft); color: var(--accent); }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.scale button { border: 1px solid var(--border-strong); background: var(--bg); border-radius: var(--radius-sm); padding: 6px 0; cursor: pointer; font-weight: 700; }
.scale button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.err-list { background: var(--critical-soft); color: var(--critical); border-radius: var(--radius-sm); padding: 10px 14px; margin: 0 0 14px; font-size: 13px; }
.err-list ul { margin: 6px 0 0; padding-left: 18px; }
.callout { background: var(--panel-2); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13px; color: var(--text-2); }
.callout.warn { border-left-color: var(--high); }
.callout.danger { border-left-color: var(--critical); }

/* Drawer & modal */
.overlay { position: fixed; inset: 0; background: rgba(3, 6, 12, 0.6); z-index: 50; animation: fade 0.15s ease; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(860px, 100vw); background: var(--panel); border-left: 1px solid var(--border-strong); z-index: 51; display: flex; flex-direction: column; box-shadow: var(--shadow); animation: slide 0.2s ease; }
.drawer.narrow { width: min(640px, 100vw); }
.drawer-head { padding: 18px 22px 14px; border-bottom: 1px solid var(--border); }
.drawer-head .row { align-items: flex-start; }
.drawer-head h2 { margin: 4px 0 0; font-size: 18px; line-height: 1.3; }
.drawer-body { padding: 18px 22px; overflow-y: auto; flex: 1; }
.drawer-foot { padding: 12px 22px; border-top: 1px solid var(--border); display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; background: var(--panel-2); }
.modal { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--panel); border: 1px solid var(--border-strong); border-radius: 12px; z-index: 61; box-shadow: var(--shadow); }
.modal .drawer-head, .modal .drawer-body, .modal .drawer-foot { padding-left: 20px; padding-right: 20px; }
.modal-overlay { z-index: 60; }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 0 -22px 16px; padding: 0 22px; overflow-x: auto; }
.tabs button { border: none; background: none; padding: 10px 12px; cursor: pointer; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.tabs button .n { font-size: 11px; color: var(--muted); margin-left: 4px; }

.dl { display: grid; grid-template-columns: 170px 1fr; gap: 8px 16px; margin: 0; }
.dl dt { color: var(--muted); font-size: 12.5px; }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-2); margin: 0; }
.block { margin-bottom: 18px; }
.block h4 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

/* Lifecycle stepper */
.stepper { display: flex; gap: 0; margin: 14px 0 2px; }
.step { flex: 1; position: relative; padding-top: 16px; font-size: 11.5px; color: var(--muted); text-align: center; }
.step::before { content: ""; position: absolute; top: 5px; left: 0; right: 0; height: 2px; background: var(--border-strong); }
.step:first-child::before { left: 50%; } .step:last-child::before { right: 50%; }
.step::after { content: ""; position: absolute; top: 0; left: calc(50% - 6px); width: 12px; height: 12px; border-radius: 50%; background: var(--panel); border: 2px solid var(--border-strong); }
.step.done { color: var(--text-2); } .step.done::before { background: var(--accent); } .step.done::after { background: var(--accent); border-color: var(--accent); }
.step.current { color: var(--text); font-weight: 700; } .step.current::after { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.step.bad::after { background: var(--critical); border-color: var(--critical); } .step.bad { color: var(--critical); font-weight: 700; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 6px; bottom: -6px; width: 1px; background: var(--border-strong); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 0; top: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.timeline .when { font-size: 11.5px; color: var(--muted); }
.timeline .what { font-weight: 600; }
.comment { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 10px; }
.comment .meta { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
pre.json { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; font: 12px/1.5 var(--mono); overflow-x: auto; max-height: 360px; margin: 0; color: var(--text-2); }

/* Charts */
.chart { width: 100%; display: block; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .grid-line { stroke: var(--border); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.heatmap { display: grid; grid-template-columns: 22px repeat(5, 1fr); gap: 3px; font-size: 11px; }
.heatmap .cell { aspect-ratio: 1.6; border-radius: 4px; display: grid; place-items: center; font-weight: 700; font-variant-numeric: tabular-nums; position: relative; }
.heatmap .axis { display: grid; place-items: center; color: var(--muted); }
.heatmap .cell.hl { outline: 2px solid var(--accent); outline-offset: 1px; }
.bar-row { display: grid; grid-template-columns: minmax(80px, 130px) 1fr 36px; align-items: center; gap: 10px; margin-bottom: 9px; font-size: 12.5px; }
.bar-track { height: 10px; background: var(--seq-0); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 0 4px 4px 0; }
.bar-row .n { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }
.meter { height: 8px; background: var(--seq-0); border-radius: 4px; overflow: hidden; position: relative; }
.meter > span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; }
.tip { position: fixed; z-index: 80; pointer-events: none; background: var(--panel); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 7px 10px; font-size: 12px; box-shadow: var(--shadow); max-width: 260px; }
.tip b { color: var(--text); }
.big-number { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.feed li:last-child { border-bottom: none; }
.feed .t { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.risk-score { display: inline-grid; place-items: center; width: 26px; height: 22px; border-radius: 5px; font-weight: 800; font-size: 12px; font-variant-numeric: tabular-nums; margin-right: 6px; }
.days { font-variant-numeric: tabular-nums; font-size: 12px; }
.days.urgent { color: var(--critical); font-weight: 700; }
.days.soon { color: var(--high); font-weight: 600; }

/* Dropdown */
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); width: 380px; max-width: calc(100vw - 24px); background: var(--panel); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow); z-index: 40; overflow: hidden; }
.dropdown .item { display: block; width: 100%; text-align: left; padding: 10px 14px; border: none; border-bottom: 1px solid var(--border); background: transparent; cursor: pointer; font-size: 12.5px; color: var(--text-2); }
.dropdown .item:hover { background: var(--panel-2); }
.dropdown .item.unread { color: var(--text); }
.dropdown .item.unread::before { content: "●"; color: var(--accent); margin-right: 6px; font-size: 9px; vertical-align: middle; }
.dropdown .head { padding: 10px 14px; display: flex; justify-content: space-between; align-items: center; font-weight: 700; border-bottom: 1px solid var(--border); }
.rel { position: relative; }

/* Toast */
#toast-root { position: fixed; bottom: 20px; right: 20px; z-index: 90; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--panel); border: 1px solid var(--border-strong); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); padding: 10px 14px; box-shadow: var(--shadow); max-width: 380px; animation: slide 0.2s ease; font-size: 13px; }
.toast.error { border-left-color: var(--critical); }

/* Login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-hero { padding: 56px; background: radial-gradient(1200px 600px at 0% 0%, rgba(56, 225, 198, 0.12), transparent 60%), var(--panel); border-right: 1px solid var(--border); display: flex; flex-direction: column; justify-content: center; gap: 22px; }
.login-hero h1 { font-size: 34px; line-height: 1.15; margin: 0; letter-spacing: -0.02em; }
.login-hero p { color: var(--text-2); max-width: 520px; margin: 0; font-size: 15px; }
.pillars { display: grid; gap: 12px; max-width: 520px; }
.pillar { display: flex; gap: 12px; align-items: flex-start; }
.pillar b { display: block; }
.pillar span { color: var(--muted); font-size: 13px; }
.pillar .num { font: 800 18px var(--mono); color: var(--accent); min-width: 78px; }
.login-form { display: grid; place-items: center; padding: 32px 16px; }
.login-card { width: min(400px, 100%); }
.login-card h2 { margin: 0 0 4px; }
.demo-accounts { margin-top: 18px; display: grid; gap: 6px; }
.demo-accounts button { display: flex; justify-content: space-between; border: 1px solid var(--border); background: var(--panel); border-radius: var(--radius-sm); padding: 8px 12px; cursor: pointer; font-size: 12.5px; color: var(--text-2); }
.demo-accounts button:hover { border-color: var(--accent); }

.playground textarea { min-height: 140px; font-family: var(--mono); font-size: 12.5px; }
.verdict { font-size: 22px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; }
.verdict.block { color: var(--critical); } .verdict.redact { color: var(--high); } .verdict.monitor { color: var(--info); } .verdict.allow { color: var(--low); }
.toggle { position: relative; width: 36px; height: 20px; flex: none; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle span { position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px; cursor: pointer; transition: 0.15s; }
.toggle span::before { content: ""; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: 0.15s; }
.toggle input:checked + span { background: var(--accent); }
.toggle input:checked + span::before { transform: translateX(16px); }
.toggle input:disabled + span { opacity: 0.5; cursor: not-allowed; }
.key-reveal { font-family: var(--mono); background: var(--bg); border: 1px dashed var(--accent); border-radius: var(--radius-sm); padding: 10px; word-break: break-all; }

@media (max-width: 1100px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main, .g-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 45; width: 260px; transform: translateX(-100%); transition: transform 0.2s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .menu-btn { display: grid; }
  .topbar { padding: 10px 16px; }
  .content { padding: 16px 16px 40px; }
  .g-2, .g-4, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .login { grid-template-columns: 1fr; }
  .login-hero { padding: 32px 16px; border-right: none; border-bottom: 1px solid var(--border); }
  .user-chip .who { display: none; }
  .dl { grid-template-columns: 1fr; gap: 2px 0; }
  .dl dd { margin-bottom: 8px; }
  .drawer-head, .drawer-body, .drawer-foot { padding-left: 16px; padding-right: 16px; }
  .tabs { margin: 0 -16px 16px; padding: 0 16px; }
}
@media (forced-colors: active) { .badge::before, .bar-fill, .heatmap .cell { forced-color-adjust: none; } }
