/* ============================================
   Budget wallon — design éditorial style NYT
   ============================================ */

:root {
  /* Palette */
  --bg: #fdfcf9;
  --bg-alt: #f5f3ec;
  --paper: #ffffff;
  --ink: #1a1a1a;
  --ink-light: #2c2c2c;
  --text: #333333;
  --text-muted: #6b6760;
  --text-faint: #999592;
  --line: #d8d3c8;
  --line-light: #e8e4d9;

  /* Accents */
  --accent: #c8102e;
  --accent-dark: #9b0c24;
  --accent-light: #fbe9ec;
  --gold: #b8821c;
  --green: #2d6a4f;
  --green-light: #d8eadf;
  --red-faint: #fce9e9;

  /* Typography */
  --font-serif: "Lora", "Charter", "Georgia", "Times New Roman", serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;

  /* Spacing */
  --gutter: 1.5rem;
  --section-py: 5rem;
  --max-width: 1140px;
  --max-width-prose: 720px;
}

/* ============ Reset & base ============ */

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-feature-settings: "kern" 1, "liga" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color 0.15s, text-decoration-color 0.15s;
}
a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* ============ Masthead ============ */

.masthead {
  background: var(--paper);
  padding: 4rem 0 3rem;
  border-bottom: 1px solid var(--line);
}

.kicker {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 1rem;
}

.headline {
  font-family: var(--font-serif);
  font-size: clamp(2.25rem, 5vw, 3.75rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 1.25rem 0;
  max-width: 900px;
}

.dek {
  font-family: var(--font-serif);
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  font-style: italic;
  line-height: 1.55;
  color: var(--text-muted);
  margin: 0 0 1.5rem 0;
  max-width: var(--max-width-prose);
}

.dek strong {
  font-style: normal;
  color: var(--ink);
}

.byline {
  font-size: 0.85rem;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}

/* ============ Section nav ============ */

.section-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(180%) blur(20px);
  background: rgba(253, 252, 249, 0.92);
}

.nav-inner {
  display: flex;
  gap: 0;
  overflow-x: auto;
  padding-top: 0;
  padding-bottom: 0;
  scrollbar-width: none;
}
.nav-inner::-webkit-scrollbar {
  display: none;
}

.nav-link {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-muted);
  padding: 1rem 1.25rem;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.nav-link:hover {
  color: var(--ink);
}
.nav-link.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

/* ============ Sections ============ */

.section {
  padding: var(--section-py) 0;
  border-bottom: 1px solid var(--line-light);
}

.section-alt {
  background: var(--bg-alt);
}

.section-header {
  max-width: var(--max-width-prose);
  margin: 0 0 3rem 0;
}

.section-kicker {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1rem;
  color: var(--accent);
  margin-bottom: 0.75rem;
  letter-spacing: 0.02em;
}

.section-title {
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.005em;
  color: var(--ink);
  margin: 0 0 1rem 0;
}

.section-lede {
  font-family: var(--font-serif);
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  line-height: 1.6;
  color: var(--text);
  margin: 0;
}

.section-lede strong {
  color: var(--ink);
  font-weight: 600;
}

/* ============ KPI grid ============ */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0 4rem 0;
}

.kpi-card {
  border-top: 3px solid var(--ink);
  padding-top: 1rem;
}

.kpi-card.kpi-accent {
  border-top-color: var(--accent);
}

.kpi-label {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.kpi-value {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  margin-bottom: 0.25rem;
}

.kpi-unit {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 0.25rem;
}

.kpi-delta {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.kpi-delta.positive {
  color: var(--green);
}

.kpi-delta.negative {
  color: var(--accent);
}

/* ============ Chart blocks ============ */

.chart-block {
  margin: 2.5rem 0;
}

.chart-block.large {
  margin: 1.5rem 0;
}

.chart-title {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 0.4rem 0;
}

.chart-subtitle {
  font-family: var(--font-sans);
  font-size: 0.92rem;
  color: var(--text-muted);
  margin: 0 0 1.5rem 0;
  max-width: var(--max-width-prose);
  line-height: 1.5;
}

/* Containers */

#chart-evolution,
#chart-balance,
#chart-do-growth,
#chart-treemap,
#chart-top-progs,
#chart-ministres,
#chart-recettes-stacked {
  width: 100%;
  position: relative;
}

#chart-evolution { min-height: 420px; }
#chart-balance { min-height: 360px; }
#chart-do-growth { min-height: 360px; }
#chart-treemap { min-height: 600px; background: var(--paper); border: 1px solid var(--line); }
#chart-top-progs { min-height: 520px; }
#chart-ministres { min-height: 480px; }
#chart-recettes-stacked { min-height: 380px; }

/* ============ D3 chart shared styles ============ */

.axis path,
.axis line {
  stroke: var(--line);
}

.axis text {
  font-family: var(--font-sans);
  font-size: 11px;
  fill: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.axis-label {
  font-family: var(--font-sans);
  font-size: 10px;
  fill: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.grid line {
  stroke: var(--line-light);
  stroke-dasharray: 2 2;
}
.grid path {
  display: none;
}

.line-series {
  fill: none;
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.area-series {
  fill-opacity: 0.08;
}

.chart-dot {
  stroke: var(--paper);
  stroke-width: 2;
}

.bar-rect {
  transition: opacity 0.15s;
}

.bar-rect:hover {
  opacity: 0.85;
}

.value-label {
  font-family: var(--font-sans);
  font-size: 11px;
  fill: var(--ink);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.series-label {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 600;
  fill: var(--ink);
}

.annotation {
  font-family: var(--font-sans);
  font-size: 11px;
  fill: var(--text-muted);
  font-style: italic;
}

/* Treemap */

.treemap-cell {
  cursor: pointer;
  transition: opacity 0.15s;
}

.treemap-cell:hover {
  opacity: 0.85;
}

.treemap-label {
  font-family: var(--font-sans);
  font-size: 11px;
  fill: white;
  font-weight: 500;
  pointer-events: none;
}

.treemap-value {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: white;
  fill-opacity: 0.8;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

.treemap-breadcrumb {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  padding-left: 0.5rem;
}

.treemap-breadcrumb a {
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}

.treemap-breadcrumb a:hover {
  text-decoration: underline;
}

/* ============ Year selector ============ */

.year-selector {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0;
}

.selector-label {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.year-buttons {
  display: flex;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: var(--paper);
}

.year-btn {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.4rem 0.9rem;
  background: transparent;
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: background 0.15s, color 0.15s;
}

.year-btn:not(:last-child) {
  border-right: 1px solid var(--line);
}

.year-btn:hover {
  background: var(--bg-alt);
  color: var(--ink);
}

.year-btn.active {
  background: var(--ink);
  color: var(--paper);
}

/* ============ Explorer ============ */

.explorer-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.search-input,
.filter-select {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  transition: border-color 0.15s;
}

.search-input {
  flex: 1;
  min-width: 240px;
}

.search-input:focus,
.filter-select:focus {
  outline: none;
  border-color: var(--ink);
}

.explorer-info {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.explorer-table-wrap {
  max-height: 75vh;
  overflow-y: auto;
  border: 1px solid var(--line);
  background: var(--paper);
}

.explorer-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: 0.85rem;
}

.explorer-table th {
  position: sticky;
  top: 0;
  background: var(--paper);
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.72rem;
  padding: 0.85rem 0.75rem;
  border-bottom: 1.5px solid var(--ink);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.explorer-table th:hover {
  color: var(--ink);
}

.explorer-table th.sort-asc::after {
  content: " ▲";
  color: var(--accent);
}

.explorer-table th.sort-desc::after {
  content: " ▼";
  color: var(--accent);
}

.explorer-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--line-light);
  vertical-align: top;
  line-height: 1.4;
}

.explorer-table tr:hover {
  background: var(--bg-alt);
}

.explorer-table .col-do,
.explorer-table .col-prog,
.explorer-table .col-art,
.explorer-table .col-min {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.explorer-table .col-libelle {
  max-width: 480px;
  color: var(--ink);
}

.explorer-table .col-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--ink);
  white-space: nowrap;
}

.explorer-table .col-num.zero {
  color: var(--text-faint);
}

/* ============ Tooltip ============ */

.tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--ink);
  color: var(--paper);
  padding: 0.65rem 0.85rem;
  border-radius: 4px;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  line-height: 1.4;
  max-width: 320px;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.tooltip.visible {
  opacity: 1;
}

.tooltip-title {
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-variant-numeric: tabular-nums;
}

.tooltip-row .label {
  color: rgba(255, 255, 255, 0.7);
}

.tooltip-row .value {
  font-weight: 500;
}

/* ============ Footer ============ */

.site-footer {
  background: var(--ink);
  color: var(--bg);
  padding: 3rem 0;
  margin-top: 4rem;
}

.site-footer .container {
  max-width: var(--max-width-prose);
}

.site-footer p {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--bg-alt);
  margin: 0 0 1rem 0;
}

.site-footer strong {
  color: var(--paper);
}

.site-footer a {
  color: var(--bg);
}

.site-footer a:hover {
  color: var(--gold);
  text-decoration-color: var(--gold);
}

.footer-meta {
  font-size: 0.82rem;
  color: var(--text-faint);
  font-style: italic;
}

/* ============ Solde / dette section ============ */

.solde-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin: 1rem 0 3rem 0;
  padding: 1.5rem;
  background: var(--paper);
  border: 1px solid var(--line);
}

.solde-kpi {
  padding: 0.5rem 0;
}

.solde-kpi-label {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  line-height: 1.3;
}

.solde-kpi-value {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  margin-bottom: 0.25rem;
}

.solde-kpi-value.positive { color: var(--green); }
.solde-kpi-value.negative { color: var(--accent); }

.solde-kpi-context {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--text-faint);
  font-style: italic;
  line-height: 1.4;
}

#chart-waterfall { min-height: 460px; }
#chart-soldes-evolution { min-height: 360px; }
#chart-dette-evolution { min-height: 320px; }

/* Waterfall connector lines */
.waterfall-connector {
  stroke: var(--text-faint);
  stroke-width: 1;
  stroke-dasharray: 2 2;
}

/* ============ Drill-down hierarchical explorer ============ */

.drilldown-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}

.drill-breadcrumb {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--text-muted);
  flex: 1;
  min-width: 220px;
}

.drill-breadcrumb .crumb {
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
}
.drill-breadcrumb .crumb:hover { text-decoration: underline; }
.drill-breadcrumb .crumb-sep { color: var(--text-faint); margin: 0 0.4rem; }
.drill-breadcrumb .crumb-current {
  color: var(--ink);
  font-weight: 600;
}

.drill-options {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.drill-toggle {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.drill-toggle span {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}

.drill-toggle select {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}

.drill-toggle select:focus {
  outline: none;
  border-color: var(--ink);
}

.drill-summary {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  background: var(--paper);
  border-left: 3px solid var(--accent);
  flex-wrap: wrap;
}

.drill-summary-label {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.drill-summary-value {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.drill-summary-context {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.drill-list {
  background: var(--paper);
  border: 1px solid var(--line);
}

.drill-row {
  display: grid;
  grid-template-columns: 70px 1fr 90px 110px 70px 100px 22px;
  gap: 0.85rem;
  align-items: center;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line-light);
  cursor: pointer;
  transition: background 0.12s;
}

.drill-row:hover {
  background: var(--bg-alt);
}

.drill-row.leaf {
  cursor: default;
}

.drill-row:last-child {
  border-bottom: none;
}

.drill-row-code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.drill-row-label {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--ink);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drill-row-meta {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--text-faint);
  margin-top: 0.15rem;
}

.drill-row-bar {
  position: relative;
  height: 10px;
  background: var(--line-light);
  border-radius: 2px;
  overflow: hidden;
}

.drill-row-bar-fill {
  position: absolute;
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
}

.drill-row-bar-fill.muted {
  background: var(--text-muted);
}

.drill-row-value {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  color: var(--ink);
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.drill-row-share {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.drill-row-evol {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.drill-row-evol.positive { color: var(--green); }
.drill-row-evol.negative { color: var(--accent); }

.drill-row-spark {
  width: 100%;
  max-width: 100px;
  height: 28px;
}

.drill-row-arrow {
  color: var(--text-faint);
  font-size: 1rem;
  text-align: right;
  user-select: none;
}

.drill-row.leaf .drill-row-arrow {
  visibility: hidden;
}

/* Leaf detail panel */
.drill-detail-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 1.5rem;
  margin-top: 1rem;
}

.drill-detail-title {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 0.5rem 0;
}

.drill-detail-meta {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.drill-detail-evolution {
  margin-top: 1.5rem;
}

/* Tags */
.drill-tag {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  margin-left: 0.4rem;
  vertical-align: middle;
}

.drill-tag.interest { background: #f7e8d8; color: #8a5a1c; }
.drill-tag.amortization { background: #e8e2f4; color: #5b4979; }
.drill-tag.guarantee { background: #f0e2e2; color: #8a3a3a; }
.drill-tag.other_debt { background: #f0ede4; color: #6b6760; }

/* ============ Loading ============ */

.loading {
  font-family: var(--font-sans);
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 3rem 0;
  font-style: italic;
}

/* ============ Responsive ============ */

@media (max-width: 768px) {
  :root {
    --section-py: 3rem;
  }
  .masthead {
    padding: 2.5rem 0 2rem;
  }
  .explorer-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .search-input,
  .filter-select {
    width: 100%;
  }
  .explorer-info {
    margin-left: 0;
  }
  .explorer-table .col-libelle {
    max-width: 200px;
    font-size: 0.78rem;
  }
}

/* ============ CTA block (home → table page) ============ */

.cta-block {
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  padding: 1.5rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.cta-link {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  align-self: flex-start;
}

.cta-link:hover {
  color: var(--accent);
}

.cta-meta {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0;
}

/* ============ Dedicated table page ============ */

.container-wide {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.page-table {
  background: var(--bg);
}

/* Compact masthead */
.masthead-mini {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 0.75rem 0;
}

.masthead-mini .container-wide {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.mini-title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.05rem;
  margin: 0;
  color: var(--ink);
}

/* Tabs */
.tabs-bar {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.tabs-bar .container-wide {
  display: flex;
  gap: 0;
}

.tab-btn {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.8rem 1.2rem;
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.tab-btn:hover {
  color: var(--ink);
}

.tab-btn.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* Sticky controls bar */
.sticky-controls {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 0.65rem 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.controls-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn-group {
  display: flex;
  gap: 0.4rem;
}

.selection-badge {
  margin-left: auto;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.selection-badge strong {
  color: var(--accent);
}

.main-table {
  padding-top: 1rem;
}

.table-info-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.table-info,
.table-legend {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.table-wrap-flex {
  border: 1px solid var(--line);
  background: var(--paper);
  overflow-x: auto;
}

.poste-chart-wrap {
  margin-bottom: 1rem;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 1rem;
}

.back-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
}

.back-link:hover {
  color: var(--ink);
  text-decoration: underline;
}

.table-controls {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.measure-toggle {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.seg-buttons {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: var(--paper);
}

.seg-btn {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.45rem 1rem;
  background: transparent;
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.seg-btn:not(:last-child) {
  border-right: 1px solid var(--line);
}

.seg-btn:hover {
  background: var(--bg-alt);
  color: var(--ink);
}

.seg-btn.active {
  background: var(--ink);
  color: var(--paper);
}

.ghost-btn {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.4rem 0.85rem;
  background: var(--paper);
  color: var(--text-muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.ghost-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.table-info {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.table-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.6rem;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line-light);
}

.table-legend .sep {
  color: var(--text-faint);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--paper);
}

.prog-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: 0.85rem;
}

.prog-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--paper);
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.72rem;
  padding: 0.85rem 0.75rem;
  border-bottom: 1.5px solid var(--ink);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.prog-table thead th:hover {
  color: var(--ink);
}

.prog-table thead th.sort-asc::after { content: " ▲"; color: var(--accent); }
.prog-table thead th.sort-desc::after { content: " ▼"; color: var(--accent); }

.prog-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--line-light);
  vertical-align: top;
  line-height: 1.35;
}

.prog-table .col-code,
.prog-table .col-min {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.prog-table .col-label {
  color: var(--ink);
  min-width: 260px;
}

.prog-table .col-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--ink);
  white-space: nowrap;
}

.prog-table .col-num.zero { color: var(--text-faint); }
.prog-table .col-delta { width: 90px; }
.prog-table .col-pct { width: 78px; }
.prog-table .col-check {
  width: 30px;
  padding-left: 0.6rem;
  padding-right: 0.2rem;
}

.prog-table .col-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
}

.prog-table .col-expand {
  width: 32px;
  padding-left: 0.5rem;
  padding-right: 0;
}

.expand-btn {
  width: 22px;
  height: 22px;
  line-height: 18px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
  transition: all 0.15s;
}

.expand-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.row-prog.expanded .expand-btn {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.prog-table .row-do td {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--line);
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
  font-size: 0.82rem;
}

.prog-table .row-do .col-code {
  color: var(--ink);
  font-weight: 600;
}

.prog-table .row-do .col-label {
  color: var(--ink);
  cursor: pointer;
}

.prog-table .row-do .col-label:hover {
  color: var(--accent);
}

.do-toggle {
  display: inline-block;
  width: 14px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-muted);
  margin-right: 0.4rem;
}

.row-do.collapsed .do-toggle::before { content: "▸"; }
.row-do:not(.collapsed) .do-toggle::before { content: "▾"; }

.row-prog.hidden { display: none; }
.row-article.hidden { display: none; }

.prog-table .row-total td,
.prog-table .row-selection td {
  background: var(--paper);
  border-top: 1.5px solid var(--ink);
  border-bottom: none;
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}

.prog-table .row-selection td {
  border-top: none;
  background: var(--accent-light);
}

.prog-table .row-article-group td {
  padding: 0.4rem 0.5rem 0.4rem 2.5rem;
  background: #fafaf6;
}

/* Discovery hint */
.discovery-hint {
  margin: 0.4rem 0 0.85rem;
  padding: 0.55rem 0.85rem;
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.45;
}
.discovery-hint kbd {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 0 0.4rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 3px;
}
.info-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: 0.7rem;
  color: var(--paper);
  background: var(--accent);
  border-radius: 50%;
  vertical-align: 1px;
}

/* Article info button (commentaires) */
.info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-family: var(--font-serif);
  font-size: 0.78rem;
  font-style: italic;
  font-weight: 700;
  color: var(--paper);
  background: var(--accent);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  margin-right: 6px;
  padding: 0;
  vertical-align: 1px;
  transition: transform 0.15s, background 0.15s;
}
.info-btn:hover { background: var(--accent-dark); transform: scale(1.1); }
.info-btn.expanded { background: var(--ink); }

.art-libelle { vertical-align: 1px; }

.prog-table .row-commentaire td.commentaire-cell {
  background: var(--paper);
  border-left: 3px solid var(--accent);
  padding: 0.9rem 1.25rem 1rem 3rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  line-height: 1.55;
}

.commentaire-content { max-width: 880px; }

.commentaire-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  color: var(--ink);
  font-size: 0.92rem;
}

.commentaire-status {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--accent-light);
  color: var(--accent-dark);
  padding: 0.1rem 0.5rem;
  border-radius: 3px;
  font-weight: 600;
}

.commentaire-sec,
.commentaire-ministre {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--bg-alt);
  padding: 0.1rem 0.5rem;
  border-radius: 3px;
}

.commentaire-desc {
  margin: 0.3rem 0 0.6rem;
  color: var(--text);
  white-space: normal;
}

.commentaire-base summary {
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  user-select: none;
  margin-top: 0.4rem;
}
.commentaire-base summary:hover { color: var(--ink); }
.commentaire-base ul {
  margin: 0.4rem 0 0;
  padding-left: 1.25rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.commentaire-base li { margin-bottom: 0.25rem; }

.commentaire-source {
  margin: 0.6rem 0 0;
  font-size: 0.72rem;
  color: var(--text-faint);
  font-style: italic;
}

.prog-table .sub-articles {
  width: 100%;
  font-size: 0.78rem;
}

.prog-table .sub-articles thead th {
  position: static;
  border-bottom: 1px solid var(--line);
  background: transparent;
  font-size: 0.68rem;
  padding: 0.3rem 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.prog-table .sub-articles td {
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid var(--line-light);
  background: transparent;
}

.prog-table .prog-count {
  color: var(--text-faint);
  font-weight: 400;
  font-size: 0.78rem;
  margin-left: 0.4rem;
}

.prog-table .row-prog:hover {
  background: var(--bg-alt);
}

.prog-table .row-prog .col-label {
  cursor: pointer;
}

.prog-table .row-prog .col-label:hover {
  color: var(--accent);
}

.prog-table .row-article td {
  background: #fafaf6;
  font-size: 0.78rem;
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line-light);
}

.prog-table .row-article .col-code {
  padding-left: 2.5rem;
  font-size: 0.74rem;
}

.prog-table .row-article .col-label {
  color: var(--text);
}

.prog-table .row-article .muted {
  color: var(--text-faint);
  font-style: italic;
  padding-left: 2.5rem;
}

.prog-table tfoot .row-total td {
  background: var(--paper);
  border-top: 1.5px solid var(--ink);
  border-bottom: none;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
  position: sticky;
  bottom: 0;
}

.delta {
  font-weight: 500;
}

.delta.pos { color: var(--green); }
.delta.neg { color: var(--accent); }
.delta.flat { color: var(--text-muted); }

.muted { color: var(--text-faint); }
.zero { color: var(--text-faint); }

@media (max-width: 768px) {
  .table-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .table-info { margin-left: 0; }
  .prog-table { font-size: 0.78rem; }
  .prog-table .col-label { min-width: 180px; }
}

