/* Portails Immobiliers — Design System v3
   Corps : cream clair permanent
   Header : photo + gradient overlay (tint adaptatif)
   Accent : varie selon periode */

:root {
  /* Corps — toujours clair */
  --bg:            #f4efe4;
  --bg-2:          #ece7db;
  --bg-card:       #ffffff;
  --bg-card-hover: #f9f7f2;
  --border:        rgba(28,40,60,0.09);
  --border-hi:     rgba(28,40,60,0.18);
  --text:          #1a2030;
  --text-2:        rgba(26,32,48,0.62);
  --text-3:        rgba(26,32,48,0.36);

  /* Accent — or champagne (matin/defaut) */
  --accent:        #c9a44a;
  --accent-dark:   #a07c28;
  --accent-dim:    rgba(201,164,74,0.10);
  --accent-glow:   rgba(201,164,74,0.22);

  /* Header overlay — matin */
  --h-ov-top:  rgba(8,16,36,0.62);
  --h-ov-mid:  rgba(8,16,36,0.28);
  --h-ov-bot:  rgba(8,16,36,0.72);

  /* Typo */
  --serif: 'Fraunces', Georgia, serif;
  --sans:  'DM Sans', system-ui, sans-serif;

  /* Divers */
  --r:          12px;
  --r-sm:       6px;
  --transition: 200ms cubic-bezier(.4,0,.2,1);
  --theme-td:   1.2s;
}

/* ════════════════════════════════
   BASE
   ════════════════════════════════ */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  overflow-x: hidden;
}

/* ════════════════════════════════
   HEADER
   ════════════════════════════════ */
.site-header {
  position: relative;
  min-height: 480px;
  display: flex;
  align-items: flex-end;
  padding: 0 24px 52px;
  background: #0a1428;
  overflow: hidden;
}

.h-photo {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}
.h-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
  opacity: 0;
  transition: opacity 1.4s ease;
}
.h-photo-img.loaded { opacity: 1; }

/* Gradient overlay — seul element au dessus de la photo */
.site-header::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    to bottom,
    var(--h-ov-top) 0%,
    var(--h-ov-mid) 45%,
    var(--h-ov-bot) 100%
  );
  transition: background var(--theme-td) ease;
}

/* Liseré or en bas */
.site-header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 8%; right: 8%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201,164,74,0.45), transparent);
  z-index: 3;
}

.header-inner {
  position: relative;
  z-index: 2;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  color: #fff;
}
.header-brand { margin-bottom: 28px; }
.header-eyebrow {
  font-family: var(--sans);
  font-size: .62rem;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
  opacity: .9;
  transition: color var(--theme-td) ease;
}
.header-title {
  font-family: var(--serif);
  font-size: clamp(2.2rem, 5.5vw, 3.8rem);
  font-weight: 300;
  letter-spacing: -.02em;
  line-height: 1.08;
  color: #fff;
  margin-bottom: 8px;
}
.accent { color: var(--accent); transition: color var(--theme-td) ease; }
.header-sub {
  font-size: .88rem;
  color: rgba(255,255,255,0.68);
  letter-spacing: .02em;
}
.header-story {
  font-family: 'Fraunces', Georgia, serif;
  font-size: .98rem;
  line-height: 1.55;
  color: rgba(255,255,255,0.82);
  margin-top: 14px;
  max-width: 64ch;
  font-weight: 300;
}
.section-intro {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.02rem;
  line-height: 1.65;
  color: var(--text-2);
  max-width: 72ch;
  margin: 4px 0 22px;
  font-weight: 400;
}

.header-kpis {
  display: flex;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: var(--r);
  overflow: hidden;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(10,20,40,0.42);
  max-width: 660px;
}
.kpi {
  flex: 1;
  padding: 16px 14px;
  display: flex; flex-direction: column; align-items: center;
  border-right: 1px solid rgba(255,255,255,0.10);
}
.kpi:last-child { border-right: none; }
.kpi-val {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -.02em;
  transition: color var(--theme-td) ease;
}
.kpi-unit  { font-size: .6rem;  color: rgba(255,255,255,0.42); margin-top: 1px; }
.kpi-label { font-size: .58rem; color: rgba(255,255,255,0.48); text-transform: uppercase; letter-spacing: .10em; margin-top: 4px; }

/* ════════════════════════════════
   PUBLICITE
   ════════════════════════════════ */
.ad-slot {
  text-align: center;
  padding: 8px 16px 12px;
  background: rgba(201,164,74,0.025);
  border-top: 1px solid rgba(201,164,74,0.06);
  border-bottom: 1px solid rgba(201,164,74,0.06);
}
.ad-label  { display: block; font-size: .55rem; color: var(--text-3); text-transform: uppercase; letter-spacing: .12em; margin-bottom: 2px; }
.ad-notice { display: block; font-size: .6rem; color: var(--text-3); font-style: italic; margin-bottom: 4px; opacity: .7; }
.ad-placeholder {
  display: flex; align-items: center; justify-content: center;
  height: 56px; border-radius: 6px; max-width: 728px; margin: 0 auto;
  background: rgba(28,40,60,0.03);
  border: 1px dashed rgba(201,164,74,0.14);
  font-size: .7rem; color: var(--text-3); font-style: italic;
}
.ad-slot-mid, .ad-slot-footer {
  max-width: 360px; margin: 0 auto;
  border-radius: var(--r); border: 1px solid rgba(201,164,74,0.08);
}
.ad-slot-mid .ad-placeholder, .ad-slot-footer .ad-placeholder { height: 250px; max-width: 300px; }
.ad-agency-slot {
  border: 1px dashed rgba(201,164,74,0.22) !important;
  background: rgba(201,164,74,0.025) !important;
  display: flex; align-items: center; justify-content: center;
}
.ad-agency-inner { text-align: center; padding: 8px; }
.ad-agency-title { font-family: var(--serif); font-size: 1rem; margin: 8px 0 4px; color: var(--text); }
.ad-agency-sub   { font-size: .75rem; color: var(--text-2); margin-bottom: 14px; line-height: 1.5; }

/* ════════════════════════════════
   NAVIGATION TABS
   ════════════════════════════════ */
.tab-nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(244,239,228,0.97);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.tab-nav-inner {
  display: flex; overflow-x: auto; scrollbar-width: none;
  max-width: 1500px; margin: 0 auto; justify-content: center; padding: 0 8px;
}
.tab-nav-inner::-webkit-scrollbar { display: none; }
.tab-btn {
  flex-shrink: 0; padding: 14px 16px;
  border: none; background: none;
  font-family: var(--sans); font-size: .73rem; font-weight: 500; letter-spacing: .025em;
  color: var(--text-3); cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}
.tab-btn:hover { color: var(--text-2); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.tab-scroll-hint {
  display: none; position: absolute; right: 0; top: 0; bottom: 0; width: 40px;
  background: linear-gradient(to right, transparent, rgba(244,239,228,0.97));
  pointer-events: none;
}
@media (max-width: 768px) {
  .tab-nav-inner { justify-content: flex-start; }
  .tab-btn { padding: 12px 13px; }
  .tab-scroll-hint { display: block; }
}

/* ════════════════════════════════
   PANELS
   ════════════════════════════════ */
.panel { display: none; animation: fadeUp .28s ease; }
.panel.active { display: block; }
@keyframes fadeUp { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }

.panel-inner { max-width: 1500px; margin: 0 auto; padding: 36px 36px; overflow-x: hidden; }
@media (max-width: 900px) { .panel-inner { padding: 30px 24px; } }
@media (max-width: 600px) { .panel-inner { padding: 22px 16px; } }
.panel-inner h2 {
  font-family: var(--serif);
  font-size: 1.75rem; font-weight: 400;
  letter-spacing: -.02em; margin-bottom: 4px; line-height: 1.2; color: var(--text);
}
.panel-inner h3 { font-family: var(--serif); font-size: 1.15rem; font-weight: 400; margin-bottom: 14px; color: var(--text-2); }
.source { font-size: .7rem; color: var(--text-3); margin-bottom: 28px; letter-spacing: .04em; text-transform: uppercase; }
.muted  { color: var(--text-3); }

/* ════════════════════════════════
   MARCHE
   ════════════════════════════════ */
.marche-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr));
  gap: 12px; margin-bottom: 28px;
}
.marche-stat-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r);
  padding: 20px 18px; text-align: center;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.marche-stat-card:hover { border-color: var(--border-hi); box-shadow: 0 4px 20px rgba(28,40,60,0.07); }
.marche-stat-val {
  font-family: var(--serif); font-size: 2rem; font-weight: 400;
  color: var(--accent); letter-spacing: -.03em;
  transition: color var(--theme-td) ease;
}
.marche-stat-label { font-size: .65rem; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; margin-top: 4px; }

.marche-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 32px; }
@media (max-width: 900px) { .marche-grid { grid-template-columns: 1fr; } }

#marche-map, #quartiers-map, .map-container {
  height: 460px; width: 100%;
  border-radius: var(--r); border: 1px solid var(--border); z-index: 0;
}
.map-legend {
  display: flex; gap: 14px; flex-wrap: wrap;
  margin: 8px 0; padding: 10px 14px;
  background: var(--bg-2); border-radius: 8px; border: 1px solid var(--border); font-size: .75rem;
}
.legend-item { display: flex; align-items: center; gap: 5px; color: var(--text-2); }
.legend-dot  { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }

.table-scroll { max-height: 460px; overflow-y: auto; border-radius: var(--r); border: 1px solid var(--border); }
.data-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.data-table th {
  text-align: left; padding: 10px 14px;
  background: var(--bg-2); color: var(--text-3); font-size: .68rem;
  text-transform: uppercase; letter-spacing: .06em; font-weight: 500;
  position: sticky; top: 0; border-bottom: 1px solid var(--border);
}
.data-table td { padding: 8px 14px; border-bottom: 1px solid var(--border); color: var(--text); }
.data-table tr:hover td { background: var(--accent-dim); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

.chart-section { margin-top: 24px; }
.chart-section canvas { max-height: 340px; }

/* ════════════════════════════════
   QUARTIERS
   ════════════════════════════════ */
/* overflow-x: hidden sur .panel-inner casse position: sticky -> override pour quartiers */
#quartiers > .panel-inner { overflow-x: visible; overflow-y: visible; }

/* Intro Quartiers : chapeau pleine largeur + grille de strates + disclaimer DVF */
.quartiers-intro { margin: 4px 0 28px; }
.quartiers-intro-lead {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.08rem; line-height: 1.65;
  color: var(--text-2);
  max-width: 95ch;
  margin: 0 0 22px;
  font-weight: 400;
}
.quartiers-intro-strates {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 18px;
}
@media (max-width: 1200px) { .quartiers-intro-strates { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px)  { .quartiers-intro-strates { grid-template-columns: 1fr; } }
.quartiers-intro-strate {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color var(--theme-td) ease, box-shadow .2s ease, transform .25s ease;
}
.quartiers-intro-strate:hover {
  border-color: var(--border-hi);
  box-shadow: 0 6px 22px rgba(28,40,60,0.10);
  transform: translateY(-2px);
}
.quartiers-intro-strate-photo {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--bg-2);
}
.quartiers-intro-strate-photo img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  transition: transform .5s ease;
}
.quartiers-intro-strate:hover .quartiers-intro-strate-photo img { transform: scale(1.04); }
.quartiers-intro-strate-photo::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0) 60%, rgba(0,0,0,0.18) 100%);
  pointer-events: none;
}
.quartiers-intro-strate-body { padding: 14px 16px; }
.quartiers-intro-strate-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: .98rem; font-weight: 500;
  color: var(--accent);
  margin: 0 0 6px;
  letter-spacing: -.005em;
  transition: color var(--theme-td) ease;
}
.quartiers-intro-strate-desc {
  font-size: .855rem; line-height: 1.55;
  color: var(--text-2);
  margin: 0;
}
.quartiers-intro-disclaimer {
  font-size: .8rem; line-height: 1.6;
  color: var(--text-2);
  margin: 18px 0 0;
  padding: 12px 16px;
  background: var(--accent-dim);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  max-width: 95ch;
  transition: background var(--theme-td) ease, border-color var(--theme-td) ease;
}
.quartiers-intro-disclaimer strong { color: var(--accent-dark); font-weight: 600; }

/* Layout desktop : carte carrée sticky a gauche, liste 2 colonnes a droite */
.quartiers-layout {
  display: grid;
  grid-template-columns: minmax(420px, 0.85fr) minmax(0, 1.15fr);
  gap: 24px;
  align-items: start;
}
.quartiers-map-wrap {
  position: sticky;
  top: 12px;
  z-index: 5;
  align-self: start;
}
.quartiers-map-wrap #quartiers-map {
  aspect-ratio: 1 / 1;
  height: auto;
  width: 100%;
  max-height: calc(100vh - 32px);
}
@media (max-width: 1100px) {
  .quartiers-layout { grid-template-columns: minmax(340px, 0.9fr) minmax(0, 1.1fr); gap: 18px; }
}
@media (max-width: 800px) {
  .quartiers-layout { grid-template-columns: 1fr; gap: 16px; }
  .quartiers-map-wrap { position: static; }
  .quartiers-map-wrap #quartiers-map { aspect-ratio: 4 / 3; max-height: 60vh; }
}

/* ════════════════════════════════ ANNUAIRE RUES ════════════════════════════════ */
.rues-controls {
  padding: 14px 18px !important;
  position: sticky; top: 60px; z-index: 20;
  background: color-mix(in srgb, var(--bg-card) 92%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  box-shadow: 0 1px 0 var(--border);
}
.rues-search-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 12px;
  align-items: stretch;
}
@media (max-width: 700px) {
  .rues-controls { top: 56px; padding: 12px 14px !important; }
  .rues-search-row { grid-template-columns: 1fr; gap: 8px; }
}
.rues-count {
  margin: 8px 2px 0;
  font-size: .82rem;
  color: var(--text-3);
  font-style: italic;
  font-variant-numeric: tabular-nums;
  min-height: 1.2em;
}
.rues-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-3);
  font-size: .95rem;
}
.rues-empty-sub {
  display: inline-block;
  margin-top: 6px;
  font-size: .82rem;
  color: var(--text-3);
  opacity: .75;
}
.rues-search, .rues-select {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-2); color: var(--text-1); font: inherit; font-size: .9rem;
  width: 100%;
}
.rues-search:focus, .rues-select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.rues-search-wrap { position: relative; min-width: 0; }
.rues-search { padding-left: 38px !important; padding-right: 38px !important; }
.rues-search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-3); pointer-events: none; display: inline-flex;
}
.rues-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px; border-radius: 50%; border: none;
  background: var(--bg-2); color: var(--text-3); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .12s ease, color .12s ease;
}
.rues-clear:hover { background: var(--accent-dim); color: var(--accent); }
.rues-suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 50;
  background: var(--bg-card); border: 1px solid var(--border-hi); border-radius: 10px;
  box-shadow: 0 8px 28px rgba(28,40,60,0.14);
  padding: 8px; max-height: 360px; overflow-y: auto;
}
.rues-suggest-title {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-3); margin: 4px 8px 6px;
}
.rues-suggest-item {
  display: flex; flex-direction: column; align-items: stretch; gap: 2px;
  width: 100%; text-align: left; padding: 8px 10px; border: none; border-radius: 6px;
  background: transparent; color: var(--text-1); font: inherit; cursor: pointer;
  transition: background .12s ease;
}
.rues-suggest-item:hover { background: var(--accent-dim); }
.rues-suggest-name { font-family: 'Fraunces', Georgia, serif; font-size: .92rem; color: var(--text-1); }
.rues-suggest-meta { font-size: .7rem; color: var(--text-3); }

/* Index alphabétique */
.rues-alpha {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin: 20px 0 14px; padding: 12px 14px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px;
  position: sticky; top: 60px; z-index: 30;
}
.rues-alpha-btn {
  display: inline-flex; flex-direction: column; align-items: center;
  min-width: 32px; padding: 4px 6px; border: 1px solid transparent; border-radius: 6px;
  background: transparent; color: var(--text-1); font: inherit; cursor: pointer;
  transition: all .12s ease;
}
.rues-alpha-btn:hover:not(.rues-alpha-btn-disabled) { background: var(--accent-dim); border-color: var(--accent); }
.rues-alpha-btn-active { background: var(--accent); color: #fff; border-color: var(--accent); }
.rues-alpha-btn-active .rues-alpha-count { color: rgba(255,255,255,0.7); }
.rues-alpha-btn-disabled { color: var(--text-3); cursor: not-allowed; opacity: .35; }
.rues-alpha-letter { font-family: 'Fraunces', Georgia, serif; font-size: 1rem; font-weight: 500; line-height: 1; }
.rues-alpha-count { font-size: .62rem; color: var(--text-3); margin-top: 2px; line-height: 1; }
@media (max-width: 700px) { .rues-alpha { top: 0; } .rues-alpha-btn { min-width: 28px; } }

/* Teaser experts.immo (CTA en construction) */
.rues-experts-teaser {
  margin-top: 36px; padding: 28px 26px;
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--accent-dim) 100%);
  border: 1px solid var(--border-hi); border-radius: 14px;
  position: relative; overflow: hidden;
}
.rues-experts-teaser::before {
  content: ''; position: absolute; top: -50%; right: -20%;
  width: 60%; height: 200%;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 60%);
  opacity: 0.4; pointer-events: none;
}
.rues-experts-teaser-inner { position: relative; z-index: 1; max-width: 720px; }
.rues-experts-eyebrow {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .14em;
  color: var(--accent); font-weight: 600; margin-bottom: 10px;
}
.rues-experts-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.4rem; font-weight: 500; color: var(--text-1);
  line-height: 1.25; margin: 0 0 12px;
}
.rues-experts-desc { color: var(--text-2); font-size: .9rem; line-height: 1.65; margin: 0 0 12px; }
.rues-experts-desc strong { color: var(--accent); font-weight: 600; }
.rues-experts-status {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .78rem; color: var(--text-3); font-style: italic;
}
.rues-experts-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-dim);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 4px var(--accent-dim); }
  50%     { box-shadow: 0 0 0 8px transparent; }
}

/* Flash highlight d'une card après clic sur suggestion */
@keyframes ruesFlash {
  0%   { background: var(--accent-dim); border-color: var(--accent); transform: scale(1.01); }
  100% { background: var(--bg-card); border-color: var(--border); transform: scale(1); }
}
.rue-card-flash { animation: ruesFlash 1.8s ease-out; }

.rues-list { display: flex; flex-direction: column; gap: 26px; margin-top: 18px; }
.rue-group-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.4rem; font-weight: 500; color: var(--accent);
  margin: 0 0 12px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: baseline; gap: 10px;
}

.rue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 18px;
}
.rue-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 20px 22px;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.rue-card:hover { transform: translateY(-1px); }
.rue-card:hover { border-color: var(--border-hi); box-shadow: 0 4px 14px rgba(28,40,60,0.08); }
.rue-card-clickable { cursor: pointer; }
.rue-card-clickable:hover { border-color: var(--accent); box-shadow: 0 4px 18px rgba(28,40,60,0.12); }
.rue-card-clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Mini-onglets année (Filosofi/INSEE séries) */
.demo-year-tabs {
  display: flex;
  gap: 4px;
  margin: 0 0 12px;
  padding: 4px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.demo-year-tab {
  flex: 1;
  min-width: 56px;
  padding: 6px 10px;
  font-size: .78rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.demo-year-tab:hover { background: var(--bg-card); color: var(--text-1); }
.demo-year-tab.active {
  background: var(--bg-card);
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}
.demo-year-body { animation: fadeIn .15s ease; }

/* Modal ventes DVF par rue */
.sales-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.sales-modal.open { display: flex; }
.sales-modal-overlay {
  position: absolute; inset: 0;
  background: rgba(10,28,46,0.55);
  backdrop-filter: blur(3px);
  animation: fadeIn .2s ease;
}
.sales-modal-inner {
  position: relative; z-index: 1;
  background: var(--bg-card);
  border-radius: 12px;
  max-width: 1100px; width: 100%;
  max-height: 88vh; display: flex; flex-direction: column;
  box-shadow: 0 24px 64px rgba(10,28,46,0.32);
  animation: scaleIn .22s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
.sales-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 28px 16px;
  border-bottom: 1px solid var(--border);
}
.sales-modal-eyebrow {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--accent); font-weight: 600; margin: 0 0 4px;
  transition: color var(--theme-td) ease;
}
.sales-modal-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.35rem; font-weight: 500;
  color: var(--text-1); margin: 0;
}
.sales-modal-close {
  background: var(--bg-2); border: 1px solid var(--border);
  width: 36px; height: 36px; border-radius: 50%;
  font-size: 1.3rem; line-height: 1; cursor: pointer;
  color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}
.sales-modal-close:hover { background: var(--accent); color: #fff; transform: rotate(90deg); }
.sales-modal-body {
  padding: 18px 28px 24px;
  overflow-y: auto;
  flex: 1;
}
.sales-modal-intro {
  font-size: .85rem; line-height: 1.55; color: var(--text-2);
  margin: 0 0 14px;
  padding: 10px 14px;
  background: var(--accent-dim);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
}
.sales-modal-intro strong { color: var(--accent-dark); }
.sales-modal-table-wrap { overflow-x: auto; }
.sales-modal-table {
  width: 100%; border-collapse: collapse; font-size: .84rem;
}
.sales-modal-table th, .sales-modal-table td {
  padding: 10px 12px; text-align: left;
  border-bottom: 1px solid var(--border);
}
.sales-modal-table th {
  font-weight: 600; color: var(--text-2);
  font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  background: var(--bg-2);
  position: sticky; top: 0;
}
.sales-modal-table td.num, .sales-modal-table th.num { text-align: right; white-space: nowrap; }
.sales-modal-table tr:hover td { background: var(--accent-dim); }
.sales-modal-table .sale-date { white-space: nowrap; color: var(--text-2); font-variant-numeric: tabular-nums; }
.sales-modal-table strong { color: var(--accent-dark); font-weight: 600; }
@media (max-width: 600px) {
  .sales-modal { padding: 8px; }
  .sales-modal-head { padding: 14px 18px 12px; }
  .sales-modal-body { padding: 14px 18px 20px; }
  .sales-modal-title { font-size: 1.1rem; }
  .sales-modal-table { font-size: .78rem; }
  .sales-modal-table th, .sales-modal-table td { padding: 8px 10px; }
}
.rue-head { margin-bottom: 8px; }
.rue-kind {
  display: inline-block; font-size: .62rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--accent); font-weight: 600;
}
.rue-name {
  font-family: 'Fraunces', Georgia, serif; font-size: 1.02rem; font-weight: 500;
  color: var(--text-1); margin: 2px 0 0;
}
.rue-stats {
  display: flex; flex-wrap: wrap; gap: 12px;
  font-size: .76rem; color: var(--text-2); margin-bottom: 10px;
  padding-top: 8px; border-top: 1px solid var(--border);
}
.rue-stat strong { color: var(--text-1); font-weight: 600; }
.rue-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.btn-rue {
  flex: 1; min-width: 100px; font-size: .72rem; padding: 7px 8px; text-align: center;
}

.infra-filter, .poi-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.infra-btn, .poi-btn {
  padding: 5px 13px; border: 1px solid var(--border); border-radius: 20px;
  background: transparent; font-family: var(--sans); font-size: .72rem; font-weight: 500;
  color: var(--text-3); cursor: pointer; transition: all .2s;
}
.infra-btn:hover, .poi-btn:hover { border-color: var(--accent); color: var(--accent); }
.infra-btn.active, .poi-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.poi-btn.loading {
  position: relative; opacity: 0.85;
}
.poi-btn.loading::after {
  content: ''; display: inline-block; width: 10px; height: 10px;
  margin-left: 8px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  vertical-align: middle; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.quartiers-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-content: start;
}
@media (max-width: 1400px) { .quartiers-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 800px)  { .quartiers-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px)  { .quartiers-list { grid-template-columns: 1fr; } }
.quartiers-subgroup { grid-column: 1 / -1; margin: 4px 0 8px; }
.quartiers-subgroup-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1rem; font-weight: 500; color: var(--accent);
  margin: 0 0 8px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px;
}
.quartiers-subgroup-title .news-count {
  font-family: 'DM Sans', sans-serif; font-size: .65rem;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-3); font-weight: 500;
}
.quartiers-cadastral { grid-column: 1 / -1; margin-top: 16px; padding: 14px 16px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px;
}
.quartiers-cadastral summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; }
.quartiers-cadastral summary::-webkit-details-marker { display: none; }
.quartiers-cadastral summary::before {
  content: '+'; font-size: 1.3rem; color: var(--accent); width: 16px; text-align: center; flex-shrink: 0;
}
.quartiers-cadastral[open] summary::before { content: '−'; }
.quartiers-subgroup-title-folded { margin: 0; padding: 0; border: none; }
.quartiers-cadastral-note { font-size: .76rem; color: var(--text-3); margin: 12px 0 14px; font-style: italic; line-height: 1.5; }
.quartiers-cadastral-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
}
@media (max-width: 560px) { .quartiers-cadastral-grid { grid-template-columns: 1fr; } }

.quartier-card-compact { padding: 8px 12px !important; opacity: 0.85; }
.quartier-card-compact:hover { opacity: 1; }
.quartier-card-compact .quartier-header h4 { font-size: .8rem; }
.quartier-card-compact .quartier-stats { font-size: .65rem; }

.quartier-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 10px 12px; cursor: pointer; min-width: 0;
  transition: border-color .2s, box-shadow .2s;
}
.quartier-card:hover { border-color: var(--border-hi); box-shadow: 0 2px 12px rgba(28,40,60,0.07); }
.quartier-card.active { border-color: var(--accent); background: var(--accent-dim); box-shadow: 0 2px 12px rgba(28,40,60,0.10); }
.quartier-header { display: flex; justify-content: space-between; align-items: baseline; }
.quartier-header h4 { font-size: .88rem; font-weight: 600; color: var(--text); }
.quartier-price { color: var(--accent); font-weight: 700; font-size: .88rem; transition: color var(--theme-td) ease; }
.quartier-stats { display: flex; gap: 12px; font-size: .7rem; color: var(--text-3); margin-top: 4px; flex-wrap: wrap; }
.quartier-desc {
  font-size: .76rem; line-height: 1.45; color: var(--text-2); margin: 6px 0 4px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.quartier-tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 6px; }
.qtag {
  display: inline-block; font-size: .65rem; padding: 2px 8px; border-radius: 999px;
  letter-spacing: .03em; border: 1px solid var(--border);
  background: var(--bg-2); color: var(--text-2);
}
.qtag-ambiance { border-color: var(--accent); color: var(--accent); }
.qtag-profil { font-style: italic; }

/* ════════════════════════════════
   AGENCES
   ════════════════════════════════ */
.agency-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px,1fr)); gap: 16px; }
.agency-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r);
  padding: 22px 24px; transition: border-color var(--transition), box-shadow var(--transition);
}
.agency-card:hover { border-color: var(--border-hi); box-shadow: 0 6px 24px rgba(28,40,60,0.09); }
.agency-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
.agency-name { font-family: var(--serif); font-weight: 400; font-size: 1.05rem; letter-spacing: -.01em; color: var(--text); }
.agency-rating { text-align: right; white-space: nowrap; }
.stars { color: #e8a820; font-size: .85rem; letter-spacing: -.02em; }
.rating-num { font-weight: 600; font-size: .78rem; margin-left: 4px; color: var(--text-2); }
.reviews-count { font-size: .68rem; color: var(--text-3); }
.agency-addr  { font-size: .78rem; color: var(--text-2); margin-bottom: 4px; }
.agency-phone { font-size: .8rem; margin-bottom: 12px; }
.agency-phone a { color: var(--accent); text-decoration: none; transition: color var(--theme-td) ease; }
.agency-phone a:hover { text-decoration: underline; }
.agency-actions { display: flex; gap: 8px; }

/* ════════════════════════════════
   BOUTONS
   ════════════════════════════════ */
.btn-outline {
  display: inline-block; padding: 7px 16px;
  border: 1px solid var(--border-hi); border-radius: 6px;
  font-family: var(--sans); font-size: .73rem; font-weight: 500; letter-spacing: .02em;
  color: var(--text-2); text-decoration: none;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.btn-gold {
  display: inline-block; padding: 7px 16px;
  background: var(--accent); border: none; border-radius: 6px;
  font-family: var(--sans); font-size: .73rem; font-weight: 600; letter-spacing: .02em;
  color: #fff; text-decoration: none;
  transition: opacity var(--transition), box-shadow var(--transition), background var(--theme-td) ease;
}
.btn-gold:hover { opacity: .88; box-shadow: 0 4px 16px var(--accent-glow); }

/* ════════════════════════════════
   PROGRAMMES
   ════════════════════════════════ */
.programmes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px,1fr)); gap: 22px; }
.programme-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r);
  position: relative; overflow: hidden;
  display: flex; flex-direction: column;
  transition: border-color var(--transition), box-shadow var(--transition), transform .25s ease;
}
.programme-card:hover { border-color: var(--border-hi); box-shadow: 0 10px 30px rgba(28,40,60,0.12); transform: translateY(-2px); }
.programme-image-wrap { position: relative; aspect-ratio: 16/10; overflow: hidden; background: var(--bg-2); }
.programme-image { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s ease; }
.programme-card:hover .programme-image { transform: scale(1.04); }
.programme-status {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  padding: 4px 10px; border-radius: 4px;
  font-size: .62rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em;
  background: rgba(0,0,0,0.72); color: #fff; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.programme-status-nofoto {
  position: static; display: inline-block; margin: 14px 0 0 14px;
  background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(201,164,74,0.15);
}
.programme-body { padding: 18px 22px 22px; display: flex; flex-direction: column; flex: 1; }
.programme-name { font-family: var(--serif); font-size: 1.18rem; font-weight: 500; margin-bottom: 4px; letter-spacing: -.01em; color: var(--text-1); }
.programme-promoteur { font-size: .8rem; color: var(--text-2); margin-bottom: 12px; }
.programme-promoteur strong { color: var(--accent); font-weight: 600; }
.programme-desc { font-size: .82rem; color: var(--text-2); margin-bottom: 16px; line-height: 1.6; }
.programme-details { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; }
.prog-detail { display: flex; justify-content: space-between; gap: 12px; font-size: .78rem; padding: 7px 0; border-bottom: 1px solid var(--border); }
.prog-detail:last-child { border-bottom: none; }
.prog-detail span:last-child { text-align: right; color: var(--text-1); font-weight: 500; }
.prog-label { color: var(--text-3); text-transform: uppercase; font-size: .65rem; letter-spacing: .06em; font-weight: 600 !important; }
.programme-actions {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px;
}
.programme-actions .btn-gold, .programme-actions .btn-outline {
  flex: 1; min-width: 110px; font-size: .78rem; padding: 9px 12px; text-align: center;
}

/* ════════════════════════════════
   ANNONCES
   ════════════════════════════════ */
.annonces-grid, .annonces-grid-wide { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 20px; }
.annonce-platform {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r);
  padding: 26px; text-align: center;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.annonce-platform:hover { border-color: var(--border-hi); box-shadow: 0 4px 20px rgba(28,40,60,0.07); }
.annonce-platform-featured   { border-color: var(--border-hi); }
.annonce-platform-estimation { border-color: var(--border-hi); background: var(--accent-dim); }
.annonce-platform h3 { font-family: var(--serif); font-size: 1.15rem; margin-bottom: 8px; color: var(--text); }
.annonce-platform p { font-size: .82rem; color: var(--text-2); margin-bottom: 16px; }
.annonce-platform-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.annonce-badge {
  font-size: .62rem; padding: 3px 9px; border-radius: 20px;
  background: var(--accent-dim); color: var(--accent);
  border: 1px solid rgba(201,164,74,0.15); white-space: nowrap;
  transition: background var(--theme-td) ease, color var(--theme-td) ease;
}
.annonce-links, .annonce-links-2col { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.annonce-links-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-annonce { display: block; text-align: center; padding: 9px 12px; font-size: .78rem; }
.annonce-logo { font-family: var(--serif); font-size: 1.3rem; font-weight: 700; margin-bottom: 10px; padding: 6px 0; }
.annonce-logo-seloger { color: #cc0008; }
.annonce-logo-lbc     { color: #e05c0e; }
.annonce-logo-bienici { color: #2060d8; }
.annonce-logo-pap     { color: #007bff; }
.annonce-logo-ma      { color: #6c3fc5; }
.affil-notice     { font-size: .7rem; color: var(--text-3); font-style: italic; }
.affil-disclaimer { margin-top: 16px; padding: 10px 16px; font-size: .75rem; color: var(--text-3); font-style: italic; border-left: 2px solid var(--border); }

/* ════════════════════════════════
   DEMOGRAPHIE
   ════════════════════════════════ */
.demo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px,1fr)); gap: 18px; padding: 8px 0; }
.demo-grid-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) { .demo-grid-2 { grid-template-columns: 1fr; } }
.demo-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r); padding: 22px; min-height: 280px; display: flex; flex-direction: column; }
.demo-card-wide { margin: 8px 0 18px; }
.demo-card h3 { font-size: .82rem; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); margin-bottom: 14px; transition: color var(--theme-td) ease; font-weight: 600; }
.demo-card canvas { width: 100% !important; height: 260px !important; max-height: 320px; }
.demo-card-wide canvas { height: 300px !important; max-height: 360px; }
@media (max-width: 700px) {
  .demo-card canvas, .demo-card-wide canvas { height: 240px !important; }
}
.demo-card-note { margin-top: 12px; font-size: .78rem; color: var(--text-3); font-style: italic; }
.demo-card-sub {
  font-size: .78rem; line-height: 1.5; color: var(--text-3);
  margin: -8px 0 14px; max-width: 70ch;
}
.demo-logements { padding: 0; background: transparent; border: none; }

/* KPI banner (réutilisé démographie + fiscalité) */
.kpi-bar {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px; margin: 12px 0 22px;
}
.kpi-tile {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 2px;
  transition: border-color .2s ease, transform .2s ease;
}
.kpi-tile:hover { border-color: var(--accent); }
.kpi-tile-val { font-family: 'Fraunces', Georgia, serif; font-size: 1.45rem; font-weight: 500; color: var(--text-1); line-height: 1.1; }
.kpi-tile-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); margin-top: 4px; }
.kpi-tile-hint { font-size: .7rem; color: var(--text-3); margin-top: 2px; }

.stat-hint { display: block; font-size: .68rem; color: var(--text-3); font-weight: 400; margin-top: 2px; font-style: italic; }

.stat-row-input { padding: 12px 0; }
.prix-input-wrap {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--accent); font-weight: 600; font-size: 1.05rem;
}
.prix-input-wrap input {
  width: 130px; padding: 6px 10px; text-align: right;
  background: var(--bg-2); color: var(--accent);
  border: 1px solid var(--border); border-radius: 6px;
  font: inherit; font-weight: 600; font-size: 1rem;
  -moz-appearance: textfield;
}
.prix-input-wrap input::-webkit-outer-spin-button,
.prix-input-wrap input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.prix-input-wrap input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }

.prix-range {
  width: 100%; margin: 6px 0 14px; height: 4px; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  background: linear-gradient(to right,
      var(--accent) 0%,
      var(--accent) var(--range-progress, 9.1%),
      var(--border)  var(--range-progress, 9.1%),
      var(--border) 100%);
  border-radius: 2px;
}
.prix-range:focus { outline: none; }
.prix-range::-webkit-slider-runnable-track { background: transparent; height: 4px; }
.prix-range::-moz-range-track { background: transparent; height: 4px; }
.prix-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg-card);
  box-shadow: 0 1px 4px rgba(0,0,0,0.25); cursor: pointer;
}
.prix-range::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg-card);
  box-shadow: 0 1px 4px rgba(0,0,0,0.25); cursor: pointer;
}
.stat-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border); }
.stat-row:last-child { border-bottom: none; }
.stat-row span   { color: var(--text-2); font-size: .875rem; }
.stat-row strong { color: var(--accent); font-size: 1rem; transition: color var(--theme-td) ease; }

/* ════════════════════════════════
   FISCALITE
   ════════════════════════════════ */
.fisc-content { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 8px 0; }
.fisc-table-wrap { border-radius: var(--r); border: 1px solid var(--border); overflow: hidden; overflow-x: auto; }

.fisc-legend {
  display: flex; flex-wrap: wrap; gap: 18px; margin-top: 14px;
  padding: 10px 14px; background: var(--bg-2); border-radius: 8px;
  border: 1px solid var(--border); font-size: .8rem;
}
.fisc-legend-item { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); }
.fisc-dot {
  display: inline-block; width: 22px; height: 3px; border-radius: 2px; position: relative;
}
.fisc-dot-dash {
  background-image: linear-gradient(90deg, currentColor 50%, transparent 50%) !important;
  background-size: 8px 100%;
}
.fisc-dot-dot {
  background-image: linear-gradient(90deg, currentColor 40%, transparent 40%) !important;
  background-size: 4px 100%;
}

.data-table td.positive { color: #c0392b; font-weight: 500; }
.data-table td.negative { color: #2e7d32; font-weight: 500; }
.data-table tr.self-row { background: var(--accent-dim); }
.data-table tr.self-row td { font-weight: 600; color: var(--accent); }
.fisc-note { font-size: .8rem; color: var(--text-3); margin-top: 14px; font-style: italic; line-height: 1.6; }

/* ════════════════════════════════
   ACTUALITES
   ════════════════════════════════ */
.news-list { display: flex; flex-direction: column; gap: 12px; padding: 8px 0; }
.news-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r);
  padding: 18px 20px; transition: border-color .2s, box-shadow .2s;
}
.news-card:hover { border-color: var(--border-hi); box-shadow: 0 2px 12px rgba(28,40,60,0.07); }
.news-meta   { display: flex; gap: 12px; margin-bottom: 8px; }
.news-date   { font-size: .75rem; color: var(--accent); transition: color var(--theme-td) ease; }
.news-source { font-size: .75rem; color: var(--text-3); }
.news-title  { margin-bottom: 6px; }
.news-title a { color: var(--text); text-decoration: none; font-family: var(--serif); font-size: 1rem; }
.news-title a:hover { color: var(--accent); }
.news-resume { color: var(--text-2); font-size: .82rem; line-height: 1.55; }

.news-section-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.05rem; font-weight: 500;
  color: var(--text-1); margin: 18px 0 10px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: baseline; gap: 8px;
}
.news-section-title:first-child { margin-top: 0; }
.news-count {
  display: inline-block; font-family: 'DM Sans', sans-serif;
  font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-3); font-weight: 500;
}
.news-grid { display: flex; flex-direction: column; gap: 12px; }

.news-archives {
  margin-top: 22px; padding: 14px 18px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--r);
}
.news-archives summary {
  cursor: pointer; list-style: none; font-weight: 600; color: var(--text-2);
  font-size: .88rem; display: flex; align-items: center; gap: 10px;
}
.news-archives summary::-webkit-details-marker { display: none; }
.news-archives summary::before {
  content: '+'; font-size: 1.2rem; color: var(--accent); width: 14px; text-align: center;
}
.news-archives[open] summary::before { content: '−'; }
.news-archives summary > span:first-of-type {
  text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; color: var(--accent);
}
.news-grid-archives {
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border);
}
.news-grid-archives .news-card { opacity: 0.85; }
.news-grid-archives .news-card:hover { opacity: 1; }

/* ════════════════════════════════
   EVENEMENTS
   ════════════════════════════════ */
.events-list { display: flex; flex-direction: column; gap: 12px; padding: 8px 0; }
.event-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r);
  padding: 18px 20px; display: flex; gap: 20px;
  transition: border-color .2s, box-shadow .2s;
}
.event-card:hover { border-color: var(--border-hi); box-shadow: 0 2px 12px rgba(28,40,60,0.07); }
.event-date  { flex-shrink: 0; width: 80px; display: flex; flex-direction: column; gap: 4px; }
.event-day   { font-size: .82rem; color: var(--accent); font-weight: 500; transition: color var(--theme-td) ease; }
.event-month { font-size: .7rem; color: var(--text-3); text-transform: uppercase; }
.event-type  { font-size: .68rem; background: var(--bg-2); color: var(--text-2); padding: 2px 8px; border-radius: 20px; text-align: center; text-transform: uppercase; letter-spacing: .05em; }
.event-info h4 { font-family: var(--serif); font-size: .95rem; margin-bottom: 4px; }
.event-info h4 a { color: var(--text); text-decoration: none; }
.event-info h4 a:hover { color: var(--accent); }
.event-lieu    { font-size: .8rem; color: var(--accent); margin-bottom: 4px; transition: color var(--theme-td) ease; }
.event-info p  { color: var(--text-2); font-size: .82rem; line-height: 1.55; }

/* ════════════════════════════════
   POLITIQUE
   ════════════════════════════════ */
.politique-grid, .politique-content { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px,1fr)); gap: 20px; padding: 8px 0; }
.politique-card, .maire-card, .election-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r); padding: 22px; }
.maire-card h3, .election-card h3 { font-family: var(--serif); font-size: 1rem; margin-bottom: 12px; color: var(--accent); transition: color var(--theme-td) ease; }
.politique-card h4 {
  font-size: .85rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--accent); margin-bottom: 12px;
  border-bottom: 1px solid var(--border); padding-bottom: 10px;
  transition: color var(--theme-td) ease;
}
.parti-badge {
  display: inline-block; background: var(--accent-dim); color: var(--accent);
  font-size: .72rem; padding: 3px 12px; border-radius: 20px; margin-bottom: 12px;
  letter-spacing: .04em; text-transform: uppercase;
  transition: background var(--theme-td) ease, color var(--theme-td) ease;
}
.maire-info h4 { font-size: 1.05rem; margin-bottom: 6px; color: var(--text); }
.maire-info p  { font-size: .85rem; color: var(--text-2); margin-bottom: 4px; line-height: 1.5; }
.election-results { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: flex; align-items: center; gap: 10px; margin: 4px 0; }
.result-name, .bar-label { flex: 1; font-size: .82rem; color: var(--text-2); min-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-pct, .bar-pct { flex: 0 0 42px; text-align: right; font-size: .82rem; font-weight: 600; color: var(--accent); transition: color var(--theme-td) ease; }
.bar, .bar-wrap { flex: 2; background: var(--bg-2); border-radius: 3px; height: 7px; overflow: hidden; min-width: 80px; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: background var(--theme-td) ease; }
.bar-fill-alt   { background: var(--text-3); }
.bar-fill-third { background: var(--border-hi); }
.election-turnout { font-size: .73rem; color: var(--text-3); margin-top: 10px; }

/* ════════════════════════════════
   FOOTER
   ════════════════════════════════ */
.site-footer {
  text-align: center; padding: 48px 24px 36px;
  border-top: 1px solid var(--border); background: var(--bg-2);
}
.footer-inner { max-width: 800px; margin: 0 auto; }
.footer-data   { font-size: .75rem; color: var(--text-3); margin-bottom: 4px; }
.footer-data a { color: var(--accent); text-decoration: none; transition: color var(--theme-td) ease; }
.footer-data a:hover { text-decoration: underline; }

/* === Sous-bandeau avertissement légal === */
.legal-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 24px; cursor: pointer; user-select: none;
  background: var(--bg-2); border-bottom: 1px solid var(--border);
  font-size: .76rem; color: var(--text-3); line-height: 1.4;
  transition: background .18s ease, color .18s ease;
}
.legal-banner:hover, .legal-banner:focus-visible {
  background: var(--accent-dim); color: var(--text-2); outline: none;
}
.legal-banner-ico {
  flex-shrink: 0; color: var(--accent); display: inline-flex;
}
.legal-banner-text { flex: 1; min-width: 0; }
.legal-banner-text strong { color: var(--text-2); font-weight: 600; margin-right: 4px; }
.legal-banner-cta {
  flex-shrink: 0; font-weight: 600; color: var(--accent);
  text-transform: uppercase; letter-spacing: .08em; font-size: .68rem;
  padding: 4px 10px; border: 1px solid var(--accent); border-radius: 999px;
}
.legal-banner:hover .legal-banner-cta { background: var(--accent); color: #fff; }
@media (max-width: 700px) {
  .legal-banner { padding: 8px 14px; font-size: .72rem; }
  .legal-banner-cta { font-size: .62rem; padding: 3px 8px; }
}

/* === Modal disclaimer === */
.legal-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.legal-modal.open { display: flex; animation: legalFade .18s ease; }
@keyframes legalFade { from { opacity: 0 } to { opacity: 1 } }
.legal-modal-backdrop {
  position: absolute; inset: 0; background: rgba(8, 14, 24, 0.72);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.legal-modal-card {
  position: relative; z-index: 1;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px;
  width: 100%; max-width: 820px; max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: 0 30px 80px rgba(0,0,0,0.4);
  animation: legalRise .22s ease;
}
@keyframes legalRise { from { transform: translateY(20px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }
.legal-modal-close {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  background: transparent; border: 1px solid var(--border); border-radius: 50%;
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-2); cursor: pointer; transition: all .15s ease;
}
.legal-modal-close:hover { background: var(--bg-2); color: var(--accent); border-color: var(--accent); }
.legal-modal-head {
  padding: 28px 32px 18px; border-bottom: 1px solid var(--border);
}
.legal-modal-eyebrow {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--accent); margin: 0 0 6px; font-weight: 600;
}
.legal-modal-head h2 {
  font-family: 'Fraunces', Georgia, serif; font-size: 1.4rem; line-height: 1.25;
  color: var(--text-1); margin: 0; font-weight: 500; padding-right: 40px;
}
.legal-modal-body {
  padding: 22px 32px; overflow-y: auto; flex: 1;
  font-size: .85rem; line-height: 1.65; color: var(--text-2);
}
.legal-modal-body p { margin: 0 0 12px; }
.legal-modal-body ul { margin: 8px 0 14px; padding-left: 22px; }
.legal-modal-body li { margin: 4px 0; }
.legal-modal-body strong { color: var(--text-1); font-weight: 600; }
.legal-modal-cta {
  margin-top: 18px !important; padding: 14px 16px;
  background: var(--accent-dim); border-left: 3px solid var(--accent);
  color: var(--text-1); font-style: italic; border-radius: 6px;
}
.legal-modal-foot {
  padding: 16px 32px 22px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end;
}
@media (max-width: 700px) {
  .legal-modal { padding: 0; }
  .legal-modal-card { max-height: 100vh; border-radius: 0; max-width: 100%; }
  .legal-modal-head { padding: 22px 20px 14px; }
  .legal-modal-head h2 { font-size: 1.15rem; }
  .legal-modal-body { padding: 18px 20px; font-size: .82rem; }
  .legal-modal-foot { padding: 14px 20px 18px; }
}
.footer-copy { font-size: .68rem; color: var(--text-3); margin-top: 12px; }
.footer-portails { margin: 24px 0 20px; }
.footer-portails-label { font-size: .65rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-3); margin-bottom: 10px; }
.footer-portails-links { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.footer-portal-card {
  display: flex; flex-direction: column; align-items: flex-start;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 12px 16px; max-width: 260px;
  text-decoration: none; transition: border-color .2s;
}
.footer-portal-card:hover { border-color: var(--accent); }
.fpc-name { font-size: .8rem; font-weight: 600; color: var(--accent); margin-bottom: 4px; transition: color var(--theme-td) ease; }
.fpc-desc { font-size: .7rem; color: var(--text-3); line-height: 1.4; text-align: left; }

/* ════════════════════════════════
   LEAFLET
   ════════════════════════════════ */
.leaflet-container { background: var(--bg-2) !important; }
.leaflet-popup-content-wrapper {
  background: var(--bg-card) !important; color: var(--text) !important;
  border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 4px 20px rgba(28,40,60,0.12);
}
.leaflet-popup-tip { background: var(--bg-card) !important; }
.leaflet-popup-content { font-family: var(--sans); font-size: .85rem; }
.leaflet-popup-content strong { color: var(--accent); }
.leaflet-tile-pane { filter: saturate(0.92); }

/* ════════════════════════════════
   LOADING
   ════════════════════════════════ */
@keyframes pulse-opacity { 0%, 100% { opacity: .4; } 50% { opacity: 1; } }
.loading-pulse { animation: pulse-opacity 1.4s ease-in-out infinite; }

/* ════════════════════════════════
   MOBILE BOTTOM NAV
   ════════════════════════════════ */
.mobile-nav   { display: none; }
.mobile-sheet { display: none; }

@media (max-width: 768px) {
  .tab-nav { display: none; }
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }

  .mobile-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0;
    height: calc(64px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(244,239,228,0.97);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border); z-index: 200;
  }
  .mnav-btn {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 4px;
    border: none; background: none; color: var(--text-3);
    font-family: var(--sans); font-size: .52rem; font-weight: 500;
    text-transform: uppercase; letter-spacing: .06em;
    cursor: pointer; padding: 8px 2px; transition: color .15s;
    -webkit-tap-highlight-color: transparent;
  }
  .mnav-btn svg { width: 22px; height: 22px; flex-shrink: 0; }
  .mnav-btn:active { opacity: .65; }
  .mnav-btn.active { color: var(--accent); }

  .mobile-sheet {
    display: block; position: fixed; inset: 0;
    z-index: 300; pointer-events: none; opacity: 0; transition: opacity .2s;
  }
  .mobile-sheet.open { pointer-events: auto; opacity: 1; }
  .msheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); backdrop-filter: blur(4px); }
  .msheet-panel {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: var(--bg); border-top: 1px solid var(--border);
    border-radius: 18px 18px 0 0;
    padding: 10px 16px calc(72px + env(safe-area-inset-bottom, 0px));
    transform: translateY(100%); transition: transform .3s cubic-bezier(.32,.72,0,1);
  }
  .mobile-sheet.open .msheet-panel { transform: translateY(0); }
  .msheet-handle { width: 36px; height: 4px; background: var(--border-hi); border-radius: 2px; margin: 0 auto 16px; }
  .msheet-title { font-size: .65rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-3); margin-bottom: 12px; text-align: center; }
  .msheet-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
  .msheet-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 6px; padding: 14px 6px 12px;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r);
    color: var(--text-3); font-family: var(--sans); font-size: .65rem; font-weight: 500;
    text-align: center; cursor: pointer; transition: all .15s;
    -webkit-tap-highlight-color: transparent;
  }
  .msheet-btn svg { width: 22px; height: 22px; }
  .msheet-btn.active { color: var(--accent); border-color: var(--border-hi); background: var(--accent-dim); }
  .msheet-btn:active { opacity: .65; }
}

/* ════════════════════════════════
   RESPONSIVE
   ════════════════════════════════ */
@media (max-width: 600px) {
  .site-header { min-height: 380px; padding: 0 16px 36px; }
  .header-kpis { flex-wrap: wrap; max-width: 100%; }
  .kpi { flex: 0 0 50%; border-bottom: 1px solid rgba(255,255,255,0.10); }
  .kpi:last-child { border-right: none; }
  .kpi:nth-child(even) { border-right: none; }
  .panel-inner { padding: 20px 16px; }
  .panel-inner h2 { font-size: 1.3rem; }
  .agency-grid, .programmes-grid, .annonces-grid { grid-template-columns: 1fr; }
  .demo-grid { grid-template-columns: 1fr; }
  .politique-grid, .politique-content { grid-template-columns: 1fr; }
  #marche-map, #quartiers-map, .map-container { height: 300px; }
  .quartiers-layout { grid-template-columns: 1fr; }
  .marche-grid { grid-template-columns: 1fr; }
  .fisc-content { grid-template-columns: 1fr; }
  .event-card { flex-direction: column; gap: 10px; }
  .event-date { flex-direction: row; gap: 8px; width: auto; }
  .data-table th, .data-table td { padding: 6px 10px; }
  .table-scroll { font-size: .75rem; }
  .annonce-links { flex-direction: column; align-items: center; }
  .annonce-platform { padding: 20px 16px; }
}

/* ════════════════════════════════
   THEME PICKER
   ════════════════════════════════ */
.theme-picker { position: fixed; bottom: 24px; right: 20px; z-index: 500; }
.theme-picker-btn {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--accent); color: #fff; border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 0 4px 16px var(--accent-glow);
  transition: background var(--theme-td) ease, transform .2s ease, box-shadow var(--theme-td) ease;
}
.theme-picker-btn:hover { transform: scale(1.08); }
.theme-menu {
  position: absolute; bottom: 52px; right: 0;
  background: var(--bg-card); border: 1px solid var(--border-hi);
  border-radius: 14px; padding: 14px; width: 200px;
  box-shadow: 0 8px 32px rgba(28,40,60,0.14);
  display: none; opacity: 0; transform: translateY(8px);
  transition: opacity .2s, transform .2s;
}
.theme-menu.open { display: block; opacity: 1; transform: translateY(0); }
.theme-menu-title { font-size: .65rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-3); margin-bottom: 10px; }
.theme-options { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.theme-opt {
  padding: 7px 6px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text-2);
  font-family: var(--sans); font-size: .72rem; cursor: pointer;
  transition: all .15s; text-align: center;
}
.theme-opt:hover, .theme-opt.active { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.theme-auto-btn {
  width: 100%; padding: 8px; border: 1px solid var(--border-hi); border-radius: 8px;
  background: var(--accent-dim); color: var(--accent);
  font-family: var(--sans); font-size: .72rem; cursor: pointer; transition: all .15s;
}
.theme-auto-btn.active { background: var(--accent); color: #fff; }
@media (max-width: 768px) { .theme-picker { bottom: 80px; } }

/* ════════════════════════════════════════════════════════════════════════════
   TIME-ADAPTIVE — uniquement accent + overlay header
   Corps/cartes/texte : TOUJOURS clair, ne changent pas selon la periode
   ════════════════════════════════════════════════════════════════════════════ */

/* NUIT 22h-5h */
html.t-nuit {
  --accent:      #7ab4e8;
  --accent-dark: #4a88c4;
  --accent-dim:  rgba(122,180,232,0.10);
  --accent-glow: rgba(122,180,232,0.22);
  --h-ov-top:    rgba(2,6,20,0.78);
  --h-ov-mid:    rgba(2,6,20,0.42);
  --h-ov-bot:    rgba(2,6,20,0.86);
}

/* AUBE 5h-8h */
html.t-aube {
  --accent:      #d488b0;
  --accent-dark: #ae6090;
  --accent-dim:  rgba(212,136,176,0.10);
  --accent-glow: rgba(212,136,176,0.22);
  --h-ov-top:    rgba(20,5,30,0.72);
  --h-ov-mid:    rgba(20,5,30,0.38);
  --h-ov-bot:    rgba(20,5,30,0.80);
}

/* APRES-MIDI 12h-17h */
html.t-apm {
  --accent:      #1a72c4;
  --accent-dark: #0f5aa0;
  --accent-dim:  rgba(26,114,196,0.09);
  --accent-glow: rgba(26,114,196,0.20);
  --h-ov-top:    rgba(4,16,42,0.50);
  --h-ov-mid:    rgba(4,16,42,0.18);
  --h-ov-bot:    rgba(4,16,42,0.62);
}

/* COUCHER 17h-20h */
html.t-coucher {
  --accent:      #e08040;
  --accent-dark: #b85e20;
  --accent-dim:  rgba(224,128,64,0.10);
  --accent-glow: rgba(224,128,64,0.22);
  --h-ov-top:    rgba(24,8,2,0.68);
  --h-ov-mid:    rgba(24,8,2,0.32);
  --h-ov-bot:    rgba(24,8,2,0.78);
}

/* SOIREE 20h-22h */
html.t-soiree {
  --accent:      #c49a3c;
  --accent-dark: #9c7420;
  --accent-dim:  rgba(196,154,60,0.10);
  --accent-glow: rgba(196,154,60,0.22);
  --h-ov-top:    rgba(5,8,18,0.74);
  --h-ov-mid:    rgba(5,8,18,0.38);
  --h-ov-bot:    rgba(5,8,18,0.84);
}
