/* ═══════════════════════════════════════════════════════════════════════
   Style commun — identité « La Marée Rouge »
   Polices hébergées avec l'outil (aucune dépendance externe).
   ═══════════════════════════════════════════════════════════════════════ */
@font-face { font-family: "Inter"; src: url("polices/inter-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("polices/inter-latin-600-normal.woff2") format("woff2"); font-weight: 500 600; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("polices/montserrat-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("polices/montserrat-latin-800-normal.woff2") format("woff2"); font-weight: 800 900; font-display: swap; }

:root {
  /* Couleurs de la campagne */
  --marque-rouge: #e30613; --marque-rouge-fonce: #a3000c; --marque-rouge-nuit: #5c0008;
  --marque-jaune: #ffe500; --marque-noir: #141414; --marque-vert: #0a8f3c;
  /* Camps politiques */
  --camp-opposition: #e30613; --camp-majorite: #4b5563; --camp-non-classe: #c9c3bc;

  --fond: #f6f3ef; --surface: #ffffff; --surface-2: #f1ede8; --surface-3: #e7e1da;
  --texte: #171412; --texte-2: #4b4440; --texte-3: #756c66;
  --bord: #e6e0d9; --bord-fort: #d3cbc2;
  --accent: #d1050f; --accent-texte: #ffffff; --accent-doux: #fde6e7;
  --ok: #0a7f36; --ok-doux: #e0f4e7; --alerte: #8a5300; --alerte-doux: #fff3c4;
  --erreur: #8e1747; --erreur-doux: #f9e3ec; --info: #2a5a99; --info-doux: #e6eef9;

  --rayon: 16px; --rayon-petit: 10px;
  --ombre: 0 1px 2px rgba(60, 30, 20, .05), 0 6px 20px -8px rgba(60, 30, 20, .12);
  --ombre-forte: 0 2px 4px rgba(60, 30, 20, .06), 0 16px 40px -12px rgba(60, 30, 20, .22);
  --police-titre: "Montserrat", system-ui, sans-serif;
  --police: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --camp-majorite: #9aa4b2; --camp-non-classe: #4a4440; --camp-opposition: #ff4651;
    --fond: #121010; --surface: #1c1918; --surface-2: #26221f; --surface-3: #302b28;
    --texte: #f5f1ee; --texte-2: #cdc4bd; --texte-3: #9d948d;
    --bord: #332e2b; --bord-fort: #453f3b;
    --accent: #ff4d55; --accent-texte: #1a0002; --accent-doux: #3d1517;
    --ok: #5fd08a; --ok-doux: #15301f; --alerte: #ffd84a; --alerte-doux: #3a3010;
    --erreur: #f48fb1; --erreur-doux: #3d1a28; --info: #8db8f0; --info-doux: #1b2a3d;
    --ombre: 0 1px 2px rgba(0,0,0,.3); --ombre-forte: 0 8px 30px rgba(0,0,0,.45); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --camp-majorite: #9aa4b2; --camp-non-classe: #4a4440; --camp-opposition: #ff4651;
  --fond: #121010; --surface: #1c1918; --surface-2: #26221f; --surface-3: #302b28;
  --texte: #f5f1ee; --texte-2: #cdc4bd; --texte-3: #9d948d;
  --bord: #332e2b; --bord-fort: #453f3b;
  --accent: #ff4d55; --accent-texte: #1a0002; --accent-doux: #3d1517;
  --ok: #5fd08a; --ok-doux: #15301f; --alerte: #ffd84a; --alerte-doux: #3a3010;
  --erreur: #f48fb1; --erreur-doux: #3d1a28; --info: #8db8f0; --info-doux: #1b2a3d;
  --ombre: 0 1px 2px rgba(0,0,0,.3); --ombre-forte: 0 8px 30px rgba(0,0,0,.45); color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--texte);
  font: 17px/1.6 var(--police); -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: 2px; }
h1, h2, h3 { font-family: var(--police-titre); line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; font-weight: 800; }
h2 { font-size: 1.22rem; font-weight: 800; }
h3 { font-size: 1rem; font-weight: 700; }
.conteneur { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.etroit { max-width: 580px; }
.carte { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon);
  padding: 20px; box-shadow: var(--ombre); margin-bottom: 16px; }
.muted { color: var(--texte-2); }
.petit { font-size: .9rem; }
.chiffre, .n { font-variant-numeric: tabular-nums; }
.ligne { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.espace { justify-content: space-between; }
.grille { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.surtitre { font: 700 .72rem/1 var(--police-titre); text-transform: uppercase; letter-spacing: .09em; color: var(--texte-3); margin-bottom: 8px; }

/* Boutons et champs */
button, .bouton {
  font: 600 .95rem/1.2 var(--police); border: 1px solid var(--bord-fort); background: var(--surface); color: var(--texte);
  padding: 10px 18px; border-radius: 999px; cursor: pointer; min-height: 44px; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s, border-color .15s, transform .1s, box-shadow .15s;
}
button:hover, .bouton:hover { border-color: var(--texte-3); }
button:active, .bouton:active { transform: translateY(1px); }
button.principal, .bouton.principal {
  background: linear-gradient(180deg, #f0141f, var(--marque-rouge-fonce)); color: #fff; border-color: transparent;
  box-shadow: 0 6px 16px -6px rgba(227, 6, 19, .6);
}
button.principal:hover, .bouton.principal:hover { box-shadow: 0 8px 22px -6px rgba(227, 6, 19, .75); }
button.danger { color: var(--erreur); border-color: currentColor; background: transparent; }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
button.lien { border: 0; background: none; color: var(--accent); padding: 4px 6px; min-height: 0; border-radius: 6px; }
label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; color: var(--texte-2); }
input, select, textarea {
  font: inherit; width: 100%; padding: 11px 14px; border-radius: var(--rayon-petit); border: 1px solid var(--bord-fort);
  background: var(--surface); color: var(--texte); min-height: 46px; transition: border-color .15s, box-shadow .15s;
}
input[type="number"] { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 1.05rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-doux); }
button:focus-visible, a:focus-visible { outline: 3px solid var(--marque-jaune); outline-offset: 2px; }
.champ { margin-bottom: 14px; }

/* Onglets (barre) */
.onglets { display: flex; gap: 4px; border-bottom: 1px solid var(--bord); margin-bottom: 20px; flex-wrap: wrap; row-gap: 0; }
.onglets button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none;
  padding: 12px 16px; white-space: nowrap; color: var(--texte-2); min-height: 0; }
.onglets button.actif { color: var(--texte); border-bottom-color: var(--marque-rouge); }

/* Sélecteur segmenté (pilule) */
.segments { display: inline-flex; background: var(--surface-3); padding: 4px; border-radius: 999px; gap: 2px; }
.segments button { border: 0; background: transparent; color: var(--texte-2); min-height: 40px; padding: 8px 20px; box-shadow: none; }
.segments button.actif { background: var(--surface); color: var(--texte); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* Badges d'état */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-valide { background: var(--ok-doux); color: var(--ok); }
.b-provisoire, .b-recu { background: var(--info-doux); color: var(--info); }
.b-conflit, .b-rejete { background: var(--erreur-doux); color: var(--erreur); }
.b-en_attente, .b-attente { background: var(--alerte-doux); color: var(--alerte); }
.b-absent, .b-remplace { background: var(--surface-2); color: var(--texte-2); }

.message { padding: 12px 14px; border-radius: var(--rayon-petit); margin: 8px 0; font-size: .92rem; }
.m-erreur { background: var(--erreur-doux); color: var(--erreur); }
.m-alerte { background: var(--alerte-doux); color: var(--alerte); }
.m-ok { background: var(--ok-doux); color: var(--ok); }
.m-info { background: var(--info-doux); color: var(--info); }

/* Tableaux */
.defile { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .96rem; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--bord); vertical-align: middle; }
th { font: 700 .74rem/1.2 var(--police-titre); text-transform: uppercase; letter-spacing: .07em; color: var(--texte-3); }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
tr.cliquable { cursor: pointer; transition: background .12s; } tr.cliquable:hover { background: var(--surface-2); }

/* Puce de parti (pastille colorée avec sigle) */
.puce { display: inline-grid; place-items: center; min-width: 50px; height: 28px; padding: 0 9px; border-radius: 8px;
  color: #fff; font: 800 .78rem/1 var(--police-titre); letter-spacing: .02em; text-shadow: 0 1px 1px rgba(0,0,0,.25); }

/* Barres de résultats */
.barres { display: grid; gap: 14px; }
.barre-ligne { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; }
.barre-tete { display: flex; align-items: center; gap: 10px; min-width: 0; }
.barre-nom { font-weight: 700; font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barre-sous { font-size: .86rem; color: var(--texte-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barre-piste { grid-column: 1 / -1; background: var(--surface-2); border-radius: 99px; height: 12px; overflow: hidden; }
.barre-remplie { display: block; height: 100%; border-radius: 99px; min-width: 3px; transition: width .6s cubic-bezier(.2,.8,.2,1); }
.barre-val { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.barre-val strong { font: 800 1.2rem/1 var(--police-titre); }
.jauge { background: var(--surface-2); border-radius: 99px; height: 12px; overflow: hidden; display: flex; }
.jauge > span { display: block; height: 100%; transition: width .6s; }
.legende { display: flex; gap: 8px 18px; flex-wrap: wrap; font-size: .88rem; color: var(--texte-2); margin-top: 10px; }
.legende i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* Bandeau aux couleurs de la campagne */
.entete-marque {
  position: relative; color: #fff; overflow: hidden;
  background:
    radial-gradient(1200px 300px at 85% -40%, rgba(255, 229, 0, .22), transparent 60%),
    radial-gradient(800px 400px at -10% 120%, rgba(0, 0, 0, .35), transparent 60%),
    linear-gradient(135deg, #f0141f 0%, var(--marque-rouge) 45%, var(--marque-rouge-fonce) 100%);
}
.entete-marque .conteneur { display: flex; align-items: center; gap: 16px; }
.entete-marque img.logo { height: 72px; width: auto; flex: none; filter: drop-shadow(0 4px 10px rgba(0,0,0,.3)); }
.entete-marque h1 { color: #fff; margin: 0; text-transform: uppercase; letter-spacing: .01em; font-weight: 900; font-size: 1.8rem; }
.entete-marque .sous-titre { color: var(--marque-jaune); font: 700 1rem/1.35 var(--police-titre); }
.entete-marque .muted, .entete-marque .petit { color: #ffe3e4; }
.bande-drapeau { height: 5px; background: linear-gradient(90deg, var(--marque-vert) 0 33.33%, var(--marque-rouge) 33.33% 66.66%, var(--marque-jaune) 66.66%); }
.direct { display: inline-flex; align-items: center; gap: 8px; background: rgba(0,0,0,.25); backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,.2); color: #fff; padding: 7px 14px; border-radius: 99px; font-size: .88rem; font-weight: 600; white-space: nowrap; }
.direct::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--marque-jaune); box-shadow: 0 0 0 0 rgba(255,229,0,.7); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(255,229,0,0); } 100% { box-shadow: 0 0 0 0 rgba(255,229,0,0); } }
@media (prefers-reduced-motion: reduce) { .direct::before { animation: none; } .barre-remplie, .jauge > span { transition: none; } }
@media (max-width: 600px) {
  .entete-marque img.logo { height: 52px; }
  .entete-marque h1 { font-size: 1.2rem; }
  .entete-marque .sous-titre { font-size: .86rem; }
  .masque-mobile { display: none; }
  th, td { padding: 10px 8px; }
  .carte { padding: 16px; }
}
.cache { display: none !important; }
