@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
:root {
  --bg: #07080b;
  --surface: #0d0f14;
  --surface2: #12151d;
  --surface3: #171b25;
  --border: #1a1f2e;
  --border2: #222840;
  --text: #b8c4d8;
  --text-dim: #556080;
  --text-bright: #e2e8f4;
  --accent: #2563eb;
  --accent-soft: #3b7cf8;
  --accent-glow: rgba(37, 99, 235, 0.15);
  --green: #10b981;
  --yellow: #f59e0b;
  --orange: #f97316;
  --critical: #dc2626;
  --mono: 'JetBrains Mono', monospace;
  --sans: 'Inter', sans-serif;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* TOPBAR */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 52px;
  background: rgba(13, 15, 20, 0.96);
  border-bottom: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  backdrop-filter: blur(12px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: #fff;
}
.brand-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-bright);
  letter-spacing: -0.02em;
}
.brand-product {
  font-size: 12px;
  color: var(--text-dim);
  margin-left: 4px;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 20px;
}
.live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--green);
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 3px 10px;
  border-radius: 20px;
}
.live-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  animation: blink 2s infinite;
}
@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}
.topbar-date {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
}

/* SHELL */
.shell {
  display: flex;
  padding-top: 52px;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 52px;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  overflow-y: auto;
}
.sidebar-section {
  padding: 0 16px 16px;
}
.sidebar-label {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0 8px;
  margin-bottom: 8px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 7px;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 2px;
  border: 1px solid transparent;
  user-select: none;
}
.nav-item:hover {
  background: var(--surface2);
  color: var(--text);
}
.nav-item.active {
  background: var(--accent-glow);
  border-color: rgba(37, 99, 235, 0.25);
  color: #7eb3ff;
  font-weight: 500;
}
.nav-num {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  width: 16px;
  flex-shrink: 0;
}
.nav-item.active .nav-num {
  color: rgba(126, 179, 255, 0.6);
}
.nav-sub {
  padding-left: 12px;
}
.nav-sub .nav-item {
  padding: 7px 10px;
  font-size: 11px;
}
.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 16px 16px;
}
.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}
.sidebar-footer-label {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.ornn-credit {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 7px;
  padding: 10px 12px;
}
.ornn-credit-top {
  font-size: 10px;
  color: var(--text-dim);
  line-height: 1.5;
  margin-bottom: 6px;
}
.ornn-credit-top strong {
  color: var(--text);
}
.ornn-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent-soft);
  text-decoration: none;
}
.ornn-link:hover {
  color: #7eb3ff;
}

/* MAIN */
.main {
  margin-left: 220px;
  flex: 1;
  padding: 32px 36px 80px;
  max-width: 1060px;
}
.section {
  display: none;
}
.section.active {
  display: block;
}

/* HEADER */
.section-header {
  margin-bottom: 28px;
}
.section-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent-soft);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.section-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.section-desc {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 8px;
  max-width: 600px;
  line-height: 1.6;
}

/* KPI ROW */
.kpi-row {
  display: grid;
  gap: 14px;
  margin-bottom: 24px;
}
.kpi-row-4 {
  grid-template-columns: repeat(4, 1fr);
}
.kpi-row-3 {
  grid-template-columns: repeat(3, 1fr);
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
}
.kpi-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}
.kpi-value {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 500;
  color: var(--text-bright);
  line-height: 1;
}
.kpi-delta {
  font-family: var(--mono);
  font-size: 10px;
  margin-top: 5px;
}
.kpi-band {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 500;
}
.band-stable {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}
.band-elevated {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}
.band-tight {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}
.band-constrained {
  background: rgba(249, 115, 22, 0.1);
  color: #f97316;
}
.band-critical {
  background: rgba(220, 38, 38, 0.1);
  color: #ef4444;
}
.delta-up {
  color: #f97316;
}
.delta-down {
  color: #10b981;
}
.delta-neutral {
  color: var(--text-dim);
}

/* CHART CARD */
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 24px;
  overflow: hidden;
}
.chart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.chart-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-bright);
}
.chart-card-sub {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}
.range-pills {
  display: flex;
  gap: 4px;
}
.range-pill {
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 500;
  font-family: var(--mono);
  cursor: pointer;
  border: 1px solid var(--border2);
  color: var(--text-dim);
  background: transparent;
}
.range-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.chart-area {
  padding: 20px 22px 16px;
}
.chart-svg {
  width: 100%;
  display: block;
}
.chart-legend {
  display: flex;
  gap: 20px;
  padding: 0 22px 18px;
  flex-wrap: wrap;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
}
.legend-line {
  width: 20px;
  height: 2px;
  border-radius: 1px;
}

/* DATA CARD */
.data-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
}
.data-card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

/* GPU TABLE */
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  text-align: left;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--surface2);
}
.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(26, 31, 46, 0.8);
  font-size: 12px;
}
.data-table tr:last-child td {
  border-bottom: none;
}
.data-table tr:hover td {
  background: var(--surface2);
}
.gpu-label {
  display: flex;
  align-items: center;
  gap: 10px;
}
.gpu-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.gpu-model {
  font-weight: 500;
  color: var(--text-bright);
}
.gpu-gen {
  font-size: 10px;
  color: var(--text-dim);
}
.weight-pill {
  display: inline-block;
  background: var(--surface3);
  border: 1px solid var(--border2);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
}
.score-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}
.score-bar-bg {
  width: 56px;
  height: 3px;
  background: var(--border2);
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}
.score-bar-fill {
  height: 100%;
  border-radius: 2px;
}
.score-num {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  width: 24px;
}

/* ── SCORE BLOCKS (clickable metric cards) ── */
.score-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.score-block-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  cursor: pointer;
  transition:
    border-color 0.15s,
    background 0.15s;
  position: relative;
  overflow: hidden;
}
.score-block-card:hover {
  border-color: var(--border2);
  background: var(--surface2);
}
.score-block-card.active-card {
  border-color: rgba(37, 99, 235, 0.5);
  background: rgba(37, 99, 235, 0.05);
}
.score-block-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  transition: background 0.15s;
}
.score-block-card.active-card::after {
  background: var(--accent);
}
.sbc-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}
.sbc-value {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 500;
  color: var(--text-bright);
  line-height: 1;
}
.sbc-delta {
  font-family: var(--mono);
  font-size: 10px;
  margin-top: 5px;
}
.sbc-band {
  margin-top: 10px;
}
.sbc-hint {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 10px;
  opacity: 0.7;
}

/* DETAIL PANEL (time series drawer) */
.detail-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 24px;
  overflow: hidden;
  display: none;
}
.detail-panel.open {
  display: block;
}
.detail-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
}
.detail-panel-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-bright);
}
.detail-panel-close {
  font-size: 18px;
  color: var(--text-dim);
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}
.detail-panel-close:hover {
  color: var(--text);
}

/* METRIC TABLE in detail panel */
.metric-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
}
.metric-item:last-child {
  border-bottom: none;
}
.metric-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-bright);
}
.metric-desc {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 2px;
  max-width: 420px;
  line-height: 1.5;
}
.metric-right {
  text-align: right;
  flex-shrink: 0;
  margin-left: 24px;
}
.metric-number {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 500;
}
.metric-primary {
  background: rgba(37, 99, 235, 0.05);
}

/* TWO COL */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* BAND REF */
.band-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 22px;
  border-bottom: 1px solid var(--border);
}
.band-row:last-child {
  border-bottom: none;
}
.band-range {
  font-family: var(--mono);
  font-size: 11px;
}

/* TRANSITION */
.t-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 20px;
}
.t-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}
.t-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.t-value {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 500;
  line-height: 1;
  margin-bottom: 5px;
}
.t-sub {
  font-size: 10px;
  color: var(--text-dim);
  line-height: 1.5;
}

/* PAGE FOOTNOTE */
.page-footnote {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-dim);
}
.page-footnote span {
  font-family: var(--mono);
  font-size: 10px;
}
.footnote-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent-soft);
  text-decoration: none;
}
.footnote-link:hover {
  color: #7eb3ff;
}

.spacer {
  height: 20px;
}

/* ── Added by the DEV-112 port; everything above is the wireframe verbatim ── */

/* Nav items became anchors so each section is deep-linkable (DESIGN.md asks for routes,
   not display:none toggling). These reset the link defaults the wireframe never needed. */
/* Only the underline needs removing. Do not set `display` here: `a.nav-item` outranks
   `.nav-item`, so overriding it would drop the flex layout the number column depends on —
   both the 10px gap and the 16px width on .nav-num stop applying. */
a.nav-item {
  text-decoration: none;
}

/* Loading and failure states. The wireframe had none — it never fetched anything. */
.page-state {
  padding: 40px 0;
  font-size: 13px;
  color: var(--text-dim);
}
.page-state.is-error {
  color: var(--orange);
}

/* An empty state for a null score. `null` means insufficient history, never 0, so it must
   not render as a zero-width bar that reads as a calm market. */
.is-empty {
  color: var(--text-dim);
  font-family: var(--mono);
}

/* ADR-4's MA90/Vol90 fallback, surfaced rather than hidden. */
.degraded-note {
  font-size: 10px;
  color: var(--yellow);
  margin-top: 6px;
  line-height: 1.5;
}

@media (prefers-reduced-motion: reduce) {
  .live-dot {
    animation: none;
  }
  * {
    transition: none !important;
  }
}

/* Crosshair tooltip. docs/DESIGN.md treats this as default behaviour on every line chart,
   not an enhancement — without it a 90-point series cannot be read at a single date. */
.chart-area {
  position: relative;
}
.chart-tooltip {
  position: absolute;
  z-index: 10;
  pointer-events: none;
  min-width: 132px;
  padding: 8px 10px;
  border: 1px solid var(--border2);
  border-radius: 7px;
  background: rgba(7, 8, 11, 0.94);
  backdrop-filter: blur(6px);
}
.chart-tooltip .tt-date {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-bright);
  margin-bottom: 6px;
}
.chart-tooltip .tt-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  color: var(--text-dim);
  line-height: 1.8;
}
.chart-tooltip .tt-swatch {
  width: 10px;
  height: 2px;
  border-radius: 1px;
  flex-shrink: 0;
}
.chart-tooltip .tt-label {
  flex: 1;
  white-space: nowrap;
}
.chart-tooltip .tt-value {
  font-family: var(--mono);
  color: var(--text-bright);
}
