/* =====================================================================
   Fonciapp – feuille de style
   Mobile d'abord : les règles de base visent le téléphone, les media
   queries (min-width) enrichissent pour tablette et ordinateur.
   ===================================================================== */

/* ---------- 1. Jetons de design (clair / sombre) ---------- */
.viz-root {
  color-scheme: light;
  --page: #f5f5f3;
  --surface-1: #ffffff;
  --surface-2: #f0f0ed;
  --border: #e3e2dd;
  --grid: #ecebe7;
  --text-primary: #141413;
  --text-secondary: #55544f;
  --text-muted: #7a7974;
  --accent: #2a78d6;
  --accent-soft: #e8f1fc;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100; --series-5: #e87ba4;
  --seq-0: #eef4fc; --seq-1: #0d3f7a;
  --good: #006300; --good-bg: #0083001f; --warn: #8a5d00; --warn-bg: #eda1002a; --bad: #b42120; --bad-bg: #e349481f;
  --radius: 12px;
  --radius-s: 8px;
  --shadow: 0 1px 2px #0000000a, 0 2px 8px #00000008;
  --tap: 44px;
  --header-h: 56px;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .viz-root {
    color-scheme: dark;
    --page: #111110; --surface-1: #1b1b1a; --surface-2: #232321; --border: #2f2f2d; --grid: #282826;
    --text-primary: #f0efec; --text-secondary: #c3c2b7; --text-muted: #8f8e88;
    --accent: #3987e5; --accent-soft: #1d2a3a;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181;
    --seq-0: #1f2a38; --seq-1: #8fc0ff;
    --good: #5fd35f; --warn: #f0b545; --bad: #ff8a89;
    --shadow: none;
  }
}
:root[data-theme="dark"] .viz-root {
  color-scheme: dark;
  --page: #111110; --surface-1: #1b1b1a; --surface-2: #232321; --border: #2f2f2d; --grid: #282826;
  --text-primary: #f0efec; --text-secondary: #c3c2b7; --text-muted: #8f8e88;
  --accent: #3987e5; --accent-soft: #1d2a3a;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181;
  --seq-0: #1f2a38; --seq-1: #8fc0ff;
  --good: #5fd35f; --warn: #f0b545; --bad: #ff8a89;
  --shadow: none;
}

/* ---------- 2. Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 52px); }
body { margin: 0; background: #f5f5f3; }
:root[data-theme="dark"] body { background: #111110; }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) body { background: #111110; } }
.viz-root {
  min-height: 100vh; background: var(--page); color: var(--text-primary);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  padding: 0 16px 32px; max-width: 1280px; margin: 0 auto;
}
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 26px; font-weight: 750; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
a { color: var(--accent); text-underline-offset: 2px; }
p { margin: 0 0 10px; }
.sub { color: var(--text-secondary); font-size: 13px; font-weight: 400; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 8px; background: var(--surface-1); padding: 8px 12px; z-index: 30; }
.only-m { display: none; }

/* ---------- 3. Contrôles ---------- */
button, select, input {
  font: inherit; font-size: 16px; /* 16 px : évite le zoom automatique d'iOS */
  color: var(--text-primary); background: var(--surface-1);
  border: 1px solid var(--border); border-radius: var(--radius-s);
  min-height: var(--tap); padding: 8px 12px;
}
select { padding-right: 30px; appearance: none; -webkit-appearance: none; cursor: pointer;
  background: var(--surface-1) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237a7974' stroke-width='1.6' fill='none'/%3E%3C/svg%3E") no-repeat right 11px center; }
button { cursor: pointer; }
button:hover, select:hover, input:hover { border-color: var(--text-muted); }
input:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=number] { -moz-appearance: textfield; }
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; }
button:disabled { opacity: .45; cursor: default; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap);
  font: inherit; font-weight: 550; color: var(--text-primary); background: var(--surface-1);
  border: 1px solid var(--border); border-radius: var(--radius-s); padding: 8px 16px; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--text-muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.big { min-height: 50px; font-size: 16px; }
.icon-btn { width: var(--tap); padding: 0; display: grid; place-items: center; font-size: 17px; }

/* Boutons segmentés (choix exclusif) */
.seg { display: inline-flex; padding: 3px; gap: 3px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; max-width: 100%; }
.seg button { flex: 1; border: 0; background: transparent; min-height: 38px; padding: 6px 14px; border-radius: 7px;
  color: var(--text-secondary); font-size: 14.5px; font-weight: 550; white-space: nowrap; }
.seg button.on { background: var(--surface-1); color: var(--text-primary); box-shadow: 0 1px 3px #0000001f; }
.seg.full { display: flex; }

/* Bascules dans les cartes (période, tableau) */
.toggle { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: 9px; }
.toggle button { border: 0; background: transparent; min-height: 34px; padding: 4px 11px; border-radius: 6px;
  font-size: 13.5px; color: var(--text-secondary); font-weight: 550; }
.toggle button.on { background: var(--surface-1); color: var(--text-primary); box-shadow: 0 1px 3px #0000001f; }

/* Champ avec unité */
.unit { position: relative; display: block; }
.unit input { width: 100%; padding-right: 40px; }
.unit i { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-style: normal;
  color: var(--text-muted); pointer-events: none; font-size: 14px; }

/* Autocomplétion */
.ac { position: relative; }
.ac input { width: 100%; }
.ac-list { position: absolute; z-index: 1000; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px;
  list-style: none; background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 28px #0000002a; max-height: 60vh; overflow-y: auto; }
.ac-list li { padding: 10px 12px; cursor: pointer; color: var(--text-primary); border-radius: 7px; font-size: 15px; }
.ac-list li .sub { display: block; font-size: 12.5px; margin-top: 1px; }
.ac-list li:hover, .ac-list li.on { background: var(--surface-2); }

/* Cartes */
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
  margin: 0; box-shadow: var(--shadow); }
figcaption { margin-bottom: 12px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; align-items: flex-start; }
figcaption > p { flex-basis: 100%; margin: 0; }

/* Badges / étiquettes */
.badge { display: inline-flex; align-items: center; gap: 5px; width: fit-content; padding: 2px 10px; border-radius: 999px;
  font-size: 14px !important; font-weight: 600; }
.badge.good { background: var(--good-bg); color: var(--good); } .badge.good::before { content: "●"; }
.badge.warn { background: var(--warn-bg); color: var(--warn); } .badge.warn::before { content: "◐"; }
.badge.bad { background: var(--bad-bg); color: var(--bad); } .badge.bad::before { content: "○"; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 5px; font-size: 11.5px; font-weight: 600;
  background: var(--series-2); color: #fff; vertical-align: 1px; white-space: nowrap; }
.up::before { content: "▲ "; font-size: 9px; }
.down::before { content: "▼ "; font-size: 9px; }

/* ---------- 4. En-tête et pied de page ---------- */
.site-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px;
  height: var(--header-h); margin: 0 -16px 16px; padding: 0 12px 0 16px;
  background: var(--page); border-bottom: 1px solid var(--border); }
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .site-header { background: color-mix(in srgb, var(--page) 86%, transparent);
    backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); }
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text-primary);
  font-weight: 750; font-size: 17px; margin-right: auto; white-space: nowrap; }
.menu-btn { order: 3; width: var(--tap); padding: 0; display: grid; place-content: center; gap: 4px; border-color: transparent; background: transparent; }
.menu-btn span { display: block; width: 20px; height: 2px; border-radius: 2px; background: var(--text-primary); transition: transform .2s, opacity .2s; }
.menu-open .menu-btn span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-open .menu-btn span:nth-child(2) { opacity: 0; }
.menu-open .menu-btn span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
#theme { order: 2; border-color: transparent; background: transparent; }
.site-nav { display: none; position: absolute; top: var(--header-h); left: 0; right: 0; flex-direction: column;
  background: var(--surface-1); border-bottom: 1px solid var(--border); box-shadow: 0 12px 24px #0000001f; padding: 6px 8px 10px; }
.menu-open .site-nav { display: flex; }
.site-nav a { display: flex; align-items: center; min-height: 48px; padding: 0 12px; border-radius: 8px; font-size: 16px;
  color: var(--text-primary); text-decoration: none; font-weight: 500; }
.site-nav a.on { color: var(--accent); background: var(--accent-soft); }

main { min-height: 60vh; }
.site-footer { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border); color: var(--text-secondary); font-size: 14px; }
.footer-cols { display: grid; gap: 22px; }
.footer-cols > div { display: flex; flex-direction: column; gap: 2px; }
.footer-cols b { color: var(--text-primary); margin-bottom: 4px; }
.footer-cols p { margin: 0 0 6px; }
.footer-cols a { color: var(--text-secondary); text-decoration: none; padding: 6px 0; }
.footer-cols a:hover { color: var(--accent); }
.credits { margin-top: 20px; font-size: 12.5px; }

/* ---------- 5. Mise en page commune ---------- */
.page-head { margin-bottom: 16px; }
.lead { font-size: 16px; color: var(--text-secondary); max-width: 820px; margin: 8px 0 0; line-height: 1.55; }
.cta-line { margin: 14px 0 0; }
.cta-line .btn { width: 100%; }
.crumbs { display: flex; flex-wrap: wrap; list-style: none; margin: 0 0 10px; padding: 0; font-size: 13.5px; color: var(--text-secondary); }
.crumbs li + li::before { content: "›"; margin: 0 7px; color: var(--text-muted); }
.crumbs a { text-decoration: none; display: inline-block; padding: 4px 0; }
.scope { margin-bottom: 14px; }
.scope-search input, .hero-search input { padding-left: 40px;
  background: var(--surface-1) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='17' height='17' viewBox='0 0 24 24' fill='none' stroke='%237a7974' stroke-width='2.2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") no-repeat 13px center; }

/* Barre de sections (page de prix) */
.section-nav { position: sticky; top: var(--header-h); z-index: 15; display: flex; gap: 6px; overflow-x: auto;
  margin: 0 -16px 14px; padding: 8px 16px; background: var(--page); scrollbar-width: none; border-bottom: 1px solid var(--border); }
.section-nav::-webkit-scrollbar { display: none; }
.section-nav a { flex: none; padding: 6px 13px; border-radius: 999px; font-size: 13.5px; font-weight: 550; text-decoration: none;
  color: var(--text-secondary); border: 1px solid var(--border); background: var(--surface-1); }
.section-nav a.on { color: #fff; background: var(--accent); border-color: var(--accent); }

/* Filtres */
.filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.filters .seg { display: flex; }
.filters-more { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.filters label { display: flex; flex-direction: column; font-size: 12px; color: var(--text-secondary); gap: 3px; font-weight: 500; }
.filters select { width: 100%; font-size: 15px; padding-left: 10px; }

/* Indicateurs clés */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.kpi { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 11px 12px; box-shadow: var(--shadow); }
.kpi .l { font-size: 12px; color: var(--text-secondary); line-height: 1.3; }
.kpi .v { font-size: 21px; font-weight: 750; margin-top: 3px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.kpi .d { font-size: 12px; color: var(--text-muted); line-height: 1.35; }

/* Graphiques */
.grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-bottom: 12px; }
.chart { position: relative; height: 220px; }
.season { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.insight { margin: 14px 0 0; padding: 12px 14px; border-left: 3px solid var(--accent); background: var(--surface-2);
  border-radius: 0 8px 8px 0; font-size: 14.5px; line-height: 1.55; }

/* Tableaux */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 9px 8px; text-align: left; border-bottom: 1px solid var(--grid); white-space: nowrap; }
th { font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.num { text-align: right; }
.tx th[data-k] { cursor: pointer; user-select: none; }
.tx th.sorted::after { content: " ▾"; }
.tx th.sorted.asc::after { content: " ▴"; }
.tx tbody tr:hover { background: var(--surface-2); }
.tx-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-bottom: 12px; align-items: center; }
.tx-tools { display: grid; grid-template-columns: 1fr auto; gap: 8px; width: 100%; }
.tx-tools input { grid-column: 1 / -1; }
.pager { display: flex; gap: 10px; justify-content: space-between; align-items: center; margin-top: 12px; color: var(--text-secondary); font-size: 14px; }
.tx-gate { padding: 14px; background: var(--surface-2); border-radius: 10px; display: flex; flex-direction: column; gap: 12px; }
.tx-gate p { margin: 0; color: var(--text-secondary); font-size: 14px; }
.wbar { display: inline-block; height: 8px; border-radius: 4px; background: var(--accent); vertical-align: middle; }

/* Heatmap année × mois : première colonne figée */
.heatmap td, .heatmap th { text-align: center; padding: 7px 6px; }
.heatmap td { border: 2px solid var(--surface-1); border-radius: 4px; font-size: 13px; }
.heatmap tbody th, .heatmap thead th:first-child { position: sticky; left: 0; background: var(--surface-1); z-index: 1; text-align: left; padding-left: 0; }
.heatmap td.avg, .heatmap th.avg { font-weight: 700; }
.scroll-hint { margin: 8px 0 0; }

/* Comparatif des sous-zones */
.table-wrap.scroll { max-height: 480px; overflow-y: auto; }
.table-wrap.scroll thead th { position: sticky; top: 0; background: var(--surface-1); z-index: 1; }
#enfants a { text-decoration: none; color: var(--text-primary); font-weight: 500; }
#enfants tr { cursor: pointer; }
#enfants tr:hover a { color: var(--accent); }
#enfants-q { width: 100%; }

/* Tableaux en fiches sur téléphone (.tx.cards) */
@media (max-width: 759px) {
  .only-m { display: inline; }
  .tx.cards thead { display: none; }
  .tx.cards, .tx.cards tbody { display: block; }
  .tx.cards tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 2px;
    padding: 12px 2px; border-bottom: 1px solid var(--grid); }
  .tx.cards td { display: none; padding: 0; border: 0; white-space: normal; text-align: left; font-size: 13.5px; }
  .tx.cards .c-adr { display: block; grid-column: 1; grid-row: 1; font-weight: 600; font-size: 14.5px; }
  .tx.cards .c-date { display: block; grid-column: 2; grid-row: 1; text-align: right; color: var(--text-secondary); font-size: 13px; }
  .tx.cards .c-v { display: block; grid-column: 2; grid-row: 2; text-align: right; font-weight: 700; font-size: 15px; }
  .tx.cards .c-m2 { display: block; grid-column: 2; grid-row: 3; text-align: right; color: var(--text-secondary); }
  .tx.cards .c-desc { display: block; grid-column: 1; grid-row: 2; color: var(--text-secondary); }
  .tx.cards .c-loc { display: block; grid-column: 1; grid-row: 3; color: var(--text-secondary); }
  .tx.cards .c-adj { display: block; grid-column: 1 / -1; grid-row: 4; text-align: right; color: var(--text-muted); font-size: 12.5px; }
  /* Comparatif : colonnes essentielles */
  #enfants th:nth-child(3), #enfants td:nth-child(3) { display: none; }
  #enfants td, #enfants th { padding: 10px 6px; font-size: 13.5px; }
  #enfants td:first-child { white-space: normal; }
}
@media (min-width: 760px) { .c-desc, .c-loc { display: none; } }

/* ---------- 6. Accueil ---------- */
.home-hero { padding: 20px 0 18px; }
.home-hero h1 { font-size: clamp(28px, 7vw, 46px); line-height: 1.12; letter-spacing: -0.025em; max-width: 880px; }
.hero-sub { font-size: 16px; color: var(--text-secondary); max-width: 680px; margin: 12px 0 18px; line-height: 1.55; }
.hero-search input { min-height: 52px; border-radius: 12px; box-shadow: var(--shadow); padding-left: 42px; background-position: 14px center; }
.hero-cta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.hero-cta .btn { padding: 8px 10px; font-size: 14.5px; }
.home-kpis { margin: 6px 0 20px; }
.features { display: grid; gap: 12px; margin-bottom: 16px; }
.features h2 { font-size: 16px; margin-bottom: 6px; }
.features p { color: var(--text-secondary); margin: 0 0 10px; }
.features a { font-weight: 600; text-decoration: none; }
.steps { margin: 26px 0; }
.steps h2 { font-size: 18px; margin-bottom: 14px; }
.steps ol { list-style: none; counter-reset: s; display: grid; gap: 14px; padding: 0; margin: 0; }
.steps li { counter-increment: s; display: flex; flex-direction: column; gap: 2px; padding-left: 44px; position: relative; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 750; }
.steps li span { color: var(--text-secondary); }
.city-links { list-style: none; padding: 0; margin: 10px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.city-links a { display: block; padding: 7px 0; text-decoration: none; }
.city-links a:hover { text-decoration: underline; }

/* ---------- 7. Pages de texte ---------- */
.prose { line-height: 1.68; font-size: 16px; }
.prose h2 { font-size: 20px; margin: 30px 0 10px; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin-bottom: 7px; }
.page { max-width: 760px; margin: 0 auto; }
.page h1 { font-size: 28px; margin-bottom: 4px; }
.card.prose h2:first-child { margin-top: 0; }
.notes { margin-top: 14px; font-size: 14.5px; }
.notes p, .notes li { color: var(--text-secondary); }
.toc { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px; background: var(--surface-1);
  border: 1px solid var(--border); border-radius: var(--radius); margin: 18px 0; font-size: 14px; }
.toc a { padding: 5px 10px; border-radius: 999px; background: var(--surface-2); text-decoration: none; }
.facts-box { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 18px 0; }
.facts-box > div { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px;
  display: flex; flex-direction: column; }
.facts-box b { font-size: 16px; }
.faq details { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; }
.faq summary { cursor: pointer; font-weight: 600; padding: 14px 44px 14px 16px; list-style: none; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 22px; color: var(--text-muted); font-weight: 400; }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 0; padding: 0 16px 14px; }

/* ---------- 8. Simulateur ---------- */
.sim { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin-bottom: 14px; align-items: start; }
.sim-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.sim-form h2 { grid-column: 1 / -1; }
.sim-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.sim-form .full { grid-column: 1 / -1; }
.sim-form input, .sim-form select { width: 100%; }
.sim-form .sub { font-size: 12.5px; line-height: 1.4; }
.sim-form .sub:empty { display: none; }
.more { border: 1px solid var(--border); border-radius: 10px; }
.more summary { cursor: pointer; padding: 12px 34px 12px 14px; font-weight: 600; font-size: 14.5px; list-style: none; position: relative; }
.more summary::-webkit-details-marker { display: none; }
.more summary::after { content: "▾"; position: absolute; right: 14px; color: var(--text-muted); }
.more[open] summary::after { content: "▴"; }
.more-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 0 14px 14px; }
.sim-result { display: grid; gap: 14px; min-width: 0; }
#result { scroll-margin-top: calc(var(--header-h) + 10px); }
.estimate .l { color: var(--text-secondary); font-size: 13px; }
.estimate .hero { font-size: 38px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; margin: 6px 0 4px; letter-spacing: -0.02em; }
.estimate .range { font-size: 15.5px; margin-bottom: 4px; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--grid); }
.facts > div { display: flex; flex-direction: column; gap: 2px; }
.facts > div:last-child { grid-column: 1 / -1; }
.facts b { font-size: 18px; }
.immeuble { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--grid); }
.immeuble h3 { color: var(--text-primary); font-size: 14px; }
.imm-list { list-style: none; margin: 8px 0 0; padding: 0; }
.imm-list li { display: flex; flex-direction: column; gap: 1px; padding: 9px 0; border-bottom: 1px solid var(--grid); font-size: 14px; }
.imm-list li:last-child { border-bottom: 0; }
.imm-b { color: var(--text-secondary); }
.imm-b b { color: var(--text-primary); }
#map { height: 300px; border-radius: 10px; margin-top: 10px; z-index: 0; }

/* ---------- 9. Publicité (désactivée tant que non configurée) ---------- */
.ad-slot { display: none; }
body.ads-on .ad-slot { display: block; min-height: 120px; margin: 16px 0; }

/* ---------- 10. États ---------- */
body.loading .grid, body.loading #kpis { opacity: .55; transition: opacity .2s; }
body.loading .viz-root { cursor: progress; }

/* =====================================================================
   Tablette et plus
   ===================================================================== */
@media (min-width: 760px) {
  .viz-root { padding: 0 24px 40px; }
  .site-header { margin: 0 -24px 22px; padding: 0 20px 0 24px; }
  .section-nav { margin: 0 -24px 16px; padding: 10px 24px; }
  .scroll-hint { display: none; }
  h1 { font-size: 30px; }
  .card { padding: 18px 20px; }
  button, select, input { font-size: 15px; min-height: 40px; }
  .seg button { min-height: 34px; }
  .filters { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
  .filters .seg { display: inline-flex; }
  .filters-more { display: flex; gap: 12px; }
  .filters select { width: auto; min-width: 140px; }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
  .kpi { padding: 14px 16px; }
  .kpi .v { font-size: 24px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
  .card.wide { grid-column: 1 / -1; }
  .chart { height: 260px; }
  .season { grid-template-columns: 1fr 1fr; gap: 24px; }
  .tx-tools { display: flex; width: auto; }
  .tx-tools input { width: 240px; }
  .pager { justify-content: center; }
  .tx-gate { flex-direction: row; align-items: center; }
  .tx-gate p { flex: 1; }
  #enfants-q { width: 220px; }
  .cta-line .btn { width: auto; }
  .home-hero { padding: 48px 0 32px; text-align: center; }
  .home-hero h1, .hero-sub { margin-left: auto; margin-right: auto; }
  .hero-search { max-width: 620px; margin: 0 auto; text-align: left; }
  .hero-cta { display: flex; justify-content: center; }
  .hero-cta .btn { padding: 8px 18px; font-size: 15px; }
  .features { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .steps ol { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .city-links { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  .facts-box { grid-template-columns: repeat(4, 1fr); }
  .footer-cols { grid-template-columns: 2fr 1fr 1fr; gap: 28px; }
  .scope { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
  .crumbs { margin: 0; }
  .scope-search { flex: 0 1 420px; }
  .facts { grid-template-columns: repeat(3, 1fr); }
  .facts > div:last-child { grid-column: auto; }
  .estimate .hero { font-size: 46px; }
  .imm-list li { flex-direction: row; justify-content: space-between; gap: 12px; }
  #map { height: 360px; }
  .page h1 { font-size: 34px; }
}

@media (min-width: 1000px) {
  /* Menu en ligne */
  .menu-btn { display: none; }
  .site-nav { display: flex; position: static; flex-direction: row; background: none; border: 0; box-shadow: none;
    padding: 0; gap: 2px; margin-right: auto; margin-left: 16px; }
  .brand { margin-right: 0; }
  .site-nav a { min-height: 36px; font-size: 14.5px; color: var(--text-secondary); padding: 0 11px; }
  .site-nav a:hover { color: var(--text-primary); background: var(--surface-2); }
  .site-nav a.on { color: var(--text-primary); background: var(--surface-1); box-shadow: inset 0 -2px 0 var(--accent); }
  .sim { grid-template-columns: 380px minmax(0, 1fr); gap: 18px; }
  .sim-form { position: sticky; top: calc(var(--header-h) + 14px); max-height: calc(100vh - var(--header-h) - 28px); overflow-y: auto; }
}

/* Finitions */
.full-w { width: 100%; margin-top: 12px; }
@media (max-width: 759px) {
  .kpis .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* =====================================================================
   11. Couleur – palette de marque
   Bleu = action, marine = marque ; vert, orange, violet, ambre = repères
   (indicateurs, rubriques). Les graphiques gardent leurs propres règles.
   ===================================================================== */
.viz-root {
  --brand: #0b2a55;
  --brand-2: #1d5fb8;
  --c-blue: #2a78d6;   --c-blue-soft: #e7f0fc;
  --c-teal: #11956f;   --c-teal-soft: #e0f4ec;
  --c-orange: #e0602a; --c-orange-soft: #fdebe2;
  --c-violet: #5b49d0; --c-violet-soft: #ebe8fb;
  --c-amber: #c98500;  --c-amber-soft: #fbf1d9;
  --hero-grad: linear-gradient(135deg, #0b2a55 0%, #1d5fb8 55%, #1a9c8a 100%);
  --head-grad: linear-gradient(120deg, #e7f0fc 0%, #eef7f3 60%, #f7f1ea 100%);
  --page: #f4f6fa;
}
:root[data-theme="dark"] .viz-root {
  --brand: #0a1f3f; --brand-2: #1b4f99;
  --c-blue: #5a9cf0;   --c-blue-soft: #16263c;
  --c-teal: #3cc49a;   --c-teal-soft: #11291f;
  --c-orange: #f0864f; --c-orange-soft: #2e1b12;
  --c-violet: #988bf0; --c-violet-soft: #1f1b38;
  --c-amber: #e7b23f;  --c-amber-soft: #2b220d;
  --hero-grad: linear-gradient(135deg, #0a1f3f 0%, #17457f 55%, #136f63 100%);
  --head-grad: linear-gradient(120deg, #16263c 0%, #142a24 60%, #2a2016 100%);
  --page: #0f1115;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .viz-root {
    --brand: #0a1f3f; --brand-2: #1b4f99;
    --c-blue: #5a9cf0;   --c-blue-soft: #16263c;
    --c-teal: #3cc49a;   --c-teal-soft: #11291f;
    --c-orange: #f0864f; --c-orange-soft: #2e1b12;
    --c-violet: #988bf0; --c-violet-soft: #1f1b38;
    --c-amber: #e7b23f;  --c-amber-soft: #2b220d;
    --hero-grad: linear-gradient(135deg, #0a1f3f 0%, #17457f 55%, #136f63 100%);
    --head-grad: linear-gradient(120deg, #16263c 0%, #142a24 60%, #2a2016 100%);
    --page: #0f1115;
  }
}
body { background: #f4f6fa; }
:root[data-theme="dark"] body { background: #0f1115; }

/* En-tête : logo en dégradé, lien actif coloré */
.brand svg rect { fill: url(#g-brand); }
.brand { color: var(--brand); }
:root[data-theme="dark"] .brand { color: var(--text-primary); }
.brand span { background: var(--hero-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
:root[data-theme="dark"] .brand span { background: linear-gradient(90deg, #8fc0ff, #5fd3b5); -webkit-background-clip: text; background-clip: text; }

/* Boutons principaux */
.btn.primary { background: linear-gradient(135deg, var(--brand-2), var(--c-blue)); border-color: transparent;
  box-shadow: 0 2px 8px #1d5fb83d; }
.btn.primary:hover { filter: brightness(1.08); }

/* ---------- Accueil : bandeau coloré ---------- */
.home-hero { background: var(--hero-grad); color: #fff; border-radius: 20px; padding: 28px 18px 24px;
  margin-top: 2px; position: relative; overflow: visible; box-shadow: 0 10px 30px #0b2a5530; }
.home-hero::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(circle at 85% 15%, #ffffff26 0, transparent 40%), radial-gradient(circle at 10% 90%, #1baf7a40 0, transparent 45%); }
.home-hero > * { position: relative; }
.home-hero h1 { color: #fff; }
.home-hero .hero-sub { color: #dbe8fb; }
.home-hero .hero-search input { border-color: transparent; box-shadow: 0 6px 20px #00000033; color: #141413; background-color: #fff; }
.home-hero .btn.primary { background: #fff; color: var(--brand); box-shadow: 0 4px 14px #00000026; }
.home-hero .btn:not(.primary) { background: #ffffff1f; color: #fff; border-color: #ffffff55; }
.home-hero .btn:not(.primary):hover { background: #ffffff33; }
.home-hero .ac-list li { color: var(--text-primary); }
.home-kpis { margin-top: 18px; }

/* Indicateurs : une couleur par carte */
.kpi { position: relative; overflow: hidden; border-top: 3px solid var(--k, var(--c-blue)); }
.kpis .kpi:nth-child(5n+1) { --k: var(--c-blue); }
.kpis .kpi:nth-child(5n+2) { --k: var(--c-orange); }
.kpis .kpi:nth-child(5n+3) { --k: var(--c-teal); }
.kpis .kpi:nth-child(5n+4) { --k: var(--c-violet); }
.kpis .kpi:nth-child(5n+5) { --k: var(--c-amber); }
.kpi .v { color: var(--k); }
:root[data-theme="dark"] .kpi .v { color: var(--k); }

/* Cartes de rubriques avec pastille d'icône */
.f-ico { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; margin-bottom: 12px;
  color: var(--fc); background: var(--fs); }
.features .card { border-top: 3px solid var(--fc); }
.features .card:nth-child(1) { --fc: var(--c-blue); --fs: var(--c-blue-soft); }
.features .card:nth-child(2) { --fc: var(--c-orange); --fs: var(--c-orange-soft); }
.features .card:nth-child(3) { --fc: var(--c-teal); --fs: var(--c-teal-soft); }
.features a { color: var(--fc); }
.sources-teaser { background: linear-gradient(135deg, var(--c-violet-soft), var(--surface-1) 70%); border-color: transparent; }
.sources-teaser h2 { color: var(--c-violet); }

/* Étapes numérotées en couleur */
.steps li:nth-child(1)::before { background: var(--c-blue); color: #fff; }
.steps li:nth-child(2)::before { background: var(--c-orange); color: #fff; }
.steps li:nth-child(3)::before { background: var(--c-teal); color: #fff; }

/* Liens vers les villes en pastilles */
.city-links { gap: 8px; }
.city-links a { padding: 7px 12px; border-radius: 999px; background: var(--c-blue-soft); color: var(--c-blue);
  font-weight: 550; font-size: 14px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.city-links a:hover { background: var(--c-blue); color: #fff; text-decoration: none; }
.city-links + h2 + .city-links a { background: var(--c-teal-soft); color: var(--c-teal); }
.city-links + h2 + .city-links a:hover { background: var(--c-teal); color: #fff; }

/* ---------- En-têtes de pages : bandeau léger ---------- */
.page-head, .page > h1:first-child { position: relative; }
.page-head { background: var(--head-grad); border-radius: 16px; padding: 18px 16px; border: 1px solid var(--border); }
.page-head h1 { color: var(--brand); }
:root[data-theme="dark"] .page-head h1 { color: var(--text-primary); }
.scope + .section-nav + .page-head, .scope ~ .page-head { margin-top: 0; }
.page h1 { background: var(--hero-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
:root[data-theme="dark"] .page h1 { background: linear-gradient(90deg, #8fc0ff, #5fd3b5); -webkit-background-clip: text; background-clip: text; }
.toc a { background: var(--c-blue-soft); color: var(--c-blue); font-weight: 550; }
.toc a:hover { background: var(--c-blue); color: #fff; }
.prose h2 { padding-left: 12px; border-left: 4px solid var(--c-blue); }
.card.prose h2 { padding-left: 0; border-left: 0; }
.facts-box > div:nth-child(1) { border-top: 3px solid var(--c-blue); }
.facts-box > div:nth-child(2) { border-top: 3px solid var(--c-orange); }
.facts-box > div:nth-child(3) { border-top: 3px solid var(--c-teal); }
.facts-box > div:nth-child(4) { border-top: 3px solid var(--c-violet); }
.faq details[open] { border-color: var(--c-blue); box-shadow: 0 0 0 3px var(--c-blue-soft); }
.faq summary::after { color: var(--c-blue); }

/* ---------- Page de prix ---------- */
.card > figcaption h2::before, .tx-head h2::before { content: ""; display: inline-block; width: 4px; height: 16px;
  border-radius: 2px; background: var(--c-blue); margin-right: 9px; vertical-align: -2px; }
#saisonnalite figcaption h2::before { background: var(--c-orange); }
#detail figcaption h2::before { background: var(--c-violet); }
#comparatif figcaption h2::before { background: var(--c-teal); }
#ventes .tx-head h2::before, #comparables h2::before { background: var(--c-amber); }
.insight { background: linear-gradient(135deg, var(--c-blue-soft), var(--c-teal-soft)); border-left-color: var(--c-blue); }
.section-nav a:hover { border-color: var(--c-blue); color: var(--c-blue); }
.seg button.on { color: var(--c-blue); }
.toggle button.on { color: var(--c-blue); }
.tx-gate { background: linear-gradient(135deg, var(--c-amber-soft), var(--surface-2)); }
.cta-line .btn.primary { background: linear-gradient(135deg, var(--c-orange), #f08a3a); box-shadow: 0 2px 10px #e0602a40; }
.up { color: var(--c-teal); }
.down { color: var(--c-orange); }

/* ---------- Simulateur : résultat mis en valeur ---------- */
#result:has(.estimate) { padding: 0; overflow: hidden; }
#result .estimate { background: var(--hero-grad); color: #fff; padding: 18px 16px 18px; }
#result .estimate .l { color: #cfe0f8; }
#result .estimate .range { color: #fff; }
#result .estimate .sub { color: #d6e5f9; }
#result .facts, #result .immeuble { margin-left: 16px; margin-right: 16px; }
#result .immeuble { margin-bottom: 16px; }
#result .facts { border-top: 0; }
#result .facts > div { padding: 10px 12px; border-radius: 10px; background: var(--c-blue-soft); }
#result .facts > div:nth-child(2) { background: var(--c-teal-soft); }
#result .facts > div:nth-child(3) { background: var(--c-violet-soft); }
.sim-form h2 { color: var(--brand); }
:root[data-theme="dark"] .sim-form h2 { color: var(--text-primary); }
.sim-form { border-top: 3px solid var(--c-blue); }
.more summary { color: var(--c-blue); }
.tag { background: var(--c-orange); }

/* ---------- Pied de page marine ---------- */
.site-footer { background: var(--brand); color: #c4d3ea; border-top: 0; border-radius: 20px 20px 0 0;
  margin-left: -16px; margin-right: -16px; padding: 28px 20px 24px; margin-bottom: -32px; }
.site-footer b { color: #fff; }
.site-footer .sub { color: #9fb4d4; }
.footer-cols a { color: #c4d3ea; }
.footer-cols a:hover { color: #fff; }
.credits { color: #9fb4d4; border-top: 1px solid #ffffff1f; padding-top: 14px; }
@media (min-width: 760px) {
  .home-hero { padding: 52px 32px 40px; border-radius: 24px; }
  .page-head { padding: 24px 26px; }
  .site-footer { margin-left: -24px; margin-right: -24px; padding: 34px 32px 28px; margin-bottom: -40px; }
  #result .estimate { padding: 22px 22px 20px; }
  #result .facts, #result .immeuble { margin-left: 22px; margin-right: 22px; }
}
.btn { text-align: center; line-height: 1.25; }

/* Repères et liens rendus côté serveur (pages de marché) */
.reperes, .zone-links { margin-bottom: 12px; }
.reperes h2, .zone-links h2 { font-size: 18px; margin: 0 0 8px; }
.reperes h2 + p, .reperes .table-wrap + p { margin-top: 6px; }
.reperes h2:not(:first-child), .zone-links h2:not(:first-child) { margin-top: 18px; }
.recap th, .recap td { text-align: right; white-space: nowrap; }
.recap th:first-child { text-align: left; }
.zone-links li { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; border-bottom: 1px solid var(--border); }
.zone-links li a { padding: 7px 0; }
.zone-links details summary { cursor: pointer; font-weight: 600; margin-top: 14px; }
@media (min-width: 760px) { .zone-links .city-links { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* Bandeau de consentement (mesure d'audience) */
.consentement { position: fixed; z-index: 1000; left: 12px; right: 12px; bottom: 12px; max-width: 640px; margin: 0 auto;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 14px 16px; background: var(--surface-1);
  color: var(--text-primary); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 4px 24px #0000002e; }
.consentement p { flex: 1 1 280px; margin: 0; font-size: 14px; }
.consentement .actions { display: flex; gap: 8px; margin-left: auto; }
.site-footer a[hidden] { display: none; }
