:root {
    --bg: #0c1210;
    --bg-glow: #143028;
    --card: #141c19;
    --line: #24332e;
    --text: #e8f0ec;
    --muted: #8aa399;
    --accent: #2ecf9a;
    --accent-dim: #1a7a5c;
    --map-empty: #1a2420;
    --warn: #e0b84f;
    --font-display: "Newsreader", "Iowan Old Style", Georgia, serif;
    --font-body: "Figtree", "Segoe UI", sans-serif;
}

/* ── Light mode ───────────────────────────────────────────────────────────── */
[data-theme="light"] {
    --bg: #f3f7f5;
    --bg-glow: #d7ebe3;
    --card: #ffffff;
    --line: #d5e2dc;
    --text: #14201c;
    --muted: #5c7268;
    --accent: #0f8f6a;
    --accent-dim: #0b6b50;
    --map-empty: #dde8e3;
}
[data-theme="light"] .mode-switch { background: #eef1f5; }
[data-theme="light"] .theme-toggle,
[data-theme="light"] .lang-switch button,
[data-theme="light"] .view-switch button { background: #eef1f5; }
[data-theme="light"] .preset { background: #f1f3f7; }
[data-theme="light"] .preset.active { background: #e2ecff; }
[data-theme="light"] .slider-track { background: #cfd6e0; }
[data-theme="light"] .slider-track::before { background: #ffffff; }
[data-theme="light"] tbody tr.main:hover { background: #eef1f5; }
[data-theme="light"] .detail td { background: #eef1f5; }
[data-theme="light"] .detail-item,
[data-theme="light"] .fiscal { background: #ffffff; }
[data-theme="light"] .homeschool .hs-free { color: #0b6b50; }
[data-theme="light"] .homeschool .hs-regulated { color: #1a5f8a; }
[data-theme="light"] .homeschool .hs-restricted { color: #9a6b10; }
[data-theme="light"] .homeschool .hs-banned { color: #9a2f2f; }
[data-theme="light"] .homeschool .hs-grey,
[data-theme="light"] .homeschool .hs-unknown { color: #5c7268; }
[data-theme="light"] .detail-item.regime-on { background: #fdf6e3; }
[data-theme="light"] .map-box { background: #e9eef5; }
[data-theme="light"] #map .ocean { fill: #e9eef5; }
[data-theme="light"] #map .country { stroke: #ffffff; }
[data-theme="light"] #map .marker { stroke: #ffffff; }
[data-theme="light"] #map .country.selected,
[data-theme="light"] #map .marker.selected { stroke: #1a1d24; }
[data-theme="light"] .country-panel { background: #ffffff; }
* { box-sizing: border-box; }
body {
    margin: 0;
    color: var(--text);
    font: 15px/1.5 var(--font-body);
    background:
        radial-gradient(1200px 600px at 10% -10%, var(--bg-glow), transparent 55%),
        radial-gradient(900px 500px at 100% 0%, rgba(46, 207, 154, .08), transparent 50%),
        var(--bg);
    min-height: 100vh;
}
.wrap { max-width: 960px; margin: 0 auto; padding: 32px 20px 64px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
h1 {
    margin: 0 0 6px;
    font-family: var(--font-display);
    font-size: clamp(28px, 4vw, 36px);
    font-weight: 600;
    letter-spacing: -0.02em;
}
.topbar-ctrls { display: flex; align-items: center; gap: 10px; }
.theme-toggle {
    background: #20242d; border: 1px solid var(--line); border-radius: 8px;
    padding: 6px 10px; font-size: 15px; line-height: 1; cursor: pointer;
}
.theme-toggle:hover { border-color: var(--accent); }
.text-link, .share-btn {
    color: var(--muted); font-size: 13px; font-weight: 600; text-decoration: none;
    background: transparent; border: 1px solid transparent; border-radius: 8px;
    padding: 6px 10px; cursor: pointer;
}
.text-link:hover, .share-btn:hover { color: var(--accent); border-color: var(--line); }
.mode-focus {
    margin: -12px 0 18px; font-size: 12px; color: var(--muted);
}
.map-variants { font-size: 12px; color: var(--muted); margin: -4px 0 10px; }
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.lang-switch button {
    background: #20242d;
    color: var(--muted);
    border: none;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.lang-switch button + button { border-left: 1px solid var(--line); }
.lang-switch button.active { background: var(--accent); color: #10131a; }
.sub { color: var(--muted); margin: 0 0 18px; max-width: 70ch; }

/* ── Switch de comparateur (Liberté / Immobilier) ────────────────────────── */
.mode-switch { display: inline-flex; gap: 6px; background: #14171e; border: 1px solid var(--line); border-radius: 10px; padding: 4px; margin-bottom: 24px; flex-wrap: wrap; }
.mode-switch button {
    background: transparent; color: var(--muted); border: none;
    padding: 8px 16px; font-size: 14px; font-weight: 600; cursor: pointer; border-radius: 7px;
    transition: background .15s, color .15s;
}
.mode-switch button:hover { color: var(--text); }
.mode-switch button.active { background: var(--accent); color: #10131a; }
#re-table, #biz-table { width: 100%; border-collapse: collapse; }
.re-ownership { font-size: 13px; color: var(--text); margin: -6px 0 14px; }
.re-profile-desc { font-size: 13px; color: var(--text); margin: 0 0 12px; line-height: 1.5; max-width: 720px; }
.re-hold-hint { font-size: 12px; margin: -6px 0 12px; max-width: 720px; line-height: 1.45; }
.re-excluded { font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
.re-excluded .excl-item { color: #d98a8a; cursor: help; border-bottom: 1px dotted #d98a8a; }
.re-sources { font-size: 11px; color: var(--muted); margin-top: 14px; }
.re-sources a { color: var(--accent); text-decoration: none; }
.re-sources a:hover { text-decoration: underline; }
.detail-item .src { color: var(--accent); text-decoration: none; font-size: 11px; }
.detail-item .src-est { color: var(--muted); font-size: 10px; font-style: italic; }
.cities-block { padding: 0 16px 12px; }
.cities-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 8px; }
.cities-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.city-card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.city-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.city-name { font-weight: 600; font-size: 14px; }
.city-pop { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.city-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.city-chip { font-size: 11px; padding: 3px 8px; border-radius: 999px; background: #20242d; border: 1px solid var(--line); white-space: nowrap; }
.city-chip.ok { background: #173a2a; border-color: #2e6b4d; }
.city-chip.off { background: transparent; color: var(--muted); }
[data-theme="light"] .city-chip { background: #eef1f5; }
[data-theme="light"] .city-chip.ok { background: #dcf3e6; border-color: #9bd8b8; }
.re-portal { padding: 0 16px 14px; }
.re-portal a { display: inline-block; background: var(--accent); color: #10131a; font-weight: 600; font-size: 13px; padding: 7px 14px; border-radius: 8px; text-decoration: none; }
.re-portal a:hover { filter: brightness(1.1); }
em { color: var(--text); font-style: italic; }

.panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 28px;
}
@media (max-width: 720px) { .panel { grid-template-columns: 1fr; } }
.block-label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 12px; }
.total { color: var(--accent); margin-left: 6px; letter-spacing: 0; }

.presets {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}
.preset {
    position: relative;
    text-align: left;
    background: #20242d;
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: 8px;
    padding: 12px 14px;
    min-height: 56px;
    cursor: pointer;
    user-select: none;            /* un glissé ne sélectionne plus le texte */
    transition: border-color .15s, background .15s;
}
.preset:hover { border-color: var(--accent); }
.preset.active { border-color: var(--accent); background: #1c2740; }
/* les clics visent toujours le bouton, jamais les <span> internes */
.preset .pname,
.preset .pdesc,
.preset .ptip { display: block; pointer-events: none; }
.preset .pname { font-weight: 600; font-size: 13px; }
.preset .pdesc { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* Infobulle au survol */
.preset .ptip {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    width: 240px;
    max-width: 80vw;
    background: #0b0d11;
    border: 1px solid var(--accent);
    /* Fond toujours sombre : ne pas hériter de --text (foncé en thème clair). */
    color: #e8f0ec;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.45;
    text-align: left;
    padding: 9px 11px;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .45);
    opacity: 0;
    visibility: hidden;
    transition: opacity .15s;
    z-index: 20;
}
.preset .ptip::after {           /* petite flèche */
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--accent);
}
.preset:hover .ptip,
.preset:focus-visible .ptip { opacity: 1; visibility: visible; }
.regime-badge:hover .rtip,
.regime-badge:focus-visible .rtip { opacity: 1; visibility: visible; }

@media (hover: none) {
    .preset .ptip {
        position: static;
        transform: none;
        width: auto;
        max-width: none;
        opacity: 1;
        visibility: visible;
        margin-top: 6px;
        box-shadow: none;
        border-color: var(--line);
        background: transparent;
        padding: 0;
    }
    .preset .ptip::after { display: none; }
    .regime-badge .rtip {
        position: static;
        width: auto;
        max-width: none;
        display: block;
        margin-top: 4px;
        opacity: 1;
        visibility: visible;
        box-shadow: none;
        border-color: var(--line);
        background: transparent;
        color: var(--muted);
        padding: 0;
    }
}

.switch:focus-within .slider-track {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.panel-close:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
#map .country:focus-visible {
    stroke: #fff;
    stroke-width: 1.2;
}

.sliders { display: flex; flex-direction: column; gap: 14px; }
.slider-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.slider-row label { font-size: 13px; font-weight: 600; }
.slider-row .val { font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 600; min-width: 42px; text-align: right; }
.slider-desc { grid-column: 1 / -1; margin: 2px 0 2px; font-size: 11px; line-height: 1.4; color: var(--muted); }
.slider-row input[type=range] { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); }

table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.table-scroll { width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll table { min-width: 0; width: 100%; }
#ranking { min-width: 0; width: 100%; }
#list-wrap { max-width: 100%; overflow-x: hidden; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
#ranking th:nth-child(1), #ranking td:nth-child(1),
#re-table th:nth-child(1), #re-table td:nth-child(1),
#biz-table th:nth-child(1), #biz-table td:nth-child(1) { width: 3rem; }
#ranking th:nth-child(3), #ranking td:nth-child(3),
#re-table th:last-child, #re-table td:last-child,
#biz-table th:last-child, #biz-table td:last-child { width: 5.5rem; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); cursor: pointer; user-select: none; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr.main { cursor: pointer; }
tbody tr.main:hover { background: #1d212a; }
tbody tr.main:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
    background: #1d212a;
}
.tname-cell { min-width: 0; overflow-wrap: anywhere; }
.tname-text { overflow-wrap: anywhere; }
.tname-sub {
    margin-top: 2px; font-size: 11px; line-height: 1.35; color: var(--muted);
    overflow-wrap: anywhere;
}
.biz-blurb {
    margin: 12px 16px 0; padding: 10px 12px;
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    border: 1px solid var(--line); border-radius: 8px;
    font-size: 13px; line-height: 1.45; color: var(--text);
}
.biz-detail-hint { margin: 8px 16px 0; font-size: 12px; color: var(--muted); line-height: 1.4; }
.biz-detail-hint + .biz-detail-hint { margin-top: 4px; }
.biz-detail-hint:last-of-type { margin-bottom: 12px; }
.detail-item.dimmed { opacity: .55; }
@media (min-width: 641px) {
    #biz-table .tname-sub { display: none; }
}
.expand-cue {
    display: inline-block;
    width: 1em;
    margin-right: 6px;
    color: var(--muted);
    font-size: 12px;
}
.score-pill { display: inline-block; min-width: 48px; padding: 2px 8px; border-radius: 6px; color: #10131a; font-weight: 700; font-variant-numeric: tabular-nums; }

.detail td { background: #14171e; padding: 0; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; padding: 14px 16px; }
.detail-item { background: #1b1f27; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.detail-item .dlabel { font-size: 11px; color: var(--muted); }
.detail-item .drow { display: flex; justify-content: space-between; margin-top: 4px; font-size: 13px; }
.detail-item .contrib { color: var(--accent); font-variant-numeric: tabular-nums; }
.detail-item-trend .trend-lines { margin-top: 6px; }
.detail-item-trend .trend-line {
    display: flex; justify-content: space-between; gap: 8px;
    font-size: 12px; line-height: 1.55; font-variant-numeric: tabular-nums;
}
.detail-item-trend .trend-line + .trend-line { margin-top: 2px; }
.detail-item-trend .trend-score { margin-top: 6px; }
.detail-item.regime-on { border-color: #d9a441; background: #241f15; }
.detail-item.regime-on .dlabel { color: #e0b84f; }
.muted { color: var(--muted); }
/* ── Toggle régimes spéciaux ─────────────────────────────────────────────── */
.regime-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 20px;
}
.regime-text { display: flex; flex-direction: column; }
.regime-name { font-weight: 600; font-size: 14px; }
.regime-help { font-size: 12px; color: var(--muted); margin-top: 2px; max-width: 70ch; }

/* interrupteur (checkbox stylé) */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex: 0 0 auto; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.slider-track {
    position: absolute; inset: 0;
    background: #2a2f3a; border: 1px solid var(--line); border-radius: 999px;
    transition: background .15s;
}
.slider-track::before {
    content: ''; position: absolute; left: 3px; top: 50%; transform: translateY(-50%);
    width: 18px; height: 18px; border-radius: 50%; background: #c9ced8; transition: transform .15s;
}
.switch input:checked + .slider-track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .slider-track::before { transform: translate(20px, -50%); background: #fff; }

/* ── Badge régime dans le tableau ────────────────────────────────────────── */
.regime-badge {
    position: relative;
    display: inline-block;
    margin-left: 8px;
    padding: 1px 7px;
    font-size: 11px; font-weight: 600;
    color: #1a1407; background: #e0b84f; border-radius: 999px;
    cursor: help;
}
.regime-badge .rtip {
    position: absolute;
    left: 0; bottom: calc(100% + 8px);
    width: 260px; max-width: 70vw;
    background: #0b0d11; border: 1px solid #e0b84f;
    /* Fond toujours sombre : ne pas hériter de --text (foncé en thème clair). */
    color: #e8f0ec;
    font-size: 12px; font-weight: 400; line-height: 1.45; text-align: left;
    padding: 9px 11px; border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .45);
    opacity: 0; visibility: hidden; transition: opacity .15s; z-index: 30;
}
.regime-badge:hover .rtip { opacity: 1; visibility: visible; }

/* ── Barre de vue (Liste / Carte) ────────────────────────────────────────── */
.view-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.view-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.view-switch button {
    background: #20242d; color: var(--muted); border: none;
    padding: 7px 18px; font-size: 13px; font-weight: 600; cursor: pointer;
    transition: background .15s, color .15s;
}
.view-switch button + button { border-left: 1px solid var(--line); }
.view-switch button.active { background: var(--accent); color: #10131a; }
.count-info { font-size: 12px; color: var(--muted); }

.search-field { flex: 1 1 180px; min-width: 140px; max-width: 280px; }
.search-field input[type="search"] {
    width: 100%;
    background: var(--card);
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 13px;
}
.search-field input[type="search"]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.search-empty { padding: 18px 12px; color: var(--muted); font-size: 14px; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.weight-hint {
    margin: 12px 0 0;
    font-size: 12px;
    line-height: 1.45;
    color: #e0b84f;
    max-width: 48ch;
}
.normalize-btn {
    margin-top: 10px;
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.normalize-btn:hover { background: #1c2740; }
.normalize-btn:focus-visible,
.boot-retry:focus-visible,
.theme-toggle:focus-visible,
.preset:focus-visible,
.lang-switch button:focus-visible,
.mode-switch button:focus-visible,
.view-switch button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.boot-status {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 20px 18px;
    margin-bottom: 24px;
}
.boot-status[data-state="loading"] { border-color: var(--line); }
.boot-status[data-state="error"] { border-color: #d98a8a; }
.boot-message { margin: 0; font-size: 14px; color: var(--text); }
.boot-retry {
    margin-top: 12px;
    background: var(--accent);
    color: #10131a;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
[data-theme="light"] .search-field input[type="search"] { background: #ffffff; }
[data-theme="light"] .normalize-btn:hover { background: #e2ecff; }

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

/* ── Carte ───────────────────────────────────────────────────────────────── */
.map-box {
    position: relative;
    background: #0c0e13; border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
    touch-action: none; /* pinch / drag gérés en JS */
}
#map {
    display: block; width: 100%; height: auto;
    cursor: grab; user-select: none;
}
#map.is-panning { cursor: grabbing; }
#map .ocean { fill: #0c0e13; pointer-events: none; }
#map .country {
    stroke: #0c0e13; stroke-width: .4;
    fill: var(--map-empty);
    cursor: pointer; transition: opacity .1s;
}
#map .country:hover { opacity: .8; }
#map .country.selected { stroke: #fff; stroke-width: 1.1; }
#map .region {
    fill: transparent;
    stroke: rgba(240, 243, 248, .45);
    stroke-width: 0.55;
    cursor: pointer;
}
#map .region.has-score { fill-opacity: 1; stroke: rgba(12, 14, 19, .4); }
#map .region.selected { stroke: #fff; stroke-width: 1.2; }
[data-theme="light"] #map .region { stroke: rgba(26, 29, 36, .4); }
[data-theme="light"] #map .region.selected { stroke: #1a1d24; }
#map .marker { stroke: #0c0e13; stroke-width: 1; cursor: pointer; }
#map .marker:hover { stroke: #fff; }
#map .marker.selected { stroke: #fff; stroke-width: 1.5; }
#map .marker.hub-dot { stroke: #f0f3f8; }
#map .marker.variant-dot { opacity: .92; }

.map-zoom {
    position: absolute; right: 10px; bottom: 10px;
    display: flex; flex-direction: column; gap: 4px; z-index: 2;
}
.map-zoom button {
    width: 34px; height: 34px; padding: 0;
    background: var(--card); color: var(--text);
    border: 1px solid var(--line); border-radius: 8px;
    font-size: 18px; line-height: 1; font-weight: 600;
    cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
.map-zoom button:hover { border-color: var(--accent); color: var(--accent); }
.map-zoom button:disabled { opacity: .4; cursor: default; }
.map-zoom button:disabled:hover { border-color: var(--line); color: var(--text); }
[data-theme="light"] .map-zoom button { box-shadow: 0 2px 8px rgba(0, 0, 0, .08); }

/* ── Panneau d'avantages ─────────────────────────────────────────────────── */
.country-panel {
    position: relative;
    margin-top: 14px;
    background: var(--card); border: 1px solid var(--line); border-radius: 12px;
    padding: 16px 18px; min-height: 60px;
}
.map-hint { color: var(--muted); font-size: 13px; margin: 4px 0; }
.panel-close {
    position: absolute; top: 10px; right: 12px;
    background: none; border: none; color: var(--muted);
    font-size: 22px; line-height: 1; cursor: pointer;
}
.panel-close:hover { color: var(--text); }
.panel-title { margin: 0 0 12px; font-size: 18px; padding-right: 24px; }
.tcard { border-top: 1px solid var(--line); padding: 12px 0; cursor: pointer; border-radius: 6px; }
.tcard:first-of-type { border-top: none; }
.tcard:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.tcard.focused { outline: 1px solid var(--accent); outline-offset: 2px; background: color-mix(in srgb, var(--accent) 12%, transparent); }
.tcard-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tcard-head .tname { font-weight: 600; }
.adv-regime { margin-top: 8px; font-size: 12px; color: #e0b84f; }
.adv-list { margin: 8px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 3px; }
.adv-list li { font-size: 13px; }
.adv-list li.muted { list-style: none; margin-left: -18px; }

/* ── Bloc fiscal (personnel vs entreprise) ───────────────────────────────── */
.fiscal { margin-top: 10px; background: #1b1f27; border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; font-size: 12px; }
.fiscal .frow { margin: 2px 0; }
.fiscal .flabel { display: inline-block; min-width: 74px; color: var(--muted); text-transform: uppercase; font-size: 10px; letter-spacing: .04em; }
.fiscal b { color: var(--text); font-weight: 600; }
.fiscal .fnote { margin-top: 4px; font-size: 10px; color: var(--muted); font-style: italic; }
.fiscal-na { color: var(--muted); font-style: italic; }
.detail .fiscal { margin: 10px 16px 14px; }
.homeschool .hs-note { margin-top: 4px; color: var(--text); line-height: 1.4; }
.homeschool .hs-free { color: #2ecf9a; }
.homeschool .hs-regulated { color: #6eb6e0; }
.homeschool .hs-restricted { color: #e0b84f; }
.homeschool .hs-banned { color: #e07a7a; }
.homeschool .hs-grey,
.homeschool .hs-unknown { color: var(--muted); }

/* ── Mobile : tables Immo / Business allégées ─────────────────────────────── */
@media (max-width: 640px) {
    body { overflow-x: hidden; }
    .wrap { padding: 20px 12px 48px; overflow-x: hidden; max-width: 100%; }
    h1 { font-size: 22px; }
    .topbar { flex-wrap: wrap; }
    .col-optional { display: none; }
    .table-scroll { overflow-x: hidden; }
    .table-scroll table { min-width: 0; }
    th, td { padding: 10px 8px; }
    .detail-grid { grid-template-columns: 1fr; }
    .panel { padding: 14px; }
    .preset { min-height: 48px; padding: 10px 12px; }
    .score-pill { min-width: 42px; padding: 2px 6px; font-size: 13px; }
    .regime-badge { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
}

.pager {
    display: flex; align-items: center; justify-content: center; gap: 12px;
    margin: 14px 0 4px; flex-wrap: wrap;
}
.pager-btn {
    background: #20242d; color: var(--text); border: 1px solid var(--line);
    border-radius: 8px; padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.pager-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pager-btn:disabled { opacity: .4; cursor: not-allowed; }
.pager-info { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
[data-theme="light"] .pager-btn { background: #eef1f5; }

/* ── Multi-variantes carte ───────────────────────────────────────────────── */
#map .country.has-variants {
    stroke: var(--accent);
    stroke-width: 0.9;
    stroke-dasharray: 3 2;
}
#map .country.has-variants.selected { stroke-dasharray: none; }

/* ── Comparateur / CSV / confiance ───────────────────────────────────────── */
.compare-bar {
    background: var(--card); border: 1px solid var(--line); border-radius: 12px;
    padding: 14px 16px; margin-bottom: 16px;
}
.compare-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.compare-picks { display: flex; flex-wrap: wrap; gap: 8px; min-height: 28px; align-items: center; }
.compare-chip {
    background: #1c2a25; border: 1px solid var(--accent-dim); color: var(--text);
    border-radius: 999px; padding: 4px 10px; font-size: 12px; cursor: pointer;
}
[data-theme="light"] .compare-chip { background: #e7f5ef; }
.compare-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13px; }
.compare-table th, .compare-table td { border-bottom: 1px solid var(--line); padding: 8px; text-align: right; }
.compare-table th:first-child, .compare-table td:first-child { text-align: left; }
.cmp-check { margin-right: 6px; cursor: pointer; }
.cmp-check input { accent-color: var(--accent); }
.conf { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; margin-left: 6px; color: var(--muted); }
.conf-high { color: var(--accent); }
.conf-low { color: var(--warn); }
.jtype { font-size: 10px; color: var(--muted); margin-left: 8px; text-transform: uppercase; }
.fiscal-range { color: var(--muted); font-size: 11px; }
.meta-asof { font-size: 11px; color: var(--muted); margin: -12px 0 16px; }
.re-custom { margin: 10px 0 14px; display: grid; gap: 8px; }
.re-custom-row { display: grid; grid-template-columns: 110px 1fr 42px; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.re-custom-row input { width: 100%; accent-color: var(--accent); }

/* Motion */
.preset, .mode-switch button, .score-pill { transition: transform .15s ease, background .15s ease, border-color .15s ease; }
.preset:hover { transform: translateY(-1px); }
.mode-switch button.active { box-shadow: 0 0 0 1px var(--accent-dim); }

#map .hatch-overlay { pointer-events: none; opacity: .55; }
#map .variant-count { fill: var(--text); font-weight: 700; opacity: .85; }
.map-legend {
    position: absolute; left: 10px; bottom: 10px; z-index: 2;
    display: flex; flex-direction: column; gap: 4px;
    background: rgba(20, 28, 25, .85); border: 1px solid var(--line);
    border-radius: 8px; padding: 8px 10px; font-size: 11px; color: var(--muted);
}
[data-theme="light"] .map-legend { background: rgba(255,255,255,.9); }
.leg-item { display: flex; align-items: center; gap: 6px; }
.leg-poly, .leg-dash, .leg-dot {
    display: inline-block; width: 14px; height: 10px; border-radius: 2px;
}
.leg-poly { background: #7dcea0; }
.leg-dash { background: transparent; border: 1.5px dashed var(--accent); }
.leg-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

.map-hubs {
    position: absolute; left: 10px; right: 56px; bottom: 78px; z-index: 2;
    display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
    max-height: 72px; overflow: auto;
    pointer-events: none;
}
.map-hubs .hubs-label {
    font-size: 10px; text-transform: uppercase; letter-spacing: .04em;
    color: var(--muted); pointer-events: none; width: 100%;
}
.map-hubs .hub-chip {
    pointer-events: auto;
    border: 1px solid var(--line); background: rgba(20, 28, 25, .88);
    color: var(--text); font-size: 11px; padding: 4px 8px; border-radius: 999px;
    cursor: pointer;
}
[data-theme="light"] .map-hubs .hub-chip { background: rgba(255,255,255,.92); }
.map-hubs .hub-chip:hover, .map-hubs .hub-chip.active {
    border-color: var(--accent); color: var(--accent);
}
.map-hubs .hub-range {
    opacity: .7; font-variant-numeric: tabular-nums; margin-left: 2px;
}
