/* =========================================================================
   ATTESTOR — FORENSIC ARCHIVE
   Developer memory viewer rendered as a 1970s intelligence analyst workbench.
   Dark ink field, aged-paper cards, oxidized copper accents, wax stamps.
   ========================================================================= */

@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght,SOFT,WONK@9..144,300..900,0..100,0..1&family=Instrument+Sans:ital,wght@0,400..700;1,400..700&display=swap");

/* Mono stack falls back through IBM Plex Mono → ui-monospace → Menlo. */
/* Departure Mono was previously loaded from a CDN URL that 404'd; */
/* dropped to avoid console errors. Re-add via self-host when desired. */

:root {
  /* ink & paper */
  --ink:          #0A0C10;
  --ink-raised:  #11151B;
  --ink-deep:    #06080B;
  --paper:       #E8DFC6;
  --paper-warm:  #DFD3B1;
  --paper-aged:  #C9BB93;
  --paper-shade: #9B8E66;

  /* accents */
  --rust:        #C75146;   /* oxidized copper — primary */
  --rust-deep:   #8B2E26;
  --verdigris:   #4A7C7E;   /* aged metal */
  --brass:       #D4A84B;   /* stamp ink */
  --indigo:      #3B4A6B;   /* faded blueprint */
  --ghost:       rgba(232, 223, 198, 0.55);

  /* functional */
  --rule:        rgba(232, 223, 198, 0.14);
  --rule-strong: rgba(232, 223, 198, 0.30);
  --radius:      2px;       /* cards have almost no radius — they're paper */

  --f-display:   "Fraunces", "Canela", Georgia, serif;
  --f-body:      "Instrument Sans", "Neue Haas Grotesk", system-ui, sans-serif;
  --f-mono:      "Departure Mono", "IBM Plex Mono", ui-monospace, Menlo, monospace;
}

/* -------- Light theme overrides -------- */
[data-theme="light"] {
  --ink:          #F4F1EB;
  --ink-raised:   #FFFFFF;
  --ink-deep:     #EAE5DA;
  --paper:        #1A1C22;
  --paper-warm:   #2C2E34;
  --paper-aged:   #4A4D56;
  --paper-shade:  #6B6E78;

  --rust:         #B5382E;
  --rust-deep:    #8B2E26;
  --verdigris:    #3A6C6E;
  --brass:        #B8901E;
  --indigo:       #2E3D5A;
  --ghost:        rgba(26, 28, 34, 0.55);

  --rule:         rgba(26, 28, 34, 0.10);
  --rule-strong:  rgba(26, 28, 34, 0.22);
}
[data-theme="light"] body::before {
  background-image:
    linear-gradient(rgba(26,28,34,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(26,28,34,0.04) 1px, transparent 1px),
    linear-gradient(rgba(26,28,34,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(26,28,34,0.02) 1px, transparent 1px);
}
[data-theme="light"] body::after {
  background: radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,0.06) 100%);
}
[data-theme="light"] .card {
  background: #FFFFFF;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
[data-theme="light"] .topbar {
  background: rgba(244, 241, 235, 0.92);
  border-bottom-color: var(--rule-strong);
}
[data-theme="light"] .nav__link {
  color: var(--paper-aged);
}
[data-theme="light"] .nav__link--active,
[data-theme="light"] .nav__link:hover {
  color: var(--paper);
}
[data-theme="light"] .field {
  background: #FAFAF7;
  border-color: var(--rule-strong);
  color: var(--paper);
}
[data-theme="light"] .rail {
  background: rgba(244, 241, 235, 0.6);
}
[data-theme="light"] .ticker {
  background: rgba(244, 241, 235, 0.92);
  border-top-color: var(--rule-strong);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--f-body);
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: 0.005em;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* -------- Layered background: grid paper + grain + vignette -------- */
body::before {
  /* engineering grid */
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(232,223,198,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232,223,198,0.035) 1px, transparent 1px),
    linear-gradient(rgba(232,223,198,0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232,223,198,0.018) 1px, transparent 1px);
  background-size: 80px 80px, 80px 80px, 16px 16px, 16px 16px;
  pointer-events: none;
  z-index: 0;
}
body::after {
  /* vignette + faint horizontal scanlines */
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at center, transparent 0%, transparent 55%, rgba(0,0,0,0.55) 100%),
    repeating-linear-gradient(0deg, transparent 0 2px, rgba(255,255,255,0.012) 2px 3px);
  pointer-events: none;
  z-index: 0;
}

main, header, footer { position: relative; z-index: 1; }

/* ============================================================
   HEADER — filing-cabinet chrome
   ============================================================ */
.chrome {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: end;
  gap: 28px;
  padding: 28px 40px 0;
  border-bottom: 1px solid var(--rule-strong);
}
.mark {
  display: flex; align-items: baseline; gap: 12px;
}
.mark__glyph {
  width: 34px; height: 34px;
  border: 1.5px solid var(--paper);
  color: var(--paper);
  font-family: var(--f-display);
  font-weight: 500;
  font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  font-style: italic;
  transform: rotate(-6deg);
  position: relative;
}
.mark__glyph::after {
  content: ""; position: absolute; inset: -5px;
  border: 1px dashed var(--ghost); border-radius: 50%;
  opacity: 0.4;
}
.mark__word {
  font-family: var(--f-display);
  font-weight: 300;
  font-variation-settings: "opsz" 144, "SOFT" 30, "WONK" 1;
  font-size: 34px;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--paper);
}
.mark__word em { font-style: italic; color: var(--rust); font-weight: 400; }
.mark__sub {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ghost);
  margin-top: 8px;
  display: block;
}

.chrome__nav {
  display: flex;
  gap: 0;
  align-items: flex-end;
}
.tab {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ghost);
  text-decoration: none;
  padding: 10px 22px 9px;
  border: 1px solid var(--rule);
  border-bottom: none;
  background: linear-gradient(to top, rgba(232,223,198,0.02), transparent);
  position: relative;
  top: 1px;
  transition: color 0.15s, background 0.15s;
}
.tab:hover { color: var(--paper); background: rgba(232,223,198,0.04); }
.tab[aria-current="page"] {
  color: var(--paper);
  background: var(--ink-raised);
  border-color: var(--rule-strong);
  border-bottom: 1px solid var(--ink-raised);
  top: 2px;
}
.tab[aria-current="page"]::before {
  content: ""; position: absolute; left: 10px; top: 4px;
  width: 4px; height: 4px; background: var(--rust); border-radius: 50%;
  box-shadow: 0 0 8px var(--rust);
}

.chrome__ident {
  text-align: right;
  font-family: var(--f-mono);
  font-size: 10px;
  line-height: 1.6;
  color: var(--ghost);
  padding-bottom: 6px;
}
.chrome__ident b { color: var(--paper); font-weight: 400; }
.chrome__ident .dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--verdigris); box-shadow: 0 0 6px var(--verdigris);
  vertical-align: middle; margin-right: 6px;
}

/* ============================================================
   PAGE TITLE — editorial
   ============================================================ */
.page-head {
  padding: 36px 40px 24px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px;
  align-items: end;
  border-bottom: 1px dashed var(--rule-strong);
}
.page-head__title {
  font-family: var(--f-display);
  font-weight: 300;
  font-variation-settings: "opsz" 144, "SOFT" 50, "WONK" 1;
  font-size: clamp(48px, 6vw, 84px);
  line-height: 0.95;
  letter-spacing: -0.035em;
  color: var(--paper);
  margin: 0;
}
.page-head__title em {
  font-style: italic;
  color: var(--rust);
  font-variation-settings: "opsz" 144, "SOFT" 100;
}
.page-head__meta {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ghost);
  text-align: right;
  line-height: 1.7;
}
.page-head__meta b { color: var(--paper); font-weight: 400; }

/* ============================================================
   CONTROL RAIL — filters
   ============================================================ */
.workspace {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 40px;
  padding: 24px 40px 80px;
}

.rail {
  border-right: 1px dashed var(--rule-strong);
  padding-right: 32px;
}
.rail__section + .rail__section { margin-top: 28px; }
.rail__label {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--rust);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 10px;
  display: flex; justify-content: space-between;
}
.rail__label span { color: var(--ghost); letter-spacing: 0.2em; }

.field {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--rule-strong);
  color: var(--paper);
  font-family: var(--f-mono);
  font-size: 12px;
  padding: 8px 0 6px;
  margin-bottom: 12px;
  letter-spacing: 0.04em;
  outline: none;
  transition: border-color 0.15s;
}
.field::placeholder { color: var(--paper-shade); }
.field:focus { border-color: var(--rust); }

select.field {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--paper-shade) 50%),
                    linear-gradient(-45deg, transparent 50%, var(--paper-shade) 50%);
  background-position: calc(100% - 8px) 16px, calc(100% - 4px) 16px;
  background-size: 4px 4px;
  background-repeat: no-repeat;
  padding-right: 20px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--paper);
  background: transparent;
  border: 1px solid var(--rule-strong);
  padding: 9px 14px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.btn:hover { border-color: var(--rust); color: var(--rust); }
.btn--primary { border-color: var(--rust); color: var(--rust); }
.btn--primary:hover { background: var(--rust); color: var(--ink); }

/* ============================================================
   EVIDENCE GRID — cards
   ============================================================ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 28px;
  padding-top: 4px;
}

.card {
  background: var(--paper);
  color: var(--ink);
  padding: 22px 22px 18px;
  position: relative;
  border: 1px solid var(--paper-shade);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.08) inset,
    0 18px 30px -18px rgba(0,0,0,0.9),
    0 4px 10px -2px rgba(0,0,0,0.5);
  transition: transform 0.28s cubic-bezier(.2,.8,.2,1),
              box-shadow 0.28s;
  text-decoration: none;
  color: var(--ink);
  transform: rotate(var(--tilt, 0deg));
  will-change: transform;
}
.card::before {
  /* paper grain — a second noise-ish layer */
  content: "";
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(45deg,
      transparent 0 2px,
      rgba(155, 142, 102, 0.05) 2px 3px);
  pointer-events: none;
}
.card::after {
  /* pushpin */
  content: "";
  position: absolute;
  top: -7px; left: 50%;
  width: 12px; height: 12px;
  transform: translateX(-50%);
  background: radial-gradient(circle at 35% 30%, #E85A4F 0%, #A21D16 60%, #5E100C 100%);
  border-radius: 50%;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.5) inset,
    0 4px 6px -1px rgba(0,0,0,0.7);
}
.card:hover {
  transform: rotate(0deg) translateY(-3px);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.1) inset,
    0 24px 40px -14px rgba(0,0,0,0.95),
    0 8px 14px -2px rgba(0,0,0,0.6);
  z-index: 3;
}

.card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.card__ns {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--paper-shade);
  display: inline-flex; align-items: center; gap: 6px;
}
.card__ns::before {
  content: ""; width: 6px; height: 6px;
  background: var(--rust); display: inline-block;
  transform: rotate(45deg);
}

.stamp {
  width: 64px; height: 64px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--rust);
  border: 2px solid var(--rust);
  border-radius: 50%;
  transform: rotate(-8deg);
  text-align: center;
  line-height: 1;
  background: transparent;
  position: relative;
  flex-shrink: 0;
  opacity: 0.85;
  /* faux ink imperfection */
  filter: contrast(1.1) blur(0.15px);
}
.stamp::before {
  content: ""; position: absolute; inset: 4px;
  border: 1px solid var(--rust);
  border-radius: 50%;
  opacity: 0.5;
}
.stamp__pct { font-size: 18px; font-weight: 400; display: block; }
.stamp__label { font-size: 7px; letter-spacing: 0.2em; display: block; margin-top: 2px; }
.stamp--superseded { color: var(--paper-shade); border-color: var(--paper-shade); }
.stamp--superseded::before { border-color: var(--paper-shade); }
.stamp--decayed { color: var(--brass); border-color: var(--brass); }
.stamp--decayed::before { border-color: var(--brass); }

.card__body {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 17px;
  line-height: 1.4;
  color: var(--ink);
  min-height: 90px;
  font-variation-settings: "opsz" 14, "SOFT" 50;
  letter-spacing: -0.01em;
  position: relative;
  z-index: 1;
}

.card__rule {
  border: none;
  border-top: 1px dashed var(--paper-shade);
  margin: 14px 0 10px;
}
.card__foot {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 10px;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--paper-shade);
  text-transform: uppercase;
  position: relative;
  z-index: 1;
}
.tags { display: flex; flex-wrap: wrap; gap: 4px; max-width: 70%; }
.tag {
  background: transparent;
  border: 1px solid var(--paper-shade);
  padding: 2px 6px;
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--ink);
}

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--ghost);
  font-family: var(--f-display);
  font-style: italic;
  font-size: 22px;
  font-variation-settings: "opsz" 144, "SOFT" 100;
  letter-spacing: -0.01em;
}

/* ============================================================
   DETAIL — dossier
   ============================================================ */
.dossier {
  padding: 24px 40px 80px;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 48px;
}
.dossier__crumbs {
  grid-column: 1 / -1;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ghost);
  padding-bottom: 18px;
  border-bottom: 1px dashed var(--rule-strong);
  margin-bottom: 28px;
}
.dossier__crumbs a { color: var(--ghost); text-decoration: none; }
.dossier__crumbs a:hover { color: var(--rust); }
.dossier__crumbs span { color: var(--rust); }

.sheet {
  background: var(--paper);
  color: var(--ink);
  padding: 52px 56px 44px;
  position: relative;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.08) inset,
    0 28px 60px -20px rgba(0,0,0,0.92),
    0 8px 24px -8px rgba(0,0,0,0.5);
  border: 1px solid var(--paper-shade);
}
.sheet::before {
  /* fold line across top, decorative */
  content: "";
  position: absolute;
  top: 0; left: 52px; right: 52px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,0,0,0.15), transparent);
}
.sheet__classification {
  position: absolute;
  top: 14px; left: 24px;
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.4em;
  color: var(--rust);
  text-transform: uppercase;
}
.sheet__classification::before {
  content: "◉ "; color: var(--rust);
}

.sheet__stamp {
  position: absolute;
  top: 34px; right: 56px;
  transform: rotate(9deg);
}

.sheet__id {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--paper-shade);
  text-transform: uppercase;
  margin-bottom: 10px;
}
.sheet__id b { color: var(--ink); font-weight: 400; }

.sheet__title {
  font-family: var(--f-display);
  font-weight: 350;
  font-variation-settings: "opsz" 144, "SOFT" 40, "WONK" 0;
  font-size: 42px;
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin: 0 0 26px;
}
.sheet__title em { font-style: italic; color: var(--rust-deep); }

.dataline {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 16px;
  padding: 6px 0;
  border-top: 1px dashed var(--paper-shade);
  font-family: var(--f-mono);
  font-size: 11px;
}
.dataline:last-child { border-bottom: 1px dashed var(--paper-shade); }
.dataline__k {
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--paper-shade);
  font-size: 10px;
  padding-top: 2px;
}
.dataline__v { color: var(--ink); letter-spacing: 0.02em; word-break: break-all; }
.dataline__v .hl { color: var(--rust-deep); }

/* dossier side panel */
.aside {
  border-left: 1px dashed var(--rule-strong);
  padding-left: 32px;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--ghost);
}
.aside h3 {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--rust);
  margin: 0 0 12px;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 6px;
}
.aside + .aside { margin-top: 28px; }
.aside ul { list-style: none; padding: 0; margin: 0; }
.aside li { padding: 6px 0; border-bottom: 1px dashed var(--rule); }
.aside li a { color: var(--paper); text-decoration: none; }
.aside li a:hover { color: var(--rust); }
.aside__meta { color: var(--paper-shade); font-size: 10px; letter-spacing: 0.12em; }

/* tabs under the sheet */
.tabs {
  margin-top: 32px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  display: flex;
  padding: 0 4px;
}
.tabs__item {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ghost);
  padding: 14px 20px;
  text-decoration: none;
  position: relative;
  border-right: 1px dashed var(--rule);
  cursor: pointer;
  background: transparent;
  border-top: none; border-bottom: none; border-left: none;
}
.tabs__item:hover { color: var(--paper); }
.tabs__item[aria-current="page"] { color: var(--rust); }
.tabs__item[aria-current="page"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px;
  height: 2px; background: var(--rust);
}

.panel {
  padding: 28px 4px;
  font-family: var(--f-mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--paper);
}
.panel h4 {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--rust);
  margin: 24px 0 10px;
}
.panel h4:first-child { margin-top: 0; }

.chain {
  list-style: none; padding: 0; margin: 0;
  position: relative;
}
.chain::before {
  content: ""; position: absolute;
  top: 6px; bottom: 6px; left: 8px;
  width: 2px;
  background: repeating-linear-gradient(to bottom, var(--rust) 0 4px, transparent 4px 8px);
}
.chain li {
  padding: 10px 0 10px 28px;
  position: relative;
}
.chain li::before {
  content: ""; position: absolute;
  left: 2px; top: 14px;
  width: 12px; height: 12px;
  border: 2px solid var(--rust);
  background: var(--ink);
  border-radius: 50%;
}
.chain li.is-current::before { background: var(--rust); }
.chain li a { color: var(--paper); text-decoration: none; }
.chain li a:hover { color: var(--rust); }
.chain__ts { font-size: 10px; letter-spacing: 0.2em; color: var(--paper-shade); text-transform: uppercase; }

.kv {
  display: grid; grid-template-columns: 180px 1fr;
  gap: 0; font-family: var(--f-mono); font-size: 11px;
  border-top: 1px dashed var(--rule);
}
.kv > dt, .kv > dd {
  padding: 10px 0;
  border-bottom: 1px dashed var(--rule);
  margin: 0;
}
.kv > dt { color: var(--ghost); letter-spacing: 0.18em; text-transform: uppercase; font-size: 10px; }
.kv > dd { color: var(--paper); word-break: break-all; }
.kv > dd code { background: rgba(232,223,198,0.06); padding: 1px 6px; color: var(--brass); }

.neighbor {
  display: grid; grid-template-columns: 60px 1fr 80px;
  gap: 14px; align-items: center;
  padding: 12px 0;
  border-bottom: 1px dashed var(--rule);
  font-size: 11px;
}
.neighbor__score {
  font-family: var(--f-mono); color: var(--rust);
  font-size: 14px; letter-spacing: 0.05em;
}
.neighbor__content {
  font-family: var(--f-display); font-size: 14px; color: var(--paper);
  line-height: 1.4;
}
.neighbor__meta { font-family: var(--f-mono); font-size: 9px; color: var(--ghost); letter-spacing: 0.2em; text-transform: uppercase; text-align: right; }

/* edges tab */
.edge {
  display: grid; grid-template-columns: 1fr auto 1fr;
  gap: 14px; align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed var(--rule);
  font-size: 11px;
}
.edge__node { font-family: var(--f-display); font-size: 16px; color: var(--paper); }
.edge__kind {
  font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.28em;
  text-transform: uppercase; color: var(--rust);
  padding: 2px 10px; border: 1px solid var(--rust);
}

/* ============================================================
   GRAPH — Cytoscape canvas + inspector
   ============================================================ */
.graph-area {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 0;
  min-height: calc(100vh - 260px);
}

.graph-canvas {
  background: var(--ink-deep);
  border: 1px solid var(--rule);
  position: relative;
  min-height: 500px;
}
/* faint grid overlay on graph canvas */
.graph-canvas::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(232,223,198,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232,223,198,0.025) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

.graph-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-display);
  font-style: italic;
  font-size: 20px;
  color: var(--ghost);
  text-align: center;
  line-height: 1.6;
  font-variation-settings: "opsz" 144, "SOFT" 100;
}

/* ---- Inspector panel ---- */
.graph-inspector {
  border-left: 1px solid var(--rule);
  background: var(--ink-raised);
  padding: 20px;
  overflow-y: auto;
  max-height: calc(100vh - 260px);
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--ghost);
}

.graph-inspector__empty {
  padding: 40px 0;
  text-align: center;
  font-family: var(--f-display);
  font-style: italic;
  font-size: 15px;
  color: var(--ghost);
  font-variation-settings: "opsz" 144, "SOFT" 100;
  opacity: 0.5;
}

.graph-inspector__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--rule-strong);
}
.graph-inspector__dot {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid;
  flex-shrink: 0;
}
.graph-inspector__name {
  font-family: var(--f-display);
  font-size: 20px;
  font-weight: 400;
  color: var(--paper);
  line-height: 1.2;
  font-variation-settings: "opsz" 28, "SOFT" 50;
}
.graph-inspector__type {
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--rust);
  margin-top: 2px;
}

.graph-inspector__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--rule);
}
.graph-inspector__stat { text-align: center; }
.graph-inspector__stat-val {
  display: block;
  font-size: 16px;
  color: var(--paper);
  font-family: var(--f-mono);
}
.graph-inspector__stat-lbl {
  display: block;
  font-size: 8px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ghost);
  margin-top: 2px;
}

.graph-inspector__section-label {
  font-size: 9px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--rust);
  margin: 14px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--rule);
}

.graph-inspector__edges,
.graph-inspector__neighbors {
  list-style: none;
  padding: 0;
  margin: 0;
}
.graph-inspector__edges li {
  padding: 5px 0;
  border-bottom: 1px dashed var(--rule);
  font-size: 10px;
  color: var(--paper);
}
.graph-inspector__edge-type {
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--brass);
  text-transform: uppercase;
}

.graph-inspector__neighbor {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--rule);
  cursor: pointer;
  color: var(--paper);
  font-size: 10px;
  transition: color 0.15s;
}
.graph-inspector__neighbor:hover { color: var(--rust); }
.graph-inspector__ndot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ---- Legend ---- */
.graph-legend__list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.graph-legend__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--ghost);
}
.graph-legend__dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 1.5px solid;
  flex-shrink: 0;
}

/* ============================================================
   RECALL PIPELINE — layer cascade replay
   ============================================================ */
.recall-area {
  min-height: 400px;
}

.recall-empty,
.recall-loading {
  padding: 80px 20px;
  text-align: center;
  font-family: var(--f-display);
  font-style: italic;
  font-size: 20px;
  color: var(--ghost);
  font-variation-settings: "opsz" 144, "SOFT" 100;
}

.recall-warnings {
  margin: 16px 0 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.recall-warning {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--rust, #c04a2a);
  background: rgba(192, 74, 42, 0.08);
  border-left: 3px solid var(--rust, #c04a2a);
  padding: 10px 14px;
  line-height: 1.5;
}

.recall-header {
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 1px dashed var(--rule-strong);
}
.recall-header__query {
  font-family: var(--f-display);
  font-size: 28px;
  font-weight: 350;
  color: var(--paper);
  font-variation-settings: "opsz" 44, "SOFT" 50;
  font-style: italic;
}
.recall-header__meta {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ghost);
  margin-top: 8px;
}

.recall-pipeline {
  position: relative;
}

/* ---- Layer card ---- */
@keyframes layer-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.recall-layer {
  background: var(--ink-raised);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--layer-color, var(--ghost));
  padding: 20px 24px;
  margin-bottom: 0;
  animation: layer-in 0.4s cubic-bezier(.2,.8,.2,1) both;
}

.recall-layer__head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}
.recall-layer__icon {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--layer-color, var(--ghost));
  color: var(--layer-color, var(--ghost));
  font-family: var(--f-mono);
  font-size: 14px;
  flex-shrink: 0;
}
.recall-layer__info { flex: 1; }
.recall-layer__name {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--layer-color, var(--paper));
}
.recall-layer__desc {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--ghost);
  margin-top: 2px;
}
.recall-layer__count {
  font-family: var(--f-mono);
  font-size: 24px;
  color: var(--layer-color, var(--paper));
  font-weight: 400;
  min-width: 40px;
  text-align: right;
}

.recall-layer__meta {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--ghost);
  margin-bottom: 10px;
  padding: 6px 0;
  border-top: 1px dashed var(--rule);
}

.recall-tag {
  display: inline-block;
  background: transparent;
  border: 1px solid var(--rule-strong);
  padding: 1px 6px;
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--paper);
  margin: 0 2px;
}

.recall-layer__empty {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--ghost);
  font-style: italic;
  padding: 8px 0;
}

/* ---- Result row ---- */
.recall-layer__results {
  border-top: 1px dashed var(--rule);
  max-height: 320px;
  overflow-y: auto;
}

.recall-result {
  display: grid;
  grid-template-columns: 32px 1fr 120px;
  gap: 12px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px dashed var(--rule);
  font-size: 11px;
}
.recall-result--final {
  border-left: 2px solid var(--rust);
  padding-left: 10px;
}

.recall-result__rank {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--ghost);
  text-align: center;
  padding-top: 2px;
}
.recall-result__body { min-width: 0; }
.recall-result__content {
  font-family: var(--f-display);
  font-size: 13px;
  color: var(--paper);
  line-height: 1.4;
  font-variation-settings: "opsz" 14, "SOFT" 50;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.recall-result__meta {
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ghost);
  margin-top: 4px;
}
.recall-result__source {
  color: var(--brass);
}

.recall-result__score {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--rust);
}
.recall-result__bar {
  height: 3px;
  background: var(--rust);
  flex-shrink: 0;
  min-width: 4px;
  opacity: 0.7;
}

/* ---- Connector ---- */
.recall-connector {
  text-align: center;
  padding: 4px 0;
  color: var(--ghost);
  font-size: 10px;
  opacity: 0.5;
}

/* RECALL PIPELINE DIAGRAM */
@keyframes diagram-step-in {
  from { opacity: 0; transform: translateY(10px) scale(0.92); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes diagram-arrow-in {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: translateX(0); }
}

.recall-diagram {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 24px 0 32px;
  flex-wrap: wrap;
}

.recall-diagram__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 18px 12px;
  background: var(--ink-raised);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--layer-color, var(--ghost));
  min-width: 100px;
  text-align: center;
  animation: diagram-step-in 0.45s cubic-bezier(.2,.8,.2,1) both;
  transition: border-color 0.2s, transform 0.2s;
}
.recall-diagram__step:hover {
  border-color: var(--layer-color, var(--ghost));
  transform: translateY(-2px);
}

.recall-diagram__num {
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ghost);
  margin-bottom: 4px;
}
.recall-diagram__name {
  font-family: var(--f-display);
  font-size: 13px;
  font-weight: 400;
  color: var(--paper);
  font-variation-settings: "opsz" 14, "SOFT" 50;
  line-height: 1.2;
  margin-bottom: 6px;
}
.recall-diagram__count {
  font-family: var(--f-mono);
  font-size: 22px;
  color: var(--layer-color, var(--paper));
  line-height: 1;
}
.recall-diagram__count-label {
  font-family: var(--f-mono);
  font-size: 8px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ghost);
  margin-top: 3px;
}

.recall-diagram__arrow {
  font-family: var(--f-mono);
  font-size: 16px;
  color: var(--ghost);
  padding: 0 6px;
  opacity: 0.5;
  animation: diagram-arrow-in 0.35s cubic-bezier(.2,.8,.2,1) both;
  user-select: none;
}

.recall-diagram__summary {
  width: 100%;
  text-align: center;
  padding: 16px 0 0;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--ghost);
}
.recall-diagram__summary-count {
  color: var(--paper);
  font-size: 12px;
}

.recall-funnel {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 12px 0 6px;
  flex-wrap: wrap;
}
.recall-funnel__step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ghost);
}
.recall-funnel__step-name {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 9px;
}
.recall-funnel__step-count {
  color: var(--paper);
  font-size: 12px;
}
.recall-funnel__arrow {
  padding: 0 8px;
  color: var(--ghost);
  opacity: 0.4;
  font-size: 10px;
}

@media (max-width: 960px) {
  .recall-diagram { padding: 16px 0 20px; }
  .recall-diagram__step { min-width: 70px; padding: 10px 10px 8px; }
  .recall-diagram__name { font-size: 11px; }
  .recall-diagram__count { font-size: 18px; }
  .recall-diagram__arrow { padding: 0 3px; font-size: 12px; }
  .recall-funnel { gap: 0; }
  .recall-funnel__arrow { padding: 0 4px; }
}

/* ---- Config sidebar ---- */
.recall-config-list {
  font-family: var(--f-mono);
  font-size: 10px;
}
.recall-config-item {
  padding: 5px 0;
  border-bottom: 1px dashed var(--rule);
  color: var(--paper);
}
.recall-config-item span {
  color: var(--ghost);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-right: 8px;
}

@media (max-width: 960px) {
  .graph-area {
    grid-template-columns: 1fr;
  }
  .graph-inspector {
    border-left: none;
    border-top: 1px solid var(--rule);
    max-height: 300px;
  }
}

/* ============================================================
   TICKER — bottom status strip
   ============================================================ */
.ticker {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--ink-deep);
  border-top: 1px solid var(--rule-strong);
  padding: 6px 20px;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--ghost);
  text-transform: uppercase;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}
.ticker__pulse::before {
  content: "●"; color: var(--rust); animation: pulse 1.2s ease-in-out infinite;
  margin-right: 6px;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }

/* ============================================================
   PAGE-LOAD CHOREOGRAPHY
   ============================================================ */
@keyframes raise {
  from { opacity: 0; transform: translateY(12px) rotate(var(--tilt, 0deg)); }
  to   { opacity: 1; transform: translateY(0)    rotate(var(--tilt, 0deg)); }
}
.card {
  animation: raise 0.6s cubic-bezier(.2,.8,.2,1) both;
  animation-delay: calc(var(--i, 0) * 40ms);
}
@keyframes sheet-in {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.sheet { animation: sheet-in 0.5s cubic-bezier(.2,.8,.2,1) both; }

@keyframes reveal {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}
.page-head, .rail { animation: reveal 0.55s cubic-bezier(.2,.8,.2,1) both; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 960px) {
  .workspace { grid-template-columns: 1fr; }
  .rail { border-right: none; border-bottom: 1px dashed var(--rule-strong); padding: 0 0 24px; }
  .dossier { grid-template-columns: 1fr; }
  .aside { border-left: none; padding-left: 0; border-top: 1px dashed var(--rule-strong); padding-top: 28px; }
  .chrome { flex-wrap: wrap; padding: 20px; grid-template-columns: 1fr; }
  .chrome__nav { order: 3; overflow-x: auto; }
  .page-head { padding: 24px 20px; grid-template-columns: 1fr; }
  .sheet { padding: 40px 24px 32px; }
}

/* ============================================================
   SELECTION
   ============================================================ */
/* ============================================================
   TIMELINE — temporal spine with supersession chains
   ============================================================ */
.tl-content { position: relative; min-height: 400px; }
.tl-empty, .tl-loading {
  padding: 80px 20px; text-align: center;
  font-family: var(--f-display); font-style: italic; font-size: 20px;
  color: var(--ghost); font-variation-settings: "opsz" 144, "SOFT" 100;
}
.tl-empty b { color: var(--rust); font-weight: 400; }
.tl-asof-hint { font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.12em; color: var(--paper-shade); margin-top: 2px; }

.tl-spine { position: relative; padding: 20px 0 60px; }
.tl-spine::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px;
  background: repeating-linear-gradient(to bottom, var(--rule-strong) 0 6px, transparent 6px 12px);
  transform: translateX(-50%);
}
@keyframes tl-node-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.tl-node {
  position: relative; display: grid; grid-template-columns: 1fr 20px 1fr; gap: 0;
  align-items: start; margin-bottom: 32px; animation: tl-node-in 0.5s cubic-bezier(.2,.8,.2,1) both;
}
.tl-node__dot {
  grid-column: 2; grid-row: 1; width: 12px; height: 12px;
  background: var(--ink); border: 2px solid var(--rust); border-radius: 50%;
  justify-self: center; margin-top: 18px; z-index: 2;
  box-shadow: 0 0 8px rgba(199, 81, 70, 0.3);
}
.tl-node__date {
  position: absolute; left: 50%; transform: translateX(-50%); top: -14px;
  font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.28em;
  text-transform: uppercase; color: var(--ghost); white-space: nowrap; z-index: 2;
}
.tl-card {
  background: var(--ink-raised); border: 1px solid var(--rule); padding: 16px 20px 14px;
  cursor: pointer; transition: border-color 0.2s, transform 0.2s; position: relative;
}
.tl-card--left { grid-column: 1; grid-row: 1; margin-right: 16px; border-right: 3px solid var(--rust); }
.tl-card--right { grid-column: 3; grid-row: 1; margin-left: 16px; border-left: 3px solid var(--rust); }
.tl-card:hover { border-color: var(--rust); transform: translateY(-2px); z-index: 3; }
.tl-card--superseded { opacity: 0.55; border-color: var(--rule); }
.tl-card--superseded .tl-card__content { text-decoration: line-through; text-decoration-color: var(--paper-shade); }
.tl-card--superseded.tl-card--left { border-right-color: var(--paper-shade); }
.tl-card--superseded.tl-card--right { border-left-color: var(--paper-shade); }
.tl-card--superseded:hover { opacity: 0.8; border-color: var(--paper-shade); }
.tl-card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.tl-card__entity { font-family: var(--f-display); font-size: 16px; font-weight: 400; color: var(--paper); font-variation-settings: "opsz" 28, "SOFT" 50; line-height: 1.2; }
.tl-card__category { font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.28em; text-transform: uppercase; color: var(--brass); margin-bottom: 6px; }
.tl-card__content { font-family: var(--f-display); font-size: 13px; line-height: 1.45; color: var(--paper); font-variation-settings: "opsz" 14, "SOFT" 50; margin-bottom: 10px; }
.tl-card__meta { display: flex; gap: 12px; font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ghost); padding-top: 8px; border-top: 1px dashed var(--rule); }
.tl-card__superseded { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.12em; color: var(--rust); margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--rule); }
.tl-card__arrow { display: inline-block; animation: arrow-pulse 1.5s ease-in-out infinite; }
@keyframes arrow-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.tl-card__validity { font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--verdigris); margin-top: 4px; }

.tl-stamp {
  width: 42px; height: 42px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--f-mono); color: var(--rust); border: 1.5px solid var(--rust); border-radius: 50%;
  transform: rotate(-6deg); flex-shrink: 0; text-align: center; line-height: 1; opacity: 0.85; filter: contrast(1.1) blur(0.15px);
}
.tl-stamp__pct { font-size: 14px; display: block; }
.tl-stamp__label { font-size: 6px; letter-spacing: 0.18em; display: block; margin-top: 1px; }
.tl-stamp--superseded { color: var(--paper-shade); border-color: var(--paper-shade); }
.tl-stamp--decayed { color: var(--brass); border-color: var(--brass); }

.tl-detail {
  position: fixed; top: 0; right: 0; width: 400px; height: 100vh;
  background: var(--ink-raised); border-left: 1px solid var(--rule-strong); z-index: 20;
  overflow-y: auto; box-shadow: -8px 0 40px rgba(0,0,0,0.5); animation: tl-detail-in 0.3s cubic-bezier(.2,.8,.2,1);
}
@keyframes tl-detail-in { from { transform: translateX(100%); } to { transform: translateX(0); } }
.tl-detail__head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px dashed var(--rule-strong); }
.tl-detail__label { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.32em; text-transform: uppercase; color: var(--rust); }
.tl-detail__close { background: none; border: 1px solid var(--rule-strong); color: var(--ghost); font-size: 18px; cursor: pointer; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; transition: color 0.15s, border-color 0.15s; }
.tl-detail__close:hover { color: var(--rust); border-color: var(--rust); }
.tl-detail__body { padding: 20px; }
.tl-detail__id { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.22em; color: var(--ghost); margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px dashed var(--rule); word-break: break-all; }
.tl-detail__row { display: grid; grid-template-columns: 110px 1fr; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--rule); font-family: var(--f-mono); font-size: 11px; color: var(--paper); }
.tl-detail__row span { font-size: 9px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ghost); }
.tl-detail__row--rust { color: var(--rust); }
.tl-detail__section { font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.32em; text-transform: uppercase; color: var(--rust); margin: 18px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--rule); }
.tl-detail__content { font-family: var(--f-display); font-size: 14px; line-height: 1.5; color: var(--paper); font-variation-settings: "opsz" 14, "SOFT" 50; white-space: pre-wrap; word-break: break-word; }
.tl-detail__tags { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px 0; }
.tl-detail__tag { font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--paper); border: 1px solid var(--rule-strong); padding: 2px 8px; }

@media (max-width: 960px) {
  .tl-spine::before { left: 16px; }
  .tl-node { grid-template-columns: 32px 1fr; }
  .tl-node__dot { grid-column: 1; justify-self: center; }
  .tl-node__date { position: static; transform: none; grid-column: 2; margin-bottom: 4px; }
  .tl-card--left, .tl-card--right { grid-column: 2; grid-row: auto; margin: 0; border-left: 3px solid var(--rust); border-right: 1px solid var(--rule); }
  .tl-card--superseded.tl-card--left, .tl-card--superseded.tl-card--right { border-left-color: var(--paper-shade); }
  .tl-detail { width: 100%; }
}

/* ============================================================
   AGENTS — Personnel dossier registry
   ============================================================ */
.agents-area { min-height: 400px; }
.agents-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 28px; padding-top: 4px; }
.agents-empty { grid-column: 1 / -1; text-align: center; padding: 80px 20px; color: var(--ghost); font-family: var(--f-display); font-style: italic; font-size: 22px; font-variation-settings: "opsz" 144, "SOFT" 100; }

.agents-card {
  background: var(--paper); color: var(--ink); padding: 28px 24px 20px; position: relative;
  border: 1px solid var(--paper-shade); cursor: pointer;
  box-shadow: 0 1px 0 rgba(255,255,255,0.08) inset, 0 18px 30px -18px rgba(0,0,0,0.9), 0 4px 10px -2px rgba(0,0,0,0.5);
  transition: transform 0.28s cubic-bezier(.2,.8,.2,1), box-shadow 0.28s;
  animation: raise 0.6s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i, 0) * 60ms);
}
.agents-card::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(45deg, transparent 0 2px, rgba(155,142,102,0.05) 2px 3px); pointer-events: none; }
.agents-card__tab { position: absolute; top: -14px; left: 18px; background: var(--paper-aged); color: var(--ink); font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.28em; text-transform: uppercase; padding: 3px 12px 2px; border: 1px solid var(--paper-shade); border-bottom: none; box-shadow: 0 -2px 4px rgba(0,0,0,0.15); }
.agents-card:hover { transform: translateY(-4px); box-shadow: 0 1px 0 rgba(255,255,255,0.1) inset, 0 28px 50px -14px rgba(0,0,0,0.95), 0 10px 18px -2px rgba(0,0,0,0.6); z-index: 3; }
.agents-card__name { font-family: var(--f-display); font-weight: 350; font-variation-settings: "opsz" 44, "SOFT" 40, "WONK" 0; font-size: 28px; line-height: 1.15; letter-spacing: -0.02em; color: var(--ink); margin-bottom: 6px; position: relative; z-index: 1; }
.agents-card__stat { display: flex; align-items: baseline; gap: 8px; margin-bottom: 14px; position: relative; z-index: 1; }
.agents-card__count { font-family: var(--f-mono); font-size: 32px; color: var(--rust); font-weight: 400; line-height: 1; }
.agents-card__label { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--paper-shade); }
.agents-card__rule { border: none; border-top: 1px dashed var(--paper-shade); margin: 10px 0; }
.agents-card__section-label { font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.28em; text-transform: uppercase; color: var(--paper-shade); margin: 10px 0 6px; position: relative; z-index: 1; }
.agents-card__entities { display: flex; flex-wrap: wrap; gap: 4px; position: relative; z-index: 1; }
.agents-entity { background: transparent; border: 1px solid var(--paper-shade); padding: 2px 7px; font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.12em; color: var(--ink); }
.agents-entity em { color: var(--rust-deep); font-style: normal; margin-left: 3px; font-size: 8px; }
.agents-card__none { font-family: var(--f-mono); font-size: 9px; color: var(--paper-shade); font-style: italic; }
.agents-card__foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-family: var(--f-mono); font-size: 10px; color: var(--paper-shade); letter-spacing: 0.08em; position: relative; z-index: 1; }
.agents-spark { color: var(--rust); font-size: 12px; line-height: 1; letter-spacing: 1px; }

.agents-catbar { position: relative; z-index: 1; }
.agents-catbar__bar { display: flex; height: 6px; border-radius: 1px; overflow: hidden; gap: 1px; margin-bottom: 4px; }
.agents-catbar__seg { min-width: 4px; opacity: 0.85; }
.agents-catbar__legend { display: flex; flex-wrap: wrap; gap: 6px; }
.agents-catbar__tag { font-family: var(--f-mono); font-size: 8px; letter-spacing: 0.1em; color: var(--ink); display: inline-flex; align-items: center; gap: 3px; }
.agents-catbar__dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

.agents-roles { list-style: none; padding: 0; margin: 0; }
.agents-roles li { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--rule); font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--ghost); }
.agents-role-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.agents-overlay { position: fixed; inset: 0; z-index: 20; background: rgba(6,8,11,0.85); display: flex; align-items: flex-start; justify-content: center; padding: 60px 20px; overflow-y: auto; }
.agents-overlay[hidden] { display: none; }
.agents-detail { background: var(--ink-raised); border: 1px solid var(--rule-strong); max-width: 760px; width: 100%; padding: 36px 40px 32px; position: relative; box-shadow: 0 32px 80px -20px rgba(0,0,0,0.95); animation: sheet-in 0.35s cubic-bezier(.2,.8,.2,1) both; }
.agents-detail__close { position: absolute; top: 12px; right: 16px; background: transparent; border: 1px solid var(--rule); color: var(--ghost); font-family: var(--f-mono); font-size: 12px; padding: 4px 10px; cursor: pointer; transition: color 0.15s, border-color 0.15s; }
.agents-detail__close:hover { color: var(--rust); border-color: var(--rust); }
.agents-detail__head { margin-bottom: 24px; padding-bottom: 18px; border-bottom: 1px dashed var(--rule-strong); }
.agents-detail__name { font-family: var(--f-display); font-weight: 350; font-variation-settings: "opsz" 144, "SOFT" 40, "WONK" 0; font-size: 36px; line-height: 1.1; letter-spacing: -0.025em; color: var(--paper); }
.agents-detail__meta { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ghost); margin-top: 6px; }
.agents-detail__section-label { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.28em; text-transform: uppercase; color: var(--rust); margin: 22px 0 10px; padding-bottom: 5px; border-bottom: 1px solid var(--rule); }

.agents-freq { width: 100%; border-collapse: collapse; font-family: var(--f-mono); font-size: 11px; }
.agents-freq th { text-align: left; font-size: 9px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ghost); padding: 6px 0; border-bottom: 1px solid var(--rule); font-weight: 400; }
.agents-freq td { padding: 5px 0; border-bottom: 1px dashed var(--rule); color: var(--paper); }
.agents-freq td:last-child { text-align: right; color: var(--rust); }

.agents-detail__list { max-height: 420px; overflow-y: auto; }
.agents-mem { display: grid; grid-template-columns: 28px 1fr 48px; gap: 10px; align-items: start; padding: 8px 0; border-bottom: 1px dashed var(--rule); font-size: 11px; }
.agents-mem__rank { font-family: var(--f-mono); font-size: 10px; color: var(--ghost); text-align: center; padding-top: 2px; }
.agents-mem__content { font-family: var(--f-display); font-size: 13px; color: var(--paper); line-height: 1.4; font-variation-settings: "opsz" 14, "SOFT" 50; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.agents-mem__meta { font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ghost); margin-top: 3px; }
.agents-mem__cat { color: var(--brass); }
.agents-mem__conf { font-family: var(--f-mono); font-size: 11px; color: var(--rust); text-align: right; }
.agents-detail__pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 16px 0 4px; font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.15em; color: var(--ghost); }
.agents-card__latest { text-transform: uppercase; letter-spacing: 0.12em; }

@media (max-width: 960px) {
  .agents-grid { grid-template-columns: 1fr; }
  .agents-detail { padding: 24px 20px 20px; }
  .agents-overlay { padding: 30px 10px; }
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pager {
  grid-column: 1 / -1;
  display: flex; align-items: center; justify-content: center;
  gap: 18px; padding: 28px 0 8px;
  font-family: var(--f-mono); font-size: 10px;
  letter-spacing: 0.22em; text-transform: uppercase;
}
.pager__btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--f-mono); font-size: 10px;
  letter-spacing: 0.25em; text-transform: uppercase;
  color: var(--paper); background: transparent;
  border: 1px solid var(--rule-strong); padding: 9px 16px;
  cursor: pointer; text-decoration: none;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.pager__btn:hover { border-color: var(--rust); color: var(--rust); }
.pager__btn--disabled { color: var(--ghost); border-color: var(--rule); opacity: 0.4; cursor: default; pointer-events: none; }
.pager__current { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.18em; color: var(--rust); }
.pager__current b { font-weight: 400; font-size: 16px; }

/* ============================================================
   EXPORT BUTTONS
   ============================================================ */
.btn--secondary { border-color: var(--rule-strong); color: var(--ghost); }
.btn--secondary:hover { border-color: var(--verdigris); color: var(--verdigris); }

/* ============================================================
   HEALTH DASHBOARD
   ============================================================ */
.health-area { padding: 0 40px 80px; }
.health-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 24px; margin: 24px 0;
  font-family: var(--f-mono); font-size: 12px;
  letter-spacing: 0.32em; text-transform: uppercase;
  border: 1px solid var(--rule);
}
.health-banner--ok { border-left: 4px solid var(--verdigris); color: var(--verdigris); }
.health-banner--error { border-left: 4px solid var(--rust); color: var(--rust); }
.health-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.health-dot--ok { background: var(--verdigris); box-shadow: 0 0 8px var(--verdigris); }
.health-dot--error { background: var(--rust); box-shadow: 0 0 8px var(--rust); }
.health-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }
.health-empty, .health-loading { text-align: center; padding: 80px 20px; font-family: var(--f-display); font-style: italic; font-size: 20px; color: var(--ghost); font-variation-settings: "opsz" 144, "SOFT" 100; }
@keyframes health-card-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
.health-card { background: var(--ink-raised); border: 1px solid var(--rule); border-left: 3px solid var(--layer-color, var(--ghost)); padding: 20px 24px; animation: health-card-in 0.45s cubic-bezier(.2,.8,.2,1) both; }
.health-card__head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px dashed var(--rule); }
.health-card__icon { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border: 1.5px solid var(--layer-color, var(--ghost)); color: var(--layer-color, var(--ghost)); font-family: var(--f-mono); font-size: 14px; flex-shrink: 0; }
.health-card__info { flex: 1; min-width: 0; }
.health-card__name { font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--paper); }
.health-card__check-name { font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.12em; color: var(--ghost); margin-top: 2px; }
.health-card__status { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ghost); }
.health-metrics { padding: 4px 0; }
.health-metric { display: flex; justify-content: space-between; align-items: baseline; padding: 5px 0; border-bottom: 1px dashed var(--rule); }
.health-metric__label { font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.28em; text-transform: uppercase; color: var(--ghost); }
.health-metric__value { font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.04em; color: var(--paper); }
.health-layers { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px 0 4px; }
.health-layer-tag { font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--paper); border: 1px solid var(--rule-strong); padding: 2px 8px; }
.health-note { font-family: var(--f-mono); font-size: 10px; color: var(--ghost); padding: 8px 0 2px; font-style: italic; }
.health-error { font-family: var(--f-mono); font-size: 10px; color: var(--rust); padding: 8px 0 2px; }
.health-refresh-note { font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.28em; text-transform: uppercase; color: var(--ghost); text-align: center; padding: 24px 0 0; opacity: 0.5; }
@media (max-width: 960px) { .health-area { padding: 0 20px 80px; } .health-grid { grid-template-columns: 1fr; } }

/* ============================================================
   CONFIG VIEWER
   ============================================================ */
.cfg-area { min-height: 400px; }
.cfg-loading { text-align: center; padding: 80px 20px; font-family: var(--f-display); font-style: italic; font-size: 20px; color: var(--ghost); font-variation-settings: "opsz" 144, "SOFT" 100; }
.cfg-section-label { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.32em; text-transform: uppercase; color: var(--rust); margin: 28px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--rule); }
.cfg-section-label:first-child { margin-top: 0; }
.cfg-kv { margin-bottom: 0; }
.cfg-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.cfg-dot--ok { background: var(--verdigris); }
.cfg-dot--err { background: var(--rust); }
.cfg-health-list { font-family: var(--f-mono); font-size: 10px; }
.cfg-health-item { padding: 5px 0; border-bottom: 1px dashed var(--rule); color: var(--paper); display: flex; align-items: center; }
.cfg-health-name { letter-spacing: 0.12em; }
.cfg-health-err { color: var(--rust); font-size: 9px; margin-left: 8px; }

/* ============================================================
   SELECTION
   ============================================================ */
/* ============================================================
   SEARCH HIGHLIGHTING
   ============================================================ */
.hl, mark.hl {
  background: rgba(199, 81, 70, 0.25);
  color: inherit;
  padding: 1px 2px;
  border-bottom: 1px solid var(--rust);
  border-radius: 0;
}

::selection { background: var(--rust); color: var(--paper); }

/* ============================================================
   RECALL: LATENCY BADGES
   ============================================================ */
.recall-diagram__ms {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--brass);
  margin-top: 4px;
  opacity: 0.85;
}
.recall-layer__ms {
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--brass);
  margin-left: auto;
  padding: 2px 8px;
  border: 1px solid var(--ghost);
  border-radius: 2px;
  white-space: nowrap;
}

/* ============================================================
   BUDGET EXPLORER
   ============================================================ */
.budget-explore-area { margin-top: 24px; }
.budget-chart {
  border: 1px solid var(--ghost);
  padding: 20px 24px;
  margin-top: 16px;
}
.budget-chart__title {
  font-family: var(--f-display);
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ghost);
  margin-bottom: 16px;
}
.budget-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.budget-row__label {
  font-family: var(--f-mono);
  font-size: 13px;
  min-width: 60px;
  text-align: right;
  color: var(--ghost);
}
.budget-row__bars {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.budget-row__bar {
  height: 18px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--paper);
  min-width: 60px;
  transition: width 0.4s ease;
}
.budget-row__bar--ms { border-radius: 0; }
.budget-row__bar--count {
  background: var(--verdigris);
  border-radius: 0;
}
.budget-row__bar span {
  white-space: nowrap;
}

/* ============================================================
   OPS LOG
   ============================================================ */
.ops-area { padding: 0 40px; }
.ops-empty {
  padding: 60px 20px;
  text-align: center;
  font-family: var(--f-display);
  font-style: italic;
  color: var(--ghost);
}
.ops-loading { @extend .ops-empty; }
.ops-summary {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  padding: 20px 0;
  border-bottom: 1px solid var(--ghost);
  margin-bottom: 16px;
}
.ops-stat {
  text-align: center;
  min-width: 80px;
}
.ops-stat__val {
  font-family: var(--f-mono);
  font-size: 20px;
  color: var(--ink);
}
.ops-stat__label {
  font-family: var(--f-display);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ghost);
}
.ops-sparkline-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0 16px;
}
.ops-sparkline-label {
  font-family: var(--f-display);
  font-size: 11px;
  text-transform: uppercase;
  color: var(--ghost);
  white-space: nowrap;
}
.ops-spark {
  width: 100%;
  max-width: 600px;
  height: 40px;
}
.ops-table-wrap { overflow-x: auto; }
.ops-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--f-mono);
  font-size: 12px;
}
.ops-table th {
  text-align: left;
  font-family: var(--f-display);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ghost);
  padding: 6px 8px;
  border-bottom: 1px solid var(--ghost);
}
.ops-table td {
  padding: 5px 8px;
  border-bottom: 1px solid color-mix(in srgb, var(--ghost) 30%, transparent);
  vertical-align: middle;
}
.ops-table tbody tr:hover {
  background: color-mix(in srgb, var(--ghost) 8%, transparent);
}
.ops-td--ts {
  white-space: nowrap;
  color: var(--ghost);
  font-size: 11px;
}
.ops-td--ms {
  white-space: nowrap;
  text-align: right;
  min-width: 70px;
}
.ops-td--bar { width: 100px; }
.ops-bar {
  height: 8px;
  border-radius: 0;
  transition: width 0.3s ease;
}
.ops-td--input {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--ink);
}
.ops-td--stores {
  font-size: 10px;
  color: var(--ghost);
}
.ops-badge {
  display: inline-block;
  padding: 1px 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid var(--ghost);
}
.ops-op--recall { color: var(--verdigris); border-color: var(--verdigris); }
.ops-op--add { color: var(--brass); border-color: var(--brass); }
.ops-op--health { color: var(--ghost); }
.ops-refresh-note {
  text-align: center;
  font-family: var(--f-display);
  font-size: 11px;
  color: var(--ghost);
  padding: 16px 0;
}

/* ============================================================
   HEALTH: LATENCY PANEL (PERCENTILES + SPARKLINE)
   ============================================================ */
.health-latency-panel {
  border: 1px solid var(--ghost);
  padding: 20px 24px;
  margin: 0 40px 24px;
}
.health-latency-panel__title {
  font-family: var(--f-display);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ghost);
  margin-bottom: 12px;
}
.health-pctl-row {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.health-pctl { text-align: center; }
.health-pctl__val {
  display: block;
  font-family: var(--f-mono);
  font-size: 18px;
  color: var(--ink);
}
.health-pctl__label {
  font-family: var(--f-display);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ghost);
}
.health-spark-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.health-spark-label {
  font-family: var(--f-display);
  font-size: 11px;
  text-transform: uppercase;
  color: var(--ghost);
  white-space: nowrap;
}
.health-spark {
  width: 100%;
  max-width: 500px;
  height: 36px;
}

/* ============================================================
   RESPONSIVE: OPS + BUDGET
   ============================================================ */
@media (max-width: 640px) {
  .ops-area { padding: 0 16px; }
  .ops-summary { gap: 12px; }
  .ops-stat__val { font-size: 16px; }
  .ops-td--input { max-width: 120px; }
  .ops-td--bar { display: none; }
  .health-latency-panel { margin: 0 16px 16px; }
  .health-pctl-row { gap: 16px; }
  .budget-chart { padding: 12px 16px; }
}
