/* ============================================================
   Entraves.ca — Design system v2 « Wow »
   Typo : Sora (titres) + Inter (texte)
   Style : glassmorphism urbain, gradients signal, motion fluide
   ============================================================ */

:root {
  --bg: #f4f5fb;
  --panel: #ffffff;
  --panel-2: #f8f9fd;
  --ink: #0d1226;
  --ink-soft: #5a6478;
  --ink-faint: #8b94a7;
  --line: #e6e8f2;
  --line-strong: #d5d9e8;
  --glass: rgba(255, 255, 255, 0.82);

  --accent: #ff4d3d;
  --accent-2: #ff7a18;
  --accent-dark: #d63726;
  --accent-soft: #ffece8;
  --accent-softer: #fff6f3;

  --grad: linear-gradient(115deg, #ff4d3d 0%, #ff7a18 100%);
  --grad-cool: linear-gradient(115deg, #4f46e5 0%, #7c3aed 55%, #a855f7 100%);
  --grad-night: linear-gradient(135deg, #12101f 0%, #1c1533 55%, #231542 100%);

  --fermee: #ff4d3d;   /* rue fermée        */
  --voie: #f5a524;     /* voie touchée      */
  --rue-fermee-type: #c2410c;
  --evt: #8b5cf6;      /* événement         */
  --pietonne: #10b981; /* rue piétonne      */
  --ok: #10b981;

  --glow: 0 0 0 1px rgba(255, 77, 61, 0.25), 0 8px 24px -6px rgba(255, 77, 61, 0.45);
  --shadow-sm: 0 1px 2px rgba(13, 18, 38, 0.05), 0 2px 8px rgba(13, 18, 38, 0.06);
  --shadow-md: 0 10px 28px -8px rgba(13, 18, 38, 0.16), 0 3px 8px -3px rgba(13, 18, 38, 0.08);
  --shadow-lg: 0 32px 64px -16px rgba(13, 18, 38, 0.28), 0 8px 20px -8px rgba(13, 18, 38, 0.12);

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --font-display: "Sora", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, .brand .logo, .btn, .chip, .type-badge {
  font-family: var(--font-display);
  letter-spacing: -0.015em;
}

a { color: var(--accent-dark); text-decoration-thickness: 1px; text-underline-offset: 2px; }

::selection { background: rgba(255, 77, 61, 0.2); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Scrollbar discrète ---------- */

#list::-webkit-scrollbar, .modal-card::-webkit-scrollbar { width: 10px; }
#list::-webkit-scrollbar-thumb, .modal-card::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}
#list::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   HEADER — glass premium
   ============================================================ */

header {
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid var(--line);
  padding: 0.45rem clamp(0.9rem, 2.5vw, 1.5rem); /* v20 : compact → carte plus haute */
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  position: sticky;
  top: 0;
  z-index: 1200;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--ink);
}

/* v20 : le sélecteur de province vit DANS la marque (à côté du logo).
   La rangée header-actions ne porte plus que les boutons → l'en-tête tient
   sur UNE ligne sur desktop comme mobile, et la carte gagne la hauteur. */
.brand-prov { display: inline-flex; align-items: center; }

.brand .logo {
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.035em;
}

.brand .logo .rouge {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand .tagline {
  font-size: 0.74rem;
  color: var(--ink-soft);
  border-left: 1px solid var(--line-strong);
  padding-left: 0.6rem;  letter-spacing: 0.01em;
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.theme-toggle {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  transition: transform 0.25s var(--spring), border-color 0.15s ease, box-shadow 0.2s ease;
}

/* Sélecteur de langue FR/EN */
.lang-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  padding: 0 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.2s var(--spring);
}

.lang-btn:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  transform: translateY(-1px);
}

.theme-toggle:hover { border-color: var(--accent); transform: rotate(-12deg) scale(1.06); }

/* ============================================================
   BOUTONS — la star du show
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.62rem 1.25rem;
  border-radius: 999px;
  border: none;
  font-weight: 600;
  font-size: 0.9rem;
  font-family: var(--font-display);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.22s var(--spring), box-shadow 0.22s ease, background 0.2s ease, color 0.2s ease;
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
}

.btn:active { transform: translateY(1px) scale(0.98); }

.btn-primary {
  background: var(--grad);
  background-size: 160% 160%;
  color: #fff;
  box-shadow: 0 6px 18px -4px rgba(255, 77, 61, 0.5);
}

.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.35) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.7s var(--ease);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -6px rgba(255, 77, 61, 0.6);
  background-position: 100% 50%;
}

.btn-primary:hover::after { transform: translateX(120%); }

.btn-secondary {
  background: var(--panel);
  border: 1.5px solid var(--line-strong);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-report {
  background: var(--grad-night);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 8px 22px -8px rgba(18, 16, 31, 0.7);
}

.btn-report:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -8px rgba(18, 16, 31, 0.8); }

/* Bouton "gemme" pour la pub */
.btn-gem {
  background: var(--grad-cool);
  color: #fff;
  box-shadow: 0 6px 18px -4px rgba(124, 58, 237, 0.5);
}

.btn-gem:hover { transform: translateY(-2px); box-shadow: 0 12px 28px -6px rgba(124, 58, 237, 0.6); }

/* Actions carte (FABs) — visibles mobile ET desktop */
.mobile-map-actions {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  z-index: 1000;
  display: none; /* remplacée par .map-topbar (au-dessus de la carte) */
  flex-direction: column;
  gap: 0.45rem;
}

/* Desktop ≥1280px : la barre d'outils au-dessus de la carte est visible
   (elle existe déjà sur mobile). */
@media (min-width: 1280px) {
  .mobile-map-actions { display: none; } /* remplacée par .map-topbar */
}

/* Barre d'outils horizontale — AU-DESSUS de la carte (flux normal du #map-wrap).
   Aucune superposition possible avec les publicités. */
.map-topbar {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0.45rem 0.7rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 1200;
  flex: 0 0 auto;   /* ne partage PAS la ligne horizontale avec la carte */
  width: 100%;
  height: auto;     /* la barre garde sa vraie hauteur (3 boutons + pastilles) */
  min-height: 0;
}

/* Menu des couches : déroule SOUS la barre d'outils, au-dessus de la carte.
   La barre (.map-topbar) est positionnée → le menu est ancré à la BARRE,
   jamais au milieu de la carte. */
.map-topbar { position: relative; }
.map-topbar .layer-menu {
  position: absolute;
  top: 3.4rem;   /* sous les 3 boutons */
  right: 0.7rem;
  left: auto;
  z-index: 1250;
}

/* Légende : au-dessus de la carte, mais SOUS le menu des couches (z moindre) */
#map-wrap .legend { z-index: 800; }
/* ---------- Segments de mode (Entraves/GPS/Mixte) + pastilles couleurs ---------- */
.mode-seg {
  display: flex;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.15rem;
  gap: 0.1rem;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.mode-seg button {
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--ink-soft);
  padding: 0.32rem 0.65rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.mode-seg button:hover { background: var(--accent-soft); }
.mode-seg button.active {
  background: var(--grad, var(--accent));
  color: #fff;
  box-shadow: 0 2px 8px -2px rgba(226, 73, 47, 0.55);
}

/* Pastilles de couleurs des travaux — lisibles en permanence, jamais sur la carte */
.map-colors {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  box-shadow: var(--shadow-sm);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--ink-soft);
  white-space: nowrap;
  flex-shrink: 0;
  overflow: hidden;
}
.map-colors .mc-item { display: flex; align-items: center; gap: 0.3rem; }
.map-colors .mc-item i {
  display: inline-block;
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

/* Chip GPS flottant : en bas à GAUCHE de la carte (au-dessus du zoom Leaflet).
   z-index ÉLEVÉ + pointer-events explicites : il doit rester cliquable
   au-dessus de tout, sur desktop comme mobile. */
.gps-chip {
  position: absolute;
  left: 0.7rem;
  bottom: 8rem; /* v20 : DANS la carte, juste au-dessus des boutons +/− (zoom bottom 3.4rem + 62px) */
  z-index: 1100;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 800;
  font-family: var(--font-display);
  color: #1a73e8;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}
.gps-chip:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.gps-chip:active { transform: scale(0.95); }
.gps-chip .gps-chip-dist { letter-spacing: 0.02em; }

/* v19 : le chip pulse doucement tant que la position n'est pas connue —
   impossible à rater. État .gps-off = rouge (problème explicité). */
.gps-chip { animation: gps-pulse 2.6s ease-in-out infinite; }
.gps-chip.gps-off { color: #c22; border-color: #f3c2c2; animation: none; }
@keyframes gps-pulse {
  0%, 100% { box-shadow: var(--shadow-md), 0 0 0 0 rgba(26, 115, 232, 0.35); }
  50% { box-shadow: var(--shadow-md), 0 0 0 9px rgba(26, 115, 232, 0); }
}
@media (max-width: 899px) {
  .gps-chip { padding: 0.6rem 1rem; font-size: 0.85rem; bottom: 8.2rem; }
}

/* Panneau GPS (actions position) — modale légère centrée, sombre-friendly */
.gps-panel {
  position: fixed; inset: 0; z-index: 1600;
  display: none; align-items: center; justify-content: center;
  background: rgba(16, 24, 40, 0.45); backdrop-filter: blur(3px);
  padding: 1rem;
}
.gps-panel.open { display: flex; }
.gps-panel .gps-card {
  background: var(--panel); border-radius: 20px; padding: 1.4rem 1.4rem 1.2rem;
  max-width: 420px; width: 100%; box-shadow: 0 24px 70px -18px rgba(0, 0, 0, 0.5);
  position: relative; border: 1px solid var(--line);
}
.gps-panel h3 { margin: 0 0 0.4rem; font-family: var(--font-display); font-size: 1.15rem; }
.gps-panel .gps-card-x {
  position: absolute; top: 0.7rem; right: 0.7rem; border: none; background: var(--accent-soft, #fdeee6);
  color: var(--accent-dark, #b93a24); width: 30px; height: 30px; border-radius: 50%;
  cursor: pointer; font-size: 0.85rem; font-weight: 800;
}
.gps-panel .gps-status {
  font-size: 0.86rem; color: var(--ink-soft); min-height: 2.2em; margin: 0 0 0.9rem;
  font-weight: 600; overflow-wrap: anywhere;
}
.gps-panel .gps-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem; }
.gps-panel .gps-actions button,
.gps-panel .gps-actions a {
  display: flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.62rem 0.5rem; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg, #f6f5f1); font: inherit; font-weight: 800; font-size: 0.85rem;
  color: var(--ink); text-decoration: none; cursor: pointer; transition: transform 0.12s, box-shadow 0.12s;
}
.gps-panel .gps-actions button:hover,
.gps-panel .gps-actions a:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.gps-panel .gps-actions #gp-waze { background: #33ccff22; border-color: #33ccff55; color: #0a7ca8; }
.gps-panel .gps-actions #gp-gmaps { background: #34a8531a; border-color: #34a85344; color: #188038; }
.gps-panel .gps-note { font-size: 0.74rem; color: var(--ink-soft); margin: 0.9rem 0 0; line-height: 1.45; }
@media (max-width: 899px) {
  .gps-panel { align-items: flex-end; padding: 0.7rem; }
  .gps-panel .gps-card { margin-bottom: 0.5rem; }
  .gps-panel .gps-actions { grid-template-columns: 1fr 1fr; }
}

/* Pastille GPS (position utilisateur) — rendue par Leaflet divIcon */
.user-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
}
.user-dot-core {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #1a73e8;
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.35), 0 0 14px rgba(26, 115, 232, 0.65);
  animation: userPulse 2.4s ease-in-out infinite;
}
@keyframes userPulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.35), 0 0 10px rgba(26, 115, 232, 0.5); }
  50% { box-shadow: 0 0 0 4px rgba(26, 115, 232, 0.15), 0 0 20px rgba(26, 115, 232, 0.8); }
}

/* Éléments d'ancrage hors écran (position GPS partagée JS <-> carte) */
.user-marker-el { display: none; }

.map-topbar .map-fab {
  width: 40px;
  height: 40px;
  font-size: 1.05rem;
  flex: 0 0 auto;
}

/* Newsletter : bandeau fin sous la carte (elle vit dans #map-wrap) */
#map-wrap .nl-box { border-radius: 0; }

.mobile-map-actions .map-fab {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-md);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s var(--spring);
  -webkit-tap-highlight-color: transparent;
}

.mobile-map-actions .map-fab:hover { transform: translateY(-2px); }
.mobile-map-actions .map-fab:active { transform: scale(0.92); }

/* ============================================================
   PUB PRÉMIUM AUTOUR DE LA CARTE — rails + bannière
   ============================================================ */

/* ============================================================
   PUB & CARTE — SLOTS SÉPARÉS (v20)
   Chaque bandeau pub est un RANG de la colonne flex #map-wrap :
   barre d'outils(1) → pub HAUTE(2) → CARTE(3) → pub BASSE(4) → newsletter(5).
   La carte reste au centre, visible et manipulable, sur tout écran.
   Mobile : 1 pub au-dessus + 1 en dessous → carte recentrée visuellement,
   et la page entière défile normalement.
   ============================================================ */
/* v22 : TOUT sur UNE ligne d'en-tête (desktop) — logo, provinces, outils,
   actions. La topbar ne prend plus une rangée pleine largeur : la carte
   gagne encore de la hauteur. Mobile : JS la remet dans #map-wrap. */
header .map-topbar {
  order: 3;
  flex: 1 1 0; /* v22 : basis 0 → prend l'espace RESTANT, jamais de wrap */
  min-width: 0;
  justify-content: center;
  border-bottom: none;
  padding: 0.15rem 0.3rem;
  background: transparent;
  flex-wrap: nowrap;
  /* PAS d'overflow-x ici : il clippait le menu des couches (🚦) sur desktop */
}
/* v22 : à 1440px la ligne est juste trop pleine → la tagline laisse sa place
   aux outils (elle revient sur les très grands écrans) */
@media (max-width: 1599px) {
  .brand .tagline { display: none; }
}
/* Composants de la topbar en mode header : compacts */
header .map-topbar .map-fab { width: 32px; height: 32px; font-size: 0.85rem; }
header .map-topbar .mode-seg button { padding: 0.3rem 0.55rem; font-size: 0.72rem; }
header .map-topbar .map-colors { font-size: 0.62rem; padding: 0.25rem 0.4rem; gap: 0.4rem; }
#map-wrap { position: relative; } /* repère des rails pub absolus (v22) */
/* v22.3 : ORDRE CORRIGÉ — bandeau HAUT (1) au-dessus de la carte (2),
   bandeau BAS (3), newsletter (4). Le bug « 8 pubs sous la carte » venait
   de #map en order 1 qui passait AVANT le bandeau haut. */
#map-wrap #map { order: 2; }
#map-wrap .nl-box { order: 4; }

.map-ad { display: flex; align-items: center; width: 100%; min-width: 0; padding: 0 0.45rem; }
.map-ad.slot-top { order: 1; margin: 0.45rem 0; }
.map-ad.slot-bottom { order: 3; margin: 0.45rem 0; }

/* v22.2 : RAILS latéraux — vécus DANS la boîte de la carte (déplacés par JS
   dans #map). MÊME LARGEUR qu'une carte de pub du bandeau haut/bas (grille 4),
   plus courts que la carte : ne touche ni le zoom, ni la chip, ni l'attribution. */
.map-ad.slot-left,
.map-ad.slot-right {
  position: absolute;
  top: 0.4rem;
  bottom: 0.4rem; /* v22.3 : jusqu'au BAS de la carte (le zoom+GPS sont à côté) */
  height: auto;
  width: calc((100% - 2.25rem) / 4); /* = largeur d'UNE carte du bandeau 4 colonnes */
  padding: 0;
  z-index: 900;
}
.map-ad.slot-left { left: 0.4rem; }
.map-ad.slot-right { right: 0.4rem; }
.map-ad-rail {
  display: grid !important;
  grid-template-rows: 1fr 1fr; /* v22.5 : 2 pubs empilées par côté */
  gap: 0.5rem;
  height: 100%;
  max-width: none !important;
}
.map-ad-rail .ad-slot {
  height: auto !important;
  min-height: 0;
  border-radius: 14px;
}
/* v22.2 : rails larges → même présentation horizontale que les pubs haut/bas,
   centrée verticalement dans la carte verticale */
.map-ad-rail .ad-content {
  flex-direction: column !important;
  height: 100%;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 0.6rem;
  padding: 0.9rem 0.7rem;
}
.map-ad-rail .ad-visual { width: 56px; height: 56px; font-size: 1.6rem; flex: 0 0 56px; }
.map-ad-rail .ad-copy { display: flex; flex-direction: column; align-items: center; }
.map-ad-rail .ad-title { white-space: normal; font-size: 0.9rem; }
.map-ad-rail .ad-desc {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; font-size: 0.74rem;
}
.map-ad-rail .ad-cta { margin-top: 0.4rem; writing-mode: horizontal-tb; }

/* v22 : logo du client dans l'icône de la pub (à la place de l'emoji) */
.ad-visual img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
  padding: 2px;
  display: block;
}

/* v22.6 : pub VIDÉO dans les rails — joue en entier, puis rotation */
.ad-video-slot { position: relative; overflow: hidden; background: #000; }
.ad-video-slot video.rail-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.rail-video-bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: linear-gradient(transparent, rgba(10, 14, 25, 0.88));
  padding: 0.7rem 0.55rem 0.45rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.rail-video-bar .ad-title {
  color: #fff;
  font-size: 0.8rem;
  margin: 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rail-video-bar .ad-cta { flex: 0 0 auto; padding: 0.3rem 0.6rem; font-size: 0.7rem; }
.ad-video-slot .ad-mini-available { z-index: 5; }
.map-ad-inner {
  display: grid; grid-template-columns: 1fr; gap: 0.45rem;
  width: 100%; min-width: 0;
}
.map-ad-inner .ad-slot {
  width: 100%; min-width: 0; height: 72px; margin: 0; /* v21 : bande fine — la carte respire */
  border-radius: var(--radius-lg, 16px); box-shadow: var(--shadow-md);
  overflow: hidden; position: relative;
}
.map-ad-inner .ad-slot .ad-content {
  flex-wrap: nowrap; height: 100%; align-items: center;
  padding: 0.45rem 0.65rem; gap: 0.55rem;
}
.map-ad-inner .ad-visual { width: 40px; height: 40px; flex: 0 0 40px; font-size: 1.1rem; }
.map-ad-inner .ad-title { font-size: 0.82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-ad-inner .ad-desc {
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
  overflow: hidden; font-size: 0.72rem; margin: 0.1rem 0 0;
}
.map-ad-inner .ad-cta { flex: 0 0 auto; padding: 0.4rem 0.7rem; font-size: 0.72rem; }

/* v22.1 : 4 pubs EN HAUT + 4 EN BAS (desktop), 1+1 (mobile ≤ 900px)
   — les rails latéraux gardent leur colonne verticale (map-ad-rail). */
@media (min-width: 901px) {
  .slot-top .map-ad-inner,
  .slot-bottom .map-ad-inner { grid-template-columns: repeat(4, 1fr); }
}
/* Desktop large : les bandeaux restent à la largeur de la carte —
   chaque pub reste lisible sans devenir une tour de 230px. */
@media (min-width: 1280px) {
  .map-ad-inner { max-width: 100%; }
}

/* Mobile/tablette : UNE pub au-dessus + UNE en dessous de la carte */
@media (max-width: 899px) {
  .map-ad-inner > .ad-slot:nth-child(n+2) { display: none; }
}

/* Anciens rails (v17, retirés) : règle conservée pour les vestiges éventuels */
.map-ads .map-ad.slot-left,
.map-ads .map-ad.slot-right,
.map-ads .map-ad-center,
.legend-rail { display: none !important; }

/* v22.1 : les NOUVEAUX rails ne s'affichent que sur grand desktop */
@media (max-width: 1099px) {
  .map-ad.slot-left,
  .map-ad.slot-right { display: none !important; }
}

/* v21 : sidebar resserrée → ~½ pouce de CARTE en plus (les bandeaux pub
   suivent la largeur de la carte, donc tout gagne) ; la newsletter reste
   une ligne fine sous la carte. */
@media (min-width: 1280px) {
  #map-wrap { flex: 1.15; max-width: calc(100% - 380px); }
  #sidebar { width: clamp(320px, 28vw, 400px); }
}

/* Spotte publicitaire mobile « carte-bord » : une fiche compacte glisse
   DEPUIS LE BAS de la carte (5 s), sans jamais couvrir le centre —
   l'utilisateur glisse ou tape pour la chasser plus tôt. */
.mobile-spot {
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  bottom: 2.9rem;
  z-index: 960;
  max-width: 380px;
  margin: 0 auto;
  transform: translateY(150%);
  opacity: 0;
  transition: transform 0.45s var(--spring), opacity 0.35s ease;
  pointer-events: none;
}
.mobile-spot.show { transform: translateY(0); opacity: 1; pointer-events: auto; }
.mobile-spot .ad-slot { margin: 0; box-shadow: var(--shadow-lg); position: relative; }
.mobile-spot .ad-slot .ad-content { padding: 0.5rem 0.6rem; gap: 0.5rem; }
.mobile-spot .ad-slot .ad-visual { width: 36px; height: 36px; font-size: 1.05rem; }
.mobile-spot .ad-slot .ad-title { font-size: 0.8rem; }
.mobile-spot .mobile-spot-x {
  position: absolute; top: -0.55rem; right: -0.15rem;
  width: 1.5rem; height: 1.5rem; border-radius: 50%;
  border: 1px solid var(--line); background: var(--panel);
  color: var(--ink-soft); font-size: 0.8rem; line-height: 1;
  box-shadow: var(--shadow-sm); cursor: pointer;
}
.mobile-spot .mobile-spot-bar { display: flex; justify-content: space-between; align-items: center; padding: 0.25rem 0.6rem 0; font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-faint); }
.mobile-spot .mobile-spot-bar b { color: var(--ink-soft); font-weight: 700; letter-spacing: 0.04em; }
@media (min-width: 901px) { .mobile-spot { display: none; } }

/* ---------- NAVIGATION GPS (Waze / Google Maps) ---------- */

.nav-links {
  display: flex;
  gap: 0.5rem;
  margin: 0.65rem 0;
  flex-wrap: wrap;
}

.btn-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: var(--font-display);
  color: #fff;
  text-decoration: none;
  transition: transform 0.18s var(--spring), box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn-nav:hover { transform: translateY(-2px); }
.btn-nav:active { transform: translateY(0) scale(0.97); }

.btn-nav.waze {
  background: linear-gradient(115deg, #33ccff 0%, #0f9bd7 100%);
  box-shadow: 0 6px 16px -5px rgba(15, 155, 215, 0.55);
}

.btn-nav.gmaps {
  background: linear-gradient(115deg, #4285f4 0%, #1a73e8 100%);
  box-shadow: 0 6px 16px -5px rgba(26, 115, 232, 0.55);
}

.btn-nav svg { flex-shrink: 0; }

/* GPS intégré de la plateforme (tracé OSRM) */
.btn-nav.drive {
  background: var(--grad);
  box-shadow: 0 6px 16px -5px rgba(226, 73, 47, 0.55);
  border: none;
  cursor: pointer;
}

.btn-nav.drive:disabled { opacity: 0.65; cursor: wait; transform: none; }

/* v21 : « Sortez-moi d'ici » — urgence évasion, style distinct */
.btn-nav.escape {
  background: linear-gradient(135deg, #1a73e8, #0b47a1);
  color: #fff;
  box-shadow: 0 6px 16px -5px rgba(26, 115, 232, 0.6);
  border: none;
  cursor: pointer;
}
.btn-nav.escape:active { transform: translateY(0) scale(0.97); }

.route-flag {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50% 50% 50% 4px;
  background: var(--grad);
  border: 2px solid #fff;
  box-shadow: 0 4px 12px -2px rgba(226, 73, 47, 0.6);
  font-size: 15px;
}

.leaflet-popup-content .route-line b { font-family: var(--font-display); }

/* ---------- CROISSANCE : provinces, PWA, infolettre, alertes ---------- */

/* Mobile : la légende des couleurs vit dans le rail gauche de la grille pub
   (desktop) et à côté des boutons dans la topbar (tablette/mobile) —
   l'ancienne légende flottante sur la carte est retirée partout.
   Les pastilles .map-colors restent visibles sur TOUS les écrans. */
.legend { display: none; }
.legend-rail { display: none !important; }

.province-select {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: var(--font-display);
  padding: 0.42rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  max-width: 150px;
}

@media (max-width: 900px) {
  .province-select { max-width: 118px; font-size: 0.72rem; padding: 0.38rem 0.4rem; }
  header .btn-report { padding: 0.4rem 0.65rem; font-size: 0.7rem; }
  header { gap: 0.4rem; padding: 0.35rem 0.6rem; } /* v22 : une seule rangée compacte */
  .brand { flex-wrap: nowrap; }
  .brand-prov { flex: 0 1 auto; } /* v22 : province À CÔTÉ du logo, plus sur sa propre ligne */
  .header-actions { gap: 0.3rem; }
  .header-actions .btn { padding: 0.4rem 0.7rem; font-size: 0.72rem; min-height: 38px; }
}

/* v21 : sur petit écran, « Signaler une entrave » défile lentement à
   l'intérieur du bouton (masqué, sans déborder) — le texte se lit en entier. */
@media (max-width: 560px) {
  header .btn-report {
    max-width: 122px;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
  }
  header .btn-report .rpt-marquee {
    display: inline-block;
    padding-right: 2.2rem; /* gap avant la répétition */
    animation: rpt-scroll 9s linear infinite;
  }
  @keyframes rpt-scroll {
    from { transform: translateX(0); }
    to { transform: translateX(-100%); }
  }
  @media (prefers-reduced-motion: reduce) {
    header .btn-report .rpt-marquee { animation: none; padding-right: 0; }
  }
}

.province-select:focus { outline: 2px solid rgba(226, 73, 47, 0.35); }

/* v22.3 : bouton « 🧭 GPS » à côté du sélecteur — visible UNIQUEMENT dans
   les provinces sans données temps réel (« bientôt ») : la navigation
   fonctionne déjà partout, alors on la met en avant. */
.prov-gps-btn {
  display: none;
  align-items: center;
  gap: 0.25rem;
  margin-left: 0.4rem;
  padding: 0.42rem 0.7rem;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 800;
  font-family: var(--font-display);
  color: #fff;
  background: linear-gradient(135deg, #1a73e8, #0b47a1);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 6px 16px -6px rgba(26, 115, 232, 0.65);
}
.prov-gps-btn.show { display: inline-flex; }
.prov-gps-btn:active { transform: scale(0.96); }
@media (max-width: 900px) {
  .prov-gps-btn { padding: 0.35rem 0.55rem; font-size: 0.7rem; }
}

.pwa-install {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1400;
  background: var(--grad);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 0.55rem 1rem 0.55rem 0.6rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  font-family: var(--font-display);
  box-shadow: 0 10px 30px -8px rgba(226, 73, 47, 0.65);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  animation: pwaIn 0.35s var(--spring, ease-out);
}

/* v21 : toast de confirmation après installation (voiture+cône sur l'écran d'accueil) */
.pwa-toast {
  position: fixed;
  left: 50%;
  bottom: 5.4rem;
  transform: translate(-50%, 16px);
  z-index: 1500;
  background: #0f2318;
  color: #d8f5e3;
  border: 1px solid rgba(52, 199, 123, 0.45);
  border-radius: 999px;
  padding: 0.65rem 1.1rem;
  font-weight: 700;
  font-size: 0.86rem;
  box-shadow: 0 12px 34px -12px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.35s var(--spring, ease);
  pointer-events: none;
  max-width: min(92vw, 480px);
  text-align: center;
}
.pwa-toast.show { opacity: 1; transform: translate(-50%, 0); }

.pwa-install .pwa-ico {
  display: flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 12px;
  background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}
.pwa-install .pwa-ico img { width: 100%; height: 100%; display: block; } /* même icône que l'app installée */
.pwa-install .pwa-txt { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.pwa-install .pwa-txt small { font-size: 0.68rem; font-weight: 600; opacity: 0.9; }
.pwa-install .pwa-x {
  margin-left: 0.2rem; opacity: 0.8; font-size: 0.8rem; padding: 0.35rem; cursor: pointer;
}
.pwa-install .pwa-x:hover { opacity: 1; }

@keyframes pwaIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Aide à l'installation (iOS / fallback navigateur) */
.install-help {
  position: fixed; inset: 0; z-index: 1650;
  display: none; align-items: center; justify-content: center;
  background: rgba(16, 24, 40, 0.5); backdrop-filter: blur(3px); padding: 1rem;
}
.install-help.open { display: flex; }
.install-help .ih-card {
  background: var(--panel); border-radius: 20px; padding: 1.5rem;
  max-width: 440px; width: 100%; box-shadow: 0 24px 70px -18px rgba(0, 0, 0, 0.5);
  position: relative; border: 1px solid var(--line);
}
.install-help h3 { margin: 0 0 0.7rem; font-family: var(--font-display); font-size: 1.15rem; }
.install-help ol { margin: 0; padding-left: 1.3rem; display: grid; gap: 0.55rem; }
.install-help li { font-size: 0.9rem; line-height: 1.45; }
.install-help .ih-x {
  position: absolute; top: 0.7rem; right: 0.7rem; border: none; background: var(--accent-soft, #fdeee6);
  color: var(--accent-dark, #b93a24); width: 30px; height: 30px; border-radius: 50%;
  cursor: pointer; font-size: 0.85rem; font-weight: 800;
}
.install-help .ih-note { font-size: 0.76rem; color: var(--ink-soft); margin: 0.9rem 0 0; line-height: 1.5; }

/* Newsletter « pires entraves » : sous la carte, à droite (bloc flottant discret) */
/* Newsletter : bandeau fin SOUS la carte, contenu aligné à droite —
   plus d'empiètement sur la carte ni sur la liste. */
.nl-box {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 var(--radius-lg, 16px) var(--radius-lg, 16px);
  padding: 0.4rem 0.7rem;
  z-index: 5;
  margin-bottom: 0.5rem;
}

.nl-box .nl-label { font-size: 0.74rem; font-weight: 700; white-space: nowrap; }

.nl-box input[type="email"] {
  flex: 1 1 200px;
  max-width: 300px;
  font: inherit;
  font-size: 0.85rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
}

.nl-box .btn { padding: 0.45rem 0.95rem; font-size: 0.8rem; }
.nl-note { font-size: 0.78rem; color: var(--ink-soft); }

.alerts-bar {
  display: none;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-dark);
  background: var(--accent-soft, rgba(226, 73, 47, 0.08));
  border: 1px solid rgba(226, 73, 47, 0.25);
  border-radius: 12px;
  padding: 0.5rem 0.7rem;
  margin: 0.6rem 0.7rem 0;
}

.alerts-bar button {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--ink-soft);
  padding: 0.2rem 0.4rem;
  border-radius: 8px;
}

.alerts-bar button:hover { background: rgba(0, 0, 0, 0.06); }

/* ---------- LÉGENDE HORIZONTALE EN HAUT + ZOOM EN BAS ---------- */

/* Légende : AU-DESSUS de la carte (coin haut-centre), pilule horizontale.
   Elle vit maintenant dans #map-wrap — jamais recouverte par les rails pub
   (qui commencent sous la barre d'outils). */
.legend {
  position: absolute;
  top: 0.55rem;
  left: 50%;
  transform: translateX(-50%);
  bottom: auto;
  right: auto;
  z-index: 800; /* sous le menu de couches (1250), au-dessus des tuiles */
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  max-width: min(70%, 680px);
  white-space: nowrap;
  pointer-events: none; /* la carte reste draggable à travers la légende */
}
.legend .legend-toggle { pointer-events: auto; }
.legend.expanded { pointer-events: auto; }

.legend h4 {
  margin: 0;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-faint);
  flex-shrink: 0;
}

.legend ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  overflow: hidden;
}

.legend li { display: flex; align-items: center; gap: 0.35rem; font-size: 0.74rem; font-weight: 600; }
.legend li:nth-child(n+4) { display: none; } /* sur écrans moyens : 3 items principaux */
@media (min-width: 1500px) { .legend li:nth-child(n+4) { display: flex; } }

/* Bouton d'extension de la légende (voir tous les items) */
.legend .legend-toggle {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.15rem 0.35rem;
  border-radius: 8px;
  line-height: 1;
  transition: transform 0.15s ease, background 0.15s ease;
}
.legend .legend-toggle:hover { background: rgba(0, 0, 0, 0.06); }
.legend.expanded .legend-toggle { transform: rotate(90deg); }
.legend.expanded { white-space: normal; }
.legend.expanded ul { flex-wrap: wrap; row-gap: 0.3rem; max-width: min(92%, 620px); }
.legend.expanded li:nth-child(n+4) { display: flex; }

/* Zoom déplacé en bas-gauche (la légende occupe le haut) */
.leaflet-top.leaflet-left { top: auto; bottom: 3.4rem; }
.leaflet-control-zoom { border: 1px solid var(--line) !important; box-shadow: var(--shadow-md); border-radius: 12px !important; overflow: hidden; }

/* v22.3 (desktop ≥ 1100px) : zoom +/− et chip GPS À DROITE de la pub de
   gauche, en bas de la carte — les rails occupent maintenant toute la hauteur. */
@media (min-width: 1100px) {
  .leaflet-top.leaflet-left { left: calc((100% - 2.25rem) / 4 + 0.55rem); bottom: 0.5rem; }
  .gps-chip { left: calc((100% - 2.25rem) / 4 + 0.55rem); bottom: 4.7rem; }
}

/* v22.3 : attribution recentrée en bas-centre (entre les rails, toujours lisible) */
.leaflet-bottom.leaflet-right { right: auto; left: 50%; transform: translateX(-50%); max-width: 55%; }
.leaflet-control-attribution { background: rgba(255, 255, 255, 0.88) !important; border-radius: 8px 8px 0 0; padding: 1px 8px; font-size: 0.62rem !important; }

/* Note waitlist inline (provinces sans flux temps réel) */
.waitlist-note {
  margin: 0.7rem;
  padding: 0.75rem 0.9rem;
  border-radius: 14px;
  background: var(--accent-soft, rgba(226, 73, 47, 0.07));
  border: 1px solid rgba(226, 73, 47, 0.22);
  font-size: 0.84rem;
  line-height: 1.5;
}

/* Note province sur les pages FAQ (adaptée dynamiquement) */
.province-note {
  margin: 0 0 1.1rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: var(--accent-soft, rgba(226, 73, 47, 0.07));
  border: 1px solid rgba(226, 73, 47, 0.22);
  font-size: 0.9rem;
  line-height: 1.55;
}
.province-note a { color: var(--accent-dark, #b93a24); font-weight: 600; }

/* ---------- MENU DES COUCHES (trafic, radars, caméras…) ---------- */

/* (Règles principales du menu : voir .map-topbar .layer-menu plus haut) */
.layer-menu {
  min-width: 250px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg, 0 18px 50px -12px rgba(13, 18, 38, 0.35));
  padding: 0.55rem 0.65rem 0.65rem;
  display: none;
}

.layer-menu.open { display: block; animation: layerIn 0.16s var(--spring, ease-out); }

@keyframes layerIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

.layer-menu .layer-menu-title {
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 0.2rem 0.35rem 0.45rem;
}

.layer-menu .layer-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.45rem;
  border-radius: 9px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

.layer-menu .layer-item:hover { background: var(--panel-2, rgba(0,0,0,0.045)); }

.layer-menu .layer-item input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--accent, #e2492f);
  cursor: pointer;
}

.layer-menu .layer-ico { font-size: 1.05rem; }

body.dark .layer-menu {
  background: #1a2130;
  border-color: rgba(255, 255, 255, 0.09);
}

body.dark .layer-menu .layer-item:hover { background: rgba(255, 255, 255, 0.06); }

/* Toggle trafic actif */
.mobile-map-actions .map-fab { position: relative; }

.map-fab.active {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 6px 18px -4px rgba(226, 73, 47, 0.6);
  border-color: transparent;
}

.map-fab.active::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  border: 2px solid rgba(255, 122, 24, 0.55);
  animation: fabPulse 1.8s ease-in-out infinite;
}

@keyframes fabPulse {
  0%, 100% { opacity: 0.9; transform: scale(1); }
  50% { opacity: 0.25; transform: scale(1.08); }
}

/* ---------- TITLES PUB CARTE (price card premium) ---------- */

.price-card .p-name { white-space: nowrap; }

.ad-form .price-box .price-card {
  flex: 1 1 150px;
  min-width: 140px;
  max-width: 200px;
  padding: 0.55rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.ad-form .price-box .price-card .p-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 560px) {
  .ad-form .price-box .price-card { flex: 1 1 46%; min-width: 0; max-width: none; }
}

/* ============================================================
   LAYOUT — app plein écran
   ============================================================ */

main {
  flex: 1;
  display: flex;
  min-height: 0;
  position: relative;
}

#sidebar {
  width: clamp(340px, 30vw, 460px);
  min-width: 320px;
  background: var(--bg);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}#map-wrap {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column; /* barre d'outils → pub haute → CARTE → pub basse → newsletter */
}

#map {
  flex: 1;
  min-width: 0;
  min-height: 320px; /* la carte ne peut plus s'effacer (bug 0px) */
  z-index: 1;
}

/* ============================================================
   NAVIGATION TURN-BY-TURN (façon Waze) — bandeau plein écran
   ============================================================ */

.nav-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1500;
  background: linear-gradient(160deg, #0f1a2b 0%, #1a2b45 100%);
  color: #fff;
  padding: 0.7rem 0.9rem 0.8rem;
  box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.55);
}
.nav-banner .nav-turn {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding-right: 2.4rem;
}
.nav-banner .nav-ico { font-size: 1.9rem; line-height: 1; filter: drop-shadow(0 2px 6px rgba(0,0,0,.45)); }
.nav-banner .nav-road {
  flex: 1;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-banner .nav-dist {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  color: #6fe3a1;
  white-space: nowrap;
}
.nav-banner .nav-stats {
  display: flex;
  gap: 1.1rem;
  margin-top: 0.45rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.88);
}
.nav-banner .nav-actions {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.nav-banner .nav-mini {
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 10px;
  width: 2rem;
  height: 2rem;
  font-size: 0.9rem;
  cursor: pointer;
}
.nav-banner .nav-x {
  position: absolute;
  top: -0.4rem;
  right: -0.1rem;
  background: #e2492f;
  border: 2px solid #fff;
  color: #fff;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 3px 10px -2px rgba(0, 0, 0, 0.5);
}

/* Mode navigation : la page se concentre sur la carte */
.nav-mode > header,
.nav-mode #sidebar,
.nav-mode .nl-box,
.nav-mode footer { display: none !important; }
.nav-mode #map-wrap { position: fixed !important; inset: 0 !important; top: 0 !important; z-index: 1200; height: 100dvh; width: 100vw; max-width: none !important; }
.nav-mode #map { height: 100dvh !important; min-height: 0 !important; }
.nav-mode .map-topbar { position: absolute; top: 4.6rem; left: 50%; transform: translateX(-50%); z-index: 1250; border-radius: 999px; border: 1px solid var(--line); box-shadow: var(--shadow-lg); }

/* ============================================================
   TOOLBAR — glass card flottante
   ============================================================ */

.toolbar {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  border-bottom: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.search-row {
  display: flex;
  gap: 0.5rem;
}

#search {
  flex: 1;
  min-width: 0;
  padding: 0.68rem 1rem;
  border-radius: 999px;
  border: 1.5px solid var(--line-strong);
  background: var(--panel);
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.2s ease;
  min-height: 44px;
}

#search::placeholder { color: var(--ink-faint); }

#search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(255, 77, 61, 0.14);
}

.icon-btn {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 999px;
  border: 1.5px solid var(--line-strong);
  background: var(--panel);
  cursor: pointer;
  font-size: 1.05rem;
  transition: transform 0.2s var(--spring), border-color 0.15s ease;
}

.icon-btn:hover { border-color: var(--accent); transform: scale(1.08); }

/* ---------- Chips / filtres ---------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1.5px solid var(--line-strong);
  background: var(--panel);
  font-size: 0.79rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.18s var(--ease);
  min-height: 40px;
  -webkit-tap-highlight-color: transparent;
}

.chip .dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  display: inline-block;
}

.chip:hover { border-color: var(--accent); color: var(--accent-dark); transform: translateY(-1px); }

.chip.active {
  background: var(--grad);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px -3px rgba(255, 77, 61, 0.5);
}

.chip.active .dot { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.55); }

.filter-row2 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.79rem;
  color: var(--ink-soft);
}

.filter-row2 select {
  padding: 0.38rem 0.6rem;
  border-radius: 10px;
  border: 1.5px solid var(--line-strong);
  background: var(--panel);
  font: inherit;
  font-size: 0.79rem;
  color: var(--ink);
  cursor: pointer;
  min-height: 40px;
}

.filter-row2 select:hover { border-color: var(--accent); }

.filter-row2 .chip { min-height: 36px; padding: 0.3rem 0.7rem; font-size: 0.74rem; }

#result-count { font-weight: 700; color: var(--ink); font-size: 0.84rem; }

#updated-note { font-size: 0.74rem; }

/* ============================================================
   LISTE
   ============================================================ */

#list {
  flex: 1;
  overflow-y: auto;
  padding: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  overscroll-behavior: contain;
}

.item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
  cursor: pointer;
  transition: transform 0.18s var(--ease), box-shadow 0.2s ease, border-color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.item:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--line-strong);
}

.item.selected {
  border-color: var(--accent);
  box-shadow: var(--glow);
  background: var(--accent-softer);
}

.item .type-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.16rem 0.55rem;
  border-radius: 999px;
  color: #fff;
  margin-bottom: 0.3rem;
}

.item h3 {
  margin: 0.1rem 0 0.2rem;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.3;
}

.item .street {
  font-size: 0.79rem;
  color: var(--ink-soft);
  margin-bottom: 0.25rem;
}

.item .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.8rem;
  font-size: 0.74rem;
  color: var(--ink-faint);
  align-items: center;
}

.item .meta .dates { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

.item .zone-tag {
  font-size: 0.66rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 6px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.empty-state {
  text-align: center;
  color: var(--ink-faint);
  padding: 2.4rem 1rem;
  font-size: 0.88rem;
}

/* ============================================================
   PUBLICITÉ — slots premium
   ============================================================ */

.ad-slot {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    radial-gradient(320px 120px at 0% 0%, rgba(255, 122, 24, 0.07), transparent 65%),
    radial-gradient(320px 120px at 100% 100%, rgba(124, 58, 237, 0.07), transparent 65%),
    var(--panel);
  transition: box-shadow 0.2s ease, transform 0.18s var(--ease);
}

.ad-slot:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.ad-slot .ad-label {
  position: absolute;
  top: 0.5rem;
  right: 0.6rem;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.06rem 0.38rem;
  z-index: 2;
}

.ad-slot .ad-content {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.85rem 0.95rem;
  min-height: 76px;
  color: inherit;
  text-decoration: none;
}

.ad-slot .ad-visual {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: var(--grad);
  color: #fff;
  box-shadow: 0 6px 14px -4px rgba(255, 77, 61, 0.45);
}

.ad-slot .ad-visual.cool { background: var(--grad-cool); box-shadow: 0 6px 14px -4px rgba(124, 58, 237, 0.45); }

.ad-slot .ad-copy { min-width: 0; }

.ad-slot .ad-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.88rem;
  line-height: 1.25;
  margin: 0 0 0.1rem;
}

.ad-slot .ad-desc {
  font-size: 0.76rem;
  color: var(--ink-soft);
  line-height: 1.4;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ad-slot .ad-cta {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.34rem 0.75rem;
  border-radius: 999px;
  background: var(--grad);
  color: #fff;
  white-space: nowrap;
}

.ad-slot .ad-cta.cool { background: var(--grad-cool); }

/* Mini bouton d'achat sous la pub : « + Votre pub ici » — centré, pro.
   Permet à un 2e annonceur de réserver le même emplacement (rotation). */
.ad-mini-available {
  display: block;
  margin: 0.3rem auto 0;
  font: inherit;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-align: center;
  color: var(--accent-dark, #b93a24);
  background: transparent;
  border: 1px dashed rgba(226, 73, 47, 0.55);
  border-radius: 999px;
  padding: 0.16rem 0.7rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.ad-mini-available:hover { background: var(--accent, #e2492f); color: #fff; border-style: solid; }

/* Variante « placeholder » : espace à vendre */
.ad-slot.ad-available { cursor: pointer; }
.ad-slot.ad-available:hover { border-color: var(--evt); }

.ad-slot .ad-badge-promo {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--evt);
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.3);
  padding: 0.08rem 0.45rem;
  border-radius: 999px;
  margin-bottom: 0.25rem;
}

/* Bandeau pub entre les items de liste */
.ad-sep {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.35rem 0.1rem 0.1rem;
}

.ad-sep::before, .ad-sep::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

/* Slot pub dans la modale détail */
.ad-slot.ad-detail { margin: 1rem 0 0.4rem; }
.ad-slot.ad-detail .ad-content { min-height: 84px; }

/* ============================================================
   LÉGENDE — voir le bloc horizontal en haut de carte (section pub)
   ============================================================ */

.legend h4 {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-soft);
}

.legend ul { list-style: none; margin: 0; padding: 0; }

.legend li { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.22rem; }

.legend .swatch {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06) inset;
}

/* ============================================================
   MODALES — glass sombre premium
   ============================================================ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(10, 10, 24, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.open { display: flex; animation: fadeIn 0.2s var(--ease); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: min(620px, 100%);
  max-height: min(84vh, 720px);
  overflow-y: auto;
  padding: 1.5rem 1.5rem 1.4rem;
  position: relative;
  animation: popIn 0.28s var(--spring);
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(22px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--ink-soft);
  transition: all 0.15s ease;
  z-index: 2;
}

.modal-close:hover { background: var(--accent-soft); color: var(--accent-dark); border-color: var(--accent); transform: rotate(90deg); }

.modal-card .type-badge {
  display: inline-block;
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  color: #fff;
  margin-bottom: 0.5rem;
}

.modal-card h2 {
  font-size: 1.25rem;
  margin: 0.15rem 0 0.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  padding-right: 2.2rem;
}

.modal-card .street { color: var(--ink-soft); font-size: 0.9rem; margin-bottom: 0.35rem; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem 1rem;
  margin: 0.9rem 0;
  padding: 0;
}

.detail-grid > div { border-bottom: 1px dashed var(--line); padding-bottom: 0.45rem; }

.detail-grid dt {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  font-weight: 700;
  margin-bottom: 0.12rem;
}

.detail-grid dd { margin: 0; font-weight: 500; font-size: 0.88rem; }

.modal-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1rem; }

/* ---------- Formulaire signalement ---------- */

.report-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.8rem;
}

.report-form label {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.report-form input, .report-form select, .report-form textarea {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line-strong);
  background: var(--panel);
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.2s ease;
  min-height: 44px;
}

.report-form input:focus, .report-form select:focus, .report-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(255, 77, 61, 0.13);
}

.report-form textarea { resize: vertical; min-height: 74px; }

.form-note { font-size: 0.74rem; color: var(--ink-faint); margin: 0; }

/* ---------- Formulaire pub (achat d'espace) ---------- */

.ad-form .price-box {
  display: flex;
  gap: 0.6rem;
  margin: 0.4rem 0 0.6rem;
  flex-wrap: wrap;
}

.price-card {
  flex: 1;
  min-width: 130px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0.7rem 0.8rem;
  cursor: pointer;
  background: var(--panel);
  transition: all 0.16s var(--ease);
  position: relative;
}

.price-card:hover { border-color: var(--evt); transform: translateY(-2px); }

.price-card.selected {
  border-color: var(--evt);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
  background: rgba(139, 92, 246, 0.05);
}

.price-card .p-name { font-weight: 700; font-size: 0.8rem; font-family: var(--font-display); }

.price-card .p-price { font-size: 1.15rem; font-weight: 700; margin: 0.15rem 0; font-family: var(--font-display); }

.price-card .p-price small { font-size: 0.66rem; font-weight: 600; color: var(--ink-faint); }

.price-card .p-desc { font-size: 0.68rem; color: var(--ink-soft); line-height: 1.35; }

/* ============================================================
   FOOTER
   ============================================================ */

footer {
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 0.7rem clamp(0.9rem, 2.5vw, 1.5rem);
  font-size: 0.78rem;
  color: var(--ink-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
  align-items: center;
}

footer a { color: var(--ink-soft); }
footer a:hover { color: var(--accent-dark); }

/* ============================================================
   PAGE FAQ
   ============================================================ */

main.page-main {
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3.5rem;
  width: 100%;
  display: block;
  flex: none;
  min-height: 0;
  height: auto;
}

.page-main h1 {
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  margin: 0.5rem 0 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.intro-note {
  background: var(--accent-softer);
  border: 1px solid #f6d4ca;
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.95rem 1.15rem;
  font-size: 0.88rem;
  margin-bottom: 1.4rem;
  line-height: 1.6;
}

.faq-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 0.6rem;
  overflow: hidden;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
  flex-shrink: 0;
}

.faq-item:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }

.faq-item h2 {
  font-size: 0.96rem;
  font-weight: 600;
  margin: 0;
  padding: 0.9rem 1.1rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  line-height: 1.4;
  user-select: none;
}

.faq-item h2 .caret {
  transition: transform 0.18s ease;
  color: var(--accent);
  font-size: 0.85rem;
  flex-shrink: 0;
}

.faq-item.open h2 .caret { transform: rotate(90deg); }

.faq-item .answer {
  display: none;
  font-size: 0.89rem;
  color: var(--ink-soft);
  line-height: 1.65;
  padding: 0 1.1rem 1rem;
}

.faq-item.open .answer { display: block; animation: slideDown 0.25s var(--ease); }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.faq-item .answer ul { padding-left: 1.2rem; margin: 0.5rem 0; }
.faq-item .answer li { margin-bottom: 0.3rem; }
.faq-item .answer code {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.04rem 0.35rem;
  font-size: 0.82em;
}

/* ============================================================
   LEAFLET
   ============================================================ */

.leaflet-popup-content-wrapper {
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  font-family: var(--font-body);
}

.leaflet-popup-content { margin: 0.75rem 0.95rem; font-size: 0.84rem; line-height: 1.45; }

.popup-title { font-weight: 700; margin-bottom: 0.15rem; font-family: var(--font-display); }
.popup-street { color: var(--ink-soft); font-size: 0.77rem; margin-bottom: 0.25rem; }
.popup-dates { font-weight: 600; font-size: 0.77rem; font-variant-numeric: tabular-nums; }
.popup-link { font-size: 0.77rem; display: inline-block; margin-top: 0.3rem; }

.leaflet-container { font-family: var(--font-body) !important; }

/* ============================================================
   DARK MODE — premium nuit
   ============================================================ */

body.dark {
  --bg: #0a0d16;
  --panel: #121728;
  --panel-2: #171e33;
  --ink: #eef0f8;
  --ink-soft: #9aa4bd;
  --ink-faint: #6a7490;
  --line: #232c45;
  --line-strong: #323d5c;
  --glass: rgba(18, 23, 40, 0.82);

  --accent: #ff5f4d;
  --accent-2: #ff8a3d;
  --accent-dark: #ff8570;
  --accent-soft: #2e1a1c;
  --accent-softer: #1d1420;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 28px -8px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 32px 64px -16px rgba(0, 0, 0, 0.75);
}

body.dark header { background: var(--glass); }
body.dark .legend { background: var(--glass); }
body.dark .item.selected { background: rgba(255, 95, 77, 0.08); }
body.dark .intro-note { border-color: rgba(255, 95, 77, 0.25); }
body.dark .ad-slot {
  background:
    radial-gradient(320px 120px at 0% 0%, rgba(255, 138, 61, 0.08), transparent 65%),
    radial-gradient(320px 120px at 100% 100%, rgba(139, 92, 246, 0.1), transparent 65%),
    var(--panel);
}
body.dark .price-card.selected { background: rgba(139, 92, 246, 0.12); }
body.dark .faq-item .answer code { background: var(--panel-2); }

body.dark .leaflet-tile { filter: brightness(0.72) contrast(0.95) saturate(0.85); }
body.dark .leaflet-popup-content-wrapper { background: var(--panel); color: var(--ink); }
body.dark .leaflet-popup-tip { background: var(--panel); }

/* ============================================================
   RESPONSIVE — TABLETTE (≤ 1024px)
   ============================================================ */

@media (max-width: 1024px) {
  #sidebar { width: clamp(300px, 38vw, 380px); min-width: 280px; }
  .detail-grid { grid-template-columns: 1fr; }
}

/* ---------- MOBILE / TABLETTE PORTRAIT (≤ 900px) ---------- */

@media (max-width: 900px) {
  /* PATTERN MOBILE : la PAGE ENTIÈRE défile (sticky header + carte),
     comme Waze/Google Maps mobile. Rien n'est coincé : l'utilisateur
     peut toujours scroller vers le bas pour voir TOUT le contenu. */

  /* main doit grandir avec son contenu (sinon le sticky n'a aucune marge) */
  main { flex: none; min-height: auto; flex-direction: column; }

  #map-wrap {
    order: 1;
    flex: 0 0 auto;
    height: auto; /* la barre d'outils + la carte + la légende s'empilent naturellement */
    min-height: 0;
    width: 100%;
    position: sticky;
    top: var(--header-h, 56px);
    z-index: 900;
    background: var(--bg);
    flex-direction: column; /* barre d'outils AU-DESSUS, carte en dessous */
  }

  /* Sur mobile, la zone carte (sous la barre d'outils) garde ~58 % de l'écran */
  #map-wrap #map { height: 52dvh; min-height: 280px; flex: 0 0 auto; }

  #sidebar {
    order: 2;
    width: 100%;
    max-width: none;
    min-width: 0;
    flex: 0 0 auto;
    max-height: none;
    height: auto;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: 0 -12px 40px -12px rgba(13, 18, 38, 0.25);
    z-index: 1000;
    background: var(--bg);
  }

  /* Poignée drag-style */
  #sidebar::before {
    content: "";
    display: block;
    width: 42px;
    height: 4px;
    border-radius: 999px;
    background: var(--line-strong);
    margin: 0.55rem auto 0.15rem;
    flex-shrink: 0;
  }

  /* Toolbar compacte */
  .toolbar { padding: 0.45rem 0.7rem 0.55rem; gap: 0.45rem; }

  /* LA LISTE S'ÉCOULE DANS LA PAGE : plus de scroll interne coincé.
     Toute la page défile — la carte reste épinglée au-dessus. */
  #list {
    flex: 0 0 auto;
    overflow: visible;
    height: auto;
    min-height: 0;
  }

  /* Rendu paresseux : les cartes hors écran ne coûtent presque rien,
     même avec 1 900 entraves dans le flux de la page. */
  #list .item { content-visibility: auto; contain-intrinsic-size: auto 96px; }

  /* Légende flottante retirée : les pastilles couleurs vivent dans la
     barre d'outils (map-colors) — plus rien ne recouvre la carte. */

  /* Barre d'outils : revient dans #map-wrap (rang 0, au-dessus de la carte)
     — le JS la déplace ; on annule les règles desktop ici. */
  .map-topbar { flex-wrap: wrap; row-gap: 0.35rem; display: flex !important; order: 0; position: relative; background: var(--panel); border-bottom: 1px solid var(--line); padding: 0.4rem 0.6rem; flex: 0 0 auto; }
  .map-colors { order: 10; width: 100%; justify-content: center; font-size: 0.64rem; padding: 0.3rem 0.5rem; }
  .map-colors .mc-item:nth-child(n+4) { display: none; }

  /* Chip GPS : discret au-dessus du zoom (bas-gauche) */
  .gps-chip { bottom: 8.2rem; left: 0.55rem; padding: 0.4rem 0.7rem; font-size: 0.72rem; z-index: 1100; }

  .brand .tagline { display: none; }

  /* (Barre d'outils .map-topbar au-dessus de la carte — plus de FABs flottants) */
  .mobile-map-actions { display: none !important; }
  .mobile-map-actions {
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
  }

  .mobile-map-actions .map-fab {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--glass);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: var(--shadow-md);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s var(--spring);
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-map-actions .map-fab:active { transform: scale(0.92); }

  /* La modale devient une bottom-sheet pleine largeur */
  .modal { padding: 0; align-items: flex-end; }

  .modal-card {
    width: 100%;
    max-width: none;
    max-height: 88dvh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 1.2rem 1.1rem 1.6rem;
    animation: sheetUp 0.3s var(--ease);
    padding-bottom: max(1.6rem, env(safe-area-inset-bottom));
  }

  .modal-card::before {
    content: "";
    display: block;
    width: 42px;
    height: 4px;
    border-radius: 999px;
    background: var(--line-strong);
    margin: 0 auto 0.9rem;
  }

  @keyframes sheetUp {
    from { transform: translateY(60%); opacity: 0.4; }
    to { transform: translateY(0); opacity: 1; }
  }
}

/* ---------- PETIT MOBILE (≤ 560px) ---------- */

@media (max-width: 560px) {
  body { font-size: 14.5px; }

  header { padding: 0.4rem 0.7rem; gap: 0.4rem; } /* compacté : hauteur carte maximale */
  .brand .logo { font-size: 1.15rem; }

  .header-actions { width: 100%; justify-content: flex-end; gap: 0.4rem; }
  .header-actions .btn { padding: 0.5rem 0.9rem; font-size: 0.8rem; min-height: 40px; }
  .theme-toggle { width: 38px; height: 38px; }
  .lang-btn { min-width: 38px; height: 38px; font-size: 0.72rem; }

  .item { padding: 0.65rem 0.75rem; }

  .detail-grid dd { font-size: 0.85rem; }

  .ad-slot .ad-content { padding: 0.7rem 0.75rem; gap: 0.6rem; }
  .ad-slot .ad-visual { width: 44px; height: 44px; font-size: 1.25rem; border-radius: 10px; }
  .ad-slot .ad-cta { display: none; }
  .ad-slot .ad-title { font-size: 0.82rem; }

  .price-card { min-width: 100%; }

  footer { font-size: 0.7rem; gap: 0.3rem 0.9rem; padding: 0.6rem 0.8rem; }
}

/* ---------- PAYSAGE MOBILE (hauteur faible) ---------- */

@media (max-width: 900px) and (max-height: 480px) {
  #list { height: 45dvh; }
  .modal-card { max-height: 92dvh; }
}

/* ---------- Accessibilité : mouvement réduit ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
