:root {
  --bleu: #1c8dd6;
  --jaune: #f2c230;
  --encre: #2b2a27;
  --gris: #6b6862;
  --fond: #ffffff;
  --fond-doux: #f4f2ed;
  --bord: #e2dfd7;
  --pastille-taille: 26px;
  font-family: "Noto Sans", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: var(--encre);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--fond); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.app { display: grid; grid-template-rows: auto 52vh 1fr; min-height: 100%; height: 100dvh; }
.entete { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-bottom: 1px solid var(--bord); background: var(--fond); }
.logo { height: 38px; width: auto; }
.titres { flex: 1; min-width: 0; }
.titres h1 { font-size: 1.05rem; margin: 0; line-height: 1.2; color: var(--bleu); font-weight: 700; }
.sous-titre { margin: 0; font-size: 0.8rem; color: var(--gris); }
.lien-plein-ecran { font-size: 0.8rem; color: var(--bleu); text-decoration: none; white-space: nowrap; }

.carte { position: relative; min-height: 260px; background: #f8f6f1; }
.panneau { display: flex; flex-direction: column; min-height: 0; overflow: auto; border-top: 1px solid var(--bord); background: var(--fond); }

.outils { display: flex; gap: 8px; padding: 10px 12px 6px; }
.outils label { flex: 1; min-width: 0; }
.outils input, .outils select { width: 100%; font: inherit; font-size: 0.9rem; padding: 7px 10px; border: 1px solid var(--bord); border-radius: 8px; background: var(--fond-doux); color: var(--encre); }
.outils input:focus, .outils select:focus { outline: 2px solid var(--bleu); outline-offset: 1px; }

.secteurs { margin: 0 12px; border: 1px solid var(--bord); border-radius: 10px; padding: 0 10px; }
.secteurs summary { cursor: pointer; padding: 8px 0; font-weight: 600; font-size: 0.9rem; list-style: none; display: flex; justify-content: space-between; }
.secteurs summary::after { content: "▾"; color: var(--gris); }
.secteurs[open] summary::after { content: "▴"; }
.secteurs-etat { font-weight: 400; color: var(--gris); margin-left: 6px; }
.secteurs-actions { display: flex; gap: 6px; padding-bottom: 6px; }
.secteurs-actions button { font: inherit; font-size: 0.75rem; padding: 3px 10px; border: 1px solid var(--bord); border-radius: 999px; background: var(--fond); cursor: pointer; color: var(--gris); }
.secteurs-actions button:hover { border-color: var(--bleu); color: var(--bleu); }
.legende-secteurs { list-style: none; margin: 0; padding: 0 0 8px; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 2px 10px; }
.legende-secteurs label { display: flex; align-items: center; gap: 7px; font-size: 0.82rem; padding: 3px 2px; cursor: pointer; border-radius: 6px; }
.legende-secteurs label:hover { background: var(--fond-doux); }
.legende-secteurs input { margin: 0; accent-color: var(--bleu); }
.legende-secteurs .libelle { flex: 1; }
.legende-secteurs .nb { color: var(--gris); font-size: 0.75rem; }
.legende-secteurs input:not(:checked) ~ .libelle { color: var(--gris); text-decoration: line-through; }
.point { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--couleur); border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.15); flex: none; }

.compte { margin: 8px 12px 4px; font-size: 0.78rem; color: var(--gris); }
.liste { list-style: none; margin: 0; padding: 0 6px 6px; }
.liste li button { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; width: 100%; text-align: left; font: inherit; padding: 6px 8px; border: 0; border-radius: 8px; background: none; cursor: pointer; color: var(--encre); }
.liste li button:hover, .liste li.active button { background: var(--fond-doux); }
.liste li button.sans-position { cursor: default; opacity: 0.7; }
.liste .numero { grid-row: 1 / span 2; width: var(--pastille-taille); height: var(--pastille-taille); border-radius: 50%; background: var(--couleur); color: var(--texte); font-weight: 700; font-size: 0.75rem; display: grid; place-items: center; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.2); }
.liste .nom { font-size: 0.88rem; font-weight: 600; line-height: 1.2; }
.liste .detail { font-size: 0.74rem; color: var(--gris); }

.pied { margin-top: auto; padding: 10px 12px; font-size: 0.75rem; color: var(--gris); display: flex; justify-content: space-between; gap: 8px; border-top: 1px solid var(--bord); }
.pied a { color: var(--bleu); }

/* Pastilles sur la carte (DOM MapLibre) */
.pastille { width: var(--pastille-taille); height: var(--pastille-taille); border-radius: 50%; background: var(--couleur); color: var(--texte); font: 700 0.72rem/1 "Noto Sans", system-ui, sans-serif; display: grid; place-items: center; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.35), 0 0 0 1px rgba(0,0,0,.12); cursor: pointer; padding: 0; transition: transform .12s; }
.pastille:hover { transform: scale(1.18); z-index: 2; }
.pastille.masquee { display: none; }
.maplibregl-marker { z-index: 1; }
.maplibregl-marker:hover { z-index: 3; }
/* La Fiche doit passer au-dessus des pastilles voisines. */
.maplibregl-popup { z-index: 5; }

/* Fiche */
.maplibregl-popup-content { border-radius: 10px; padding: 12px 14px; box-shadow: 0 4px 16px rgba(0,0,0,.18); font-family: inherit; }
.fiche header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.fiche h3 { margin: 0; font-size: 0.95rem; line-height: 1.2; }
.fiche-numero { width: 24px; height: 24px; border-radius: 50%; background: var(--couleur); color: #fff; font-weight: 700; font-size: 0.72rem; display: grid; place-items: center; flex: none; }
.fiche p { margin: 3px 0; font-size: 0.85rem; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.fiche-secteur { color: var(--gris); }
.fiche-quartier { color: var(--gris); }
.fiche-tel a { color: var(--bleu); text-decoration: none; font-weight: 600; }
.badge-nouveau { display: inline-block; font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; background: var(--jaune); color: #4a3a00; padding: 1px 6px; border-radius: 999px; vertical-align: middle; }

@media (min-width: 900px) {
  .app { grid-template-columns: 380px 1fr; grid-template-rows: auto 1fr; }
  .entete { grid-column: 1 / -1; }
  .panneau { grid-column: 1; grid-row: 2; border-top: 0; border-right: 1px solid var(--bord); }
  .carte { grid-column: 2; grid-row: 2; }
}
