/* =========================================================
   Carte, fiche panneau, ajout, liste « à recoller »
   (les couleurs et polices viennent de app.css)
   ========================================================= */
:root { --filtre-plan: saturate(.2) contrast(.85) brightness(1.08); --filtre-ortho: saturate(.85); }
@media (prefers-color-scheme: dark) {
  :root {
    --filtre-plan: invert(1) hue-rotate(180deg) saturate(.3) brightness(.85) contrast(.9);
    --filtre-ortho: brightness(.6) saturate(.7);
  }
}

.ecran-carte { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--fond); }
.ecran-carte .barre { position: relative; }
.barre__nom { flex: 1; }

.filtres {
  flex: none; display: flex; gap: 8px; padding: 6px 12px; position: relative; z-index: 1200;
  border-bottom: var(--ep) solid var(--trait); background: var(--fond); scrollbar-width: none;
}
.filtres::-webkit-scrollbar { display: none; }
.puce {
  flex: none; height: var(--zone); padding: 0 12px; display: inline-flex; align-items: center; gap: 6px;
  border: var(--ep) solid var(--trait); border-radius: var(--rayon); background: var(--fond); color: var(--texte);
  font-weight: 700; font-size: 15px; cursor: pointer; white-space: nowrap;
}
.puce__ico svg { width: 24px; height: 24px; display: block; }
.puce[aria-pressed="true"] { background: var(--texte); color: var(--fond); }
select.puce { appearance: none; max-width: 220px; }

.carte-zone { flex: 1; position: relative; min-height: 0; }
#carte { position: absolute; inset: 0; background: var(--surface); }
.fond-plan .leaflet-tile-pane { filter: var(--filtre-plan); }
.fond-ortho .leaflet-tile-pane { filter: var(--filtre-ortho); }
.leaflet-container { font-family: var(--police-corps); }
.leaflet-container .leaflet-control-attribution {
  font-size: 10px; background: var(--fond); color: var(--texte); opacity: .9; margin-bottom: 88px;
}
.leaflet-control-attribution a { color: inherit; font-weight: 400; }

.carte-outils { position: absolute; right: 10px; top: 10px; z-index: 600; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.bascule { display: flex; border: var(--ep) solid var(--trait); border-radius: var(--rayon); overflow: hidden; background: var(--fond); }
.bascule button {
  height: var(--zone); padding: 0 11px; border: 0; background: none; color: var(--texte); cursor: pointer;
  font: 900 13px/1 var(--police-titre); text-transform: uppercase; letter-spacing: .04em;
}
.bascule button[aria-pressed="true"] { background: var(--texte); color: var(--fond); }
.outil {
  width: var(--zone); height: var(--zone); display: grid; place-items: center; cursor: pointer;
  background: var(--fond); color: var(--texte); border: var(--ep) solid var(--trait); border-radius: var(--rayon);
}
.legende {
  position: absolute; left: 10px; top: 10px; z-index: 650; width: min(260px, calc(100% - 80px));
  background: var(--fond); border: var(--ep) solid var(--trait); border-radius: var(--rayon); padding: 8px 12px;
}
.legende-liste { list-style: none; margin: 0; padding: 0; }
.legende-liste li { display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 10px; padding: 3px 0; font-size: 14px; font-weight: 700; }
.legende-liste svg { width: 34px; height: 34px; }

/* ---- Marqueurs ---- */
.marqueur { background: none; border: 0; }
.marqueur svg { width: 100%; height: 100%; display: block; position: relative; filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff); }
.marqueur--recouvert::before {
  content: ""; position: absolute; left: 50%; top: 38%; width: 66px; height: 66px; margin: -33px 0 0 -33px;
  border-radius: 50%; background: rgba(209, 39, 28, .2); border: 2px solid rgba(209, 39, 28, .6);
}
.marqueur--attente-recouvert::before {
  content: ""; position: absolute; left: 50%; top: 38%; width: 56px; height: 56px; margin: -28px 0 0 -28px;
  border-radius: 50%; border: 2px dashed rgba(209, 39, 28, .8);
}
.groupe { background: none; }
.groupe div {
  width: 100%; height: 100%; display: grid; place-items: center; position: relative;
  background: var(--fond); color: var(--texte); border: 3px solid var(--trait); border-radius: var(--rayon);
  font: 900 19px/1 var(--police-titre); box-shadow: 0 0 0 2px var(--fond);
}
.groupe--urgent div { background: var(--c-rouge); color: #fff; border-color: var(--c-charbon); box-shadow: 0 0 0 2px #fff; }
.groupe div i {
  position: absolute; top: -9px; right: -9px; width: 20px; height: 20px; font-style: normal;
  background: var(--c-charbon); color: #fff; font-size: 14px; line-height: 20px; text-align: center; border-radius: 2px;
}
.legende-liste .groupe { display: block; width: 32px; height: 32px; }
.legende-liste .groupe div { font-size: 15px; }
.legende-liste .groupe div i { width: 15px; height: 15px; font-size: 11px; line-height: 15px; top: -6px; right: -6px; }
.moi { background: none; }
.moi span {
  display: block; width: 20px; height: 20px; border-radius: 50%; background: var(--c-bleu); border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--c-charbon), 0 0 0 12px rgba(56, 133, 244, .2);
}

/* ---- Barre du bas ---- */
.bas {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 700; display: flex; gap: 10px;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); pointer-events: none;
}
.bas > * { pointer-events: auto; }
.bas--ajout { display: none; }
.mode-ajout .bas--normal { display: none; }
.mode-ajout .bas--ajout { display: flex; }
.bas--ajout .btn { flex: none; min-height: 64px; }
.btn-liste {
  flex: none; width: 82px; height: 64px; cursor: pointer; color: var(--texte);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: var(--fond); border: var(--ep) solid var(--trait); border-radius: var(--rayon);
  font: 900 11px/1 var(--police-titre); text-transform: uppercase; letter-spacing: .03em;
}
.btn-liste b { font-size: 24px; color: var(--urgence); }
.fab {
  flex: 1; height: 64px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--accent); color: var(--sur-accent); border: var(--ep) solid var(--c-charbon); border-radius: var(--rayon);
  font: 900 21px/1 var(--police-titre); text-transform: uppercase; letter-spacing: .03em; box-shadow: 0 3px 0 var(--c-charbon);
}
.fab:active { transform: translateY(2px); box-shadow: none; }

/* ---- Mode ajout ---- */
.viseur-ajout {
  display: none; position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px;
  z-index: 650; pointer-events: none; fill: none; stroke: var(--c-violet); stroke-width: 4;
  filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff);
}
.bandeau-ajout {
  display: none; position: absolute; top: 10px; left: 10px; right: 72px; z-index: 650; margin: 0;
  background: var(--accent); color: var(--sur-accent); padding: 10px 12px; font-weight: 700; border-radius: var(--rayon);
}
.mode-ajout .viseur-ajout, .mode-ajout .bandeau-ajout { display: block; }
.mode-ajout .legende { display: none; }

/* ---- Volet (fiche panneau) ---- */
.volet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1100; max-height: 76%;
  overflow-y: auto; overscroll-behavior: contain; background: var(--fond); border-top: var(--ep) solid var(--trait);
  padding: 0 16px calc(24px + env(safe-area-inset-bottom));
  transform: translateY(105%); transition: transform .25s ease-out;
}
.volet.ouvert { transform: none; }
.volet__poignee {
  position: sticky; top: 0; z-index: 2; display: grid; place-items: center;
  width: calc(100% + 32px); height: 30px; margin: 0 -16px; border: 0; cursor: pointer; background: var(--fond);
}
.volet__poignee::before { content: ""; width: 52px; height: 5px; background: var(--trait); border-radius: 1px; }
.proche {
  margin: 0 0 10px; padding: 6px 10px; background: var(--surface); border-left: 5px solid var(--accent);
  font-weight: 700; font-size: 14px; text-transform: uppercase; letter-spacing: .04em;
}
.fiche__tete { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 2px 0 12px; }
.depuis { font-weight: 700; color: var(--texte-doux); font-size: 14px; }
.tampon--place { border-color: var(--c-vert); }
.tampon--recouvert { background: var(--c-rouge); border-color: var(--c-rouge); color: #fff; }
.tampon--attente { border-color: var(--accent); border-style: dashed; color: var(--accent); }
.tampon--attente-recouvert { border-color: var(--c-rouge); border-style: dashed; }
.tampon--reverifier { background: var(--c-jaune); border-color: var(--c-charbon); color: var(--c-charbon); }
.tampon--inconnu { border-color: var(--c-gris); color: var(--texte-doux); }
.tampon--vierge { border-color: var(--c-bleu); color: var(--c-bleu); }
.commune { margin: 10px 0 14px; color: var(--texte-doux); font-weight: 700; }
.alerte { margin: 0 0 14px; padding: 10px 12px; border: var(--ep) dashed var(--accent); background: var(--surface); font-size: 15px; }
.alerte--attente-recouvert { border-color: var(--c-rouge); }
.actions-etat { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.rappel-court { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--texte-doux); margin: 10px 0 18px; }
.rappel-court .ico { width: 20px; height: 20px; flex: none; }
.photo { aspect-ratio: 4 / 3; border: var(--ep) solid var(--trait); border-radius: var(--rayon); overflow: hidden; background: var(--surface); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo__vide { height: 100%; display: grid; place-items: center; padding: 12px; text-align: center; font-weight: 700; color: var(--texte-doux); font-size: 14px; }
.photo--choix { margin: 14px 0 12px; }
figure { margin: 0 0 16px; }
figcaption { font-weight: 700; font-size: 13px; margin-top: 6px; text-transform: uppercase; letter-spacing: .04em; }
.commentaire { font-style: italic; margin: 14px 0 0; }
.infos { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 14px; margin: 16px 0 0; }
.infos dt { font-weight: 700; }
.infos dd { margin: 0; font-variant-numeric: tabular-nums; }
.historique { list-style: none; margin: 0; padding: 0; border-top: var(--ep) solid var(--trait); }
.historique li { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--texte-doux); font-size: 14px; }
.historique svg { width: 30px; height: 30px; }
.historique .quand { color: var(--texte-doux); }
.decision { font: 900 11px/1 var(--police-titre); letter-spacing: .06em; text-transform: uppercase; border: 2px solid currentColor; padding: 3px 5px; border-radius: 2px; white-space: nowrap; }
.decision--en_attente { color: var(--accent); border-style: dashed; }
.decision--refuse, .decision--remplace, .decision--expire, .decision--annule { color: var(--texte-doux); text-decoration: line-through; }

/* ---- Dialogue doublon ---- */
.dialogue {
  position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 1600;
  background: var(--fond); border: var(--ep) solid var(--trait); border-radius: var(--rayon); padding: 16px;
}
.dialogue .titre { font-size: 24px; text-transform: uppercase; }
#dialogue-photo { z-index: 1700; display: grid; gap: 10px; }
#dialogue-photo[hidden] { display: none; }
#dialogue-photo .titre, #dialogue-photo .aide, #dialogue-photo .ligne-statut { margin: 0; }
#dialogue-photo .lien { justify-self: center; min-height: 44px; }
.doublon { display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: center; margin: 14px 0 6px; }
.doublon svg { width: 44px; height: 44px; }
.doublon strong { display: block; font: 900 17px/1.15 var(--police-titre); }
.duo-btn { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 14px; }

/* ---- Ajout : rappel de cadrage, champs ---- */
.rappel-cadrage {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px;
  background: var(--c-creme); color: var(--c-charbon); border: 2px solid var(--c-charbon); border-radius: var(--rayon);
}
.rappel-cadrage p { margin: 0; }
.rappel-cadrage strong { display: block; font: 900 17px/1.2 var(--police-titre); text-transform: uppercase; }
.champ textarea {
  display: block; width: 100%; margin-top: 6px; padding: 12px; min-height: 84px; resize: vertical;
  background: var(--fond); color: var(--texte); border: var(--ep) solid var(--trait); border-radius: var(--rayon);
  font: 400 17px/1.4 var(--police-corps);
}

/* ---- Liste à recoller ---- */
.ligne {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center;
  width: 100%; min-height: 74px; padding: 10px 0; cursor: pointer; text-align: left;
  background: none; border: 0; border-bottom: var(--ep) solid var(--trait); color: var(--texte);
}
.ligne svg { width: 44px; height: 44px; }
.ligne strong { display: block; font: 900 17px/1.15 var(--police-titre); }
.ligne span { font-size: 14px; color: var(--texte-doux); }
.ligne .dist { font: 900 18px/1 var(--police-titre); color: var(--texte); font-variant-numeric: tabular-nums; }
.vide { text-align: center; padding: 56px 16px; }
.vide svg { width: 72px; height: 72px; }
.vide p { font: 900 24px/1.15 var(--police-titre); text-transform: uppercase; }

/* ---- Cloche des admins ---- */
.icone-btn { position: relative; }
.pastille {
  position: absolute; top: 3px; right: 1px; min-width: 22px; height: 22px; padding: 0 5px;
  background: var(--accent); color: var(--sur-accent); border: 2px solid var(--fond); border-radius: var(--rayon);
  font: 900 13px/18px var(--police-titre); text-align: center;
}
.pastille:empty { display: none; }

/* ---- File à valider ---- */
.prop { padding: 18px 0; border-bottom: var(--ep) solid var(--trait); }
.prop__tete { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.prop h3 { font: 900 20px/1.12 var(--police-titre); margin: 12px 0 2px; }
.meta { font-size: 14px; color: var(--texte-doux); margin: 0 0 12px; }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.duo figure { margin: 0; }
.photo--proposee { border-style: dashed; border-color: var(--accent); border-width: 3px; }
.rappel-court span { line-height: 1.35; }

/* ---- Message bref ---- */
.toast {
  position: fixed; left: 12px; right: 12px; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 3000;
  max-width: 496px; margin: 0 auto;
  background: var(--texte); color: var(--fond); border-radius: var(--rayon); padding: 14px 16px; font-weight: 700;
  opacity: 0; transform: translateY(16px); transition: .2s; pointer-events: none;
}
.toast.visible { opacity: 1; transform: none; }

/* ---- Administration ---- */
.chiffres { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 18px; }
.chiffres div { border: var(--ep) solid var(--trait); border-radius: var(--rayon); padding: 10px; text-align: center; }
.chiffres dt { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--texte-doux); }
.chiffres dd { margin: 4px 0 0; font: 900 26px/1 var(--police-titre); }
.tuiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tuile {
  min-height: 72px; padding: 10px 12px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 4px;
  border: var(--ep) solid var(--trait); border-radius: var(--rayon); background: var(--fond); color: var(--texte);
  font: 900 15px/1.15 var(--police-titre); text-transform: uppercase; letter-spacing: .02em; text-align: left; text-decoration: none; cursor: pointer;
}
.pastille-texte {
  display: inline-block; padding: 2px 6px; border-radius: var(--rayon); background: var(--accent); color: var(--sur-accent);
  font: 900 11px/1.2 var(--police-titre); text-transform: uppercase; letter-spacing: .04em;
}
.pastille-texte--douce { background: var(--surface); color: var(--texte-doux); border: 1px solid var(--texte-doux); }
.liste-membres { list-style: none; margin: 0; padding: 0; border-top: var(--ep) solid var(--trait); }
.liste-membres li { padding: 14px 0; border-bottom: 1px solid var(--texte-doux); }
.liste-membres li.inactif strong { text-decoration: line-through; color: var(--texte-doux); }
.actions-membre { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.actions-membre .btn { min-height: 48px; font-size: 13px; flex: 1 1 auto; }
.resultats { list-style: none; margin: 8px 0 0; padding: 0; }
.resultats li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--texte-doux); }
.resultats li small { color: var(--texte-doux); }
.resultats .btn { min-height: 48px; font-size: 13px; flex: none; }
.plier { margin: 18px 0 0; }
.plier summary { font-weight: 700; cursor: pointer; min-height: var(--zone); display: flex; align-items: center; }
#fusion .btn { font-size: 14px; }
/* Choix de l'état à l'ajout d'un panneau. */
.etats-ajout { border: 0; padding: 0; margin: 0 0 18px; display: grid; gap: 8px; }
.etats-ajout legend { font-weight: 700; margin-bottom: 8px; padding: 0; }
.etats-ajout label { display: flex; align-items: center; gap: 12px; min-height: var(--zone); padding: 8px 12px;
  border: var(--ep) solid var(--trait); border-radius: var(--rayon); cursor: pointer; }
.etats-ajout label:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.etats-ajout input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; margin: 0; }
.etats-ajout__ico svg { width: 34px; height: 34px; display: block; }
.etats-ajout b { display: block; }
.etats-ajout small { color: var(--texte-doux); font-size: 14px; }

/* ---- Communes sans panneau ---- */
.puce--sp { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; border-style: dashed; }
.puce--sp .ico { width: 20px; height: 20px; }
.sp-liste { display: grid; margin: 6px 0 18px; }
.sp-liste .ligne { grid-template-columns: 1fr auto; }
.sp-liste .ligne .tampon { font-size: 12px; }
.tampon--sp-signalee { border-color: var(--c-rouge); color: var(--c-rouge); }
.tampon--sp-contactee { border-color: var(--accent); color: var(--accent); border-style: dashed; }
.tampon--sp-installe { border-color: var(--c-vert); color: var(--c-vert); }
.sp-carte { border-top: var(--ep) solid var(--trait); padding: 16px 0 6px; }
.sp-carte__tete { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sp-carte__tete h3 { margin: 0; font: 900 22px/1.1 var(--police-titre); }
.sp-carte .meta { color: var(--texte-doux); font-size: 14px; margin: 6px 0; }
.tuile--large { grid-column: 1 / -1; }
.sp-mairie { background: var(--surface); border-left: 5px solid var(--accent); padding: 10px 12px; margin: 10px 0; display: grid; gap: 10px; }
.sp-mairie p { margin: 0; line-height: 1.4; word-break: break-word; }
.sp-source { margin-top: 18px; }

/* ---- Menu « Filtres » ---- */
.menu-filtre { position: relative; }
.puce--filtre b { font-weight: 900; }
.puce--filtre b:not(:empty)::before { content: "·"; margin-right: 6px; font-weight: 700; }
.puce--filtre .chevron { font-size: 12px; }
.puce--actif { background: var(--texte); color: var(--fond); }
.menu-filtre__liste {
  position: absolute; left: 0; top: calc(100% + 6px); min-width: 250px; z-index: 1300;
  background: var(--fond); border: var(--ep) solid var(--trait); border-radius: var(--rayon);
  box-shadow: 0 10px 24px rgb(0 0 0 / .18); display: grid; padding: 4px;
}
.menu-filtre__liste[hidden] { display: none; }
.menu-filtre__choix {
  display: flex; align-items: center; gap: 10px; min-height: var(--zone); padding: 6px 10px;
  border: 0; background: none; color: var(--texte); font: 700 16px/1.2 inherit; text-align: left; cursor: pointer; border-radius: var(--rayon);
}
.menu-filtre__choix small { display: block; font-weight: 400; font-size: 13px; color: var(--texte-doux); }
.menu-filtre__choix[aria-checked="true"] { background: var(--surface); box-shadow: inset 4px 0 0 var(--accent); }
.menu-filtre__choix .puce__ico { width: 28px; height: 28px; flex: none; }
.puce--sp { flex: 1; justify-content: center; }
/* Filtre actif : le bouton ne montre que son nom (« À recoller ▾ »), pour garder la place du bouton voisin. */
.puce--actif > span:first-child { display: none; }
.puce--actif b::before { content: none !important; }
.puce--sp { min-width: 0; overflow: hidden; }
/* Barre de la carte : les deux boutons à parts égales */
.filtres > .menu-filtre, .filtres > .puce--sp { flex: 1 1 0; min-width: 0; }
.puce--filtre { width: 100%; justify-content: center; }
.menu-filtre__liste { min-width: 100%; width: max-content; }
.filtres { display: grid; grid-template-columns: 1fr 1fr; }
.filtres > .menu-filtre, .filtres > .puce--sp { min-width: 0; }
.filtres .puce { width: 100%; justify-content: center; padding: 0 8px; font-size: 15px; }
.puce--sp { white-space: normal; line-height: 1.1; text-align: center; }

/* ---- Groupes d'action ---- */
.liste-territoires .territoire--ga { margin-left: 18px; border-left: 4px solid var(--accent); padding-left: 12px; }
.liste-territoires .btn { min-height: 40px; margin-top: 6px; }
.admin-resp { margin: -6px 0 14px; }
.tampon--qualifie { border-color: var(--c-vert); color: var(--c-vert); }
