/* Dosarul Averilor — editorial civic identity (v3).
   Inspired by the art direction of companiidestat.ro: warm paper, violet-cast
   ink, one loud ultramarine for data and action, acid green as a marker pen,
   flare red strictly for alarm. Three voices: Unbounded (display — titles and
   hero numerals), Hanken Grotesk (body), JetBrains Mono (labels, meta, tabular
   numerals). Sharp corners, hairline rules, no decorative shadows.
   Every text pair computed ≥ 4.5:1 (WCAG AA) on its surface in both modes;
   in-bar labels use --on-accent (6.0/7.5:1), marker text --on-acid (≥11:1). */

:root {
  --page:        #f9f0e7;   /* warm paper                                    */
  --surface:     #fdf8f2;   /* chart sheet                                   */
  --panel:       #f3e0d6;   /* deep-cream panels: facts, callouts            */
  --ink:         #161421;
  --ink-2:       #383642;
  --muted:       #63626b;   /* 5.3:1 on paper                                */
  --line:        #cbc3ba;   /* hairline rules                                */
  --grid:        #e7ddd2;
  --baseline:    #b3a99e;
  --accent:        #2c4ef5; /* ultramarine — the single data & action hue    */
  --accent-strong: #1b2fc7; /* text emphasis / hover (8.2:1)                 */
  --accent-wash: rgba(44, 78, 245, 0.09);
  --on-accent:   #ffffff;   /* labels inside accent bars (6.0:1)             */
  --acid:        #d0dd32;   /* marker pen — backgrounds only, never text     */
  --on-acid:     #14131d;   /* ink on acid (12:1)                            */
  --deemph:      #e0d2c5;   /* de-emphasis bars                              */
  --hover-lift:  rgba(22, 20, 33, 0.05);
  --stamp:       #1b2fc7;   /* document chips — decorative                   */
  --alarm:       #be0000;   /* flare, deep step for text (5.9:1)             */
  --alarm-mark:  #ff3800;   /* flare, full — marks only, never small text    */
  --shadow-pop:  0 10px 30px rgba(22, 20, 33, 0.18);
  /* sequential ultramarine ramp (declarations map) */
  --q1: #b0c9ff; --q2: #8eacf5; --q3: #6d8ee4; --q4: #4e70d2;
  --q5: #3151c0; --q6: #1a32b1; --q7: #0f069b;
  /* sequential green ramp (salary map) */
  --a1: #b5d892; --a2: #96bd6d; --a3: #77a246; --a4: #5a8715;
  --a5: #3d6d00; --a6: #255600; --a7: #0f4000;
  --tile-nodata: #e7ddd2;
  --display: "Unbounded", ui-sans-serif, system-ui, sans-serif;
  --sans: "Hanken Grotesk", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
}

[data-theme="dark"] {
  --page:        #0f0e18;   /* the archive at night, violet-black           */
  --surface:     #181721;
  --panel:       #201e2c;
  --ink:         #ebe7e1;
  --ink-2:       #c2bdb5;
  --muted:       #929199;   /* 5.7:1 on surface                              */
  --line:        #34323f;
  --grid:        #262433;
  --baseline:    #4a4859;
  --accent:        #779fff; /* 6.9:1 on surface                              */
  --accent-strong: #8caeff;
  --accent-wash: rgba(119, 159, 255, 0.14);
  --on-accent:   #0f0e18;   /* dark ink on the light dark-mode bars (7.5:1)  */
  --acid:        #c6d246;
  --on-acid:     #14131d;
  --deemph:      #34323f;
  --hover-lift:  rgba(235, 231, 225, 0.06);
  --stamp:       #8caeff;
  --alarm:       #fd6844;   /* 6.1:1 on surface                              */
  --alarm-mark:  #fd6844;
  --shadow-pop:  0 10px 30px rgba(0, 0, 0, 0.5);
  --q1: #172d94; --q2: #2b48aa; --q3: #4161c0; --q4: #597ad7;
  --q5: #7294ed; --q6: #8caeff; --q7: #aacbff;
  --a1: #224900; --a2: #386000; --a3: #4f7715; --a4: #678f37;
  --a5: #7fa754; --a6: #99c070; --a7: #b6dd8f;
  --tile-nodata: #232132;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page:        #0f0e18;
    --surface:     #181721;
    --panel:       #201e2c;
    --ink:         #ebe7e1;
    --ink-2:       #c2bdb5;
    --muted:       #929199;
    --line:        #34323f;
    --grid:        #262433;
    --baseline:    #4a4859;
    --accent:        #779fff;
    --accent-strong: #8caeff;
    --accent-wash: rgba(119, 159, 255, 0.14);
    --on-accent:   #0f0e18;
    --acid:        #c6d246;
    --on-acid:     #14131d;
    --deemph:      #34323f;
    --hover-lift:  rgba(235, 231, 225, 0.06);
    --stamp:       #8caeff;
    --alarm:       #fd6844;
    --alarm-mark:  #fd6844;
    --shadow-pop:  0 10px 30px rgba(0, 0, 0, 0.5);
    --q1: #172d94; --q2: #2b48aa; --q3: #4161c0; --q4: #597ad7;
    --q5: #7294ed; --q6: #8caeff; --q7: #aacbff;
    --a1: #224900; --a2: #386000; --a3: #4f7715; --a4: #678f37;
    --a5: #7fa754; --a6: #99c070; --a7: #b6dd8f;
    --tile-nodata: #232132;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: 0.01ms !important; }
}

body {
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--acid); color: var(--on-acid); }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

.serif { font-family: var(--display); }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ---------- two-column layout: sticky nav + content ---------- */
.layout {
  max-width: 1280px;
  display: grid; grid-template-columns: 180px minmax(0, 1fr);
  gap: 52px; align-items: start;
}
.side-rail {
  position: sticky; top: 62px;
  padding-top: 76px; min-width: 0;
  max-height: calc(100vh - 62px); overflow-y: auto;
}
.content { min-width: 0; counter-reset: fig; }

/* ---------- masthead ---------- */
.masthead {
  border-bottom: 2px solid var(--ink);
  background: var(--page);
  position: sticky; top: 0; z-index: 30;
}
.masthead .wrap {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 12px; padding-bottom: 12px;
}
.wordmark {
  font-family: var(--display); font-weight: 700; font-size: 13px;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.wordmark span { color: var(--accent); }
.masthead-right { display: flex; align-items: center; gap: 16px; }
.masthead-right .src {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
}
.barcode {
  width: 58px; height: 16px;
  background: repeating-linear-gradient(90deg,
    var(--ink) 0 1px, transparent 1px 3px,
    var(--ink) 3px 6px, transparent 6px 7px,
    var(--ink) 7px 8px, transparent 8px 11px,
    var(--ink) 11px 13px, transparent 13px 14px);
  opacity: 0.85;
}
#theme-btn, #lang-btn {
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  border: 1.5px solid var(--ink); background: transparent; color: var(--ink);
  padding: 5px 12px; cursor: pointer; text-decoration: none;
  transition: background 120ms, color 120ms;
}
#theme-btn:hover, #lang-btn:hover { background: var(--ink); color: var(--page); }

/* ---------- hero: full-bleed stage on paper, no box ---------- */
.hero {
  position: relative;
  padding: 58px 0 20px;
  margin-top: 8px;
}
.kicker {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-2);
  margin-bottom: 26px;
  display: flex; align-items: center; gap: 10px;
}
.kicker::before {
  content: ""; width: 9px; height: 9px; flex: none;
  background: var(--accent); border-radius: 50%;
}
h1 {
  font-family: var(--display);
  font-size: clamp(34px, 5.6vw, 64px);
  line-height: 1.08; font-weight: 900; letter-spacing: -0.01em;
  max-width: 17ch;
}
.dek {
  font-family: var(--sans);
  font-size: clamp(17px, 2vw, 20px); line-height: 1.65;
  color: var(--ink-2); max-width: 58ch; margin-top: 24px;
}
.dek b { color: var(--ink); font-variant-numeric: tabular-nums; }
.byline {
  margin-top: 26px; padding-top: 14px;
  border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.byline b { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- stamps → document chips (decoration, never data) ---------- */
.stamp {
  position: absolute; top: 52px; right: 0;
  transform: rotate(-4deg);
  font-family: var(--mono); text-transform: uppercase; text-align: center;
  color: var(--stamp);
  border: 2px solid currentColor;
  padding: 7px 14px; opacity: 0.85;
  pointer-events: none; user-select: none;
}
.stamp b { display: block; font-size: 10.5px; letter-spacing: 0.18em; font-weight: 700; }
.stamp i { display: block; font-style: normal; font-size: 9px; letter-spacing: 0.1em; margin-top: 2px; }
.stamp-inline { position: static; display: inline-block; margin: 16px 0 0; transform: rotate(-2deg); }
.stamp-alarm { color: var(--alarm); }

/* ---------- KPI row: editorial stat stack, rules not boxes ---------- */
.kpis {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px 28px;
  margin: 40px 0 8px;
}
.kpis-2 { grid-template-columns: 1fr 1fr; margin: 14px 0 6px; }
.tile { border-top: 2px solid var(--ink); padding-top: 10px; }
.tile .label {
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
}
.tile .value {
  font-family: var(--display); font-size: 27px; font-weight: 700;
  font-variant-numeric: tabular-nums; margin-top: 7px; line-height: 1.15;
}
.tile .value small { font-family: var(--sans); font-size: 12px; font-weight: 400; color: var(--ink-2); letter-spacing: 0; }
.tile .note { font-family: var(--sans); font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* ---------- "Rezumatul dosarului" brief ---------- */
.brief {
  border-top: 2px solid var(--ink);
  padding: 16px 2px 6px; margin-top: 40px;
}
.brief-title {
  font-family: var(--mono); font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.24em; text-transform: uppercase; color: var(--ink);
}
.brief ul { list-style: none; margin-top: 8px; }
.brief li { border-bottom: 1px solid var(--grid); }
.brief li:last-child { border-bottom: none; }
.brief a {
  display: block; position: relative;
  padding: 12px 36px 12px 2px; color: var(--ink); text-decoration: none;
  font-family: var(--sans); font-size: 16.5px; font-weight: 600; line-height: 1.5;
  transition: color 120ms;
}
.brief a::after {
  content: "→"; color: var(--muted); font-family: var(--mono);
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  transition: transform 120ms, color 120ms;
}
.brief a:hover { color: var(--accent-strong); }
.brief a:hover::after { color: var(--accent-strong); transform: translateY(-50%) translateX(4px); }
.brief b { color: var(--accent-strong); font-variant-numeric: tabular-nums; }

/* ---------- table of contents ---------- */
.toc { display: flex; flex-direction: column; gap: 2px; }
.toc-title {
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.24em; text-transform: uppercase; color: var(--muted);
  padding: 0 0 9px 8px; border-bottom: 2px solid var(--ink);
  margin-bottom: 10px;
}
.toc a {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 8px 10px; color: var(--ink-2); text-decoration: none;
  transition: background 120ms, color 120ms;
}
.toc a b {
  color: var(--muted); font-weight: 700; margin-right: 8px;
  font-variant-numeric: tabular-nums;
}
.toc a:hover { background: var(--hover-lift); color: var(--ink); }
.toc a.active { background: var(--acid); color: var(--on-acid); }
.toc a.active b { color: var(--on-acid); }

/* ---------- sections: chapters ---------- */
section { padding: 72px 0 8px; scroll-margin-top: 58px; position: relative; }
section::before {
  content: attr(data-num);
  position: absolute; z-index: -1; right: -4px; top: 26px;
  font-family: var(--display); font-weight: 900; font-size: 140px; line-height: 1;
  color: color-mix(in srgb, var(--ink) 6%, transparent);
  pointer-events: none; user-select: none;
}
.sec-kicker { display: flex; align-items: center; gap: 14px; }
.sec-kicker::after { content: ""; height: 2px; flex: 1; background: var(--ink); }
.sec-kicker .tab {
  font-family: var(--mono); font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.2em; text-transform: uppercase;
  background: var(--ink); color: var(--page);
  padding: 7px 14px;
}
.sec-kicker .tab b { color: var(--acid); margin-right: 8px; font-variant-numeric: tabular-nums; }
h2 {
  font-family: var(--display);
  font-size: clamp(23px, 3vw, 32px); line-height: 1.22;
  font-weight: 700; letter-spacing: -0.005em;
  margin-top: 20px; max-width: 30ch;
}
.lead {
  font-family: var(--sans);
  font-size: 18px; line-height: 1.7; color: var(--ink-2);
  max-width: 62ch; margin-top: 16px;
}
.lead b, .lead strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.lead a { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
.lead a:hover { text-decoration-thickness: 3px; }

/* ---------- PDF / record links ---------- */
.pdf-link {
  display: inline-block;
  font-family: var(--mono); font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent-strong); text-decoration: none;
  border: 1.5px solid currentColor; padding: 2px 8px;
  white-space: nowrap;
  transition: background 120ms, color 120ms;
}
.pdf-link:hover { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.row-link { color: var(--ink); text-decoration: none; border-bottom: 1px dotted var(--muted); }
.row-link:hover { color: var(--accent-strong); border-bottom-color: var(--accent-strong); }
.fact-link {
  display: inline-block; margin-top: 10px;
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent-strong); text-decoration: none;
}
.fact-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.callout a {
  color: var(--accent-strong); text-decoration: none;
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.callout a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- chart cards: numbered exhibits ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line); border-top: 2px solid var(--ink);
  padding: 20px 22px 16px; margin-top: 26px;
}
.card h3 { font-family: var(--sans); font-size: 17.5px; font-weight: 700; line-height: 1.35; }
.card h3::before {
  counter-increment: fig;
  content: "Fig. " counter(fig, decimal-leading-zero);
  display: block;
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--accent-strong); margin-bottom: 6px;
}
.card .sub { font-family: var(--sans); font-size: 13px; color: var(--muted); margin-top: 5px; line-height: 1.55; }
.card .plot { margin-top: 16px; }
.card .takeaway {
  display: inline-block;
  font-family: var(--sans); font-size: 15px; font-weight: 600; line-height: 1.5;
  background: var(--acid); color: var(--on-acid);
  padding: 7px 12px; margin-top: 14px;
  max-width: 64ch;
}
.card .takeaway > b:first-child {
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase;
  margin-right: 7px;
}
.card .takeaway b { font-variant-numeric: tabular-nums; }
.card .foot {
  font-family: var(--sans); font-size: 13px; color: var(--muted);
  line-height: 1.6;
  margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--grid);
}
.card .foot a { color: var(--accent-strong); text-decoration: none; }
.card .foot a:hover { text-decoration: underline; text-underline-offset: 3px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.grid-2 > * { min-width: 0; }

svg { display: block; width: 100%; height: auto; }
svg text { font-family: var(--mono); }

.bar          { fill: var(--accent); }
.bar.dim      { fill: var(--deemph); }
.bar-hit      { fill: transparent; cursor: default; }
.bar-hit:focus { outline: none; }
.axis-label   { fill: var(--muted); font-size: 10px; }
.cat-label    { fill: var(--ink-2); font-size: 11px; }
.val-label    { fill: var(--ink); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.val-label.in { fill: var(--on-accent); }
.gridline     { stroke: var(--grid); stroke-width: 1; }
.baseline     { stroke: var(--baseline); stroke-width: 1; }
.ref-line     { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 3 3; }
.ref-text     { fill: var(--ink-2); font-size: 10px; font-weight: 700; }

/* ---------- callouts: pinned service notes ---------- */
.callout {
  background: var(--panel);
  border-left: 4px solid var(--accent);
  padding: 16px 22px 14px; margin-top: 28px;
  font-family: var(--sans); font-size: 16.5px; line-height: 1.6; color: var(--ink);
  max-width: 72ch;
}
.callout::before {
  content: "Notă de serviciu";
  display: block;
  font-family: var(--mono); font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.24em; text-transform: uppercase; color: var(--accent-strong);
  margin-bottom: 8px;
}
.callout small {
  display: block; font-family: var(--mono); font-size: 10.5px;
  color: var(--muted); margin-top: 9px;
}

/* ---------- fact tiles: lettered annexes ---------- */
.facts {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
  margin-top: 26px; counter-reset: annex;
}
.fact {
  background: var(--panel);
  padding: 13px 15px 15px;
}
.fact::before {
  counter-increment: annex;
  content: "Anexa " counter(annex, upper-alpha);
  display: block;
  font-family: var(--mono); font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--line); padding-bottom: 7px; margin-bottom: 10px;
}
.fact .v {
  font-family: var(--display); font-size: 21px; font-weight: 700;
  font-variant-numeric: tabular-nums; line-height: 1.2;
}
.fact .t { font-family: var(--sans); font-size: 13.5px; color: var(--ink-2); margin-top: 6px; line-height: 1.5; }

/* ---------- county map ---------- */
.map-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
}
.map-head h3 { min-width: 0; }
.map-tabs { display: flex; border: 1.5px solid var(--ink); flex: none; }
.map-tab {
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  background: transparent; color: var(--ink); border: 0;
  padding: 7px 14px; cursor: pointer;
  transition: background 120ms, color 120ms;
}
.map-tab + .map-tab { border-left: 1.5px solid var(--ink); }
.map-tab.active { background: var(--ink); color: var(--page); }
.map-tab:not(.active):hover { background: var(--hover-lift); }

.map-shape {
  stroke: var(--surface); stroke-width: 1.2; stroke-linejoin: round;
  cursor: default;
}
.map-shape:focus { outline: none; }
.map-code  { font-size: 15px; font-weight: 700; pointer-events: none; }
.map-legend { display: flex; align-items: center; gap: 3px; margin-top: 12px; flex-wrap: wrap; }
.map-legend .cell { width: 34px; height: 10px; }
.map-legend .lg-label {
  font-family: var(--mono); font-size: 10px; color: var(--muted); margin: 0 6px 0 2px;
}

/* ---------- bloopers: «salariu» vs «salar» ---------- */
.versus { margin-top: 18px; }
.versus-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
.versus-side .w { display: block; font-family: var(--sans); font-size: 15.5px; font-weight: 700; }
.versus-side .n {
  font-family: var(--display); font-size: 26px; font-weight: 700;
  font-variant-numeric: tabular-nums; line-height: 1.25;
}
.versus-side .note { display: block; font-family: var(--mono); font-size: 10px; color: var(--muted); margin-top: 3px; }
.versus-side.right { text-align: right; }
.versus-bar { display: flex; height: 12px; margin-top: 12px; background: var(--deemph); }
.versus-bar .a { background: var(--accent); }
.versus-bar .b { background: var(--deemph); }
.versus-pct { font-family: var(--mono); font-size: 10.5px; color: var(--muted); margin-top: 8px; }

/* ---------- bloopers: per-bank spelling registry ---------- */
.bank-list { margin-top: 12px; }
.bank-list details { border-bottom: 1px solid var(--grid); }
.bank-list details:last-child { border-bottom: none; }
.bank-list summary {
  display: flex; align-items: baseline; gap: 12px;
  padding: 10px 6px; cursor: pointer; user-select: none; list-style: none;
}
.bank-list summary::-webkit-details-marker { display: none; }
.bank-list summary::before {
  content: "+"; font-family: var(--mono); font-size: 14px; font-weight: 700;
  color: var(--accent-strong); width: 14px; flex: none;
}
.bank-list details[open] summary::before { content: "–"; }
.bank-list summary:hover { background: var(--hover-lift); }
.bank-list .b-name { font-family: var(--sans); font-size: 15px; font-weight: 700; flex: 1; min-width: 0; }
.bank-list .b-meta {
  font-family: var(--mono); font-size: 10.5px; color: var(--muted);
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.bank-list .variants {
  max-height: 300px; overflow: auto; margin: 0 0 12px 20px;
  border: 1px solid var(--grid);
}

/* ---------- tables: scroll shells, pinned headers, zebra ---------- */
details.tbl { margin-top: 12px; }
details.tbl > div, #tbl-edge-inline, #tbl-pf-inline, #tbl-betting-inline,
#tbl-currency-inline {
  overflow: auto;
  max-height: 380px;
  margin-top: 8px;
  border: 1px solid var(--grid);
}
details.tbl summary {
  font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-2); cursor: pointer; user-select: none;
}
details.tbl summary:hover { color: var(--accent-strong); }
table { border-collapse: collapse; width: 100%; margin-top: 10px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--grid); }
th {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted); font-weight: 700;
  border-bottom: 2px solid var(--ink);
}
td { font-family: var(--sans); font-size: 14px; line-height: 1.45; }
td.num, th.num { text-align: right; }
td.num { font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }
tbody tr:nth-child(even) { background: color-mix(in srgb, var(--ink) 3%, transparent); }
tbody tr:hover { background: var(--hover-lift); }

details.tbl > div table, #tbl-edge-inline table, #tbl-pf-inline table,
#tbl-betting-inline table, #tbl-currency-inline table,
.explorer-card table, .bank-list .variants table {
  margin-top: 0;
}
details.tbl > div thead th, #tbl-edge-inline thead th, #tbl-pf-inline thead th,
#tbl-betting-inline thead th, #tbl-currency-inline thead th,
.explorer-card thead th, .bank-list .variants thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface);
  padding-top: 11px;
}

/* ---------- explorer: the search registry ---------- */
.filters {
  display: flex; gap: 10px; flex-wrap: wrap; margin-top: 26px;
  align-items: center;
}
.filters input[type="search"], .filters select {
  font-family: var(--sans); font-size: 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-bottom: 2px solid var(--ink); color: var(--ink);
  padding: 10px 12px;
  transition: border-color 120ms;
}
.filters input[type="search"]:focus, .filters select:focus {
  border-color: var(--accent); outline: none;
}
.filters input[type="search"] { flex: 1; min-width: 220px; }
.filters .count {
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  margin-left: auto; font-variant-numeric: tabular-nums;
}
#explorer-more {
  margin: 18px auto 6px; display: block;
  font-family: var(--mono); font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  border: 1.5px solid var(--ink); background: transparent; color: var(--ink);
  padding: 10px 28px; cursor: pointer;
  transition: background 120ms, color 120ms;
}
#explorer-more:hover { background: var(--ink); color: var(--page); }
.explorer-card {
  overflow: auto;
  max-height: 74vh;
  padding-top: 0;
}
.explorer-card table { min-width: 960px; }
#ex-table tbody td:first-child { font-weight: 700; }
td.ex-type { font-family: var(--mono); font-size: 10.5px; color: var(--ink-2); white-space: nowrap; }
td.ex-type small { font-size: 9.5px; color: var(--muted); }
.person-badge, .person-badge-demo {
  font-family: var(--mono); font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.04em; white-space: nowrap;
  border: 1.5px solid var(--accent-strong); background: transparent; color: var(--accent-strong);
  padding: 1px 7px;
}
.person-badge { margin-left: 8px; cursor: pointer; transition: background 120ms, color 120ms; }
.person-badge:hover, .person-badge.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
#ex-pid-clear {
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  border: 1.5px solid var(--alarm); color: var(--alarm); background: transparent;
  padding: 8px 13px; cursor: pointer;
  transition: background 120ms, color 120ms;
}
#ex-pid-clear:hover { background: var(--alarm); color: var(--page); }
.endnote {
  font-family: var(--sans); font-size: 13px; color: var(--muted);
  line-height: 1.6; margin-top: 14px; max-width: 88ch;
}

/* ---------- tooltip: inverted, popped ---------- */
#tooltip {
  position: fixed; z-index: 50; pointer-events: none;
  background: var(--ink); color: var(--page);
  box-shadow: var(--shadow-pop);
  padding: 9px 12px;
  font-family: var(--mono); font-size: 11px;
  max-width: 300px;
  opacity: 0; transition: opacity 80ms;
}
#tooltip.on { opacity: 1; }
#tooltip .tt-title { font-family: var(--sans); font-size: 13.5px; font-weight: 700; color: var(--page); margin-bottom: 3px; }
#tooltip .tt-val { font-weight: 700; color: var(--acid); font-variant-numeric: tabular-nums; }
[data-theme="dark"] #tooltip .tt-val { color: #d6e05a; }

/* ---------- methodology footer ---------- */
.methodology {
  margin-top: 76px; border-top: 6px double var(--ink);
  padding: 32px 0 50px;
}
.methodology h2 { font-size: 19px; }
.methodology h2::before {
  content: "Fila finală";
  display: block;
  font-family: var(--mono); font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.24em; text-transform: uppercase; color: var(--muted);
  margin-bottom: 8px;
}
.methodology p, .methodology li {
  font-family: var(--sans);
  font-size: 15px; line-height: 1.65; color: var(--ink-2);
  max-width: 80ch; margin-top: 10px;
}
.methodology ul { margin: 10px 0 0 18px; }
.methodology li { margin-top: 6px; }
.methodology code { font-family: var(--mono); font-size: 13px; }
#generated-note { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .masthead { position: static; }
  .masthead-right .src, .barcode { display: none; }
  .layout { grid-template-columns: 1fr; gap: 0; }
  .side-rail {
    position: sticky; top: 0; padding-top: 0; max-height: none; overflow: visible;
    background: var(--page); z-index: 20;
    border-bottom: 2px solid var(--ink);
    margin: 0 -20px; padding: 8px 14px;
  }
  .toc { flex-direction: row; overflow-x: auto; gap: 4px; }
  .toc-title { display: none; }
  .toc a { white-space: nowrap; padding: 7px 14px; }
  section { scroll-margin-top: 54px; }
  section::before { font-size: 92px; top: 12px; }
  .hero { padding: 34px 0 16px; }
  .stamp { position: static; display: inline-block; margin: 4px 0 22px; transform: rotate(-2deg); }
}

@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 780px) {
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 16px 20px; }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .tile .value { font-size: 21px; }
  .brief a { font-size: 15.5px; }
  section::before { font-size: 72px; right: 0; }
  .hero { padding: 28px 0 14px; }
}
