/* =====================================================
   Mailing référents — Les Patriotes
   Palette : orange de marque, marine du logo,
   fond papier neutre, cartes blanches.
   ===================================================== */

:root {
  --orange: #f97316;
  --orange-fonce: #ea580c;
  --orange-pale: #fff3e8;
  --marine: #22304d;
  --texte: #1c1917;
  --discret: #78716c;
  --bordure: #e7e5e4;
  --fond: #faf9f7;
  --erreur: #b91c1c;
  --succes: #15803d;
  --rayon: 12px;
  --ombre: 0 1px 3px rgba(28, 25, 23, 0.07), 0 8px 24px rgba(28, 25, 23, 0.05);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

/* ---------- En-tête : le filet orange est la signature ---------- */

.entete {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 14px;
  padding: 14px 22px;
  background: #fff;
  border-bottom: 3px solid var(--orange);
}

.marque {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.2px;
  color: var(--marine);
}

.marque img {
  display: block;
  height: 34px;
  width: auto;
}

.marque .point {
  color: var(--orange);
}

.perimetre {
  margin-left: auto;
  padding: 4px 14px;
  background: var(--marine);
  color: #fff;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.inline { display: inline; margin: 0; }

/* ---------- Corps de page ---------- */

main {
  max-width: 680px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

/* Pages a tableau : on prend la largeur de l'ecran, sans depasser
   une limite au-dela de laquelle l'oeil perd la ligne. */
main.large { max-width: 1400px; }

h1 {
  font-size: 26px;
  font-weight: 750;
  letter-spacing: -0.4px;
  color: var(--marine);
  margin: 0 0 22px;
}

.carte {
  background: #fff;
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  padding: 24px;
  box-shadow: var(--ombre);
}

/* Apparition douce des blocs au chargement */
main > * {
  animation: apparition 0.4s ease-out both;
}
main > *:nth-child(2) { animation-delay: 0.05s; }
main > *:nth-child(3) { animation-delay: 0.1s; }
main > *:nth-child(4) { animation-delay: 0.15s; }

@keyframes apparition {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Formulaires ---------- */

label {
  display: block;
  margin: 20px 0 6px;
  font-size: 14px;
  font-weight: 650;
  color: var(--marine);
}

label:first-child { margin-top: 0; }

input[type="text"],
input[type="password"],
input[type="email"],
input[type="file"],
textarea,
select {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--bordure);
  border-radius: 9px;
  font-family: inherit;
  font-size: 16px;
  background: #fff;
  color: var(--texte);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea { resize: vertical; min-height: 220px; }

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.18);
}

/* ---------- Boutons ---------- */

button.principal {
  margin-top: 24px;
  width: 100%;
  padding: 13px 18px;
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: 9px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.1px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
  box-shadow: 0 2px 6px rgba(249, 115, 22, 0.35);
}

button.principal:hover {
  background: var(--orange-fonce);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4);
}

button.principal:active {
  transform: none;
  box-shadow: 0 1px 3px rgba(249, 115, 22, 0.3);
}

button.principal:focus-visible {
  outline: 3px solid var(--marine);
  outline-offset: 2px;
}

button.lien, a.lien {
  background: none;
  border: none;
  padding: 0;
  color: var(--orange-fonce);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border-bottom: 1.5px solid transparent;
  transition: border-color 0.15s ease;
  font-family: inherit;
}

button.lien:hover, a.lien:hover {
  border-bottom-color: var(--orange-fonce);
}

.lien.danger { color: var(--erreur); }
.lien.danger:hover { border-bottom-color: var(--erreur); }

/* ---------- Messages ---------- */

.info {
  padding: 13px 16px;
  background: var(--orange-pale);
  border: 1px solid #fed7aa;
  border-left: 4px solid var(--orange);
  border-radius: 9px;
  font-size: 15px;
  margin-bottom: 22px;
}

.aide { font-size: 13px; color: var(--discret); margin: 6px 0 0; }
.erreur { color: var(--erreur); font-weight: 500; }
.succes { color: var(--succes); font-weight: 500; }

/* ---------- Aperçu du message ---------- */

.apercu {
  border: 1px solid var(--bordure);
  border-radius: 9px;
  padding: 4px;
  background: var(--fond);
  max-height: 460px;
  overflow-y: auto;
}

/* ---------- Tableau d'administration ---------- */

.tableau { width: 100%; border-collapse: collapse; font-size: 15px; }

/* Sur une liste de 350 lignes, l'en-tete des colonnes reste visible
   au defilement.

   PIEGE DEJOUE : « position: sticky » colle au plus proche ancetre
   defilant. Or .zone-tableau porte overflow-x pour le defilement
   horizontal, ce qui en fait le conteneur de reference. La liste
   defile donc DANS sa zone, bornee a la hauteur d'ecran, en-tete
   fige — et la barre d'outils reste visible au-dessus. */
main.large .zone-tableau {
  max-height: 76vh;
  overflow: auto;
}

main.large .tableau thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  box-shadow: inset 0 -2px 0 var(--bordure);
}

.tableau th {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 2px solid var(--marine);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--marine);
}

.tableau td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--bordure);
  vertical-align: top;
}

.tableau tbody tr {
  transition: background 0.12s ease;
}

.tableau tbody tr:hover { background: var(--orange-pale); }

.tableau tr.inactif td { opacity: 0.45; }

/* ---------- Accessibilité ---------- */

/* ---------- Accessibilite : le focus se voit, toujours ---------- */

a:focus-visible,
button:focus-visible,
summary:focus-visible,
input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible,
.vignette:focus-visible,
.barre-ligne:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--marine);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  html { scroll-behavior: auto; }
}

@media (max-width: 480px) {
  main { padding: 22px 14px 48px; }
  .carte { padding: 18px; }
  h1 { font-size: 22px; }
}

/* ---------- Éditeur de message ---------- */

.barre-outils {
  display: flex;
  gap: 4px;
  padding: 6px;
  border: 1.5px solid var(--bordure);
  border-bottom: none;
  border-radius: 9px 9px 0 0;
  background: var(--fond);
}

.barre-outils button {
  width: 36px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  font-size: 15px;
  color: var(--marine);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.barre-outils button:hover {
  background: #fff;
  border-color: var(--bordure);
}

.barre-outils button:active {
  background: var(--orange-pale);
}

.editeur {
  min-height: 220px;
  padding: 12px 14px;
  border: 1.5px solid var(--bordure);
  border-radius: 0 0 9px 9px;
  background: #fff;
  font-size: 16px;
  line-height: 1.6;
  overflow-y: auto;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.editeur:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.18);
}

.editeur:empty::before {
  content: attr(data-placeholder);
  color: var(--discret);
  pointer-events: none;
}

.editeur p { margin: 0 0 12px; }

.barre-outils .separateur {
  width: 1px;
  background: var(--bordure);
  margin: 4px 4px;
}

.barre-outils #bouton-image {
  width: auto;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 600;
}

.editeur img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  display: block;
  margin: 8px 0;
}

.groupe-tailles { display: inline-flex; gap: 4px; align-items: stretch; }

.editeur img { cursor: pointer; transition: outline-color 0.12s ease; outline: 2px solid transparent; outline-offset: 2px; }

.editeur img.choisie { outline-color: var(--orange); }

.navigation { display: inline-flex; gap: 16px; margin-left: 18px; }

input[type="search"] {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--bordure);
  border-radius: 9px;
  font-family: inherit;
  font-size: 16px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="search"]:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.18);
}

tr.cliquable { cursor: pointer; }

.lien-ligne { color: inherit; text-decoration: none; }
.lien-ligne:hover strong { color: var(--orange-fonce); }

.fiche { width: 100%; border-collapse: collapse; font-size: 15px; }
.fiche th {
  text-align: left; width: 180px; padding: 9px 12px 9px 0;
  color: var(--discret); font-weight: 600; vertical-align: top;
  border-bottom: 1px solid var(--bordure);
}
.fiche td { padding: 9px 0; border-bottom: 1px solid var(--bordure); }

/* ---------- Statut d'adhésion : badges et filtres ---------- */

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.badge-ok { background: #e7f6ec; color: var(--succes); }
.badge-ko { background: #fdeaea; color: var(--erreur); }
.badge-neutre { background: var(--bordure); color: var(--discret); }

.filtres {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.filtres button {
  padding: 6px 14px;
  border: 1.5px solid var(--bordure);
  border-radius: 999px;
  background: #fff;
  color: var(--texte);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.filtres button:hover { border-color: var(--orange); }

.filtres button.actif {
  background: var(--marine);
  border-color: var(--marine);
  color: #fff;
}

.tri { font-size: 14px; white-space: nowrap; color: var(--discret); display: inline-flex; align-items: center; gap: 8px; }
.tri select {
  padding: 6px 10px; border: 1.5px solid var(--bordure); border-radius: 9px;
  font-family: inherit; font-size: 14px; background: #fff; color: var(--texte);
}

.badge-tiede { background: #fff2d8; color: #a15c07; }

/* ---------- Barre filtres + tri : deux blocs, une seule ligne ---------- */

.barre-liste {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  margin-top: 12px;
}

.barre-liste .filtres { margin-top: 0; }

/* ---------- Tableau des adhérents : largeurs maîtrisées ---------- */

/* Le nom est prioritaire, le badge ne se coupe jamais, et les
   colonnes secondaires cèdent en premier quand l'écran rétrécit. */
/* Les colonnes se designent par leur cle, pas par leur position :
   masquer une colonne ne doit pas decaler les regles de largeur. */
#table-adherents [data-cle="numero"],
#table-adherents [data-cle="codePostal"],
#table-adherents [data-cle="fin"] { white-space: nowrap; width: 1%; }
#table-adherents [data-cle="statut"] { width: 1%; white-space: nowrap; }
/* Aucune donnee ne se coupe en plein milieu : le tableau prend la
   largeur qu'il lui faut, et le conteneur defile s'il le faut. */
#table-adherents th,
#table-adherents td { white-space: nowrap; }
#table-adherents [data-cle="etiquettes"] {
  max-width: 26ch; overflow: hidden; text-overflow: ellipsis;
}
#table-adherents [data-cle="nom"] { white-space: normal; min-width: 15ch; }
#table-adherents [hidden] { display: none; }

/* ---------- En-têtes triables ---------- */

.tableau th.triable { cursor: pointer; user-select: none; white-space: nowrap; }
.tableau th.triable:hover { color: var(--orange-fonce); }
.tableau th.triable:focus-visible {
  outline: 2px solid var(--orange); outline-offset: 2px; border-radius: 4px;
}
.tableau th .fleche { margin-left: 5px; opacity: 0.5; font-size: 11px; }
.tableau th[data-tri="asc"] .fleche::after { content: "\2191"; }
.tableau th[data-tri="desc"] .fleche::after { content: "\2193"; }

/* ---------- Choix des colonnes ---------- */

.colonnes { position: relative; }

.colonnes summary {
  list-style: none;
  cursor: pointer;
  padding: 6px 14px;
  border: 1.5px solid var(--bordure);
  border-radius: 999px;
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.colonnes summary::-webkit-details-marker { display: none; }
.colonnes summary::after { content: " \25BE"; opacity: 0.6; }
.colonnes summary:hover { border-color: var(--orange); }
.colonnes[open] summary { border-color: var(--marine); }

.colonnes-menu {
  position: absolute;
  right: 0;
  z-index: 20;
  margin-top: 8px;
  min-width: 220px;
  padding: 12px 14px;
  background: #fff;
  border: 1.5px solid var(--bordure);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.colonnes-menu label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  cursor: pointer;
  margin: 0;
}

.colonnes-menu label.fige { opacity: 0.55; cursor: default; }
.colonnes-menu input { margin: 0; accent-color: var(--orange); }

.colonnes-menu button {
  margin-top: 4px;
  align-self: flex-start;
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  cursor: pointer;
}

/* ---------- Défilement horizontal du tableau ---------- */

/* Quand les colonnes choisies dépassent la largeur disponible, le
   tableau défile plutôt que de comprimer les données. L'ombre à
   droite signale qu'il reste quelque chose à voir. */
.zone-tableau {
  overflow-x: auto;
  margin-top: 14px;
  background:
    linear-gradient(to right, #fff 30%, rgba(255, 255, 255, 0)),
    linear-gradient(to right, rgba(255, 255, 255, 0), #fff 70%) 100% 0,
    radial-gradient(farthest-side at 0 50%, rgba(28, 25, 23, 0.12), transparent),
    radial-gradient(farthest-side at 100% 50%, rgba(28, 25, 23, 0.12), transparent) 100% 0;
  background-repeat: no-repeat;
  background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
  background-attachment: local, local, scroll, scroll;
}

/* La colonne du nom reste visible pendant le défilement : sans elle,
   on ne sait plus de qui parle la ligne qu'on lit. */
#table-adherents [data-cle="nom"] {
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 2;
}

#table-adherents tbody tr:hover [data-cle="nom"] { background: var(--orange-pale); }

/* ---------- Petits écrans : la carte cède ses marges au tableau ---------- */

@media (max-width: 760px) {
  main.large { padding-left: 10px; padding-right: 10px; }
  main.large .carte { padding: 16px 12px; }
  /* Le menu des colonnes s'ancre à droite de l'écran, pas hors champ. */
  .colonnes-menu { right: 0; left: auto; max-width: calc(100vw - 40px); }
  .barre-liste { gap: 10px 12px; }
  #table-adherents [data-cle="nom"] { min-width: 12ch; }
}

/* ---------- Correction des coordonnées ---------- */

.bouton-secondaire {
  display: inline-block;
  padding: 9px 18px;
  border: 1.5px solid var(--marine);
  border-radius: 9px;
  color: var(--marine);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.bouton-secondaire:hover { background: var(--marine); color: #fff; }

/* Un avertissement qui fait sortir un adhérent du périmètre doit se
   distinguer nettement d'une information ordinaire. */
.avertissement {
  background: #fff7ed;
  border-left: 4px solid var(--orange);
  border-radius: 0 9px 9px 0;
  padding: 14px 16px;
  margin: 0 0 18px;
}

/* ---------- Suggestions d'adresses ---------- */

.suggestions {
  list-style: none;
  margin: -10px 0 14px;
  padding: 4px;
  border: 1.5px solid var(--bordure);
  border-radius: var(--rayon);
  background: #fff;
  box-shadow: var(--ombre);
  max-height: 260px;
  overflow-y: auto;
}

.suggestions li {
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
}

.suggestions li:hover,
.suggestions li.survol { background: var(--orange-pale); }

/* ---------- Formulaire d'annonce d'événement ---------- */

.deux-colonnes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

@media (max-width: 560px) {
  .deux-colonnes { grid-template-columns: 1fr; }
}

label.case {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 500;
  margin: 6px 0 16px;
  cursor: pointer;
}

label.case input { margin: 0; accent-color: var(--orange); width: auto; }

textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--bordure);
  border-radius: 9px;
  font-family: inherit;
  font-size: 16px;
  resize: vertical;
}

textarea:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.18);
}

/* L'adresse est la colonne la plus longue : on la borne pour qu'elle
   ne repousse pas le statut d'adhésion hors de l'écran. */
#table-adherents [data-cle="rue"] {
  max-width: 30ch;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Scrutins ---------- */

.choix { border: none; padding: 0; margin: 0 0 16px; }
.choix legend { font-weight: 600; margin-bottom: 10px; padding: 0; }
.choix label.case { padding: 10px 12px; border: 1.5px solid var(--bordure); border-radius: 9px; margin: 0 0 8px; }
.choix label.case:hover { border-color: var(--orange); }
.choix input { accent-color: var(--orange); }

.bloc-code {
  background: var(--fond); border: 1.5px solid var(--bordure);
  border-radius: 9px; padding: 12px; overflow-x: auto;
  font-size: 13px; font-family: ui-monospace, Menlo, Consolas, monospace;
}

h2 { font-size: 19px; font-weight: 700; margin: 30px 0 12px; }

.barre-pv {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

/* Le procès-verbal est fait pour être imprimé ou enregistré en PDF
   depuis le navigateur. Générer le PDF côté serveur exigerait
   d'embarquer un navigateur sans interface : plusieurs centaines de
   mégaoctets et une dépendance lourde, pour le même résultat. */
@media print {
  @page { margin: 15mm; }

  .entete, .pas-impression, .navigation { display: none !important; }
  main.large .zone-tableau { max-height: none; overflow: visible; }
  main, main.large { max-width: none; padding: 0; }
  body { background: #fff; font-size: 12pt; }

  .carte {
    box-shadow: none;
    border: 1px solid #ccc;
    /* Une carte ne doit pas être coupée en deux par un saut de page :
       un tableau de votes à cheval sur deux feuilles se relit mal. */
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 12px;
  }

  h1 { font-size: 20pt; }
  h2 { font-size: 14pt; break-after: avoid; page-break-after: avoid; }

  /* Les en-têtes de tableau se répètent en haut de chaque page. */
  thead { display: table-header-group; }
  tr { break-inside: avoid; page-break-inside: avoid; }

  /* Sans cela, les navigateurs suppriment les fonds à l'impression
     et un badge « ALTÉRÉ » deviendrait invisible sur le papier. */
  .badge {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    border: 1px solid currentColor;
  }

  .avertissement {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    border-left: 4px solid #999;
  }

  a { text-decoration: none; color: inherit; }
}

/* Le signalement de décès est séparé du reste et volontairement
   discret : il doit être trouvable sans être proposé. */
.lien.discret { color: var(--discret); font-size: 14px; }
.lien.discret:hover { color: var(--erreur); }

/* ---------- Documents soumis au vote ---------- */

.documents { list-style: none; padding: 0; margin: 0; }
.documents li { padding: 10px 0; border-bottom: 1px solid var(--bordure); }
.documents li:last-child { border-bottom: none; }
.documents .aide { margin-left: 8px; }

.empreinte {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 11px;
  word-break: break-all;
  margin-left: 0;
}


.documents-joints { list-style: none; padding: 0; margin: 8px 0 0; }
.documents-joints li { font-size: 14px; padding: 3px 0; }

.ajout-document { margin-top: 8px; }

.ajout-document summary {
  list-style: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--discret);
  display: inline-block;
}
.ajout-document summary::-webkit-details-marker { display: none; }
.ajout-document summary::before { content: "+ "; font-weight: 700; }
.ajout-document summary:hover { color: var(--orange-fonce); }

.joindre {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.joindre input[type="file"] { font-size: 12px; max-width: 220px; }

/* ---------- Sélecteur de segment ---------- */

.filtre-segment { margin-bottom: 8px; }

.liste-segments {
  width: 100%;
  padding: 6px;
  border: 1.5px solid var(--bordure);
  border-radius: 9px;
  font-family: inherit;
  font-size: 15px;
  background: #fff;
}

.liste-segments option { padding: 6px 8px; border-radius: 6px; }
.liste-segments:focus { outline: none; border-color: var(--orange); }

/* ---------- Ciblage des destinataires ---------- */

.ciblage { margin-bottom: 18px; }
.ciblage .case { display: flex; align-items: flex-start; gap: 10px; }
.ciblage .case .aide { display: block; margin-top: 2px; }

/* ---------- Sélection de destinataires ---------- */

/* La cellule ENTIERE est cliquable (pas seulement la case) : la
   surface de visee passe d'environ 16 px a toute la cellule. */
th.selection, td.selection { width: 46px; text-align: center; padding-left: 10px; }
td.selection { cursor: pointer; }
td.selection input, th.selection input {
  accent-color: var(--orange);
  cursor: pointer;
  width: 19px;
  height: 19px;
  vertical-align: middle;
}

/* Mode selection : le clic sur une LIGNE coche au lieu d'ouvrir la
   fiche. L'etat doit se voir d'un coup d'oeil. */
#table-adherents.mode-selection tr.cliquable { cursor: cell; }
#table-adherents.mode-selection { user-select: none; }
#table-adherents tr.selectionnee td { background: color-mix(in srgb, var(--orange) 12%, transparent); }
#mode-selection[aria-pressed="true"] {
  background: var(--orange);
  color: #fff;
  border-color: var(--orange);
}

.barre-selection {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 12px 0 0;
  padding: 12px 14px;
  border: 1.5px solid var(--orange);
  border-radius: 10px;
  background: var(--fond);
  /* Reste visible pendant qu'on fait defiler une longue liste :
     c'est elle qui porte le compte et le bouton d'envoi. */
  position: sticky;
  bottom: 10px;
  z-index: 5;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
.barre-selection #compte-selection { font-weight: 600; }

/* ==========================================================
   Tableau de bord du périmètre
   ==========================================================
   Aucune bibliothèque de graphiques : les barres sont des blocs
   dimensionnés en pourcentage. La politique de sécurité est en
   'self', et une dépendance pour dessiner des rectangles serait à
   maintenir sans bénéfice.
   ========================================================== */

.tableau-bord {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.bloc-bord {
  background: #fff;
  border: 1.5px solid var(--bordure);
  border-radius: 12px;
  padding: 18px;
}
.bloc-bord h2 { margin: 0 0 12px; font-size: 17px; }
.bloc-bord .aide { margin: 8px 0 0; }

/* ---------- Vignettes chiffrées ---------- */

.vignettes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin: 14px 0 0;
}

.vignette {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 10px;
  border: 1.5px solid var(--bordure);
  border-radius: 10px;
  background: var(--fond);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .12s, transform .12s;
}
.vignette:hover:not(:disabled) { border-color: var(--orange); transform: translateY(-1px); }
.vignette:disabled { opacity: .45; cursor: default; }
.vignette.actif { border-color: var(--orange); background: #fff; box-shadow: inset 0 0 0 1px var(--orange); }

.vignette-valeur { font-size: 26px; font-weight: 700; line-height: 1.1; }
.vignette-libelle { font-size: 12.5px; color: var(--discret); }

/* Un ton pour l'urgence, pas une alerte : ces adhérents ne sont pas
   encore perdus, c'est précisément l'intérêt de les voir. */
.vignette.urgent .vignette-valeur { color: var(--orange-fonce, #c2410c); }
.vignette.attention .vignette-valeur { color: #92400e; }

/* ---------- Barres de répartition ---------- */

.barres { list-style: none; padding: 0; margin: 14px 0 0; }
.barres li { margin-bottom: 6px; }

.barre-ligne {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) 2fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 8px;
  border: 1.5px solid transparent;
  border-radius: 8px;
  background: none;
  font-family: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.barre-ligne:hover { border-color: var(--bordure); background: var(--fond); }
.barre-ligne.actif { border-color: var(--orange); background: var(--fond); }

.barre-nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barre-piste { height: 9px; border-radius: 5px; background: var(--bordure); overflow: hidden; }
.barre-remplie { display: block; height: 100%; border-radius: 5px; background: var(--orange); }
.barre-valeur { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Sur un téléphone, la barre passe sous le nom plutôt que de
   comprimer les trois colonnes jusqu'à l'illisible. */
@media (max-width: 560px) {
  .barre-ligne { grid-template-columns: 1fr auto; }
  .barre-piste { grid-column: 1 / -1; order: 3; }
}

@media print {
  .tableau-bord { display: none; }
}

/* ---------- Repli des blocs du tableau de bord ---------- */

.bloc-bord > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.bloc-bord > summary::-webkit-details-marker { display: none; }

.bloc-titre { font-size: 17px; font-weight: 700; }
.bloc-titre::before {
  content: "▾ ";
  color: var(--discret);
  font-size: 13px;
}
.bloc-bord:not([open]) .bloc-titre::before { content: "▸ "; }

/* Le résumé porte le chiffre essentiel : replier fait perdre le
   détail, jamais l'information qui déclenche l'action. */
.bloc-resume { font-size: 13.5px; color: var(--discret); }

.bloc-bord > summary:hover .bloc-titre { color: var(--orange-fonce, #c2410c); }

/* Un filtre issu d'un bloc replié doit rester visible : sinon la
   liste apparaît filtrée sans raison apparente. */
.bloc-bord.filtre-actif { border-color: var(--orange); }
.bloc-bord.filtre-actif:not([open]) .bloc-resume::after {
  content: " · filtre actif";
  color: var(--orange-fonce, #c2410c);
  font-weight: 600;
}

/* ---------- Sous-navigation de l'administration ---------- */

.sous-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.sous-nav a {
  padding: 7px 14px;
  border: 1.5px solid var(--bordure);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--texte);
  text-decoration: none;
}
.sous-nav a:hover { border-color: var(--orange); }
.sous-nav a.actif {
  background: var(--marine);
  border-color: var(--marine);
  color: #fff;
}

/* ---------- Panneaux d'affichage libre ---------- */

.suggestions { list-style: none; margin: 4px 0 0; padding: 0; border: 1.5px solid var(--bordure); border-radius: 8px; background: #fff; }
.suggestions li { padding: 6px 10px; border-bottom: 1px solid var(--bordure); }
.suggestions li:last-child { border-bottom: 0; }
.popup-panneau { font-family: inherit; font-size: 14px; }
.popup-panneau .inline { display: inline; }
.popup-panneau input[type="text"] { width: 100%; margin: 6px 0; }
.notes-panneau { list-style: none; padding: 0; margin: 8px 0; max-height: 160px; overflow: auto; }
.notes-panneau li { padding: 4px 0; border-top: 1px solid var(--bordure); }
.leaflet-container { font-family: inherit; }

/* ---------- Fiche personne ---------- */
label.module { display: block; font-size: 15px; cursor: pointer; }
label.module input { margin-right: 8px; accent-color: var(--orange); }

/* ---------- Menu a gauche (comme la besace v1), 09/10/2026 ---------- */
body.avec-menu { display: flex; flex-wrap: wrap; min-height: 100vh; }
body.avec-menu > main { flex: 999 1 560px; min-width: 0; margin: 0; }
.menu-gauche {
  flex: 1 1 240px;
  max-width: 280px;
  background: var(--marine);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 0 18px;
}
.menu-gauche .marque {
  background: var(--orange);
  color: var(--marine);
  padding: 14px 18px;
  text-decoration: none;
  line-height: 1.2;
  flex-wrap: wrap;
  gap: 2px 8px;
}
.menu-gauche .perimetre { margin: 0 18px; align-self: flex-start; background: #fff; color: var(--marine); }
.menu-gauche .navigation { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0 10px; }
.lien-menu {
  display: block;
  padding: 11px 12px;
  border-radius: 8px;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  background: none;
  border: 0;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  width: 100%;
}
.lien-menu:hover { background: rgba(255, 255, 255, 0.1); }
.lien-menu[aria-current="page"] { background: var(--orange); color: var(--marine); }
.menu-bas { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid rgba(255, 255, 255, 0.15); }
.menu-bas .lien-menu { font-weight: 400; font-size: 14px; color: #d6deea; }
@media (max-width: 820px) {
  body.avec-menu { flex-direction: column; flex-wrap: nowrap; }
  body.avec-menu > main { flex: 1 1 auto; }
  .menu-gauche { max-width: none; flex: 0 0 auto; }
  .menu-gauche .navigation { flex-direction: row; flex-wrap: wrap; }
  .menu-gauche .navigation .lien-menu { width: auto; }
}
@media print { .menu-gauche { display: none !important; } }
