:root {
  color-scheme: light;
  --surface-1: #fcfcfb; --page: #f9f9f7; --text-primary: #0b0b0b;
  --text-secondary: #52514e; --text-muted: #898781; --gridline: #e1e0d9;
  --border: rgba(11,11,11,0.10); --node-base: #b9b7ad;
  --series-1: #2a78d6; --series-2: #008300; --series-3: #e87ba4; --series-4: #eda100;
  --series-5: #1baf7a; --series-6: #eb6834; --series-7: #4a3aa7; --series-8: #e34948;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --surface-1: #1a1a19; --page: #0d0d0d; --text-primary: #ffffff;
    --text-secondary: #c3c2b7; --text-muted: #898781; --gridline: #2c2c2a;
    --border: rgba(255,255,255,0.10); --node-base: #55534c;
    --series-1: #3987e5; --series-2: #008300; --series-3: #d55181; --series-4: #c98500;
    --series-5: #199e70; --series-6: #d95926; --series-7: #9085e9; --series-8: #e66767;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-1: #1a1a19; --page: #0d0d0d; --text-primary: #ffffff;
  --text-secondary: #c3c2b7; --text-muted: #898781; --gridline: #2c2c2a;
  --border: rgba(255,255,255,0.10); --node-base: #55534c;
  --series-1: #3987e5; --series-2: #008300; --series-3: #d55181; --series-4: #c98500;
  --series-5: #199e70; --series-6: #d95926; --series-7: #9085e9; --series-8: #e66767;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--page); color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 18px; background: var(--surface-1); border-bottom: 1px solid var(--border); }
.topbar h1 { font-size: 14.5px; margin: 0; }
.topbar a.back { font-size: 12.5px; color: var(--series-1); text-decoration: none; }
.topbar .meta { font-size: 11.5px; color: var(--text-muted); }

table.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data-table th { text-align: left; padding: 8px 10px; color: var(--text-muted);
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.03em;
  border-bottom: 1px solid var(--gridline); position: sticky; top: 0; background: var(--page); }
table.data-table td { padding: 7px 10px; border-bottom: 1px solid var(--gridline);
  color: var(--text-secondary); vertical-align: top; }
table.data-table tr:hover td { background: var(--surface-1); }
table.data-table td.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
table.data-table td.name { color: var(--text-primary); font-weight: 500; white-space: nowrap; }
.tag { display: inline-block; padding: 1px 6px; border-radius: 4px; background: var(--gridline);
  font-size: 10.5px; margin: 1px 2px 1px 0; color: var(--text-secondary); }
.coherence-bar { display: inline-block; width: 40px; height: 6px; border-radius: 3px;
  background: var(--gridline); position: relative; overflow: hidden; vertical-align: middle; margin-right: 6px; }
.coherence-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--series-1); }

.page-wrap { max-width: 980px; margin: 0 auto; padding: 20px; }
.page-note { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; line-height: 1.5; }
input.filter-input { padding: 6px 10px; font-size: 12.5px; border: 1px solid var(--border);
  border-radius: 6px; background: var(--surface-1); color: var(--text-primary); width: 260px; }

.explainer { background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 16px; font-size: 12.5px; color: var(--text-secondary); line-height: 1.55; margin-bottom: 16px; }
.explainer strong { color: var(--text-primary); }
.explainer .example { display: flex; gap: 18px; margin-top: 8px; flex-wrap: wrap; }
.explainer .example-item { font-size: 11.5px; }
.explainer .example-item .label { color: var(--text-muted); }

tr.clickable-row { cursor: pointer; }

#graph-panel { display: none; margin-top: 16px; background: var(--surface-1);
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
#graph-panel.open { display: block; }
#graph-panel .graph-panel-header { display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; border-bottom: 1px solid var(--gridline); font-size: 12.5px; }
#graph-panel .graph-panel-header .title { color: var(--text-primary); font-weight: 600; }
#graph-panel .graph-panel-header .meta { color: var(--text-muted); margin-left: 8px; font-weight: 400; }
#graph-panel .graph-panel-close { border: none; background: none; color: var(--series-1);
  font-size: 12px; cursor: pointer; padding: 0; }
#graph-panel .graph-canvas-wrap { position: relative; height: 420px; }
#graph-panel .graph-canvas-wrap .cosmos-canvas { width: 100%; height: 100%; }
#graph-panel .graph-hover-tooltip { position: absolute; pointer-events: none; background: var(--surface-1);
  border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; font-size: 12px;
  display: none; box-shadow: 0 2px 8px var(--border); z-index: 5; }
#graph-panel .graph-legend { position: absolute; top: 10px; right: 10px; background: var(--surface-1);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 11px;
  color: var(--text-secondary); }
#graph-panel .graph-legend .row { display: flex; align-items: center; gap: 6px; margin: 2px 0; }
#graph-panel .graph-legend .swatch { width: 9px; height: 9px; border-radius: 2px; flex: none; }
