:root {
    --bg: #fafaf7;
    --surface: #ffffff;
    --ink: #1a1d21;
    --ink-soft: #5b6470;
    --line: #e3e5e8;

    /* Couleurs de vote — UNE seule définition, reprise partout (points, compteurs, légendes,
       badges, barres) : Pour = bleu, Contre = rouge, Abstention = orange, Non-votant = gris, Absent = gris clair. */
    --pour: #2563c9;
    --contre: #d1342c;
    --abstention: #f28c0f;
    --abstention-texte: #c26a00;
    /* Résultat d'un scrutin */
    --adopte: #1e8e4e;
    --rejete: #c4302b;
    --tag-rectifie: #7b3fb5;
    --tag-delegation: #0e7c86;
    --nonvotant: #7d8794;
    --absent: #d5d9de;

    --radius: 10px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #14171a;
        --surface: #1c2024;
        --ink: #eceef0;
        --ink-soft: #9aa3ad;
        --line: #2b3137;
        --absent: #3a424a;
        --pour: #5b9bf5;
        --contre: #f0625a;
        --abstention: #f5a43a;
        --abstention-texte: #f5a43a;
        --adopte: #4cc38a;
        --rejete: #f0625a;
        --tag-rectifie: #b98af0;
        --tag-delegation: #4fc3cc;
    }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

a { color: inherit; }

/* ---- En-tête / pied ---- */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-header .wrap { display: flex; align-items: baseline; gap: 16px; padding-top: 14px; padding-bottom: 14px; flex-wrap: wrap; }
.brand { font-size: 1.35rem; font-weight: 800; text-decoration: none; letter-spacing: -0.02em; }
.brand em { font-style: normal; color: var(--contre); }
.tagline { color: var(--ink-soft); font-size: 0.9rem; }

.site-footer { margin-top: 56px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 0.85rem; }
.site-footer .wrap { padding-top: 20px; padding-bottom: 32px; }
.site-footer p { margin: 0 0 6px; }

/* ---- Accueil ---- */
.intro { padding: 36px 0 12px; max-width: 760px; }
.intro h1 { margin: 0 0 10px; font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.1; letter-spacing: -0.03em; }
.intro p { margin: 0; font-size: 1.1rem; color: var(--ink-soft); }
.c-pour { color: var(--pour); }
.c-contre { color: var(--contre); }
.c-abstention { color: var(--abstention-texte); }
.c-absent { color: var(--ink-soft); }
.vide { color: var(--ink-soft); padding: 40px 0; }

.cartes { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 20px; margin-top: 24px; }

.carte { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 14px; display: flex; flex-direction: column; }
.carte header { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--ink-soft); }
.carte h2 { margin: 8px 0 6px; font-size: 1.05rem; line-height: 1.35; }
.carte h2 a { text-decoration: none; }
.carte h2 a:hover { text-decoration: underline; }
.carte-hemicycle { display: block; margin-top: auto; }

.sort { white-space: nowrap; font-weight: 700; padding: 2px 9px; border-radius: 999px; font-size: 0.78rem; }
.sort.adopte { background: color-mix(in srgb, var(--adopte) 16%, transparent); color: var(--adopte); }
.sort.rejete { background: color-mix(in srgb, var(--rejete) 14%, transparent); color: var(--rejete); }

.decompte { list-style: none; display: flex; justify-content: space-between; gap: 6px; margin: 6px 0 0; padding: 10px 0 0; border-top: 1px solid var(--line); font-size: 0.85rem; color: var(--ink-soft); }
.decompte b { font-size: 1.1rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.d-pour b { color: var(--pour); }
.d-contre b { color: var(--contre); }
.d-abstention b { color: var(--abstention-texte); }
.d-absent b { color: var(--ink-soft); }

/* ---- Hémicycle ---- */
.hemicycle { display: block; width: 100%; height: auto; }
.hemicycle circle { stroke: transparent; stroke-width: 2; transition: stroke 0.1s; }
.hemicycle circle:hover { stroke: var(--ink); }
.p-pour { fill: var(--pour); }
.p-contre { fill: var(--contre); }
.p-abstention { fill: var(--abstention); }
.p-non_votant { fill: var(--nonvotant); }
.p-absent { fill: var(--absent); }
.hemicycle circle.rectifie { stroke: var(--ink); stroke-width: 2.5; }

/* ---- Page scrutin ---- */
.retour { margin: 20px 0 0; font-size: 0.9rem; }
.retour a { color: var(--ink-soft); }
.scrutin-tete .meta { margin: 18px 0 4px; color: var(--ink-soft); font-size: 0.9rem; }
.scrutin-tete h1 { margin: 0 0 16px; font-size: clamp(1.4rem, 3vw, 2rem); line-height: 1.25; letter-spacing: -0.02em; max-width: 900px; }

.hemicycle-grand { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 12px 4px; }

.legende { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 14px 0 0; margin: 0 0 6px; }
.legende li { display: flex; align-items: center; gap: 7px; }
.legende i { width: 14px; height: 14px; border-radius: 50%; display: inline-block; background: var(--absent); }
.legende .d-pour i { background: var(--pour); }
.legende .d-contre i { background: var(--contre); }
.legende .d-abstention i { background: var(--abstention); }
.legende .d-nonvotant i { background: var(--nonvotant); }
.legende b { font-variant-numeric: tabular-nums; }

h2 { margin: 36px 0 12px; font-size: 1.25rem; letter-spacing: -0.01em; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); }
thead th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); background: color-mix(in srgb, var(--ink) 3%, transparent); }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
table.groupes td, table.groupes thead th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.pastille { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }

.filtre { width: 100%; max-width: 420px; padding: 10px 14px; margin-bottom: 12px; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.filtre:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
tr[hidden] { display: none; }

.badge { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 0.82rem; font-weight: 600; color: #fff; }
.b-pour { background: var(--pour); }
.b-contre { background: var(--contre); }
.b-abstention { background: var(--abstention); color: #1a1d21; }
.b-non_votant { background: var(--nonvotant); }
.b-absent { background: var(--absent); color: var(--ink); }
.note { margin-left: 8px; font-size: 0.8rem; color: var(--ink-soft); }

@media (max-width: 600px) {
    th, td { padding: 8px 10px; }
    .decompte { font-size: 0.8rem; }
}

.alerte { margin: 0 0 14px; padding: 12px 16px; border-radius: var(--radius); border: 1px solid var(--abstention); background: color-mix(in srgb, var(--abstention) 14%, transparent); font-size: 0.92rem; }

/* ---- Navigation ---- */
.menu { display: flex; gap: 4px 18px; flex-wrap: wrap; margin-left: auto; font-size: 0.95rem; }
.menu a { text-decoration: none; color: var(--ink-soft); padding: 2px 0; border-bottom: 2px solid transparent; }
.menu a:hover { color: var(--ink); }
.menu a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--contre); }

/* ---- Pages de liste ---- */
.titre-page { margin: 28px 0 6px; font-size: clamp(1.6rem, 3.5vw, 2.2rem); letter-spacing: -0.03em; line-height: 1.15; }
.chapo { margin: 0 0 18px; color: var(--ink-soft); max-width: 760px; }
.compte { color: var(--ink-soft); font-size: 0.9rem; margin: 8px 0; }

.filtres { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filtres .filtre { flex: 1 1 280px; margin-bottom: 0; }
.filtres select, .filtres button { font: inherit; padding: 10px 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.filtres button:hover { border-color: var(--ink-soft); }
.case { display: inline-flex; gap: 6px; align-items: center; color: var(--ink-soft); font-size: 0.92rem; }

.liste-textes td.num, .liste-textes th.num { text-align: right; font-variant-numeric: tabular-nums; }
.liste-textes a { text-decoration: none; }
.liste-textes a:hover { text-decoration: underline; }
.nowrap { white-space: nowrap; }

.chambre-tag { font-size: 0.75rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 8%, transparent); }
.ch-senat { background: color-mix(in srgb, #7b4591 20%, transparent); }
.ch-an { background: color-mix(in srgb, #1f6fb5 20%, transparent); }

.pagination { display: flex; gap: 18px; align-items: center; justify-content: center; margin: 20px 0 0; color: var(--ink-soft); }
.pagination a { text-decoration: none; padding: 6px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); }

/* ---- Accueil : sections par chambre ---- */
.chambre { margin-top: 36px; }
.chambre-tete { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 6px 18px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.chambre-tete h2 { margin: 0; font-size: 1.5rem; }
.chambre-tete p { margin: 0; font-size: 0.92rem; color: var(--ink-soft); }
.carte h3 { margin: 8px 0 6px; font-size: 1.05rem; line-height: 1.35; }
.carte h3 a { text-decoration: none; }
.carte h3 a:hover { text-decoration: underline; }

/* ---- Liste d'élus ---- */
.barre-groupes { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.puce { font: inherit; font-size: 0.88rem; padding: 4px 12px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; }
.puce b { margin-left: 6px; color: var(--ink-soft); font-weight: 600; }
.puce.actif { border-color: var(--ink); }
.grille-elus { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 8px; }
.grille-elus li[hidden] { display: none; }
.grille-elus a { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; padding: 10px 12px; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.grille-elus a:hover { border-color: var(--ink-soft); }
.grille-elus .pastille { margin: 0; grid-row: span 2; }
.grille-elus .nom { font-weight: 600; line-height: 1.25; }
.grille-elus .sous { font-size: 0.8rem; color: var(--ink-soft); }

/* ---- Fiche d'un élu ---- */
.fiche-tete h1 { margin: 18px 0 4px; font-size: clamp(1.6rem, 3.5vw, 2.3rem); letter-spacing: -0.03em; }
.fiche-tete .meta { margin: 0 0 8px; color: var(--ink-soft); }
.bilan-chiffre { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 0 0 12px; }
.bilan-chiffre strong { font-size: 2.4rem; letter-spacing: -0.03em; line-height: 1; }
.bilan-chiffre span { color: var(--ink-soft); max-width: 620px; }
.barre-empilee { display: flex; height: 16px; border-radius: 999px; overflow: hidden; background: var(--absent); }
.barre-empilee span { display: block; height: 100%; }
.barre-empilee .b-pour { background: var(--pour); }
.barre-empilee .b-contre { background: var(--contre); }
.barre-empilee .b-abstention { background: var(--abstention); }
.barre-empilee .b-non_votant { background: var(--nonvotant); }
.barre-empilee .b-absent { background: var(--absent); }

.note-source { margin: 10px 0 0; font-size: 0.85rem; color: var(--ink-soft); max-width: 820px; }

/* ---- Groupes dans l'hémicycle ---- */
.hemicycle .arc { fill: none; stroke-width: 12; stroke-linecap: butt; }
.hemicycle .etiquettes text { font-size: 21px; font-weight: 700; fill: var(--ink-soft); font-family: inherit; }
.hemicycle.par-groupe .sieges circle { fill: var(--g); }

.bascule { display: flex; align-items: center; gap: 6px; margin: 16px 0 8px; font-size: 0.9rem; color: var(--ink-soft); }
.bascule button { font: inherit; font-size: 0.9rem; padding: 4px 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
.bascule button.actif { border-color: var(--ink); font-weight: 600; }
.legende[hidden] { display: none; }
.legende .pastille { margin-right: 0; }

/* En-têtes et cellules de comptes : mêmes couleurs que les points */
.th-pour { color: var(--pour); }
.th-contre { color: var(--contre); }
.th-abstention { color: var(--abstention-texte); }
td.c-pour, td.c-contre, td.c-abstention { font-weight: 600; }
.barre-empilee.fine { height: 10px; min-width: 120px; }
.col-barre { width: 28%; }
table.groupes td.col-barre { text-align: left; }

/* ---- Étiquettes : mêmes couleurs partout (rectifié / par délégation / données incomplètes) ---- */
.tag { display: inline-block; margin-left: 8px; padding: 0 8px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; border: 1px solid currentColor; }
.tag-rectifie { color: var(--tag-rectifie); }
.tag-delegation { color: var(--tag-delegation); }

/* ---- Administration ---- */
.admin-nav { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; margin: 18px 0 0; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.admin-nav a { text-decoration: none; padding: 4px 12px; border-radius: 999px; color: var(--ink-soft); }
.admin-nav a:hover { color: var(--ink); }
.admin-nav a[aria-current="page"] { background: color-mix(in srgb, var(--ink) 10%, transparent); color: var(--ink); font-weight: 600; }
.admin-nav .deconnexion { margin-left: auto; }
.admin-nav .deconnexion button { font: inherit; font-size: 0.9rem; background: none; border: 0; color: var(--ink-soft); cursor: pointer; text-decoration: underline; }

.chiffres { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin: 16px 0; }
.chiffres div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; }
.chiffres b { font-size: 1.7rem; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.chiffres span { color: var(--ink-soft); font-size: 0.85rem; }
.liste-simple { margin: 0; padding-left: 1.2rem; color: var(--ink-soft); }

.separateur { width: 1px; background: var(--line); margin: 0 6px; align-self: stretch; }
a.puce { text-decoration: none; }

.formulaire { display: flex; flex-direction: column; gap: 12px; max-width: 420px; margin: 12px 0; }
.formulaire label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; color: var(--ink-soft); }
.formulaire label.case { flex-direction: row; align-items: center; gap: 8px; }
.formulaire input[type=email], .formulaire input[type=password], .formulaire input[type=text], .champ, .champ-court {
    font: inherit; padding: 9px 12px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.champ { min-width: 220px; flex: 1; }
.champ-court { width: 72px; }
.formulaire input:focus-visible, .champ:focus-visible, .champ-court:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }

.bouton { font: inherit; font-weight: 600; padding: 9px 18px; color: #fff; background: var(--pour); border: 0; border-radius: var(--radius); cursor: pointer; }
.bouton:hover { filter: brightness(1.08); }
.bouton.petit { padding: 5px 12px; font-size: 0.85rem; }
.bouton.secondaire { color: var(--ink); background: var(--surface); border: 1px solid var(--line); }
.bouton.danger { background: var(--contre); }

.en-ligne { display: inline-block; margin: 0 4px 4px 0; }
.ligne-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.texte-une { flex: 2 1 300px; display: flex; flex-direction: column; }
.info { margin: 0 0 14px; padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--adopte); background: color-mix(in srgb, var(--adopte) 12%, transparent); }
.note-cell { max-width: 360px; font-size: 0.85rem; color: var(--ink-soft); }

/* ---- Caractéristiques du vote (type, votants, majorité) ---- */
.fiche-vote { margin: 0 0 18px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.fiche-vote dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px 24px; margin: 0 0 14px; }
.fiche-vote dl > div { display: flex; flex-direction: column; gap: 1px; }
.fiche-vote dt { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); }
.fiche-vote dd { margin: 0; font-size: 1.15rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.fiche-vote dd.detail { font-size: 0.82rem; font-weight: 400; color: var(--ink-soft); }
.fiche-vote dd.detail:empty { display: none; }

.jauge { position: relative; display: flex; height: 14px; border-radius: 999px; background: var(--absent); overflow: visible; }
.jauge .j-pour { background: var(--pour); border-radius: 999px 0 0 999px; }
.jauge .j-contre { background: var(--contre); }
.jauge .j-seuil { position: absolute; top: -5px; bottom: -5px; width: 2px; background: var(--ink); transform: translateX(-1px); }
.jauge-legende { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 10px 0 0; font-size: 0.9rem; color: var(--ink-soft); }
.jauge-legende b { font-variant-numeric: tabular-nums; }
.jauge-legende .seuil { margin-left: auto; color: var(--ink); }

/* ---- Accueil : Assemblée nationale à gauche, Sénat à droite ---- */
.colonnes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; align-items: start; }
.colonnes .chambre { min-width: 0; }
.colonnes .cartes { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 900px) { .colonnes { grid-template-columns: minmax(0, 1fr); } }

/* ---- Cercle de groupe autour des points (couleur du groupe en anneau, couleur du vote au centre) ---- */
.hemicycle.anneau .sieges circle { stroke: var(--g); stroke-width: 3; }
.hemicycle.anneau .sieges circle:hover { stroke: var(--ink); }
.hemicycle.anneau .sieges circle.rectifie { stroke-dasharray: 3 2; }
.hemicycle.par-groupe .sieges circle { fill: var(--g); }
.anneau-case { margin-left: 14px; }

/* ---- Statut d'un texte (étiquettes colorées) ---- */
.statut { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 0.82rem; font-weight: 650; border: 1px solid currentColor; white-space: normal; line-height: 1.35; }
.statut-promulgue { color: var(--adopte); background: color-mix(in srgb, var(--adopte) 12%, transparent); }
.statut-partiel { color: var(--abstention-texte); background: color-mix(in srgb, var(--abstention) 12%, transparent); }
.statut-censure { color: var(--rejete); background: color-mix(in srgb, var(--rejete) 12%, transparent); }
.statut-attente { color: var(--tag-rectifie); background: color-mix(in srgb, var(--tag-rectifie) 14%, transparent); }
.statut-discussion { color: var(--pour); background: color-mix(in srgb, var(--pour) 10%, transparent); }
.statut-inactif { color: var(--ink-soft); }
.cc-conforme { color: var(--adopte); }
.cc-partiel { color: var(--abstention-texte); }
.cc-censure { color: var(--rejete); }

.bloc-texte { margin: 0 0 14px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.bloc-texte-titre { margin: 0 0 6px; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.bloc-texte-faits { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; color: var(--ink-soft); font-size: 0.92rem; }
.bloc-texte-faits b { color: var(--ink); }
.bloc-cc { margin: 18px 0; padding: 4px 16px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.bloc-cc h2 { margin: 12px 0 8px; font-size: 1.05rem; }
.liste-def { margin: 0; display: grid; gap: 8px; }
.liste-def dt { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); }
.liste-def dd { margin: 0; }
.liens-externes { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; }
td.liens a { margin-right: 10px; font-size: 0.85rem; }

/* ---- Tri par colonne et export ---- */
a.tri { text-decoration: none; color: inherit; white-space: nowrap; }
a.tri:hover, a.tri.actif { color: var(--ink); text-decoration: underline; }
thead th[aria-sort="ascending"], thead th[aria-sort="descending"] { color: var(--ink); }
.barre-liste { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; }
.export { margin: 8px 0; font-size: 0.88rem; color: var(--ink-soft); }
.export a { margin-left: 8px; padding: 2px 10px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--ink); background: var(--surface); }
.export a:hover { border-color: var(--ink-soft); }

/* ---- Tableau des lois : colonnes de droite compactes pour laisser le titre sur peu de lignes ---- */
.liste-textes .col-date { width: 1%; white-space: nowrap; font-variant-numeric: tabular-nums; }
.liste-textes .col-statut { width: 1%; white-space: nowrap; }
.liste-textes .col-liens { width: 1%; white-space: nowrap; }
.liste-textes td.liens a { display: block; margin: 0; line-height: 1.5; }
.liste-textes .col-titre { min-width: 260px; }
.liste-textes td.col-statut .statut { padding: 0 8px; font-size: 0.78rem; line-height: 1.5; white-space: nowrap; }

/* Mini-étiquettes par assemblée (AN / Sénat) : adopté, pas adopté, ou donnée absente */
.tag-ch { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 6px; font-size: 0.72rem; font-weight: 700; line-height: 1.5; border: 1px solid currentColor; cursor: help; }
.tag-ch.ch-ok { color: var(--adopte); background: color-mix(in srgb, var(--adopte) 12%, transparent); }
.tag-ch.ch-ko { color: var(--rejete); background: color-mix(in srgb, var(--rejete) 10%, transparent); }
.tag-ch.ch-inconnu { color: var(--ink-soft); border-style: dashed; background: transparent; }

/* ---- Liste d'élus : une seule ligne par nom (les cartes gardent toutes la même hauteur) ---- */
.grille-elus { grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); }
.grille-elus a { grid-template-columns: auto minmax(0, 1fr); min-width: 0; }
.grille-elus .nom, .grille-elus .sous { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.grille-elus .nom { font-size: 0.97rem; }

/* ---- Ordre d'affichage des noms : « Prénom Nom » (défaut) ou « Nom Prénom » ---- */
.np { display: inline-flex; gap: 0.3em; white-space: nowrap; }
html[data-ordre="nom-prenom"] .np-n { order: -1; text-transform: uppercase; font-size: 0.97em; letter-spacing: 0.01em; }

.ordre-nom { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; margin-left: 14px; }
.ordre-nom button { font: inherit; font-size: 0.78rem; padding: 3px 10px; color: var(--ink-soft); background: transparent; border: 0; cursor: pointer; white-space: nowrap; }
.ordre-nom button[aria-pressed="true"] { color: var(--ink); background: color-mix(in srgb, var(--ink) 12%, transparent); font-weight: 650; }
.ordre-nom button:hover { color: var(--ink); }
@media (max-width: 700px) { .ordre-nom { margin-left: 0; } }

/* =====================================================================================
   RESPONSIVE
   - Grandes largeurs : tableaux classiques, en-têtes triables.
   - <= 720 px (téléphone) : chaque ligne d'un tableau `.liste-textes` devient une CARTE
     (étiquette + valeur) pour éviter le défilement latéral ; le tri passe par deux listes.
   - Les autres tableaux restent défilables à l'intérieur de leur cadre (`.table-wrap`).
   ===================================================================================== */
.tri-mobile { display: none; }

@media (max-width: 720px) {
    .tri-mobile { display: inline-block; }

    .liste-textes, .liste-textes tbody, .liste-textes tr, .liste-textes td { display: block; width: auto; }
    .liste-textes thead { position: absolute; left: -9999px; }   /* masqué visuellement, conservé pour les lecteurs d'écran */
    .liste-textes tr { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; }
    .liste-textes td { border: 0; padding: 0; text-align: left; white-space: normal; }
    .liste-textes td:empty { display: none; }
    .liste-textes td[data-label]::before { content: attr(data-label); display: inline-block; min-width: 7.2em; margin-right: 6px; font-size: 0.76rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.03em; }
    .liste-textes td.num { text-align: left; }
    /* le titre passe en premier et sans étiquette */
    .liste-textes td.col-titre, .liste-textes td:not([data-label]) { order: -1; font-weight: 600; }
    .liste-textes td.col-titre a { text-decoration: none; }
    .liste-textes td.col-statut, .liste-textes td.col-date, .liste-textes td.col-liens { width: auto; }
    .liste-textes td.col-liens a { display: inline-block; margin-right: 12px; }

    /* formulaires et filtres : une colonne, champs pleine largeur, cibles tactiles confortables */
    .filtres { flex-direction: column; align-items: stretch; }
    .filtres .filtre, .filtres select, .filtres button { width: 100%; flex: none; min-height: 44px; }
    .case { min-height: 32px; }

    /* barres de puces (groupes, périodes) : défilement horizontal plutôt que 5 lignes de puces */
    .barre-groupes { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
    .puce { flex: none; min-height: 36px; }

    .chiffres { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .fiche-vote dl { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
    .jauge-legende .seuil { margin-left: 0; width: 100%; }
    .hemicycle-grand { padding: 8px 4px 0; }
    .bascule { flex-wrap: wrap; }
    .admin-nav { overflow-x: auto; flex-wrap: nowrap; }
    .admin-nav a, .admin-nav .deconnexion { flex: none; white-space: nowrap; }
    .pagination { flex-wrap: wrap; gap: 8px 14px; }
    .ligne-form { flex-direction: column; align-items: stretch; }
    .ligne-form .champ, .ligne-form .champ-court, .ligne-form .bouton { width: 100%; }
}

@media (max-width: 480px) {
    .wrap { padding: 0 12px; }
    .site-header .wrap { gap: 8px 12px; }
    .menu { margin-left: 0; width: 100%; justify-content: space-between; }
    .titre-page { margin-top: 20px; }
    .grille-elus { grid-template-columns: minmax(0, 1fr); }
}

/* Écrans tactiles : cibles de 44 px minimum pour les liens des listes */
@media (pointer: coarse) {
    .menu a, .export a, .pagination a { padding-top: 8px; padding-bottom: 8px; }
}
