/* Interface Lugaxis V2.
   Toutes les couleurs sont des variables (« tokens ») définies ici une seule
   fois, en mode clair puis en mode sombre. */

:root {
  color-scheme: light;
  --fond: #f4f5f7;
  --surface: #fcfcfb;
  --surface-2: #f3f4f6;
  --bordure: #e3e5e9;
  --bordure-forte: #cfd3d9;
  --texte: #0b0b0b;
  --texte-2: #52514e;
  --texte-3: #7c7b77;
  --accent: #1c5cab;
  --accent-fort: #184f95;
  --accent-doux: #e8f0fb;
  --ombre: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 16px rgba(16, 24, 40, 0.06);
  --ombre-forte: 0 8px 30px rgba(16, 24, 40, 0.14);

  /* Zones : un seul bleu, du plus foncé (proche) au plus clair (lointain) */
  --zone-p: #1c5cab;
  --zone-s: #3987e5;
  --zone-t: #86b6ef;
  /* Concurrents */
  --concurrent: #eb6834;

  /* États */
  --ok: #0ca30c;
  --alerte: #fab219;
  --alerte-fond: #fff7e6;
  --alerte-texte: #7a4b00;
  --critique: #d03b3b;
  --critique-fond: #fdecec;

  --rayon: 12px;
  --rayon-petit: 8px;
  --police: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --chiffres: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --fond: #121211;
    --surface: #1a1a19;
    --surface-2: #232321;
    --bordure: #31312e;
    --bordure-forte: #44443f;
    --texte: #f0efec;
    --texte-2: #c3c2b7;
    --texte-3: #93928a;
    --accent: #3987e5;
    --accent-fort: #5598e7;
    --accent-doux: #1b2a3f;
    --ombre: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
    --ombre-forte: 0 8px 30px rgba(0, 0, 0, 0.5);
    --alerte-fond: #2e2411;
    --alerte-texte: #f5d48a;
    --critique-fond: #331a1a;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --fond: #121211;
  --surface: #1a1a19;
  --surface-2: #232321;
  --bordure: #31312e;
  --bordure-forte: #44443f;
  --texte: #f0efec;
  --texte-2: #c3c2b7;
  --texte-3: #93928a;
  --accent: #3987e5;
  --accent-fort: #5598e7;
  --accent-doux: #1b2a3f;
  --ombre: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
  --ombre-forte: 0 8px 30px rgba(0, 0, 0, 0.5);
  --alerte-fond: #2e2411;
  --alerte-texte: #f5d48a;
  --critique-fond: #331a1a;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--police);
  font-size: 14px;
  line-height: 1.45;
  color: var(--texte);
  background: var(--fond);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }

/* ---------- Mise en page : panneau à gauche, carte à droite ---------- */
.app { display: flex; height: 100vh; }
.panneau {
  width: 440px;
  flex: none;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--bordure);
  z-index: 2;
  box-shadow: var(--ombre);
}
.zone-carte { position: relative; flex: 1; min-width: 0; overflow: hidden; }
#carte { position: absolute; inset: 0; background: var(--surface-2); }

/* ---------- En-tête ---------- */
.entete {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px;
}
.marque { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.marque-logo { height: 36px; width: auto; display: block; }
.marque-nom { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.marque-sous-titre { color: var(--texte-3); font-size: 12.5px; }
.etat-api {
  display: inline-flex; align-items: center; gap: 6px; flex: none; white-space: nowrap;
  font-size: 12px; color: var(--texte-2);
  padding: 4px 9px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--bordure);
}
.pastille { width: 7px; height: 7px; border-radius: 50%; background: var(--texte-3); }
.etat-api.ok .pastille { background: var(--ok); box-shadow: 0 0 0 3px rgba(12, 163, 12, 0.15); }
.etat-api.ko .pastille { background: var(--critique); }

/* ---------- Onglets ---------- */
.onglets {
  display: flex; gap: 4px; margin: 0 20px;
  padding: 3px; border-radius: 10px; background: var(--surface-2);
  border: 1px solid var(--bordure);
}
.onglet {
  flex: 1; border: 0; background: transparent; cursor: pointer;
  padding: 7px 10px; border-radius: 8px; font-weight: 500; color: var(--texte-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  white-space: nowrap;
}
.onglet.actif { background: var(--surface); color: var(--texte); box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12); }
.compteur {
  min-width: 20px; padding: 0 6px; border-radius: 999px; font-size: 11.5px;
  background: var(--accent-doux); color: var(--accent); font-weight: 600;
}

.contenu { flex: 1; overflow-y: auto; padding: 16px 20px 24px; }
.pied {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 14px 8px 12px; border-top: 1px solid var(--bordure);
  font-size: 12px; color: var(--texte-3);
}
.pied-liens a { color: var(--texte-3); }
.bouton-reglages {
  display: inline-flex; align-items: center; gap: 8px; max-width: 60%;
  height: 34px; padding: 0 10px 0 8px; border-radius: 9px; cursor: pointer;
  border: 1px solid transparent; background: none; color: var(--texte-2); font: inherit; font-weight: 600;
  transition: background 0.15s, color 0.15s;
}
.bouton-reglages span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bouton-reglages svg {
  width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round; transition: transform 0.4s;
}
.bouton-reglages:hover, .bouton-reglages.actif { background: var(--surface-2); color: var(--texte); }
.bouton-reglages:hover svg { transform: rotate(45deg); }
.bouton-reglages.actif { border-color: var(--bordure); }
.vue-titre { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.vue-titre h2 { margin: 0; font-size: 17px; }
.lien-retour {
  border: 1px solid var(--bordure); background: var(--surface); border-radius: 8px; cursor: pointer;
  height: 30px; padding: 0 10px; color: var(--texte-2); font: inherit; font-size: 12.5px;
}
.lien-retour:hover { color: var(--texte); background: var(--surface-2); }

/* ---------- Formulaire ---------- */
.carte-form { display: flex; flex-direction: column; gap: 14px; }
.champ { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.champ label { font-size: 12.5px; font-weight: 600; color: var(--texte-2); }
.rangee { display: flex; gap: 12px; }
.rangee .champ { width: 110px; }
.rangee .champ-large { flex: 1; width: auto; }
input[type="text"], input[type="number"], input[type="password"], input[type="email"], input[type="search"], select {
  width: 100%; height: 38px; padding: 0 11px;
  border: 1px solid var(--bordure-forte); border-radius: var(--rayon-petit);
  background: var(--surface); outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-doux); }
.avec-unite { position: relative; }
.avec-unite input { padding-right: 36px; }
.avec-unite span { position: absolute; right: 11px; top: 9px; color: var(--texte-3); pointer-events: none; }
.aide { margin: 0; font-size: 12px; color: var(--texte-3); }

.point {
  display: flex; align-items: center; gap: 8px;
  min-height: 38px; padding: 8px 11px;
  border: 1px dashed var(--bordure-forte); border-radius: var(--rayon-petit);
  color: var(--texte-3); background: var(--surface-2);
}
.point svg { width: 16px; height: 16px; fill: currentColor; flex: none; }
.point.pose { border-style: solid; color: var(--texte); background: var(--surface); }
.point.pose svg { fill: var(--critique); }

.segments {
  display: flex; padding: 3px; gap: 3px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--bordure);
}
.segments button {
  flex: 1; border: 0; background: transparent; cursor: pointer;
  padding: 7px 8px; border-radius: 7px; color: var(--texte-2); font-weight: 500;
}
.segments button[aria-checked="true"] {
  background: var(--surface); color: var(--texte); box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12);
}

.bouton-principal {
  position: relative; height: 44px; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--accent); color: #ffffff; font-weight: 600; font-size: 14.5px;
  transition: background 0.15s, transform 0.05s;
}
.bouton-principal:hover:not(:disabled) { background: var(--accent-fort); }
.bouton-principal:active:not(:disabled) { transform: translateY(1px); }
.bouton-principal:disabled { opacity: 0.45; cursor: not-allowed; }
.roue {
  display: none; position: absolute; right: 16px; top: 13px;
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4); border-top-color: #ffffff;
  animation: tourne 0.7s linear infinite;
}
.en-cours .roue { display: block; }
@keyframes tourne { to { transform: rotate(360deg); } }
.erreur {
  margin: 0; padding: 10px 12px; border-radius: var(--rayon-petit);
  background: var(--critique-fond); color: var(--critique); font-size: 13px;
}

.secondaire {
  text-decoration: none; color: var(--texte); box-sizing: border-box;
  height: 36px; padding: 0 12px; border-radius: var(--rayon-petit); cursor: pointer;
  border: 1px solid var(--bordure-forte); background: var(--surface); font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
}
.secondaire:hover { background: var(--surface-2); }
.secondaire svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }

/* ---------- Résultats ---------- */
.resultats { margin-top: 22px; display: flex; flex-direction: column; gap: 14px; animation: apparait 0.25s ease-out; }
@keyframes apparait { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.separateur { height: 1px; background: var(--bordure); margin: 0 -20px 4px; }
.titre-section {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  margin: 0; font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--texte-3);
}
.titre-section small { text-transform: none; letter-spacing: 0; font-weight: 500; }

.hero {
  padding: 18px; border-radius: var(--rayon);
  background: linear-gradient(135deg, var(--accent-doux), var(--surface) 70%);
  border: 1px solid var(--bordure);
}
.hero-libelle { font-size: 12.5px; color: var(--texte-2); font-weight: 500; }
.hero-valeur {
  font-family: var(--chiffres); font-size: 38px; font-weight: 700; letter-spacing: -0.02em;
  line-height: 1.1; margin: 4px 0 2px; font-variant-numeric: tabular-nums;
}
.hero-valeur small { font-size: 20px; font-weight: 600; color: var(--texte-2); margin-left: 4px; }
.hero-detail { font-size: 12.5px; color: var(--texte-3); font-variant-numeric: tabular-nums; }

.tuiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tuile {
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--bordure); background: var(--surface);
}
.tuile-libelle { font-size: 11.5px; color: var(--texte-3); }
.tuile-valeur { font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 2px; }

.alerte {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 10px 12px; border-radius: var(--rayon-petit);
  background: var(--alerte-fond); color: var(--alerte-texte); font-size: 13px;
}
.alerte svg { width: 16px; height: 16px; flex: none; margin-top: 1px; fill: var(--alerte); }

/* Barre de répartition du CA par zone */
.repartition { display: flex; gap: 2px; height: 14px; }
.repartition div { min-width: 3px; transition: opacity 0.15s; cursor: default; }
.repartition div:first-child { border-radius: 4px 0 0 4px; }
.repartition div:last-child { border-radius: 0 4px 4px 0; }
.repartition div:only-child { border-radius: 4px; }
.repartition:hover div { opacity: 0.55; }
.repartition div:hover { opacity: 1; }
.repartition-legende { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--texte-2); }
.repartition-legende span { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.puce { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }

/* Tableau par zone */
.tableau-conteneur { overflow-x: auto; border: 1px solid var(--bordure); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 12.5px; }
th, td { padding: 8px 8px; text-align: right; white-space: nowrap; }
th:first-child, td:first-child { padding-left: 10px; }
th:last-child, td:last-child { padding-right: 10px; }
th:first-child, td:first-child { text-align: left; }
thead th { font-weight: 600; color: var(--texte-3); background: var(--surface-2); font-size: 11.5px; }
tbody tr + tr td { border-top: 1px solid var(--bordure); }
tfoot td { border-top: 1px solid var(--bordure-forte); font-weight: 650; }
.nom-zone { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; }
.corrige { color: var(--critique); font-weight: 600; }

/* Cascade des ajustements */
.cascade { display: flex; flex-direction: column; }
.etape {
  display: grid; grid-template-columns: 22px 1fr; gap: 0 10px;
  padding-bottom: 14px; position: relative;
}
.etape:not(:last-child)::before {
  content: ""; position: absolute; left: 10px; top: 22px; bottom: 0;
  width: 2px; background: var(--bordure);
}
.etape-num {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; background: var(--surface-2);
  border: 1px solid var(--bordure-forte); color: var(--texte-2); z-index: 1;
}
.etape.active .etape-num { background: var(--accent); border-color: var(--accent); color: #ffffff; }
.etape-titre { font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.etape-valeurs { font-variant-numeric: tabular-nums; color: var(--texte-2); font-size: 12.5px; margin-top: 1px; }
.etape-valeurs strong { color: var(--texte); }
.ecart { font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px; white-space: nowrap; }
.ecart.hausse { background: rgba(12, 163, 12, 0.12); color: #0a7f0a; }
.ecart.baisse { background: var(--critique-fond); color: var(--critique); }
.ecart.neutre { background: var(--surface-2); color: var(--texte-3); }
.etape-detail { font-size: 12px; color: var(--texte-3); margin-top: 2px; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mention { font-size: 12px; color: var(--texte-3); margin: 0; }

/* ---------- Études enregistrées ---------- */
.liste-etudes { display: flex; flex-direction: column; gap: 8px; }
.etude {
  display: flex; align-items: stretch; border-radius: 10px;
  border: 1px solid var(--bordure); background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.etude:hover { border-color: var(--accent); box-shadow: var(--ombre); }
.etude-ouvrir {
  flex: 1; min-width: 0; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px;
  text-align: left; padding: 12px 14px; border: 0; background: none; cursor: pointer;
  color: inherit; font: inherit; border-radius: 10px;
}
.etude-nom { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.etude-ca { font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; }
.etude-meta { grid-column: 1 / -1; font-size: 12px; color: var(--texte-3); }
.vide { text-align: center; color: var(--texte-3); padding: 40px 10px; }

/* ---------- Carte : légende, invite, éléments Leaflet ---------- */
.legende-ligne { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.cle { width: 14px; height: 14px; border-radius: 4px; }
.cle-p { background: var(--zone-p); }
.cle-s { background: var(--zone-s); }
.cle-t { background: var(--zone-t); }
.legende-classes { display: flex; gap: 8px; margin-top: 4px; }
.legende-classes span { display: inline-flex; align-items: center; gap: 4px; }
.legende-classes i { width: 12px; height: 12px; border-radius: 3px; opacity: 0.8; }
.cle-rond {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--concurrent); border: 2px solid #ffffff; box-shadow: 0 0 0 1px var(--concurrent);
}
.cle-rond-vide { background: #ffffff; }

.invite-carte {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%); z-index: 500;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 999px; font-weight: 500;
  background: var(--texte); color: var(--surface); box-shadow: var(--ombre-forte);
  pointer-events: none; transition: opacity 0.3s;
  max-width: calc(100% - 32px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.invite-carte svg { width: 16px; height: 16px; fill: currentColor; }
.invite-carte.cachee { opacity: 0; }

/* Fond de carte légèrement désaturé pour que les données ressortent */
.fond-attenue { filter: saturate(0.35) contrast(0.95) brightness(1.03); }
:root[data-theme="dark"] .fond-attenue { filter: saturate(0.3) brightness(0.75) contrast(1.1); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .fond-attenue { filter: saturate(0.3) brightness(0.75) contrast(1.1); }
}

.leaflet-container { font-family: var(--police); cursor: crosshair; }
.leaflet-interactive { cursor: pointer; }
.leaflet-tooltip {
  border: 1px solid var(--bordure); border-radius: 8px; box-shadow: var(--ombre);
  background: var(--surface); color: var(--texte); padding: 6px 9px; font-size: 12.5px;
}
.leaflet-tooltip-top::before { border-top-color: var(--surface); }
.leaflet-bar a { background: var(--surface); color: var(--texte); border-color: var(--bordure); }
.leaflet-control-layers {
  border-radius: 10px !important; border: 1px solid var(--bordure) !important;
  background: var(--surface); color: var(--texte); box-shadow: var(--ombre) !important;
}
.marqueur-projet { filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.35)); }

/* ---------- Petits écrans : carte en haut, panneau en dessous ---------- */
@media (max-width: 820px) {
  .app { flex-direction: column-reverse; height: auto; min-height: 100vh; }
  .panneau { width: 100%; border-right: 0; border-top: 1px solid var(--bordure); }
  .zone-carte { height: 55vh; flex: none; }
  .contenu { overflow: visible; padding: 16px; }
  .separateur { margin: 0 -16px 4px; }
  table { font-size: 12px; }
  th, td { padding: 7px 5px; }
  th:first-child, td:first-child { padding-left: 8px; }
  th:last-child, td:last-child { padding-right: 8px; }
  .entete, .pied { padding-left: 16px; padding-right: 16px; }
  .onglets { margin: 0 16px; }
  .invite-carte { font-size: 12.5px; }
  .onglet { font-size: 13px; padding: 7px 6px; }
  .hero-valeur { font-size: 32px; }
}

/* ---------- Bascule d'une couche (légende) ---------- */
.bascule {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-weight: 600; color: var(--texte); font-size: 12px; cursor: pointer; user-select: none;
}
.bascule input {
  appearance: none; flex: none; position: relative; width: 30px; height: 17px; margin: 0;
  border-radius: 999px; background: var(--bordure-forte); cursor: pointer; transition: background 0.15s;
}
.bascule input::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px;
  border-radius: 50%; background: #ffffff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s;
}
.bascule input:checked { background: var(--accent); }
.bascule input:checked::after { transform: translateX(13px); }
.bascule input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Utilisateur connecté (pied du panneau) ---------- */
.lien-discret {
  border: 0; background: none; padding: 0; cursor: pointer;
  color: var(--accent); font: inherit; text-decoration: underline;
}

/* ---------- Portail de connexion ---------- */
.page-connexion {
  display: flex; align-items: center; justify-content: center; min-height: 100%;
  background:
    radial-gradient(circle at 50% 38%, var(--accent-doux) 0, transparent 60%),
    var(--fond);
}
.portail { width: 100%; max-width: 380px; padding: 24px 16px; box-sizing: border-box; }
.portail-carte {
  padding: 32px 28px 28px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--bordure); box-shadow: var(--ombre-forte);
}
.portail-marque { text-align: center; margin-bottom: 26px; }
.portail-logo-image { width: 220px; height: auto; display: block; margin: 0 auto 12px; }
.portail-sous-titre { color: var(--texte-3); font-size: 13px; margin-top: 2px; }
#formulaire-connexion { display: flex; flex-direction: column; gap: 14px; }
#formulaire-connexion input { height: 42px; }
.portail-pied { text-align: center; color: var(--texte-3); font-size: 12px; margin-top: 18px; }

/* ---------- Bouton icône (suppression) ---------- */
.bouton-icone {
  flex: none; align-self: center; width: 34px; height: 34px; margin-right: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 8px; background: none; cursor: pointer;
  color: var(--texte-3); transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.bouton-icone svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; }
.bouton-icone-neutre:hover { color: var(--accent) !important; background: var(--accent-doux) !important; border-color: var(--accent-doux) !important; }
.bouton-icone + .bouton-icone { margin-left: -6px; }
.bouton-icone:hover { color: var(--critique); background: var(--critique-fond); border-color: var(--critique-fond); }
.bouton-icone:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- Paramètres ---------- */
.bloc {
  padding: 16px; border-radius: var(--rayon); margin-bottom: 14px;
  border: 1px solid var(--bordure); background: var(--surface);
}
.bloc-titre { margin: 0 0 12px; font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.bloc-sous-titre { margin: 18px 0 8px; font-size: 13px; font-weight: 650; color: var(--texte-2); }
.carte-form .bloc-sous-titre { margin-top: 6px; margin-bottom: 0; }
.fiche-compte { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 13px; }
.fiche-compte dt { color: var(--texte-3); }
.fiche-compte dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }
.aide-inline { font-weight: 400; color: var(--texte-3); margin-left: 4px; }
.badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
  background: var(--surface-2); color: var(--texte-2); border: 1px solid var(--bordure);
}
.badge-admin { background: var(--accent-doux); color: var(--accent); border-color: transparent; }
.message { margin: 0; padding: 10px 12px; border-radius: var(--rayon-petit); font-size: 13px; }
.message.ok { background: rgba(12, 163, 12, 0.1); color: #0a7f0a; }
.message.ko { background: var(--critique-fond); color: var(--critique); }
.message.info { background: var(--alerte-fond); color: var(--alerte-texte); }
.lien-invitation { display: flex; gap: 6px; margin-top: 8px; }
.lien-invitation input { flex: 1; min-width: 0; height: 34px; font-size: 12px; }
.liste-admin { display: flex; flex-direction: column; border: 1px solid var(--bordure); border-radius: 10px; overflow: hidden; }
.ligne-admin { display: flex; align-items: center; gap: 10px; padding: 8px 4px 8px 12px; font-size: 13px; }
.ligne-admin + .ligne-admin { border-top: 1px solid var(--bordure); }
.ligne-admin-texte { flex: 1; min-width: 0; }
.ligne-admin-titre { font-weight: 600; display: flex; align-items: center; gap: 6px; overflow-wrap: anywhere; }
.ligne-admin-meta { font-size: 12px; color: var(--texte-3); overflow-wrap: anywhere; }
.ligne-admin select { width: auto; height: 30px; font-size: 12px; padding: 0 6px; }
.liste-admin .vide { padding: 14px; font-size: 12.5px; }
.portail-accueil { margin: 0 0 16px; font-size: 13.5px; color: var(--texte-2); text-align: center; }
#formulaire-activation { display: flex; flex-direction: column; gap: 14px; }
#formulaire-activation input { height: 42px; }
#erreur-activation { margin-top: 14px; }
#form-mot-de-passe { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--bordure); }

/* ---------- Panneau « Carte » : fonds et couches ---------- */
.panneau-couches {
  position: absolute; top: 12px; right: 12px; z-index: 800;
  display: flex; flex-direction: column; align-items: flex-end;
  max-height: calc(100% - 24px);
}
.couches-bouton {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--bordure); cursor: pointer;
  background: var(--surface); color: var(--texte); font-weight: 600; font-size: 13px;
  box-shadow: var(--ombre-forte);
}
.couches-bouton:hover { border-color: var(--accent); }
.couches-bouton[hidden] { display: none; }
.couches-bouton svg, .couches-titre svg {
  width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round;
}
.couches-corps {
  width: 300px; max-height: 100%; overflow-y: auto; box-sizing: border-box;
  border-radius: 14px; border: 1px solid var(--bordure);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--ombre-forte);
}
.couches-entete {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 10px 8px 16px;
}
.couches-titre { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; font-size: 14px; }
.couches-titre svg { color: var(--accent); }
.couches-fermer {
  width: 30px; height: 30px; border: 0; border-radius: 8px; background: none; cursor: pointer;
  color: var(--texte-3); display: inline-flex; align-items: center; justify-content: center;
}
.couches-fermer:hover { background: var(--surface-2); color: var(--texte); }
.couches-fermer svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; }
.couches-section { padding: 6px 16px 14px; }
.couches-section + .couches-section { border-top: 1px solid var(--bordure); padding-top: 12px; }
.couches-section-titre {
  font-size: 11px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--texte-3); margin-bottom: 8px;
}

/* Fonds de carte : vignettes */
.fonds { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.fond {
  display: flex; flex-direction: column; gap: 5px; padding: 0; border: 0; background: none;
  cursor: pointer; color: var(--texte-2); font-size: 11.5px; font-weight: 500; text-align: center;
}
.fond img {
  width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; display: block;
  border: 2px solid var(--bordure); box-sizing: border-box; background: var(--surface-2);
  transition: border-color 0.15s, transform 0.15s;
}
.fond:hover img { transform: translateY(-1px); border-color: var(--bordure-forte); }
.fond[aria-checked="true"] { color: var(--accent); font-weight: 650; }
.fond[aria-checked="true"] img { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-doux); }
.fond:focus-visible img { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Couches : une carte par couche, légende et opacité visibles quand elle est affichée */
.couche { border-radius: 10px; transition: background 0.15s; }
.couche + .couche { margin-top: 4px; }
.couche-ligne { display: flex; align-items: center; gap: 10px; padding: 8px 6px; }
.couche-icone { flex: none; width: 30px; height: 30px; border-radius: 8px; position: relative; }
.icone-zones {
  background: radial-gradient(circle, var(--zone-p) 0 22%, var(--zone-s) 23% 45%, var(--zone-t) 46% 70%, var(--surface-2) 71%);
}
.icone-concurrents {
  background:
    radial-gradient(circle at 35% 40%, var(--concurrent) 0 4px, transparent 5px),
    radial-gradient(circle at 68% 64%, var(--concurrent) 0 6px, transparent 7px),
    var(--surface-2);
}
.icone-alveoles {
  background:
    linear-gradient(135deg, #2e2180 0 25%, #4535b0 25% 50%, #8a7fe2 50% 75%, #b0a8ef 75%);
}
.icone-etudes {
  background:
    radial-gradient(circle at 50% 50%, #ffffff 0 3px, var(--accent) 4px 7px, transparent 8px),
    var(--surface-2);
}
.couche-texte { flex: 1; min-width: 0; }
.couche-nom { font-weight: 600; font-size: 13px; color: var(--texte); }
.couche-source { font-size: 11.5px; color: var(--texte-3); }
.couche:not(.active) .couche-icone { filter: grayscale(1); opacity: 0.45; }
.couche:not(.active) .couche-nom { color: var(--texte-2); }
.couche-details { display: none; padding: 0 6px 10px 46px; font-size: 12px; color: var(--texte-2); }
.couche.active .couche-details { display: block; }
.couche.active { background: var(--surface-2); }
.couche-details .legende-ligne { margin-top: 3px; }
.couche-details .legende-classes { margin: 2px 0 2px; }
.opacite {
  display: grid; grid-template-columns: auto 1fr 38px; align-items: center; gap: 8px;
  margin-top: 8px; font-size: 11.5px; color: var(--texte-3);
}
.opacite output { text-align: right; font-variant-numeric: tabular-nums; color: var(--texte-2); }
.opacite input[type="range"] { width: 100%; accent-color: var(--accent); margin: 0; }

/* Zones lisibles sur l'imagerie satellite : liseré blanc autour du contour coloré */
.fond-image .leaflet-zones-pane svg { filter: drop-shadow(0 0 1.5px #ffffff) drop-shadow(0 0 1px #ffffff); }

@media (max-width: 760px) {
  .panneau-couches { top: 8px; right: 8px; }
  .couches-corps { width: min(300px, calc(100vw - 16px)); }
}

/* ---------- Liste des études : recherche, filtre, comparaison, modification ---------- */
.outils-etudes { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.outils-etudes input[type="search"] { flex: 1; min-width: 0; }
.bascule-texte { font-weight: 500; color: var(--texte-2); font-size: 12.5px; white-space: nowrap; }
.etude-cocher { flex: none; display: flex; align-items: center; padding-left: 12px; cursor: pointer; }
.etude-cocher input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; margin: 0; }
.etude.selectionnee { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-doux); }
.etude-note {
  grid-column: 1 / -1; font-size: 12px; color: var(--texte-2); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.etude-note::before { content: "✎ "; color: var(--texte-3); }
.barre-comparaison {
  position: sticky; bottom: -24px; margin: 12px -20px -24px; padding: 10px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--surface); border-top: 1px solid var(--bordure); font-size: 12.5px; color: var(--texte-2);
}
.bouton-compact { height: 36px; padding: 0 16px; font-size: 13.5px; }
.dialogue {
  width: min(440px, calc(100vw - 32px)); padding: 20px; border-radius: 14px; box-sizing: border-box;
  border: 1px solid var(--bordure); background: var(--surface); color: var(--texte); box-shadow: var(--ombre-forte);
}
.dialogue::backdrop { background: rgba(16, 24, 40, 0.35); }
.dialogue textarea {
  width: 100%; box-sizing: border-box; padding: 9px 11px; resize: vertical; font: inherit;
  border: 1px solid var(--bordure-forte); border-radius: var(--rayon-petit); background: var(--surface); color: var(--texte);
}
.dialogue textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-doux); }
.actions-droite { justify-content: flex-end; }
.discret { color: var(--texte-3); font-weight: 400; }

/* ---------- Mot de passe oublié, courriel du compte ---------- */
.lien-oubli { display: block; text-align: center; margin-top: 14px; font-size: 13px; color: var(--accent); }
.formulaire-portail { display: flex; flex-direction: column; gap: 14px; }
.formulaire-portail input { height: 42px; }
.ligne-formulaire { display: flex; gap: 8px; margin-top: 12px; }
.ligne-formulaire input { flex: 1; min-width: 0; }
#message-email, #message-comptes { margin-top: 8px; }

/* ---------- Recherche d'adresse sur la carte ---------- */
.recherche-carte {
  position: absolute; top: 12px; left: 12px; z-index: 800; width: min(340px, calc(100% - 24px));
}
.recherche-carte > svg {
  position: absolute; left: 13px; top: 12px; width: 17px; height: 17px; pointer-events: none;
  fill: none; stroke: var(--texte-3); stroke-width: 2; stroke-linecap: round;
}
.recherche-carte input {
  width: 100%; height: 42px; padding: 0 14px 0 38px; box-sizing: border-box; border-radius: 999px;
  border: 1px solid var(--bordure); background: var(--surface); box-shadow: var(--ombre-forte);
}
.resultats-adresse {
  margin-top: 6px; border-radius: 12px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--bordure); box-shadow: var(--ombre-forte);
}
.resultat-adresse {
  display: block; width: 100%; text-align: left; padding: 9px 14px; border: 0; background: none;
  cursor: pointer; color: var(--texte); font: inherit;
}
.resultat-adresse + .resultat-adresse { border-top: 1px solid var(--bordure); }
.resultat-adresse:hover, .resultat-adresse:focus-visible { background: var(--accent-doux); outline: none; }
.resultat-adresse strong { display: block; font-size: 13px; }
.resultat-adresse span { display: block; font-size: 11.5px; color: var(--texte-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resultats-adresse .info-recherche { padding: 9px 14px; font-size: 12.5px; color: var(--texte-2); }
.resultats-adresse .source-recherche { padding: 5px 14px; font-size: 10.5px; color: var(--texte-3);
  border-top: 1px solid var(--bordure); background: var(--surface-2); }
/* L'invite centrale passe sous la barre de recherche */
.invite-carte { top: 64px; }
