      :root {
    --bg: #eef3f9;
    --card: rgba(255,255,255,0.94);
    --line: #dbe5f0;
    --text: #172433;
    --muted: #64748b;
    --primary: #0f4c81;
    --primary-2: #2563eb;
    --accent: #0f766e;
    --soft: #eff6ff;
    --shadow: 0 20px 50px rgba(15, 23, 42, 0.10);
    --radius: 18px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Inter, Arial, Helvetica, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(59,130,246,0.12), transparent 30%),
        radial-gradient(circle at top right, rgba(15,118,110,0.10), transparent 28%),
        linear-gradient(180deg, #edf3f9 0%, #f8fbff 100%);
    color: var(--text);
}

.page {
    max-width: 1540px;
    margin: 0 auto;
    padding: 28px;
}

.page-hero {
    position: relative;
    overflow: visible;
    background: linear-gradient(135deg, #0f2742 0%, #123d6d 55%, #2563eb 100%);
    color: #fff;
    border-radius: 24px;
    padding: 28px 32px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
    margin-bottom: 24px;
}

.page-hero::before,
.page-hero::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,0.07);
    pointer-events: none;
}

.page-hero::before {
    width: 260px;
    height: 260px;
    top: -120px;
    right: -60px;
}

.page-hero::after {
    width: 180px;
    height: 180px;
    bottom: -80px;
    right: 180px;
}

.page-hero__inner {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 34px;
    align-items: center;
}

.page-hero__logo-link {
    display: block;
    text-decoration: none;
}

.page-hero__logo-wrap {
    width: 220px;
    border-radius: 22px;
    background: rgba(255,255,255,0.96);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    box-shadow: 0 14px 34px rgba(0,0,0,0.18);
}

.page-hero__logo {
    width: 100%;
    max-width: 180px;
    height: auto;
    display: block;
}

.page-hero__content {
    min-width: 0;
}

.page-hero__topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 14px;
}

.page-hero__kicker {
    display: inline-block;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.14);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.page-hero__menu,
.page-hero__submenu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.page-hero__nav-top {
    position: relative;
    z-index: 3000;
}

/* CORRECTIF : Alignement horizontal des items du menu */
.page-hero__nav-top .page-hero__menu {
    display: flex;
    gap: 12px;
    align-items: center;
}

.page-hero__menu-item {
    position: relative;
    display: flex;
    align-items: center;
}

/* CORRECTIF : Suppression du padding-bottom qui dÃ©calait le bouton */
.page-hero__menu-item--dropdown {
    position: relative;
    padding-bottom: 0; 
}

.page-hero__nav-top .page-hero__menu-item > a,
.page-hero__nav-top .page-hero__menu-link {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 14px;
    border: none;
    border-radius: 10px;
    background: rgba(255,255,255,0.12);
    color: #fff;
    font-size: 14px;
    font-family: inherit;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    line-height: 1;
    appearance: none;
    -webkit-appearance: none;
}

.page-hero__nav-top .page-hero__menu-link:focus {
    outline: none;
}

.page-hero__nav-top .page-hero__menu-item > a:hover,
.page-hero__nav-top .page-hero__menu-link:hover {
    background: rgba(255,255,255,0.22);
    transform: translateY(-1px);
}

.page-hero__nav-top .page-hero__submenu {
    position: absolute;
    top: 100%;
    right: 0;
    left: auto;
    min-width: 280px;
    max-height: 320px;
    overflow-y: auto;
    overflow-x: hidden;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    display: none;
    z-index: 9999;
    margin-top: 8px; /* Espace pour compenser la suppression du padding */
}

/* Zone invisible pour maintenir le menu ouvert au survol */
.page-hero__menu-item--dropdown::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 12px;
}

.page-hero__submenu li a {
    display: block;
    padding: 12px 16px;
    color: #172433;
    text-decoration: none;
    font-size: 14px;
    border-bottom: 1px solid #eef2f7;
    white-space: nowrap;
}

.page-hero__submenu li:last-child a {
    border-bottom: none;
}

.page-hero__submenu li a:hover {
    background: #f8fbff;
}

.page-hero__menu-item--dropdown:hover > .page-hero__submenu {
    display: block !important;
}

.page-hero__title {
    margin: 0;
    font-size: clamp(26px, 3.2vw, 46px);
    line-height: 1.15;
    letter-spacing: -0.01em;
    max-width: 780px;
}
.page-hero__intro {
    margin: 18px 0 0;
    max-width: 760px;
    font-size: 17px;
    line-height: 1.7;
    color: rgba(255,255,255,0.9);
}

.card {
    background: var(--card);
    border: 1px solid rgba(219, 229, 240, 0.9);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
    margin-bottom: 22px;
}

.card-header {
    padding: 18px 22px 0 22px;
}

.card-header h2 {
    margin: 0;
    font-size: 20px;
}

.card-body {
    padding: 22px;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px 14px;
    align-items: end;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.field label {
    font-size: 13px;
    font-weight: 800;
    color: var(--muted);
}

.field input,
.field select {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: 13px;
    padding: 11px 13px;
    font-size: 14px;
    background: #fff;
    color: var(--text);
    transition: 0.2s ease;
}

.field input:focus,
.field select:focus {
    outline: none;
    border-color: #93c5fd;
    box-shadow: 0 0 0 4px rgba(37,99,235,0.10);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
}

.btn {
    border: none;
    border-radius: 13px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: 0.2s ease;
}

.btn-primary {
    background: var(--primary-2);
    color: #fff;
}

.btn-primary:hover { background: #1d4ed8; }

.btn-secondary {
    background: #e8eff8;
    color: #27405e;
}

.btn-secondary:hover { background: #dbe7f5; }

.btn-visualiser {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 26px;
    height: 26px;
    min-width: 26px;
    padding: 0;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
    color: #1d4ed8;
    font-size: 0.82rem;
    font-weight: 800;
    box-shadow: 0 6px 14px rgba(29, 78, 216, 0.12);
}

.btn-visualiser:hover {
    transform: translateY(-1px);
    background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);
}

.btn-visualiser:disabled {
    cursor: wait;
    opacity: 0.75;
    transform: none;
}

.btn-export {
    background: var(--accent);
    color: #fff;
}

.btn-export:hover { background: #0d5f58; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.stats-grid .stat {
    background: linear-gradient(180deg, #fbfdff 0%, #f2f7fd 100%);
    border: 1px solid #e1eaf4;
    border-radius: 16px;
    padding: 10px 12px;
}

.stats-grid .stat .label {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stats-grid .stat .value {
    font-size: 1.05rem;
    font-weight: 900;
    line-height: 1.2;
}

.stats-grid .stat .sub {
    display: none;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.topbar-right {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.pill {
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--soft);
    color: var(--primary-2);
    font-weight: 800;
    font-size: 13px;
}

.table-wrap {
    overflow: auto;
    border: 1px solid #ebf1f7;
    border-radius: 16px;
    max-width: 100%;
}

.table-wrap thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fff;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 1280px;
    background: #fff;
    table-layout: auto;
}

thead th {
    position: sticky;
    top: 0;
    background: #f7fbff;
    color: #334155;
    font-size: 12px;
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid #e5edf6;
    white-space: nowrap;
}

thead th.sortable {
    cursor: pointer;
    user-select: none;
}

tbody td {
    padding: 10px;
    border-bottom: 1px solid #eef2f7;
    vertical-align: top;
    font-size: 13px;
}

tbody tr:hover {
    background: #fbfdff;
}

.num {
    text-align: right;
    white-space: nowrap;
}

.muted {
    color: var(--muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.badge-yes {
    background: #dcfce7;
    color: #166534;
}

.badge-no {
    background: #f1f5f9;
    color: #475569;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination .btn {
    padding: 10px 14px;
}

.footer-note {
    margin-top: 12px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.empty {
    text-align: center;
    color: var(--muted);
    padding: 30px;
}

.empty strong {
    display: block;
    color: var(--text);
    font-size: 17px;
    margin-bottom: 6px;
}

.charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    align-items: stretch;
}

.chart-panel {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px;
    background: rgba(255,255,255,0.72);
}

.chart-panel h3 {
    margin: 0 0 12px;
    font-size: 16px;
}

.chart-box {
    position: relative;
    min-height: 280px;
}

.chart-box.chart-box-year {
    min-height: 320px;
    height: 320px;
}

.chart-box.chart-box-segment {
    min-height: 380px;
    height: 540px;
    transition: height 0.2s ease;
}

.loader {
    display: none;
    font-size: 14px;
    color: var(--muted);
    font-weight: 800;
}

.loader.show {
    display: inline-block;
}

.hidden {
    display: none !important;
}

.site-footer {
    margin-top: 40px;
    padding: 20px;
    text-align: center;
    border-top: 1px solid var(--line);
    background: rgba(255,255,255,0.85);
    font-size: 13px;
    color: var(--muted);
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-links {
    margin-top: 8px;
}

.footer-links a {
    color: var(--primary-2);
    text-decoration: none;
    font-weight: 600;
}

.footer-links a:hover {
    text-decoration: underline;
}

.footer-contact {
    margin: 10px 0 0;
}

.footer-contact a {
    color: var(--primary-2);
    text-decoration: none;
    font-weight: 600;
}

.footer-contact a:hover {
    text-decoration: underline;
}

.card-intro {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.55;
}

.context-note {
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(37,99,235,0.08);
    border: 1px solid rgba(37,99,235,0.14);
    color: var(--text);
    line-height: 1.6;
}

@media (max-width: 768px) {
    .page-hero {
        padding: 22px 20px;
        border-radius: 18px;
    }

    .page-hero__inner {
        grid-template-columns: 140px minmax(0, 1fr);
        gap: 14px;
        align-items: start;
    }

    .page-hero__logo-wrap {
        width: 140px;
        padding: 10px;
        border-radius: 16px;
    }

    .page-hero__logo {
        max-width: 118px;
    }

    .page-hero__content {
        display: contents;
    }

    .page-hero__topbar {
        grid-column: 2;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        margin-bottom: 0;
        min-width: 0;
    }

    .page-hero__kicker {
        font-size: 10px;
        padding: 5px 9px;
        white-space: nowrap;
    }

    .page-hero__nav-top .page-hero__menu {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
    }

    .page-hero__nav-top .page-hero__menu-item > a,
    .page-hero__nav-top .page-hero__menu-link {
        height: 32px;
        padding: 0 10px;
        font-size: 12px;
    }

    /* Titre et intro en dessous, sur toute la largeur */
    .page-hero__title,
    .page-hero__intro {
        grid-column: 1 / -1;
    }

    .page-hero__title {
        margin-top: 4px;
        font-size: 28px;
    }

    .page-hero__intro {
        margin-top: 10px;
        font-size: 14px;
    }

    .page-hero__nav-top .page-hero__submenu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: auto;
    min-width: 220px;
    max-width: min(92vw, 320px);
    max-height: 260px;
    overflow-y: auto;
    overflow-x: hidden;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.18);
    display: none;
    z-index: 9999;
}
    .page-hero__menu-item--dropdown.is-open > .page-hero__submenu {
    display: block !important;
}

}

@media (max-width: 380px) {
    .page-hero__inner {
        grid-template-columns: 1fr;
    }

    .page-hero__topbar,
    .page-hero__title,
    .page-hero__intro {
        grid-column: 1;
    }

    .page-hero__logo-wrap {
        width: 150px;
    }

    .page-hero__nav-top .page-hero__menu {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* === Page: ventes-terrains-viz.php === */
.filters-simple-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 14px;
    align-items: end;
    margin-bottom: 14px;
}

.filters-grid .field.field-equal,
.filters-grid .field,
.filters-simple-grid .field {
    min-width: 0;
}

.filters-simple-grid .field label,
.filters-grid .field label {
    margin-bottom: 5px;
    font-size: 0.88rem;
    font-weight: 700;
}

.filters-simple-grid .field input,
.filters-simple-grid .field select,
.filters-grid .field input,
.filters-grid .field select {
    min-height: 44px;
    padding: 10px 14px;
    font-size: 0.98rem;
    border-radius: 14px;
}

.filters-simple-grid .actions,
.filters-grid .actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.filters-simple-grid .actions .btn,
.filters-grid .actions .btn {
    min-height: 44px;
    white-space: nowrap;
}

.actions-primary .btn {
    width: 100%;
}

.filters-advanced-wrap {
    border-top: 1px solid #e7edf5;
    padding-top: 14px;
}

.filters-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 16px;
    border: 1px solid #d9e4f2;
    border-radius: 14px;
    background: #f8fbff;
    color: #1f3b63;
    font-size: 0.98rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.filters-toggle:hover {
    background: #f1f7ff;
    border-color: #c8d9ef;
}

.filters-toggle__icon {
    font-size: 1.2rem;
    line-height: 1;
    font-weight: 700;
}

.advanced-filters {
    margin-top: 14px;
}

.advanced-filters.hidden {
    display: none;
}

.filters-grid-advanced {
    padding-top: 2px;
}

.filters-grid-advanced-compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    align-items: stretch;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    border: 1px solid #e1eaf4;
    border-radius: 16px;
    background: linear-gradient(180deg, #fbfdff 0%, #f4f8fd 100%);
}

.filter-group__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.filter-group__title {
    font-size: 0.96rem;
    font-weight: 800;
    color: #18324d;
}

.filter-group__hint {
    color: #64748b;
    font-size: 0.8rem;
    font-weight: 700;
}

.filter-group__fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
}

.filter-group__fields--range {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.filter-group .field {
    gap: 5px;
}

.filter-group .field label {
    margin-bottom: 0;
    font-size: 0.8rem;
    color: #5f6b7a;
}

.filter-group .field input,
.filter-group .field select {
    min-height: 42px;
    padding: 9px 12px;
    font-size: 0.94rem;
    border-radius: 12px;
}

.filters-advanced-actions {
    margin-top: 14px;
    display: flex;
    justify-content: flex-end;
}

.filters-advanced-actions .actions {
    flex-wrap: wrap;
}

.filters-advanced-actions .btn {
    flex: 0 0 auto;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(320px, 0.95fr) minmax(420px, 1.25fr);
    gap: 16px;
    align-items: stretch;
}

.dashboard-grid > .card {
    margin-bottom: 0;
}

.chart-panel-stack {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    align-items: stretch;
    width: 100%;
}

.chart-box-year {
    height: 320px;
}

.chart-card-fullwidth {
    width: 100%;
    margin-top: 16px;
}

.chart-box-segment {
    width: 100%;
    min-height: 420px;
    height: 420px;
}

.topbar,
.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.pagination {
    margin-left: auto;
}

.pagination-bottom {
    margin-top: 12px;
    justify-content: flex-end;
}

.topbar-left {
    min-width: 260px;
}

.results-title {
    margin: 0;
}

.results-intro {
    margin: 4px 0 0;
    color: #5f6b7a;
    font-size: 0.95rem;
}

.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 14px;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #eef4ff;
    font-size: 0.9rem;
    font-weight: 600;
}

.feedback {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 0.95rem;
}

.feedback-info {
    background: #eef4ff;
    color: #1d3d73;
}

.feedback-error {
    background: #fff1f1;
    color: #7a1f1f;
}

.map-icon {
    font-size: 0.82rem;
    line-height: 1;
}

.map-label {
    display: none;
}

@media (max-width: 1180px) {
    .filters-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .filters-grid-advanced-compact {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filters-simple-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-grid,
    .chart-panel-stack {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .chart-box-year {
        height: 250px;
    }

    .chart-box-segment {
        min-height: 360px;
    }

    .filters-grid,
    .filters-simple-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filters-simple-grid .actions,
    .filters-advanced-actions .actions {
        flex-wrap: wrap;
    }

    .filters-advanced-actions {
        justify-content: stretch;
    }

    .filters-advanced-actions .actions {
        width: 100%;
        justify-content: flex-end;
    }

    .filters-advanced-actions .actions .btn {
        flex: 1 1 calc(50% - 10px);
    }

    .filters-advanced-actions .btn-primary {
        min-width: 220px;
    }

    .btn-visualiser {
        width: 30px;
        height: 30px;
    }

    .topbar-left {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .filters-grid,
    .filters-simple-grid,
    .filters-grid-advanced-compact {
        grid-template-columns: 1fr;
    }

    /* On garde les paires min/max et début/fin sur 2 colonnes */
    .filter-group__fields--range {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .filter-group {
        padding: 12px;
    }

    .field-simple-actions {
        grid-column: auto;
        min-width: 0;
    }

    .filters-toggle {
        padding: 11px 14px;
    }

    .filters-advanced-actions .actions .btn {
        flex: 1 1 100%;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Ultra petit écran */
@media (max-width: 380px) {
    .filter-group__fields--range {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 560px) {
    .page {
        padding: 14px;
    }

    .card-body {
        padding: 16px;
    }
}
