/* =====================================================================
   Thèmes : clair (défaut), nuit, signalisation – choisis dans « Affichage »
   (« Auto » suit le réglage clair/sombre du téléphone ou de l'ordinateur)
   ===================================================================== */
:root, [data-theme=clair] {
  --fond: #f5f6f8; --carte: #ffffff; --carte-2: #eef0f3; --texte: #0f172a; --gris: #5b6474; --bord: #e3e7ed;
  --accent: #2563eb; --accent-texte: #ffffff; --entete: #ffffff; --entete-texte: #0f172a; --entete-bord: #e3e7ed;
  --marine: #2563eb; --bleu: #2563eb; --vert: #15803d; --orange: #d97706; --rouge: #dc2626;
  --sur-vert: #ffffff; --sur-orange: #ffffff; --sur-rouge: #ffffff;
  --ok-fond: #e7f6ec; --ok-texte: #166534; --att-fond: #fff3dc; --att-texte: #92400e; --pb-fond: #fde8e8; --pb-texte: #b42318;
  --note-fond: #fff6e0; --note-texte: #6b4600; --toast: #0f172a; --toast-texte: #ffffff;
  --rayon: 16px; --rayon-btn: 12px; --ombre: 0 6px 24px rgba(15,23,42,.08); --cadre: 1px solid var(--bord);
  --police: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --police-titre: var(--police);
  --casse-titre: none; --poids-titre: 700; --espace-titre: -0.01em; --carte-fond: #e9edf2;
}
[data-theme=nuit] {
  --fond: #0b1220; --carte: #131c2e; --carte-2: #1c2740; --texte: #eaf0fa; --gris: #9aa8c2; --bord: #24314b;
  --accent: #4cc9f0; --accent-texte: #04121c; --entete: #0a101c; --entete-texte: #eaf0fa; --entete-bord: #1c2740;
  --marine: #4cc9f0; --bleu: #4cc9f0; --vert: #3dd68c; --orange: #ffb020; --rouge: #ff6b6b;
  --sur-vert: #04121c; --sur-orange: #1a1200; --sur-rouge: #1a0505;
  --ok-fond: rgba(61,214,140,.15); --ok-texte: #3dd68c; --att-fond: rgba(255,176,32,.15); --att-texte: #ffc95c; --pb-fond: rgba(255,107,107,.15); --pb-texte: #ff8f8f;
  --note-fond: #3a2e12; --note-texte: #ffd98a; --toast: #eaf0fa; --toast-texte: #0b1220;
  --rayon: 20px; --rayon-btn: 14px; --ombre: 0 10px 34px rgba(0,0,0,.45); --cadre: 1px solid rgba(255,255,255,.07);
  --police-titre: "Space Grotesk", var(--police); --carte-fond: #0e1626;
  color-scheme: dark;
}
[data-theme=signal] {
  --fond: #f4f1ea; --carte: #ffffff; --carte-2: #ece7dc; --texte: #111111; --gris: #57524a; --bord: #cfc7b6;
  --accent: #f76707; --accent-texte: #111111; --entete: #111111; --entete-texte: #ffffff; --entete-bord: #111111;
  --marine: #111111; --bleu: #1864ab; --vert: #2b8a3e; --orange: #f76707; --rouge: #c92a2a;
  --sur-vert: #ffffff; --sur-orange: #111111; --sur-rouge: #ffffff;
  --ok-fond: #e1f1e4; --ok-texte: #1e6b2f; --att-fond: #ffe8d6; --att-texte: #8a3a00; --pb-fond: #fbe2e2; --pb-texte: #a61e1e;
  --note-fond: #ffe8d6; --note-texte: #6b2e00; --toast: #111111; --toast-texte: #ffffff;
  --rayon: 6px; --rayon-btn: 4px; --ombre: 3px 3px 0 #111111; --cadre: 2px solid #111111;
  --police: Barlow, system-ui, sans-serif; --police-titre: "Barlow Condensed", Barlow, sans-serif;
  --casse-titre: uppercase; --poids-titre: 800; --espace-titre: 0.03em; --carte-fond: #e6e0d2; --lien: #a33f00;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--police);
  background: var(--fond); color: var(--texte); font-size: 15px;
  -webkit-tap-highlight-color: transparent;
}
#app { min-height: 100%; display: flex; flex-direction: column; }
main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
h1, h2, h3, .logo, .focus-titre, .fenetre-titre, .stats b, .compteur {
  font-family: var(--police-titre); text-transform: var(--casse-titre); letter-spacing: var(--espace-titre); }
h1, h2, h3 { margin: 0 0 10px; font-weight: var(--poids-titre); }
h3 { font-size: 15px; margin-top: 14px; }
.centre { text-align: center; padding: 40px 16px; color: var(--gris); }
.aide { color: var(--gris); font-size: 13px; margin: 6px 0; }

/* ---------- Boutons et champs ---------- */
button, .btn {
  font: inherit; font-weight: 600; border: 1px solid var(--bord); background: var(--carte); color: var(--texte);
  border-radius: var(--rayon-btn); padding: 9px 13px; cursor: pointer; text-decoration: none; display: inline-flex;
  align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
}
button:disabled { opacity: .4; cursor: default; }
button.vert, .btn.vert { background: var(--vert); border-color: var(--vert); color: var(--sur-vert); }
button.rouge { background: var(--rouge); border-color: var(--rouge); color: var(--sur-rouge); }
button.orange, .btn.orange { background: var(--orange); border-color: var(--orange); color: var(--sur-orange); }
button.actif { background: var(--accent); border-color: var(--accent); color: var(--accent-texte); }
[data-theme=signal] button.vert, [data-theme=signal] button.rouge, [data-theme=signal] button.orange, [data-theme=signal] button.actif, [data-theme=signal] .gros { border: 2px solid #111; }
button.gros { width: 100%; padding: 16px; font-size: 17px; border-radius: var(--rayon); border: none; }
button.mini { padding: 4px 9px; }
button.lien { background: transparent; border: none; color: var(--entete-texte); padding: 6px 8px; font-weight: 500; }
input, select, textarea {
  font: inherit; padding: 9px 10px; border: 1px solid var(--bord); border-radius: var(--rayon-btn); background: var(--carte); width: 100%;
  color: var(--texte);
}
label { display: block; font-size: 13px; color: var(--gris); margin-top: 8px; }
label > input, label > select, label > textarea { margin-top: 4px; }
label.case { display: flex; align-items: center; gap: 8px; color: var(--texte); }
label.case input { width: auto; margin: 0; }
.rangee { display: flex; gap: 8px; align-items: flex-end; margin-top: 8px; }
.rangee > label { flex: 1; margin-top: 0; }
.rangee > input[type=search] { flex: 1; }
.rangee.wrap { flex-wrap: wrap; }
.grandit { flex: 1; min-width: 0; }

/* ---------- En-tête ---------- */
.entete {
  background: var(--entete); color: var(--entete-texte); border-bottom: 1px solid var(--entete-bord); display: flex; align-items: center; gap: 6px;
  padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top));
  position: sticky; top: 0; z-index: 1000;
}
.entete .logo { font-weight: 800; font-size: 17px; }
.entete .qui { flex: 1; text-align: right; opacity: .8; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Connexion ---------- */
.connexion { max-width: 380px; margin: auto; padding: 40px 20px; text-align: center; width: 100%; }
.connexion .logo-grand { font-size: 64px; }
.connexion form { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.connexion input { padding: 14px; font-size: 16px; }

/* ---------- Carte ---------- */
.carte { min-height: 300px; border-radius: var(--rayon); overflow: hidden; background: var(--carte-fond); border: var(--cadre); }
.pin {
  width: 28px; height: 28px; border-radius: 50%; border: 3px solid #fff; color: #fff; font-weight: 800; font-size: 12px;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 5px rgba(0,0,0,.45);
}
.pin.gros { width: 36px; height: 36px; font-size: 15px; box-shadow: 0 0 0 4px rgba(28,126,214,.35), 0 1px 5px rgba(0,0,0,.45); }

/* ---------- Vue Terrain (téléphone) ---------- */
.op { max-width: 640px; margin: 0 auto; width: 100%; padding: 12px; padding-bottom: max(24px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
.op .rangee { margin-top: 0; align-items: center; }
.op select { flex: 1; font-size: 16px; padding: 12px; font-weight: 600; }
.compteur { font-weight: 700; color: var(--marine); white-space: nowrap; }
.etat { font-size: 13px; color: var(--gris); text-align: center; }
.carte-op { height: 38vh; min-height: 220px; }
.liste { display: flex; flex-direction: column; gap: 10px; }
.arret { background: var(--carte); border-radius: var(--rayon); padding: 12px; box-shadow: var(--ombre); border-left: 5px solid var(--gris); }
.arret.encours { border-left-color: var(--orange); }
.arret.fait { border-left-color: var(--vert); opacity: .65; }
.arret.prochain { box-shadow: 0 0 0 2px var(--bleu), 0 4px 14px rgba(28,126,214,.2); }
.arret-tete { display: flex; gap: 10px; align-items: flex-start; }
.arret-info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.arret-info b { font-size: 16px; }
.arret-info small { color: var(--gris); }
.arret-info .note { color: var(--note-texte); }
.num { min-width: 30px; height: 30px; border-radius: 50%; color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 20px; background: var(--carte-2); color: var(--gris); white-space: nowrap; }
.badge.encours { background: var(--att-fond); color: var(--att-texte); }
.badge.fait { background: var(--ok-fond); color: var(--ok-texte); }
.arret-actions { display: flex; gap: 6px; margin-top: 10px; }
.arret-actions > * { flex: 1; padding: 11px 6px; }

/* ---------- Vue Bureau (ordinateur) ---------- */
.onglets { display: flex; gap: 4px; padding: 8px 12px; background: var(--entete); border-bottom: 1px solid var(--entete-bord); overflow-x: auto; }
.onglets button { border: none; border-radius: var(--rayon-btn); background: transparent; color: var(--gris); font-weight: 600; }
.onglets button:hover { background: var(--carte-2); color: var(--texte); }
.onglets button.actif { background: var(--accent); color: var(--accent-texte); }
[data-theme=signal] .onglets button { color: #ddd; text-transform: uppercase; font-family: var(--police-titre); letter-spacing: .05em; font-size: 16px; }
[data-theme=signal] .onglets button:hover { background: #2a2a2a; color: #fff; }
[data-theme=signal] .onglets button.actif { color: #111; }
.panneau { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.split { flex: 1; display: grid; grid-template-columns: 1fr 400px; gap: 12px; padding: 12px; min-height: 0; height: calc(100vh - 110px); }
.split .carte { height: 100%; }
.cote { background: var(--carte); border-radius: var(--rayon); padding: 14px; overflow-y: auto; border: var(--cadre); box-shadow: var(--ombre); }
.formulaire { background: var(--carte-2); border: 1px solid var(--bord); border-radius: 12px; padding: 12px; margin: 10px 0; }
.formulaire:empty { display: none; }
.liste-bureau { display: flex; flex-direction: column; }
.ligne { display: flex; flex-direction: column; gap: 2px; padding: 9px 4px; border-bottom: 1px solid var(--bord); cursor: pointer; }
.ligne:hover { background: var(--carte-2); }
.ligne small { color: var(--gris); }
.ligne.inactif { opacity: .5; }
.ligne.arret-route { flex-direction: row; align-items: center; gap: 8px; cursor: default; }
.barre-prog { height: 12px; background: var(--carte-2); border-radius: 6px; overflow: hidden; display: flex; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 8px; margin-top: 10px; text-align: center; }
.stats div { background: var(--carte-2); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; }
.stats b { font-size: 24px; }
.stats small { color: var(--gris); }
.page { padding: 16px; max-width: 1200px; width: 100%; margin: 0 auto; }
.filtres label { flex: 0 1 200px; }
.tableau-wrap { overflow-x: auto; border: var(--cadre); background: var(--carte); border-radius: var(--rayon); margin-top: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--bord); white-space: nowrap; }
th { background: var(--carte-2); font-size: 12px; text-transform: uppercase; color: var(--gris); }
td input, td select { min-width: 160px; }

@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; height: auto; }
  .split .carte { height: 50vh; }
}

/* ---------- Assistant IA ---------- */
.ia { display: flex; flex-direction: column; height: calc(100vh - 110px); }
.ia .rangee label { flex: 0 1 260px; }
.ia-fil { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 12px 0; }
.ia-bulle { max-width: 80%; padding: 10px 14px; border-radius: 14px; line-height: 1.45; }
.ia-bulle.moi { align-self: flex-end; background: var(--accent); color: var(--accent-texte); white-space: pre-wrap; }
.ia-bulle.ia { align-self: flex-start; background: var(--carte); box-shadow: var(--ombre); border: var(--cadre); }
.ia-bulle.erreur { background: var(--pb-fond); color: var(--rouge); }
.ia-texte p, .ia-texte li { margin: 0 0 6px; }
.ia-texte li { margin-left: 18px; }
.ia-texte .titre { font-weight: 700; margin-top: 8px; }
.ia-accueil button.mini { white-space: normal; text-align: left; padding: 8px 10px; font-weight: 500; }
.ia-saisie { display: flex; gap: 8px; align-items: flex-end; }
.ia-saisie textarea { flex: 1; resize: vertical; }

/* ---------- Indicateur réseau (terrain) ---------- */
.reseau { font-size: 13px; font-weight: 600; text-align: center; padding: 8px 10px; border-radius: 10px; }
.reseau.ok { background: var(--ok-fond); color: var(--ok-texte); }
.reseau.attente { background: var(--att-fond); color: var(--att-texte); }
.reseau.horsligne { background: var(--pb-fond); color: var(--pb-texte); }

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--toast); color: var(--toast-texte); padding: 12px 18px; border-radius: var(--rayon-btn); font-weight: 600; z-index: 5000;
  opacity: 0; pointer-events: none; transition: .25s; max-width: 90vw; text-align: center;
}
#toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

.connexion button.oubli { background: none; border: none; color: var(--lien, var(--accent)); margin-top: 14px; font-size: 14px; text-decoration: underline; }
.barre-prog.mince { height: 6px; margin-top: 4px; }
.op .barre-prog { margin: 4px 0; }
.op select { flex: 1; min-width: 0; }

.chrono { font-size: 14px; font-weight: 600; color: var(--lien, var(--accent)); min-height: 18px; margin: 2px 0 4px; }
.badge small.chrono-arret { display: block; font-weight: 500; opacity: .85; }

.formulaire.ajout { border: 2px dashed var(--orange); }
.formulaire.ajout:has(> button:only-child) { border: none; padding: 0; background: none; }

/* =====================================================================
   Terrain v2 : gros boutons (gants ≥ 56 px), un arrêt à la fois, mode nuit
   ===================================================================== */
.op .choix { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.op .choix select { min-width: 0; text-overflow: ellipsis; }
.op .choix select { min-height: 56px; font-size: 17px; }
.op .avancement { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.op .avancement .compteur { font-size: 16px; }
.op .avancement button.lien { color: var(--texte); font-size: 22px; min-width: 56px; min-height: 56px; }
.op .barre-prog { height: 14px; }
.op .chrono { font-size: 14px; min-height: 0; margin: 2px 0 0; }
.op button.gros, .op a.gros, .fenetre .gros { min-height: 60px; font-size: 18px; border-radius: var(--rayon-btn); }
a.gros { display: flex; align-items: center; justify-content: center; text-align: center; text-decoration: none; font-weight: 700; padding: 10px 14px; color: var(--accent-texte); border-radius: var(--rayon-btn); }
.gros.bleu, a.gros.bleu { background: var(--accent); color: var(--accent-texte); }
.gros.vert, a.gros.vert { background: var(--vert); color: var(--sur-vert); }
.gros.orange { background: var(--orange); color: var(--sur-orange); }
.gros.gris { background: var(--carte-2); color: var(--texte); }
[data-theme=signal] .gros, [data-theme=signal] .fenetre-titre, [data-theme=signal] .focus-etiquette { text-transform: uppercase; }

/* Carte « arrêt en cours / prochain » */
.focus { background: var(--carte); border-radius: var(--rayon); padding: 16px; box-shadow: var(--ombre); border: var(--cadre); border-top: 6px solid var(--accent); display: flex; flex-direction: column; gap: 6px; }
.focus.encours { border-top-color: var(--orange); }
.focus.fini { border-top-color: var(--vert); text-align: center; }
.focus-etiquette { font-size: 13px; font-weight: 800; letter-spacing: .04em; color: var(--gris); display: flex; justify-content: space-between; }
.focus.encours .focus-etiquette { color: var(--att-texte); }
.focus-titre { font-size: 26px; font-weight: var(--poids-titre); line-height: 1.15; }
[data-theme=signal] .focus-titre { font-size: 32px; text-transform: none; letter-spacing: 0; }
.focus-info { color: var(--gris); font-size: 15px; }
.focus-dist { font-size: 17px; font-weight: 700; color: var(--texte); }
.focus-note { background: var(--note-fond); color: var(--note-texte); border-radius: 10px; padding: 8px 10px; font-size: 15px; }
.focus-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.focus-actions > * { white-space: normal; line-height: 1.15; }
.outils { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 6px; }
.outils button { min-height: 60px; padding: 6px 4px; font-size: 14px; white-space: normal; line-height: 1.1; border-radius: var(--rayon-btn); background: var(--carte-2); border: none; }
[data-theme=signal] .outils button { border: 2px solid #111; }
.outils button.pb { color: var(--rouge); }

/* Carte + bouton « suivre ma position » */
.carte-wrap { position: relative; }
.carte-wrap .suivre { position: absolute; right: 10px; bottom: 10px; z-index: 500; width: 56px; height: 56px; border-radius: var(--rayon); font-size: 26px; box-shadow: var(--ombre); border: var(--cadre); background: var(--carte); color: var(--texte); }
.carte-wrap .suivre.actif { background: var(--accent); color: var(--accent-texte); border-color: var(--accent); }
.carte-op { height: 34vh; }

/* Liste des arrêts : chaque ligne s'ouvre d'un toucher */
.titre-liste { margin: 8px 0 0; color: var(--gris); }
.op details.arret > summary { list-style: none; cursor: pointer; min-height: 48px; }
.op details.arret > summary::-webkit-details-marker { display: none; }
.op details.arret[open] { box-shadow: 0 0 0 2px var(--bord); }
.op .arret-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.op .arret-actions > * { min-height: 56px; white-space: normal; }
.arret.probleme { border-left-color: var(--rouge); }
.badge.probleme { background: var(--pb-fond); color: var(--pb-texte); }
.op details.finis > summary { padding: 16px; background: var(--carte); border: var(--cadre); border-radius: var(--rayon); font-weight: 700; cursor: pointer; min-height: 56px; }
.op details.finis[open] > summary { margin-bottom: 10px; }
.op details.finis .arret { margin-bottom: 10px; }

/* Fenêtre (sel, problème) */
.fenetre-fond { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 3000; display: flex; align-items: flex-end; justify-content: center; }
.fenetre { background: var(--carte); color: var(--texte); width: 100%; max-width: 560px; border-radius: var(--rayon) var(--rayon) 0 0; border: var(--cadre); padding: 16px; padding-bottom: max(16px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; max-height: 90vh; overflow-y: auto; }
.fenetre-titre { font-size: 19px; font-weight: 800; margin-bottom: 4px; }
.fenetre .grille { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fenetre button.gros { width: 100%; border: 1px solid var(--bord); background: var(--fond); color: var(--texte); }
.fenetre button.gros.gris { background: var(--carte-2); }
.fenetre button.gros.choisi { background: var(--accent); color: var(--accent-texte); border-color: var(--accent); }
.fenetre .apercu { display: inline-flex; gap: 3px; margin-right: 8px; }
.fenetre .apercu i { width: 14px; height: 14px; border-radius: 50%; display: inline-block; border: 1px solid rgba(0,0,0,.2); }

/* Toast avec « Annuler » */
.toast-annuler { position: fixed; left: 12px; right: 12px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 4000; background: var(--toast); color: var(--toast-texte); border-radius: var(--rayon); padding: 10px 10px 10px 16px; display: flex; align-items: center; gap: 10px; font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.35); max-width: 600px; margin: 0 auto; }
.toast-annuler span { flex: 1; }
.toast-annuler button { min-height: 52px; min-width: 96px; background: #ffd43b; color: #1d2733; border: none; font-size: 16px; }

/* Carte sombre la nuit (rues seulement ; le satellite reste naturel) */
[data-theme=nuit] .leaflet-container:not(.sat) .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.88) saturate(.55); }
[data-theme=signal] .leaflet-container:not(.sat) .leaflet-tile-pane { filter: sepia(.18) saturate(.85); }
.leaflet-container { font-family: var(--police); background: var(--carte-fond); }
.leaflet-bar a, .leaflet-control-layers, .leaflet-control-layers-toggle { background-color: var(--carte); color: var(--texte); border-color: var(--bord); }
.leaflet-control-attribution { background: color-mix(in srgb, var(--carte) 75%, transparent) !important; color: var(--gris); }
.leaflet-control-attribution a { color: var(--gris); }
.leaflet-tooltip { background: var(--carte); color: var(--texte); border: var(--cadre); border-radius: var(--rayon-btn); box-shadow: var(--ombre); }
.leaflet-control-layers-toggle { background-color: #ffffff !important; }
[data-theme=nuit] .focus { box-shadow: 0 10px 34px rgba(0,0,0,.45), 0 0 0 1px rgba(76,201,240,.12); }
.formulaire.ajout > button:only-child { width: 100%; white-space: normal; }
.ligne.arret-route .grandit small { display: block; }

/* Trajets (chemin parcouru) */
.fleche { color: #111; font-size: 14px; line-height: 18px; text-align: center; text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff; }
.legende { font-size: 13px; margin: 10px 0; display: flex; flex-direction: column; gap: 4px; }
.legende .lg { display: inline-block; width: 30px; height: 7px; border-radius: 4px; vertical-align: middle; margin-right: 4px; }
.lg.noir { background: #111; box-shadow: 0 0 0 2px #fff, 0 0 0 3px #ccc; }
.lg.orange { background: #ff922b; }
.lg.rouge { background: #e03131; height: 12px !important; width: 12px !important; border-radius: 50% !important; }
.lg.mauve { background: repeating-linear-gradient(90deg, #7048e8 0 6px, transparent 6px 10px); }
.lg.sites { background: #1c7ed6; opacity: .5; }

/* Bureau – « 👁️ Sur la carte » */
.carte-voir { background: var(--carte-2); border-radius: 10px; padding: 8px 10px; margin: 6px 0 10px; }
.carte-voir select { width: 100%; }
[data-theme=signal] .pin, [data-theme=signal] .num { border-radius: 4px; border-color: #111; }
[data-theme=signal] .entete .logo { font-size: 21px; letter-spacing: .06em; }
.entete .icone-entete { min-width: 44px; min-height: 44px; }
@media (max-width: 520px) { .entete .qui { display: none; } .entete .logo { flex: 1; } }

.connexion .lien-app { display: block; margin-top: 18px; padding: 14px; border-radius: var(--rayon-btn); background: var(--carte-2); color: var(--texte); font-weight: 700; text-decoration: none; border: var(--cadre); }

/* Connexion tablette : 4 chiffres */
.connexion.nip { max-width: 360px; }
.nip-points { display: flex; justify-content: center; gap: 16px; margin: 14px 0 6px; }
.nip-points i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--gris); display: inline-block; }
.nip-points i.plein { background: var(--accent); border-color: var(--accent); }
.nip-msg { min-height: 22px; color: var(--pb-texte); font-weight: 600; margin: 4px 0 10px; }
.nip-clavier { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.nip-clavier.occupe { opacity: .5; pointer-events: none; }
.nip-touche { min-height: 72px; font-size: 28px; font-weight: 600; border-radius: var(--rayon); background: var(--carte); border: var(--cadre); box-shadow: var(--ombre); font-family: var(--police-titre); }
.nip-touche:active { background: var(--accent); color: var(--accent-texte); }
.nip-touche.effacer { font-size: 22px; background: transparent; box-shadow: none; border: none; }
.nip-zone .gros { width: 100%; margin-top: 8px; }

/* =====================================================================
   Finition : icônes au trait, listes déroulantes au style de l'app
   ===================================================================== */
.ico { flex: none; }
button .ico, a .ico { margin-right: 2px; }
.gros { display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.gros .lib2 { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1; text-align: left; }
.gros .lib2 small { font-size: 13px; font-weight: 600; opacity: .85; text-transform: none; letter-spacing: 0; }
.outils button { flex-direction: column; gap: 4px; font-weight: 600; }
.outils button .ico { margin: 0; }
.outils button.fait { color: var(--ok-texte); background: var(--ok-fond); }
.outils button.pb .ico { color: var(--rouge); }
.focus-note { display: flex; gap: 8px; align-items: flex-start; }
.focus-note .ico { margin-top: 2px; }
.arret-actions .btn, .arret-actions button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.carte-wrap .suivre { display: flex; align-items: center; justify-content: center; padding: 0; }
input:focus, select:focus, textarea:focus, .select-joli:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input, select, textarea { font-size: 16px; }   /* pas de zoom automatique sur téléphone */

/* Listes : même look partout (ordi : flèche maison ; tactile : panneau du bas) */
select { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23889' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
.select-cache { position: absolute !important; opacity: 0; width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; margin: 0 !important; pointer-events: none; overflow: hidden; }
.select-joli { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-width: 0; min-height: 46px;
  padding: 10px 12px; font: inherit; font-weight: 600; text-align: left; color: var(--texte); background: var(--carte);
  border: 1px solid var(--bord); border-radius: var(--rayon-btn); cursor: pointer; }
[data-theme=signal] .select-joli { border: 2px solid #111; }
.select-joli-lib { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-joli .ico { color: var(--gris); }
.select-joli:disabled { opacity: .5; }
label > .select-joli { margin-top: 4px; }
.rangee > .select-joli, .rangee.wrap > .select-joli { flex: 1 1 150px; }
.op .choix .select-joli { min-height: 56px; font-size: 17px; }
.menu-fenetre { max-height: 80vh; }
.menu-liste { display: flex; flex-direction: column; overflow-y: auto; margin: 0 -16px; }
.menu-choix { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 56px;
  padding: 12px 20px; border: none; border-radius: 0; border-bottom: 1px solid var(--bord); background: transparent;
  color: var(--texte); font-size: 17px; font-weight: 500; text-align: left; white-space: normal; }
.menu-choix:last-child { border-bottom: none; }
.menu-choix.choisi { color: var(--accent); font-weight: 700; }
[data-theme=signal] .menu-choix.choisi { color: var(--texte); background: var(--att-fond); }
.menu-choix:active { background: var(--carte-2); }
.fenetre-fond { animation: fondu .15s ease-out; }
.fenetre { animation: monte .2s ease-out; }
@keyframes fondu { from { opacity: 0; } }
@keyframes monte { from { transform: translateY(24px); opacity: .6; } }
@media (prefers-reduced-motion: reduce) { .fenetre, .fenetre-fond { animation: none; } }

/* La carte ne passe plus par-dessus l'en-tête quand on fait défiler */
.entete { z-index: 1200; }
.carte, .carte-wrap { position: relative; isolation: isolate; z-index: 0; }

/* Annuler / nouvelle passe */
.lien-annuler { align-self: center; display: inline-flex; align-items: center; gap: 6px; background: transparent; border: none;
  color: var(--gris); font-weight: 600; font-size: 15px; min-height: 48px; padding: 6px 12px; }
.btn.bleu { background: var(--accent); border-color: var(--accent); color: var(--accent-texte); }

.op .choix { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr) !important; }

/* Bacs à sel */
.bouton-bacs { width: 100%; margin-bottom: 10px; font-weight: 700; }
.bacs-resume .stats { grid-template-columns: repeat(4, 1fr); margin: 8px 0 10px; }
.ligne.a-bacs b { color: var(--texte); }
.ligne-bacs { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--bord); }
.bac-lib { display: flex; align-items: center; gap: 12px; font-size: 19px; font-weight: 700; }
.bac-ico { display: inline-block; background: #f76707; border-radius: 4px; border: 2px solid rgba(0,0,0,.25); }
.bac-ico.petit { width: 16px; height: 14px; } .bac-ico.moyen { width: 22px; height: 18px; } .bac-ico.gros { width: 30px; height: 24px; }
.pas { display: flex; align-items: center; gap: 10px; }
.pas button { width: 56px; height: 56px; font-size: 28px; font-weight: 700; border-radius: var(--rayon-btn); padding: 0; }
.compteur-bacs { min-width: 36px; text-align: center; font-size: 26px; font-weight: 800; font-family: var(--police-titre); font-variant-numeric: tabular-nums; }
.focus-bacs { color: var(--att-texte); font-weight: 700; }
.site-bacs { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 6px; text-align: left; background: transparent;
  border: none; border-bottom: 1px solid var(--bord); border-radius: 0; color: var(--texte); min-height: 56px; }
.site-bacs:hover { background: var(--carte-2); }
.site-bacs-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.site-bacs-info small { color: var(--gris); }
.site-bacs-info .note { color: var(--att-texte); font-weight: 700; }
.pastille-bacs { flex: none; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: #adb5bd; color: #fff; font-weight: 800; }
.site-bacs.a-bacs .pastille-bacs { background: #f76707; }
.bac-ico { flex: none; align-self: center; }
.fenetre .gros.vert { background: var(--vert); color: var(--sur-vert); border-color: var(--vert); }
.site-bacs { justify-content: flex-start !important; } .site-bacs-info { align-items: flex-start; }

/* ===== Mode GPS plein écran (terrain) ===== */
.btn-gps { position: absolute; left: 10px; bottom: 10px; z-index: 500; display: inline-flex; align-items: center; gap: 6px;
  min-height: 56px; padding: 0 16px; font-weight: 800; font-size: 16px; border-radius: var(--rayon); background: var(--accent);
  color: var(--accent-texte); border: var(--cadre); box-shadow: var(--ombre); }
.gps-fermer, .gps-barre { display: none; }
.carte-wrap.gps { position: fixed; inset: 0; z-index: 3000; border-radius: 0; margin: 0; background: var(--carte-fond); }
.carte-wrap.gps .carte { height: 100% !important; min-height: 100%; border-radius: 0; border: none; }
.carte-wrap.gps .btn-gps { display: none; }
.carte-wrap.gps .suivre { bottom: auto; top: calc(env(safe-area-inset-top) + 14px); right: 14px; }
.carte-wrap.gps .leaflet-control-zoom, .carte-wrap.gps .leaflet-control-layers { display: none; }
.carte-wrap.gps .gps-fermer { display: flex; align-items: center; justify-content: center; position: absolute; z-index: 600;
  top: calc(env(safe-area-inset-top) + 14px); left: 14px; width: 56px; height: 56px; padding: 0; font-size: 24px; font-weight: 700;
  border-radius: var(--rayon); background: var(--carte); color: var(--texte); border: var(--cadre); box-shadow: var(--ombre); }
.carte-wrap.gps .gps-barre { display: flex; align-items: center; gap: 12px; position: absolute; z-index: 600; left: 10px; right: 10px;
  bottom: calc(env(safe-area-inset-bottom) + 10px); padding: 14px; background: var(--carte); color: var(--texte);
  border-radius: var(--rayon); border: var(--cadre); box-shadow: var(--ombre); }
.gps-texte { flex: 1; min-width: 0; }
.gps-etiquette { font-size: 12px; font-weight: 800; letter-spacing: .06em; color: var(--gris); }
.gps-titre { font-family: var(--police-titre); font-weight: var(--poids-titre); font-size: 22px; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gps-info { font-size: 18px; font-weight: 700; color: var(--accent); margin-top: 2px; }
[data-theme=signal] .gps-info { color: var(--texte); }
.gps-barre .gros { flex: none; min-height: 64px; padding: 0 18px; }
body.gps-actif { overflow: hidden; }
body.gps-actif .toast-annuler, body.gps-actif .toast { z-index: 3100; bottom: calc(env(safe-area-inset-bottom) + 110px); }
.carte-wrap.gps .gps-barre { flex-direction: column; align-items: stretch; gap: 10px; }
.gps-barre .gros { width: 100% !important; margin: 0 !important; }
body.gps-actif .toast-annuler, body.gps-actif .toast { bottom: calc(env(safe-area-inset-bottom) + 200px); }
body.gps-actif #toast { z-index: 3100; bottom: calc(env(safe-area-inset-bottom) + 200px); }

/* GPS : bandeau de manœuvre, flèche, voix */
.gps-haut { display: none; }
.carte-wrap.gps .gps-haut { display: block; position: absolute; z-index: 600; left: 84px; right: 84px; top: calc(env(safe-area-inset-top) + 14px); }
.gps-man { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--rayon); background: #16a34a; color: #fff; box-shadow: var(--ombre); }
.gps-man.arrive { background: var(--accent); color: var(--accent-texte); }
.gps-man > div { display: flex; flex-direction: column; min-width: 0; }
.gps-man b { font-size: 24px; line-height: 1.1; font-family: var(--police-titre); }
.gps-man span:not(.gps-man-ico) { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.gps-man-ico { flex: none; font-size: 34px; font-weight: 900; line-height: 1; width: 40px; text-align: center; display: inline-block; }
.moi-point { width: 22px; height: 22px; margin: 11px; border-radius: 50%; background: #2563eb; border: 4px solid #fff; box-shadow: 0 0 0 8px rgba(37,99,235,.25); }
.moi-fleche { width: 44px; height: 44px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.4)); }
.gps-voix { display: none; }
.carte-wrap.gps .gps-voix { display: flex; align-items: center; justify-content: center; position: absolute; z-index: 600; right: 14px;
  top: calc(env(safe-area-inset-top) + 82px); width: 56px; height: 56px; padding: 0; font-size: 24px; border-radius: var(--rayon);
  background: var(--carte); border: var(--cadre); box-shadow: var(--ombre); }

.carte-permission { background: var(--carte); border: var(--cadre); border-left: 6px solid var(--accent); border-radius: var(--rayon); padding: 14px; box-shadow: var(--ombre); display: flex; flex-direction: column; gap: 8px; }
.carte-permission[hidden] { display: none; }
.carte-permission b { font-size: 19px; }
.carte-permission p { margin: 0; color: var(--gris); }
/* GPS : point bleu + faisceau, boussole */
.moi { position: relative; width: 96px; height: 96px; }
.moi-cone { position: absolute; inset: 0; transform-origin: 50% 50%; transition: transform .25s linear, opacity .3s; pointer-events: none; }
.moi .moi-point { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; }
.gps-boussole { display: none; }
.carte-wrap.gps .gps-boussole { display: flex; align-items: center; justify-content: center; position: absolute; z-index: 600; right: 14px;
  top: calc(env(safe-area-inset-top) + 150px); width: 56px; height: 56px; padding: 0; border-radius: 50%;
  background: var(--carte); color: var(--texte); border: var(--cadre); box-shadow: var(--ombre); }
.gps-boussole .aiguille { transition: transform .25s linear; }

.menu-ordre { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.menu-ordre .gros { width: 100%; }
.focus.fini .gros { width: 100%; margin-top: 8px; }
.arret-tete { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.fenetre .gros.bleu, .focus .gros.bleu, .gps-barre .gros.bleu { background: var(--accent); color: var(--accent-texte); border-color: var(--accent); }

/* Glisser un arrêt pour changer l'ordre */
.liste > details.arret { transition: transform .18s ease; }
.liste > details.arret.souleve { transition: none; position: relative; z-index: 50; box-shadow: 0 16px 40px rgba(0,0,0,.35); outline: 3px solid var(--accent); }
body.glisse { user-select: none; -webkit-user-select: none; }
body.glisse .liste > details.arret:not(.souleve) { opacity: .85; }
.btn-passe { display: inline-flex; align-items: center; gap: 6px; min-height: 48px; padding: 6px 12px; border-radius: 999px;
  background: var(--carte-2); color: var(--texte); border: var(--cadre); font-weight: 700; font-size: 14px; white-space: nowrap; }
.btn-passe[hidden] { display: none; }
.avancement { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
