/* ==========================================================================
   Diagnostic Risques — design system (écran + impression A4)
   Palette : vert profond (confiance/territoire), niveaux d'aléa normalisés
   ========================================================================== */
:root {
    --green: #2F80ED;
    --green-dark: #0F2A44;
    --green-soft: #ebf3fd;
    --bg: #F8FAFC;
    --card: #ffffff;
    --ink: #0F2A44;
    --muted: #64748B;
    --line: rgba(15,42,68,.10);
    --faible: #10b981;   --faible-bg: #ecfdf5;
    --moyen:  #f59e0b;   --moyen-bg:  #fffbeb;
    --fort:   #ef4444;   --fort-bg:   #fef2f2;
    --neant:  #2F80ED;   --neant-bg:  #eff6ff;
    --indispo:#94a3b8;   --indispo-bg:#f1f5f9;
    --radius: 16px;
    --shadow: 0 1px 2px rgba(15, 42, 68, .05), 0 6px 24px rgba(15, 42, 68, .07);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    font-size: 15px;
    line-height: 1.62;
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: clamp(26px, 4vw, 40px); font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: 14.5px; font-weight: 700; color: var(--green-dark); text-transform: uppercase; letter-spacing: .04em; margin: 18px 0 6px; }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------------------------------------------------------------- boutons */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    border: 0; border-radius: 999px; cursor: pointer;
    padding: 11px 22px; font: inherit; font-weight: 600;
    transition: transform .06s ease, box-shadow .15s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--green); color: #fff; box-shadow: 0 6px 16px rgba(0,122,83,.25); }
.btn-primary:hover { background: var(--green-dark); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--green-dark); border: 1px solid var(--line); }
.btn-ghost:hover { background: #fff; }

/* ---------------------------------------------------------------- marque */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; color: var(--green-dark); font-size: 17px; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark {
    width: 26px; height: 26px; border-radius: 8px;
    background:
        radial-gradient(circle at 30% 65%, #fff 0 3px, transparent 3.5px),
        linear-gradient(135deg, var(--green) 0%, #02996a 100%);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.25), 0 2px 6px rgba(0,122,83,.35);
}

/* ---------------------------------------------------------------- accueil */
.hero {
    min-height: 92vh; display: grid; place-items: center; padding: 48px 20px;
    background:
        radial-gradient(1200px 500px at 85% -10%, rgba(2,153,106,.18), transparent 60%),
        radial-gradient(900px 420px at -10% 110%, rgba(0,122,83,.12), transparent 55%),
        linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
}
.hero-inner { max-width: 880px; text-align: center; }
.hero h1 { margin: 26px 0 12px; }
.lead { color: var(--muted); font-size: 16.5px; max-width: 620px; margin: 0 auto 34px; }

.searchbox {
    position: relative; display: flex; align-items: center; gap: 8px;
    background: #fff; border: 1px solid var(--line); border-radius: 999px;
    padding: 8px 8px 8px 20px; box-shadow: var(--shadow);
    max-width: 640px; margin: 0 auto;
    z-index: 40;
}
.searchbox:focus-within {
    border-color: var(--green); box-shadow: 0 0 0 4px rgba(0,122,83,.12), var(--shadow);
    z-index: 100 !important;
}
.search-ico { width: 20px; height: 20px; color: var(--muted); flex: none; }
#adresse {
    flex: 1; border: 0; outline: 0; font: inherit; font-size: 16.5px;
    background: transparent; min-width: 0; padding: 10px 0;
}
.suggest {
    position: absolute; top: calc(100% + 10px); left: 0; right: 0; z-index: 1000;
    background: #ffffff !important; border: 1px solid var(--line); border-radius: 14px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18); overflow: hidden; text-align: left;
}
.suggest-item { display: block; width: 100%; padding: 12px 18px; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; }
.suggest-item:hover, .suggest-item.active { background: var(--green-soft); }
.suggest-item .s-city { color: var(--muted); font-size: 13px; }
.hint { color: var(--muted); font-size: 13px; margin-top: 12px; }
/* champ avec adresse sélectionnée : liseré vert */
#adresse.has-selection { caret-color: var(--green); }
.searchbox.has-selection { border-color: var(--green); }

/* ------------------------------------------------- barre de progression (analyse) */
.loading {
    position: fixed; inset: 0; z-index: 300;
    display: grid; place-items: center;
    background: rgba(242, 246, 244, .78);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    opacity: 0; transition: opacity .18s ease;
}
.loading[hidden] { display: none; } /* l'attribut hidden doit toujours l'emporter */
.loading.is-on { opacity: 1; }
.loading-card {
    background: #fff; border: 1px solid var(--line); border-radius: 18px;
    box-shadow: 0 12px 48px rgba(20, 37, 30, .18);
    padding: 28px 34px; width: min(430px, calc(100vw - 44px)); text-align: center;
}
.loading-spin {
    width: 30px; height: 30px; margin: 0 auto 12px; border-radius: 50%;
    border: 3px solid var(--green-soft); border-top-color: var(--green);
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-title {
    font-weight: 800; color: var(--green-dark); font-size: 13px;
    letter-spacing: .08em; text-transform: uppercase;
}
.loading-barwrap {
    height: 8px; border-radius: 99px; background: var(--green-soft);
    overflow: hidden; margin: 15px 0 10px;
}
.loading-bar {
    height: 100%; width: 6%; border-radius: 99px;
    background: linear-gradient(90deg, var(--green) 0%, #02996a 100%);
    transition: width 11s cubic-bezier(.15, .5, .25, 1);
}
.loading.is-on .loading-bar { width: 94%; }
.loading-msg { color: var(--muted); font-size: 13.5px; min-height: 1.5em; }
@media (prefers-reduced-motion: reduce) {
    .loading-spin { animation: none; }
    .loading-bar { transition: none; }
}

.points {
    position: relative; z-index: 1;
    display: flex; gap: 12px; justify-content: center; align-items: center;
    list-style: none; padding: 0; margin: 38px auto 0;
    color: var(--muted); font-size: 13px;
    flex-wrap: nowrap; max-width: 100%;
}
.points li {
    position: relative; z-index: 1;
    white-space: nowrap;
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 7px 16px;
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.points strong { color: var(--green-dark); font-weight: 800; }

/* ------------------------------------------------- grille de capacités (accueil) */
.capacites { max-width: 1100px; margin: 0 auto; padding: 48px 20px 24px; }
.capacites-head { text-align: center; max-width: 760px; margin: 0 auto 36px; }
.cap-tag {
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(245, 158, 11, 0.12); color: #d97706; border: 1px solid rgba(245, 158, 11, 0.3);
    padding: 5px 14px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
    margin-bottom: 12px;
}
.capacites-head h2 { font-size: clamp(22px, 3.2vw, 32px); font-weight: 800; margin: 0 0 10px; letter-spacing: -0.02em; }
.cap-sub { color: var(--muted); font-size: 14.5px; line-height: 1.6; margin: 0; }
.cap-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 18px; }
.cap {
    background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 22px;
    box-shadow: 0 2px 12px rgba(20, 37, 30, 0.05); display: flex; flex-direction: column; justify-content: space-between;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.cap:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(20, 37, 30, 0.09); border-color: var(--green); }
.cap-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cap-badge {
    font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em;
    padding: 3px 9px; border-radius: 999px; background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0;
}
.cap-ico {
    display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
    font-size: 18px; color: var(--c, #1b365d);
    background: color-mix(in srgb, var(--c, #1b365d) 10%, #fff);
    border: 1px solid color-mix(in srgb, var(--c, #1b365d) 24%, #fff);
}
.cap-ico svg { width: 20px; height: 20px; }
.cap h3 { margin: 0 0 8px; font-size: 15.5px; font-weight: 800; color: #0f172a; }
.cap p { margin: 0 0 14px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.cap-source {
    margin-top: auto; padding-top: 12px; border-top: 1px dashed var(--line);
    font-size: 11.5px; font-weight: 600; color: #64748b; display: flex; align-items: center; gap: 6px;
}
.cap-source svg { width: 13px; height: 13px; opacity: 0.7; }

/* Bandeau des sources officielles certifiées */
.sources-banner {
    margin-top: 40px; padding: 22px 24px; border-radius: 16px;
    background: #f8fafc; border: 1px solid #cbd5e1;
    display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center;
}
.sources-title {
    display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 800;
    color: #1b365d; text-transform: uppercase; letter-spacing: 0.04em;
}
.sources-title svg { color: #1b365d; }
.sources-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.source-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px; border-radius: 999px; background: #ffffff; border: 1px solid #cbd5e1;
    color: #334155; font-size: 12px; font-weight: 700; text-decoration: none !important;
    transition: all 0.15s ease;
}
.source-chip:hover {
    background: #1b365d; color: #ffffff !important; border-color: #1b365d; transform: translateY(-1px);
}
.accueil-footer { text-align: center; padding: 24px 20px; color: var(--muted); font-size: 12.5px; line-height: 1.6; }

/* ---------------------------------------------------------------- rapport */
.topbar {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 24px; background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}
.topbar-actions { display: flex; gap: 10px; }
.wrap { max-width: 1060px; margin: 26px auto 60px; padding: 0 20px; display: grid; gap: 22px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; }
.overline { text-transform: uppercase; letter-spacing: .08em; font-size: 12px; font-weight: 700; color: var(--green); margin: 0 0 6px; }
.addr-meta { color: var(--muted); font-size: 14px; margin: 6px 0 0; }
.addr-meta .dot { margin: 0 8px; opacity: .6; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

.report-head { display: grid; grid-template-columns: 1fr 420px; gap: 24px; align-items: center; }
.mini-map { border-radius: 12px; border: 1px solid var(--line); width: 100%; height: auto; display: block; }

/* ---------------------------------------------------------------- badges */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.badge {
    display: flex; align-items: center; gap: 10px;
    border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
    text-decoration: none; color: inherit; background: #fff;
    transition: border-color .15s ease, transform .06s ease;
}
.badge:hover { border-color: var(--green); text-decoration: none; transform: translateY(-1px); }
.badge-dot { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.badge-title { font-weight: 600; font-size: 13.5px; }
.badge-val { margin-left: auto; font-size: 12.5px; font-weight: 700; text-align: right; }
.badge.faible  { background: var(--faible-bg);  border-color: #bfe6d1; } .badge.faible  .badge-dot { background: var(--faible); }  .badge.faible  .badge-val { color: var(--faible); }
.badge.moyen   { background: var(--moyen-bg);   border-color: #f2d9ae; } .badge.moyen   .badge-dot { background: var(--moyen); }   .badge.moyen   .badge-val { color: var(--moyen); }
.badge.fort    { background: var(--fort-bg);    border-color: #f2bcb2; } .badge.fort    .badge-dot { background: var(--fort); }    .badge.fort    .badge-val { color: var(--fort); }
.badge.neant   { background: var(--neant-bg);   border-color: #c2e3d4; } .badge.neant   .badge-dot { background: var(--neant); }   .badge.neant   .badge-val { color: var(--neant); }
.badge.indispo { background: var(--indispo-bg); border-color: var(--line); } .badge.indispo .badge-dot { background: var(--indispo); } .badge.indispo .badge-val { color: var(--indispo); }
.section-head .badge { padding: 8px 14px; border-radius: 999px; }
.section-head .badge-val { margin: 0; }

/* ---------------------------------------------------------------- sections */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.section-body p { margin: 0 0 10px; }
.section-body ul { margin: 6px 0 0; padding-left: 20px; }
.section-body li { margin: 4px 0; }
.source { color: var(--muted); font-size: 12px; border-top: 1px dashed var(--line); margin: 20px 0 0; padding-top: 12px; }

/* ---------------------------------------------------------------- cartes */
.mapbox { border-radius: 12px; overflow: hidden; border: 1px solid var(--line); height: 430px; background: #eef2f0; z-index: 1; }
.leaflet-container { font: inherit; }
.map-switch { position: absolute; top: 10px; right: 10px; z-index: 500; display: flex; gap: 4px; background: #fff; border-radius: 10px; padding: 4px; box-shadow: var(--shadow); }
.map-switch button { border: 0; background: transparent; font: inherit; font-size: 12px; font-weight: 600; color: var(--muted); padding: 5px 10px; border-radius: 7px; cursor: pointer; }
.map-switch button.on { background: var(--green); color: #fff; }

/* ---------------------------------------------------------------- tableaux */
table.catnat, table.table {
    width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 10px;
    border: 1px solid #cbd5e1;
}
table.catnat th, table.table th {
    text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
    color: #1b365d; background: #edf2f7; padding: 9px 12px; border: 1px solid #cbd5e1; font-weight: 800;
}
table.catnat td, table.table td {
    padding: 8px 12px; border: 1px solid #e2e8f0; vertical-align: top; color: #1e293b;
}
table.catnat tr:nth-child(even) td, table.table tr:nth-child(even) td {
    background: #f8fafc;
}
.catnat-stats {
    background: #edf2f7; border: 1px solid #cbd5e1; border-left: 4px solid #1b365d;
    border-radius: 4px; padding: 10px 14px; font-size: 13px; color: #1b365d; font-weight: 600;
}

/* ------------------------------------------------- fiches clés/valeurs */
.props { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px; margin: 12px 0 16px; }
.props > div { border: 1px solid #cbd5e1; border-radius: 4px; padding: 8px 12px; background: #f8fafc; display: grid; gap: 2px; }
.prop-k { color: #64748b; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.prop-v { font-weight: 700; font-size: 13.5px; overflow-wrap: anywhere; color: #0f172a; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .92em; }
.doc-links { white-space: nowrap; }

/* ------------------------------------------------- DPE (étiquettes) */
.dpe-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin: 12px 0 16px; }
.dpe-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: #fbfdfc; }
.dpe-card h3 { margin: 0 0 10px; }
.dpe-scale { display: flex; gap: 4px; }
.dpe-step {
    flex: 1; text-align: center; padding: 9px 0 9px; border-radius: 6px;
    background: color-mix(in srgb, var(--c) 22%, #fff); color: #48514c;
    font-weight: 800; font-size: 13px; border: 1px solid color-mix(in srgb, var(--c) 45%, #fff);
}
.dpe-step.on {
    background: var(--c); color: #fff; border-color: var(--c);
    box-shadow: 0 3px 10px color-mix(in srgb, var(--c) 45%, transparent);
    transform: scale(1.08);
}
.dpe-kv { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.dpe-kv strong { color: var(--ink); font-size: 14.5px; }

/* ------------------------------------------------- DVF (stats marché) */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin: 12px 0 16px; }
.stat { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: linear-gradient(180deg, #fbfdfc, #f2f7f4); display: grid; gap: 2px; }
.stat.empty { opacity: .65; }
.stat-k { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; }
.stat-v { font-size: 21px; font-weight: 800; color: var(--green-dark); letter-spacing: -.01em; }
.stat-s { color: var(--muted); font-size: 12px; }

.note-warn { background: var(--moyen-bg); border: 1px solid #f2d9ae; border-radius: 10px; padding: 12px 16px; }
.note-ok { color: var(--faible); font-weight: 600; }
.mentions p { font-size: 13px; color: var(--muted); }
.error-wrap { place-items: center; min-height: 60vh; }
.error-card { text-align: center; max-width: 460px; margin: 10vh auto; }

/* ==========================================================================
   IMPRESSION — export PDF propre (A4)
   ========================================================================== */
@page { size: A4; margin: 12mm 11mm; background: #ffffff !important; }
@media print {
    :root { --shadow: none !important; --bg: #ffffff !important; --card: #ffffff !important; }
    html, body, .wrap { background: #ffffff !important; background-color: #ffffff !important; font-size: 12.2px; line-height: 1.5; color: #111 !important; }
    .no-print, .map-interactive, .topbar { display: none !important; }
    .map-print { display: block !important; }
    .wrap { max-width: none; margin: 0; padding: 0; gap: 14px; display: block; }
    .card { border: 1px solid #d8ddd9; box-shadow: none; border-radius: 8px; padding: 16px 18px; margin-bottom: 14px; break-inside: avoid; page-break-inside: avoid; }
    h1 { font-size: 24px; }
    h2 { font-size: 16px; margin-bottom: 8px; }
    h3 { font-size: 11.5px; margin: 12px 0 4px; }
    .section-head { margin-bottom: 10px; }
    .report-head { display: block; }
    .mini-map { display: block; width: 62%; margin: 10px 0 0; }
    .mapbox, .map-print { height: auto; width: 100%; border-radius: 8px; }
    .badges { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .badge { padding: 8px 10px; }
    a { color: inherit; }
    .source { margin-top: 10px; }
    #sec-cadastre, #sec-dispositions, #sec-plu, #sec-plu2, #sec-sup,
    #sec-argiles, #sec-sismique, #sec-inondation, #sec-terrain, #sec-dpe, #sec-dvf { break-before: page; page-break-before: always; margin-top: 0; }
    #sec-radon, #sec-catnat { break-inside: avoid; }
    #synthese { break-after: avoid; }
    .props { grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 12px; }
    .props > div { padding: 8px 10px; }
    .prop-v { font-size: 12.5px; }
    .feuille { border-radius: 8px; break-inside: avoid; page-break-inside: avoid; }
    .feuille figcaption { font-size: 10px; padding: 6px 10px; }
    .dpe-grid, .stats-row { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-v { font-size: 17px; }
    .dpe-step { padding: 7px 0; }
    table.catnat, table.table { font-size: 11.5px; }
    table.catnat th, table.table th { padding: 7px 9px; }
    table.catnat td, table.table td { padding: 6px 9px; }
    .leaflet-attribution { display: none !important; }
    /* NRU à l'impression */
    .nru-title { font-size: 20px; }
    .nru-sub { font-size: 11px; margin-bottom: 10px; }
    .legal-box { padding: 10px 12px; }
    .legal-box p { font-size: 10.2px; }
    .sec-bar { border-radius: 6px; padding: 7px 12px; margin: 0 0 10px; }
    .sec-bar h2 { font-size: 13.5px; }
    .sec-badge { font-size: 10.5px; padding: 4px 10px; }
    .sec-band-title { font-size: 10.5px; padding: 5px 9px; margin: 12px 0 7px; }
    .ck-grid { gap: 2px 18px; }
    .ck-lbl { font-size: 10.6px; }
    .ck-sub { font-size: 9.6px; }
    .ckbox { width: 12px; height: 12px; margin-top: 2px; font-size: 9px; }
    .cartouche { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .cartouche > div { padding: 7px 9px; font-size: 10.5px; }
    .zonage-code { font-size: 22px; padding: 6px 12px; }
    .zonage-desc { font-size: 11px; }
    .legend { font-size: 10px; }
    .doc-links-line .btn { font-size: 10.5px; padding: 6px 10px; }
    .nru-tbl td { font-size: 11px; }
    * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Feuille cadastrale officielle (plan de section DGFiP) */
.feuille { margin: 14px 0 4px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.feuille img { display: block; width: 100%; height: auto; }
.feuille figcaption { font-size: 12px; color: var(--muted); padding: 10px 14px; border-top: 1px solid var(--line); background: #fafbfa; }
.feuille figcaption a { color: inherit; }

/* ==========================================================================
   NOTE DE RENSEIGNEMENTS D'URBANISME (NRU) — style document officiel
   ========================================================================== */
.nru-head { text-align: center; }
.nru-brand {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1.5px solid #cbd5e1;
    text-align: left;
}
.nru-brand-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
}
.nru-brand-name {
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 0.05em;
    color: #1b365d;
    line-height: 1.15;
}
.nru-brand-sub {
    color: #334155;
    font-size: 13px;
    font-weight: 700;
    margin-top: 1px;
    letter-spacing: 0.01em;
}
.nru-brand-url, .nru-contact-url {
    font-size: 12px;
    font-weight: 700;
}
.nru-brand-url a, .nru-contact-url a {
    color: #0d5cb6 !important;
    text-decoration: underline !important;
    text-underline-offset: 2px;
}
.nru-brand-right {
    text-align: right;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}
.nru-brand-right .brand-logo {
    height: 48px;
    width: auto;
    max-width: 250px;
    object-fit: contain;
}
.nru-title {
    font-size: clamp(20px, 2.8vw, 25px);
    font-weight: 900;
    letter-spacing: 0.04em;
    margin: 6px 0 3px;
    color: #0f172a;
    text-transform: uppercase;
    text-align: center;
}
.nru-sub {
    color: #475569;
    font-weight: 800;
    font-size: 12px;
    letter-spacing: 0.05em;
    margin: 0 0 16px;
    text-transform: uppercase;
    text-align: center;
}
.legal-box {
    text-align: left;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 14px 18px;
    background: #f8fafc;
}
.legal-cert-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-left: 4px solid #1b365d;
    border-radius: 6px;
    padding: 10px 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}
.legal-cert-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: left;
}
.legal-cert-lbl {
    font-size: 10px;
    font-weight: 800;
    color: #64748b;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.legal-cert-val {
    font-size: 13.5px;
    font-weight: 800;
    color: #0f172a;
}
.legal-cert-tz {
    font-size: 11.5px;
    font-weight: 600;
    color: #64748b;
}
.legal-cert-ref {
    text-align: right;
}
.legal-cert-code {
    font-size: 16px;
    font-weight: 900;
    color: #1b365d;
    letter-spacing: 0.06em;
}
.legal-box p { margin: 0 0 8px; font-size: 12.5px; color: #334155; line-height: 1.55; }
.legal-box p:last-child { margin-bottom: 0; }
.legal-box .ref { text-align: center; font-weight: 800; color: #1b365d; letter-spacing: 0.03em; margin-top: 10px; }

/* Bandeau de titre de section (Style NoteUrba / Notariat : Bleu Institutionnel Profond) */
.sec-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    background: #1b365d !important;
    color: #ffffff !important;
    border-radius: 4px;
    padding: 8px 14px;
    margin: -6px 0 16px;
    border: 1px solid #142a4a;
    box-shadow: 0 1px 3px rgba(27, 54, 93, 0.15);
}
.sec-bar h2 {
    color: #ffffff !important;
    margin: 0;
    font-size: 13.5px !important;
    letter-spacing: 0.05em !important;
    text-transform: uppercase !important;
    font-weight: 800 !important;
}
.sec-badge {
    background: rgba(255,255,255,.18);
    border: 1px solid rgba(255,255,255,.4);
    border-radius: 4px;
    padding: 3px 10px;
    font-weight: 700;
    font-size: 11.5px;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.sec-badge.faible { background: var(--faible); border-color: var(--faible); }
.sec-badge.moyen  { background: var(--moyen);  border-color: var(--moyen); }
.sec-badge.fort   { background: var(--fort);   border-color: var(--fort); }
.sec-badge.neant  { background: var(--neant);  border-color: var(--neant); }
.sec-badge.indispo{ background: var(--indispo); border-color: var(--indispo); }

/* Sous-titres de groupe (bandeau gris-bleuté avec liseré marine, façon NoteUrba) */
.sec-band-title {
    background: #edf2f7 !important;
    border: 1px solid #cbd5e1 !important;
    border-left: 4px solid #1b365d !important;
    border-radius: 4px;
    padding: 6px 12px;
    margin: 16px 0 10px;
    font-weight: 800;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #1b365d !important;
}

/* Cartouche 3 colonnes (extrait de plan cadastral) */
.cartouche { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 14px; }
.cartouche > div {
    border: 1px solid #cbd5e1; border-radius: 6px; background: #f8fafc; padding: 10px 12px; font-size: 13px; line-height: 1.5;
}
.cartouche strong { font-size: 14px; color: #0f172a; }
.cartouche .prop-k { display: block; margin-bottom: 2px; color: #64748b; }

/* Boîte ZONAGE (code de zone + désignation) */
.zonage-box {
    display: flex; align-items: center; gap: 16px;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px;
    background: #f8fafc !important;
    padding: 12px 16px;
    margin: 4px 0 16px;
}
.zonage-code {
    font-size: 26px;
    font-weight: 900;
    color: #1b365d !important;
    letter-spacing: -.01em;
    background: #fff;
    border: 1.5px solid #1b365d !important;
    border-radius: 6px;
    padding: 6px 14px;
    flex: none;
}
.zonage-desc { font-size: 13.5px; }

/* Cases à cocher (récapitulatif dispositions) */
.ck-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 22px; margin: 0 0 6px; }
.ck-grid.ck-compact { gap: 3px 22px; }
.ck { display: flex; gap: 10px; align-items: flex-start; padding: 3px 2px; }
.ckbox {
    flex: none; width: 15px; height: 15px; border: 1.5px solid #94a3b8; border-radius: 3px; margin-top: 3px;
    display: inline-grid; place-items: center; font-size: 11px; font-weight: 800; color: #1b365d; background: #fff;
}
.ck.on .ckbox { border-color: #1b365d; background: #edf2f7; color: #1b365d; }
.ck-lbl { font-size: 12.8px; line-height: 1.45; color: #1e293b; }
.ck.on .ck-lbl { font-weight: 700; color: #0f172a; }
.ck-sub { display: block; color: #64748b; font-size: 11.5px; font-weight: 400; }
.ck-links { display: block; margin-top: 2px; font-size: 11.5px; font-weight: 600; }
.ck-links a, .gpu-terrs a, .gpu-mini a {
    color: #0d5cb6 !important;
    text-decoration: underline !important;
    text-underline-offset: 2px;
    white-space: nowrap;
}
.ck-links a:hover, .gpu-terrs a:hover, .gpu-mini a:hover {
    color: #083c7a !important;
}
.fam-title {
    grid-column: 1 / -1; margin-top: 8px; font-weight: 700; font-size: 11.5px;
    text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
    border-bottom: 1px dashed var(--line); padding-bottom: 3px;
}

/* Légende de cartes */
.legend { display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap; font-size: 12.3px; color: var(--muted); margin: 10px 2px 4px; }
.lg { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 5px; }
.lg-zone { background: rgba(255,128,0,.5); border: 2px solid #c45800; }
.lg-pat { background: rgba(196,22,33,.55); border: 2px solid #96101a; }
.lg-com { background: rgba(23,78,166,.55); border: 2px solid #0c347c; }
.lg-er { background: rgba(0,128,64,.55); border: 2px solid #006430; }
.lg-autre { background: rgba(122,20,140,.55); border: 2px solid #5c086c; }
.lg-zoneline { background: transparent; border: 0; border-top: 2.5px solid #c45800; height: 0; width: 18px; border-radius: 0; }

/* Bloc liens documents PDF */
.doc-links-line { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.doc-links-line .btn { padding: 8px 14px; font-size: 13px; }

/* Observations */
.obs { border: 1px solid var(--line); border-radius: 10px; background: #fbfdfc; padding: 12px 16px; }
.obs p { margin: 0 0 6px; font-size: 13px; }
.obs p:last-child { margin-bottom: 0; }

/* Écran : les cartes statiques restent masquées */
.map-print { display: none; }

/* ---------------------------------------------------------------- mobile (écran uniquement — l'impression A4 est plus étroite que 760px !) */
@media screen and (max-width: 760px) {
    .report-head { grid-template-columns: 1fr; }
    .searchbox .btn { padding: 11px 16px; }
    .points { flex-wrap: wrap !important; gap: 8px; margin-top: 24px; }
    .points li { font-size: 11.5px; padding: 5px 11px; white-space: normal !important; }
    .mapbox { height: 330px; }
    .badge-val { max-width: 120px; }
    .ck-grid { grid-template-columns: 1fr; }
    .cartouche { grid-template-columns: 1fr; }
    .zonage-box { flex-direction: column; align-items: flex-start; }
}

/* ==================================================================
   1quater. Comparaison multi-parcelles + sélection au clic + règlement
   ================================================================== */

/* --- Bouton d'ajout (accueil) --- */
.compare-add-row { margin: 2px 0 6px; }
#add-compare { padding: 8px 14px; font-size: 13px; }
#add-compare.flash-ok { border-color: var(--green-dark); background: var(--green-soft); }

/* --- Panier de comparaison (accueil) --- */
.comparebar {
    margin: 10px auto 0; max-width: 560px; text-align: left;
    border: 1.5px solid var(--green); border-radius: 12px; background: #fff;
    box-shadow: 0 8px 24px rgba(13, 82, 53, .08); padding: 14px 16px;
}
.cb-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.cb-head strong { font-size: 14px; color: var(--green-dark); }
.cb-count { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.cb-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 4px; }
.cb-list li {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    font-size: 13px; padding: 6px 10px; background: var(--green-soft);
    border: 1px solid #cfe6db; border-radius: 8px;
}
.cb-del {
    flex: none; border: 0; background: transparent; cursor: pointer; font-weight: 700;
    color: var(--muted); font-size: 13px; padding: 2px 6px; border-radius: 6px;
}
.cb-del:hover { color: #b3261e; background: #fdecea; }
.cb-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cb-clear {
    border: 0; background: transparent; color: var(--muted); font-size: 12.5px;
    cursor: pointer; text-decoration: underline; padding: 4px;
}
.cb-note { margin: 8px 0 0; font-size: 11.8px; color: var(--muted); }

/* --- Puce « comparer » dans la barre d'une note --- */
#compare-chip { border-color: var(--green); color: var(--green-dark); background: var(--green-soft); }
#compare-chip[hidden] { display: none; }

/* --- Sélection d'une parcelle voisine au clic (Outil notarial / cadastral) --- */
.map-pickbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 12px;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-left: 4px solid #1b365d;
    border-radius: 6px;
    flex-wrap: wrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.map-pick-btn {
    border: 1px solid #142a4a;
    background: #1b365d;
    color: #ffffff;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(27, 54, 93, 0.25);
}
.map-pick-btn:hover {
    background: #152d4e;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(27, 54, 93, 0.35);
}
.map-pick-btn.armed {
    border-color: #0369a1 !important;
    background: #0284c7 !important;
    color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.35) !important;
}
.map-pick-ico {
    flex-shrink: 0;
}
.map-pick-meta {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 12px;
    flex-wrap: wrap;
}
.map-pick-badge {
    background: #e2e8f0;
    color: #1b365d;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 2px 8px;
    font-weight: 800;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.map-pick-hint {
    font-size: 12px;
    color: #475569;
    font-weight: 600;
}
.map-pick-btn.armed + .map-pick-meta .map-pick-hint {
    color: #0369a1;
    font-weight: 700;
}
.pick-loading { font-size: 13px; padding: 6px 2px; color: #1b365d; font-weight: 600; }
.pick-res { font-size: 13px; line-height: 1.5; color: #0f172a; }
.pick-title { font-size: 14px; margin-bottom: 4px; color: #1b365d; font-weight: 700; }
.pick-line { color: #475569; font-size: 12.5px; margin-bottom: 3px; }
.pick-add {
    margin-top: 10px; width: 100%; text-align: center; padding: 9px 12px; font-size: 13px; cursor: pointer;
    background: #1b365d !important; border: 1px solid #142a4a !important; color: #ffffff !important; font-weight: 700;
    border-radius: 6px; box-shadow: 0 2px 6px rgba(27, 54, 93, 0.2);
}
.pick-add:hover { background: #152d4e !important; }
.pick-open {
    display: block; margin-top: 8px; text-align: center; font-size: 13px; font-weight: 700;
    color: #0d5cb6 !important; text-decoration: underline !important;
}

/* --- Zone inline (tableaux comparatifs) --- */
.zonage-inline {
    display: inline-block; font-weight: 800; color: #1b365d;
    background: #edf2f7; border: 1px solid #cbd5e1;
    border-radius: 4px; padding: 2px 8px; margin-right: 6px; font-size: 12.5px;
}

/* --- Règlement PLU — règles applicables en zone --- */
.regl-band { margin-top: 18px; }
.regl { border: 1px solid #cbd5e1; border-radius: 6px; overflow: hidden; margin-top: 8px; }
.regl-title {
    background: #1b365d !important; color: #fff !important; font-weight: 800; letter-spacing: .04em;
    font-size: 13px; padding: 8px 14px; text-transform: uppercase;
}
.regl-zone { background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.45); border-radius: 4px; padding: 1px 8px; margin-left: 4px; font-size: 12px; }
.regl-note { font-size: 12px; color: #475569; padding: 10px 14px 0; margin: 0; }
.regl-list { list-style: none; margin: 0; padding: 6px 14px 12px; display: grid; gap: 8px; }
.regl-item { border-top: 1px dashed #cbd5e1; padding-top: 8px; }
.regl-item:first-child { border-top: 0; }
.regl-item-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.regl-num {
    flex: none; font-weight: 800; font-size: 11.5px; color: #1b365d;
    border: 1px solid #cbd5e1; background: #edf2f7;
    border-radius: 4px; padding: 2px 8px; letter-spacing: .02em;
}
.regl-titre { font-weight: 700; font-size: 13px; flex: 1 1 auto; color: #0f172a; }
.regl-page { flex: none; font-size: 12px; font-weight: 600; white-space: nowrap; }
.regl-page a { color: #0d5cb6 !important; text-decoration: underline !important; }
.regl-resume { margin: 4px 0 0; font-size: 12.8px; line-height: 1.55; color: #334155; }

/* Impression des nouveaux blocs */
@media print {
    .comparebar, .compare-add-row, .map-pickbar, #compare-chip { display: none !important; }
    .regl { border-color: #9fc4b4; page-break-inside: avoid; }
    .regl-title { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .regl-item { page-break-inside: avoid; }
    .zonage-inline { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ==================================================================
   MODE « RAPPORTS COMPLETS » (?full=) — dossier multi-notes
   Une note complète par parcelle sélectionnée, dans un seul document.
   ================================================================== */
.full-toc { margin: 10px 0 0; padding-left: 20px; }
.full-toc li { margin: 3px 0; }
.full-cta {
    margin-top: 18px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 12px 16px;
}
.full-cta-sub {
    color: #475569;
    font-size: 12.5px;
    max-width: 48ch;
    line-height: 1.45;
}
.wrap .card .btn-primary {
    background: #1b365d !important;
    color: #ffffff !important;
    border: 1px solid #142a4a !important;
    box-shadow: 0 2px 6px rgba(27, 54, 93, 0.25) !important;
    border-radius: 6px !important;
    font-weight: 700 !important;
}
.wrap .card .btn-primary:hover {
    background: #152d4e !important;
    text-decoration: none !important;
}
.wrap .card .btn-ghost {
    color: #1b365d !important;
    border: 1px solid #cbd5e1 !important;
    background: #f8fafc !important;
    border-radius: 6px !important;
}
.wrap .card .btn-ghost:hover {
    background: #edf2f7 !important;
}
.full-sep {
    display: flex; align-items: center; gap: 16px;
    margin: 38px 0 0; color: #7d8a90;
    font-size: 12.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.full-sep::before, .full-sep::after { content: ""; flex: 1; height: 2px; background: #e3e8ea; border-radius: 2px; }
.full-note { min-width: 0; }

/* Cartes historiques (Cassini, État-major, 1950) — § 2 de la note */
.histo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 12px 0 8px; }
.histo { margin: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; break-inside: avoid; page-break-inside: avoid; }
.histo .mapbox { height: 230px; border-radius: 0; border: none; border-bottom: 1px solid var(--line); }
.histo figcaption { font-size: 12px; font-weight: 600; padding: 9px 12px; border-top: 1px solid var(--line); background: #fafbfa; line-height: 1.45; }
.histo figcaption .muted { font-weight: 400; font-size: 11px; color: var(--muted); }
@media screen and (max-width: 900px) { .histo-grid { grid-template-columns: 1fr; } .histo .mapbox { height: 280px; } }
@media print {
    .full-sep { display: none; }
    .full-cta { display: none !important; }
    .full-dossier-head { break-after: page; page-break-after: always; }
    .full-note + .full-note, .full-sep + .full-note { break-before: page; page-break-before: always; }
    /* cartes historiques : 3 vignettes sur une rangée */
    .histo-grid { gap: 10px; }
    .histo { border-radius: 8px; }
    .histo figcaption { font-size: 9.5px; padding: 6px 8px; }
}

/* ==========================================================================
   LOGO OFFICIEL VOSGES SINISTRE
   ========================================================================== */
.brand-logo {
    height: 38px;
    width: auto;
    max-width: 240px;
    object-fit: contain;
    display: inline-block;
    vertical-align: middle;
}

/* Bascule intelligente du logo selon le fond de la topbar (Clair / Sombre) */
.logo-white-text { display: none !important; }
.logo-dark-text { display: inline-block !important; }

html[data-theme="sombre"] .topbar .logo-white-text,
html[data-theme="prestige"] .topbar .logo-white-text,
html[data-theme="sombre"] .brand .logo-white-text,
html[data-theme="prestige"] .brand .logo-white-text {
    display: inline-block !important;
}

html[data-theme="sombre"] .topbar .logo-dark-text,
html[data-theme="prestige"] .topbar .logo-dark-text,
html[data-theme="sombre"] .brand .logo-dark-text,
html[data-theme="prestige"] .brand .logo-dark-text {
    display: none !important;
}

/* Dans la note d'urbanisme (fond blanc papier permanent), le logo officiel reste toujours affiché */
.nru-brand .brand-logo {
    height: 50px !important;
    max-width: 320px !important;
    display: inline-block !important;
}

/* ==========================================================================
   THÈME SOMBRE (DARK & GOLD) — VOSGES SINISTRE DESIGN SYSTEM
   Activé via attribut HTML data-theme="sombre"
   ========================================================================== */
html[data-theme="sombre"],
html[data-theme="prestige"] {
    --green: #f59e0b;
    --green-dark: #d97706;
    --green-soft: rgba(245, 158, 11, 0.15);
    --bg: #090d16;
    --card: #0f172a;
    --ink: #f8fafc;
    --muted: #94a3b8;
    --line: rgba(255, 255, 255, 0.09);
    --radius: 18px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 30px rgba(245, 158, 11, 0.06);
}

@media screen {
    html[data-theme="sombre"] body,
    html[data-theme="prestige"] body {
        font-family: "Plus Jakarta Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
        background: var(--bg);
        color: var(--ink);
    }
}

/* Accueil Hero */
html[data-theme="sombre"] .hero,
html[data-theme="prestige"] .hero {
    background: 
        radial-gradient(1000px 500px at 50% -10%, rgba(245, 158, 11, 0.16), transparent 70%),
        radial-gradient(800px 400px at 85% 85%, rgba(16, 185, 129, 0.08), transparent 60%),
        linear-gradient(180deg, #090d16 0%, #0c1220 100%);
    position: relative;
    overflow: hidden;
}

html[data-theme="sombre"] .hero h1,
html[data-theme="prestige"] .hero h1 {
    color: #ffffff;
    font-weight: 800;
    letter-spacing: -0.03em;
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.6);
}

html[data-theme="sombre"] .hero .lead,
html[data-theme="prestige"] .hero .lead {
    color: #94a3b8;
    font-size: 16px;
    line-height: 1.7;
}

/* Logo Brand */
html[data-theme="sombre"] .brand,
html[data-theme="prestige"] .brand {
    color: #ffffff;
}

/* Barre de recherche Glassmorphism */
html[data-theme="sombre"] .searchbox,
html[data-theme="prestige"] .searchbox {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(245, 158, 11, 0.35);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 0 25px rgba(245, 158, 11, 0.12);
    transition: all 0.25s ease;
    position: relative;
    z-index: 40;
}
html[data-theme="sombre"] .searchbox:focus-within,
html[data-theme="prestige"] .searchbox:focus-within {
    border-color: #f59e0b;
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.22), 0 12px 48px rgba(0, 0, 0, 0.7);
    background: #0f172a;
    z-index: 100 !important;
}
html[data-theme="sombre"] .search-ico,
html[data-theme="prestige"] .search-ico {
    color: #f59e0b;
}
html[data-theme="sombre"] #adresse,
html[data-theme="prestige"] #adresse {
    color: #ffffff;
    font-size: 16px;
}
html[data-theme="sombre"] #adresse::placeholder,
html[data-theme="prestige"] #adresse::placeholder {
    color: #64748b;
}

/* Boutons */
html[data-theme="sombre"] .btn-primary,
html[data-theme="prestige"] .btn-primary {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #0b0f19;
    font-weight: 800;
    box-shadow: 0 4px 18px rgba(245, 158, 11, 0.4);
    border: none;
}
html[data-theme="sombre"] .btn-primary:hover,
html[data-theme="prestige"] .btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 6px 22px rgba(245, 158, 11, 0.55);
}
html[data-theme="sombre"] .btn-ghost,
html[data-theme="prestige"] .btn-ghost {
    background: rgba(15, 23, 42, 0.6);
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.12);
}
html[data-theme="sombre"] .btn-ghost:hover,
html[data-theme="prestige"] .btn-ghost:hover {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.4);
    color: #fbbf24;
}

/* Suggestion box (100% opaque, au premier plan sans transparence) */
html[data-theme="sombre"] .suggest,
html[data-theme="prestige"] .suggest {
    background: #0b1120 !important;
    background-color: #0b1120 !important;
    opacity: 1 !important;
    border: 1px solid rgba(245, 158, 11, 0.45);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.95), 0 0 25px rgba(245, 158, 11, 0.15);
    border-radius: 16px;
    z-index: 1000 !important;
}
html[data-theme="sombre"] .suggest-item,
html[data-theme="prestige"] .suggest-item {
    color: #f1f5f9;
}
html[data-theme="sombre"] .suggest-item:hover,
html[data-theme="sombre"] .suggest-item.active,
html[data-theme="prestige"] .suggest-item:hover,
html[data-theme="prestige"] .suggest-item.active {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}
html[data-theme="sombre"] .suggest-item .s-city,
html[data-theme="prestige"] .suggest-item .s-city {
    color: #94a3b8;
}

/* Points en bas du Hero (placés en arrière-plan sous la boîte de suggestion) */
html[data-theme="sombre"] .points,
html[data-theme="prestige"] .points {
    position: relative;
    z-index: 1;
}
html[data-theme="sombre"] .points li,
html[data-theme="prestige"] .points li {
    position: relative;
    z-index: 1;
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 7px 16px;
    border-radius: 999px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(8px);
    white-space: nowrap;
    color: #cbd5e1;
}
html[data-theme="sombre"] .points strong,
html[data-theme="prestige"] .points strong {
    color: #f59e0b;
}

/* Grille Capacités */
html[data-theme="sombre"] .capacites,
html[data-theme="prestige"] .capacites {
    background: transparent;
}
html[data-theme="sombre"] .capacites h2,
html[data-theme="prestige"] .capacites h2 {
    color: #ffffff;
    font-weight: 800;
}
html[data-theme="sombre"] .cap-tag,
html[data-theme="prestige"] .cap-tag {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.35);
}
html[data-theme="sombre"] .cap,
html[data-theme="prestige"] .cap {
    background: linear-gradient(145deg, rgba(15, 23, 42, 0.9) 0%, rgba(15, 23, 42, 0.6) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    transition: all 0.25s ease;
}
html[data-theme="sombre"] .cap:hover,
html[data-theme="prestige"] .cap:hover {
    border-color: rgba(245, 158, 11, 0.45);
    transform: translateY(-3px);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 24px rgba(245, 158, 11, 0.1);
}
html[data-theme="sombre"] .cap h3,
html[data-theme="prestige"] .cap h3 {
    color: #f8fafc;
}
html[data-theme="sombre"] .cap p,
html[data-theme="prestige"] .cap p {
    color: #94a3b8;
}
html[data-theme="sombre"] .cap-badge,
html[data-theme="prestige"] .cap-badge {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
}
html[data-theme="sombre"] .cap-ico,
html[data-theme="prestige"] .cap-ico {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
    color: #fbbf24;
}
html[data-theme="sombre"] .cap-source,
html[data-theme="prestige"] .cap-source {
    border-color: rgba(255, 255, 255, 0.08);
    color: #64748b;
}
html[data-theme="sombre"] .sources-banner,
html[data-theme="prestige"] .sources-banner {
    background: rgba(15, 23, 42, 0.85);
    border-color: rgba(245, 158, 11, 0.3);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
html[data-theme="sombre"] .sources-title,
html[data-theme="prestige"] .sources-title {
    color: #fbbf24;
}
html[data-theme="sombre"] .sources-title svg,
html[data-theme="prestige"] .sources-title svg {
    color: #f59e0b;
}
html[data-theme="sombre"] .source-chip,
html[data-theme="prestige"] .source-chip {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
}
html[data-theme="sombre"] .source-chip:hover,
html[data-theme="prestige"] .source-chip:hover {
    background: rgba(245, 158, 11, 0.2);
    border-color: #f59e0b;
    color: #fbbf24 !important;
}

/* Footer */
html[data-theme="sombre"] .accueil-footer,
html[data-theme="prestige"] .accueil-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    color: #64748b;
}
html[data-theme="sombre"] .accueil-footer a,
html[data-theme="prestige"] .accueil-footer a {
    color: #f59e0b;
}

/* Panier de comparaison */
html[data-theme="sombre"] .comparebar,
html[data-theme="prestige"] .comparebar {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(245, 158, 11, 0.35);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7);
    color: #f8fafc;
}
html[data-theme="sombre"] .cb-head strong,
html[data-theme="prestige"] .cb-head strong {
    color: #fbbf24;
}
html[data-theme="sombre"] .cb-note,
html[data-theme="prestige"] .cb-note {
    color: #94a3b8;
}

/* Loading overlay */
html[data-theme="sombre"] .loading,
html[data-theme="prestige"] .loading {
    background: rgba(9, 13, 22, 0.85);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
html[data-theme="sombre"] .loading-card,
html[data-theme="prestige"] .loading-card {
    background: #0f172a;
    border: 1px solid rgba(245, 158, 11, 0.35);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 30px rgba(245, 158, 11, 0.12);
    color: #ffffff;
}
html[data-theme="sombre"] .loading-title,
html[data-theme="prestige"] .loading-title {
    color: #fbbf24;
}
html[data-theme="sombre"] .loading-spin,
html[data-theme="prestige"] .loading-spin {
    border: 3px solid rgba(245, 158, 11, 0.2);
    border-top-color: #f59e0b;
}
html[data-theme="sombre"] .loading-barwrap,
html[data-theme="prestige"] .loading-barwrap {
    background: rgba(255, 255, 255, 0.08);
}
html[data-theme="sombre"] .loading-bar,
html[data-theme="prestige"] .loading-bar {
    background: linear-gradient(90deg, #f59e0b 0%, #34d399 100%);
}
html[data-theme="sombre"] .loading-msg,
html[data-theme="prestige"] .loading-msg {
    color: #94a3b8;
}

/* ==========================================================================
   PAGE RAPPORT.PHP & RAPPORT_NOTE.PHP EN MODE SOMBRE
   Le fond général et la topbar sont sombres, mais le document reste blanc papier
   ========================================================================== */
@media screen {
    html[data-theme="sombre"] body.rapport,
    html[data-theme="prestige"] body.rapport {
        background: #090d16;
    }
}

/* Header sticky de navigation */
html[data-theme="sombre"] .topbar,
html[data-theme="prestige"] .topbar {
    background: rgba(15, 23, 42, 0.94) !important;
    border-bottom: 1px solid rgba(245, 158, 11, 0.3) !important;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}
html[data-theme="sombre"] .topbar .brand,
html[data-theme="prestige"] .topbar .brand {
    color: #ffffff !important;
}
html[data-theme="sombre"] .topbar .btn-ghost,
html[data-theme="prestige"] .topbar .btn-ghost {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #f1f5f9 !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
}
html[data-theme="sombre"] .topbar .btn-ghost:hover,
html[data-theme="prestige"] .topbar .btn-ghost:hover {
    background: rgba(245, 158, 11, 0.15) !important;
    border-color: #f59e0b !important;
    color: #fbbf24 !important;
}
html[data-theme="sombre"] .topbar .btn-primary,
html[data-theme="prestige"] .topbar .btn-primary {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    color: #0b0f19 !important;
    font-weight: 800;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4) !important;
    border: none;
}

/* LE DOCUMENT OFFICIEL "NOTE DE RENSEIGNEMENTS D'URBANISME" RESTE BLANC PAPIER */
html[data-theme="sombre"] .wrap .card,
html[data-theme="prestige"] .wrap .card {
    background: #ffffff !important;
    color: #14251e !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255, 255, 255, 0.2) !important;
}

/* Typographie interne au document blanc (préservation du contraste papier notarial) */
html[data-theme="sombre"] .wrap .card h1,
html[data-theme="prestige"] .wrap .card h1,
html[data-theme="sombre"] .wrap .card h2,
html[data-theme="prestige"] .wrap .card h2 {
    color: #0f172a !important;
}
html[data-theme="sombre"] .wrap .card .sec-bar h2,
html[data-theme="prestige"] .wrap .card .sec-bar h2 {
    color: #ffffff !important;
}
html[data-theme="sombre"] .wrap .card h3,
html[data-theme="prestige"] .wrap .card h3 {
    color: #1b365d !important;
}
html[data-theme="sombre"] .wrap .card p,
html[data-theme="prestige"] .wrap .card p,
html[data-theme="sombre"] .wrap .card li,
html[data-theme="prestige"] .wrap .card li,
html[data-theme="sombre"] .wrap .card td,
html[data-theme="prestige"] .wrap .card td,
html[data-theme="sombre"] .wrap .card th,
html[data-theme="prestige"] .wrap .card th {
    color: #1e293b !important;
}
html[data-theme="sombre"] .wrap .card .muted,
html[data-theme="prestige"] .wrap .card .muted,
html[data-theme="sombre"] .wrap .card .addr-meta,
html[data-theme="prestige"] .wrap .card .addr-meta,
html[data-theme="sombre"] .wrap .card .source,
html[data-theme="prestige"] .wrap .card .source,
html[data-theme="sombre"] .wrap .card .nru-sub,
html[data-theme="prestige"] .wrap .card .nru-sub,
html[data-theme="sombre"] .wrap .card .nru-brand-sub,
html[data-theme="prestige"] .wrap .card .nru-brand-sub,
html[data-theme="sombre"] .wrap .card .legal-box p,
html[data-theme="prestige"] .wrap .card .legal-box p {
    color: #475569 !important;
}
html[data-theme="sombre"] .wrap .card a,
html[data-theme="prestige"] .wrap .card a,
.wrap .card a {
    color: #0d5cb6 !important;
    text-decoration: underline !important;
    text-underline-offset: 3px !important;
    text-decoration-thickness: 1.5px !important;
    font-weight: 600 !important;
}
html[data-theme="sombre"] .wrap .card a:hover,
html[data-theme="prestige"] .wrap .card a:hover,
.wrap .card a:hover {
    color: #083c7a !important;
}
html[data-theme="sombre"] .wrap .card .badge,
html[data-theme="prestige"] .wrap .card .badge {
    color: #0f172a !important;
}
html[data-theme="sombre"] .wrap .card .legal-box,
html[data-theme="prestige"] .wrap .card .legal-box {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
}
html[data-theme="sombre"] .wrap .card .nru-brand-name,
html[data-theme="prestige"] .wrap .card .nru-brand-name {
    color: #1b365d !important;
}
html[data-theme="sombre"] .wrap .card .legal-cert-bar,
html[data-theme="prestige"] .wrap .card .legal-cert-bar {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    border-left-color: #1b365d !important;
}
html[data-theme="sombre"] .wrap .card .legal-cert-lbl,
html[data-theme="prestige"] .wrap .card .legal-cert-lbl {
    color: #64748b !important;
}
html[data-theme="sombre"] .wrap .card .legal-cert-val,
html[data-theme="prestige"] .wrap .card .legal-cert-val {
    color: #0f172a !important;
}
html[data-theme="sombre"] .wrap .card .legal-cert-code,
html[data-theme="prestige"] .wrap .card .legal-cert-code {
    color: #1b365d !important;
}
html[data-theme="sombre"] .wrap .card .regl-title,
html[data-theme="prestige"] .wrap .card .regl-title {
    background: #1b365d !important;
    color: #ffffff !important;
}
html[data-theme="sombre"] .wrap .card .catnat-stats,
html[data-theme="prestige"] .wrap .card .catnat-stats {
    background: #edf2f7 !important;
    border-color: #cbd5e1 !important;
    color: #1e293b !important;
}

/* -------------------------------------------------
   BOUTON SWITCH DE THÈME FLOTTANT (SOMBRE / CLAIR)
   ------------------------------------------------- */
.theme-switch-btn {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 200;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 15px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    user-select: none;
}

/* Quand en Mode Clair */
html:not([data-theme="sombre"]):not([data-theme="prestige"]) .theme-switch-btn {
    background: #ffffff;
    color: var(--green-dark);
    border: 1px solid var(--line);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}
html:not([data-theme="sombre"]):not([data-theme="prestige"]) .theme-switch-btn:hover {
    background: var(--green-soft);
    border-color: var(--green);
    transform: translateY(-1px);
}

/* Quand en Mode Sombre */
html[data-theme="sombre"] .theme-switch-btn,
html[data-theme="prestige"] .theme-switch-btn {
    background: rgba(15, 23, 42, 0.88);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 15px rgba(245, 158, 11, 0.15);
}
html[data-theme="sombre"] .theme-switch-btn:hover,
html[data-theme="prestige"] .theme-switch-btn:hover {
    background: rgba(245, 158, 11, 0.2);
    border-color: #f59e0b;
    transform: translateY(-1px) scale(1.02);
}

/* ==========================================================================
   RÉINITIALISATION TOTALE DE L'IMPRESSION PDF (GARANTIE FOND BLANC PAPIER NOTARIAL)
   Garantit que le thème sombre à l'écran ne s'imprime jamais en noir dans le PDF
   ========================================================================== */
@media print {
    *, *::before, *::after {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    html,
    html[data-theme="sombre"],
    html[data-theme="prestige"],
    body,
    html[data-theme="sombre"] body,
    html[data-theme="prestige"] body,
    html[data-theme="sombre"] body.rapport,
    html[data-theme="prestige"] body.rapport {
        background: #ffffff !important;
        background-color: #ffffff !important;
        color: #111111 !important;
    }
    .no-print,
    .map-interactive,
    .topbar,
    .theme-switch-btn,
    #theme-toggle {
        display: none !important;
    }
    .map-print {
        display: block !important;
    }
    .wrap {
        background: transparent !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        gap: 14px !important;
        display: block !important;
    }
    .card,
    .full-note,
    html[data-theme="sombre"] .wrap .card,
    html[data-theme="prestige"] .wrap .card,
    html[data-theme="sombre"] .card,
    html[data-theme="prestige"] .card {
        background: #ffffff !important;
        background-color: #ffffff !important;
        color: #111111 !important;
        border: 1px solid #cbd5e1 !important;
        box-shadow: none !important;
        border-radius: 8px !important;
        padding: 16px 18px !important;
        margin-bottom: 14px !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }
    .nru-head {
        background: #ffffff !important;
        border: 1px solid #cbd5e1 !important;
    }
    .legal-box,
    html[data-theme="sombre"] .wrap .card .legal-box,
    html[data-theme="prestige"] .wrap .card .legal-box {
        background: #f8fafc !important;
        background-color: #f8fafc !important;
        border: 1px solid #cbd5e1 !important;
    }
    .legal-cert-bar,
    html[data-theme="sombre"] .wrap .card .legal-cert-bar,
    html[data-theme="prestige"] .wrap .card .legal-cert-bar {
        background: #ffffff !important;
        background-color: #ffffff !important;
        border: 1.5px solid #cbd5e1 !important;
        border-left: 4px solid #1b365d !important;
    }
    .legal-cert-lbl { color: #64748b !important; }
    .legal-cert-val { color: #0f172a !important; }
    .legal-cert-code { color: #1b365d !important; font-size: 15px !important; }
    .legal-cert-tz { color: #64748b !important; }
    .cartouche > div,
    .zonage-box,
    .regl-item,
    .dpe-step,
    .stats-row > div,
    .feuille,
    .histo {
        background: #ffffff !important;
        background-color: #ffffff !important;
        color: #1e293b !important;
        border-color: #cbd5e1 !important;
    }
    .feuille figcaption,
    .histo figcaption {
        background: #f8fafc !important;
        background-color: #f8fafc !important;
        color: #334155 !important;
        border-top: 1px solid #cbd5e1 !important;
    }
    .sec-bar {
        background: #1b365d !important;
        background-color: #1b365d !important;
        color: #ffffff !important;
        border-color: #142a4a !important;
    }
    .sec-bar h2 {
        color: #ffffff !important;
    }
}

