/* Élus Mérignac — styles isolés sous .em-app pour ne pas interférer avec le thème */
.em-app {
  --em-bleu: #0060A8;
  --em-bleu-fonce: #003E6E;
  --em-rouge: #E2001A;
  --em-vert: #7AB51D;
  --em-texte: #1d2433;
  --em-doux: #5b6372;
  --em-fond: #f4f6f9;
  --em-carte: #ffffff;
  --em-bord: #e3e7ee;
  --em-rayon: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--em-texte);
  background: var(--em-fond);
  border-radius: var(--em-rayon);
  overflow: hidden;
  line-height: 1.4;
  font-size: 16px;
  max-width: 1100px;
  margin: 1.5em auto;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.em-app *, .em-app *::before, .em-app *::after { box-sizing: border-box; }
.em-app button { font: inherit; color: inherit; }
.em-app h2, .em-app h3, .em-app h4 { font-family: inherit; letter-spacing: normal; text-transform: none; }
.em-chargement, .em-vide, .em-note { color: var(--em-doux); }
.em-vide { padding: 1em 0; }
.em-note { font-size: .85em; }

/* En-tête aux couleurs de la Ville */
.em-entete {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px; background: var(--em-bleu); color: #fff;
}
.em-logo { border-radius: 10px; flex: none; }
.em-titre { font-size: 1.25em; font-weight: 700; display: flex; flex-direction: column; line-height: 1.2; }
.em-titre small { font-size: .65em; font-weight: 500; opacity: .85; }
.em-bandeau { display: flex; height: 4px; }
.em-bandeau span { flex: 1; }
.em-bandeau span:nth-child(1) { background: var(--em-bleu); }
.em-bandeau span:nth-child(2) { background: var(--em-rouge); }
.em-bandeau span:nth-child(3) { background: var(--em-vert); }

/* Onglets */
.em-onglets {
  display: flex; gap: 4px; overflow-x: auto; padding: 10px 16px 0;
  background: var(--em-carte); border-bottom: 1px solid var(--em-bord);
}
.em-onglets button {
  background: none; border: 0; border-bottom: 3px solid transparent;
  padding: 10px 14px; cursor: pointer; white-space: nowrap; color: var(--em-doux); font-weight: 600;
}
.em-onglets button[aria-selected="true"] { color: var(--em-bleu); border-bottom-color: var(--em-bleu); }
.em-onglets button:focus-visible { outline: 2px solid var(--em-bleu); outline-offset: -2px; }
.em-corps { padding: 18px 20px 24px; }

/* Recherche et outils */
.em-outils { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.em-outils .em-recherche { flex: 1 1 260px; }
.em-recherche, .em-select {
  width: 100%; padding: 10px 14px; margin: 10px 0;
  border: 1px solid var(--em-bord); border-radius: 10px; background: var(--em-carte); font-size: 15px; color: var(--em-texte);
}
.em-select { width: auto; }
.em-recherche:focus, .em-select:focus { outline: 2px solid var(--em-bleu); outline-offset: 0; border-color: transparent; }

/* Sections */
.em-section {
  display: flex; align-items: center; gap: 8px;
  font-size: 1em; font-weight: 700; margin: 22px 0 10px; color: var(--em-texte);
}
.em-sous-section { font-size: .9em; margin: 16px 0 6px; }
.em-compte { color: #fff; font-size: .75em; padding: 1px 8px; border-radius: 999px; }

/* Composition du conseil */
.em-composition { background: var(--em-carte); border-radius: var(--em-rayon); padding: 14px 16px; border: 1px solid var(--em-bord); }
.em-composition-total { color: var(--em-doux); margin-bottom: 8px; }
.em-composition-total strong { font-size: 1.8em; color: var(--em-bleu); margin-right: 4px; }
.em-barre { display: flex; height: 22px; border-radius: 6px; overflow: hidden; gap: 2px; }
.em-barre span { display: block; }
.em-legende { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .88em; }
.em-legende li { display: flex; align-items: center; gap: 6px; margin: 0; }
.em-legende i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* Cartes élu·es (organigramme) */
.em-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.em-carte-elu {
  display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%;
  background: var(--em-carte); border: 1px solid var(--em-bord); border-left: 5px solid; border-radius: 12px;
  padding: 12px; cursor: pointer; transition: box-shadow .15s, transform .15s;
}
.em-carte-elu:hover { box-shadow: 0 4px 14px rgba(0,0,0,.08); transform: translateY(-1px); }
.em-carte-elu:focus-visible, .em-ligne:focus-visible { outline: 2px solid var(--em-bleu); outline-offset: 2px; }
.em-avatar-zone { position: relative; flex: none; }
.em-avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  border-radius: 50%; color: #fff; font-weight: 700; letter-spacing: .02em;
}
.em-rang {
  position: absolute; right: -4px; bottom: -4px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 1.5px solid; font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.em-carte-texte, .em-ligne-texte { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.em-nom { font-size: 1em; }
.em-fonction { font-size: .85em; color: var(--em-doux); }
.em-quartier { font-size: .8em; font-weight: 600; }
.em-groupe { font-size: .75em; color: #8a909b; }

/* Listes */
.em-liste { display: flex; flex-direction: column; background: var(--em-carte); border: 1px solid var(--em-bord); border-radius: var(--em-rayon); overflow: hidden; }
.em-ligne {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: none; border: 0; border-bottom: 1px solid var(--em-bord); padding: 10px 14px; cursor: pointer;
}
.em-ligne:last-child { border-bottom: 0; }
.em-ligne:hover { background: #f7f9fc; }
.em-ligne-texte { flex: 1; }
.em-meta { font-size: .82em; color: var(--em-doux); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.em-chevron { color: #b5bac3; font-size: 1.4em; }
.em-pastille { font-size: .78em; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.em-icone-cat {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  border-radius: 28%; color: #fff; font-weight: 800;
}

/* Puces de filtre */
.em-puces { display: flex; gap: 8px; flex-wrap: wrap; }
.em-puce {
  --em-c: var(--em-bleu);
  border: 0; border-radius: 999px; padding: 7px 14px; cursor: pointer; font-size: .9em; font-weight: 600;
  color: var(--em-c); background: color-mix(in srgb, var(--em-c) 12%, transparent);
}
.em-puce[aria-pressed="true"] { color: #fff; background: var(--em-c); }

/* Carte */
.em-carte { height: 520px; border-radius: var(--em-rayon); overflow: hidden; border: 1px solid var(--em-bord); z-index: 0; }
.em-legende-carte { margin: 12px 0 4px; }
.em-marqueur-conteneur { background: none; border: 0; }
.em-marqueur {
  display: flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  border-radius: 50%; color: #fff; font-weight: 800; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35);
}
.em-marqueur-nb {
  position: absolute; top: -6px; right: -8px; background: var(--em-rouge); color: #fff;
  font-size: 11px; font-weight: 700; padding: 0 5px; border-radius: 999px; border: 1.5px solid #fff;
}
.em-popup-adresse { font-size: .85em; color: var(--em-doux); margin-bottom: 6px; }
.em-popup .em-lien { display: block; text-align: left; margin: 4px 0; }
.em-mini-carte { height: 180px; border-radius: 10px; overflow: hidden; margin: 8px 0; }

/* Liens-boutons */
.em-lien { background: none; border: 0; padding: 0; color: var(--em-bleu); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; text-align: left; }
.em-bouton {
  display: inline-block; background: var(--em-bleu); color: #fff !important; border: 0; border-radius: 10px;
  padding: 9px 16px; font-weight: 600; cursor: pointer; text-decoration: none !important;
}
.em-bouton:hover { background: var(--em-bleu-fonce); }
.em-actions { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 24px; }

/* Synthèse */
.em-chiffres { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.em-chiffre { background: var(--em-carte); border: 1px solid var(--em-bord); border-radius: var(--em-rayon); padding: 14px; text-align: center; }
.em-chiffre strong { display: block; font-size: 2em; line-height: 1.1; }
.em-chiffre span { font-size: .85em; color: var(--em-doux); }
.em-barres { background: var(--em-carte); border: 1px solid var(--em-bord); border-radius: var(--em-rayon); padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.em-barre-ligne { display: grid; grid-template-columns: minmax(120px, 34%) 1fr 36px; gap: 10px; align-items: center; font-size: .9em; }
.em-barre-piste { height: 14px; background: #eef1f5; border-radius: 7px; overflow: hidden; }
.em-barre-piste span { display: block; height: 100%; border-radius: 7px; }
.em-barre-val { font-weight: 700; text-align: right; color: var(--em-doux); }

/* Fiches */
.em-dialogue {
  border: 0; padding: 0; border-radius: 18px; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 40px);
  box-shadow: 0 20px 60px rgba(0,0,0,.3); color: var(--em-texte); background: var(--em-fond);
}
.em-dialogue::backdrop { background: rgba(10, 25, 45, .55); }
.em-fermer {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255,255,255,.9); font-size: 22px; line-height: 1; cursor: pointer;
}
.em-fiche { padding-bottom: 20px; }
.em-fiche > *:not(.em-fiche-entete) { margin-left: 20px; margin-right: 20px; }
.em-fiche-entete { display: flex; gap: 16px; align-items: center; padding: 26px 20px 20px; color: #fff; }
.em-fiche-entete h2 { margin: 0 0 6px; font-size: 1.35em; color: #fff; line-height: 1.2; }
.em-fiche-entete h2 span { font-weight: 800; }
.em-fiche-entete .em-avatar { border: 3px solid rgba(255,255,255,.8); }
.em-badge { display: inline-block; background: rgba(255,255,255,.22); padding: 3px 10px; border-radius: 999px; font-size: .85em; font-weight: 600; }
.em-fiche-bloc { background: var(--em-carte); border-left: 5px solid; border-radius: 12px; padding: 12px 16px; margin-top: 16px; }
.em-fiche-bloc h3 { margin: 0 0 6px; font-size: .95em; }
.em-fiche-bloc p { margin: 6px 0; }
.em-fiche-fonction { font-weight: 500; }
.em-fiche-bloc dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 8px 0 0; font-size: .9em; }
.em-fiche-bloc dt { color: var(--em-doux); }
.em-fiche-bloc dd { margin: 0; font-weight: 600; }
.em-fiche-liste { list-style: none; margin: 0; padding: 0; background: var(--em-carte); border-radius: 12px; }
.em-fiche-liste li { padding: 9px 14px; border-bottom: 1px solid var(--em-bord); display: flex; justify-content: space-between; gap: 10px; align-items: center; margin: 0; }
.em-fiche-liste li:last-child { border-bottom: 0; }

@media (max-width: 600px) {
  .em-corps { padding: 14px 12px 20px; }
  .em-grille { grid-template-columns: 1fr; }
  .em-carte { height: 420px; }
  .em-barre-ligne { grid-template-columns: 1fr 36px; }
  .em-barre-lib { grid-column: 1 / -1; }
  .em-fiche-liste li { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) { .em-carte-elu { transition: none; } }

/* Titulaire / suppléant·e : deux styles bien distincts
   - titulaire : badge plein, barre pleine
   - suppléant·e : badge en contour pointillé, barre hachurée */
.em-role {
  --em-c: #0060A8;
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
  font-size: .78em; font-weight: 700; padding: 2px 9px; border-radius: 999px; border: 1.5px solid var(--em-c);
}
.em-role-tit { background: var(--em-c); color: #fff; }
.em-role-tit::before { content: "●"; font-size: .8em; }
.em-role-sup { background: #fff; color: var(--em-c); border-style: dashed; }
.em-role-sup::before { content: "○"; font-size: .9em; }
.em-compteurs { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.em-fiche-compteurs { margin-top: 14px; }
.em-fiche-compteurs .em-role { font-size: .9em; padding: 4px 12px; }

.em-position {
  flex: none; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #eef1f5; color: var(--em-doux); font-size: .8em; font-weight: 800; margin-right: 6px;
}
.em-ligne > .em-position { margin-right: 0; }
.em-barre-lib { display: flex; align-items: center; }

.em-piste-empilee { display: flex; }
.em-piste-empilee span { border-radius: 0; }
.em-piste-empilee span:first-child { border-radius: 7px 0 0 7px; }
.em-piste-empilee span:last-child { border-radius: 0 7px 7px 0; }
.em-piste-empilee span:only-child { border-radius: 7px; }
.em-seg-tit { background: #0060A8; }
.em-seg-sup { background: repeating-linear-gradient(135deg, #4E7F12 0 4px, #b9d68f 4px 8px); }
.em-barre-val-double { white-space: nowrap; }
.em-barre-ligne:has(.em-barre-val-double) { grid-template-columns: minmax(150px, 34%) 1fr 64px; }
.em-txt-tit { color: #0060A8; }
.em-txt-sup { color: #4E7F12; }
.em-legende-roles { display: flex; gap: 18px; flex-wrap: wrap; font-size: .85em; color: var(--em-doux); margin-bottom: 4px; }
.em-legende-roles span { display: inline-flex; align-items: center; gap: 6px; }
.em-legende-roles i { display: inline-block; width: 22px; height: 10px; border-radius: 3px; }

.em-bloc-role { margin-top: 6px; }
.em-bloc-sup .em-fiche-liste { border: 1.5px dashed #9cbf6b; background: #fbfdf8; }
.em-bloc-tit .em-fiche-liste { border: 1.5px solid #cfe0f0; }

@media (max-width: 600px) {
  .em-barre-ligne:has(.em-barre-val-double) { grid-template-columns: 1fr 64px; }
}

/* Présidences de structures */
.em-role-pres { background: #E2001A; color: #fff; border-color: #E2001A; }
.em-role-pres::before { content: none; }
.em-preside { font-size: .8em; font-weight: 700; color: #E2001A; }
.em-meta .em-preside { display: block; width: 100%; }
.em-intro { color: var(--em-doux); margin: 0 0 4px; }
.em-pres-liste { display: flex; flex-direction: column; gap: 10px; }
.em-pres-carte {
  background: var(--em-carte); border: 1px solid var(--em-bord); border-top: 4px solid #E2001A;
  border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px;
}
.em-pres-carte-fiche { border-top-width: 1px; border-left: 4px solid #E2001A; margin-top: 8px; }
.em-pres-tete { display: flex; gap: 12px; align-items: flex-start; }
.em-pres-titre { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.em-pres-structure { font-weight: 700; color: var(--em-texte); text-decoration: none; }
.em-pres-structure:hover { text-decoration: underline; color: var(--em-bleu); }
.em-pres-elu {
  display: inline-flex; align-items: center; gap: 8px; background: #f4f6f9; border: 0; border-radius: 999px;
  padding: 3px 12px 3px 3px; cursor: pointer; align-self: flex-start;
}
.em-pres-elu-titre { background: none; padding: 0; font-weight: 700; font-size: 1em; }
.em-pres-details { font-size: .88em; border-top: 1px dashed var(--em-bord); padding-top: 8px; }
.em-pres-carte-fiche .em-pres-details { border-top: 0; padding-top: 0; }
.em-pres-dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; }
.em-pres-dl dt { color: var(--em-doux); }
.em-pres-dl dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.em-pres-remarque { margin: 6px 0 0; white-space: pre-line; color: var(--em-texte); }

/* Bouton « Recentrer sur Mérignac » */
.em-btn-recentrer {
  background: #fff; border: 2px solid rgba(0,0,0,.2); border-radius: 4px; padding: 4px 8px;
  font: 600 12px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: #0060A8; cursor: pointer;
}
.em-btn-recentrer:hover { background: #f4f6f9; }
.em-chiffres { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 600px) { .em-chiffres { grid-template-columns: repeat(2, 1fr); } }
