:root {
  /* Palette inspirée du Système de Design de l'État (non officiel) */
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f6f6f6;
  --ink: #161616;
  --muted: #3a3a3a;
  --muted-2: #666666;
  --line: #e5e5e5;
  --line-strong: #cecece;
  --blue: #000091; /* Bleu France */
  --blue-hover: #1b1bd4;
  --navy: #16294d; /* Bleu marine (bannière) */
  --red: #e1000f; /* Rouge Marianne */
  --info-bg: #f4f6ff;
  --total: #ce0500; /* blocage total (error) */
  --partiel: #f57c00; /* blocage partiel (warning) */
  --libre: #18753c; /* levée (success) */
  --radius: 10px;
  --radius-sm: 5px;
  --shadow-soft: 0 2px 6px rgba(0, 0, 18, 0.06), 0 8px 24px rgba(0, 0, 18, 0.05);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
a { color: var(--blue); text-underline-offset: 2px; }

/* ---------- En-tête ---------- */
.site-header {
  background: var(--navy); border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  position: sticky; top: 0; z-index: 500;
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}
.site-header.is-compact { box-shadow: 0 2px 14px rgba(0, 0, 18, 0.35); border-color: transparent; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 9px 20px; transition: padding 0.25s ease; }
.site-header.is-compact .header-inner { padding: 6px 20px; }
.brand { display: flex; align-items: center; gap: 13px; text-decoration: none; color: #fff; }
.brand-logo { width: 52px; height: 52px; flex: none; border-radius: 12px; display: block; transition: width 0.25s ease, height 0.25s ease, border-radius 0.25s ease; }
.site-header.is-compact .brand-logo { width: 40px; height: 40px; border-radius: 9px; }
.brand-name { font-weight: 700; font-size: 1.4rem; letter-spacing: -0.01em; transition: font-size 0.25s ease; }
.site-header.is-compact .brand-name { font-size: 1.12rem; }
.brand-name b { color: #ff4d4d; font-weight: 700; }

/* Bouton d'action : rouge et compact sur la bannière marine */
.site-header .btn-primary { background: var(--total); color: #fff; padding: 4px 18px; }
.site-header .btn-primary:hover { background: #b20400; }

/* Compteur live dans la bannière */
.header-right { display: flex; align-items: center; gap: 16px; }
.header-count {
  display: inline-flex; align-items: baseline; gap: 7px;
  background: #fde8e8; color: var(--total);
  border: 1px solid #f6c9c9; border-radius: 999px;
  padding: 3px 15px; font-size: 0.9rem; line-height: 1;
  transition: padding 0.25s ease, background 0.25s ease;
}
.header-count-dot { align-self: center; width: 9px; height: 9px; border-radius: 50%; background: var(--total); box-shadow: 0 0 0 0 rgba(206, 5, 0, 0.5); animation: pulseDot 2s ease-out infinite; }
.header-count strong { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.01em; transition: font-size 0.25s ease; }
.header-count-label { font-weight: 600; }
/* Aucun lycée bloqué : état apaisé (vert) */
.header-count.is-ok { background: #e3f6ea; color: var(--libre); border-color: #bfe5cc; }
.header-count.is-ok .header-count-dot { background: var(--libre); animation: none; box-shadow: none; }
.site-header.is-compact .header-count { padding: 2px 13px; }
.site-header.is-compact .header-count strong { font-size: 1.1rem; }
@keyframes pulseDot {
  0% { box-shadow: 0 0 0 0 rgba(206, 5, 0, 0.45); }
  70% { box-shadow: 0 0 0 7px rgba(206, 5, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(206, 5, 0, 0); }
}
@media (prefers-reduced-motion: reduce) { .header-count-dot { animation: none; } }

/* ---------- Boutons ---------- */
.btn {
  font: inherit; font-weight: 600;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 10px 20px; cursor: pointer;
  transition: background 0.14s ease, box-shadow 0.14s ease, opacity 0.14s ease;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-hover); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
/* Libellé court du bouton de signalement, activé sur petit écran */
.btn-label-short { display: none; }
.btn-ghost { background: transparent; color: var(--blue); border-color: transparent; padding: 8px 12px; }
.btn-ghost:hover { background: var(--surface-2); }

/* ---------- Bandeau d'accueil (pleine largeur, fond gris) ---------- */
.hero-band { padding: 18px 0 20px; }
.hero-intro .lead { font-size: 1.02rem; }
.hero-info { margin-top: 14px; }

/* Blocs d'info repliables */
.hero-band details > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--blue);
  user-select: none;
}
.hero-band details > summary::-webkit-details-marker { display: none; }
.hero-band details > summary::before {
  content: "";
  width: 7px; height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  flex: none;
}
.hero-band details[open] > summary::before { transform: rotate(45deg); }
.hero-band details > summary:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.hero-band details > :not(summary) { margin-top: 12px; }
.lead { font-size: 1.02rem; color: var(--muted); margin: 0; max-width: none; }

/* ---------- Indicateurs ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 10px 0 40px; }
.stat-tile {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px; min-height: 120px;
  display: flex; flex-direction: column; justify-content: center;
  border-top: 3px solid var(--blue);
}
.stat-tile.is-alert { border-top-color: var(--total); }
.stat-tile.is-warn { border-top-color: var(--partiel); }
.stat-tile.is-ok { border-top-color: var(--libre); }
.stat-value { font-weight: 700; font-size: 2.6rem; line-height: 1; letter-spacing: -0.02em; }
.stat-value.accent-total { color: var(--total); }
.stat-value.accent-partiel { color: var(--partiel); }
.stat-value.accent-ok { color: var(--libre); }
.stat-label { font-size: 0.92rem; font-weight: 600; margin-top: 12px; }
.stat-sub { font-size: 0.82rem; color: var(--muted-2); margin-top: 3px; }
.skeleton { background: linear-gradient(90deg, #fff 0%, var(--surface-2) 50%, #fff 100%); animation: pulse 1.4s ease infinite; border-top-color: var(--line); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ---------- Disposition carte + aside ---------- */
.layout { display: grid; grid-template-columns: 1fr 324px; gap: 22px; align-items: start; margin-bottom: 48px; }
.map-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.map-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }

/* Bascule de vue (segmented) */
.view-toggle { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; }
.view-btn { font: inherit; font-weight: 600; font-size: 0.9rem; background: #fff; color: var(--muted); border: 0; padding: 8px 15px; cursor: pointer; }
.view-btn + .view-btn { border-left: 1px solid var(--line-strong); }
.view-btn.is-active { background: var(--blue); color: #fff; }

.toolbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* Bouton d'actualisation (icône seule) */
.refresh-btn {
  width: 36px; height: 36px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.15rem; line-height: 1; color: var(--muted);
  background: #fff; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}
.refresh-btn:hover { background: var(--surface-2); color: var(--blue); }
.refresh-btn:active { transform: translateY(1px); }
.legend { display: flex; gap: 8px; font-size: 0.84rem; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 7px; background: none; border: 1px solid transparent; border-radius: 999px; color: inherit; font: inherit; font-size: 0.84rem; padding: 4px 11px 4px 9px; cursor: pointer; transition: background 0.12s ease, opacity 0.12s ease; }
.legend-item:hover { background: var(--surface-2); }
.legend-item.is-off { opacity: 0.45; text-decoration: line-through; }
.legend-item:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.dot-total { background: var(--total); }
.dot-partiel { background: var(--partiel); }
.dot-ouvert { background: var(--libre); }

/* Légende des états dans « Comment ça marche ? » */
.legende-etats { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.legende-etats li { display: flex; align-items: center; gap: 9px; font-size: 0.92rem; }
.legende-etats .dot { flex: none; }
.txt-ok { color: var(--libre); }
.txt-total { color: var(--total); }
.txt-partiel { color: var(--partiel); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
#map { height: 548px; width: 100%; background: var(--surface-2); z-index: 1; }
.map-note { margin: 0; padding: 12px 16px; font-size: 0.78rem; color: var(--muted-2); border-top: 1px solid var(--line); }

/* Onglets de territoire au-dessus de la carte */
.map-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.map-tab { flex: none; font: inherit; font-size: 0.85rem; font-weight: 600; white-space: nowrap; background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; }
.map-tab:hover { background: var(--surface-2); }
.map-tab.is-active { background: var(--blue); color: #fff; border-color: var(--blue); }
.tab-dot { width: 9px; height: 9px; border-radius: 50%; background: #ccc; display: inline-block; border: 1px solid rgba(0, 0, 0, 0.18); }
.map-tab.is-active .tab-dot { border-color: rgba(255, 255, 255, 0.55); }

/* ---------- Panneaux ---------- */
.side { display: flex; flex-direction: column; gap: 22px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.panel h2 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-2); margin: 0 0 14px; font-weight: 700; }
.dept-list { margin: 0; padding: 0; list-style: none; }
.dept-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; }
.dept-row + .dept-row { border-top: 1px solid var(--line); }
.dept-rank {
  flex: none; width: 23px; height: 23px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 0.72rem; font-weight: 700;
  background: var(--surface-2); color: var(--muted-2);
}
.dept-rank.r1 { background: var(--navy); color: #fff; }
.dept-rank.r2, .dept-rank.r3 { background: #dfe4ee; color: var(--navy); }
.dept-body { flex: 1; min-width: 0; }
.dept-name { font-size: 0.9rem; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 6px; }
.dept-code { color: var(--muted-2); font-weight: 400; font-size: 0.8rem; }
.dept-bar { position: relative; height: 20px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.dept-fill { position: absolute; left: 0; top: 0; height: 100%; display: flex; min-width: 24px; transition: width 0.4s ease; }
.dept-seg {
  height: 100%; display: grid; place-items: center;
  min-width: 22px; overflow: hidden;
  color: #fff; font-size: 0.72rem; font-weight: 700;
  font-variant-numeric: tabular-nums; line-height: 1;
}
.dept-seg.seg-total { background: var(--total); }
.dept-seg.seg-partiel { background: var(--partiel); }
.dept-seg + .dept-seg { margin-left: 2px; }
.dept-row:hover .dept-name { color: var(--blue); }
.mini-legend { display: flex; gap: 14px; margin: -6px 0 14px; font-size: 0.76rem; color: var(--muted-2); }
.mini-legend span { display: inline-flex; align-items: center; gap: 6px; }
.mini-legend .dot { width: 9px; height: 9px; }
.muted { color: var(--muted-2); }
.empty-state { font-size: 0.9rem; color: var(--muted-2); font-style: italic; }

/* Encadré d'information (callout DSFR) */
.panel-info { background: var(--info-bg); border: 0; border-left: 4px solid var(--blue); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.panel-info h2 { color: var(--blue); }
.panel-info p { font-size: 0.9rem; color: var(--muted); margin: 0 0 12px; }
.panel-info p:last-child { margin-bottom: 0; }
.panel-info strong { color: var(--ink); }
.disclaimer { font-size: 0.78rem !important; font-style: italic; }

/* ---------- Fiche établissement (style « callout » bleu) ---------- */
.fiche, .synthese { background: var(--info-bg); border: 0; border-left: 4px solid var(--blue); border-radius: 0 var(--radius) var(--radius) 0; padding: 22px 24px; margin-bottom: 40px; }

/* Bouton de signalement de la fiche : rouge (action « blocus ») */
#fiche-report.btn-primary { background: var(--total); }
#fiche-report.btn-primary:hover { background: #b20400; }

/* ---------- Synthèse par département ---------- */
.synthese-pick { width: 100%; max-width: 420px; }
.synthese-pick .input { width: 100%; cursor: pointer; }
.synth-resume { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; margin-bottom: 16px; font-size: 0.9rem; }
.synth-stat { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); }
.synth-stat strong { color: var(--ink); font-weight: 800; font-size: 1.05rem; }
.synth-stat-sig { margin-left: auto; }
.synth-filtres { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.synth-filtre {
  font: inherit; font-size: 0.84rem; font-weight: 600;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 13px; border-radius: 999px; cursor: pointer;
  background: #fff; color: var(--ink); border: 1px solid var(--line-strong);
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.synth-filtre:hover { border-color: var(--blue); }
.synth-filtre.is-active { background: var(--blue); color: #fff; border-color: var(--blue); }
.synth-filtre-n { font-weight: 800; opacity: 0.85; }
.synth-filtre.is-active .synth-filtre-n { opacity: 1; }
.synth-list { list-style: none; margin: 0; padding: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.synth-list li[data-uai] {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  padding: 11px 15px; border-bottom: 1px solid var(--line); cursor: pointer;
  transition: background 0.1s ease;
}
.synth-list li[data-uai]:last-child { border-bottom: 0; }
.synth-list li[data-uai]:hover { background: var(--surface-2); }
.synth-nom { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.synth-nom-txt { font-weight: 600; font-size: 0.9rem; }
.synth-commune { font-size: 0.8rem; color: var(--muted-2); }
.synth-right { display: flex; align-items: center; gap: 14px; flex: none; }
.synth-counts { font-size: 0.8rem; color: var(--muted-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.synth-list .empty-state { padding: 16px; }
.synth-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.synth-page-btn {
  font: inherit; font-size: 0.85rem; font-weight: 600;
  padding: 7px 14px; border-radius: var(--radius-sm); cursor: pointer;
  background: #fff; color: var(--blue); border: 1px solid var(--line-strong);
  transition: background 0.12s ease, border-color 0.12s ease, opacity 0.12s ease;
}
.synth-page-btn:hover:not(:disabled) { border-color: var(--blue); background: var(--info-bg); }
.synth-page-btn:disabled { opacity: 0.4; cursor: default; }
.synth-page-info { font-size: 0.82rem; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
  .synth-stat-sig { margin-left: 0; }
  .synth-counts { display: none; }
  .synth-right { gap: 0; }
}
.fiche-head { display: flex; flex-direction: column; align-items: stretch; gap: 12px; margin-bottom: 18px; }
.fiche-head h2 { margin: 0; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; color: var(--blue); }
.fiche-search { position: relative; width: 100%; max-width: 520px; }
.fiche-search-row { display: flex; gap: 8px; align-items: stretch; }
.fiche-search-row .input { flex: 1; min-width: 0; }
.fiche-search .search-results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: #fff; z-index: 20; box-shadow: var(--shadow-soft); }

/* Bouton géolocalisation de la recherche de fiche */
.geo-btn {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 0 16px; white-space: nowrap;
  font: inherit; font-weight: 600; font-size: 0.9rem;
  color: var(--blue);
  background: var(--info-bg);
  border: 1px solid var(--blue);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s ease, opacity 0.12s ease;
}
.geo-btn span[aria-hidden] { font-size: 1.05rem; }
.geo-btn:hover { background: #d6e4fb; }
.geo-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.geo-btn:disabled { opacity: 0.6; cursor: default; }
.geo-btn.is-loading { animation: pulse 1s ease infinite; }
.fiche-nom { font-size: 1.18rem; font-weight: 700; }
.fiche-meta { color: var(--muted-2); font-size: 0.85rem; margin-top: 3px; }
.fiche-statut { margin-top: 14px; display: flex; flex-direction: column; gap: 14px; align-items: stretch; }
.fiche-conf { font-size: 0.82rem; color: var(--muted); }
.fiche-ok { color: var(--libre); font-weight: 600; font-size: 0.92rem; }

/* Tag d'état du lycée */
.fiche-etat { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.etat-tag {
  display: inline-flex; align-items: center;
  padding: 5px 14px; border-radius: 999px;
  font-size: 0.82rem; font-weight: 700; letter-spacing: 0.01em;
  border: 1px solid transparent;
}
.etat-tag.etat-ouvert { background: #e3f6ea; color: var(--libre); border-color: #bfe5cc; }
.etat-tag.etat-partiel { background: #fff3e0; color: #b35900; border-color: #ffd9a8; }
.etat-tag.etat-total { background: #fde8e8; color: var(--total); border-color: #f6c9c9; }

/* Jauges d'avancement vers le seuil */
.fiche-jauges { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 24px; }
.jauge { display: flex; flex-direction: column; gap: 7px; }
.jauge-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 0.82rem; }
.jauge-label { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; color: var(--ink); }
.jauge-label .dot { width: 9px; height: 9px; }
.jauge-val { font-weight: 700; color: var(--muted-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.jauge-track { height: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.jauge-fill { height: 100%; border-radius: 999px; min-width: 0; transition: width 0.4s ease; }
.jauge-fill-total { background: var(--total); }
.jauge-fill-partiel { background: var(--partiel); }
.jauge.is-atteint .jauge-val { color: var(--ink); }
.jauge.is-atteint .jauge-fill-total { box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08); }
.jauge-note { font-size: 0.78rem; color: var(--muted-2); margin: 2px 0 0; }

@media (max-width: 560px) {
  .fiche-jauges { grid-template-columns: 1fr; }
}
.fiche-histo { margin-top: 18px; }
.fiche-histo h3 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-2); margin: 0 0 10px; font-weight: 700; }
.fiche-histo ul { list-style: none; margin: 0 0 18px; padding: 0; }
.fiche-histo li { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 0.88rem; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.fiche-histo li:last-child { border-bottom: 0; }
.fiche-statut .popup-badge, .fiche-histo .popup-badge { margin-top: 0; }
.fiche-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); gap: 28px; align-items: start; }
.fiche-grid .fiche-histo { margin-top: 18px; }
.fiche-chart { margin-top: 18px; }
.fiche-chart h3 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-2); margin: 0 0 10px; font-weight: 700; }
.hc-legend { display: flex; gap: 14px; margin-bottom: 6px; font-size: 0.76rem; color: var(--muted-2); }
.hc-legend span { display: inline-flex; align-items: center; gap: 6px; }
.histo-chart { width: 100%; height: auto; display: block; }
.histo-chart .hc-axis { stroke: var(--line-strong); stroke-width: 1; }
.histo-chart .hc-x { fill: var(--muted-2); font-size: 9px; text-anchor: middle; }
.histo-chart .hc-x2 { fill: var(--muted-2); opacity: 0.8; }
.histo-chart .hc-val { fill: var(--muted); font-size: 9px; font-weight: 700; text-anchor: middle; }
.histo-chart path { transition: opacity 0.12s ease; }
.histo-chart path:hover { opacity: 0.82; }
@media (max-width: 760px) {
  .fiche-grid { grid-template-columns: 1fr; gap: 6px; }
}
.popup-badge.libre { background: var(--libre); }

/* ---------- Modale ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(22, 22, 22, 0.5); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 1000; }
.modal-overlay[hidden] { display: none; }
.modal { background: #fff; color: var(--ink); width: 100%; max-width: 500px; border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0, 0, 18, 0.28); max-height: 92vh; display: flex; flex-direction: column; border-top: 4px solid var(--blue); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 12px; }
.modal-head h2 { margin: 0; font-weight: 700; font-size: 1.25rem; }
.icon-btn { background: none; border: 0; font-size: 1.1rem; cursor: pointer; color: var(--muted-2); padding: 4px 8px; border-radius: 6px; line-height: 1; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.modal-body { padding: 4px 22px 8px; overflow: auto; }
.modal-foot { padding: 16px 22px 22px; }
.modal-foot .btn { width: 100%; }

.field-label { display: block; font-size: 0.82rem; font-weight: 700; color: var(--ink); margin: 18px 0 8px; }
.field-label:first-child { margin-top: 6px; }
.input { width: 100%; font: inherit; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line-strong); border-bottom: 2px solid var(--muted-2); border-radius: var(--radius-sm) var(--radius-sm) 0 0; padding: 11px 13px; }
.input::placeholder { color: #8b8b8b; }
.input:focus { outline: 2px solid var(--blue); outline-offset: 2px; }
textarea.input { resize: vertical; }

/* Bouton « Lycées autour de moi » (géolocalisation dans la modale) */
.btn-near {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  justify-content: center;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--blue);
  background: var(--info-bg);
  border: 1px solid var(--blue);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.12s ease;
}
.btn-near:hover { background: #d6e4fb; }
.btn-near:disabled { opacity: 0.6; cursor: default; }
.btn-near:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.search-sep {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
  color: var(--muted-2);
  font-size: 0.78rem;
}
.search-sep::before, .search-sep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line-strong);
}

.search-results { list-style: none; margin: 8px 0 0; padding: 0; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; max-height: 250px; overflow-y: auto; }
.search-results li { padding: 11px 14px; cursor: pointer; border-bottom: 1px solid var(--line); }
.search-results li:last-child { border-bottom: 0; }
.search-results li:hover, .search-results li.active { background: var(--surface-2); }
.search-results .r-name { font-weight: 600; font-size: 0.92rem; }
.search-results .r-meta { font-size: 0.8rem; color: var(--muted-2); }
.search-results .r-dist { font-weight: 600; font-size: 0.78rem; color: var(--blue); background: var(--info-bg); border-radius: 10px; padding: 1px 8px; margin-left: 4px; white-space: nowrap; }
.search-results .r-empty { color: var(--muted-2); cursor: default; font-size: 0.88rem; }

.selected-school { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--info-bg); border-left: 4px solid var(--blue); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 12px 14px; margin-top: 8px; }
.selected-name { font-weight: 600; font-size: 0.92rem; }
.link-btn { background: none; border: 0; color: var(--blue); cursor: pointer; font: inherit; font-size: 0.84rem; text-decoration: underline; white-space: nowrap; }

.statut-field { border: 0; padding: 0; margin: 0; }
.statut-field[disabled] { opacity: 0.4; }
.radio { display: flex; align-items: flex-start; gap: 11px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); margin-bottom: 9px; cursor: pointer; font-size: 0.9rem; transition: border-color 0.12s ease, background 0.12s ease; }
.radio:hover { background: var(--surface-2); }
.radio:has(input:checked) { border-color: var(--blue); background: var(--info-bg); }
.radio input { margin-top: 3px; accent-color: var(--blue); }

.form-msg { margin: 14px 0 0; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 0.88rem; }
.form-msg.ok { background: #e3f6ea; color: var(--libre); border-left: 4px solid var(--libre); }
.form-msg.err { background: #fde8e8; color: var(--total); border-left: 4px solid var(--total); }
.form-msg.info { background: var(--info-bg); color: var(--blue); border-left: 4px solid var(--blue); }

.modal-note {
  margin: 14px 0 0;
  padding: 11px 13px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--muted);
}

/* ---------- Regroupements (clusters) : palette blocage, jamais de vert ---------- */
.marker-cluster-small { background-color: rgba(254, 178, 76, 0.45); }
.marker-cluster-small div { background-color: rgba(253, 141, 60, 0.92); }
.marker-cluster-medium { background-color: rgba(240, 59, 32, 0.4); }
.marker-cluster-medium div { background-color: rgba(240, 59, 32, 0.92); }
.marker-cluster-large { background-color: rgba(189, 0, 38, 0.4); }
.marker-cluster-large div { background-color: rgba(189, 0, 38, 0.92); }
.marker-cluster div { color: #fff; font-weight: 700; }

/* ---------- Contrôles Leaflet ---------- */
.recenter-ctrl a { display: flex; align-items: center; justify-content: center; color: var(--navy); }
.recenter-ctrl a:hover { color: var(--blue); }
.leaflet-control-layers { border: 1px solid var(--line-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-soft); padding: 4px; }
.leaflet-control-layers-expanded { padding: 10px 12px; font-size: 0.86rem; }
.leaflet-control-layers label { margin: 3px 0; cursor: pointer; }
.choro-legend { background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-soft); padding: 10px 12px; font-size: 0.78rem; color: var(--muted); line-height: 1.5; }
.choro-legend strong { display: block; color: var(--ink); margin-bottom: 6px; font-size: 0.8rem; }
.choro-legend i { width: 14px; height: 14px; display: inline-block; margin-right: 7px; vertical-align: -2px; border: 1px solid rgba(0,0,0,0.1); }

/* ---------- Popup ---------- */
.leaflet-popup-content-wrapper { border-radius: 8px; }
.leaflet-popup-content { margin: 13px 15px; font-size: 0.88rem; }
.popup-name { font-weight: 700; margin-bottom: 2px; }
.popup-meta { color: #666; font-size: 0.82rem; }
.popup-badge { display: inline-block; margin-top: 7px; padding: 2px 10px; border-radius: 4px; font-size: 0.75rem; font-weight: 700; color: #fff; }
.popup-badge.total { background: var(--total); }
.popup-badge.partiel { background: var(--partiel); }
.popup-conf { margin-top: 7px; font-size: 0.8rem; color: #555; }

/* ---------- Pied de page ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface-2); padding: 12px 0; margin-top: auto; }
.site-footer p { margin: 0; font-size: 0.82rem; color: var(--muted-2); text-align: center; }
.site-footer a { color: var(--blue); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  #map { height: 420px; }
  .hero-band { padding: 12px 0 0; }
  .brand-logo { width: 46px; height: 46px; }
}
@media (max-width: 760px) {
  .header-count-label { display: none; }
  .header-right { gap: 10px; }
}
@media (max-width: 560px) {
  .stat-tile { padding: 18px; min-height: 104px; }
  .stat-value { font-size: 2.1rem; }
  .brand-name { font-size: 1.15rem; }
  .btn-primary { padding: 9px 15px; font-size: 0.9rem; }
}
@media (max-width: 480px) {
  /* En-tête compact : bouton « Signaler », badge masqué (le chiffre est déjà dans les tuiles) */
  #btn-signaler .btn-label-full { display: none; }
  #btn-signaler .btn-label-short { display: inline; }
  .header-count { display: none; }
  .header-inner { gap: 10px; }
  .brand-name { font-size: 1.02rem; }
  .brand-logo { width: 42px; height: 42px; }
}
@media (max-width: 440px) {
  /* Écran étroit : bouton géoloc en icône seule */
  .geo-btn-label { display: none; }
  .geo-btn { padding: 0 13px; }
}
@media (max-width: 400px) {
  /* Indicateurs en 1 colonne (compacts) */
  .stats { grid-template-columns: 1fr; gap: 12px; }
  .stat-tile { min-height: auto; padding: 14px 16px; }
  .stat-value { font-size: 1.9rem; }
  /* Pagination synthèse : les boutons restent aux extrémités, l'info passe dessous */
  .synth-pagination { flex-wrap: wrap; }
  .synth-page-info { order: 2; flex-basis: 100%; margin-top: 8px; }
}
