/* ============================================================================
   Immobservatoire — Atlas du marché
   Design system : double thème (sombre par défaut), tokens CSS, verre dépoli.
   Le JS pilote l'état par classes (.active, .collapsed, .open, .selected…) ;
   ce fichier ne fait que le rendu.
   ============================================================================ */

/* ----------------------------------------------------------------------------
   1. Tokens
---------------------------------------------------------------------------- */
:root {
  color-scheme: dark;
  --font-ui: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", Inter, ui-sans-serif, system-ui, sans-serif;

  --bg: #0a0d12;
  --surface: rgba(16, 21, 30, 0.78);
  --surface-solid: #11161f;
  --surface-2: rgba(255, 255, 255, 0.045);
  --surface-3: rgba(255, 255, 255, 0.085);
  --field: rgba(255, 255, 255, 0.05);
  --field-border: rgba(255, 255, 255, 0.11);

  --text: #e9edf3;
  --text-muted: #9aa4b4;
  --text-faint: #667182;

  --hairline: rgba(255, 255, 255, 0.09);
  --hairline-strong: rgba(255, 255, 255, 0.17);

  --accent: #2dd4bf;
  --accent-2: #22d3ee;
  --accent-ink: #052a24;
  --accent-soft: rgba(45, 212, 191, 0.13);
  --accent-glow: rgba(45, 212, 191, 0.4);
  --accent-line: rgba(45, 212, 191, 0.55);

  --gold: #fbbf24;
  --danger: #f87171;

  --shadow-panel: 0 24px 70px rgba(2, 4, 8, 0.55), 0 2px 10px rgba(2, 4, 8, 0.35);
  --shadow-pop: 0 14px 44px rgba(2, 4, 8, 0.6);
  --glass: saturate(160%) blur(22px);

  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 8px;

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #edefeb;
  --surface: rgba(252, 253, 252, 0.82);
  --surface-solid: #fbfcfb;
  --surface-2: rgba(18, 26, 35, 0.045);
  --surface-3: rgba(18, 26, 35, 0.08);
  --field: rgba(255, 255, 255, 0.75);
  --field-border: rgba(18, 26, 35, 0.14);

  --text: #151a21;
  --text-muted: #5b6573;
  --text-faint: #8b95a3;

  --hairline: rgba(18, 26, 35, 0.1);
  --hairline-strong: rgba(18, 26, 35, 0.18);

  --accent: #0d9488;
  --accent-2: #0891b2;
  --accent-ink: #f4fffd;
  --accent-soft: rgba(13, 148, 136, 0.1);
  --accent-glow: rgba(13, 148, 136, 0.28);
  --accent-line: rgba(13, 148, 136, 0.5);

  --gold: #b45309;
  --danger: #dc2626;

  --shadow-panel: 0 20px 60px rgba(24, 33, 31, 0.16), 0 2px 8px rgba(24, 33, 31, 0.08);
  --shadow-pop: 0 14px 40px rgba(24, 33, 31, 0.18);
}

/* ----------------------------------------------------------------------------
   2. Base
---------------------------------------------------------------------------- */
* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body,
.app,
#map {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.app {
  position: relative;
  overflow: hidden;
}

#map {
  width: 100%;
  background: var(--bg);
}

button {
  font: inherit;
  color: inherit;
}

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

::selection {
  background: var(--accent-soft);
}

body.dragging {
  cursor: grabbing;
  user-select: none;
}

.drag-handle {
  cursor: grab;
}

/* Barres de défilement fines, fondues dans le verre. */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--hairline-strong) transparent;
}
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*::-webkit-scrollbar-thumb {
  background: var(--hairline-strong);
  border-radius: 99px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}

/* ----------------------------------------------------------------------------
   3. Contrôles MapLibre (zoom, échelle, attribution)
---------------------------------------------------------------------------- */
.maplibregl-ctrl-bottom-left {
  z-index: 1;
}

.maplibregl-ctrl-group {
  background: var(--surface) !important;
  -webkit-backdrop-filter: var(--glass);
  backdrop-filter: var(--glass);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md) !important;
  box-shadow: var(--shadow-pop) !important;
  overflow: hidden;
}

.maplibregl-ctrl-group button {
  background: transparent !important;
  border: 0 !important;
}

.maplibregl-ctrl-group button + button {
  border-top: 1px solid var(--hairline) !important;
}

.maplibregl-ctrl-group button .maplibregl-ctrl-icon {
  filter: none;
}

:root[data-theme="dark"] .maplibregl-ctrl-group button .maplibregl-ctrl-icon {
  filter: invert(1) hue-rotate(180deg) contrast(0.85);
}

.maplibregl-ctrl-scale {
  background: var(--surface) !important;
  -webkit-backdrop-filter: var(--glass);
  backdrop-filter: var(--glass);
  border: 1px solid var(--hairline) !important;
  border-top: 0 !important;
  border-radius: 0 0 6px 6px;
  color: var(--text-muted) !important;
  font-size: 10px !important;
}

.maplibregl-ctrl-attrib {
  background: color-mix(in srgb, var(--surface-solid) 72%, transparent) !important;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-radius: var(--r-sm) 0 0 0;
  font-size: 10px;
}

.maplibregl-ctrl-attrib a {
  color: var(--text-muted) !important;
}

/* ----------------------------------------------------------------------------
   4. Panneau principal (gauche)
---------------------------------------------------------------------------- */
.panel {
  position: absolute;
  z-index: 3;
  top: 14px;
  left: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(404px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow-y: auto;
  overflow-x: visible;
  padding: 18px 18px 16px;
  background: var(--surface);
  -webkit-backdrop-filter: var(--glass);
  backdrop-filter: var(--glass);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-panel);
  animation: panel-in 0.5s var(--ease) both;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateX(-14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Liseré supérieur : signature lumineuse du panneau. */
.panel::after {
  content: "";
  position: absolute;
  top: 0;
  left: 18%;
  right: 18%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-line), transparent);
  pointer-events: none;
}

.panel.collapsed {
  transform: translateX(calc(-100% - 28px));
  opacity: 0;
  pointer-events: none;
}

/* ---- En-tête / marque ---- */
.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand strong {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Logo-mot : « immobservatoire » dont les deux o sont des verres (lunettes), reliés par un pont
   tracé par logo.js. Remplace l'ancienne pastille + texte de marque. */
.logo-word {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  font-family: "Poppins", var(--font-display), sans-serif;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.01em;
  line-height: 1;
  color: var(--text);
  white-space: nowrap;
  text-decoration: none;
  text-transform: none;
}
.logo-word .lens {
  display: inline-block;
  width: 0.92em;
  height: 0.92em;
  border: 0.06em solid var(--accent);
  border-radius: 50%;
  box-sizing: border-box;
  flex: 0 0 auto;
}
.logo-bridge { position: absolute; inset: 0; overflow: visible; pointer-events: none; color: var(--accent); }

.brand .head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand span,
.field > span,
.label,
.table-head span,
.range {
  color: var(--text-muted);
  font-size: 11.5px;
}

.brand .head-actions > span {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent-line);
  box-shadow: 0 0 14px var(--accent-glow);
}

:root[data-theme="dark"] .theme-toggle .icon-moon,
:root:not([data-theme="dark"]) .theme-toggle .icon-sun {
  display: none;
}

/* ---- Libellés de section ---- */
.section-label {
  margin-top: 2px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ---- Sélecteur de mode (segmenté) ---- */
.mode-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.mode-control button {
  min-height: 32px;
  border: 0;
  border-radius: calc(var(--r-md) - 4px);
  background: transparent;
  color: var(--text-muted);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.25s var(--ease), color 0.2s, box-shadow 0.25s;
}

.mode-control button:hover {
  color: var(--text);
}

.mode-control button.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  font-weight: 600;
  box-shadow: 0 2px 14px var(--accent-glow);
}

/* ---- Champs ---- */
.field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.field > span {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Champ sans objet pour le type courant (ex. Pièces pour un terrain/dépendance/local). */
.field-disabled {
  opacity: 0.4;
}

.field input,
.field select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--field-border);
  border-radius: var(--r-sm);
  padding: 0 10px;
  background: var(--field);
  color: var(--text);
  font: inherit;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.field input::placeholder {
  color: var(--text-faint);
}

.search-field.address-freeform {
  opacity: 0.55;
}

.search-field.address-freeform input {
  border-style: dashed;
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}

.field input[type="number"]::-webkit-outer-spin-button,
.field input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

.field input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.search-field input {
  min-height: 42px;
  font-size: 14.5px;
}

/* ---- Suggestions d'adresse ---- */
.search-wrap {
  position: relative;
}

.suggestions {
  position: absolute;
  z-index: 6;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  overflow: hidden;
  padding: 5px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-md);
  background: var(--surface-solid);
  box-shadow: var(--shadow-pop);
  animation: pop-in 0.18s var(--ease) both;
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.suggestions button {
  display: block;
  width: 100%;
  border: 0;
  border-radius: var(--r-sm);
  padding: 9px 10px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.suggestions button:hover,
.suggestions button:focus,
.suggestions button.active {   /* .active = element surligne au clavier (fleches) : meme rendu que le survol/focus */
  background: var(--accent-soft);
  color: var(--text);
  outline: none;
}

/* Échec de l'API d'adresse (BAN) : message visible dans la boîte de suggestions (vs silence) — voir address.js. */
.suggestion-error {
  margin: 0;
  padding: 9px 10px;
  font-size: 13px;
  line-height: 1.35;
  color: var(--danger);
}

/* ---- Interrupteur zone ---- */
.zone-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text-muted);
  font-size: 12.5px;
  cursor: pointer;
  user-select: none;
}

.zone-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.zone-toggle .switch {
  position: relative;
  flex: 0 0 auto;
  width: 32px;
  height: 18px;
  border: 1px solid var(--hairline-strong);
  border-radius: 99px;
  background: var(--surface-2);
  transition: background 0.2s, border-color 0.2s;
}

.zone-toggle .switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform 0.22s var(--ease), background 0.2s;
}

.zone-toggle input:checked + .switch {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.zone-toggle input:checked + .switch::after {
  transform: translateX(14px);
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.zone-toggle input:focus-visible + .switch {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.zone-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.zone-row .zone-toggle {
  flex: 1;
  min-width: 0;
}

/* Petit curseur de teinte : la piste EST la palette (fondu continu des teintes,
   alignées sur l'échelle 0-360 du slider), le pouce prend la couleur choisie.
   Sélecteurs préfixés input[type="range"] pour battre les styles génériques. */
input[type="range"].zone-color {
  flex: 0 0 64px;
  width: 64px;
}

input[type="range"].zone-color::-webkit-slider-runnable-track {
  height: 12px;
  border: 1px solid var(--hairline-strong);
  border-radius: 99px;
  background: linear-gradient(90deg,
    hsl(0, 72%, 55%), hsl(60, 72%, 55%), hsl(120, 72%, 55%),
    hsl(180, 72%, 55%), hsl(240, 72%, 55%), hsl(300, 72%, 55%), hsl(360, 72%, 55%));
}

input[type="range"].zone-color::-moz-range-track {
  height: 12px;
  border: 1px solid var(--hairline-strong);
  border-radius: 99px;
  background: linear-gradient(90deg,
    hsl(0, 72%, 55%), hsl(60, 72%, 55%), hsl(120, 72%, 55%),
    hsl(180, 72%, 55%), hsl(240, 72%, 55%), hsl(300, 72%, 55%), hsl(360, 72%, 55%));
}

input[type="range"].zone-color::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  margin-top: -1px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--zone-color, var(--accent));
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

input[type="range"].zone-color::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--zone-color, var(--accent));
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

input[type="range"].zone-color:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---- Curseurs (simple + double) ---- */
/* Emprise « zone libre » : bouton d'armement du dessin + aide, visible tant que cette emprise est active.
   Permet de tracer autant de zones qu'on veut (le tracé se désarme après chaque rectangle). */
.freeform-control { display: grid; gap: 6px; }
.freeform-draw {
  width: 100%;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--accent-line);
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s;
}
.freeform-draw:hover { background: var(--accent-glow); border-color: var(--accent); }
.freeform-hint { margin: 0; color: var(--text-faint); font-size: 11px; line-height: 1.4; }

.radius-control,
.history-control {
  display: grid;
  gap: 7px;
}

.radius-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.radius-head strong {
  font-family: var(--font-display);
  font-size: 13.5px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.radius-scale {
  display: flex;
  justify-content: space-between;
  margin-top: -3px;
  color: var(--text-faint);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.radius-control.disabled {
  opacity: 0.45;
}

.radius-control input:disabled {
  cursor: not-allowed;
}

input[type="range"] {
  width: 100%;
  height: 22px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent-line), var(--surface-3) 0) no-repeat var(--surface-3);
}

input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 99px;
  background: var(--surface-3);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  margin-top: -5.5px;
  border: 2.5px solid var(--accent);
  border-radius: 50%;
  background: var(--surface-solid);
  box-shadow: 0 0 10px var(--accent-glow);
  transition: transform 0.15s var(--ease);
}

input[type="range"]::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: 2.5px solid var(--accent);
  border-radius: 50%;
  background: var(--surface-solid);
  box-shadow: 0 0 10px var(--accent-glow);
}

input[type="range"]:hover::-webkit-slider-thumb {
  transform: scale(1.15);
}

/* Double poignée : deux inputs superposés, seules les poignées sont cliquables. */
.dual-range {
  position: relative;
  height: 22px;
}

.dual-range::before {
  content: "";
  position: absolute;
  top: 9px;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: 99px;
  background: var(--surface-3);
}

.dual-range input[type="range"] {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.dual-range input[type="range"]::-webkit-slider-runnable-track {
  background: transparent;
}

.dual-range input[type="range"]::-moz-range-track {
  background: transparent;
}

.dual-range input[type="range"]::-webkit-slider-thumb {
  pointer-events: auto;
}

.dual-range input[type="range"]::-moz-range-thumb {
  pointer-events: auto;
}

/* ---- En-tete du panneau ---- */
/* Le toggle de mode + une action Reinitialiser discrete (icone). Le gros bouton Explorer/Estimer a ete
   retire : les resultats se mettent a jour en direct au moindre changement (adresse, parametre, emprise). */
.panel-head {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.panel-head .mode-control {
  flex: 1;
  min-width: 0;
}

button#reset.reset-mini {
  flex: 0 0 auto;
  width: 40px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text-faint);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

button#reset.reset-mini:hover {
  color: var(--text);
  border-color: var(--hairline-strong);
}

/* ---- Menus de couches (fond de carte, cadastre, type marché) ---- */
.map-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* « Bâtiments 3D » / « Relief » : deux boutons DISCRETS au même niveau, style sobre facon « Toutes les ventes »
   (.layer-menu-current : fond --field, bordure fine). Rangée pleine largeur sous Fond + Cadastre. Au plus un
   actif (les deux eteints = defaut) ; etat actif = simple lisere accent, pas un degrade voyant. */
.map-overlay-group {
  grid-column: 1 / -1;
  order: 1;
  margin-top: 2px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.map-overlay-btn {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.map-overlay-btn:hover {
  border-color: var(--hairline-strong);
  color: var(--text);
}

.map-overlay-btn.active {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.layer-select > span {
  display: block;
  margin-bottom: 5px;
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.layer-menu-trigger {
  position: relative;
}

.layer-menu-current {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--field-border);
  border-radius: var(--r-sm);
  background: var(--field);
  color: var(--text);
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.layer-menu-current:hover {
  border-color: var(--hairline-strong);
}

.layer-menu-caret {
  color: var(--text-faint);
  font-size: 10px;
}

.layer-menu-providers {
  position: absolute;
  z-index: 7;
  top: calc(100% + 5px);
  left: 0;
  min-width: 100%;
  display: none;
  padding: 5px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-md);
  background: var(--surface-solid);
  box-shadow: var(--shadow-pop);
}

/* Pont invisible sur l'écart visuel : le survol ne se rompt pas en traversant le gap. */
.layer-menu-providers::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  height: 8px;
}

.layer-menu:not(.just-picked) .layer-menu-trigger:hover .layer-menu-providers,
.layer-menu:not(.just-picked) .layer-menu-trigger:focus-within .layer-menu-providers {
  display: block;
  animation: pop-in 0.16s var(--ease) both;
}

.layer-menu-providers > button,
.layer-provider-name,
.layer-submenu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  border: 0;
  border-radius: var(--r-sm);
  padding: 8px 10px;
  background: transparent;
  color: var(--text);
  font-size: 12.5px;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.layer-menu-providers > button:hover,
.layer-submenu button:hover {
  background: var(--accent-soft);
}

.layer-menu-providers > button.active,
.layer-submenu button.active {
  color: var(--accent);
  font-weight: 600;
}

.layer-provider {
  position: relative;
}

.layer-provider-name {
  color: var(--text-muted);
}

.layer-provider:hover > .layer-provider-name,
.layer-provider:focus-within > .layer-provider-name {
  background: var(--surface-2);
  color: var(--text);
}

/* Sous-menu : s'ouvre vers la DROITE (le panneau colle au bord gauche de l'écran). */
.layer-submenu {
  position: absolute;
  z-index: 8;
  top: -5px;
  left: calc(100% + 4px);
  display: none;
  min-width: 140px;
  padding: 5px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-md);
  background: var(--surface-solid);
  box-shadow: var(--shadow-pop);
}

/* Pont sur l'écart horizontal trigger <-> sous-menu. */
.layer-submenu::before {
  content: "";
  position: absolute;
  right: 100%;
  top: 0;
  bottom: 0;
  width: 8px;
}

.layer-provider:hover > .layer-submenu,
.layer-provider:focus-within > .layer-submenu {
  display: block;
}

/* Les menus du bas du panneau s'ouvrent vers le haut (le panneau défile en overflow-y). */
.map-controls .layer-menu-providers {
  top: auto;
  bottom: calc(100% + 5px);
}

.map-controls .layer-menu-providers::before {
  bottom: auto;
  top: 100%;
}

.map-controls .layer-submenu {
  top: auto;
  bottom: -5px;
}

/* Menu type marché : présenté comme un champ. */
.type-menu .layer-menu-current {
  min-height: 38px;
}

.type-menu .layer-menu-providers {
  right: 0;
}

/* ---- Statut ---- */
.status {
  color: var(--text-muted);
  font-size: 12px;
}

.status:empty {
  display: none;
}

/* ----------------------------------------------------------------------------
   5. Résultats (estimation / marché)
---------------------------------------------------------------------------- */
.result {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--surface-2);
  animation: pop-in 0.25s var(--ease) both;
}

.result .label {
  display: block;
  margin-bottom: 2px;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* Filtre « ventes multiples » sous le nombre de ventes (emprise avec reventes/immeubles) : petit menu déroulant
   (Toutes / Que les multiples / Aucune) qui filtre l'affichage carte + liste. L'aide reste un marqueur .hint. */
.multi-menu {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
}
.multi-menu .layer-menu-trigger { flex: 0 0 auto; }
.multi-menu .layer-menu-current {
  width: auto;
  min-height: 26px;
  padding: 0 8px;
  font-size: 11.5px;
  gap: 6px;
  color: #7048e8;
  font-weight: 600;
}
.multi-menu .layer-menu-caret { font-size: 9px; }
.multi-menu .layer-menu-providers { left: 0; right: auto; min-width: 190px; }

#estimatedPrice {
  display: block;
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(100deg, var(--text) 30%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.metrics {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 12px;
}

.metrics span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.metrics b {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.scope-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 0 10px;
  border: 1px solid var(--hairline);
  border-radius: 99px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 11.5px;
  cursor: default;
  transition: border-color 0.2s, color 0.2s;
}

.scope-chip:not(:disabled) {
  cursor: pointer;
}

.scope-chip:not(:disabled):hover {
  border-color: var(--accent-line);
  color: var(--text);
}

.scope-chip:not(:disabled)::after,
.sales-chip::after {
  content: "▾";
  font-size: 9px;
  color: var(--text-faint);
  transition: transform 0.2s var(--ease);
}

.scope-chip.open::after {
  transform: rotate(180deg);
}

.sales-chip:not(.open)::after {
  transform: rotate(-90deg);
}

.sales-chip {
  cursor: pointer;
}

.result-stats {
  display: grid;
  gap: 4px;
}

.range {
  font-size: 12px;
  line-height: 1.5;
}

.range:empty {
  display: none;
}

/* ---- Contexte commune sous la fourchette : sections repliables Terrain / Loyer / Géorisques ---- */
.estimate-context {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}
.ctx-section {
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--surface-2);
  overflow: hidden;
}
.ctx-section > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  transition: color 0.2s;
}
.ctx-section > summary::-webkit-details-marker { display: none; }
.ctx-section > summary::before {
  content: "›";
  color: var(--text-faint);
  font-size: 13px;
  transition: transform 0.2s var(--ease);
}
.ctx-section[open] > summary,
.ctx-section > summary:hover { color: var(--accent); }
.ctx-section[open] > summary::before { transform: rotate(90deg); color: var(--accent); }
.ctx-body {
  padding: 2px 12px 10px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
}
/* ---- Reçu des facteurs d'estimation (médiane -> corrections -> prix) ---- */
.facteur-base, .facteur-total {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 8px;
  color: var(--text); font-weight: 600; padding: 4px 0;
}
.facteur-total { border-top: 1px solid var(--hairline); margin-top: 5px; padding-top: 8px; }
.facteur-sub { color: var(--text-faint); font-weight: 400; }
.facteur-row {
  display: grid; grid-template-columns: 1fr auto; align-items: baseline;
  column-gap: 10px; padding: 4px 0; border-top: 1px solid var(--hairline);
}
.facteur-name { color: var(--text); font-weight: 500; }
.facteur-pct { font-weight: 600; font-variant-numeric: tabular-nums; }
.facteur-up { color: var(--accent); }
.facteur-down { color: var(--danger); }
.facteur-why { grid-column: 1 / -1; color: var(--text-muted); }
/* ---- Menu « Bien » : DPE / piscine / dépendance regroupés dans un seul panneau ---- */
/* Largeur du champ « Bien » alignée sur le menu Type (cellule 1fr de .grid : « 1fr 1fr », gap 10px). */
.bien-menu { width: calc(50% - 5px); }
/* Dans une grille (Atlas) -> remplit sa cellule (1fr) : MÊME empreinte que le menu Type (demi-largeur), pas pleine
   largeur. En exploration il est à côté du Type ; en estimation il est seul en colonne de gauche (place du Type). */
.grid > .bien-menu { width: auto; }
/* Grisé (estimation hors maison) : .field-disabled donne l'opacité ; pointer-events:none rend le déclencheur inerte
   (le sous-menu ne s'ouvre plus), comme un champ disabled (parité avec Pièces/Surface grisés). */
.bien-menu.field-disabled { pointer-events: none; }
/* Le sous-menu s'ouvre du côté qui le garde DANS le panneau (sinon il déborde la bordure que .panel clippe :
   overflow-y:auto force overflow-x à auto, tronquant DPE « G » / dépendance). Colonne de DROITE (exploration, à côté
   du Type) -> ouverture vers la GAUCHE ; colonne de GAUCHE (estimation) -> vers la DROITE. */
.bien-menu .layer-menu-providers { min-width: 280px; }
#explorationFilters > .bien-menu .layer-menu-providers { left: auto; right: 0; }
.grid:not(#explorationFilters) > .bien-menu .layer-menu-providers { left: 0; right: auto; }
.bien-options { padding: 6px; }
/* Chaque option EN COLONNE (libellé au-dessus, contrôle pleine largeur en dessous) : avec un select large
   (DPE A–G, « avec/sans dépendance »), une disposition en ligne se chevauchait dans un panneau étroit. */
.bien-opt {
  display: flex; flex-direction: column; align-items: stretch; gap: 5px;
  padding: 7px 8px; margin: 0; font-size: 12px; font-weight: 500; color: var(--text);
  cursor: pointer; border-radius: var(--r-sm);
}
.bien-opt:hover { background: var(--surface-3); }
.bien-opt > span { flex: 0 0 auto; font-size: 11px; color: var(--text-muted); }
.bien-opt select {
  flex: 1 1 auto; width: 100%; min-height: 30px; border: 1px solid var(--field-border);
  border-radius: var(--r-sm); padding: 0 8px; background: var(--field); color: var(--text); font: inherit;
}
/* Piscine : la case + son libellé restent sur UNE ligne (plus naturel qu'une case orpheline au-dessus). */
#bienPool { flex-direction: row; align-items: center; gap: 8px; }
#bienPool > span { flex: 1 1 auto; font-size: 12px; color: var(--text); }
/* Sous-options DPE / dépendance en BOUTONS (au lieu du <select> natif OS) : segmenté, stylé comme le menu. */
.bien-seg { display: flex; flex-wrap: wrap; gap: 4px; }
.bien-seg button {
  flex: 0 0 auto; min-width: 26px; min-height: 28px; padding: 4px 8px;
  border: 1px solid var(--field-border); border-radius: var(--r-sm);
  background: var(--field); color: var(--text-muted); font: inherit; font-size: 12px; cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.bien-seg button:hover { border-color: var(--accent-line); color: var(--text); }
.bien-seg button.active { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); font-weight: 600; }
/* Case dessinée en CSS (appearance:none) : la case native se rend blanc-sur-blanc / mal dimensionnée
   dans le panneau ; on la dessine pour qu'elle soit toujours visible et bien posée par-dessus le panneau. */
.bien-opt input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; box-sizing: border-box;
  flex: 0 0 auto; width: 18px; height: 18px; min-height: 0; padding: 0; margin: 0; position: relative;
  border: 2px solid var(--text-faint); border-radius: 5px;
  background: var(--surface-3); cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.bien-opt input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
.bien-opt input[type="checkbox"]:checked::after {
  content: ""; position: absolute; left: 5px; top: 1px;
  width: 5px; height: 10px; border: solid var(--accent-ink); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.bien-opt input[type="checkbox"]:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---- Détails d'emprise (communes / codes postaux) ---- */
.scope-details {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  max-height: 240px;
  overflow-y: auto;
}

.scope-details strong {
  font-size: 12px;
}

.scope-details ul {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.scope-details li button {
  border: 1px solid var(--hairline);
  border-radius: 99px;
  padding: 4px 10px;
  background: transparent;
  color: var(--text);
  font-size: 11.5px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.scope-details li button:hover,
.scope-details li button:focus-visible {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  outline: none;
}

.scope-details li span {
  color: var(--text-faint);
  font-size: 10.5px;
}

/* ---- Stats marché par catégorie ---- */
.market-stats {
  display: grid;
  gap: 2px;
}

/* Ligne de catégorie : un bouton (clic = retirer la catégorie, corrélé au menu Type). */
.market-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "cat m2"
    "sub m2";
  align-items: center;
  gap: 0 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.market-row:hover {
  background: var(--surface-2);
}

.market-row .row-toggle {
  margin-left: 7px;
  color: var(--text-faint);
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}

.market-row:hover .row-toggle {
  opacity: 1;
}

/* ◎ = « n'afficher que » (filtre positif) ; × = « retirer de la sélection ». */
.market-row:hover .row-toggle.focus {
  color: var(--accent);
}

.market-row:hover .row-toggle.remove {
  color: var(--danger);
}

.market-row .cat {
  grid-area: cat;
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  font-size: 13px;
}

.market-row .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}

/* Pictogramme par type dans la légende (remplace le point coloré ; style A/B/C). */
.market-row .glyph-mark {
  display: inline-flex;
  flex: none;
  line-height: 0;
}

.market-row .sub {
  grid-area: sub;
  color: var(--text-muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.market-row .m2 {
  grid-area: m2;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.market-row.indicatif .m2 {
  color: var(--text-faint);
  font-weight: 500;
}

/* ----------------------------------------------------------------------------
   6. Onglets latéraux (panneaux repliés)
---------------------------------------------------------------------------- */
.expand-estimation,
.expand-transactions {
  position: absolute;
  z-index: 3;
  top: 50%;
  display: none;
  width: 26px;
  height: 64px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  -webkit-backdrop-filter: var(--glass);
  backdrop-filter: var(--glass);
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  box-shadow: var(--shadow-pop);
  /* Languette fantôme : simple indice (panneau ouvert ou replié)… */
  opacity: 0.22;
  transition: opacity 0.35s, color 0.2s, width 0.15s var(--ease),
    left 0.5s cubic-bezier(0.34, 1.2, 0.4, 1), right 0.5s cubic-bezier(0.34, 1.2, 0.4, 1);
}

/* …pleinement révélée sous la souris ou au focus clavier. */
.expand-estimation:hover,
.expand-estimation:focus-visible,
.expand-transactions:hover,
.expand-transactions:focus-visible {
  opacity: 1;
}

/* Toujours visible : accolé au bord droit du panneau ouvert, au bord de l'écran sinon. */
.expand-estimation {
  display: block;
  left: calc(min(404px, 100vw - 28px) + 18px);
  border-radius: var(--r-md);
  transform: translateY(-50%);
}

.expand-transactions {
  right: 0;
  border-right: 0;
  border-radius: var(--r-md) 0 0 var(--r-md);
  transform: translateY(-50%);
}

.expand-estimation:hover,
.expand-transactions:hover {
  color: var(--accent);
  width: 30px;
}

.panel.collapsed + .expand-estimation {
  left: 0;
  border-left: 0;
  border-radius: 0 var(--r-md) var(--r-md) 0;
}

/* ----------------------------------------------------------------------------
   7. Tiroir de résultats (droite)
---------------------------------------------------------------------------- */
/* Conteneur transparent aux clics : seuls ses panneaux et son onglet sont interactifs. */
.table-wrap {
  position: absolute;
  z-index: 3;
  top: 14px;
  right: 14px;
  bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(420px, calc(100vw - 28px));
  pointer-events: none;
}

.table-wrap .list-panel,
.table-wrap .detail-panel,
.table-wrap .expand-transactions {
  pointer-events: auto;
}

.table-wrap .list-panel,
.table-wrap .detail-panel {
  transition: transform 0.5s cubic-bezier(0.34, 1.2, 0.4, 1), opacity 0.4s ease;
}

.table-wrap.collapsed .list-panel,
.table-wrap.collapsed .detail-panel {
  transform: translateX(calc(100% + 28px));
  opacity: 0;
  pointer-events: none;
}

.table-wrap.has-results .expand-transactions {
  display: block;
}

.table-wrap.collapsed:not(.has-results) .expand-transactions {
  display: none;
}

/* Tiroir ouvert : l'onglet flotte à gauche du tiroir. Replié : il colle au bord de l'écran. */
.table-wrap .expand-transactions {
  right: calc(100% + 8px);
}

.table-wrap.collapsed .expand-transactions {
  right: -14px;
  border-right: 0;
}

.table-wrap.has-results:not(.collapsed) .expand-transactions:focus-visible {
  outline: 2px solid var(--accent);
}

.list-panel,
.detail-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  background: var(--surface);
  -webkit-backdrop-filter: var(--glass);
  backdrop-filter: var(--glass);
  box-shadow: var(--shadow-panel);
}

.list-panel {
  flex: 1;
}

.table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--hairline);
}

.table-head strong {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.table-head .head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-head button {
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
}

.table-head #closeDetail {
  width: 26px;
  height: 26px;
  font-size: 15px;
  line-height: 1;
}

/* ---- Menu de tri ---- */
.sort-menu {
  position: relative;
}

.sort-menu > button {
  min-height: 26px;
  padding: 0 10px;
  font-size: 11.5px;
  transition: color 0.2s, border-color 0.2s;
}

.sort-menu > button:hover {
  color: var(--text);
  border-color: var(--hairline-strong);
}

.sort-options {
  position: absolute;
  z-index: 7;
  top: calc(100% + 5px);
  right: 0;
  display: none;
  min-width: 130px;
  padding: 5px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-md);
  background: var(--surface-solid);
  box-shadow: var(--shadow-pop);
}

.sort-menu.open .sort-options {
  display: block;
  animation: pop-in 0.16s var(--ease) both;
}

.sort-options button {
  display: block;
  width: 100%;
  border: 0;
  border-radius: var(--r-sm);
  padding: 7px 10px;
  background: transparent;
  color: var(--text);
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}

.sort-options button:hover {
  background: var(--accent-soft);
}

.sort-options button.active {
  color: var(--accent);
  font-weight: 600;
}

/* ---- Liste de transactions ---- */
.transactions-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scroll-behavior: smooth;
}

.list-sentinel {
  flex: 0 0 1px;
}

.transaction-card {
  flex: 0 0 auto;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--surface-2);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s, transform 0.26s cubic-bezier(0.34, 1.2, 0.4, 1);
}

.transaction-card:hover {
  border-color: var(--hairline-strong);
  /* Loupe macOS très légère : magnification + lift, transform pur (orthogonal aux
     ombres colorées de .selected / .map-hover, qui gardent leur halo intact). */
  transform: scale(1.014) translateY(-1px);
  transform-origin: center top;
  z-index: 1;
}
/* prefers-reduced-motion ne neutralise que les durées (pas transform) : on annule la loupe. */
@media (prefers-reduced-motion: reduce) {
  .transaction-card:hover { transform: none; }
}

.transaction-card.map-hover {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold), 0 0 18px color-mix(in srgb, var(--gold) 35%, transparent);
}

.transaction-card.selected {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent-line), 0 8px 30px color-mix(in srgb, var(--accent) 18%, transparent);
}

/* « Déjà consulté » : léger changement de couleur du BANDEAU (.transaction), sans
   coche ni fondu d'opacité. Teinte neutre via --surface-3 (gris adaptatif clair/
   sombre), jamais confondue avec .selected (accent) ni .map-hover (or) ; fin liseré
   gauche neutre comme repère discret. */
.transaction-card.viewed:not(.selected) .transaction {
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--text) 9%, transparent) 0 2px,
    var(--surface-3) 2px
  );
}
/* Le prix garde l'accent mais légèrement assourdi : confirme « consulté » sans casser
   la hiérarchie de lecture. */
.transaction-card.viewed:not(.selected) .transaction b:first-child {
  color: color-mix(in srgb, var(--accent) 72%, var(--text-muted));
}
/* Au survol, le bandeau vu s'éclaircit (liseré absorbé, --surface-3 plein). */
.transaction-card.viewed:not(.selected):hover .transaction {
  background: var(--surface-3);
}

.transaction {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.transaction b {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.transaction b:first-child {
  color: var(--accent);
}

.transaction b + b {
  text-align: right;
}

.transaction span {
  grid-column: 1;
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.4;
}

.transaction .result-date {
  grid-column: 2;
  grid-row: 2;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.viewed-tick {
  display: inline-grid;
  place-items: center;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 9px;
}

/* ----------------------------------------------------------------------------
   8. Détail d'un transaction
---------------------------------------------------------------------------- */
.detail-panel {
  max-height: 46%;
}

.detail-body {
  overflow-y: auto;
  padding: 12px 14px;
}

.transaction-detail {
  padding: 12px;
  border-top: 1px solid var(--hairline);
  display: grid;
  gap: 12px;
  animation: pop-in 0.2s var(--ease) both;
}

.detail-title {
  display: grid;
  gap: 2px;
}

.detail-title strong {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.detail-title span {
  color: var(--text-muted);
  font-size: 12px;
}

.detail-lieudit {
  color: var(--accent);
  font-size: 11.5px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

/* Urbanisme (permis) : une carte PLEINE LARGEUR par dossier — une seule info par carte, la grille
   2 colonnes du détail tronquait les libellés (retour propriétaire). */
.urb-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

/* Dans ces cartes pleine largeur, l'étiquette ne se tronque JAMAIS : elle passe à la ligne
   (l'ellipsis générique des detail-field est faite pour la grille étroite à 2 colonnes). */
.urb-list .detail-field span {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.detail-field {
  display: grid;
  gap: 1px;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

.detail-field span {
  color: var(--text-faint);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-field b {
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.detail-note {
  margin: 0;
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.5;
}

.street-muted {
  color: var(--text-faint);
  font-size: 11.5px;
}

/* Bâtiments : survol synchronisé carte <-> liste. */
.bati-item {
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.bati-item:hover,
.bati-item.bati-hover {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 10%, transparent);
}

.batiments-head {
  color: var(--text-muted);
  font-size: 11.5px;
  margin-bottom: 6px;
}

.adresse-item > span {
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
  color: var(--text);
  white-space: normal;
}

.adresse-tag {
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
}

/* ---- Blocs repliables ---- */
.collapsible {
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--surface-2);
  overflow: hidden;
}

.collapsible-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.collapsible-summary::before {
  content: "›";
  color: var(--text-faint);
  font-size: 13px;
  transition: transform 0.2s var(--ease);
}

.collapsible-summary:hover {
  color: var(--accent);
}

.collapsible.open .collapsible-summary::before {
  transform: rotate(90deg);
  color: var(--accent);
}

.collapsible-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.28s var(--ease);
}

.collapsible.open .collapsible-body {
  grid-template-rows: 1fr;
}

.collapsible-inner {
  overflow: hidden;
  padding: 0 12px;
}

.collapsible.open .collapsible-inner {
  padding-bottom: 12px;
}

/* ---- Badges DPE (couleurs officielles, lisibles sur les deux thèmes) ---- */
.dpe-badge {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 5px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.dpe-a { background: #009036; }
.dpe-b { background: #52b153; }
.dpe-c { background: #a5cc74; color: #1d2a16; text-shadow: none; }
.dpe-d { background: #f4e70f; color: #4a4205; text-shadow: none; }
.dpe-e { background: #f0b40f; color: #4a3605; text-shadow: none; }
.dpe-f { background: #eb8235; }
.dpe-g { background: #d7221f; }

.dpe-panel-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}

.dpe-expire {
  padding: 1px 8px;
  border: 1px solid color-mix(in srgb, var(--danger) 50%, transparent);
  border-radius: 99px;
  color: var(--danger);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Panneau d'attention DPE périmé : on montre l'info mais on prévient qu'elle peut être obsolète. */
.dpe-warn {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 6px;
  padding: 7px 9px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--danger) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 28%, transparent);
}

.dpe-warn-ico {
  flex: none;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.35;
}

.dpe-pair {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 11.5px;
}

.dpe-distrib {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 6px;
}

.dpe-distrib-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.dpe-distrib-item small {
  color: var(--text-faint);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

/* ---- Infobulles ---- */
.hint {
  display: inline-grid;
  place-items: center;
  width: 13px;
  height: 13px;
  border: 1px solid var(--hairline-strong);
  border-radius: 50%;
  color: var(--text-faint);
  font-size: 9px;
  font-weight: 600;
  cursor: help;
  user-select: none;
  vertical-align: 1px;
  transition: color 0.15s, border-color 0.15s;
}

.hint:hover {
  color: var(--accent);
  border-color: var(--accent-line);
}

.hint-tip {
  position: fixed;
  z-index: 99;
  max-width: 300px;
  padding: 9px 11px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-md);
  background: var(--surface-solid);
  color: var(--text);
  font-size: 11.5px;
  line-height: 1.5;
  box-shadow: var(--shadow-pop);
  pointer-events: none;
}

.hint-tip[hidden] {
  display: none;
}

/* ----------------------------------------------------------------------------
   9. Marqueur cible
---------------------------------------------------------------------------- */
.marker {
  position: relative;
  width: 18px;
  height: 18px;
}

.marker::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: 2px solid #fff;
  box-shadow: 0 0 12px var(--accent-glow), 0 2px 6px rgba(0, 0, 0, 0.4);
}

.marker.target::before {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  border: 1.5px solid var(--accent-line);
  animation: marker-pulse 2.2s ease-out infinite;
}

@keyframes marker-pulse {
  0% {
    transform: scale(0.55);
    opacity: 0.9;
  }
  70% {
    transform: scale(1.25);
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}

/* ----------------------------------------------------------------------------
   10. Frise temporelle
---------------------------------------------------------------------------- */
.timeline {
  --ease-spring: cubic-bezier(0.34, 1.2, 0.4, 1);
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(680px, calc(100vw - 460px));
  min-width: 340px;
  height: 60px;
  padding: 10px 14px;
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: 16px;
  background: var(--surface);
  -webkit-backdrop-filter: var(--glass);
  backdrop-filter: var(--glass);
  box-shadow: var(--shadow-panel);
  user-select: none;
  animation: timeline-in 0.45s var(--ease) both;
  transition:
    width 0.5s var(--ease-spring),
    height 0.5s var(--ease-spring),
    min-width 0.5s var(--ease-spring),
    padding 0.5s var(--ease-spring),
    border-radius 0.5s var(--ease-spring),
    transform 0.3s var(--ease-spring),
    box-shadow 0.3s;
}

/* Le contenu s'efface vite à la réduction, et ne revient qu'une fois la barre redéployée. */
.timeline > * {
  transition: opacity 0.22s 0.26s;
}

/* Point lumineux au cœur de la pastille réduite. */
.timeline::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 7px;
  margin: -3.5px 0 0 -3.5px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 10px var(--accent-glow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
}

/* ---- État réduit : double-clic -> pastille ---- */
.timeline.minimized {
  width: 22px;
  min-width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 99px;
  cursor: pointer;
  box-shadow: var(--shadow-pop), 0 0 16px var(--accent-glow);
}

.timeline.minimized > * {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.timeline.minimized::after {
  opacity: 1;
  transition: opacity 0.25s 0.3s;
}

.timeline.minimized:hover {
  transform: translateX(-50%) scale(1.3);
}

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

.timeline-play {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--accent-line);
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, transform 0.15s var(--ease);
}

.timeline-play:hover {
  box-shadow: 0 0 16px var(--accent-glow);
  transform: scale(1.06);
}

.timeline.playing .timeline-play {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
}

.timeline .icon-pause {
  display: none;
}

.timeline.playing .icon-pause {
  display: block;
}

.timeline.playing .icon-play {
  display: none;
}

.timeline-track {
  position: relative;
  flex: 1;
  height: 40px;
  min-width: 0;
}

.timeline-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* Deux poignées superposées (début / fin) : seules les poignées sont cliquables. */
.timeline-track input[type="range"] {
  position: absolute;
  inset: 0;
  height: 100%;
  margin: 0;
  pointer-events: none;
}

.timeline-track input[type="range"]::-webkit-slider-thumb {
  pointer-events: auto;
}

.timeline-track input[type="range"]::-moz-range-thumb {
  pointer-events: auto;
}

.timeline-track input[type="range"]::-webkit-slider-runnable-track {
  background: transparent;
}

.timeline-track input[type="range"]::-moz-range-track {
  background: transparent;
}

.timeline-track input[type="range"]::-webkit-slider-thumb {
  width: 4px;
  height: 36px;
  margin-top: 0;
  border: 0;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px var(--accent-glow);
}

.timeline-track input[type="range"]::-moz-range-thumb {
  width: 4px;
  height: 36px;
  border: 0;
  border-radius: 3px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.timeline-meta {
  flex: 0 0 auto;
  display: grid;
  gap: 1px;
  min-width: 116px;
  text-align: right;
}

.timeline-meta strong {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.timeline-meta span {
  color: var(--text-muted);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.timeline-all {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 0 12px;
  border: 1px solid var(--hairline);
  border-radius: 99px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 11.5px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.timeline-all:hover {
  color: var(--accent);
  border-color: var(--accent-line);
}

/* ----------------------------------------------------------------------------
   11. Responsive & préférences
---------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .timeline {
    width: min(680px, calc(100vw - 28px));
    bottom: 12px;
  }
}

@media (max-width: 720px) {
  .panel {
    top: 10px;
    left: 10px;
    width: calc(100vw - 20px);
    max-height: 62vh;
  }

  .table-wrap {
    top: auto;
    right: 10px;
    bottom: 10px;
    left: 10px;
    width: auto;
    height: 52vh;
  }

  .timeline {
    display: none;
  }
}

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

/* Export — fenêtre d'aperçu + renommage des colonnes (atlas/export.js) */
.export-ov {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(2, 4, 8, 0.5);
  animation: pop-in 0.14s var(--ease) both;
}
.export-modal {
  display: flex;
  flex-direction: column;
  width: min(980px, 96vw);
  max-height: 88vh;
  padding: 16px 20px 14px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-md);
  background: var(--surface-solid);
  color: var(--text);
  box-shadow: var(--shadow-pop);
}
.export-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.export-head h2 {
  margin: 0;
  font-size: 16px;
}
.export-x {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  color: var(--text);
  opacity: 0.7;
  padding: 2px 6px;
}
.export-x:hover {
  opacity: 1;
}
.export-note {
  margin: 6px 0 0;
  font-size: 12.5px;
  opacity: 0.75;
}
.export-warn {
  margin: 8px 0 0;
  padding: 8px 10px;
  font-size: 12px;
  border: 1px solid var(--accent-line);
  border-radius: var(--r-sm);
  background: var(--accent-soft);
}
.export-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 12px 0;
}
.export-fmt {
  display: inline-flex;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.export-fmt-b {
  border: none;
  background: var(--surface-2);
  color: var(--text);
  padding: 6px 16px;
  cursor: pointer;
  font-size: 12.5px;
}
.export-fmt-b.active {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.export-limit {
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  opacity: 0.9;
}
.export-lim {
  width: 90px;
  padding: 5px 7px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text);
}
.export-preview-wrap {
  flex: 1;
  overflow: auto;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
}
.export-preview {
  border-collapse: collapse;
  width: 100%;
  font-size: 11.5px;
}
.export-preview th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  padding: 0;
}
.export-h {
  width: 100%;
  min-width: 104px;
  box-sizing: border-box;
  border: none;
  border-bottom: 2px solid var(--hairline-strong);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  font-size: 11.5px;
  padding: 7px 8px;
}
.export-h:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: var(--surface-solid);
}
.export-preview td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}
.export-preview tbody tr:hover {
  background: var(--surface-2);
}
.export-foot {
  margin: 8px 0 0;
  font-size: 11px;
  opacity: 0.65;
}
.export-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}
.export-cancel,
.export-go {
  padding: 8px 18px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 13px;
  border: 1px solid var(--hairline-strong);
}
.export-cancel {
  background: var(--surface-2);
  color: var(--text);
}
.export-go {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
  font-weight: 600;
}
.export-empty .export-note {
  padding: 14px 0 8px;
}
