:root {
  --paper: #ffffff;
  --ink: #111111;
  --ink-2: #555555;
  --ink-3: #767676;
  --rule: #111111;
  --rule-soft: #e2e2e2;
  --wash: #f4f4f2;
  --blue: #1f3fd9;
  --hue: #c2410c;
  --hue-soft: #f6d9c9;
  --sans: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --side: 380px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
}
a { color: var(--blue); text-underline-offset: 2px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
h1, h2, h3 { font-weight: 700; letter-spacing: -0.01em; margin: 0; }
code { font-family: var(--mono); font-size: 0.9em; }

.layout {
  display: grid;
  grid-template-columns: var(--side) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  grid-template-areas: "head main" "side main";
  min-height: 100vh;
}
.head { grid-area: head; padding: 24px 20px 0; border-right: 1px solid var(--rule-soft); }
.side { grid-area: side; }
.main { grid-area: main; }

/* ---------- side column ---------- */
.side { border-right: 1px solid var(--rule-soft); }
.side-inner { padding: 0 20px 40px; }
.title { font-size: 28px; line-height: 1.12; margin-bottom: 12px; }
.lede { margin: 0 0 22px; color: var(--ink); }
.side-head { border-top: 2px solid var(--rule); padding-top: 10px; margin-bottom: 8px; }
.side-head h2 { font-size: 16px; }
.hint { font-size: 13px; color: var(--ink-2); margin: 4px 0 0; }

.sector { margin-top: 14px; }
.sector-name {
  display: flex; justify-content: space-between; gap: 8px; align-items: baseline;
  font-size: 13px; font-weight: 700; padding: 6px 0 4px; border-bottom: 1px solid var(--rule);
}
.sector-name .gdp { font-weight: 400; color: var(--ink-3); white-space: nowrap; }

.occ { border-bottom: 1px solid var(--rule-soft); }
.occ-btn {
  all: unset; box-sizing: border-box; cursor: pointer; width: 100%;
  display: grid; grid-template-columns: minmax(0, 1fr) 84px 30px; gap: 8px; align-items: center;
  padding: 6px 0; font-size: 13.5px; line-height: 1.3;
}
.occ-btn:hover .occ-name { color: var(--blue); }
.occ-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.occ[aria-expanded="true"] .occ-name { font-weight: 700; }
.occ-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 12.5px; }
.minibar { position: relative; height: 8px; background: var(--wash); }
.minibar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ink); }
.minibar i.over { background: var(--hue); }
.minibar b { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--ink-3); }

.occ-detail { padding: 4px 0 16px; font-size: 13.5px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 6px 0 10px; }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; }
.bars7 { width: 100%; height: auto; display: block; margin: 4px 0 10px; }
.bars7 text { font: 11px var(--sans); fill: var(--ink-2); }
.bars7 .v { fill: var(--ink); font-variant-numeric: tabular-nums; }
.ex-head { font-size: 13px; font-weight: 700; margin: 10px 0 4px; }
.ex-prompt {
  white-space: pre-wrap; font-family: var(--sans); background: var(--wash); padding: 10px 12px; max-height: 280px;
  overflow-y: auto; font-size: 13px; line-height: 1.45; margin: 0;
}
.files { color: var(--ink-2); font-size: 12.5px; margin: 6px 0 0; overflow-wrap: anywhere; }
.files span { font-family: var(--mono); font-size: 11.5px; }

/* ---------- main column ---------- */
.main { padding: 24px 28px 60px; min-width: 0; }
.panel { margin-bottom: 40px; max-width: 1100px; }
.panel-head { border-top: 2px solid var(--rule); padding-top: 10px; }
.panel h2 { font-size: 20px; }
.sub { margin: 2px 0 0; color: var(--ink-2); font-size: 14px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 12px 0 4px; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend svg { flex: none; }
.chart { margin: 0; position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
#chart-expert svg { min-height: 420px; }
.chart text { font: 12px var(--sans); fill: var(--ink-2); }
.chart .axis line, .chart .grid line { stroke: var(--rule-soft); }
.chart .axis path { stroke: var(--ink); }
.chart .parity { stroke: var(--ink); stroke-dasharray: 5 4; stroke-width: 1.2; }
.chart .parity-label { fill: var(--ink); font-weight: 700; }
.chart .lab { fill: var(--ink); font-size: 12px; }
.chart .lab.muted { fill: var(--ink-2); }
.chart .frontier { fill: none; stroke: var(--hue); stroke-width: 1.5; opacity: 0.55; }
.chart .dot { cursor: pointer; }
.chart .hit { fill: transparent; cursor: pointer; }
.note { font-size: 13px; color: var(--ink-2); margin: 10px 0 0; max-width: 760px; }

.prose { max-width: 760px; }
.prose h2 { border-top: 2px solid var(--rule); padding-top: 10px; margin-bottom: 8px; }
.prose p { margin: 0 0 12px; }
.limits { padding-left: 18px; margin: 0 0 14px; }
.limits li { margin-bottom: 8px; }

.sector-table { overflow-x: auto; }
.sector-table table { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
.sector-table th, .sector-table td { padding: 5px 6px; border-bottom: 1px solid var(--rule-soft); text-align: right; }
.sector-table th:first-child, .sector-table td:first-child { text-align: left; }
.sector-table thead th { border-bottom: 1px solid var(--rule); font-weight: 700; vertical-align: bottom; font-size: 12px; }
.sector-table td.best { font-weight: 700; }
.sector-table td.over { color: var(--hue); }

.sources ul { padding-left: 18px; font-size: 13.5px; }
.sources li { margin-bottom: 8px; }
.built { font-size: 13px; color: var(--ink-3); }

.tip {
  position: fixed; z-index: 20; pointer-events: none; display: none;
  background: var(--paper); border: 1px solid var(--rule); padding: 8px 10px;
  font-size: 13px; max-width: 280px; line-height: 1.4;
}
.tip strong { display: block; }
.tip .src { color: var(--ink-2); font-size: 12px; margin-top: 4px; }

/* ---------- narrow screens ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "main" "side"; grid-template-rows: auto; }
  .head { border-right: 0; padding: 20px 16px 0; }
  .side { border-right: 0; }
  .side-inner { padding: 0 16px 32px; }
  .main { padding: 4px 16px 24px; }
  #chart-expert svg { min-height: 0; }
  .title { font-size: 24px; }
}
