/* Le plan de la ville, annoté au surligneur.
   Le fond reste un plan gris-bleu et discret ; la couleur vient des choix qu'on y pose. */

:root {
  --plan: #eef0f3;
  --papier: #ffffff;
  --encre: #172036;
  --encre-2: #5b6478;
  --encre-3: #8a91a1;
  --trait: #d8dce3;
  --trait-fort: #b9bfca;

  --voeu: #2747d9;
  --voeu-pale: #dfe5ff;
  --veux: #22c973;
  --peut: #ffd60a;
  --non: #8a8f99;
  --danger: #c4323c;

  --t1: #c9f3df;
  --t2: #7ddcb5;
  --t3: #33b597;
  --t4: #1f7c86;
  --t5: #27496b;
  --t6: #3a2f55;

  --ombre: 0 1px 2px rgba(23, 32, 54, .08), 0 6px 20px rgba(23, 32, 54, .10);
  --rayon: 6px;
  --gauche: 340px;
  --droite: 390px;
  --titre: "Familjen Grotesk", "Helvetica Neue", sans-serif;
  --texte: "Atkinson Hyperlegible", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--plan);
  color: var(--encre);
  font: 14px/1.45 var(--texte);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--voeu); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--titre); margin: 0; }

.app {
  display: grid;
  grid-template-columns: var(--gauche) 1fr var(--droite);
  height: 100vh;
}

/* ---------- colonne de gauche ---------- */

.gauche {
  background: var(--papier);
  border-right: 1px solid var(--trait);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.titre { padding: 22px 22px 16px; }
.titre h1 { font-size: 26px; line-height: 1.05; font-weight: 700; letter-spacing: -.01em; }
.titre p { margin: 8px 0 0; color: var(--encre-2); font-size: 13.5px; }

.bloc { padding: 14px 22px 16px; border-top: 1px solid var(--trait); }
.bloc h2 { font-size: 15px; font-weight: 600; }
.tete-bloc { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.bloc > h2 { margin-bottom: 10px; }

.lien {
  background: none; border: 0; padding: 0;
  color: var(--voeu); font-size: 13px; text-decoration: underline; text-underline-offset: 2px;
  cursor: pointer;
}
.lien:hover { color: var(--encre); }
.lien.danger { color: var(--danger); }
.aide { color: var(--encre-2); font-size: 12.5px; margin: 8px 0 0; }

.ligne-reglage { display: flex; gap: 8px; align-items: center; }
input[type="time"] {
  border: 1px solid var(--trait-fort); border-radius: var(--rayon);
  padding: 5px 8px; background: var(--papier); font-variant-numeric: tabular-nums; width: 92px;
}

.bascule { display: inline-flex; border: 1px solid var(--trait-fort); border-radius: var(--rayon); overflow: hidden; background: var(--papier); }
.bascule button { border: 0; background: none; padding: 5px 10px; font-size: 13px; color: var(--encre-2); }
.bascule button + button { border-left: 1px solid var(--trait-fort); }
.bascule button.actif { background: var(--encre); color: #fff; }
.bascule.grande button { padding: 7px 14px; font-size: 14px; font-weight: 700; }

/* vœux : une vraie liste ordonnée, le numéro est celui du dossier */
.voeux { list-style: none; margin: 0; padding: 0; }
.voeu {
  display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center;
  padding: 6px 6px; margin: 0 -6px; border-radius: var(--rayon); cursor: pointer;
}
.voeu:hover { background: var(--plan); }
.voeu.edition { background: var(--voeu-pale); box-shadow: inset 0 0 0 1.5px var(--voeu); }
.pastille {
  display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 5px;
  background: var(--voeu); color: #fff; border-radius: 4px;
  font: 700 12.5px/1 var(--titre); font-variant-numeric: tabular-nums;
}
.voeu .quoi { min-width: 0; }
.voeu .quoi strong { display: block; font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.voeu .quoi span { display: block; color: var(--encre-2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.voeu.edition .quoi span { white-space: normal; }
.voeu .quoi span.vide { color: var(--danger); }
.voeu .actions { display: flex; gap: 2px; opacity: 0; }
.voeu:hover .actions, .voeu.edition .actions, .voeu:focus-within .actions { opacity: 1; }
.icone {
  border: 0; background: none; width: 26px; height: 26px; border-radius: 4px;
  display: grid; place-items: center; color: var(--encre-2); font-size: 14px;
}
.icone:hover { background: var(--trait); color: var(--encre); }

/* lieux */
.recherche { position: relative; margin-bottom: 8px; }
.recherche input {
  width: 100%; border: 1px solid var(--trait-fort); border-radius: var(--rayon);
  padding: 7px 10px; background: var(--papier);
}
.suggestions {
  position: absolute; z-index: 1200; left: 0; right: 0; top: calc(100% + 4px);
  list-style: none; margin: 0; padding: 4px; background: var(--papier);
  border: 1px solid var(--trait-fort); border-radius: var(--rayon); box-shadow: var(--ombre);
}
.suggestions li { padding: 6px 8px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.suggestions li:hover, .suggestions li.actif { background: var(--plan); }
.suggestions li small { color: var(--encre-2); display: block; }

.lieux { list-style: none; margin: 0; padding: 0; }
.lieu { display: grid; grid-template-columns: 18px 1fr auto; gap: 10px; padding: 7px 6px; margin: 0 -6px; border-radius: var(--rayon); align-items: start; }
.lieu:hover { background: var(--plan); }
.lieu.reference { background: var(--plan); }
.lieu .point { width: 14px; height: 14px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); margin-top: 3px; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); }
.lieu strong { display: block; font-size: 13.5px; }
.lieu .desc { color: var(--encre-2); font-size: 12.5px; }
.lieu .adr { color: var(--encre-3); font-size: 12px; }
.lieu .actions { display: flex; gap: 2px; opacity: 0; }
.lieu:hover .actions, .lieu:focus-within .actions { opacity: 1; }
.lieu-vide { color: var(--encre-2); font-size: 13px; padding: 4px 0; }

.edition-lieu { display: grid; gap: 6px; padding: 8px; margin: 2px -6px 6px; background: var(--plan); border-radius: var(--rayon); }
.edition-lieu input, .edition-lieu textarea {
  width: 100%; border: 1px solid var(--trait-fort); border-radius: 4px; padding: 5px 8px; background: var(--papier); font: inherit; font-size: 13px; resize: vertical;
}
.edition-lieu .boutons { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.couleurs { display: flex; gap: 6px; }
.couleurs button { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.2); padding: 0; }
.couleurs button.actif { box-shadow: 0 0 0 2px var(--encre); }
.bouton {
  border: 1px solid var(--encre); background: var(--encre); color: #fff; border-radius: var(--rayon);
  padding: 5px 12px; font-weight: 700; font-size: 13px;
}
.bouton.second { background: var(--papier); color: var(--encre); border-color: var(--trait-fort); }

/* calques */
.calques { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; }
.calques .groupe { grid-column: 1 / -1; color: var(--encre-2); font-size: 12px; margin-top: 8px; }
.calques .groupe:first-child { margin-top: 0; }
.calque { display: flex; align-items: center; gap: 7px; font-size: 13px; padding: 3px 0; cursor: pointer; user-select: none; }
.calque input { margin: 0; accent-color: var(--encre); }
.calque .rond { width: 10px; height: 10px; border-radius: 50%; flex: none; border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); }
.calque .n { color: var(--encre-3); font-size: 11.5px; margin-left: auto; font-variant-numeric: tabular-nums; }

.pied { margin-top: auto; padding: 14px 22px 18px; border-top: 1px solid var(--trait); display: flex; gap: 16px; flex-wrap: wrap; }

/* ---------- carte ---------- */

.centre { position: relative; min-width: 0; }
#carte { position: absolute; inset: 0; background: var(--plan); }
.leaflet-container { font-family: var(--texte); }
/* l'effet surligneur : les zones se multiplient avec le plan au lieu de le couvrir */
.leaflet-overlay-pane { mix-blend-mode: multiply; }
.fond-gris { filter: grayscale(1) brightness(1.06) contrast(.82); }
.carte-placement, .carte-placement .leaflet-interactive { cursor: crosshair !important; }

.barre-carte {
  position: absolute; z-index: 1000; top: 14px; left: 14px; right: 14px;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; pointer-events: none;
}
.barre-carte > * { pointer-events: auto; box-shadow: var(--ombre); }
.barre-carte select {
  border: 1px solid var(--trait-fort); border-radius: var(--rayon); padding: 7px 10px; background: var(--papier); font-weight: 700;
}
.barre-carte select:disabled { opacity: .45; }

.pinceaux { display: flex; gap: 0; background: var(--papier); border-radius: var(--rayon); border: 1px solid var(--trait-fort); overflow: hidden; margin-left: auto; }
.pinceau { display: flex; align-items: center; gap: 7px; border: 0; background: none; padding: 7px 12px; font-size: 13.5px; }
.pinceau + .pinceau { border-left: 1px solid var(--trait); }
.pinceau .trace { width: 22px; height: 10px; border-radius: 2px; }
.pinceau kbd { font: 11px var(--texte); color: var(--encre-3); border: 1px solid var(--trait); border-radius: 3px; padding: 0 4px; }
.pinceau.actif { background: var(--encre); color: #fff; }
.pinceau.actif kbd { color: #c9cedb; border-color: #4a5470; }
.trace.veux { background: var(--veux); }
.trace.peut { background: var(--peut); }
.trace.non { background: repeating-linear-gradient(45deg, var(--non) 0 2px, transparent 2px 5px); box-shadow: inset 0 0 0 1px var(--non); }
.trace.gomme { background: var(--papier); box-shadow: inset 0 0 0 1.5px var(--encre-3); }
.trace.voeu { background: var(--voeu); }

.legende {
  position: absolute; z-index: 1000; left: 14px; bottom: 58px;
  background: var(--papier); border-radius: var(--rayon); box-shadow: var(--ombre);
  padding: 10px 12px; font-size: 12.5px; max-width: 360px;
}
.legende h3 { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.legende .echelle { display: flex; }
.legende .echelle span { flex: 1; text-align: center; padding: 3px 6px; color: #fff; font-variant-numeric: tabular-nums; min-width: 44px; }
.legende .echelle span.clair { color: var(--encre); }
.legende .cles { display: grid; grid-template-columns: auto 1fr; gap: 4px 8px; align-items: center; }
.legende .cles .trace { width: 22px; height: 12px; border-radius: 2px; }
.legende .note { color: var(--encre-2); margin-top: 6px; }

/* étiquettes numérotées des vœux sur la carte */
.etiquette-voeu {
  background: var(--voeu); color: #fff; border-radius: 4px; padding: 2px 6px;
  font: 700 12px/1.2 var(--titre); white-space: nowrap; box-shadow: 0 1px 3px rgba(0,0,0,.35);
  transform: translate(-50%, -50%); display: inline-block; pointer-events: none;
}
.etiquette-voeu small { font-weight: 500; opacity: .85; margin-left: 4px; }

/* épingles des lieux */
.epingle { position: relative; }
.epingle .tete {
  position: absolute; left: -15px; top: -38px; width: 30px; height: 30px;
  border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  border: 2.5px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.epingle .lettre {
  position: absolute; left: -15px; top: -38px; width: 30px; height: 30px; display: grid; place-items: center;
  color: #fff; font: 700 13px var(--titre);
}
.epingle .nom {
  position: absolute; left: 18px; top: -34px; white-space: nowrap; background: rgba(255,255,255,.92);
  padding: 1px 6px; border-radius: 3px; font: 700 12px var(--texte); color: var(--encre); box-shadow: 0 1px 2px rgba(0,0,0,.2);
}

.leaflet-tooltip.info-zone {
  background: var(--encre); color: #fff; border: 0; border-radius: var(--rayon); box-shadow: var(--ombre);
  padding: 7px 10px; font-size: 12.5px;
}
.leaflet-tooltip.info-zone::before { display: none; }
.info-zone b { font-family: var(--titre); font-size: 14px; }
.info-zone .gris { color: #b5bccb; }
.info-zone .t { font-variant-numeric: tabular-nums; }

.leaflet-popup-content-wrapper { border-radius: var(--rayon); }
.leaflet-popup-content { margin: 10px 12px; font-size: 13px; }
.popup-lieu strong { font-family: var(--titre); font-size: 14px; display: block; }
.popup-lieu .gris { color: var(--encre-2); }

/* ---------- tiroir de comparaison ---------- */

.tiroir {
  position: absolute; z-index: 1001; left: 0; right: 0; bottom: 0;
  background: var(--papier); border-top: 1px solid var(--trait-fort);
  transform: translateY(calc(100% - 44px)); transition: transform .25s ease;
  display: flex; flex-direction: column; max-height: 55%;
}
.tiroir.ouvert { transform: none; box-shadow: 0 -8px 24px rgba(23,32,54,.12); }
.poignee {
  flex: none; height: 44px; border: 0; background: none; text-align: left; padding: 0 18px;
  font: 600 14.5px var(--titre); display: flex; align-items: center; gap: 8px;
}
.poignee::after { content: "▴"; color: var(--encre-3); }
.tiroir.ouvert .poignee::after { content: "▾"; }
.tableau-conteneur { overflow: auto; padding: 0 18px 16px; }
.tableau { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
.tableau th {
  position: sticky; top: 0; background: var(--papier); text-align: left; font-weight: 700; font-size: 12.5px;
  border-bottom: 1.5px solid var(--encre); padding: 6px 8px; cursor: pointer; white-space: nowrap;
}
.tableau th.trie::after { content: " ↓"; }
.tableau th.trie.inverse::after { content: " ↑"; }
.tableau td { border-bottom: 1px solid var(--trait); padding: 5px 8px; white-space: nowrap; }
.tableau td.nb { text-align: right; }
.tableau tr:hover td { background: var(--plan); cursor: pointer; }
.tableau .case-temps { display: inline-block; min-width: 46px; text-align: center; border-radius: 3px; padding: 1px 4px; }

/* ---------- colonne de droite ---------- */

.droite { background: var(--papier); border-left: 1px solid var(--trait); overflow-y: auto; }
.vide-detail { padding: 28px 24px; color: var(--encre-2); }
.vide-detail h2 { color: var(--encre); font-size: 18px; margin-bottom: 8px; }
.vide-detail ul { padding-left: 18px; margin: 10px 0 0; }
.vide-detail li { margin-bottom: 6px; }

.fiche { padding: 20px 22px 28px; }
.fiche .commune { color: var(--encre-2); font-size: 13px; }
.fiche h2 { font-size: 24px; line-height: 1.1; font-weight: 700; margin: 2px 0 4px; letter-spacing: -.01em; }
.fiche .sous { color: var(--encre-2); font-size: 13px; }
.fiche .appartient { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.fiche .appartient .pastille { height: auto; padding: 3px 7px; font-size: 12px; }

.statuts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 16px 0 6px; }
.statut {
  border: 1px solid var(--trait-fort); background: var(--papier); border-radius: var(--rayon);
  padding: 7px 6px; font-size: 13px; font-weight: 700; display: flex; gap: 6px; align-items: center; justify-content: center;
}
.statut .trace { width: 14px; height: 14px; border-radius: 3px; }
.statut.actif { border-color: var(--encre); box-shadow: inset 0 0 0 1px var(--encre); background: var(--plan); }

.fiche h3 { font-size: 15px; font-weight: 600; margin: 22px 0 8px; padding-top: 14px; border-top: 1px solid var(--trait); }

.temps-lieu { padding: 8px 0; border-bottom: 1px solid var(--trait); }
.temps-lieu:last-child { border-bottom: 0; }
.temps-lieu .haut { display: grid; grid-template-columns: 14px 1fr auto; gap: 8px; align-items: center; }
.temps-lieu .point { width: 11px; height: 11px; border-radius: 50%; }
.temps-lieu .nom { font-weight: 700; font-size: 13.5px; }
.temps-lieu .tc { font: 700 20px/1 var(--titre); font-variant-numeric: tabular-nums; }
.temps-lieu .tc small { font: 400 12px var(--texte); color: var(--encre-2); margin-left: 2px; }
.temps-lieu .autres { color: var(--encre-2); font-size: 12.5px; margin: 2px 0 0 22px; }
.temps-lieu details { margin: 4px 0 0 22px; }
.temps-lieu summary { color: var(--voeu); font-size: 12.5px; cursor: pointer; }
.etapes { list-style: none; padding: 0; margin: 6px 0 2px; border-left: 2px solid var(--trait); }
.etapes li { padding: 3px 0 3px 12px; position: relative; font-size: 12.5px; }
.etapes li::before { content: ""; position: absolute; left: -5px; top: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--trait-fort); }
.etapes .heure { font-variant-numeric: tabular-nums; color: var(--encre-2); margin-right: 6px; }
.badge-ligne {
  display: inline-block; min-width: 26px; text-align: center; padding: 1px 5px; border-radius: 3px;
  font: 700 11.5px/1.35 var(--titre); margin-right: 4px;
}

.essentiels { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.essentiel { background: var(--plan); border-radius: var(--rayon); padding: 8px 10px; }
.essentiel .v { font: 700 17px/1.1 var(--titre); font-variant-numeric: tabular-nums; }
.essentiel .l { color: var(--encre-2); font-size: 12px; }
.essentiel.loin .v { color: var(--danger); }
.lignes-proches { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.fiche .note { color: var(--encre-2); font-size: 12px; margin-top: 10px; }

.toast {
  position: fixed; z-index: 3000; left: 50%; bottom: 60px; transform: translate(-50%, 20px);
  background: var(--encre); color: #fff; padding: 9px 14px; border-radius: var(--rayon);
  font-size: 13.5px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  .tiroir, .toast { transition: none; }
}
