/* Bugetele primăriilor din Republica Moldova (2025)
 * Art direction: "Treasury Ledger & Tax-Stamp Print" — Moldovan public-treasury broadsheet.
 * Day-one dual theming (Light parchment + Dark slate), strict WCAG AAA (>=7:1 normal text).
 */

@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("fonts/fraunces-normal-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("fonts/fraunces-normal-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("fonts/source-serif-4-normal-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("fonts/source-serif-4-normal-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url("fonts/source-serif-4-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url("fonts/source-serif-4-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/ibmplexsans-normal-500-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/ibmplexsans-normal-500-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/ibmplexsans-normal-600-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/ibmplexsans-normal-600-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Base Light Theme (Archival Ledger Parchment) — all text pairs >= 7:1 AAA */
:root {
  color-scheme: light dark;
  --bg: #f7f4ec;
  --band: #efe9dc;
  --surface: #fcfaf4;
  --fg: #14181c;
  --mut: #424a52;
  --crim: #851d12;
  --pine: #0d4f38;
  --ochre: #684606;
  --acc: #0d4f38;
  --acc-ink: #fcfaf4;
  --focus: #0b4a8f;
  --line: #ccc3b0;
  --line-soft: #dfd8c7;
  --line-strong: #6f6657;
  --row-hover: #f0eadc;

  /* Map choropleth 6-step ledger palette (Light) */
  --bin-0: #b23c2c;
  --bin-1: #cf6b56;
  --bin-2: #e3a787;
  --bin-3: #d8d3bd;
  --bin-4: #84b49a;
  --bin-5: #297457;
  --map-border: #f7f4ec;
  --map-nonrep-bg: #e5decb;
  --map-hatch: #786e5d;
  --map-river: #4c7899;
  --map-label: #14181c;
  --map-halo: #f7f4ec;

  /* Stacked ledger bar fills (Light) */
  --seg-tax: #0d4f38;
  --seg-oth: #3c8266;
  --seg-grant: #2c6282;
  --seg-ear-cur: #9c2b1d;
  --seg-gen: #c9684b;
  --seg-ear-cap: #b88424;
  --seg-pay: #851d12;
  --seg-goods: #6e6454;
  --seg-cap: #0d4f38;
  --seg-other-exp: #b9b09e;

  --display: "Fraunces", Georgia, serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --col: 68rem;
  --to-top-bg: #14181c;
  --to-top-fg: #f7f4ec;
}

:root:has(> head > meta[name="color-scheme"][content="dark"]) {
  color-scheme: dark;
}
:root:has(> head > meta[name="color-scheme"][content="light"]) {
  color-scheme: light;
}

/* Dark Theme (Deep Ledger Slate) — all text pairs >= 7.5:1 AAA */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1318;
    --band: #151b22;
    --surface: #1b222b;
    --fg: #f3efe6;
    --mut: #bcc5ce;
    --crim: #f79788;
    --pine: #76dfb7;
    --ochre: #f0c56e;
    --acc: #76dfb7;
    --acc-ink: #0f1318;
    --focus: #93c5fd;
    --line: #2d3743;
    --line-soft: #222b35;
    --line-strong: #627285;
    --row-hover: #212a35;

    --bin-0: #a5382a;
    --bin-1: #c45b48;
    --bin-2: #cc8b6b;
    --bin-3: #5a635d;
    --bin-4: #38795f;
    --bin-5: #23986c;
    --map-border: #0f1318;
    --map-nonrep-bg: #182028;
    --map-hatch: #707e8c;
    --map-river: #6da1c9;
    --map-label: #f3efe6;
    --map-halo: #0f1318;

    --seg-tax: #45b88c;
    --seg-oth: #76dfb7;
    --seg-grant: #6da1c9;
    --seg-ear-cur: #e06a58;
    --seg-gen: #f59c89;
    --seg-ear-cap: #e0b254;
    --seg-pay: #e06a58;
    --seg-goods: #8d9aa6;
    --seg-cap: #45b88c;
    --seg-other-exp: #465362;

    --to-top-bg: #f3efe6;
    --to-top-fg: #0f1318;
  }
}

html[data-theme="dark"] {
  --bg: #0f1318;
  --band: #151b22;
  --surface: #1b222b;
  --fg: #f3efe6;
  --mut: #bcc5ce;
  --crim: #f79788;
  --pine: #76dfb7;
  --ochre: #f0c56e;
  --acc: #76dfb7;
  --acc-ink: #0f1318;
  --focus: #93c5fd;
  --line: #2d3743;
  --line-soft: #222b35;
  --line-strong: #627285;
  --row-hover: #212a35;

  --bin-0: #a5382a;
  --bin-1: #c45b48;
  --bin-2: #cc8b6b;
  --bin-3: #5a635d;
  --bin-4: #38795f;
  --bin-5: #23986c;
  --map-border: #0f1318;
  --map-nonrep-bg: #182028;
  --map-hatch: #707e8c;
  --map-river: #6da1c9;
  --map-label: #f3efe6;
  --map-halo: #0f1318;

  --seg-tax: #45b88c;
  --seg-oth: #76dfb7;
  --seg-grant: #6da1c9;
  --seg-ear-cur: #e06a58;
  --seg-gen: #f59c89;
  --seg-ear-cap: #e0b254;
  --seg-pay: #e06a58;
  --seg-goods: #8d9aa6;
  --seg-cap: #45b88c;
  --seg-other-exp: #465362;

  --to-top-bg: #f3efe6;
  --to-top-fg: #0f1318;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--serif);
  font-size: 100%;
  line-height: 1.62;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  overflow-x: clip;
}

a {
  color: var(--pine);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.6rem 1rem;
  background: var(--fg);
  color: var(--bg);
  font-family: var(--sans);
  font-size: 0.9rem;
  z-index: 100;
}
.skip-link:focus { left: 0.75rem; top: 0.75rem; }

.wrap {
  width: min(var(--col), calc(100% - 2rem));
  margin-inline: auto;
}
.prose-narrow { max-width: 44rem; }
.tnum { font-family: var(--sans); font-variant-numeric: tabular-nums; }
.txt-pine { color: var(--pine); }
.txt-crim { color: var(--crim); }

/* Keep reading rail strictly outside the 68rem layout gutter */
@media (max-width: 1459px) {
  .rail { display: none; }
}
@media (min-width: 1460px) {
  .rail { --col: 68rem; --gut: 1.25rem; }
}

/* Masthead (compact, non-sticky so keyboard never collides on phones / FB in-app browser) */
.masthead {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  font-family: var(--sans);
  font-size: 0.875rem;
}
.masthead-inner {
  width: min(var(--col), calc(100% - 2rem));
  margin-inline: auto;
  min-height: 3.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-block: 0.45rem;
}
.brand {
  color: var(--fg);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.mast-nav {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  flex-wrap: wrap;
}
.mast-nav a {
  color: var(--mut);
  text-decoration: none;
  font-weight: 500;
}
.mast-nav a:hover { color: var(--fg); text-decoration: underline; }
.mast-tools {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.lang-switch {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 0.6rem;
  border: 1px solid var(--line);
  color: var(--fg);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.8125rem;
}
.lang-switch:hover { border-color: var(--fg); }
.theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fg);
  cursor: pointer;
}
.theme-btn:hover { border-color: var(--fg); }
@media (pointer: coarse) {
  .theme-btn, .lang-switch { min-height: 44px; min-width: 44px; }
}
@media (max-width: 760px) {
  .mast-nav { display: none; }
  .masthead-inner { flex-wrap: nowrap; min-height: 3.1rem; padding-block: 0.35rem; }
}

/* Broadsheet Opening Header */
.hero {
  padding-block: 1.5rem 1.35rem;
  border-bottom: 1px solid var(--line);
}
.hero-raion { padding-block: 1.8rem 1.5rem; }
.kicker {
  margin: 0 0 0.65rem;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--crim);
}
.kicker a { color: inherit; text-decoration: none; }
.kicker a:hover { text-decoration: underline; }
h1 {
  margin: 0 0 0.9rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.85rem, 3.6vw, 2.95rem);
  line-height: 1.09;
  letter-spacing: -0.02em;
  max-width: 24ch;
}
.deck {
  margin: 0 0 1.15rem;
  font-size: clamp(1.02rem, 1.3vw, 1.14rem);
  line-height: 1.54;
  color: var(--fg);
  max-width: 68ch;
}
h2 {
  margin: 0 0 0.6rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.35rem, 2.2vw, 1.8rem);
  line-height: 1.18;
  letter-spacing: -0.015em;
}
h3 {
  margin: 0 0 0.5rem;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.15rem;
  line-height: 1.25;
}
.section-label {
  margin: 0 0 0.65rem;
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--mut);
}
.section-sub {
  margin: 0 0 1.2rem;
  color: var(--mut);
  font-size: 0.98rem;
  max-width: 62ch;
}

/* 4-column Accounting Strip (double top rule, hairline columns, zero shadows) */
.ledger-strip {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 3px double var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}
.strip-cell {
  padding: 0.9rem 1rem 0.9rem 0;
  border-right: 1px solid var(--line);
}
.strip-cell:not(:first-child) { padding-left: 1rem; }
.strip-cell:last-child { border-right: 0; padding-right: 0.5rem; }
.strip-cell dt {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--mut);
  line-height: 1.32;
  margin-bottom: 0.3rem;
}
.strip-cell dd {
  margin: 0;
  font-size: clamp(1.3rem, 2vw, 1.65rem);
  font-weight: 600;
  line-height: 1.15;
}
.strip-cell dd.strip-note {
  margin-top: 0.28rem;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--mut);
  line-height: 1.35;
}
@media (max-width: 820px) {
  .ledger-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strip-cell { padding: 0.8rem 0.75rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .strip-cell:nth-child(odd) { padding-left: 0; border-right: 1px solid var(--line); }
  .strip-cell:nth-child(even) { padding-right: 0; }
  .strip-cell:nth-last-child(-n+2) { border-bottom: 0; }
}
@media (max-width: 480px) {
  .ledger-strip { grid-template-columns: 1fr; }
  .strip-cell, .strip-cell:nth-child(odd), .strip-cell:nth-child(even) {
    padding: 0.75rem 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .strip-cell:last-child { border-bottom: 0; }
}

/* Signature Treasury Desk (Finder + Dossier | Choropleth Map) */
.desk-section { padding-block: 1.45rem 2.2rem; }
.desk-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(0, 0.94fr);
  gap: 2.2rem;
  align-items: start;
}
@media (max-width: 960px) {
  .desk-grid { grid-template-columns: 1fr; gap: 2rem; }
}

/* Instant Primărie Finder */
.finder-box { margin-bottom: 1.35rem; }
.finder-form { position: relative; }
.finder-input-wrap {
  display: flex;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
}
.finder-input-wrap:focus-within { border-color: var(--focus); }
.finder-input-wrap input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--fg);
  font-family: var(--sans);
  font-size: 1rem;
  padding: 0.65rem 0.85rem;
}
.finder-input-wrap input:focus-visible { outline: none; }
.finder-submit {
  flex: none;
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--fg);
  color: var(--bg);
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0 1.05rem;
  cursor: pointer;
}
.finder-submit:hover { opacity: 0.9; }

.finder-results {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 30;
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-top: 0;
  max-height: 19rem;
  overflow-y: auto;
}
.finder-opt {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.58rem 0.85rem;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 0.9rem;
}
.finder-opt:last-child { border-bottom: 0; }
.finder-opt:hover, .finder-opt[aria-selected="true"] { background: var(--band); }
.finder-opt-name { font-weight: 600; color: var(--fg); }
.finder-opt-reg { color: var(--mut); font-size: 0.8rem; margin-left: 0.4rem; }
.finder-opt-pct { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }

.quick-picks {
  margin-top: 0.65rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
  font-family: var(--sans);
  font-size: 0.8rem;
}
.qp-label { color: var(--mut); font-weight: 500; }
.quick-pick {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fg);
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.28rem 0.55rem;
  cursor: pointer;
}
.quick-pick:hover { border-color: var(--fg); }
.quick-pick-active {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}
@media (pointer: coarse) {
  .quick-pick { min-height: 36px; padding-inline: 0.65rem; }
}

/* Fiscal Balance Dossier Sheet (accounting ledger folio) */
.dossier-sheet {
  background: var(--surface);
  border-top: 3px double var(--line-strong);
  border-bottom: 2px solid var(--line-strong);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 1.25rem 1.3rem 1.15rem;
}
.dossier-head {
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}
.dossier-meta {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--mut);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
}
.dossier-reg-link { color: var(--pine); }
.dossier-name {
  margin: 0 0 0.25rem;
  font-family: var(--display);
  font-size: clamp(1.3rem, 2vw, 1.65rem);
  font-weight: 700;
  line-height: 1.15;
}
.dossier-sub, .dossier-rank {
  margin: 0.15rem 0 0;
  font-family: var(--sans);
  font-size: 0.83rem;
  color: var(--mut);
}

.dossier-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}
.dkpi {
  padding: 0.75rem 0.7rem 0.75rem 0;
  border-bottom: 1px solid var(--line-soft);
}
.dkpi:nth-child(odd) { border-right: 1px solid var(--line-soft); }
.dkpi:nth-child(even) { padding-left: 0.85rem; padding-right: 0; }
.dkpi:nth-last-child(-n+2) { border-bottom: 0; }
.dkpi-lbl {
  display: block;
  font-family: var(--sans);
  font-size: 0.76rem;
  color: var(--mut);
  margin-bottom: 0.15rem;
}
.dkpi-val {
  display: block;
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
  font-size: 1.32rem;
  font-weight: 600;
  line-height: 1.15;
}
.dkpi-sub {
  display: block;
  margin-top: 0.15rem;
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
  font-size: 0.76rem;
  color: var(--mut);
}

.ledger-block {
  padding-block: 0.9rem;
  border-bottom: 1px solid var(--line-soft);
}
.ledger-bar-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.45rem;
}
.ledger-bar-svg {
  display: block;
  width: 100%;
  height: 22px;
  border: 1px solid var(--line);
}
.seg-tax { fill: var(--seg-tax); }
.seg-oth { fill: var(--seg-oth); }
.seg-grant { fill: var(--seg-grant); }
.seg-ear-cur { fill: var(--seg-ear-cur); }
.seg-gen { fill: var(--seg-gen); }
.seg-ear-cap { fill: var(--seg-ear-cap); }
.seg-pay { fill: var(--seg-pay); }
.seg-goods { fill: var(--seg-goods); }
.seg-cap { fill: var(--seg-cap); }
.seg-other-exp { fill: var(--seg-other-exp); }
.seg-empty { fill: var(--line-soft); }

.bar-legend {
  margin: 0.55rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.28rem 0.75rem;
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--mut);
}
@media (max-width: 520px) {
  .bar-legend { grid-template-columns: 1fr; }
}
.bar-legend strong { color: var(--fg); font-weight: 600; }
.sw {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 0.35rem;
  vertical-align: -1px;
}
.sw-tax { background: var(--seg-tax); }
.sw-oth { background: var(--seg-oth); }
.sw-grant { background: var(--seg-grant); }
.sw-ear-cur { background: var(--seg-ear-cur); }
.sw-gen { background: var(--seg-gen); }
.sw-ear-cap { background: var(--seg-ear-cap); }
.sw-pay { background: var(--seg-pay); }
.sw-goods { background: var(--seg-goods); }
.sw-cap { background: var(--seg-cap); }
.sw-other-exp { background: var(--seg-other-exp); }

.dossier-note {
  margin: 0.65rem 0 0;
  font-size: 0.88rem;
  line-height: 1.48;
  color: var(--mut);
}
.dossier-actions {
  padding-top: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-family: var(--sans);
}
.share-status {
  font-size: 0.8rem;
  color: var(--pine);
  font-weight: 600;
}
.dossier-full-reg {
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
}
.dossier-full-reg:hover { text-decoration: underline; }

/* Moldova Interactive SVG Choropleth */
.map-header {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}
.layer-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.layer-btn {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--fg);
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.42rem 0.7rem;
  cursor: pointer;
}
.layer-btn[aria-pressed="true"] {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}
@media (pointer: coarse) {
  .layer-btn { min-height: 40px; }
}

.map-frame {
  margin: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0.6rem 0 0.75rem;
}
.md-map {
  display: block;
  width: 100%;
  max-height: 560px;
  height: auto;
}
.md-region {
  stroke: var(--map-border);
  stroke-width: 1.1;
  stroke-linejoin: round;
  cursor: pointer;
  transition: opacity 0.14s ease, stroke-width 0.14s ease;
}
.md-region:hover { opacity: 0.88; stroke: var(--fg); stroke-width: 2; }
.md-region:focus-visible { outline: none; stroke: var(--focus); stroke-width: 3; }
.md-region.is-selected { stroke: var(--fg); stroke-width: 2.8; }

.fill-b0 { fill: var(--bin-0); }
.fill-b1 { fill: var(--bin-1); }
.fill-b2 { fill: var(--bin-2); }
.fill-b3 { fill: var(--bin-3); }
.fill-b4 { fill: var(--bin-4); }
.fill-b5 { fill: var(--bin-5); }

.md-nonrep {
  fill: url(#nonrep-hatch);
  stroke: var(--map-hatch);
  stroke-width: 0.9;
  cursor: default;
}
.md-nonrep:hover { opacity: 1; stroke: var(--map-hatch); stroke-width: 0.9; }
.hatch-line { stroke: var(--map-hatch); stroke-width: 1.6; }

.md-river {
  fill: none;
  stroke: var(--map-river);
  stroke-width: 2.1;
  stroke-linecap: round;
  pointer-events: none;
  opacity: 0.85;
}
.md-city-dot { fill: var(--fg); stroke: var(--bg); stroke-width: 1.4; }
.md-city-lbl {
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  fill: var(--map-label);
  paint-order: stroke;
  stroke: var(--map-halo);
  stroke-width: 3.4px;
  stroke-linejoin: round;
}
.md-river-lbl {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12px;
  fill: var(--map-river);
  paint-order: stroke;
  stroke: var(--map-halo);
  stroke-width: 3px;
}
.md-nonrep-lbl, .md-nonrep-sub {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  fill: var(--mut);
  paint-order: stroke;
  stroke: var(--map-halo);
  stroke-width: 3px;
}
.md-nonrep-sub { font-weight: 500; font-size: 10px; }

.map-caption { margin-top: 0.65rem; font-family: var(--sans); }
.map-legend { font-size: 0.78rem; color: var(--mut); }
.leg-title { display: block; font-weight: 600; color: var(--fg); margin-bottom: 0.35rem; }
.leg-bins {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
}
.leg-bins li { display: inline-flex; align-items: center; gap: 0.3rem; font-variant-numeric: tabular-nums; }
.leg-sw { display: inline-block; width: 12px; height: 12px; border: 1px solid var(--line-strong); }
.leg-sw.fill-b0 { background: var(--bin-0); }
.leg-sw.fill-b1 { background: var(--bin-1); }
.leg-sw.fill-b2 { background: var(--bin-2); }
.leg-sw.fill-b3 { background: var(--bin-3); }
.leg-sw.fill-b4 { background: var(--bin-4); }
.leg-sw.fill-b5 { background: var(--bin-5); }
.leg-hatch {
  background: repeating-linear-gradient(45deg, var(--map-nonrep-bg), var(--map-nonrep-bg) 3px, var(--map-hatch) 3px, var(--map-hatch) 4.5px);
}
.map-footnote {
  margin: 0.5rem 0 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--mut);
}

.region-readout {
  margin-top: 0.9rem;
  padding: 0.9rem 1rem;
  background: var(--band);
  border-top: 2px solid var(--line-strong);
  font-family: var(--sans);
}
.rr-head {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-bottom: 0.65rem;
}
.rr-head strong { font-family: var(--display); font-size: 1.08rem; }
.rr-meta { font-size: 0.78rem; color: var(--mut); }
.rr-grid {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}
.rr-grid dt { font-size: 0.74rem; color: var(--mut); }
.rr-grid dd { margin: 0.12rem 0 0; font-size: 1.05rem; font-weight: 600; }
.rr-actions {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}
.rr-link { font-size: 0.84rem; font-weight: 600; text-decoration: none; }
.rr-link:hover { text-decoration: underline; }
.rr-btn {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
}
.rr-btn:hover { border-color: var(--fg); }

/* Editorial Band Sections */
.band-section {
  padding-block: 2.4rem;
  background: var(--band);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.explorer-section, .method-section { padding-block: 2.4rem; }

.extremes-grid {
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.8rem;
}
.extreme-col { min-width: 0; }
@media (max-width: 960px) {
  .extremes-grid { grid-template-columns: minmax(0, 1fr); }
}
.extreme-title {
  font-family: var(--sans);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}

.tiers-box {
  margin-top: 2rem;
  padding-top: 1.4rem;
  border-top: 3px double var(--line-strong);
}
.tiers-grid {
  margin-top: 0.85rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.4rem;
}
@media (max-width: 820px) {
  .tiers-grid { grid-template-columns: 1fr; }
}
.tier-item h4 {
  margin: 0 0 0.25rem;
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 600;
}
.tier-fig {
  margin: 0 0 0.45rem;
  font-size: 1.05rem;
  font-weight: 600;
}
.tier-item p:last-child {
  margin: 0;
  font-size: 0.92rem;
  color: var(--mut);
  line-height: 1.52;
}

/* Explorer Controls & Accessible Responsive Sortable Tables */
.explorer-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.75rem 1.5rem;
  margin-bottom: 1rem;
}
.explorer-count {
  margin: 0;
  font-size: 0.84rem;
  color: var(--mut);
  font-weight: 600;
}
.explorer-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-bottom: 1rem;
  font-family: var(--sans);
}
.ctrl-field {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 12rem;
}
.ctrl-grow { flex: 1 1 14rem; }
.ctrl-field label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--mut);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ctrl-field select, .ctrl-field input {
  min-height: 40px;
  padding: 0.42rem 0.65rem;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 0.9rem;
}

.table-wrapper {
  overflow-x: auto;
  max-inline-size: 100%;
  border-top: 2px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  background: var(--surface);
}
.explorer-wrap { max-block-size: min(640px, 76vh); overflow-y: auto; }

.data-table {
  width: 100%;
  min-inline-size: 40rem;
  border-collapse: separate;
  border-spacing: 0;
  font-family: var(--sans);
  font-size: 0.86rem;
}
.data-table thead th {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
  background: var(--band);
  color: var(--fg);
  font-weight: 600;
  font-size: 0.78rem;
  text-align: left;
  padding: 0.6rem 0.65rem;
  border-bottom: 1.5px solid var(--line-strong);
  white-space: nowrap;
}
.data-table thead th.num, .data-table tbody td.tnum { text-align: right; }
.data-table thead th:has(> button) { padding: 0; }
.data-table thead th > button {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.3rem;
  width: 100%;
  min-height: 38px;
  padding: 0.55rem 0.65rem;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.data-table thead th.num > button { justify-content: flex-end; }
.data-table thead th > button:hover { background: var(--row-hover); }
.sort-ic::after { content: "↕"; opacity: 0.4; font-size: 0.75rem; }
th[aria-sort="ascending"] .sort-ic::after { content: "▲"; opacity: 1; color: var(--pine); }
th[aria-sort="descending"] .sort-ic::after { content: "▼"; opacity: 1; color: var(--pine); }

.data-table tbody th, .data-table tbody td {
  padding: 0.52rem 0.65rem;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.data-table tbody th {
  font-weight: 600;
  text-align: left;
}
.data-table tbody tr:hover { background: var(--row-hover); }
.row-pick-btn {
  border: 0;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-weight: 600;
  text-align: left;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 0.16em;
}
.row-pick-btn:hover { color: var(--pine); text-decoration-color: var(--pine); }

.table-pager {
  margin-top: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--sans);
  font-size: 0.84rem;
}
.pager-btn {
  min-height: 36px;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.pager-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.pager-info { color: var(--mut); }
.pager-all { margin-left: auto; }

/* Raion Dossier Council Block & Pager */
.councils-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 1.2rem;
}
.council-card {
  background: var(--surface);
  border-top: 2px solid var(--line-strong);
  border-bottom: 1px solid var(--line);
  padding: 1rem 1.1rem;
}
.council-dl {
  margin: 0.65rem 0 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem 0.9rem;
  font-family: var(--sans);
}
.council-dl dt { font-size: 0.75rem; color: var(--mut); }
.council-dl dd { margin: 0.1rem 0 0; font-size: 0.95rem; font-weight: 600; }

.raion-pager {
  padding-block: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.85rem;
  font-family: var(--sans);
  font-size: 0.88rem;
  font-weight: 600;
}

/* Methodology & Sources */
.method-section ul {
  padding-left: 1.25rem;
  margin: 0.8rem 0 1.3rem;
}
.method-section li { margin-bottom: 0.6rem; }
.sources-list li { font-family: var(--sans); font-size: 0.9rem; }

/* Bounded Editorial Footer */
.site-footer {
  border-top: 3px double var(--line-strong);
  padding-block: 1.4rem 2.2rem;
  font-family: var(--sans);
  font-size: 0.84rem;
  color: var(--mut);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem 1.5rem;
}
.footer-inner p { margin: 0; }
.footer-links { display: flex; gap: 1.1rem; }

@media (prefers-reduced-motion: reduce) {
  .md-region { transition: none; }
}
@media (forced-colors: active) {
  .md-region { stroke: CanvasText; }
  .md-region.is-selected { stroke: Highlight; stroke-width: 3; }
  .ledger-bar-svg { border-color: CanvasText; }
}
