/* ═══════════════════════════════════════════════════════════════════════════
   reglement-hub — charte des deux consoles (FIVE SARL)
   Inspiration « infrastructure financière » : encre marine, primaire indigo,
   surfaces quasi blanches, chiffres à chasse tabulaire partout où il y a de
   l'argent.

   DEUX POLARITÉS, ET C'EST VOULU :
     · [data-console="prod"] → fond clair, primaire indigo — la sobriété d'un
       outil qui engage.
     · [data-console="demo"] → coque sombre, accent ambre — impossible à
       confondre avec la précédente lors d'une bascule d'onglet en réunion.
   Personne ne doit avoir à LIRE pour savoir où il se trouve.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --ink:            #0d253d;
  --ink-2:          #273951;
  --ink-mute:       #64748d;
  --canvas:         #ffffff;
  --canvas-soft:    #f6f9fc;
  --hairline:       #e3e8ee;
  --primaire:       #533afd;
  --primaire-fonce: #4434d4;
  --primaire-doux:  #eceafe;
  --ambre:          #ffb020;
  --ambre-fonce:    #b4560a;
  --ambre-encre:    #2b1a00;
  --succes:         #0f7b5a;
  --succes-doux:    #e4f4ee;
  --alerte:         #b3261e;
  --alerte-doux:    #fbeceb;
  --attente:        #8a6100;
  --attente-doux:   #fdf3dc;

  --r-1: 4px;  --r-2: 8px;  --r-3: 14px;
  --e-1: 4px;  --e-2: 8px;  --e-3: 16px; --e-4: 24px; --e-5: 40px;
  --ombre-1: 0 1px 2px rgba(13,37,61,.08), 0 1px 1px rgba(13,37,61,.04);
  --ombre-2: 0 4px 14px rgba(13,37,61,.10), 0 1px 3px rgba(13,37,61,.06);

  /* Polices : aucune des familles proscrites par la charte FIVE SARL.
     `system-ui` est évité volontairement — il résout vers une police interdite
     sur plusieurs plateformes. */
  --sans: 'SF Pro Display', 'Segoe UI', 'Helvetica Neue', 'Nimbus Sans', 'Liberation Sans', sans-serif;
  --serif: 'Bitstream Charter', 'Charter', 'Nimbus Roman', 'Liberation Serif', Georgia, serif;
  --mono: 'SF Mono', 'DejaVu Sans Mono', 'Liberation Mono', 'Noto Sans Mono', monospace;

  --fond: var(--canvas-soft);
  --surface: var(--canvas);
  --texte: var(--ink);
  --texte-doux: var(--ink-mute);
  --bordure: var(--hairline);
  --accent: var(--primaire);
  --accent-doux: var(--primaire-doux);
}

/* Console DÉMONSTRATION : coque sombre, accent ambre. */
[data-console="demo"] {
  --fond:        #071426;
  --surface:     #0e2138;
  --surface-2:   #16304d;
  --texte:       #eaf1f8;
  --texte-doux:  #9db2c9;
  --bordure:     #1e3c5e;
  --accent:      var(--ambre);
  --accent-doux: #2a2008;
  --succes-doux: #0b2b22;
  --alerte-doux: #331313;
  --attente-doux:#2c2308;
  --succes:      #4fd6a8;
  --alerte:      #ff8b82;
  --attente:     #ffca4d;
  --ombre-1: 0 1px 2px rgba(0,0,0,.4);
  --ombre-2: 0 6px 20px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--texte);
  font-family: var(--sans); font-size: 15px; line-height: 1.55;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3 { font-weight: 300; letter-spacing: -.02em; line-height: 1.12; margin: 0; }
h1 { font-size: 32px; }
h2 { font-size: 22px; }
h3 { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
a { color: var(--accent); }
code, .mono { font-family: var(--mono); font-size: .86em; }

/* ── Bandeaux permanents ─────────────────────────────────────────────────── */
.bandeau {
  position: sticky; top: 0; z-index: 30; padding: 10px var(--e-4);
  display: flex; gap: var(--e-3); align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; letter-spacing: .06em; text-transform: uppercase;
}
.bandeau--demo { background: var(--ambre); color: var(--ambre-encre); }
.bandeau--prod { background: var(--ink); color: #fff; }
.bandeau small { font-weight: 500; text-transform: none; letter-spacing: 0; opacity: .85; }

.enveloppe { max-width: 1180px; margin: 0 auto; padding: var(--e-4); }

/* ── En-tête ─────────────────────────────────────────────────────────────── */
.tete { display: flex; flex-wrap: wrap; gap: var(--e-3); align-items: flex-start;
        justify-content: space-between; margin-bottom: var(--e-4); }
.tete p { margin: var(--e-1) 0 0; color: var(--texte-doux); max-width: 62ch; }

/* ── Onglets ─────────────────────────────────────────────────────────────── */
.onglets { display: flex; flex-wrap: wrap; gap: var(--e-1); border-bottom: 1px solid var(--bordure);
           margin-bottom: var(--e-4); }
.onglets button {
  appearance: none; background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 10px 14px; font: inherit; font-size: 14px; color: var(--texte-doux);
  cursor: pointer; border-radius: var(--r-1) var(--r-1) 0 0;
}
.onglets button:hover { color: var(--texte); background: var(--accent-doux); }
.onglets button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.onglets button:focus-visible, .bouton:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Cartes ──────────────────────────────────────────────────────────────── */
.carte { background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--r-3);
         padding: var(--e-4); box-shadow: var(--ombre-1); }
.carte + .carte { margin-top: var(--e-3); }
.carte > h2, .carte > h3 { margin-bottom: var(--e-2); }
.grille { display: grid; gap: var(--e-3); }
.grille--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grille--4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

/* ── Tuiles de montant : les quatre états, jamais fondus en un seul ──────── */
.tuile { background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--r-2);
         padding: var(--e-3); }
.tuile .etiquette { font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
                    color: var(--texte-doux); font-weight: 600; }
.tuile .valeur { font-size: 23px; font-weight: 300; letter-spacing: -.02em; margin-top: 2px; }
.tuile .note { font-size: 12px; color: var(--texte-doux); }
.tuile--attente { border-left: 3px solid var(--attente); }
.tuile--acquis  { border-left: 3px solid var(--accent); }
.tuile--regl    { border-left: 3px solid var(--ink-mute); }
.tuile--verse   { border-left: 3px solid var(--succes); }
.negatif { color: var(--alerte); }

/* ── Tableaux ────────────────────────────────────────────────────────────── */
.table-enveloppe { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
     color: var(--texte-doux); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--bordure); }
td { padding: 9px 10px; border-bottom: 1px solid var(--bordure); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── Pastilles d'état ────────────────────────────────────────────────────── */
.pastille { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px;
            font-weight: 700; letter-spacing: .03em; white-space: nowrap; }
.p-ok      { background: var(--succes-doux); color: var(--succes); }
.p-attente { background: var(--attente-doux); color: var(--attente); }
.p-ko      { background: var(--alerte-doux); color: var(--alerte); }
.p-neutre  { background: var(--accent-doux); color: var(--accent); }

/* ── Boutons ─────────────────────────────────────────────────────────────── */
.bouton { appearance: none; border: 1px solid transparent; border-radius: 999px;
          padding: 9px 18px; font: inherit; font-size: 14px; font-weight: 600;
          cursor: pointer; background: var(--accent); color: #fff; }
[data-console="demo"] .bouton { color: var(--ambre-encre); }
.bouton:hover { filter: brightness(.94); }
.bouton:disabled { opacity: .5; cursor: not-allowed; }
.bouton--fantome { background: transparent; color: var(--texte); border-color: var(--bordure); }
.bouton--danger { background: transparent; color: var(--alerte); border-color: var(--alerte); }
/* Sur fond sombre, l'encre du bouton plein est presque noire : elle rendrait
   les boutons transparents illisibles. La règle doit donc être au moins aussi
   spécifique que celle qu'elle corrige. */
[data-console="demo"] .bouton--fantome { color: var(--texte); }
[data-console="demo"] .bouton--danger { color: var(--alerte); }
.barre-actions { display: flex; flex-wrap: wrap; gap: var(--e-2); align-items: center; }

select, input[type="text"] {
  font: inherit; font-size: 14px; padding: 8px 10px; border-radius: var(--r-2);
  border: 1px solid var(--bordure); background: var(--surface); color: var(--texte);
}

/* ── Récit de la démonstration ───────────────────────────────────────────── */
.etape { display: grid; grid-template-columns: 34px 1fr; gap: var(--e-3);
         padding: var(--e-3) 0; border-bottom: 1px solid var(--bordure); }
.etape:last-child { border-bottom: 0; }
.etape .num { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-doux);
              color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.etape h3 { margin-bottom: 2px; }
.etape .quoi { color: var(--texte); }
.etape .retenir { margin-top: var(--e-2); padding: 10px 12px; border-left: 3px solid var(--accent);
                  background: var(--accent-doux); border-radius: 0 var(--r-2) var(--r-2) 0; font-size: 14px; }
details.donnees { margin-top: var(--e-2); }
details.donnees summary { cursor: pointer; color: var(--texte-doux); font-size: 13px; }
details.donnees pre { overflow-x: auto; background: var(--fond); border: 1px solid var(--bordure);
                      border-radius: var(--r-2); padding: var(--e-2); font-size: 12px; }

/* ── Liste de contrôle ───────────────────────────────────────────────────── */
.controle { list-style: none; margin: 0; padding: 0; }
.controle li { display: flex; flex-wrap: wrap; gap: var(--e-2); align-items: baseline;
               padding: 11px 0; border-bottom: 1px dashed var(--bordure); }
.controle li:last-child { border-bottom: 0; }
.controle .libelle { flex: 1 1 260px; }
.controle .detail { flex: 1 1 100%; font-size: 12.5px; color: var(--texte-doux); }

/* ── États de chargement / vide / erreur ─────────────────────────────────── */
.etat-vide, .etat-charge, .etat-erreur {
  padding: var(--e-4); text-align: center; color: var(--texte-doux);
  border: 1px dashed var(--bordure); border-radius: var(--r-2); }
.etat-erreur { color: var(--alerte); border-color: var(--alerte); border-style: solid;
               background: var(--alerte-doux); text-align: left; }
.etat-charge::after { content: ' …'; }

/* ── Pied de page ────────────────────────────────────────────────────────── */
.pied { margin-top: var(--e-5); padding: var(--e-4) 0; border-top: 1px solid var(--bordure);
        color: var(--texte-doux); font-size: 12.5px; }
.pied strong { color: var(--texte); font-weight: 600; }

@media (max-width: 640px) {
  .enveloppe { padding: var(--e-3); }
  h1 { font-size: 26px; }
  .bandeau { padding: 9px var(--e-3); font-size: 11.5px; text-align: center; }
}

/* Lien d'action rendu par un bouton : le PDF est récupéré puis ouvert depuis
   un objet local, jamais par une URL portant un secret. */
.lien-pdf { appearance: none; background: none; border: 0; padding: 0; font: inherit;
            color: var(--accent); text-decoration: underline; cursor: pointer; }
.lien-pdf:disabled { opacity: .6; cursor: wait; }
