:root {
  --bg: #0f1419; --panel: #1a212b; --panel-border: #2a3441;
  --text: #e6edf3; --muted: #9aa7b4; --accent: #4cc2ff; --null: #5c6875;
  --key: #4cc2ff; --fuzzy: #f0b35b; --ref: #2f3b4a; --ext: #3a3346;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
       background: var(--bg); color: var(--text); line-height: 1.5; }
.wrap { max-width: 1400px; margin: 0 auto; padding: 36px 20px 64px; }
h1 { margin: 0 0 8px; font-size: 1.8rem; }
a { color: var(--accent); }
.back { margin: 0 0 10px; font-size: 0.9rem; }
.back a { text-decoration: none; color: var(--muted); }
.back a:hover { color: var(--accent); }
.lede { color: var(--muted); max-width: 80ch; margin: 10px 0 16px; }
.status { color: var(--muted); font-size: 0.9rem; }

nav.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
nav.tabs a { padding: 6px 14px; border: 1px solid var(--panel-border); border-radius: 999px; text-decoration: none; color: var(--muted); font-size: 0.9rem; font-weight: 600; }
nav.tabs a.on { background: var(--accent); color: #0f1419; border-color: var(--accent); }
.blurb { color: var(--muted); font-size: 0.92rem; max-width: 90ch; margin: 0 0 10px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin: 0 0 10px; font-size: 0.85rem; color: var(--muted); }
.toolbar label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.toolbar button { background: var(--panel); color: var(--text); border: 1px solid var(--panel-border); border-radius: 8px; padding: 4px 10px; font-size: 0.85rem; cursor: pointer; }
.toolbar button:hover { border-color: var(--accent); }
.legend { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 28px; height: 0; border-top: 2px solid var(--key); }
.legend i.fuzzy { border-top-style: dashed; border-top-color: var(--fuzzy); }
.legend b { display: inline-block; width: 14px; height: 10px; border-radius: 2px; border: 1px solid var(--panel-border); }
.legend b.main { background: var(--panel); } .legend b.ref { background: var(--ref); } .legend b.ext { background: var(--ext); }

.canvas { overflow: auto; border: 1px solid var(--panel-border); border-radius: 12px; background: #0b0f14; }
.canvas.fit svg { width: 100%; height: auto; }
svg { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; }
svg .group-label { fill: var(--muted); font-family: system-ui, sans-serif; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
svg .box rect.body { fill: var(--panel); stroke: var(--panel-border); rx: 8; }
svg .box.reference rect.body { fill: var(--ref); }
svg .box.external rect.body { fill: var(--ext); }
svg .box rect.head { fill: transparent; cursor: pointer; }
svg .box text.title { fill: var(--text); font-family: system-ui, sans-serif; font-size: 13px; font-weight: 600; }
svg .box text.rows { fill: var(--muted); font-size: 10px; font-family: system-ui, sans-serif; }
svg .box .col text { fill: var(--text); }
svg .box .col text.type { fill: var(--null); }
svg .box .col.pk text.name { fill: var(--accent); font-weight: 600; }
svg .box .col.link text.name { text-decoration: underline; text-decoration-color: var(--panel-border); }
svg .box text.more, svg .box text.sources { fill: var(--muted); font-style: italic; font-size: 10px; font-family: system-ui, sans-serif; }
svg .box text.open { fill: var(--accent); font-family: system-ui, sans-serif; font-size: 10px; cursor: pointer; }
svg .box.selected rect.body { stroke: var(--accent); stroke-width: 1.5; }
svg .edge path { fill: none; stroke: var(--key); stroke-width: 1.4; opacity: .75; }
svg .edge.fuzzy path { stroke: var(--fuzzy); stroke-dasharray: 6 4; }
svg .edge path.hit { stroke: transparent; stroke-width: 10; opacity: 1; cursor: pointer; }
svg .edge circle { fill: var(--key); } svg .edge.fuzzy circle { fill: var(--fuzzy); }
svg .edge.dim path:not(.hit) { opacity: .12; } svg .edge.dim circle { opacity: .12; }
svg .edge.hot path:not(.hit) { opacity: 1; stroke-width: 2.4; }
svg .edge text { fill: var(--fuzzy); font-size: 10px; }

.tip { position: fixed; z-index: 10; max-width: 380px; background: var(--panel); border: 1px solid var(--panel-border); border-radius: 8px; padding: 8px 10px; font-size: 0.82rem; color: var(--text); pointer-events: none; box-shadow: 0 6px 24px rgba(0,0,0,.4); }
.tip b { color: var(--accent); }

details { margin: 18px 0; color: var(--muted); font-size: 0.9rem; }
details summary { cursor: pointer; color: var(--text); }
details table { border-collapse: collapse; font-size: 0.85rem; margin-top: 8px; }
details td, details th { padding: 4px 10px; border-bottom: 1px solid var(--panel-border); text-align: left; }
details code { font-size: 0.85em; }
footer { margin-top: 40px; color: var(--muted); font-size: 0.85rem; }
