/* ============================================================
   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);
  position: sticky;
  top: 0;
  z-index: 1200;
  padding: 0.7rem clamp(0.9rem, 2.5vw, 1.5rem);
  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);
}

.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) — rien ne change, la pub ne peut pas la recouvrir. */
@media (min-width: 1280px) {
  .map-ads .map-ad.rail { padding: 4rem 0.55rem 5.8rem; }
  .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;
  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) */
  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; }
.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
   ============================================================ */

#map-ads-slot { position: absolute; inset: 0; pointer-events: none; z-index: 950; }

.map-ads {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  pointer-events: none;
}

.map-ads .map-ad {
  pointer-events: auto;
  display: flex;
  align-items: center;
  max-width: 190px;
}

.map-ads .map-ad .ad-slot {
  width: 100%;
  height: auto;
  border-radius: var(--radius-lg, 16px);
  box-shadow: var(--shadow-md);
}

/* Rails verticaux gauche/droite — dégagent le bas (légende) et le haut (zoom / FABs) */
.map-ads .map-ad.rail { align-items: stretch; padding: 4.6rem 0.55rem 5.4rem; }
/* Deux emplacements empilés par rail (plus d'inventaire pub) */
.ad-stack { display: flex; flex-direction: column; gap: 0.5rem; justify-content: center; height: 100%; width: 100%; }
.ad-stack .ad-slot { flex: 0 0 auto; }
.map-ads .map-ad.rail .ad-slot { display: flex; flex-direction: column; height: auto; }
.map-ads .map-ad.rail .ad-slot .ad-content { flex-direction: column; align-items: flex-start; gap: 0.55rem; height: 100%; }
.map-ads .map-ad.rail .ad-slot .ad-visual { width: 42px; height: 42px; font-size: 1.25rem; }
.map-ads .map-ad.rail .ad-slot .ad-cta { align-self: stretch; text-align: center; }

/* Centre : bannière discrète en bas de carte */
.map-ads .map-ad-center {
  position: absolute;
  left: 50%;
  bottom: 2.6rem;
  transform: translateX(-50%);
  max-width: min(520px, 72vw);
  padding: 0 0.5rem;
}
.map-ads .map-ad-center .ad-slot { padding: 0.35rem 0.5rem; }
.map-ads .map-ad-center .ad-slot .ad-content { gap: 0.55rem; }
.map-ads .map-ad-center .ad-slot .ad-visual { width: 34px; height: 34px; font-size: 1rem; }
.map-ads .map-ad-center .ad-slot .ad-title { font-size: 0.78rem; }
.map-ads .map-ad-center .ad-slot .ad-desc,
.map-ads .map-ad-center .ad-slot .ad-badge-promo { display: none; }

/* Compacter la carte au profit de la pub (desktop ≥ 1280px) */
@media (min-width: 1280px) {
  #map-wrap { flex: 1.15; max-width: calc(100% - 420px); }
  #sidebar { width: clamp(340px, 30vw, 440px); }
}

/* Écrans moyens : rails masqués, bannière conservée */
@media (max-width: 1279px) {
  .map-ads .map-ad.rail { display: none; }
}

/* Téléphone/tablette : la bannière centrale obstruait la carte.
   On la retire de la carte — les emplacements prémium restent servis
   dans la liste (haut + intercalaires) et dans les fiches. */
@media (max-width: 900px) {
  .map-ads .map-ad-center { display: none; }
  #map-ads-slot { 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; }

.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 ---------- */

.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.42rem 0.65rem; font-size: 0.7rem; }
  header { gap: 0.45rem; }
}

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

.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.7rem 1.3rem;
  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;
  animation: pwaIn 0.35s var(--spring, ease-out);
}

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

/* 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-top: 1px solid var(--line);
  padding: 0.4rem 0.7rem;
  z-index: 5;
}

.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; }

/* 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 (haut) puis carte (flex:1) */
}

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

/* ============================================================
   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 compacte en haut de carte (mobile aussi — elle gêne moins que
     la barre d'outils, les boutons étant dans la barre au-dessus) */
  .legend { top: 0.4rem; max-width: min(86%, 560px); padding: 0.3rem 0.7rem; gap: 0.55rem; }
  .legend li:nth-child(n+4) { display: none; }
  .legend .legend-toggle { display: block; }
  .legend.expanded li:nth-child(n+4) { display: flex; }

  .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.55rem 0.8rem; gap: 0.5rem; }
  .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;
  }
}
