:root {
  --fond: #f5f4f1;
  --surface: #ffffff;
  --texte: #1d1d1f;
  --texte-doux: #66666b;
  --filet: #e6e4df;
  --coupure: #d62839;
  --deviation: #f08a00;
  --deplace: #2563c9;
  --ombre: 0 1px 2px rgba(0, 0, 0, .06), 0 6px 20px rgba(0, 0, 0, .1);
  --police: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--fond); color: var(--texte); font-family: var(--police); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }

.mise-en-page { display: grid; grid-template-columns: 420px 1fr; height: 100dvh; }
.zone-carte { grid-column: 2; grid-row: 1; position: relative; min-height: 0; }
.carte { position: absolute; inset: 0; background: #eef0f1; }
.panneau { grid-column: 1; grid-row: 1; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--filet); padding: 26px 24px 24px; display: flex; flex-direction: column; }

/* En-tête */
h1 { font-size: 23px; line-height: 1.18; letter-spacing: -0.02em; margin: 0 0 8px; font-weight: 700; }
h2 { font-size: 16px; line-height: 1.3; margin: 0 0 6px; font-weight: 650; }
.fraicheur { margin: 0; font-size: 13.5px; line-height: 1.4; color: var(--texte-doux); }
.fraicheur.erreur { color: var(--coupure); }

/* Onglets incidents / travaux */
.onglets { display: grid; grid-template-columns: 1fr 1fr; margin: 20px 0 0; border-bottom: 1px solid var(--filet); }
.onglets button { border: 0; background: none; padding: 10px 4px 12px; font-size: 15px; font-weight: 600; color: var(--texte-doux); cursor: pointer; position: relative; display: flex; justify-content: center; align-items: baseline; gap: 7px; }
.onglets button[aria-selected="true"] { color: var(--texte); }
.onglets button[aria-selected="true"]::after { content: ""; position: absolute; left: 12%; right: 12%; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--texte); }
.compte { font-variant-numeric: tabular-nums; font-weight: 500; color: var(--texte-doux); }

/* Filtre par mode */
.modes { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 6px; }
.modes button { border: 1px solid var(--filet); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 13.5px; font-weight: 550; color: var(--texte-doux); cursor: pointer; }
.modes button:hover { border-color: #cfccc5; color: var(--texte); }
.modes button[aria-checked="true"] { background: var(--texte); border-color: var(--texte); color: #fff; }

/* Liste des perturbations */
.liste { list-style: none; margin: 0; padding: 0; }
.fiche { display: grid; grid-template-columns: 44px 1fr; gap: 3px 12px; padding: 13px 10px; margin: 0 -10px; border-radius: 12px; cursor: pointer; outline: none; }
.fiche + .fiche { box-shadow: 0 -1px 0 var(--filet); }
.fiche:hover, .fiche:focus-visible { background: #faf9f7; }
.fiche[aria-expanded="true"] { background: var(--fond); box-shadow: none; }
.fiche[aria-expanded="true"] + .fiche { box-shadow: none; }
.pastille { grid-row: span 2; justify-self: start; min-width: 34px; height: 28px; padding: 0 7px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; font-weight: 750; font-size: 14px; letter-spacing: -0.01em; }
.pastille.metro, .pastille.tram { border-radius: 50%; min-width: 30px; width: 30px; height: 30px; padding: 0; }
.resume { font-size: 15px; line-height: 1.38; font-weight: 550; }
.dates { font-size: 13px; color: var(--texte-doux); }
.detail { grid-column: 2; font-size: 13.5px; line-height: 1.5; color: var(--texte-doux); margin-top: 6px; }
.detail p { margin: 0; }
.detail .source { margin-top: 6px; font-size: 12px; }
.fiche:not([aria-expanded="true"]) .detail { display: none; }
.vide { padding: 22px 0; color: var(--texte-doux); font-size: 14.5px; line-height: 1.45; }

.a-placer { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--filet); }
.a-placer > p { margin: 0 0 8px; font-size: 13.5px; line-height: 1.45; color: var(--texte-doux); }
.a-placer .resume { font-weight: 500; }

.pied { margin-top: auto; padding-top: 28px; font-size: 12px; line-height: 1.5; color: var(--texte-doux); }
.pied p { margin: 0; }
.pied a { color: inherit; }

/* Commandes posées sur la carte */
.bascule { position: absolute; top: 14px; left: 14px; z-index: 800; display: flex; padding: 3px; gap: 2px; background: var(--surface); border-radius: 12px; box-shadow: var(--ombre); }
.bascule button { border: 0; background: none; border-radius: 9px; padding: 8px 13px; font-size: 14px; font-weight: 600; color: var(--texte-doux); cursor: pointer; white-space: nowrap; }
.bascule button[aria-checked="true"] { background: var(--texte); color: #fff; }

.legende-carte { position: absolute; left: 14px; bottom: 26px; z-index: 800; max-width: 280px; background: var(--surface); border-radius: 12px; box-shadow: var(--ombre); }
.legende-bouton { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; font-size: 13px; font-weight: 600; color: var(--texte-doux); cursor: pointer; border-radius: 12px; }
.legende-bouton:hover { color: var(--texte); }
.legende-carte[data-ouverte="false"] .legende { display: none; }
.legende { list-style: none; margin: 0; padding: 0 12px 12px; display: grid; gap: 7px; font-size: 12.5px; line-height: 1.3; }
.legende li { display: grid; grid-template-columns: 30px 1fr; align-items: center; }
body[data-affichage="coupures"] .legende [data-affichage="circule"],
body[data-affichage="circule"] .legende [data-affichage="coupures"] { display: none; }

.trait { display: block; width: 24px; height: 5px; border-radius: 3px; }
.trait-coupure { background: var(--coupure); }
.trait-deviation { background: var(--deviation); }
.trait-circule { background: linear-gradient(90deg, #e2001a 0 33%, #0069b4 33% 66%, #009a44 66%); }
.trait-estime { height: 0; border-top: 5px dotted var(--deviation); border-radius: 0; background: none; }
.trait-heures { height: 0; border-top: 5px dashed var(--texte-doux); border-radius: 0; background: none; }
.trait-sens { position: relative; background: var(--coupure); }
.trait-sens::after { content: ""; position: absolute; left: 9px; top: 0.5px; width: 3px; height: 3px; border: solid #fff; border-width: 1.4px 1.4px 0 0; transform: rotate(45deg); }
.point { display: block; width: 12px; height: 12px; border-radius: 50%; margin-left: 6px; background: #fff; border: 3px solid; }
.point-borne { border-color: var(--texte); }
.point-deplace { border-color: var(--deplace); }
.point-ferme { border-color: var(--coupure); width: 10px; height: 10px; margin-left: 7px; border-width: 2.5px; }
.point-efface { border-color: #7d7d83; background: #d4d4d8; width: 10px; height: 10px; margin-left: 7px; border-width: 2px; }

/* Carte */
.leaflet-container { font-family: var(--police); }
.leaflet-tile-pane { filter: grayscale(1) contrast(0.8) brightness(1.1); }
.leaflet-control-zoom { border: 0 !important; box-shadow: var(--ombre) !important; border-radius: 12px !important; overflow: hidden; }
.leaflet-control-zoom a { border-color: var(--filet) !important; color: var(--texte) !important; }
.leaflet-tooltip.nom-station { display: flex; align-items: center; gap: 4px; }
.leaflet-tooltip.nom-station.posee { font-size: 11.5px; padding: 2px 6px; background: rgba(255, 255, 255, .9); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.leaflet-tooltip.nom-station.posee::before { display: none; }
.mini-pastille { display: inline-block; min-width: 17px; padding: 0 4px; border-radius: 4px; font-size: 10.5px; font-weight: 750; line-height: 16px; text-align: center; }
.leaflet-tooltip.bulle { font-size: 13px; font-weight: 550; padding: 5px 9px; border-radius: 8px; border: 0; box-shadow: 0 2px 10px rgba(0, 0, 0, .15); }
.leaflet-marker-icon.fleche { background: none; border: 0; }
.fleche svg { display: block; }

/* Une perturbation choisie ou survolée dans la liste : le reste s'efface. */
.carte .pt { transition: opacity .18s ease; }
.carte.focus .pt:not(.choisi) { opacity: .1; }

@media (max-width: 820px) {
  .mise-en-page { display: block; height: auto; }
  .zone-carte { height: 56dvh; position: sticky; top: 0; z-index: 0; }
  .panneau { position: relative; z-index: 1; border-right: 0; border-radius: 20px 20px 0 0; margin-top: -20px; padding: 22px 16px 32px; box-shadow: 0 -4px 20px rgba(0, 0, 0, .08); min-height: 60dvh; }
  h1 { font-size: 21px; }
  .bascule { top: 10px; left: 10px; }
  .bascule button { padding: 7px 10px; font-size: 13px; }
  .legende-carte { left: 10px; bottom: 30px; max-width: calc(100% - 20px); }
  .modes { flex-wrap: nowrap; overflow-x: auto; margin-left: -16px; margin-right: -16px; padding: 0 16px; scrollbar-width: none; }
  .modes::-webkit-scrollbar { display: none; }
  .modes button { flex: none; }
}
