/* Andesite. An operational console for a permanent record.
   Dark is the default; light when chosen (data-theme="light").
   No inline styles anywhere (strict CSP): geometry arrives as custom properties set through the CSSOM.

   Layout tiers
     >= 1280px  desktop: every page in the top bar
     1024-1279  iPad landscape and small laptops: main pages in the bar, the rest in the menu
     700-1023   iPad portrait: menu button top right, breadcrumb and page tabs below the bar
     < 700      phones: compact bar, menu, and a bottom tab bar */

:root {
  --bg-0: #0d1117;
  --bg-1: #131922;
  --bg-2: #18202b;
  --bg-3: #1f2834;
  --bg-hover: #222c3a;
  --line: #262f3b;
  --line-2: #33404f;
  --line-3: #465467;
  --text: #e6eaf0;
  --text-2: #b4bdc9;
  --text-3: #7d8a9b;
  --accent: #4c90f0;
  --accent-2: #2d72d2;
  --accent-soft: rgba(76, 144, 240, 0.14);
  --accent-ink: #0d1117;
  --focus: #8abbff;
  --ok: #32a467;
  --ok-soft: rgba(50, 164, 103, 0.15);
  --warn: #ec9a3c;
  --bad: #e76a6e;
  --bad-soft: rgba(231, 106, 110, 0.14);

  --t-court: #e76a6e;
  --t-acknowledged: #ec9a3c;
  --t-documented: #4c90f0;
  --t-alleged: #a88be0;
  --t-unverified: #8f99a8;

  --ty-event: #4c90f0;
  --ty-actor: #f0b726;
  --ty-action: #b6d94c;
  --ty-provision: #2ec4b6;
  --ty-instrument: #1b9e93;
  --ty-right: #d16ba5;
  --ty-place: #72ca9b;
  --ty-outcome: #56b4e9;
  --ty-source: #8f99a8;

  --oc-remedy: #32a467;
  --oc-partial: #56b4e9;
  --oc-deflected: #d1980b;
  --oc-adverse: #d16ba5;
  --oc-none: #5f6b7c;

  --m-physical: #e76a6e;
  --m-administrative: #ec9a3c;
  --m-digital: #4c90f0;
  --m-legal: #a88be0;
  --m-unclassified: #5f6b7c;

  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 12px 32px -18px rgba(0, 0, 0, 0.8);
  --shadow-pop: 0 18px 48px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--line-2);
  --grid-dot: rgba(255, 255, 255, 0.035);

  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --radius: 3px;
  --gutter: 16px;
  --topbar-h: 52px;
  --subbar-h: 40px;
  --tabbar-h: 0px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --max: 1680px;

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg-0: #f3f5f8;
  --bg-1: #ffffff;
  --bg-2: #f6f7f9;
  --bg-3: #edf0f4;
  --bg-hover: #eef2f7;
  --line: #dfe3e9;
  --line-2: #cfd5dd;
  --line-3: #aab3bf;
  --text: #1c2127;
  --text-2: #404854;
  --text-3: #5f6b7c;
  --accent: #2d72d2;
  --accent-2: #215db0;
  --accent-soft: rgba(45, 114, 210, 0.1);
  --accent-ink: #ffffff;
  --focus: #2d72d2;
  --ok: #1c7a4a;
  --ok-soft: rgba(35, 133, 81, 0.12);
  --warn: #b0640f;
  --bad: #c23030;
  --bad-soft: rgba(205, 66, 70, 0.1);

  --t-court: #c23030;
  --t-acknowledged: #b0640f;
  --t-documented: #2d72d2;
  --t-alleged: #7454c9;
  --t-unverified: #6b7686;

  --ty-event: #2d72d2;
  --ty-actor: #a66c00;
  --ty-action: #5f7d00;
  --ty-provision: #0f8a80;
  --ty-instrument: #0b6e66;
  --ty-right: #b5407f;
  --ty-place: #23855a;
  --ty-outcome: #1f7fb8;
  --ty-source: #6b7686;

  --oc-remedy: #1c7a4a;
  --oc-partial: #1f7fb8;
  --oc-deflected: #a37200;
  --oc-adverse: #b5407f;
  --oc-none: #8f99a8;

  --m-physical: #c23030;
  --m-administrative: #b0640f;
  --m-digital: #2d72d2;
  --m-legal: #7454c9;

  --shadow: 0 1px 2px rgba(17, 20, 24, 0.06), 0 8px 24px -16px rgba(17, 20, 24, 0.25);
  --shadow-pop: 0 18px 48px -12px rgba(17, 20, 24, 0.28), 0 0 0 1px var(--line-2);
  --grid-dot: rgba(17, 20, 24, 0.045);
  color-scheme: light;
}

/* ---------- Key colours ---------- */
.ty-event { --k: var(--ty-event); } .ty-actor { --k: var(--ty-actor); } .ty-action { --k: var(--ty-action); }
.ty-provision { --k: var(--ty-provision); } .ty-instrument { --k: var(--ty-instrument); } .ty-right { --k: var(--ty-right); }
.ty-place { --k: var(--ty-place); } .ty-outcome { --k: var(--ty-outcome); } .ty-source { --k: var(--ty-source); }
.f-actor { --k: var(--ty-actor); } .f-provision { --k: var(--ty-provision); }
.f-right-press, .f-right-expression, .f-right-assembly, .f-right-information { --k: var(--ty-right); }
.m-physical, .f-mech-physical { --k: var(--m-physical); } .m-administrative, .f-mech-administrative { --k: var(--m-administrative); }
.m-digital, .f-mech-digital { --k: var(--m-digital); } .m-legal, .f-mech-legal { --k: var(--m-legal); }
.m-unclassified, .f-mech-unclassified { --k: var(--m-unclassified); }
.oc-remedy { --k: var(--oc-remedy); } .oc-partial { --k: var(--oc-partial); } .oc-deflected { --k: var(--oc-deflected); }
.oc-adverse { --k: var(--oc-adverse); } .oc-none { --k: var(--oc-none); }
/* Tier rules come last so an event node coloured by its evidence level wins over its type. */
.c-court, .s-court, .f-court, .t-court { --k: var(--t-court); }
.c-acknowledged, .s-acknowledged, .f-acknowledged, .t-acknowledged { --k: var(--t-acknowledged); }
.c-documented, .s-documented, .f-documented, .t-documented { --k: var(--t-documented); }
.c-alleged, .s-alleged, .f-alleged, .t-alleged { --k: var(--t-alleged); }
.c-unverified, .s-unverified, .f-unverified, .t-unverified { --k: var(--t-unverified); }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + var(--subbar-h) + 16px); }
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg-0);
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1px);
  background-size: 18px 18px;
  color: var(--text);
  font: 400 0.875rem/1.55 var(--font);
  font-feature-settings: "kern" 1;
  overflow-x: hidden;
  padding-bottom: var(--tabbar-h);
}
body.has-drawer { overflow: hidden; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.005em; }
p { margin: 0 0 0.75em; }
p:last-child { margin-bottom: 0; }
code, kbd, pre, .mono { font-family: var(--mono); font-feature-settings: "zero" 1; }
.tnum { font-variant-numeric: tabular-nums; }
.small { font-size: 0.8125rem; }
.muted { color: var(--text-3); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono-label {
  display: inline-flex; align-items: center; gap: 6px;
  font: 500 0.6875rem/1.4 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 0;
}
.eyebrow { margin: 0 0 6px; font-size: 0.6875rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); display: flex; align-items: center; gap: 6px; }
.ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.ico-xl { width: 40px; height: 40px; stroke-width: 1; color: var(--text-3); }
.skip { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: var(--radius); }
.skip:focus { top: 8px; }
.noscript { padding: 40px var(--gutter); }

.tier-glyph { width: 12px; height: 12px; flex: none; vertical-align: -1px; }
.tier-glyph .g { fill: var(--k); }
.tier-glyph .g-outline { fill: none; stroke: var(--k); stroke-width: 1.5; stroke-linejoin: round; }
.tier-glyph .g-dash { fill: none; stroke: var(--k); stroke-width: 1.4; stroke-dasharray: 2 1.6; }

/* ---------- Buttons, chips, pills ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 32px; padding: 0 12px;
  border: 1px solid var(--accent-2); border-radius: var(--radius);
  background: var(--accent-2); color: #fff;
  font-weight: 500; font-size: 0.8125rem; line-height: 1;
  text-decoration: none; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.btn:hover { background: var(--accent); border-color: var(--accent); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-small { min-height: 28px; padding: 0 10px; font-size: 0.75rem; }
.btn-quiet { background: transparent; color: var(--text-2); border-color: var(--line-2); }
.btn-quiet:hover { background: var(--bg-hover); color: var(--text); border-color: var(--line-3); }
.btn.is-flash { border-color: var(--ok); color: var(--ok); background: var(--ok-soft); }
.btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.btn .ico { width: 14px; height: 14px; }
.row-gap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 26px; padding: 2px 9px;
  border: 1px solid var(--line-2); border-radius: 2px;
  background: var(--bg-2); color: var(--text-2);
  font-size: 0.75rem; line-height: 1.2; text-decoration: none;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.chip[class*="ty-"], .chip[class*="oc-"] { border-left: 2px solid var(--k); }
.chip:hover { border-color: var(--line-3); color: var(--text); text-decoration: none; background: var(--bg-hover); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.chip-tier[aria-pressed="true"] { border-color: var(--k); background: color-mix(in srgb, var(--k) 14%, transparent); }
.chip .tnum { color: var(--text-3); font-family: var(--mono); font-size: 0.6875rem; }
.chip.is-quiet { opacity: 0.55; }
.chip-static { pointer-events: none; margin: 1px 4px 1px 0; }
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 7px; border-radius: 2px;
  border: 1px solid var(--line-2);
  font: 500 0.6875rem/1.3 var(--mono); letter-spacing: 0.02em; text-transform: uppercase;
  color: var(--text-2); white-space: nowrap;
}
.tier-pill { color: var(--k); border-color: color-mix(in srgb, var(--k) 45%, transparent); background: color-mix(in srgb, var(--k) 10%, transparent); }
.pill-new { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, transparent); background: var(--ok-soft); animation: newglow 2.4s ease-in-out infinite; }
.pill-auto { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.pill-bad { color: var(--bad); border-color: var(--bad); }
.note { border-left: 2px solid var(--warn); background: color-mix(in srgb, var(--warn) 8%, transparent); padding: 8px 12px; font-size: 0.8125rem; color: var(--text-2); margin: 12px 0; }
.note-bad { border-color: var(--bad); background: var(--bad-soft); }
.empty { color: var(--text-3); padding: 24px 0; text-align: center; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--k); flex: none; }
.type-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--k); margin-right: 6px; flex: none; vertical-align: 0; }
.mech-tag { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--k); }
.mech-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--k); margin-right: 6px; }
.lk-label { color: var(--text-3); }
.ext { display: inline-flex; align-items: center; gap: 4px; }
.ext .ico { width: 12px; height: 12px; }
.hash { font-family: var(--mono); font-size: 0.75rem; word-break: break-all; color: var(--text-2); }
kbd { font-size: 0.6875rem; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 3px; padding: 0 5px; color: var(--text-3); background: var(--bg-2); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  height: var(--topbar-h);
  padding: 0 var(--gutter);
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
  background: color-mix(in srgb, var(--bg-1) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; flex: none; }
.brand:hover { text-decoration: none; }
.brand-glyph { width: 26px; height: 26px; }
.bg-stone { fill: var(--bg-0); stroke: var(--accent); stroke-width: 2; }
.bg-cut { fill: none; stroke: var(--text); stroke-width: 2.6; stroke-linejoin: miter; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 700; font-size: 0.875rem; letter-spacing: 0.22em; text-transform: uppercase; }
.brand-sub { font: 500 0.625rem/1.2 var(--mono); color: var(--text-3); letter-spacing: 0.06em; text-transform: uppercase; }

.tb-nav { display: flex; align-items: stretch; gap: 2px; height: 100%; margin-left: 12px; min-width: 0; flex: 0 1 auto; overflow: hidden; }
.tb-link {
  position: relative; display: inline-flex; align-items: center; gap: 7px;
  padding: 0 11px; color: var(--text-2); font-weight: 500; font-size: 0.8125rem;
  text-decoration: none; white-space: nowrap; border-radius: 0;
  transition: color 0.15s, background 0.15s;
}
.tb-link .ico { color: var(--text-3); transition: color 0.15s; }
.tb-link:hover { color: var(--text); background: var(--bg-hover); text-decoration: none; }
.tb-link[aria-current="page"] { color: var(--text); }
.tb-link[aria-current="page"] .ico { color: var(--accent); }
.tb-link::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; background: var(--accent); transform: scaleX(0); transition: transform 0.25s var(--ease); }
.tb-link[aria-current="page"]::after { transform: scaleX(1); }

.tb-right { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: none; }
.tb-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 10px;
  border: 1px solid var(--line-2); border-radius: var(--radius);
  background: var(--bg-2); color: var(--text-2); font-size: 0.8125rem;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.tb-btn:hover { background: var(--bg-hover); color: var(--text); border-color: var(--line-3); }
.tb-btn.icon-only { width: 32px; padding: 0; justify-content: center; }
.tb-search { min-width: 168px; color: var(--text-3); }
.tb-search kbd { margin-left: auto; }
.theme-toggle .i-moon { display: none; }
:root[data-theme="light"] .theme-toggle .i-moon { display: block; }
:root[data-theme="light"] .theme-toggle .i-sun { display: none; }
.menu-toggle { display: none; }

.live { display: inline-flex; align-items: center; gap: 6px; font: 500 0.6875rem/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ok); padding: 0 4px; }
.live-dot { position: relative; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.live-dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1px solid var(--ok); animation: ping 2s var(--ease) infinite; }

.seal-wrap, .lang-wrap { position: relative; }
.seal-badge {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 10px;
  border: 1px solid var(--line-2); border-radius: var(--radius);
  background: var(--bg-2); color: var(--text-2); font: 500 0.75rem/1 var(--mono);
}
.seal-badge:hover { border-color: var(--line-3); }
.seal-icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.seal-icon .i-ok, .seal-icon .i-bad { display: none; }
.seal-badge[data-state="ok"] { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: var(--ok-soft); }
.seal-badge[data-state="ok"] .i-ok { display: block; }
.seal-badge[data-state="broken"] { color: var(--bad); border-color: var(--bad); background: var(--bad-soft); }
.seal-badge[data-state="broken"] .i-bad { display: block; }
.seal-badge[data-state="pending"] .s-shield { animation: blink 1s ease-in-out infinite; }
.seal-text { display: inline-flex; gap: 8px; align-items: center; }
.st-hash { color: var(--text-3); }
.st-short { display: none; }
.popover {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
  width: min(360px, calc(100vw - 32px));
  background: var(--bg-1); border-radius: 4px; box-shadow: var(--shadow-pop);
  padding: 14px; animation: pop 0.18s var(--ease) both;
}
.seal-panel p { color: var(--text-2); font-size: 0.8125rem; }
.lang-pop { width: 220px; padding: 6px; list-style: none; margin: 0; }
.lang-pop a { display: flex; justify-content: space-between; padding: 8px 10px; border-radius: 2px; color: var(--text-2); }
.lang-pop a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.lang-pop a[aria-current="true"] { color: var(--accent); background: var(--accent-soft); }
.lang-pop .mono { color: var(--text-3); font-size: 0.6875rem; }

.progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; overflow: hidden; pointer-events: none; }
.progress.is-on::before { content: ""; position: absolute; top: 0; bottom: 0; width: 30%; background: linear-gradient(90deg, transparent, var(--accent), transparent); animation: slide 1.1s linear infinite; }

/* ---------- Sub bar ---------- */
.subbar {
  position: sticky; top: var(--topbar-h); z-index: 30;
  display: flex; align-items: center; gap: 16px; min-height: var(--subbar-h);
  padding: 0 var(--gutter);
  background: color-mix(in srgb, var(--bg-0) 90%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 0.75rem; color: var(--text-3); min-width: 0; white-space: nowrap; overflow: hidden; }
.crumbs a { color: var(--text-3); }
.crumbs a:hover { color: var(--text); }
.crumbs [aria-current="page"] { color: var(--text); }
.crumbs .sep { color: var(--line-3); }
.sub-tabs { display: flex; gap: 2px; align-self: stretch; overflow-x: auto; scrollbar-width: none; }
.sub-tabs::-webkit-scrollbar { display: none; }
.sub-tab { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; color: var(--text-2); font-size: 0.8125rem; font-weight: 500; white-space: nowrap; }
.sub-tab:hover { color: var(--text); text-decoration: none; background: var(--bg-hover); }
.sub-tab .st-n { font-size: 0.625rem; color: var(--text-3); }
.sub-tab[aria-selected="true"] { color: var(--text); }
.sub-tab[aria-selected="true"]::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; background: var(--accent); }
.sub-meta { margin: 0 0 0 auto; font-size: 0.6875rem; color: var(--text-3); white-space: nowrap; }

.banner-broken { background: var(--bad-soft); border-bottom: 1px solid var(--bad); color: var(--bad); padding: 10px var(--gutter); font-weight: 500; }

/* ---------- Page ---------- */
.view { display: block; max-width: var(--max); margin: 0 auto; padding: 20px var(--gutter) 40px; outline: none; min-height: 60vh; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 4px 0 18px; }
.page-title { font-size: 1.5rem; line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; }
.page-lead { margin: 6px 0 0; color: var(--text-2); max-width: 78ch; }
.section-title { font-size: 0.75rem; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); margin: 24px 0 10px; font-weight: 500; }
.back-link { margin-bottom: 12px; }

.boot { display: grid; place-items: center; min-height: 50vh; position: relative; }
.boot-grid { position: absolute; inset: 20% 30%; background: linear-gradient(90deg, transparent, var(--accent-soft), transparent); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: 4px; opacity: 0.6; }
.boot-text { position: relative; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; color: var(--text-3); font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; }

/* Dashboard grid */
.dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; align-items: start; }
.dash > * { grid-column: span 12; min-width: 0; }
.dash > [data-span="4"] { grid-column: span 4; }
.dash > [data-span="5"] { grid-column: span 5; }
.dash > [data-span="6"] { grid-column: span 6; }
.dash > [data-span="7"] { grid-column: span 7; }
.dash > [data-span="8"] { grid-column: span 8; }
.dash + .panel, .dash + .section-title, .act-grid + .panel { margin-top: 12px; }

.panel {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: var(--shadow);
  min-width: 0;
  position: relative;
  overflow: hidden;
}
.panel::before { content: ""; position: absolute; left: 0; top: 0; width: 24px; height: 1px; background: var(--accent); opacity: 0.7; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 14px 10px; border-bottom: 1px solid var(--line); }
.panel-titles { min-width: 0; }
.panel-title { display: flex; align-items: center; gap: 8px; font-size: 0.75rem; font-family: var(--mono); font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text); }
.panel-sub { margin: 3px 0 0; font-size: 0.75rem; color: var(--text-3); }
.panel-actions { display: flex; gap: 6px; flex: none; }
.panel-body { padding: 14px; }
.panel-warn { border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
.panel-warn::before { background: var(--warn); width: 100%; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.panel-kpis .kpis { border: 0; border-radius: 0; }
.kpis-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 14px; }
.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 14px; }
.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; background: var(--bg-1); color: var(--text); text-decoration: none; min-width: 0; transition: background 0.15s; }
a.kpi:hover { background: var(--bg-hover); text-decoration: none; }
.kpi-n { font: 600 1.75rem/1.1 var(--mono); letter-spacing: -0.02em; }
.kpi-sub { font-size: 0.75rem; color: var(--text-3); }
.kpi-warn .kpi-n { color: var(--warn); }
.kpi-court .kpi-n { color: var(--t-court); }
.kpi-seal { grid-column: span 2; }
.kpi-seal-state { font: 500 0.8125rem/1.4 var(--mono); color: var(--text-2); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.kpi-seal[data-state="ok"] .kpi-seal-state { color: var(--ok); }
.kpi-seal[data-state="broken"] .kpi-seal-state { color: var(--bad); }
.big-stat { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.big-stat .tnum { font: 600 2.25rem/1 var(--mono); color: var(--warn); }
.big-stat > span:last-child { color: var(--text-2); font-size: 0.8125rem; }

/* First visit strip */
.strip { display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 10px 14px; margin-bottom: 14px; border: 1px solid var(--line); border-left: 2px solid var(--warn); background: var(--bg-1); border-radius: 3px; font-size: 0.8125rem; color: var(--text-2); }
.strip strong { color: var(--text); margin-right: 4px; }
.strip-off .strip { display: none; }

/* Latest */
.panel-latest .panel-title .live-dot { margin-right: 2px; }
.latest-body { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; }
.latest-lead {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  padding: 16px; border: 1px solid var(--line-2); border-left: 3px solid var(--k);
  border-radius: 3px; color: var(--text); text-decoration: none;
  background: linear-gradient(135deg, color-mix(in srgb, var(--k) 10%, transparent), transparent 60%);
  transition: border-color 0.2s, transform 0.2s var(--ease);
}
.latest-lead:hover { text-decoration: none; border-color: var(--line-3); transform: translateY(-1px); }
.latest-lead::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, color-mix(in srgb, var(--k) 12%, transparent) 50%, transparent 70%); background-size: 250% 100%; animation: sweep 4s ease-in-out infinite; pointer-events: none; }
.ll-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.od-id { font-size: 0.75rem; color: var(--text-3); padding: 2px 6px; border: 1px solid var(--line-2); border-radius: 2px; }
.latest-title { font-size: 1.25rem; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
.latest-sum { color: var(--text-2); }
.latest-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.75rem; color: var(--text-3); }
.latest-meta > span { display: inline-flex; align-items: center; gap: 5px; }
.latest-meta .ico { width: 12px; height: 12px; }
.latest-go { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 500; font-size: 0.8125rem; margin-top: auto; }
.latest-go .ico { transition: transform 0.2s var(--ease); }
.latest-lead:hover .latest-go .ico { transform: translateX(3px); }
.latest-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.latest-list li + li { border-top: 1px solid var(--line); }
.latest-list a { display: flex; gap: 10px; padding: 10px 6px; color: var(--text); text-decoration: none; border-radius: 2px; transition: background 0.15s; }
.latest-list a:hover { background: var(--bg-hover); text-decoration: none; }
.latest-list .tier-glyph { margin-top: 4px; }
.ll-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ll-line { font-size: 0.6875rem; color: var(--text-3); }
.ll-t { font-size: 0.8125rem; line-height: 1.35; }

/* Charts */
.chart-wrap { position: relative; width: 100%; }
.chart-wrap svg { display: block; width: 100%; height: auto; overflow: visible; }
.scroll-x { overflow-x: auto; }
.scroll-x svg { min-width: 720px; }
.axis { font: 400 9px var(--mono); fill: var(--text-3); }
.grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 3; }
.baseline { stroke: var(--line-3); }
.col-seg { fill: var(--k); transform-box: fill-box; transform-origin: bottom; }
.col .col-hit { fill: transparent; }
.col.has { cursor: pointer; }
.col.has:hover .col-hit, .col.has:focus-visible .col-hit { fill: var(--accent-soft); }
.legend { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.75rem; color: var(--text-2); }
.legend li, .legend a { display: inline-flex; align-items: center; gap: 6px; color: inherit; }
.legend-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.legend-cols a:hover { color: var(--text); text-decoration: none; }
.lg-n { color: var(--text-3); font-family: var(--mono); margin-left: auto; }
.chart-empty { color: var(--text-3); text-align: center; padding: 32px 0; }

.donut-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; align-items: center; margin-bottom: 10px; }
.donut { width: 150px; height: 150px; }
.donut-track { fill: none; stroke: var(--bg-3); }
.donut-seg { fill: none; stroke: var(--k); stroke-linecap: butt; cursor: pointer; transition: opacity 0.15s; }
.donut:hover .donut-seg { opacity: 0.45; }
.donut .donut-seg:hover { opacity: 1; }
.donut-n { font: 600 28px var(--mono); fill: var(--text); }
.donut-sub { font: 500 9px var(--mono); fill: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em; }
.tier-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.tier-legend a { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 2px; color: var(--text-2); font-size: 0.8125rem; }
.tier-legend a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.tier-legend .tnum { margin-left: auto; font-family: var(--mono); color: var(--text); }

.barlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.bl-row { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(60px, 1fr) 32px; align-items: center; gap: 10px; padding: 6px; border-radius: 2px; color: var(--text); text-decoration: none; }
a.bl-row:hover { background: var(--bg-hover); text-decoration: none; }
.bl-label { display: flex; flex-direction: column; min-width: 0; font-size: 0.8125rem; line-height: 1.3; }
.bl-sub { font-size: 0.6875rem; color: var(--text-3); }
.bl-track { height: 8px; background: var(--bg-3); border-radius: 1px; overflow: hidden; }
.bl-fill { display: block; height: 100%; width: var(--w, 0%); background: var(--k, var(--accent)); border-radius: 1px; }
.bl-n { text-align: right; font-family: var(--mono); font-size: 0.8125rem; }

.stackbar { display: flex; gap: 2px; height: 10px; margin: 6px 0 4px; border-radius: 1px; overflow: hidden; background: var(--bg-3); }
.sb-seg { display: block; width: var(--w, 0%); flex: none; background: var(--k); }

.spark { display: block; width: 100%; height: 28px; }
.spark-area { fill: color-mix(in srgb, var(--k, var(--accent)) 16%, transparent); }
.spark-line { fill: none; stroke: var(--k, var(--accent)); stroke-width: 1.5; vector-effect: non-scaling-stroke; }

/* Map */
.panel-map .panel-body { display: grid; grid-template-columns: minmax(0, 1fr) 170px; gap: 14px; align-items: center; }
.map-wrap svg { display: block; width: 100%; height: auto; }
.d-land { fill: var(--line-3); }
.d-near { fill: var(--line); }
.mk { cursor: pointer; transition: opacity 0.4s; }
.mk-dot { fill: var(--k); stroke: var(--bg-1); stroke-width: 0.25; }
.mk-pulse { fill: color-mix(in srgb, var(--k) 25%, transparent); stroke: var(--k); stroke-width: 0.15; transform-box: fill-box; transform-origin: center; animation: pulse 2.6s var(--ease) infinite; animation-delay: calc(var(--d, 0) * 180ms); }
.mk:hover .mk-dot, .mk:focus-visible .mk-dot { stroke: var(--text); stroke-width: 0.35; }
.mk-n { font: 600 1.6px var(--mono); fill: var(--text); }
.mk.is-off { opacity: 0.06; }
.mk.is-off .mk-pulse { animation: none; }
.mk.is-now .mk-dot { stroke: var(--text); stroke-width: 0.4; }
.map-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; font-size: 0.8125rem; }
.map-legend a { display: flex; justify-content: space-between; gap: 8px; padding: 6px 8px; border-radius: 2px; color: var(--text-2); border-left: 2px solid var(--ty-place); background: var(--bg-2); }
.map-legend a:hover { color: var(--text); text-decoration: none; background: var(--bg-hover); }

/* Ontology layer cards */
.layer-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.layer-card {
  position: relative; display: flex; flex-direction: column; gap: 6px;
  padding: 16px; border: 1px solid var(--line-2); border-radius: 3px; color: var(--text);
  background: var(--bg-2); overflow: hidden; text-decoration: none;
  transition: border-color 0.2s, transform 0.2s var(--ease), background 0.2s;
}
.layer-card:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); background: var(--bg-hover); }
.layer-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--lc); }
.lc-semantic { --lc: var(--ty-provision); } .lc-kinetic { --lc: var(--ty-actor); } .lc-dynamic { --lc: var(--ty-outcome); }
.lc-n { font-size: 0.6875rem; color: var(--lc); }
.lc-name { font-size: 1.125rem; font-weight: 600; }
.lc-tag { color: var(--text-2); font-size: 0.8125rem; }
.lc-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 0.75rem; color: var(--text-3); }
.lc-stats .tnum { color: var(--text); font-family: var(--mono); font-weight: 600; }
.lc-go { position: absolute; right: 14px; top: 14px; color: var(--text-3); transition: transform 0.2s var(--ease), color 0.2s; }
.layer-card:hover .lc-go { transform: translateX(3px); color: var(--accent); }

.layer-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: var(--bg-1); margin-bottom: 10px; }
.ls-item { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; color: var(--text-2); text-decoration: none; transition: background 0.2s; }
.ls-item + .ls-item { border-left: 1px solid var(--line); }
.ls-item:hover { background: var(--bg-hover); text-decoration: none; }
.ls-semantic { --lc: var(--ty-provision); } .ls-kinetic { --lc: var(--ty-actor); } .ls-dynamic { --lc: var(--ty-outcome); }
.ls-n { font-size: 0.75rem; color: var(--lc); padding-top: 2px; }
.ls-text { display: flex; flex-direction: column; gap: 2px; }
.ls-name { font-weight: 600; color: var(--text); }
.ls-tag { font-size: 0.75rem; color: var(--text-3); }
.ls-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--lc); transform: scaleX(0); transform-origin: left; transition: transform 0.35s var(--ease); }
.ls-item[aria-current="page"] { background: color-mix(in srgb, var(--lc) 8%, var(--bg-1)); }
.ls-item[aria-current="page"] .ls-bar { transform: scaleX(1); }
.layer-desc { color: var(--text-2); max-width: 100ch; margin: 0 0 16px; font-size: 0.8125rem; }

/* Semantic */
.sem-grid { display: grid; grid-template-columns: 230px minmax(0, 1fr) 320px; gap: 12px; align-items: stretch; margin-bottom: 12px; }
.type-list { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.type-row { display: grid; grid-template-columns: 16px 10px minmax(0, 1fr) auto 24px; align-items: center; gap: 8px; padding: 6px 4px; border-radius: 2px; cursor: pointer; font-size: 0.8125rem; }
.type-row:hover { background: var(--bg-hover); }
.type-row input { margin: 0; accent-color: var(--accent); }
.type-row .type-dot { margin: 0; }
.tr-layer { font-size: 0.5625rem; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.tr-n { text-align: right; font-family: var(--mono); color: var(--text-3); }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; margin: 8px 0 10px; }
.seg-wrap { flex-wrap: wrap; }
.seg button { border: 0; background: var(--bg-2); color: var(--text-2); padding: 6px 10px; font-size: 0.75rem; }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button:hover { background: var(--bg-hover); color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.graph-body { padding: 0; position: relative; }
.graph-host { height: clamp(420px, 66vh, 760px); position: relative; background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--accent) 6%, transparent), transparent 70%); touch-action: none; }
.graph-host.is-active { box-shadow: inset 0 0 0 1px var(--accent-soft); }
.graph-hint { position: absolute; left: 12px; bottom: 8px; margin: 0; pointer-events: none; }
.graph-tools .tb-btn { height: 28px; width: 28px; }
.graph { display: block; width: 100%; height: 100%; cursor: grab; user-select: none; -webkit-user-select: none; }
.graph:active { cursor: grabbing; }
.g-link { stroke: var(--line-2); stroke-width: 0.8; transition: stroke 0.2s, opacity 0.2s; }
.lk-performed { stroke: color-mix(in srgb, var(--ty-action) 45%, var(--line-2)); stroke-dasharray: 3 2; }
.lk-resulted_in { stroke: color-mix(in srgb, var(--ty-outcome) 45%, var(--line-2)); stroke-dasharray: 1 2; }
.lk-committed_by { stroke: color-mix(in srgb, var(--ty-actor) 35%, var(--line-2)); }
.lk-engages { stroke: color-mix(in srgb, var(--ty-provision) 35%, var(--line-2)); }
.g-node { cursor: pointer; transition: opacity 0.2s; }
.g-node .nd-shape { fill: var(--k); stroke: var(--bg-1); stroke-width: 1.5; transition: transform 0.2s var(--ease); }
.g-node .nd-ring { fill: var(--bg-1); stroke: var(--k); stroke-width: 2.5; }
.g-node .nd-halo { fill: color-mix(in srgb, var(--k) 20%, transparent); opacity: 0; transition: opacity 0.2s; }
.nd-label { font: 500 8.5px var(--font); fill: var(--text-2); opacity: 0; pointer-events: none; paint-order: stroke; stroke: var(--bg-1); stroke-width: 3px; stroke-linejoin: round; transition: opacity 0.2s; }
.g-node.lbl-on .nd-label { opacity: 0.9; }
.g-node.ty-event .nd-label { font-family: var(--mono); font-size: 7.5px; }
.g-node:hover .nd-halo, .g-node.is-hot .nd-halo, .g-node.is-sel .nd-halo { opacity: 1; }
.g-node:hover .nd-label, .g-node.is-nb .nd-label, .g-node.is-sel .nd-label { opacity: 1; fill: var(--text); }
.g-node.is-sel .nd-shape { stroke: var(--text); stroke-width: 2; }
.graph.is-focus .g-node:not(.is-nb) { opacity: 0.16; }
.graph.is-focus .g-link { opacity: 0.08; }
.graph.is-focus .g-link.is-nb { opacity: 1; stroke: var(--accent); stroke-width: 1.4; stroke-dasharray: 4 3; animation: dash 1s linear infinite; }

.insp-empty { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; color: var(--text-2); }
.insp-type { margin-bottom: 4px; }
.insp-type .type-dot { margin-right: 0; }
.insp-title { font-size: 1rem; line-height: 1.35; margin-bottom: 12px; }
.sem-insp .panel-body { max-height: clamp(420px, 66vh, 760px); overflow: auto; }

/* Properties and links */
.props { display: grid; grid-template-columns: 1fr; gap: 0; margin: 0 0 14px; border-top: 1px solid var(--line); }
.props > div { display: grid; grid-template-columns: minmax(96px, 38%) minmax(0, 1fr); gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 0.8125rem; }
.props dt { color: var(--text-3); font-size: 0.75rem; }
.props dd { margin: 0; color: var(--text); min-width: 0; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.props-mono dd { font-family: var(--mono); }
.linkgroups { margin: 8px 0 14px; display: flex; flex-direction: column; gap: 10px; }
.linkgroups > div { display: flex; flex-direction: column; gap: 6px; }
.linkgroups dd { margin: 0; display: flex; flex-wrap: wrap; gap: 5px; }

.table-wrap { overflow-x: auto; }
.dtable { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.dtable th { text-align: left; font: 500 0.6875rem var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); padding: 8px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.dtable td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.dtable .num { text-align: right; }
.dtable tbody tr { transition: background 0.15s; }
.dtable tbody tr:hover { background: var(--bg-hover); }
.dtable-click tbody tr { cursor: pointer; }

/* Kinetic */
.pipeline { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.pl-step { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 12px; border: 1px solid var(--line-2); border-radius: 3px; background: var(--bg-2); min-width: 0; }
.pl-n { font-size: 0.625rem; color: var(--accent); }
.pl-name { font-weight: 600; font-size: 0.8125rem; }
.pl-count { font: 600 1.375rem/1.1 var(--mono); }
.pl-desc { color: var(--text-3); line-height: 1.4; }
.pl-wire { position: absolute; top: 24px; right: -11px; width: 12px; height: 2px; background: var(--line-3); z-index: 1; overflow: visible; }
.pl-packet { position: absolute; top: -2px; left: 0; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); animation: packet 1.8s linear infinite; animation-delay: calc(var(--d, 0) * 360ms); }
.act-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.act-card { display: flex; flex-direction: column; gap: 8px; padding: 14px; background: var(--bg-1); border: 1px solid var(--line); border-top: 2px solid var(--k, var(--line-2)); border-radius: 4px; }
.act-card header { display: flex; justify-content: space-between; align-items: baseline; }
.act-card:has(.m-physical) { --k: var(--m-physical); }
.act-card:has(.m-administrative) { --k: var(--m-administrative); }
.act-card:has(.m-digital) { --k: var(--m-digital); }
.act-card:has(.m-legal) { --k: var(--m-legal); }
.act-n { font: 600 1.5rem/1 var(--mono); }
.act-name { font-size: 0.9375rem; }
.act-actors { color: var(--text-3); margin: 0; }
.act-ids { display: flex; flex-wrap: wrap; gap: 4px; }
.act-ids .chip { font-size: 0.6875rem; min-height: 22px; padding: 1px 6px; }
.act-more { display: inline-flex; align-items: center; gap: 5px; margin-top: auto; }

.sankey { font: 500 10px var(--font); }
.sankey-heads { display: grid; grid-template-columns: 1fr 1fr 1fr; margin-bottom: 6px; }
.sankey-heads span:nth-child(2) { text-align: center; }
.sankey-heads span:last-child { text-align: right; }
.sk-band { fill: color-mix(in srgb, var(--k, var(--accent)) 26%, transparent); transition: fill 0.2s, opacity 0.2s; }
.sk-flow { fill: none; stroke: color-mix(in srgb, var(--k, var(--accent)) 80%, white); stroke-dasharray: 2 14; stroke-linecap: round; opacity: 0.55; animation: dash 1.6s linear infinite; pointer-events: none; }
.sk-link { cursor: pointer; }
.sk-node rect { fill: var(--k, var(--accent)); }
.sk-node { cursor: pointer; }
.sk-label { fill: var(--text-2); font-size: 10px; paint-order: stroke; stroke: var(--bg-1); stroke-width: 3px; stroke-linejoin: round; }
.sk-node:hover .sk-label, .sk-node:focus-visible .sk-label { fill: var(--text); }
.sankey.is-focus .sk-link { opacity: 0.15; }
.sankey.is-focus .sk-link.is-on { opacity: 1; }
.sankey.is-focus .sk-link.is-on .sk-band { fill: color-mix(in srgb, var(--k, var(--accent)) 50%, transparent); }

/* Dynamic */
.scrub { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; margin-bottom: 14px; padding: 10px 12px; border: 1px solid var(--line); background: var(--bg-2); border-radius: 3px; }
.scrub-year { font-size: 1.5rem; font-weight: 600; color: var(--accent); min-width: 4ch; }
.scrub input[type="range"] { width: 100%; accent-color: var(--accent); }
#dyn-play .i-pause { display: none; }
#dyn-play[aria-pressed="true"] .i-play { display: none; }
#dyn-play[aria-pressed="true"] .i-pause { display: block; }
.replay-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 190px; gap: 16px; align-items: center; }
.cum-area { fill: color-mix(in srgb, var(--k) 30%, transparent); }
.cum-line { fill: none; stroke: var(--text); stroke-width: 1.5; }
.cum-cursor line { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 3 3; }
.cum-cursor circle { fill: var(--accent); stroke: var(--bg-1); stroke-width: 2; }
.cum-cursor { transition: transform 0.25s var(--ease); }
.replay-stats { margin: 0; display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.replay-stats > div { background: var(--bg-1); padding: 8px 12px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.replay-stats dd { margin: 0; font: 600 1.125rem var(--mono); }
.lanes-wrap { position: relative; }
.lane-axis { position: relative; height: 18px; margin-left: 96px; margin-right: 76px; color: var(--text-3); border-bottom: 1px solid var(--line); }
.lane-axis span { position: absolute; left: var(--x); transform: translateX(-50%); font-size: 0.625rem; }
.lanes { list-style: none; margin: 0; padding: 0; }
.lane { display: grid; grid-template-columns: 96px minmax(0, 1fr) 76px; align-items: center; min-height: 28px; border-bottom: 1px solid var(--line); }
.lane:hover { background: var(--bg-hover); }
.lane-id { display: inline-flex; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--text-2); }
.lane-track { position: relative; height: 28px; background-image: linear-gradient(var(--line), var(--line)); background-size: 100% 1px; background-position: 0 50%; background-repeat: no-repeat; }
.lane-span { position: absolute; top: 50%; left: var(--x); width: var(--w); height: 4px; transform: translateY(-50%); background: color-mix(in srgb, var(--k) 45%, transparent); border-radius: 2px; transform-origin: left; }
.lane-pt { position: absolute; top: 50%; left: var(--x); width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--k); border: 2px solid var(--bg-1); cursor: help; transition: transform 0.15s; }
.lane-pt:hover { transform: scale(1.5); }
.lane-event { border-radius: 1px; transform: rotate(45deg); }
.lane-event:hover { transform: rotate(45deg) scale(1.5); }
.lane-pt.is-undated { background: transparent; border: 2px dashed var(--k); }
.lane-days { text-align: right; padding-right: 6px; color: var(--text-3); }

/* Ledger split view */
.split { display: grid; grid-template-columns: minmax(340px, 420px) minmax(0, 1fr); gap: 12px; align-items: start; }
.list-pane, .detail-pane { background: var(--bg-1); border: 1px solid var(--line); border-radius: 4px; min-width: 0; }
.list-pane { position: sticky; top: calc(var(--topbar-h) + var(--subbar-h) + 12px); max-height: calc(100vh - var(--topbar-h) - var(--subbar-h) - 36px); overflow: auto; overscroll-behavior: contain; }
.detail-pane { padding: 20px 22px; min-height: 60vh; }
.lp-head { padding: 14px 14px 0; }
.lp-head .page-title { font-size: 1.125rem; }
.lp-head .page-lead { font-size: 0.8125rem; }
.toolbar { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; background: var(--bg-1); }
.search { position: relative; display: block; }
.search .ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search input { width: 100%; height: 34px; padding: 0 10px 0 32px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--bg-0); color: var(--text); }
.search input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.tb-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tb-row-end { justify-content: space-between; }
.select { display: inline-flex; align-items: center; gap: 8px; font-size: 0.75rem; color: var(--text-3); }
.select select { height: 28px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--bg-2); color: var(--text); padding: 0 6px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 0.75rem; color: var(--text-2); cursor: pointer; position: relative; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-track { width: 28px; height: 16px; border-radius: 8px; background: var(--line-2); position: relative; transition: background 0.2s; flex: none; }
.toggle-track::after { content: ""; position: absolute; left: 2px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--text); transition: transform 0.2s var(--ease); }
.toggle input:checked + .toggle-track { background: var(--accent-2); }
.toggle input:checked + .toggle-track::after { transform: translateX(12px); }
.toggle input:focus-visible + .toggle-track { outline: 2px solid var(--focus); outline-offset: 2px; }
.facets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.facets:empty { display: none; }
.facet { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 8px; border: 1px solid var(--accent); background: var(--accent-soft); border-radius: 2px; font-size: 0.75rem; }
.facet button { display: inline-grid; place-items: center; width: 18px; height: 18px; border: 0; background: transparent; color: var(--text-2); border-radius: 2px; padding: 0; }
.facet button:hover { background: var(--bg-hover); color: var(--text); }
.facet .ico { width: 12px; height: 12px; }
.filter-count { margin: 0; padding: 8px 14px; font-size: 0.6875rem; color: var(--text-3); border-bottom: 1px solid var(--line); }
.lgroup-year { position: sticky; top: 0; display: flex; justify-content: space-between; padding: 6px 14px; font-size: 0.6875rem; color: var(--text-2); background: var(--bg-2); border-bottom: 1px solid var(--line); z-index: 1; }
.lrows ul, .lrows-flat { list-style: none; margin: 0; padding: 0; }
.lrow { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 10px; padding: 10px 14px; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line); border-left: 2px solid transparent; transition: background 0.15s, border-color 0.15s; }
.lrows-flat .lrow { border-left-color: var(--k); }
.lrow:hover { background: var(--bg-hover); text-decoration: none; border-left-color: var(--k); }
.lrow[aria-current="true"] { background: var(--accent-soft); border-left-color: var(--accent); }
.lrow.is-withdrawn { opacity: 0.55; }
.lr-glyph { padding-top: 3px; }
.lr-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.lr-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 0.6875rem; color: var(--text-3); }
.lr-id { color: var(--text-2); }
.lr-title { font-size: 0.8125rem; font-weight: 500; line-height: 1.35; }
.lr-meta { font-size: 0.75rem; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lr-laws { font-size: 0.6875rem; color: var(--ty-provision); align-self: center; }
.detail-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; min-height: 50vh; color: var(--text-2); }

/* Entry object view */
.objview { display: flex; flex-direction: column; gap: 18px; }
.od-head { display: flex; flex-direction: column; gap: 10px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.od-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.od-title { font-size: 1.5rem; line-height: 1.25; letter-spacing: -0.01em; max-width: 60ch; }
.od-sub { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; color: var(--text-3); font-size: 0.8125rem; }
.od-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.od-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; }
.od-sec { min-width: 0; }
.od-h { font: 600 0.6875rem/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.od-lead { font-size: 0.9375rem; line-height: 1.65; color: var(--text); max-width: 70ch; }
.od-context { color: var(--text-2); max-width: 70ch; padding-left: 12px; border-left: 2px solid var(--line-2); }
.od-links-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: center; }
.ego-wrap { border: 1px solid var(--line); border-radius: 3px; background: var(--bg-2); max-width: 560px; width: 100%; }
.ego { display: block; width: 100%; height: auto; }
.eg-line { stroke: var(--line-3); stroke-width: 1; }
.eg-node { cursor: pointer; }
.eg-node circle { fill: var(--k); stroke: var(--bg-2); stroke-width: 2; transition: r 0.15s; }
.eg-node:hover circle { r: 7.5; }
.eg-node text { font: 500 9px var(--font); fill: var(--text-2); paint-order: stroke; stroke: var(--bg-2); stroke-width: 3px; }
.eg-node:hover text { fill: var(--text); }
.eg-ring { fill: color-mix(in srgb, var(--k) 18%, var(--bg-2)); stroke: var(--k); stroke-width: 1.5; }
.eg-center .tier-glyph { overflow: visible; }
.cite-box textarea { width: 100%; min-height: 80px; margin-top: 6px; padding: 8px; border: 1px solid var(--line-2); border-radius: 3px; background: var(--bg-0); color: var(--text); font: 0.75rem/1.5 var(--mono); }

.lifeline { position: relative; list-style: none; margin: 10px 0 0; padding: 0 0 64px; height: 92px; }
.lifeline::before { content: ""; position: absolute; left: 0; right: 0; top: 10px; height: 2px; background: var(--line-2); }
.ll-pt { position: absolute; top: 4px; left: calc(var(--x) * 0.88%); }
.ll-dot { display: block; width: 14px; height: 14px; border-radius: 50%; background: var(--k); border: 3px solid var(--bg-1); box-shadow: 0 0 0 1px var(--k); }
.ll-pt:first-child .ll-dot { border-radius: 2px; transform: rotate(45deg); }
.ll-text { position: absolute; top: 20px; left: 0; display: flex; flex-direction: column; width: 140px; font-size: 0.75rem; line-height: 1.3; }
.ll-pt:nth-child(even) .ll-text { top: 48px; }
.ll-date { color: var(--text-3); font-size: 0.6875rem; }
.ll-label { color: var(--text-2); }

.law-list { display: flex; flex-direction: column; gap: 6px; }
.law-card { border: 1px solid var(--line-2); border-left: 2px solid var(--ty-provision); border-radius: 3px; background: var(--bg-2); }
.law-card summary { display: flex; align-items: center; gap: 12px; padding: 10px 12px; cursor: pointer; list-style: none; }
.law-card summary::-webkit-details-marker { display: none; }
.law-card summary:hover { background: var(--bg-hover); }
.law-short { color: var(--ty-provision); font-size: 0.8125rem; white-space: nowrap; }
.law-instrument { color: var(--text-2); font-size: 0.8125rem; min-width: 0; }
.law-chev { margin-left: auto; color: var(--text-3); transition: transform 0.2s var(--ease); }
.law-card[open] .law-chev { transform: rotate(180deg); }
.law-body { padding: 4px 14px 14px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.law-citation { font-size: 0.75rem; color: var(--text-3); margin: 0; }
.law-original { margin: 0; padding: 10px 12px; border-left: 2px solid var(--ty-provision); background: var(--bg-1); white-space: pre-line; font-size: 0.875rem; line-height: 1.6; }
.law-translation { margin: 0; white-space: pre-line; color: var(--text-2); font-size: 0.8125rem; display: flex; flex-direction: column; gap: 4px; }
.law-note { font-size: 0.75rem; color: var(--text-3); margin: 0; }

.sources { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.sources li { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.src-type { font-size: 0.625rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); padding-top: 2px; }
.src-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.src-title { font-size: 0.8125rem; font-weight: 500; overflow-wrap: anywhere; }
.src-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 0.75rem; color: var(--text-3); }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.checks li { display: flex; gap: 8px; font-size: 0.8125rem; }
.checks .yes .mark { color: var(--ok); }
.checks .no { color: var(--text-3); }
.amendments { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 0.8125rem; }
.a-head { font-size: 0.75rem; color: var(--text-3); }

/* Legal */
.mx-wrap { margin: 0 -14px; padding: 0 14px; }
.matrix { border-collapse: separate; border-spacing: 2px; font-size: 0.75rem; min-width: 720px; width: 100%; }
.matrix th, .matrix td { padding: 0; }
.mx-corner { text-align: left; vertical-align: bottom; padding: 4px 8px 4px 0 !important; min-width: 150px; }
.mx-corner .mono-label { display: block; font-size: 0.5625rem; }
.mx-group { font: 500 0.625rem var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); padding: 4px 6px !important; border-bottom: 2px solid var(--gk); text-align: left; }
.mx-constitution { --gk: var(--t-court); } .mx-statute { --gk: var(--ty-provision); } .mx-treaty { --gk: var(--accent); } .mx-declaration { --gk: var(--text-3); }
.mx-col { vertical-align: bottom; height: 140px; }
.mx-col a { display: flex; align-items: flex-end; justify-content: center; height: 140px; padding-bottom: 4px; color: var(--text-2); }
.mx-col a span { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; font-family: var(--mono); font-size: 0.6875rem; }
.mx-col a:hover { color: var(--text); text-decoration: none; }
.mx-row { text-align: left; }
.mx-row a { display: flex; flex-direction: column; padding: 6px 8px 6px 0; color: var(--text); }
.mx-row a:hover { text-decoration: none; color: var(--accent); }
.mx-actor { font-weight: 500; font-size: 0.8125rem; white-space: nowrap; }
.mx-kind { font-size: 0.625rem; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; font-family: var(--mono); }
.mx-cell { min-width: 44px; height: 38px; background: var(--bg-2); border-radius: 2px; }
.mx-cell.is-empty { background: color-mix(in srgb, var(--bg-2) 50%, transparent); }
.mx-cell a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 100%; height: 38px; color: var(--k); background: color-mix(in srgb, var(--k) 16%, transparent); border: 1px solid color-mix(in srgb, var(--k) 40%, transparent); border-radius: 2px; transition: transform 0.15s var(--ease), background 0.15s; }
.mx-cell a:hover { transform: scale(1.12); background: color-mix(in srgb, var(--k) 30%, transparent); text-decoration: none; position: relative; z-index: 2; }
.mx-n { font: 600 0.6875rem var(--mono); color: var(--text); }
.legal-stack { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.lsk { border: 1px solid var(--line-2); border-left: 3px solid var(--gk); border-radius: 3px; padding: 10px 12px; background: var(--bg-2); }
.lsk-constitution { --gk: var(--t-court); } .lsk-statute { --gk: var(--ty-provision); } .lsk-treaty { --gk: var(--accent); } .lsk-declaration { --gk: var(--text-3); }
.lsk-head { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin-bottom: 8px; }
.lsk-n { font-size: 0.6875rem; color: var(--gk); grid-row: span 2; padding-top: 2px; }
.lsk-name { font-weight: 600; font-size: 0.8125rem; }
.lsk-desc { color: var(--text-3); }
.lsk-insts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.lsk-inst { display: block; font-size: 0.75rem; color: var(--text-2); margin-bottom: 4px; }
.lsk-provs { display: flex; flex-wrap: wrap; gap: 4px; }
.prov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.prov-card { display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid var(--line-2); border-top: 2px solid var(--ty-provision); border-radius: 3px; background: var(--bg-2); color: var(--text); text-decoration: none; transition: transform 0.2s var(--ease), border-color 0.2s; }
.prov-card:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--line-3); }
.prov-card.is-quiet { opacity: 0.6; border-top-color: var(--line-3); }
.pc-top { display: flex; justify-content: space-between; align-items: center; }
.pc-short { color: var(--ty-provision); font-size: 0.8125rem; font-weight: 600; }
.pc-inst { font-size: 0.6875rem; color: var(--text-3); }
.pc-text { font-size: 0.75rem; color: var(--text-2); line-height: 1.45; flex: 1; }
.pc-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 0.6875rem; color: var(--text-3); }
.radial-wrap svg { max-height: 420px; }
.rd-orbit { fill: none; stroke: var(--line); stroke-dasharray: 2 4; }
.rd-l { stroke-width: 1; }
.rd-l1 { stroke: color-mix(in srgb, var(--k) 70%, transparent); }
.rd-l2 { stroke: color-mix(in srgb, var(--ty-actor) 40%, transparent); stroke-dasharray: 3 3; }
.rd-center circle { fill: color-mix(in srgb, var(--ty-provision) 18%, var(--bg-1)); stroke: var(--ty-provision); stroke-width: 1.5; }
.rd-c1 { font: 600 16px var(--font); fill: var(--ty-provision); }
.rd-c2 { font: 500 8px var(--mono); fill: var(--text-2); }
.rd-ev { cursor: pointer; }
.rd-ev circle { fill: var(--k); stroke: var(--bg-1); stroke-width: 2; transition: r 0.15s; }
.rd-ev:hover circle { r: 12; }
.rd-ev text { font: 600 7px var(--mono); fill: var(--bg-0); pointer-events: none; }
.rd-actor { cursor: pointer; }
.rd-actor rect { fill: var(--bg-2); stroke: var(--ty-actor); stroke-width: 1; }
.rd-actor text { font: 500 9px var(--font); fill: var(--text); }
.rd-actor:hover rect { fill: color-mix(in srgb, var(--ty-actor) 18%, var(--bg-2)); }

/* Integrity */
.chain-wrap { overflow-x: auto; padding-bottom: 6px; }
.chain { list-style: none; margin: 0; padding: 4px 0; display: flex; gap: 22px; }
.blk { position: relative; flex: none; width: 128px; }
.blk + .blk::before { content: ""; position: absolute; left: -22px; top: 50%; width: 22px; height: 2px; background: var(--line-2); }
.blk.is-ok + .blk::before, .blk.is-ok::before { background: var(--ok); }
.blk > a, .blk-genesis { display: flex; flex-direction: column; gap: 4px; padding: 10px; border: 1px solid var(--line-2); border-radius: 3px; background: var(--bg-2); color: var(--text); text-decoration: none; transition: border-color 0.25s, background 0.25s, box-shadow 0.25s; }
.blk > a:hover { text-decoration: none; border-color: var(--line-3); }
.blk-n { font-size: 0.625rem; color: var(--text-3); }
.blk-id { display: inline-flex; align-items: center; gap: 6px; font-size: 0.75rem; }
.blk-hash { font-size: 0.625rem; color: var(--text-3); word-break: break-all; }
.blk-state { height: 2px; background: var(--line-2); border-radius: 1px; margin-top: 4px; transition: background 0.25s; }
.blk.is-scan > a { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), 0 0 24px -4px var(--accent); }
.blk.is-ok > a, .blk-genesis { border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.blk.is-ok .blk-state { background: var(--ok); }
.blk.is-bad > a { border-color: var(--bad); background: var(--bad-soft); }
.blk.is-bad .blk-state { background: var(--bad); }
.verify-bar { height: 3px; background: var(--bg-3); border-radius: 2px; margin-top: 12px; overflow: hidden; }
.vb-fill { display: block; height: 100%; width: var(--w, 0%); background: var(--ok); transition: width 0.2s linear; }
.panel-verify[data-state="broken"] .vb-fill { background: var(--bad); }
.panel-verify[data-state="ok"] .panel-sub { color: var(--ok); }
.panel-verify[data-state="broken"] .panel-sub { color: var(--bad); }
.formula { margin: 0 0 14px; padding: 12px 14px; background: var(--bg-0); border: 1px solid var(--line); border-radius: 3px; color: var(--ty-provision); font-size: 0.8125rem; overflow-x: auto; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; counter-reset: s; }
.steps li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 8px; font-size: 0.8125rem; color: var(--text-2); }
.step-n { color: var(--accent); font-size: 0.75rem; }
.hash-big { display: block; padding: 10px 12px; background: var(--bg-0); border: 1px solid var(--line); border-radius: 3px; font-size: 0.8125rem; color: var(--ok); }
.checklist { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.checklist li { display: flex; gap: 8px; font-size: 0.8125rem; color: var(--text-2); }
.checklist .ico { color: var(--ok); margin-top: 2px; }

/* Docs */
.docs { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 32px; align-items: start; }
.toc { position: sticky; top: calc(var(--topbar-h) + var(--subbar-h) + 20px); padding: 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg-1); }
.toc ol { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.toc a { display: flex; gap: 8px; padding: 6px 8px; border-radius: 2px; font-size: 0.8125rem; color: var(--text-2); border-left: 2px solid transparent; }
.toc a .mono { color: var(--text-3); font-size: 0.6875rem; padding-top: 2px; }
.toc a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.toc a.is-on { color: var(--text); border-left-color: var(--accent); background: var(--accent-soft); }
.prose { max-width: 72ch; }
.prose-sec { padding: 4px 0 20px; border-bottom: 1px solid var(--line); margin-bottom: 20px; scroll-margin-top: calc(var(--topbar-h) + var(--subbar-h) + 20px); }
.prose-sec h2 { display: flex; gap: 10px; align-items: baseline; font-size: 1.125rem; margin-bottom: 10px; }
.sec-n { color: var(--accent); font-size: 0.75rem; }
.prose p { font-size: 0.9375rem; line-height: 1.7; color: var(--text-2); }

/* Status bar */
.statusbar { display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: center; max-width: var(--max); margin: 0 auto; padding: 14px var(--gutter) 22px; font-size: 0.6875rem; color: var(--text-3); border-top: 1px solid var(--line); }
.statusbar a { color: var(--text-2); }
.sb-item { display: inline-flex; gap: 6px; align-items: center; }
.sb-item:first-child { color: var(--text-2); }

/* Tab bar (phones) */
.tabbar { display: none; }

/* Drawer */
.scrim { position: fixed; inset: 0; z-index: 70; background: rgba(5, 8, 12, 0.6); backdrop-filter: blur(2px); animation: fade 0.2s both; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 80;
  width: min(380px, 92vw); display: flex; flex-direction: column;
  background: var(--bg-1); border-left: 1px solid var(--line-2); box-shadow: var(--shadow-pop);
  transform: translateX(100%); transition: transform 0.24s var(--ease);
  padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom);
}
.drawer.is-open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 0 14px; height: var(--topbar-h); border-bottom: 1px solid var(--line); flex: none; }
.drawer-title { font: 600 0.75rem var(--mono); text-transform: uppercase; letter-spacing: 0.08em; }
.drawer-body { overflow: auto; padding: 8px 14px 24px; overscroll-behavior: contain; }
.dm-label { font: 500 0.625rem var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); margin: 18px 0 6px; }
.dm-pages, .dm-langs, .dm-ext, .dm-subs { list-style: none; margin: 0; padding: 0; }
.dm-link { display: grid; grid-template-columns: 18px minmax(0, 1fr) 16px; gap: 12px; align-items: center; padding: 10px 8px; border-radius: 3px; color: var(--text); text-decoration: none; }
.dm-link:hover { background: var(--bg-hover); text-decoration: none; }
.dm-link[aria-current="page"] { background: var(--accent-soft); }
.dm-link[aria-current="page"] > .ico:first-child { color: var(--accent); }
.dm-link > .ico:first-child { color: var(--text-3); }
.dm-text { display: flex; flex-direction: column; gap: 1px; }
.dm-name { font-weight: 500; }
.dm-desc { font-size: 0.75rem; color: var(--text-3); line-height: 1.35; }
.dm-chev { color: var(--text-3); }
.dm-subs { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 8px 10px 38px; }
.dm-subs a { display: inline-block; padding: 4px 10px; border: 1px solid var(--line-2); border-radius: 2px; font-size: 0.75rem; color: var(--text-2); }
.dm-subs a[aria-current="page"] { border-color: var(--accent); color: var(--accent); }
.dm-langs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.dm-langs a { display: block; padding: 9px 10px; border: 1px solid var(--line-2); border-radius: 3px; color: var(--text-2); font-size: 0.8125rem; }
.dm-langs a[aria-current="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.dm-ext a { display: flex; align-items: center; gap: 10px; padding: 10px 8px; color: var(--text); border-radius: 3px; }
.dm-ext a:hover { background: var(--bg-hover); text-decoration: none; }
.dm-ext .dm-chev { margin-left: auto; }
.dm-foot { margin-top: 18px; color: var(--text-3); }
.drawer .seg { display: flex; width: 100%; }
.drawer .seg button { flex: 1; padding: 9px; }

/* Command palette */
.palette {
  position: fixed; z-index: 90; left: 50%; top: 12vh;
  width: min(640px, calc(100vw - 24px)); max-height: 70vh;
  display: flex; flex-direction: column;
  background: var(--bg-1); border-radius: 6px; box-shadow: var(--shadow-pop);
  transform: translateX(-50%); animation: palin 0.18s var(--ease) both; overflow: hidden;
}
.pal-input { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.pal-input .ico { color: var(--text-3); }
.pal-input input { flex: 1; height: 52px; border: 0; background: transparent; font-size: 1rem; outline: none; }
.pal-list { list-style: none; margin: 0; padding: 6px; overflow: auto; }
.pal-group { padding: 10px 10px 4px; font: 500 0.625rem var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); }
.pal-list a { display: grid; grid-template-columns: 16px minmax(0, 1fr) 16px; gap: 12px; align-items: center; padding: 9px 10px; border-radius: 3px; color: var(--text); text-decoration: none; }
.pal-list a .ico:first-child { color: var(--text-3); }
.pal-list [aria-selected="true"] a, .pal-list a:hover { background: var(--accent-soft); text-decoration: none; }
.pal-list [aria-selected="true"] .pal-go { opacity: 1; color: var(--accent); }
.pal-go { opacity: 0; }
.pal-text { display: flex; flex-direction: column; min-width: 0; }
.pal-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-sub { font-size: 0.75rem; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-empty { padding: 24px; text-align: center; color: var(--text-3); }

/* Tooltip and toast */
.tooltip {
  position: fixed; left: 0; top: 0; z-index: 120; max-width: 300px;
  padding: 6px 9px; border-radius: 3px; pointer-events: none;
  background: var(--text); color: var(--bg-0);
  font: 500 0.75rem/1.4 var(--font); box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.5);
}
.toast {
  position: fixed; left: 50%; bottom: calc(18px + var(--tabbar-h)); z-index: 95;
  transform: translateX(-50%); display: flex; align-items: center; gap: 12px;
  padding: 10px 12px 10px 14px; border-radius: 4px; background: var(--bg-1); box-shadow: var(--shadow-pop);
  font-size: 0.8125rem; animation: toastin 0.3s var(--ease) both; max-width: calc(100vw - 24px);
}

/* ---------- Motion ---------- */
.view-enter { animation: fade 0.3s ease both; }
.view-enter [data-reveal] { animation: reveal 0.55s var(--ease) both; animation-delay: calc(min(var(--i, 0), 14) * 45ms); }
.view-enter .anim-draw { stroke-dasharray: 1; animation: draw 1.1s var(--ease) both; animation-delay: calc(200ms + var(--d, 0) * 70ms); }
.view-enter .donut-seg.anim-draw { animation-duration: 0.9s; }
.view-enter .bl-fill, .view-enter .sb-seg, .view-enter .lane-span { animation: grow 0.9s var(--ease) both; animation-delay: calc(200ms + var(--d, 0) * 60ms); }
.view-enter .col-seg { animation: rise 0.7s var(--ease) both; }
.view-enter .col { --dd: var(--d, 0); }
.view-enter .col .col-seg { animation-delay: calc(150ms + var(--d, 0) * 18ms); }
.view-enter .sk-link { animation: fade 0.8s ease both; animation-delay: calc(200ms + var(--d, 0) * 25ms); }
.view-enter .mk { animation: pop 0.5s var(--ease) both; animation-delay: calc(300ms + var(--d, 0) * 60ms); transform-box: fill-box; transform-origin: center; }
.view-enter .eg-node, .view-enter .rd-ev, .view-enter .rd-actor { animation: fade 0.5s ease both; animation-delay: calc(400ms + var(--d, 0) * 60ms); }
.view-enter .mx-cell a { animation: pop 0.4s var(--ease) both; animation-delay: calc(200ms + var(--d, 0) * 20ms); }
.view-enter .lane, .view-enter .lsk, .view-enter .pl-step, .view-enter .ll-pt { animation: reveal 0.5s var(--ease) both; animation-delay: calc(200ms + var(--d, 0) * 50ms); }
.view-enter .blk { animation: reveal 0.4s var(--ease) both; animation-delay: calc(var(--d, 0) * 30ms); }

@keyframes fade { from { opacity: 0; } }
@keyframes reveal { from { opacity: 0; transform: translateY(8px); } }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes grow { from { width: 0; } }
@keyframes rise { from { transform: scaleY(0); } }
@keyframes pop { from { opacity: 0; transform: scale(0.6); } }
@keyframes pulse { 0% { transform: scale(0.6); opacity: 0.9; } 80%, 100% { transform: scale(2.2); opacity: 0; } }
@keyframes ping { 0% { transform: scale(0.6); opacity: 1; } 80%, 100% { transform: scale(1.8); opacity: 0; } }
@keyframes dash { to { stroke-dashoffset: -16; } }
@keyframes packet { 0% { left: -6px; opacity: 0; } 20% { opacity: 1; } 80% { opacity: 1; } 100% { left: 12px; opacity: 0; } }
@keyframes slide { from { left: -30%; } to { left: 100%; } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes sweep { 0%, 100% { background-position: 120% 0; } 50% { background-position: -20% 0; } }
@keyframes blink { 50% { opacity: 0.3; } }
@keyframes newglow { 50% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent); } }
@keyframes palin { from { opacity: 0; transform: translate(-50%, -8px) scale(0.98); } }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 12px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .anim-draw { stroke-dasharray: none !important; }
}

/* ---------- Layout tiers ---------- */

/* Desktop widths where every page still fits: trim chrome before trimming navigation. */
@media (max-width: 1599px) {
  .brand-sub { display: none; }
  .tb-search { min-width: 0; }
  .tb-search .lbl, .tb-search kbd { display: none; }
  .st-hash { display: none; }
}
@media (max-width: 1439px) {
  .tb-link .ico { display: none; }
  .tb-link { padding: 0 9px; }
}

/* Below desktop: secondary pages move into the menu. */
@media (max-width: 1279px) {
  .tb-link[data-priority="2"] { display: none; }
  .menu-toggle { display: inline-flex; }
  .tb-search { min-width: 0; }
  .tb-search kbd { display: none; }
  .st-hash { display: none; }
  .sem-grid { grid-template-columns: 220px minmax(0, 1fr); }
  .sem-insp { grid-column: span 2; }
  .sem-insp .panel-body { max-height: none; }
  .replay-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .replay-stats { grid-column: span 2; grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .replay-stats > div { flex-direction: column; align-items: flex-start; }
  .pipeline { grid-template-columns: repeat(5, minmax(120px, 1fr)); overflow-x: auto; }
}

/* iPad landscape, small laptops. */
@media (max-width: 1180px) {
  .tb-link { padding: 0 9px; }
  .tb-link .ico { display: none; }
  .live .lbl, .tb-search .lbl { display: none; }
  .brand-sub { display: none; }
}

/* iPad portrait and smaller tablets: the menu takes over navigation. */
@media (max-width: 1023px) {
  .tb-nav { display: none; }
  .dash > [data-span] { grid-column: span 12; }
  .dash > [data-span="4"], .dash > [data-span="5"], .dash > [data-span="6"], .dash > [data-span="7"] { grid-column: span 6; }
  .dash > .panel-kpis, .dash > .panel-map { grid-column: span 12; }
  .panel-kpis .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-seal { grid-column: span 3; }
  .split { grid-template-columns: minmax(0, 1fr); }
  .split.has-detail .list-pane { display: none; }
  .split:not(.has-detail) .detail-pane { display: none; }
  .list-pane { position: static; max-height: none; overflow: visible; }
  .toolbar, .lgroup-year { position: static; }
  .sem-grid { grid-template-columns: minmax(0, 1fr); }
  .sem-graph { order: -1; }
  .sem-insp { grid-column: auto; }
  .sem-types .type-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
  .graph-host { height: clamp(380px, 58vh, 640px); }
  .docs { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .toc { position: static; }
  .toc ol { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .od-grid, .od-links-grid { grid-template-columns: minmax(0, 1fr); }
  .layer-cards { grid-template-columns: minmax(0, 1fr); }
  .latest-body { grid-template-columns: minmax(0, 1fr); }
  .kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pl-wire { display: none; }
}

/* Phones. */
@media (max-width: 699px) {
  :root { --gutter: 12px; --topbar-h: 50px; --tabbar-h: calc(58px + env(safe-area-inset-bottom)); }
  body { font-size: 0.9375rem; }
  .topbar { gap: 6px; }
  .brand-text { display: none; }
  .tb-right { gap: 6px; }
  .lang-wrap { display: none; }
  .live { display: none; }
  .seal-badge { padding: 0 8px; }
  .st-long { display: none; }
  .st-short { display: inline; }
  .tb-search { width: 32px; padding: 0; justify-content: center; }
  .subbar { gap: 10px; flex-wrap: wrap; padding-top: 0; padding-bottom: 0; }
  .sub-meta { display: none; }
  .crumbs { font-size: 0.6875rem; }
  .sub-tabs { width: 100%; margin: 0 calc(var(--gutter) * -1); padding: 0 var(--gutter); border-top: 1px solid var(--line); min-height: 40px; }
  .sub-tab { flex: 1; justify-content: center; }
  .view { padding-top: 14px; }
  .page-title { font-size: 1.3rem; }
  .dash { gap: 10px; }
  .dash > [data-span] { grid-column: span 12 !important; }
  .panel-kpis .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-seal { grid-column: span 2; }
  .kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-n { font-size: 1.4rem; }
  .donut-row { grid-template-columns: 120px minmax(0, 1fr); }
  .donut { width: 120px; height: 120px; }
  .panel-map .panel-body { grid-template-columns: minmax(0, 1fr); }
  .map-legend { flex-direction: row; flex-wrap: wrap; }
  /* The sub bar already carries the three layer tabs on phones. */
  .layer-strip { display: none; }
  .crumbs { padding: 10px 0; }
  .replay-grid { grid-template-columns: minmax(0, 1fr); }
  .replay-stats { grid-column: auto; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scrub { grid-template-columns: auto minmax(0, 1fr); }
  .scrub > :last-child { display: none; }
  .lane { grid-template-columns: 78px minmax(0, 1fr) 52px; }
  .lane-axis { margin-left: 78px; margin-right: 52px; }
  .lane-id { font-size: 0.6875rem; }
  .pipeline { grid-template-columns: repeat(5, minmax(132px, 1fr)); }
  .detail-pane { padding: 14px; border-radius: 0; margin: 0 calc(var(--gutter) * -1); border-left: 0; border-right: 0; }
  .list-pane { margin: 0 calc(var(--gutter) * -1); border-radius: 0; border-left: 0; border-right: 0; }
  .od-title { font-size: 1.25rem; }
  .sources li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .lifeline { height: auto; padding: 0; display: flex; flex-direction: column; gap: 10px; }
  .lifeline::before { left: 6px; right: auto; top: 0; bottom: 0; width: 2px; height: auto; }
  .ll-pt { position: relative; top: 0; left: 0; display: flex; gap: 12px; align-items: flex-start; }
  .ll-text, .ll-pt:nth-child(even) .ll-text { position: static; width: auto; }
  .strip { flex-direction: column; align-items: flex-start; }
  .statusbar { padding-bottom: 12px; }
  .graph-host { height: 62vh; }
  .graph-hint { display: none; }
  .tooltip { max-width: 240px; }

  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    height: var(--tabbar-h); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--bg-1) 92%, transparent);
    backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
    border-top: 1px solid var(--line);
  }
  .tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: transparent; color: var(--text-3); font-size: 0.625rem; font-weight: 500; text-decoration: none; position: relative; }
  .tab .ico { width: 20px; height: 20px; }
  .tab:hover { text-decoration: none; color: var(--text); }
  .tab[aria-current="page"] { color: var(--accent); }
  .tab[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 2px; background: var(--accent); border-radius: 0 0 2px 2px; }
}

@media (max-width: 380px) {
  .seal-badge .seal-text { display: none; }
  .kpis-3 { grid-template-columns: minmax(0, 1fr); }
}

@media (hover: none) {
  .graph-hint { display: none; }
}

@media print {
  .topbar, .subbar, .tabbar, .statusbar, .toolbar, .strip, .drawer, .scrim { display: none !important; }
  body { background: #fff; color: #000; }
  .panel { box-shadow: none; }
}
