/* Atlas des territoires : compléments à ../style.css. */
.ariane-fiche { font-size: var(--taille-1); color: var(--text-secondary); margin: -4px 0 10px; }
.ariane-fiche button { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font: inherit; }
.classement tr.courant td { font-weight: 650; }
.classement td.num:first-child { color: var(--text-muted); width: 2.5em; }
.classement button { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font: inherit; text-align: left; }

/* Volet élections */
.choix {
  width: 100%; font: inherit; color: var(--text-primary); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px;
}
.res .pastille { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }
.participation { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: var(--taille-1); color: var(--text-secondary); margin: 0 0 14px; font-variant-numeric: tabular-nums; }
.participation b { color: var(--text-primary); font-weight: 650; }
.elu { display: inline-block; font-size: var(--taille-1); font-weight: 650; text-transform: uppercase; letter-spacing: .04em;
       color: var(--surface-1); background: var(--text-primary); border-radius: 4px; padding: 1px 5px; margin-left: 6px; vertical-align: 1px; }
.res { list-style: none; margin: 0 0 16px; padding: 0; }
.bureau-commune { border-bottom: 1px solid var(--border); padding: 4px 0; }
.bureau-commune summary { cursor: pointer; }
.bureau-commune .note { margin-left: 6px; }
.res li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.res .qui { min-width: 0; }
.res .nom { font-weight: 600; }
.res .parti { font-size: var(--taille-1); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res .pct { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.res .voix { text-align: right; font-size: var(--taille-1); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.res .barre { grid-column: 1 / -1; height: 6px; background: var(--hors-zone); border-radius: 3px; overflow: hidden; }
.res .barre span { display: block; height: 100%; border-radius: 0 3px 3px 0; }
.res .autres { color: var(--text-muted); font-size: var(--taille-1); }
.barre-temps[hidden] { display: none; }
.estimation { color: var(--text-primary); }
.legende .unite.estimation { font-weight: 650; }
.avert.estimation { font-size: var(--taille-1); }
/* Carte d'une autre année que le vote : avertissement gardé dans la légende repliée (mobile) */
.legende .unite.contours { color: var(--text-primary); background: var(--accent-soft); border-radius: 4px; padding: 3px 6px; }
.legende.repliee .unite.contours { display: block; margin: 5px 0 0; }


/* Fiche électorale : historique du territoire (chargé à l'ouverture) */
.historique-terr { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 6px 0 12px; }
.historique-terr summary { cursor: pointer; padding: 9px 2px; font-weight: 600; font-size: var(--taille-2); color: var(--text-secondary); }
.historique { width: 100%; border-collapse: collapse; font-size: var(--taille-1); margin: 2px 0 6px; }
.historique td { padding: 5px 2px; border-bottom: 1px solid var(--border); }
.historique td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.historique td.marge { color: var(--text-muted); }
.historique tr.courant td { background: var(--accent-soft); font-weight: 600; }
.historique button { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font: inherit; text-align: left; }
.historique .pastille { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }

/* Choix du scrutin : série (puces), année (frise), variante ou tour (segments) */
.choix-scrutin { display: flex; flex-direction: column; gap: 8px; }
.choix-scrutin .series { gap: 5px; }
.choix-scrutin .annees-scrutin { margin: 2px 0; }
.choix-scrutin .variantes button { font-size: var(--taille-1); padding: 5px 8px; white-space: normal; line-height: 1.25; }
.choix-scrutin .note { margin: 0; }
.choix-scrutin .segmented.pleine { width: 100%; }
.choix-scrutin .segmented.pleine button { flex: 1; }

/* Nuage socio-électoral (volet élections, onglet « Nuage ») */
.choix-nuage { display: flex; flex-direction: column; gap: 4px; font-size: var(--taille-1); color: var(--text-secondary); margin-bottom: 8px; }
.cadre-nuage { position: relative; margin: 4px 0 6px; }
.cadre-nuage canvas { display: block; cursor: crosshair; }
#nuage-bulle { position: absolute; pointer-events: none; max-width: 170px; z-index: 2; }

/* Pression prolongée sur la carte (ouvre une zone) : pas de menu ni de sélection du navigateur */
#carte canvas { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }

/* Député en exercice (fiche des circonscriptions de France) */
.depute .nom { font-size: var(--taille-4); font-weight: 600; }
.depute .groupe { display: flex; align-items: center; gap: 6px; margin: 2px 0 4px; font-size: var(--taille-2); }
.proximite summary { cursor: pointer; font-size: var(--taille-2); color: var(--text-secondary); margin: 6px 0; }
.solennels { list-style: none; padding: 0; margin: 4px 0 8px; display: flex; flex-direction: column; gap: 8px; }
.solennels li { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; align-items: start; font-size: var(--taille-2); }
.solennels li .note { grid-column: 2; margin: 0; }
.badge-val.position-P { background: var(--accent-soft); color: var(--accent); }
.badge-val.position-C { color: var(--text-primary); }
.badge-val.position-absent, .badge-val.position-N { color: var(--text-muted); }
.anciens { list-style: none; padding: 0; margin: 4px 0 8px; display: flex; flex-direction: column; gap: 8px; font-size: var(--taille-2); }
.anciens .legislature { font-weight: 600; margin-bottom: 2px; }
.anciens .mandat { display: grid; grid-template-columns: auto 1fr; column-gap: 6px; align-items: baseline; }
.anciens .sigle { color: var(--text-muted); }
.anciens .mandat > .note { grid-column: 2; margin: 0; }
.anciens .pastille, .depute .pastille { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }

/* Fiche portrait d'une personne (France : candidats aux législatives, députés) */
.lien-personne { all: unset; cursor: pointer; color: inherit; text-decoration: underline; text-decoration-color: var(--border);
  text-underline-offset: 2px; }
.lien-personne:hover, .lien-personne:focus-visible { color: var(--accent); text-decoration-color: currentColor; }
.lien-personne:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.retour-portrait, .lien-scrutin { all: unset; cursor: pointer; color: var(--accent); font-size: var(--taille-2); }
.retour-portrait:hover, .lien-scrutin:hover { text-decoration: underline; }
.retour-portrait:focus-visible, .lien-scrutin:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.portrait-tete { display: flex; gap: 12px; align-items: center; margin: 10px 0 8px; }
.portrait-av { flex: none; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  font-weight: 700; font-size: var(--taille-5); background: var(--grp); }
.portrait-role { font-size: var(--taille-1); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.portrait-nom { margin: 2px 0 0; font-size: var(--taille-5); line-height: 1.15; }
.portrait-puces { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.portrait-puces .puce { display: inline-flex; align-items: center; gap: 6px; font-size: var(--taille-1); border: 1px solid var(--border);
  border-radius: 4px; padding: 3px 7px; }
.portrait-puces .pastille, .portrait-elections .pastille { display: inline-block; width: 10px; height: 10px; border-radius: 3px;
  margin-right: 6px; vertical-align: -1px; }
.portrait-puces .puce .pastille { margin-right: 0; }
.portrait-reperes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 6px; }
.portrait-reperes > div { background: var(--surface-0); border-radius: 6px; padding: 8px 10px; display: grid; gap: 1px; min-width: 0; }
.portrait-reperes > .large { grid-column: 1 / -1; }
.portrait-reperes small { font-size: var(--taille-1); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.portrait-reperes b { font-size: var(--taille-4); line-height: 1.25; overflow-wrap: anywhere; }
.portrait-reperes em { font-style: normal; font-size: var(--taille-1); color: var(--text-secondary); }
.portrait-elections { list-style: none; padding: 0; margin: 4px 0 8px; display: flex; flex-direction: column; gap: 12px; font-size: var(--taille-2); }
.portrait-elections .entete { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.portrait-elections .issue { font-size: var(--taille-1); color: var(--text-muted); white-space: nowrap; }
.portrait-elections .note { margin: 2px 0; }
.portrait-elections .tour { display: grid; grid-template-columns: 52px 1fr 48px; gap: 6px; align-items: center; margin-top: 3px; }
.portrait-elections .tour .lib { font-size: var(--taille-1); color: var(--text-muted); }
.portrait-elections .tour .barre { height: 8px; background: var(--hors-zone); border-radius: 2px; overflow: hidden; display: block; }
.portrait-elections .tour .barre span { display: block; height: 100%; }
.portrait-elections .tour .pct { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* Comparaison de deux cartes (comparaison.js), en mode plein écran (body.plein) : l'en-tête et les volets de l'atlas
   laissent la place à la barre du mode et aux deux cartes ; fiche flottante, seulement avec un territoire choisi */
.barre-mode, .carte-b, body:not(.plein) .choix-a, .fermer-fiche-mode { display: none; }
body.plein .topbar, body.plein .barre-choix, body.plein .barre-temps, body.plein #panneau-gauche { display: none; }
body.plein .barre-mode {
  display: flex; align-items: center; gap: 12px; padding: 8px 16px; background: var(--surface-1); border-bottom: 1px solid var(--border);
  padding-top: max(8px, env(safe-area-inset-top));
}
.barre-mode h2 { flex: 1; min-width: 0; margin: 0; font-size: var(--taille-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barre-mode .btn-ghost { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 6px; color: var(--text-primary); }
.barre-mode .btn-ghost svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.barre-mode .lien-b { padding-left: 8px; }
.barre-mode .lien-b[aria-pressed="true"] { background: var(--accent-soft); border-color: transparent; }
.barre-mode .lien-b[aria-pressed="false"] { color: var(--text-muted); }
body.plein .layout { grid-template-columns: minmax(0, 1fr); position: relative; }
body.plein #carte { min-width: 0; }
body.plein .carte-b { display: flex; flex: 1; min-width: 0; position: relative; border-left: 2px solid var(--border); }
body.plein .choix-a { display: flex; }
#carte-b { flex: 1; background: var(--surface-1); }
#carte-b canvas { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
/* Bandeau de choix de chaque carte, en haut à gauche de la sienne */
.choix-b {
  position: absolute; top: 8px; left: 8px; z-index: 4; max-width: calc(100% - 60px); display: flex; flex-wrap: wrap;
  align-items: center; gap: 6px; padding: 6px 34px 6px 6px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: 0 2px 8px rgb(0 0 0 / .08); font-size: var(--taille-2);
}
.choix-a { max-width: calc(50% - 60px); }
.pastille-carte { flex: none; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--accent);
  color: #fff; font-size: var(--taille-1); font-weight: 700; }
.choix-b:not(.choix-a) .pastille-carte { background: var(--second); }
.choix-b select { font: inherit; max-width: 230px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface-1); color: var(--text-primary); }
.choix-b .segmented { flex: none; flex-wrap: nowrap; width: auto; }
.choix-b .segmented button { padding: 4px 9px; font-size: var(--taille-2); flex: none; }
.selecteurs-b { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.choix-b .replier { position: absolute; top: 8px; right: 5px; width: 22px; height: 22px; border: 0; border-radius: 5px; background: none;
  color: var(--text-muted); cursor: pointer; font-size: var(--taille-1); line-height: 1; }
.choix-b .replier:hover { background: var(--accent-soft); color: var(--text-primary); }
/* Replié : ce que montre la carte, en une ligne ; un clic le déplie */
.resume-b { display: none; border: 0; background: none; padding: 2px 4px; font: inherit; font-weight: 600; color: var(--text-primary);
  cursor: pointer; text-align: left; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.choix-b.repliee .selecteurs-b { display: none; }
.choix-b.repliee .resume-b { display: block; flex: 1; }
body.plein #legende { right: calc(50% + 12px); }
body.plein #ariane { top: 56px; max-width: calc(50% - 70px); }
body.plein .carte-cadre > .fonds { z-index: 6; }
@media (min-width: 901px) {
  /* Fiche flottante sur la seconde carte, sous son bandeau, à gauche des boutons de la carte */
  body.plein #panneau-droit {
    position: absolute; z-index: 7; top: 104px; right: 52px; width: clamp(300px, calc(50% - 310px), 400px); max-height: calc(100% - 150px);
    border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 28px rgb(0 0 0 / .16); padding-top: 10px;
  }
  body.plein:not(.avec-sel) #panneau-droit { display: none; }
  body.plein #legende-b { right: auto; left: 12px; }   /* à gauche de la seconde carte : la fiche flotte à droite */
  body.plein .fermer-fiche-mode { display: block; position: sticky; top: 0; float: right; z-index: 2; margin: -2px -6px 0 8px;
    width: 30px; height: 30px; font-size: var(--taille-2); border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; }
}
@media (max-width: 900px) {
  /* L'une au-dessus de l'autre ; la fiche en feuille en bas, seulement avec un territoire choisi */
  body.plein:not(.avec-sel) { --apercu: 0px; }
  body.plein:not(.avec-sel) #panneau-droit { display: none; }
  body.plein .barre-mode { gap: 8px; padding: 6px 12px; padding-top: max(6px, env(safe-area-inset-top)); }
  .barre-mode h2 { font-size: var(--taille-4); }
  .barre-mode .lien-b span { display: none; }   /* icône seule ; son état se lit à sa couleur */
  body.plein .carte-cadre { flex-direction: column; }
  body.plein .carte-b { border-left: 0; border-top: 2px solid var(--border); margin-bottom: var(--apercu, 168px); }
  body.plein #legende { right: 10px; bottom: calc(50% + var(--apercu, 168px) / 2 + 8px); }
  #legende-b { bottom: 10px; }
  body.plein #carte .maplibregl-ctrl-bottom-right, #carte-b .maplibregl-ctrl-bottom-right { bottom: 0; }
  .choix-b, .choix-a { right: 52px; max-width: none; gap: 4px; padding: 4px 30px 4px 4px; font-size: var(--taille-1); }
  .selecteurs-b { flex: 1 1 0; flex-wrap: nowrap; gap: 4px; }
  .choix-b select { flex: 1; min-width: 0; max-width: none; min-height: 30px; padding: 2px 4px; }
  .choix-b .segmented button { padding: 3px 6px; font-size: var(--taille-1); min-height: 30px; }
  .choix-b .replier { top: 7px; }
  body.plein #ariane { top: 48px; max-width: calc(100% - 70px); }
}

/* Comparaison de deux territoires (fiche.js, scrutins.js) : le premier en bleu (accent), le second en orange */
:root { --second: #eb6834; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --second: #f0844f; } }
:root[data-theme="dark"] { --second: #f0844f; }
.tete-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 2px 0 6px; }
.duo-terr { display: flex; gap: 8px; align-items: flex-start; min-width: 0; }
.duo-terr .pastille-duo { flex: none; width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; background: var(--accent); }
.duo-terr.b .pastille-duo { background: var(--second); }
.duo-nom { font-size: var(--taille-4); font-weight: 650; line-height: 1.2; overflow-wrap: anywhere; }
.duo-valeurs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.duo-val .hero { font-size: var(--taille-6); }
.duo-val.a .hero { color: var(--accent); }
.duo-val.b .hero { color: var(--second); }
.position .autre { fill: var(--second); stroke: var(--surface-1); stroke-width: 2; }
.legende-courbe i.l-autre { background: var(--second); width: 8px; height: 8px; border-radius: 50%; }
.courbe .s-autre { stroke: var(--second); }
.courbe circle.s-autre { fill: var(--second); stroke: var(--surface-1); }
.legende-courbe i.s-autre { background: var(--second); }
.mini-pos i.autre { background: var(--second); }
.tous.duo th { font-size: var(--taille-1); font-weight: 600; color: var(--text-secondary); padding: 4px 2px; text-align: left; }
.tous.duo th.num { text-align: right; }
.tous.duo th.a { color: var(--accent); }
.tous.duo th.b { color: var(--second); }
.duo-barres { list-style: none; padding: 0; margin: 4px 0 10px; display: flex; flex-direction: column; gap: 8px; font-size: var(--taille-2); }
.duo-barres li { display: grid; grid-template-columns: minmax(0, 1fr) 56px; gap: 2px 8px; align-items: center; }
.duo-barres .nom { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; min-width: 0; }
.duo-barres .pastille { flex: none; width: 10px; height: 10px; border-radius: 3px; }
.barre-duo { display: grid; grid-template-columns: 1fr 52px; gap: 6px; align-items: center; grid-column: 1; }
.barre-duo span { display: block; height: 8px; border-radius: 2px; }
.barre-duo.b span { opacity: .55; background-image: repeating-linear-gradient(45deg, transparent 0 3px, rgb(255 255 255 / .5) 3px 5px) !important; }
.barre-duo { background: none; }
.barre-duo b { font-variant-numeric: tabular-nums; text-align: right; font-weight: 600; }
.barre-duo.a b { color: var(--accent); }
.barre-duo.b b { color: var(--second); }
.duo-barres .ecart { grid-column: 2; grid-row: 2 / span 2; text-align: right; white-space: nowrap; font-size: var(--taille-1); color: var(--text-muted); font-variant-numeric: tabular-nums; }
/* Fiche d'une carte à l'autre : un bloc par carte (indicateur et scrutin, deux indicateurs) */
.duo-blocs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 4px; }
.duo-blocs > div { min-width: 0; }
.duo-blocs .hero { font-size: var(--taille-5); }
.duo-blocs > .a .hero { color: var(--accent); }
.duo-blocs > .b .hero { color: var(--second); }
.duo-blocs .participation { flex-direction: column; gap: 2px; }
.duo-barres.seul li { grid-template-columns: minmax(0, 1fr); }
/* Page d'un parti (parti.js) : panneau de droite élargi, à onglets */
@media (min-width: 901px) { body.mode-parti .layout { grid-template-columns: 280px 1fr 520px; } }
.liens-parti { font-size: var(--taille-1); color: var(--text-muted); margin-top: 1px; }
.lien-parti, .lien-terr { all: unset; cursor: pointer; color: var(--accent); }
.lien-parti:hover, .lien-terr:hover { text-decoration: underline; }
.lien-parti:focus-visible, .lien-terr:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.parti-tete { display: flex; gap: 12px; align-items: center; margin: 10px 0 6px; }
.parti-av { flex: none; min-width: 48px; height: 48px; padding: 0 6px; box-sizing: border-box; border-radius: 24px; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: var(--taille-3); }
.parti-etiquette { font-size: var(--taille-2); background: var(--surface-0); border-radius: 8px; padding: 8px 10px; margin: 6px 0 10px; }
.onglets-parti { display: flex; flex-wrap: wrap; gap: 2px 16px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.onglets-parti button { border: 0; background: none; padding: 8px 2px; font: inherit; font-size: var(--taille-3); color: var(--text-secondary);
  border-bottom: 2px solid transparent; cursor: pointer; }
.onglets-parti button[aria-selected="true"] { color: var(--text-primary); font-weight: 600; border-bottom-color: var(--accent); }
.parti-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 6px 0 12px; }
.parti-kpis.quatre { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.parti-kpis.deux { grid-template-columns: minmax(0, 1fr); }
.parti-kpis > div { background: var(--surface-0); border-radius: 8px; padding: 8px 10px; display: grid; gap: 1px; min-width: 0; }
.parti-kpis small { font-size: var(--taille-1); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.parti-kpis b { font-size: var(--taille-5); line-height: 1.2; font-variant-numeric: tabular-nums; }
.parti-kpis em { font-style: normal; font-size: var(--taille-1); color: var(--text-secondary); overflow-wrap: anywhere; }
.parti-hemi { position: relative; display: flex; height: 16px; border-radius: 3px; overflow: hidden; margin: 4px 0; }
.parti-hemi i { position: absolute; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; background: var(--text-primary); }
.parti-scores, .parti-terr, .parti-prox { list-style: none; padding: 0; margin: 4px 0 8px; font-size: var(--taille-2); }
.parti-scores li { display: grid; grid-template-columns: minmax(0, 1fr) 90px 52px 52px; gap: 2px 8px; align-items: center; padding: 6px 0;
  border-bottom: 1px solid var(--border); }
.parti-scores li > .note:first-of-type { grid-column: 1; grid-row: 2; }
.parti-scores .barre, .parti-prox .barre { display: block; height: 8px; background: var(--hors-zone); border-radius: 2px; overflow: hidden; }
.parti-scores .barre span, .parti-prox .barre span { display: block; height: 100%; background: var(--c, var(--accent)); }
.parti-scores .barre span.alliance { background: repeating-linear-gradient(90deg, var(--c) 0 6px, color-mix(in srgb, var(--c) 35%, transparent) 6px 9px); }
.parti-scores b, .parti-prox b { text-align: right; font-variant-numeric: tabular-nums; }
.parti-scores li > .note:last-child { text-align: right; }
.parti-id { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 4px 10px; font-size: var(--taille-2); margin: 4px 0 10px; }
.parti-id dt { color: var(--text-muted); }
.parti-id dd { margin: 0; }
.parti-courbe { width: 100%; height: auto; display: block; }
.parti-courbe .grille { stroke: var(--border); }
.parti-courbe .axe { fill: var(--text-muted); font-size: var(--taille-1); }
.parti-courbe circle { cursor: pointer; }
.legende-courbe i.pointille { background: none; border-top: 2px dashed var(--text-secondary); height: 0; }
.parti-deux { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.parti-terr li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.parti-terr b { font-variant-numeric: tabular-nums; }
.parti-prox li { display: grid; grid-template-columns: 110px minmax(0, 1fr) 52px; gap: 8px; align-items: center; padding: 3px 0; }
.parti-prox li > :first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.parti-elus td, .parti-votes td { vertical-align: top; }
.parti-elus th { text-align: left; font-size: var(--taille-1); font-weight: 600; color: var(--text-secondary); padding: 4px 2px; }
.parti-elus th.num { text-align: right; }
.parti-votes .an { display: block; margin: 2px 0 0; }
.parti-votes td.pos { text-align: right; white-space: nowrap; font-weight: 600; font-size: var(--taille-1); }
.parti-votes .pos-P { color: #1baf7a; }
.parti-votes .pos-C { color: #e34948; }
.parti-votes .pos-A { color: var(--text-secondary); }
.profil-prox li { grid-template-columns: minmax(0, 1fr) 120px 44px; }
.parti-terr li .note { margin-left: auto; margin-right: 8px; }
/* Démarrage interrompu (main.js, erreurDemarrage) : message centré et bouton pour réessayer */
.erreur-demarrage { position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 16px; padding: 16px; background: var(--surface-0); color: var(--text-primary);
  font-size: var(--taille-4); line-height: 1.5; text-align: center; }
.erreur-demarrage p { max-width: 520px; margin: 0; }
.erreur-demarrage button { padding: 8px 18px; border: 1px solid var(--border); border-radius: 6px; background: var(--accent);
  color: #fff; font: inherit; cursor: pointer; }

/* Comparateur de territoires (comparateur.js) : page plein écran au-dessus de l'atlas, tableau d'une colonne par
   territoire (pastille de couleur), référence en dernière colonne */
.page-mode {
  position: fixed; inset: 0; z-index: 45; display: flex; flex-direction: column; background: var(--surface-0);
  --c0: var(--accent); --c1: var(--second, #eb6834); --c2: #1baf7a; --c3: #8a63d2; --c4: #d55181;
}
.page-mode[hidden] { display: none; }
body.page-ouverte { overflow: hidden; }
.page-mode .barre-mode {
  display: flex; align-items: center; gap: 12px; padding: 8px 16px; background: var(--surface-1); border-bottom: 1px solid var(--border);
  padding-top: max(8px, env(safe-area-inset-top));
}
.page-mode-corps { flex: 1; overflow: auto; padding: 16px max(16px, calc((100% - 1200px) / 2)) 32px; }
.cmp-choix { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cmp-terr { display: contents; list-style: none; }
.cmp-puce { display: inline-flex; align-items: center; gap: 2px; padding: 3px 4px 3px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); max-width: 100%; }
.pastille-cmp { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-right: 4px; }
.c0 { --c: var(--c0); } .c1 { --c: var(--c1); } .c2 { --c: var(--c2); } .c3 { --c: var(--c3); } .c4 { --c: var(--c4); }
.cmp-nom { display: inline-flex; align-items: baseline; gap: 6px; min-width: 0; border: 0; background: none; padding: 2px 4px; font-weight: 600; cursor: pointer; border-radius: 6px; }
.cmp-nom:hover { background: var(--accent-soft); }
.cmp-nom .type, .cmp-ajout .type { font-size: var(--taille-1); text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 500; }
.cmp-retirer { flex: none; width: 26px; height: 26px; border: 0; border-radius: 50%; background: none; color: var(--text-muted); cursor: pointer; }
.cmp-retirer:hover { background: var(--accent-soft); color: var(--text-primary); }
.cmp-ajout { width: min(300px, 100%); }
.cmp-ajout input:disabled { opacity: .6; }
.suggestions {
  position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; right: 0; margin: 0; padding: 4px; list-style: none;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgb(0 0 0 / .14); max-height: 360px; overflow-y: auto;
}
.suggestions[hidden] { display: none; }
.suggestions li { padding: 7px 9px; border-radius: 7px; cursor: pointer; display: flex; flex-direction: column; gap: 1px; }
.suggestions li[aria-selected="true"], .suggestions li:hover { background: var(--accent-soft); }
.suggestions .nom { font-weight: 600; }
.suggestions .type { margin-left: 6px; }
.suggestions .indices { font-size: var(--taille-1); color: var(--text-secondary); }
.suggestions .vide { color: var(--text-muted); cursor: default; }
.cmp-rapides { margin: 8px 0 0; color: var(--text-secondary); font-size: var(--taille-2); }
.cmp-rapides:empty { display: none; }
.chip-ajout { border: 1px dashed var(--border); background: none; border-radius: 999px; padding: 3px 10px; cursor: pointer; color: var(--text-secondary); }
.chip-ajout:hover { border-style: solid; color: var(--text-primary); background: var(--accent-soft); }
.cmp-vue { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 16px 0 10px; }
.cmp-vue:empty { display: none; }
.cmp-vue select { font: inherit; color: var(--text-primary); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px; max-width: 100%; }
#cmp-contenu.charge { opacity: .55; transition: opacity .2s .15s; }
.cmp-vide { margin: 40px auto; max-width: 460px; text-align: center; color: var(--text-secondary); }
.cmp-defile { overflow-x: auto; }
.cmp-theme { margin: 0 0 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-1); }
.cmp-theme > summary { padding: 10px 12px; font-weight: 600; cursor: pointer; }
.cmp-theme > summary .nb { margin-left: 8px; color: var(--text-muted); font-weight: 400; font-size: var(--taille-1); }
.cmp-theme[open] > summary { border-bottom: 1px solid var(--border); }
.cmp-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.cmp-table th, .cmp-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.cmp-table tbody tr:last-child > * { border-bottom: 0; }
.cmp-table thead th { position: sticky; top: 0; background: var(--surface-1); font-size: var(--taille-2); text-align: right; border-bottom: 2px solid var(--c, var(--border)); }
.cmp-table thead th.ref { color: var(--text-secondary); font-weight: 500; }
.cmp-table tbody th { text-align: left; font-weight: 500; min-width: 180px; }
.cmp-table tbody th .an { display: block; font-size: var(--taille-1); color: var(--text-muted); font-weight: 400; }
.cmp-table td { text-align: right; white-space: nowrap; min-width: 92px; }
.cmp-table td small { display: block; font-size: var(--taille-1); color: var(--text-muted); }
.cmp-table td.ref { color: var(--text-secondary); background: color-mix(in srgb, var(--surface-0) 60%, transparent); }
.cmp-table td.haut { font-weight: 700; }
.cmp-table td.bas { color: var(--text-muted); }
.cmp-table tr.courant > th { color: var(--accent); }
.cmp-table tr.texte td { white-space: normal; }
.cmp-table .sous-titre th { padding-top: 16px; font-size: var(--taille-1); text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); font-weight: 600; }
.cmp-table .pastille { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; vertical-align: 1px; }
.cmp-tete { display: inline-flex; align-items: baseline; text-align: left; }
.cmp-table td.barre { position: relative; }
.cmp-table td.barre b { position: relative; font-weight: 500; }
.cmp-barre { position: absolute; left: 8px; bottom: 4px; height: 3px; max-width: calc(100% - 16px); border-radius: 2px; opacity: .85; }
.page-mode .note { color: var(--text-muted); font-size: var(--taille-1); margin: 10px 0 0; }
.cmp-astuce { margin: 0 0 10px !important; }
/* Bouton « Comparer » de la fiche */
.ligne-nom { display: flex; align-items: center; gap: 8px; }
.ligne-nom .fiche-nom { flex: 1; min-width: 0; }
.btn-comparer-terr { flex: none; display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; font-size: var(--taille-1); }
.btn-comparer-terr svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
@media (max-width: 900px) {
  .page-mode .barre-mode { gap: 8px; padding: 6px 12px; padding-top: max(6px, env(safe-area-inset-top)); }
  .page-mode-corps { padding: 12px 12px 24px; }
  .cmp-ajout { width: 100%; }
  .cmp-table tbody th { position: sticky; left: 0; z-index: 1; background: var(--surface-1); min-width: 130px; max-width: 150px; font-size: var(--taille-2); }
  .cmp-table thead th:first-child { position: sticky; left: 0; z-index: 2; }
  .cmp-table td { min-width: 84px; font-size: var(--taille-2); }
}
