:root {
    color-scheme: dark;
    --bg: #0d1117; --panel: #161b22; --panel-hover: #1d2530;
    --line: #303b49; --text: #e6edf3; --muted: #a1aebd;
    --orange: #ff8b4c; --green: #69cf89; --yellow: #e7c467;
    --blue: #79b8ff; --purple: #c8a4ff; --red: #ff8c86;
}
* { box-sizing: border-box; }
body { margin: 0 auto; padding: 32px; max-width: 1680px; background: var(--bg); color: var(--text); font: 14px/1.55 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2rem, 4vw, 2.8rem); letter-spacing: -.045em; font-weight: 650; }
h2 { font-size: 1.15rem; letter-spacing: -.02em; }
h3 { font-size: .95rem; margin-bottom: 10px; }
a { color: var(--blue); }
button, input, select { font: inherit; }
button, select, input { color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; min-height: 40px; padding: 8px 10px; }
button { cursor: pointer; font-weight: 600; }
button:hover { border-color: var(--blue); background: var(--panel-hover); }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }
input, select { width: 100%; min-width: 0; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; overflow-wrap: anywhere; }
code { color: #c0d5eb; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 350px; overflow-y: auto; font-size: .78rem; }
.skip-link { position: absolute; top: -80px; left: 16px; padding: 8px; background: var(--panel); z-index: 10; }
.skip-link:focus { top: 8px; }
.page-header { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin: 8px 0 28px; }
.eyebrow { color: var(--orange); font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.subtitle, .muted, .hint { color: var(--muted); }
.subtitle { margin-top: 8px; max-width: 650px; }
.header-badge { border: 1px solid var(--line); border-radius: 24px; padding: 7px 12px; color: var(--muted); font-size: .75rem; white-space: nowrap; }
.workspace-nav { display: flex; gap: 8px; overflow-x: auto; padding: 10px; margin: 0 0 20px; border: 1px solid var(--line); border-radius: 12px; background: #111a25; position: sticky; top: 8px; z-index: 5; }
.workspace-nav a { flex-shrink: 0; text-decoration: none; padding: 7px 12px; border-radius: 7px; font-size: .8rem; color: var(--text); }
.workspace-nav a:hover { background: var(--panel-hover); color: var(--orange); }
.workspace-portals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.workspace-portals a { display: grid; gap: 6px; padding: 20px 24px; border: 1px solid #405466; border-radius: 12px; color: var(--text); text-decoration: none; background: radial-gradient(ellipse at top right, #29423d, #15212c 70%); }
.workspace-portals a + a { background: radial-gradient(ellipse at top right, #393352, #15212c 70%); }
.workspace-portals strong { font-size: 1.1rem; }.workspace-portals span { color: var(--muted); font-size: .8rem; }.workspace-portals .portal-kicker { color: #8de7bd; text-transform: uppercase; letter-spacing: .1em; font-size: .65rem; font-weight: 700; }
.workspace-portals a:hover { border-color: var(--orange); }
#app, #knowledge-brain, #analytics-lab, #predictions, #evidence-inspector { scroll-margin-top: 90px; }
.scope { display: flex; flex-wrap: wrap; gap: 10px 24px; padding: 14px 0 20px; border-top: 1px solid var(--line); font-size: .8rem; color: var(--muted); }
.scope strong { color: var(--text); font-weight: 500; }
.notice { padding: 12px 16px; border: 1px solid #6e5a2c; border-radius: 6px; background: #302719; color: #ebd49d; margin-bottom: 20px; overflow-wrap: anywhere; }
.notice.info { background: #142339; color: #b2d4fc; border-color: #2b466a; }
.notice.danger { background: #331f24; color: #ffb8b4; border-color: #704048; }
.stats-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.stat-card, .card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.stat-card { padding: 18px; }
.stat-card .label { color: var(--muted); font-size: .74rem; }
.stat-card .value { font-size: 1.85rem; letter-spacing: -.04em; font-weight: 650; margin: 4px 0; }
.stat-card .detail { color: var(--muted); font-size: .72rem; }
.green { color: var(--green); } .orange { color: var(--orange); } .yellow { color: var(--yellow); } .purple { color: var(--purple); } .red { color: var(--red); }
.summary-note { margin-bottom: 28px; color: var(--muted); font-size: .8rem; }
.card { padding: 22px; margin-bottom: 24px; min-width: 0; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 8px; }
.section-heading p { margin-top: 5px; color: var(--muted); font-size: .82rem; }
.badge { display: inline-block; padding: 2px 8px; border: 1px solid currentColor; border-radius: 14px; font-size: .67rem; white-space: nowrap; vertical-align: middle; }
.badge.neutral { color: var(--muted); } .badge.pending { color: var(--yellow); } .badge.correct { color: var(--green); } .badge.wrong { color: var(--red); }
.filters { display: grid; grid-template-columns: minmax(200px, 2fr) repeat(3, minmax(110px, 1fr)); gap: 12px; margin: 20px 0 12px; }
.filters label { display: block; color: var(--muted); font-size: .75rem; }
.filters label span { display: block; margin-bottom: 5px; }
.filter-actions { display: flex; gap: 12px; align-items: end; }
.hint { font-size: .78rem; margin: 10px 0; }
.table-scroll { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; margin-top: 14px; }
table { width: 100%; border-collapse: collapse; font-size: .8rem; }
caption { text-align: left; color: var(--muted); padding: 10px; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: .7rem; background: #121821; white-space: nowrap; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.selected { background: #223044; }
tbody tr:hover { background: var(--panel-hover); }
td .secondary { display: block; color: var(--muted); font-size: .7rem; margin-top: 3px; }
.row-link { color: var(--blue); font-size: .8rem; font-weight: 500; padding: 0; min-height: 28px; border: 0; background: transparent; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.pagination { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-top: 14px; }
.page-buttons { display: flex; gap: 8px; align-items: center; }
.page-buttons select { width: auto; }
.empty-state { padding: 42px 24px; text-align: center; color: var(--muted); }
.empty-state p + p { margin-top: 10px; }
.inspector { scroll-margin-top: 16px; }
.inspector:focus { outline: none; }
.inspector > .section-heading { margin-bottom: 18px; }
.inspector-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 18px; }
.inspector-grid > div { min-width: 0; }
.facts { margin: 0; display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 8px 16px; font-size: .8rem; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; overflow-wrap: anywhere; }
.inspector-section { margin-top: 24px; }
.inspector-section > p { color: var(--muted); font-size: .8rem; margin: 6px 0; }
.evidence-table td { overflow-wrap: anywhere; }
.evidence-table .source-list { margin: 0; padding-left: 16px; max-height: 160px; overflow-y: auto; }
.conflict-list { padding-left: 20px; margin: 8px 0 0; }
details { margin-top: 14px; font-size: .8rem; }
summary { cursor: pointer; color: var(--blue); padding: 5px 0; }
.trace-list { list-style: none; padding: 0; margin: 12px 0; }
.trace-event { padding: 15px; border: 1px solid var(--line); border-radius: 6px; margin-top: 10px; scroll-margin-top: 12px; }
.trace-event:target { border-color: var(--orange); }
.trace-event p { font-size: .8rem; margin: 5px 0; overflow-wrap: anywhere; }
.trace-event ul { font-size: .78rem; padding-left: 20px; }
.charts-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.charts-grid > .card { margin-bottom: 0; }
.chart-container { position: relative; height: 280px; margin-top: 18px; }
.chart-container[hidden] { display: none; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-top: 18px; }
.metric { padding: 12px; border-radius: 6px; background: var(--bg); }
.metric strong { display: block; font-size: 1.3rem; font-weight: 600; }
.metric span { font-size: .73rem; color: var(--muted); }
.charts-section { margin-top: 30px; }
.timestamp { margin: 24px 0 12px; color: var(--muted); font-size: .75rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (max-width: 1150px) { .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) {
    .workspace-portals { grid-template-columns: 1fr; }.workspace-portals a { padding: 16px; }.workspace-nav { top: 4px; }
    body { padding: 18px; } .page-header { display: block; margin-top: 0; } .header-badge { display: inline-block; margin-top: 14px; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stat-card { padding: 13px; } .stat-card .value { font-size: 1.55rem; }
    .card { padding: 16px; } .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } .filters .search-filter { grid-column: 1 / -1; }
    .inspector-grid, .charts-grid { grid-template-columns: minmax(0, 1fr); } .facts { grid-template-columns: 100px minmax(0, 1fr); gap: 8px; }
    .section-heading { flex-wrap: wrap; } .page-buttons { flex-wrap: wrap; } .scope { display: block; } .scope > span { display: block; margin-top: 4px; }
    .chart-container { height: 250px; }
}
