:root {
  --paper: #f2f1ec;
  --paper-strong: #e7e4dc;
  --ink: #17191c;
  --ink-soft: #575b61;
  --line: #c9c6bd;
  --panel: #faf9f5;
  --oi-orange: #e69f00;
  --oi-sky-blue: #56b4e9;
  --oi-green: #009e73;
  --oi-yellow: #f0e442;
  --oi-blue: #0072b2;
  --oi-vermillion: #d55e00;
  --oi-purple: #cc79a7;
  --oi-black: #000000;
  --vermilion: var(--oi-vermillion);
  --vermilion-dark: #9a4300;
  --gold: var(--oi-orange);
  --forest: var(--oi-green);
  --steel: var(--oi-blue);
  --sidebar: 228px;
}

* { box-sizing: border-box; }
*:focus-visible { outline: 3px solid var(--oi-yellow); outline-offset: 4px; }
.skip-link { position: fixed; left: 16px; top: -80px; z-index: 20; padding: 12px 16px; background: var(--ink); color: var(--paper); font-weight: 800; }
.skip-link:focus { top: 16px; }
.loading-state { position: fixed; inset: 0; z-index: 15; display: grid; place-items: center; background: var(--paper); color: var(--ink); font-weight: 800; }
.loading-state[hidden] { display: none; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Manrope", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}
button, select { font: inherit; }

.shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 34px 24px 26px;
  background: var(--ink);
  color: var(--paper);
  display: flex;
  flex-direction: column;
  border-right: 6px solid var(--vermilion);
}
.brand-mark { display: flex; gap: 4px; height: 30px; align-items: flex-end; margin-bottom: 14px; }
.brand-mark span { display: block; width: 17px; background: var(--vermilion); transform: skew(-14deg); }
.brand-mark span:nth-child(1) { height: 18px; }
.brand-mark span:nth-child(2) { height: 30px; background: var(--gold); }
.brand-mark span:nth-child(3) { height: 23px; }
.brand-copy strong { display: block; font-family: "Barlow Condensed", sans-serif; font-size: 26px; letter-spacing: 0.04em; }
.brand-copy small { color: #b9b8b2; font-size: 9px; letter-spacing: 0.12em; }
.sidebar nav { margin-top: 64px; display: grid; gap: 3px; }
.nav-item {
  color: #aaa9a4;
  text-decoration: none;
  padding: 11px 0;
  border-bottom: 1px solid #34363a;
  transition: color 150ms ease, transform 150ms ease;
}
.nav-item:hover, .nav-item.active { color: var(--paper); transform: translateX(4px); }
.nav-item.active::before { content: ""; display: inline-block; width: 18px; height: 3px; background: var(--vermilion); margin: 0 9px 3px 0; }
.portfolio-link { margin-top: 18px; border-top: 1px solid #44484d; padding-top: 18px; }
.source-note { margin-top: auto; border-top: 1px solid #3a3c40; padding-top: 20px; display: grid; gap: 5px; }
.source-note span { color: var(--gold); font-size: 9px; font-weight: 700; letter-spacing: 0.12em; }
.source-note strong { font-size: 11px; line-height: 1.5; }
.source-note small { color: #aaa9a4; }

main { min-width: 0; padding: 34px clamp(22px, 4vw, 58px) 20px; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.eyebrow, .panel-kicker { margin: 0 0 8px; color: var(--vermilion); font-size: 10px; font-weight: 800; letter-spacing: 0.1em; }
h1, h2, p { letter-spacing: 0; }
h1 { margin: 0; max-width: 760px; font-family: "Barlow Condensed", sans-serif; font-size: clamp(42px, 5vw, 72px); line-height: 0.94; text-transform: uppercase; }
.lede { max-width: 680px; margin: 18px 0 0; color: var(--ink-soft); line-height: 1.7; }
.filters { display: flex; align-items: flex-end; gap: 9px; flex-shrink: 0; }
.filters label { display: grid; gap: 5px; }
.filters label span { font-size: 9px; font-weight: 800; text-transform: uppercase; color: var(--ink-soft); }
select, .filters button { min-height: 40px; border: 1px solid var(--ink); background: transparent; border-radius: 2px; padding: 0 12px; color: var(--ink); }
.filters button { cursor: pointer; background: var(--ink); color: var(--paper); border-color: var(--ink); }
.filters button:hover { background: var(--vermilion); border-color: var(--vermilion); }

.metric-strip { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr; border-bottom: 1px solid var(--line); }
.metric { padding: 26px 22px 25px 0; border-right: 1px solid var(--line); min-width: 0; }
.metric + .metric { padding-left: 22px; }
.metric:last-child { border-right: 0; }
.metric span, .metric small { display: block; color: var(--ink-soft); }
.metric span { font-size: 10px; font-weight: 700; text-transform: uppercase; }
.metric strong { display: block; margin: 8px 0 3px; font-family: "Barlow Condensed", sans-serif; font-size: clamp(34px, 3.8vw, 52px); line-height: 1; }
.metric.primary strong { color: var(--vermilion); }
.metric.signal strong { color: var(--forest); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.85fr); gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.panel { min-width: 0; background: var(--panel); padding: clamp(22px, 3vw, 36px); }
.trend-panel, .scatter-panel { min-height: 410px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.panel h2 { margin: 0; font-family: "Barlow Condensed", sans-serif; font-size: 28px; line-height: 1.05; text-transform: uppercase; }
.chart-frame { min-height: 300px; position: relative; }
.chart-frame svg { width: 100%; height: 300px; overflow: visible; }
.axis-label { fill: var(--ink-soft); font: 10px "Manrope", sans-serif; }
.grid-line { stroke: #dedbd3; stroke-width: 1; }
.trend-line { fill: none; stroke-width: 2.3; vector-effect: non-scaling-stroke; }
.trend-point, .scatter-dot { cursor: crosshair; transition: r 100ms ease, opacity 100ms ease; }
.trend-point:focus, .scatter-dot:focus { opacity: 1; stroke: var(--ink); stroke-width: 3px; }
.trend-point:hover, .scatter-dot:hover { r: 5; opacity: 1; }
.legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px 14px; }
.legend span { font-size: 10px; color: var(--ink-soft); white-space: nowrap; }
.legend i { display: inline-block; width: 16px; height: 3px; margin: 0 5px 2px 0; }

.insight-panel { background: var(--ink); color: var(--paper); display: flex; flex-direction: column; }
.insight-panel .panel-kicker { color: var(--gold); }
.insight-panel h2 { font-size: clamp(30px, 3.2vw, 45px); }
.insight-panel > p:not(.panel-kicker) { color: #b9b8b2; line-height: 1.7; }
.insight-number { margin-top: auto; padding-top: 34px; }
.insight-number span { display: block; color: var(--vermilion); font-family: "Barlow Condensed", sans-serif; font-size: 58px; font-weight: 800; }
.insight-number small { color: #b9b8b2; }

.bar-chart { display: grid; gap: 18px; }
.bar-row { display: grid; grid-template-columns: 85px minmax(0, 1fr) 78px; align-items: center; gap: 12px; }
.bar-label { font-weight: 700; }
.bar-track { height: 24px; background: var(--paper-strong); position: relative; }
.bar-fill { height: 100%; background: var(--forest); transform-origin: left; animation: reveal 600ms cubic-bezier(.22,1,.36,1) both; }
.bar-row:nth-child(1) .bar-fill { background: var(--oi-orange); }
.bar-row:nth-child(2) .bar-fill { background: var(--oi-sky-blue); }
.bar-row:nth-child(3) .bar-fill { background: var(--oi-green); }
.bar-row:nth-child(4) .bar-fill { background: var(--oi-blue); }
.bar-value { font-family: "Barlow Condensed", sans-serif; font-size: 21px; font-weight: 700; text-align: right; }

.correlation-key { font-size: 10px; color: var(--ink-soft); }
.correlation-list { display: grid; gap: 11px; }
.corr-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) 44px; gap: 10px; align-items: center; }
.corr-row span { font-size: 11px; }
.corr-track { height: 12px; position: relative; background: linear-gradient(90deg, #d9d5cb 49.5%, var(--ink) 49.5%, var(--ink) 50.5%, #d9d5cb 50.5%); }
.corr-fill { position: absolute; top: 2px; height: 8px; }
.corr-fill.negative { right: 50%; background: var(--vermilion); }
.corr-fill.positive { left: 50%; background: var(--oi-blue); }
.corr-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }

.data-panel { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: start; background: var(--paper-strong); }
.data-panel p { color: var(--ink-soft); line-height: 1.7; }
.data-panel code { font-family: inherit; color: var(--vermilion-dark); font-weight: 700; }
.data-panel dl { margin: 0; display: grid; gap: 13px; }
.data-panel dl div { border-bottom: 1px solid #bbb8ae; padding-bottom: 11px; }
.data-panel dt { color: var(--ink-soft); font-size: 9px; text-transform: uppercase; font-weight: 800; }
.data-panel dd { margin: 5px 0 0; font-weight: 700; word-break: break-word; }

footer { display: flex; justify-content: space-between; gap: 20px; padding: 18px 0 0; color: var(--ink-soft); font-size: 10px; }
.tooltip { position: fixed; z-index: 10; pointer-events: none; opacity: 0; transform: translate(10px, 10px); background: var(--ink); color: var(--paper); padding: 8px 10px; border-radius: 2px; font-size: 11px; line-height: 1.5; transition: opacity 80ms ease; }
.tooltip.visible { opacity: 1; }

@keyframes reveal { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

@media (max-width: 1000px) {
  :root { --sidebar: 184px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .filters { width: 100%; }
  .filters label { flex: 1; }
  select { width: 100%; }
  .metric-strip { grid-template-columns: repeat(2, 1fr); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(3), .metric:nth-child(4) { border-top: 1px solid var(--line); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 18px 20px; border-right: 0; border-bottom: 5px solid var(--vermilion); display: grid; grid-template-columns: auto 1fr; gap: 0 15px; align-items: center; }
  .brand-mark { margin: 0; }
  .sidebar nav { grid-column: 1 / -1; margin-top: 16px; display: flex; overflow-x: auto; gap: 20px; }
  .nav-item { border: 0; padding: 8px 0; white-space: nowrap; }
  .source-note { display: none; }
  main { padding: 24px 18px 18px; }
  .filters { display: grid; grid-template-columns: 1fr 1fr; }
  .filters button { grid-column: 1 / -1; }
  .metric-strip { grid-template-columns: 1fr 1fr; }
  .metric { padding: 20px 12px 20px 0; }
  .metric + .metric { padding-left: 12px; }
  .panel { padding: 24px 18px; }
  .panel-heading { display: block; }
  .legend { justify-content: flex-start; margin-top: 12px; }
  .corr-row { grid-template-columns: 96px minmax(0, 1fr) 40px; }
  .bar-row { grid-template-columns: 70px minmax(0, 1fr) 62px; }
  .data-panel { grid-template-columns: 1fr; gap: 22px; }
  footer { flex-direction: column; }
}
