/* Équilibre des retraites — feuille de style
   Charte du site (Cormorant Garamond + Montserrat, papier / or / bleu).
   Adaptée de projets/nucleaire/css/styles.css (même gabarit graphe + panneaux).
   Les variables :root sont exposées pour /assets/site.css (nav + footer). */

:root {
  --ink: #1a1814;
  --paper: #f2f5fa;
  --paper-dark: #e6ecf6;
  --brand: #1d3a5f;
  --gold: #b89a5a;
  --muted: #6b6252;
  --nav-h: 72px;
  --line: rgba(184, 154, 90, 0.30);
  --card: #fffdf8;
  --shadow: 0 14px 40px rgba(26, 24, 20, 0.09);
  --down: #c2543f;      /* déficit */
  --up: #3f7d4e;        /* excédent */
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Montserrat', sans-serif;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

/* ── EN-TÊTE ── */
.entete {
  max-width: 940px;
  margin: 0 auto;
  padding: calc(var(--nav-h) + 3rem) 1.5rem 0.6rem;
  text-align: center;
}
.eyebrow {
  font-size: 0.66rem; letter-spacing: 0.3em; text-transform: uppercase;
  color: #8a6d2f; margin: 0 0 0.8rem;
}
.entete h1 {
  font-family: 'Cormorant Garamond', serif; font-weight: 600;
  font-size: clamp(2.2rem, 5.5vw, 3.4rem); line-height: 1.05;
  margin: 0; letter-spacing: 0.01em; color: var(--brand);
}
.accroche {
  max-width: 700px; margin: 1rem auto 0;
  font-size: 0.95rem; line-height: 1.7; color: #4a443b;
}
.accroche em { font-style: italic; color: var(--brand); }
.filet { width: 74px; height: 2px; margin: 1.4rem auto 0; background: var(--gold); }

/* ── SCÈNE ── */
.scene { max-width: 1560px; margin: 0 auto; padding: 1.2rem 1.4rem 4rem; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 432px; gap: 1.15rem; align-items: start; }
.col-chart { position: sticky; top: calc(var(--nav-h) + 8px); min-width: 0; }
.col-opts { min-width: 0; }
@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; }
  .col-chart { position: static; }
}

/* ── PANNEAUX (repliables) ── */
.panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; margin: 0 0 0.9rem; box-shadow: var(--shadow); overflow: hidden;
}
.panel-toggle {
  width: 100%; display: flex; align-items: center; gap: 0.7rem;
  background: none; border: 0; cursor: pointer; text-align: left;
  font-family: 'Montserrat', sans-serif; padding: 1rem 1.25rem;
}
.panel-toggle:hover h2 { color: var(--gold); }
.panel-num {
  flex: none; width: 1.7rem; height: 1.7rem; display: grid; place-items: center;
  border-radius: 50%; background: var(--brand); color: #fff;
  font-size: 0.9rem; font-weight: 500; font-family: 'Cormorant Garamond', serif;
}
.panel-toggle h2 {
  margin: 0; font-family: 'Cormorant Garamond', serif; font-weight: 600;
  font-size: 1.42rem; color: var(--brand); transition: color 0.15s;
}
.panel-toggle:hover { background: rgba(184,154,90,0.06); }
.pcaret {
  margin-left: auto; flex: none; width: 1.85rem; height: 1.85rem;
  display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--line); background: var(--paper-dark);
  color: var(--brand); font-size: 0.8rem; line-height: 1;
  transition: transform 0.22s, background 0.15s, border-color 0.15s, color 0.15s;
}
.panel-toggle:hover .pcaret { border-color: var(--gold); color: var(--gold); background: #fff; }
.panel:not(.open) .pcaret { transform: rotate(-90deg); }
.panel-body { padding: 0 1.25rem 1.3rem; }
.panel:not(.open) .panel-body { display: none; }
.panel-sub { margin: 0 0 0.9rem; font-size: 0.82rem; color: var(--muted); line-height: 1.6; }

/* ═══════════════ GRAPHE (carte collante) ═══════════════ */
.chart-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); padding: 0.9rem 0.9rem 0.7rem; margin: 0; position: relative;
}
.chart-topbar {
  display: flex; align-items: center; gap: 0.6rem 1rem; flex-wrap: wrap;
  margin: 0 0 0.5rem; padding: 0 0.2rem;
}
.chart-title { font-family: 'Cormorant Garamond', serif; font-size: 1.15rem; color: var(--brand); font-weight: 600; margin: 0; }
.seg {
  display: inline-flex; background: var(--paper-dark);
  border: 1px solid var(--line); border-radius: 10px; padding: 3px; margin-left: auto;
  flex-wrap: wrap;
}
.seg button {
  border: 0; background: transparent; cursor: pointer;
  font-family: 'Montserrat', sans-serif; font-size: 0.76rem; color: var(--muted);
  padding: 0.4rem 0.7rem; border-radius: 7px; transition: all 0.15s; white-space: nowrap;
}
.seg button.on { background: #fff; color: var(--brand); box-shadow: 0 1px 4px rgba(0,0,0,0.08); font-weight: 500; }

.chart-wrap { position: relative; width: 100%; }
#chart { display: block; width: 100%; height: auto; touch-action: none; }
#chart .grid { stroke: rgba(122,112,96,0.16); stroke-width: 1; }
#chart .axis { stroke: rgba(122,112,96,0.5); stroke-width: 1; }
#chart .zero-line { stroke: rgba(122,112,96,0.75); stroke-width: 1.4; }
#chart .tick-txt { fill: var(--muted); font: 400 11px 'Montserrat', sans-serif; }
#chart .axis-lab { fill: var(--muted); font: 500 11px 'Montserrat', sans-serif; letter-spacing: 0.06em; }
#chart .now-line { stroke: var(--brand); stroke-width: 1.2; stroke-dasharray: 4 4; opacity: 0.55; }
#chart .now-txt { fill: var(--brand); font: 600 10.5px 'Montserrat', sans-serif; }
#chart .serie-line { fill: none; stroke-width: 2; }
#chart .serie-line.thin { stroke-width: 1.5; }
#chart .cor-line { fill: none; stroke: #8a6d2f; stroke-width: 1.6; stroke-dasharray: 6 4; opacity: 0.85; }
#chart .cor-dot { fill: #8a6d2f; }
#chart .cor-txt { fill: #8a6d2f; font: 600 10.5px 'Montserrat', sans-serif; }
#chart .obs-line { fill: none; stroke: #24324a; stroke-width: 2.2; }
#chart .guide { stroke: var(--brand); stroke-width: 1; opacity: 0.45; }
#chart .gdot { stroke: #fff; stroke-width: 1.4; }

/* Bulle survol */
.tip {
  position: absolute; pointer-events: none; z-index: 10;
  background: #fffefaee; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 26px rgba(26,24,20,0.16); padding: 0.55rem 0.7rem;
  font-size: 0.76rem; color: var(--ink); min-width: 168px; max-width: 280px;
  opacity: 0; transform: translateY(4px); transition: opacity 0.12s;
  backdrop-filter: blur(2px);
}
.tip.on { opacity: 1; transform: translateY(0); }
.tip-year { font-family: 'Cormorant Garamond', serif; font-size: 1.1rem; font-weight: 600; color: var(--brand); }
.tip-tot { font-weight: 600; margin: 0.1rem 0 0.4rem; }
.tip-tot b { color: var(--brand); font-variant-numeric: tabular-nums; }
.tip-tot b.neg { color: var(--down); }
.tip-tot b.pos { color: var(--up); }
.tip-row { display: flex; align-items: center; gap: 0.4rem; line-height: 1.55; }
.tip-row .sw { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.tip-row .nm { flex: 1 1 auto; color: #4a443b; }
.tip-row .vl { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 500; }

/* Bandeau de chiffres-clés */
.kpis { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.6rem 0.1rem 0.15rem; }
.kpi {
  flex: 1 1 120px; background: var(--paper); border: 1px solid var(--line);
  border-radius: 11px; padding: 0.5rem 0.7rem; text-align: center;
}
.kpi .k-lab { font-size: 0.6rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.kpi .k-val { font-family: 'Cormorant Garamond', serif; font-size: 1.4rem; font-weight: 600; color: var(--brand); line-height: 1.15; white-space: nowrap; }
.kpi .k-val small { font-size: 0.72rem; font-family: 'Montserrat', sans-serif; color: var(--muted); font-weight: 400; }
.kpi .k-val.neg { color: var(--down); }
.kpi .k-val.pos { color: var(--up); }
.kpi .k-sub { font-size: 0.66rem; color: var(--muted); }

/* Légende (séries cliquables) */
.legend { display: flex; flex-wrap: wrap; gap: 0.35rem 0.55rem; margin: 0.55rem 0.1rem 0.15rem; }
.leg {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: var(--paper); border: 1px solid var(--line); border-radius: 999px;
  padding: 0.25rem 0.62rem; font-size: 0.72rem; color: var(--ink);
  user-select: none;
}
.leg .sw { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.leg .sw.dash { background: repeating-linear-gradient(90deg, #8a6d2f 0 4px, transparent 4px 7px); border-radius: 0; height: 3px; }

/* Écart modèle / COR (encart de validation) */
.valid-box {
  margin: 0.6rem 0.1rem 0.15rem; padding: 0.55rem 0.75rem;
  background: rgba(184,154,90,0.07); border: 1px solid var(--line); border-radius: 11px;
  font-size: 0.74rem; color: var(--muted); line-height: 1.55;
}
.valid-box b { color: #8a6d2f; font-weight: 600; }

/* ═══════════════ CONTRÔLES ═══════════════ */
/* Scénarios types */
.scenarios { display: grid; grid-template-columns: repeat(auto-fit, minmax(198px, 1fr)); gap: 0.65rem; }
.scn {
  text-align: left; cursor: pointer; background: #fff; border: 1px solid var(--line);
  border-radius: 13px; padding: 0.75rem 0.85rem; transition: all 0.15s; font-family: 'Montserrat', sans-serif;
}
.scn:hover { border-color: var(--gold); transform: translateY(-1px); box-shadow: 0 8px 20px rgba(26,24,20,0.07); }
.scn.on { border-color: var(--brand); background: #f4f8fd; box-shadow: inset 0 0 0 1px var(--brand); }
.scn .scn-ic { font-size: 1.3rem; }
.scn .scn-nm { display: block; font-weight: 600; color: var(--brand); font-size: 0.92rem; margin: 0.2rem 0 0.15rem; }
.scn .scn-dc { display: block; font-size: 0.74rem; color: var(--muted); line-height: 1.5; font-weight: 300; }

/* Groupes de boutons-pastilles */
.pill-row { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; }
.pill-row + .pill-row { margin-top: 0.7rem; }
.pill-lab { font-size: 0.64rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-right: 0.15rem; min-width: 92px; }
.pill {
  font-family: 'Montserrat', sans-serif; cursor: pointer; font-size: 0.78rem;
  background: #fff; color: var(--brand); border: 1px solid var(--line);
  border-radius: 999px; padding: 0.42rem 0.85rem; transition: all 0.15s;
}
.pill:hover { border-color: var(--gold); }
.pill.on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Curseurs paramètres */
.param-box { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 0.75rem 0.9rem; }
.param-box + .param-box { margin-top: 0.65rem; }
.param-top { display: flex; align-items: baseline; gap: 0.5rem; margin-bottom: 0.15rem; flex-wrap: wrap; }
.param-top .p-nm { font-weight: 500; font-size: 0.86rem; color: var(--ink); }
.param-top output { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--brand); font-size: 0.95rem; white-space: nowrap; }
.param-hint { font-size: 0.7rem; color: var(--muted); line-height: 1.5; margin: 0.1rem 0 0.35rem; }
.param-hint b { color: #8a6d2f; font-weight: 600; }
input[type=range].slider-in {
  width: 100%; height: 6px; -webkit-appearance: none; appearance: none;
  background: var(--paper-dark); border-radius: 999px; cursor: pointer; margin: 0.3rem 0; accent-color: var(--brand);
}
input[type=range].slider-in::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--brand); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.25); cursor: pointer;
}
input[type=range].slider-in::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; background: var(--brand); border: 2px solid #fff; cursor: pointer;
}
.param-scale { display: flex; justify-content: space-between; font-size: 0.64rem; color: var(--muted); }

/* Interrupteurs (rétroactions) */
.toggle-row { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.toggle {
  display: flex; align-items: center; gap: 0.6rem; cursor: pointer; flex: 1 1 100%;
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 0.65rem 0.8rem;
  transition: all 0.15s;
}
.toggle:hover { border-color: var(--gold); }
.toggle.on { background: #f4f8fd; border-color: var(--brand); }
.toggle .tg-sw {
  width: 42px; height: 24px; border-radius: 999px; background: #cfd6df; position: relative;
  flex: none; transition: background 0.18s;
}
.toggle .tg-sw::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: transform 0.18s;
}
.toggle.on .tg-sw { background: var(--brand); }
.toggle.on .tg-sw::after { transform: translateX(18px); }
.toggle .tg-txt { min-width: 0; }
.toggle .tg-nm { font-weight: 600; color: var(--brand); font-size: 0.88rem; }
.toggle .tg-dc { font-size: 0.73rem; color: var(--muted); line-height: 1.45; }

/* Simulations enregistrées (compte) — même modèle que le nucléaire */
.scn-actions { margin-top: 0.85rem; }
.scn-login { font-size: 0.8rem; color: var(--muted); margin: 0; line-height: 1.5; }
.scn-login a { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }
.scn-login a:hover { color: var(--gold); }
.scn-saved { position: relative; padding: 0; }
.scn-saved.on { border-color: var(--brand); background: #f4f8fd; box-shadow: inset 0 0 0 1px var(--brand); }
.scn-saved .scn-main {
  display: block; width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  padding: 0.75rem 2rem 0.75rem 0.85rem; font-family: 'Montserrat', sans-serif;
}
.scn-del {
  position: absolute; top: 0.45rem; right: 0.45rem; width: 1.5rem; height: 1.5rem; line-height: 1;
  border: 0; border-radius: 6px; background: rgba(26,24,20,0.05); color: var(--muted);
  cursor: pointer; font-size: 0.82rem;
}
.scn-del:hover { color: var(--down); background: #f6e2d8; }

/* ── Constructeur de réformes datées ── */
.rf-list { display: flex; flex-direction: column; gap: 0.45rem; margin-bottom: 0.9rem; }
.rf-empty { font-size: 0.8rem; color: var(--muted); line-height: 1.55; margin: 0; font-style: italic; }
.rf-row {
  display: flex; align-items: center; gap: 0.55rem;
  background: #f4f8fd; border: 1px solid var(--brand); border-radius: 11px; padding: 0.5rem 0.65rem;
}
.rf-ic { flex: none; font-size: 1.05rem; }
.rf-txt { flex: 1 1 auto; font-size: 0.8rem; color: var(--ink); line-height: 1.45; }
.rf-del {
  flex: none; width: 1.5rem; height: 1.5rem; line-height: 1;
  border: 0; border-radius: 6px; background: rgba(26,24,20,0.05); color: var(--muted);
  cursor: pointer; font-size: 0.82rem;
}
.rf-del:hover { color: var(--down); background: #f6e2d8; }
.rf-form { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 0.8rem 0.9rem; }
.rf-form-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.6rem; margin-bottom: 0.55rem; }
.rf-form-row:last-of-type { margin-bottom: 0; }
.rf-lab { font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.rf-select {
  font-family: 'Montserrat', sans-serif; font-size: 0.8rem; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 0.34rem 0.5rem;
  max-width: 100%;
}
.rf-select:focus, .rf-form .mini-num:focus { outline: 2px solid rgba(29,58,95,0.35); outline-offset: 1px; }
.rf-note { flex: 1 1 100%; font-size: 0.7rem; color: var(--muted); line-height: 1.45; }
.rf-check { font-size: 0.76rem; color: var(--ink); line-height: 1.5; display: flex; gap: 0.45rem; align-items: flex-start; cursor: pointer; }
.rf-check input { accent-color: var(--brand); width: 16px; height: 16px; flex: none; margin-top: 0.1rem; cursor: pointer; }
.mini-num {
  width: 4.6rem; border: 1px solid var(--line); border-radius: 7px; padding: 0.32rem 0.4rem;
  text-align: center; font-size: 0.82rem; font-family: 'Montserrat', sans-serif; background: #fff;
}

.btn-ghost {
  font-family: 'Montserrat', sans-serif; cursor: pointer; border-radius: 10px;
  padding: 0.5rem 0.85rem; font-size: 0.8rem; transition: all 0.15s;
  background: #fff; color: var(--brand); border: 1px solid var(--line);
}
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }
.btn-ghost.small { padding: 0.38rem 0.68rem; font-size: 0.75rem; }
.btn-solid {
  font-family: 'Montserrat', sans-serif; cursor: pointer; border-radius: 10px;
  padding: 0.55rem 1rem; font-size: 0.85rem; font-weight: 500; transition: all 0.15s;
  background: var(--brand); color: #fff; border: 1px solid var(--brand);
}
.btn-solid:hover { background: #142a45; }

/* Barre d'action sous le graphe */
.chart-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.7rem 0.1rem 0.15rem; }
.chart-actions .btn-ghost { padding: 0.55rem 0.9rem; font-size: 0.82rem; }

/* Bulle de confirmation */
.toast {
  position: absolute; left: 50%; bottom: 12px; transform: translate(-50%, 8px);
  background: #1d3a5f; color: #fff; font-size: 0.8rem; padding: 0.5rem 0.9rem;
  border-radius: 999px; box-shadow: 0 8px 22px rgba(26,24,20,0.22);
  opacity: 0; pointer-events: none; transition: opacity 0.18s, transform 0.18s; z-index: 20; white-space: nowrap;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ── NOTE / MÉTHODE / SOURCES ── */
.note { max-width: 900px; margin: 2.4rem auto 0; padding: 1.4rem 0 0; border-top: 1px solid var(--line); }
.note h3 { font-family: 'Cormorant Garamond', serif; font-size: 1.35rem; color: var(--brand); font-weight: 600; margin: 0 0 0.7rem; }
.note h4 { font-family: 'Cormorant Garamond', serif; font-size: 1.12rem; color: #8a6d2f; font-weight: 600; margin: 1.1rem 0 0.4rem; }
.note p, .note li { font-size: 0.86rem; line-height: 1.72; color: #4a443b; margin: 0 0 0.7rem; }
.note ul { padding-left: 1.2rem; margin: 0 0 0.7rem; }
.note li { margin: 0 0 0.35rem; }
.note b { font-weight: 600; color: var(--ink); }
.note em { font-style: italic; color: var(--brand); }
.note a { color: var(--brand); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 2px; }
.note a:hover { color: var(--gold); }

/* Tableau de sources */
.src-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; margin: 0.4rem 0 0.9rem; }
.src-table th, .src-table td { text-align: left; padding: 0.4rem 0.55rem; border-top: 1px solid var(--line); vertical-align: top; line-height: 1.5; }
.src-table th { font-size: 0.64rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.src-table td:first-child { white-space: nowrap; font-weight: 500; }
.src-table a { color: var(--brand); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 2px; }
.src-table a:hover { color: var(--gold); }
@media (max-width: 640px) {
  .src-table td:first-child { white-space: normal; }
}

/* ── RESPONSIVE ── */
@media (max-width: 720px) {
  .seg { margin-left: 0; }
  .chart-topbar { gap: 0.5rem; }
}
@media (max-width: 520px) {
  .kpi { flex: 1 1 44%; }
  .pill-lab { min-width: 100%; margin-bottom: -0.2rem; }
}
