/* ============================================
   BRUTALIST MODERN — Erogazioni Politiche
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
    --black: #0a0a0a;
    --white: #ffffff;
    --off-white: #f7f7f5;
    --gray-100: #f0f0ec;
    --gray-200: #e4e4df;
    --gray-400: #a8a89e;
    --gray-600: #6b6b63;
    --red: #e63946;
    --blue: #1d3557;
    --green: #2a9d8f;
    --amber: #e9c46a;
    --font: 'Space Grotesk', system-ui, sans-serif;
    --mono: 'JetBrains Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font);
    background: var(--off-white);
    color: var(--black);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: inherit; text-decoration: none; }

main { flex: 1; }


/* === NAV === */
.site-nav {
    background: var(--black);
    color: var(--white);
    padding: 0 3rem;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
}

.nav-logo-img {
    height: 44px;
    width: auto;
}

.nav-brand .dot {
    width: 10px; height: 10px;
    background: var(--red);
    border-radius: 2px;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-right a {
    color: var(--gray-400);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    transition: color 0.15s;
}

.nav-right a:hover { color: var(--white); }

.search-box { position: relative; }

.search-box input {
    background: transparent;
    border: 2px solid rgba(255,255,255,0.15);
    color: var(--white);
    padding: 0.45rem 0.9rem 0.45rem 2rem;
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 500;
    width: 220px;
    outline: none;
    transition: border-color 0.2s;
}

.search-box input::placeholder { color: rgba(255,255,255,0.3); }
.search-box input:focus { border-color: var(--red); }

.search-box .icon {
    position: absolute;
    left: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    opacity: 0.4;
}

.search-results {
    position: absolute;
    top: calc(100% + 2px);
    left: 0; right: 0;
    background: var(--white);
    border: 2px solid var(--black);
    display: none;
    max-height: 320px;
    overflow-y: auto;
    z-index: 200;
}

.search-results.active { display: block; }

.search-results a {
    display: block;
    padding: 0.6rem 0.9rem;
    font-size: 0.82rem;
    font-weight: 500;
    border-bottom: 1px solid var(--gray-200);
    color: var(--black);
}

.search-results a:hover { background: var(--gray-100); }


/* === HERO === */
.hero {
    background: var(--blue);
    color: var(--white);
    padding: 5rem 3rem 6rem;
    position: relative;
    overflow: hidden;
}

/* grid pattern */
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
}

/* accent stripe */
.hero::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 6px; height: 100%;
    background: var(--red);
}

.hero-inner {
    position: relative;
    z-index: 1;
}

.hero-eyebrow {
    display: inline-block;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--amber);
    border: 2px solid var(--amber);
    padding: 0.3rem 0.8rem;
    margin-bottom: 1.5rem;
}

.hero h1 {
    font-size: 4.2rem;
    font-weight: 700;
    line-height: 0.95;
    letter-spacing: -0.045em;
    max-width: 750px;
}

.hero h1 em {
    font-style: normal;
    color: var(--amber);
    position: relative;
}

.hero h1 em::after {
    content: '';
    position: absolute;
    left: 0; bottom: 2px;
    width: 100%; height: 6px;
    background: var(--red);
    opacity: 0.7;
    z-index: -1;
}

.hero p {
    margin-top: 1.4rem;
    font-size: 1.05rem;
    color: rgba(255,255,255,0.5);
    max-width: 520px;
    line-height: 1.55;
}

.hero-total {
    margin-top: 2.5rem;
    display: flex;
    align-items: baseline;
    gap: 0.8rem;
}

.hero-total .big {
    font-family: var(--mono);
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--green);
}

.hero-total .caption {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.35);
}

/* floating shapes */
.hero-shapes {
    position: absolute;
    top: 0; right: 0;
    width: 45%; height: 100%;
    pointer-events: none;
    z-index: 0;
}

.hero-shapes .shape {
    position: absolute;
    border: 2px solid rgba(255,255,255,0.06);
}

.hero-shapes .s1 {
    width: 200px; height: 200px;
    top: 15%; right: 10%;
    animation: drift 20s ease-in-out infinite;
}

.hero-shapes .s2 {
    width: 120px; height: 120px;
    top: 55%; right: 30%;
    border-color: rgba(230,57,70,0.15);
    animation: drift 15s ease-in-out infinite reverse;
}

.hero-shapes .s3 {
    width: 80px; height: 80px;
    top: 25%; right: 40%;
    border-color: rgba(233,196,106,0.12);
    animation: drift 25s ease-in-out infinite;
}

@keyframes drift {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(-15px, 20px) rotate(3deg); }
    50% { transform: translate(10px, -15px) rotate(-2deg); }
    75% { transform: translate(-8px, -10px) rotate(1deg); }
}

/* hero layout */
.hero-flex {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 3rem;
    max-width: 1200px;
    margin: 0 auto;
}

.hero-left { flex: 1; }

.hero-right {
    flex: 0 0 380px;
    position: relative;
    z-index: 2;
}

.hero-search {
    background: rgba(0,0,0,0.25);
    border: 2px solid rgba(255,255,255,0.12);
    padding: 2rem;
}

.hero-search-label {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--white);
    margin-bottom: 0.3rem;
}

.hero-search-sub {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.4);
    margin-bottom: 1.2rem;
    line-height: 1.4;
}

.search-box--hero input {
    width: 100%;
    background: rgba(255,255,255,0.08);
    border: 2px solid rgba(255,255,255,0.15);
    color: var(--white);
    padding: 0.85rem 1rem 0.85rem 2.4rem;
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 500;
    outline: none;
    transition: border-color 0.2s;
}

.search-box--hero input::placeholder { color: rgba(255,255,255,0.3); }
.search-box--hero input:focus { border-color: var(--amber); }

.search-box--hero .icon {
    font-size: 0.9rem;
    opacity: 0.5;
}

.search-box--hero .search-results {
    border-color: var(--black);
}

/* === LAYOUT === */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 3rem;
}

/* === STAT BAND === */
.stat-band {
    background: var(--black);
    color: var(--white);
    padding: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
}

.stat-band .stat-item {
    padding: 2rem 2.5rem;
    border-right: 1px solid rgba(255,255,255,0.08);
    text-align: center;
}

.stat-band .stat-item:last-child { border-right: none; }

.stat-band .label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--gray-400);
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.stat-band .value {
    font-family: var(--mono);
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.stat-band .value.euro { color: var(--green); }
.stat-band .value.count { color: var(--white); }
.stat-band .value.party { color: var(--amber); }
.stat-band .value.donor { color: var(--red); }
.stat-band .value.period { color: var(--white); font-size: 1.2rem; }


/* === SECTION === */
.section {
    padding: 4rem 0;
}

.section + .section {
    border-top: 2px solid var(--gray-200);
}

.section-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--gray-400);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.section-title {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 2rem;
}

/* === CARDS === */
.card {
    background: var(--white);
    border: 2px solid var(--gray-200);
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 2px solid var(--gray-200);
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gray-600);
}

.card-body { padding: 1.5rem; }

.chart-wrap { position: relative; height: 320px; }

/* === GRID === */
.grid-2 {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 2px;
    background: var(--gray-200);
    border: 2px solid var(--gray-200);
    margin-bottom: 2rem;
}

.grid-2 > .card { border: none; }


/* === TABLES === */
.tbl-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
}

th {
    text-align: left;
    padding: 0.8rem 1.2rem;
    font-weight: 700;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gray-400);
    border-bottom: 2px solid var(--gray-200);
    background: var(--off-white);
    position: sticky;
    top: 0;
}

td {
    padding: 0.7rem 1.2rem;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-600);
}

tr:hover td { background: var(--gray-100); color: var(--black); }

.party-link {
    color: var(--black);
    font-weight: 600;
    border-bottom: 2px solid var(--amber);
    padding-bottom: 1px;
    transition: border-color 0.15s;
}

.party-link:hover { border-color: var(--red); }

.amount {
    font-family: var(--mono);
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--black);
    white-space: nowrap;
}

.rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    font-size: 0.72rem;
    font-weight: 700;
    background: var(--gray-100);
    color: var(--gray-600);
}

.rank.gold { background: var(--amber); color: var(--black); }
.rank.silver { background: var(--gray-200); color: var(--black); }
.rank.bronze { background: #ddb892; color: var(--black); }

.badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    font-size: 0.68rem;
    font-weight: 700;
    font-family: var(--mono);
    background: var(--gray-100);
    color: var(--gray-600);
    letter-spacing: 0.02em;
}

/* === PAGINATION === */
.pagination {
    display: flex;
    gap: 2px;
    justify-content: center;
    padding: 1.5rem;
    background: var(--off-white);
    border-top: 2px solid var(--gray-200);
}

.pagination a,
.pagination span {
    padding: 0.45rem 0.85rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gray-600);
    border: 2px solid var(--gray-200);
    background: var(--white);
    transition: all 0.15s;
}

.pagination a:hover { background: var(--black); color: var(--white); border-color: var(--black); }
.pagination .current { background: var(--black); color: var(--white); border-color: var(--black); }
.pagination .dots { border: none; background: none; color: var(--gray-400); }


/* === PAGE HEAD (detail) === */
.page-head {
    padding: 3rem 0 0;
}

.page-head .back {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gray-400);
    display: inline-block;
    margin-bottom: 1rem;
    transition: color 0.15s;
}

.page-head .back:hover { color: var(--black); }

.page-head h1 {
    font-size: 2.8rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.05;
    margin-bottom: 0.3rem;
}

.page-head .sub {
    color: var(--gray-400);
    font-size: 1rem;
    margin-bottom: 2rem;
}

/* === FOOTER === */
.site-footer {
    background: var(--black);
    color: var(--gray-400);
    padding: 3rem;
    margin-top: 4rem;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 3rem;
}

.footer-brand {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--white);
    margin-bottom: 0.6rem;
}

.footer-col p {
    font-size: 0.75rem;
    line-height: 1.6;
}

.footer-heading {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--gray-600);
    margin-bottom: 0.8rem;
}

.footer-col a {
    display: block;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--gray-400);
    padding: 0.25rem 0;
    transition: color 0.15s;
}

.footer-col a:hover { color: var(--white); }

/* === RESPONSIVE === */

/* Hamburger toggle (hidden on desktop) */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0.3rem;
    line-height: 1;
}

@media (max-width: 900px) {
    /* NAV */
    .site-nav {
        padding: 0 1rem;
        height: 52px;
        flex-wrap: wrap;
    }

    .nav-logo-img { height: 28px; }

    .nav-toggle { display: block; }

    .nav-right {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        background: var(--black);
        padding: 0.5rem 0 1rem;
        border-top: 1px solid rgba(255,255,255,0.08);
    }

    .nav-right.open { display: flex; }

    .nav-right a {
        padding: 0.7rem 0;
        font-size: 0.82rem;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }

    .nav-right .search-box { display: none; }

    /* HERO */
    .hero {
        padding: 2.5rem 1.2rem 3rem;
    }

    .hero::after { width: 4px; }

    .hero-flex {
        flex-direction: column;
        align-items: stretch;
        gap: 1.5rem;
    }

    .hero-right {
        flex: none;
        width: 100%;
    }

    .hero-search { padding: 1.2rem; }
    .hero-search-label { font-size: 0.95rem; }
    .hero-search-sub { font-size: 0.72rem; margin-bottom: 0.8rem; }

    .search-box--hero input {
        padding: 0.7rem 0.8rem 0.7rem 2rem;
        font-size: 0.88rem;
    }

    .hero-eyebrow {
        font-size: 0.55rem;
        padding: 0.25rem 0.6rem;
        margin-bottom: 1rem;
    }

    .hero h1 {
        font-size: 2.2rem;
        line-height: 1.0;
    }

    .hero p {
        font-size: 0.88rem;
        margin-top: 1rem;
    }

    .hero-total {
        margin-top: 1.5rem;
        flex-direction: column;
        gap: 0.2rem;
    }

    .hero-total .big { font-size: 2rem; }
    .hero-total .caption { font-size: 0.65rem; }

    .hero-shapes { display: none; }

    /* STAT BAND */
    .stat-band {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-band .stat-item {
        padding: 1.2rem 1rem;
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }

    .stat-band .value { font-size: 1.3rem; }
    .stat-band .value.period { font-size: 1rem; }
    .stat-band .label { font-size: 0.58rem; }

    /* LAYOUT */
    .container { padding: 0 1rem; }

    /* SECTIONS */
    .section { padding: 2.5rem 0; }
    .section-title { font-size: 1.4rem; margin-bottom: 1.2rem; }
    .section-label { font-size: 0.58rem; }

    /* GRID */
    .grid-2 { grid-template-columns: 1fr; }

    /* CARDS */
    .card-header { padding: 0.8rem 1rem; font-size: 0.65rem; }
    .card-body { padding: 1rem; }
    .chart-wrap { height: 220px; }

    /* TABLES */
    th { padding: 0.6rem 0.7rem; font-size: 0.56rem; }
    td { padding: 0.5rem 0.7rem; font-size: 0.78rem; }
    .amount { font-size: 0.72rem; }
    .rank { width: 24px; height: 24px; font-size: 0.65rem; }
    .badge { font-size: 0.6rem; padding: 0.15rem 0.4rem; }
    .party-link { font-size: 0.78rem; }

    /* PAGE HEAD */
    .page-head { padding: 2rem 0 0; }
    .page-head h1 { font-size: 1.6rem; word-break: break-word; }
    .page-head .sub { font-size: 0.85rem; margin-bottom: 1.2rem; }

    /* PAGINATION */
    .pagination {
        padding: 1rem 0.5rem;
        flex-wrap: wrap;
        gap: 3px;
    }
    .pagination a,
    .pagination span {
        padding: 0.35rem 0.6rem;
        font-size: 0.7rem;
    }

    /* FORMS */
    .filter-grid {
        grid-template-columns: 1fr;
    }

    .filter-submit {
        flex-direction: row;
    }

    .filter-submit button {
        width: 100%;
        padding: 0.7rem;
        text-align: center;
    }

    /* FOOTER */
    .site-footer { padding: 2rem 1rem; margin-top: 2rem; }
    .footer-inner { grid-template-columns: 1fr; gap: 1.5rem; }
}

/* Extra small screens */
@media (max-width: 480px) {
    .hero h1 { font-size: 1.7rem; }
    .hero-total .big { font-size: 1.6rem; }
    .stat-band { grid-template-columns: 1fr; }
    .stat-band .stat-item { border-right: none; }
    .stat-band .value { font-size: 1.5rem; }
    .pagination a,
    .pagination span { padding: 0.3rem 0.5rem; font-size: 0.65rem; }
    .nav-logo-img { height: 24px; }
}


/* === FORMS === */
.filter-form { width: 100%; }

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    align-items: end;
}

.filter-field label {
    display: block;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gray-400);
    margin-bottom: 0.4rem;
}

.filter-field input,
.filter-field select {
    width: 100%;
    padding: 0.6rem 0.8rem;
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 500;
    border: 2px solid var(--gray-200);
    background: var(--off-white);
    color: var(--black);
    outline: none;
    transition: border-color 0.15s;
}

.filter-field input:focus,
.filter-field select:focus {
    border-color: var(--black);
}

.filter-field input::placeholder { color: var(--gray-400); }

.filter-submit {
    display: flex;
    gap: 0.8rem;
    align-items: end;
}

.filter-submit button {
    padding: 0.6rem 1.8rem;
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: var(--black);
    color: var(--white);
    border: 2px solid var(--black);
    cursor: pointer;
    transition: all 0.15s;
}

.filter-submit button:hover {
    background: var(--red);
    border-color: var(--red);
}

.filter-reset {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-400);
    padding: 0.6rem 0;
}

.filter-reset:hover { color: var(--black); }


/* === EXPORT BUTTON === */
.btn-export {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.2rem;
    font-family: var(--font);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: transparent;
    color: var(--black);
    border: 2px solid var(--black);
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-export:hover {
    background: var(--black);
    color: var(--white);
}

/* === CURIOSITÀ FACT CARDS === */
.facts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
    background: var(--gray-200);
    border: 2px solid var(--gray-200);
    margin-bottom: 2rem;
}

.fact-card {
    background: var(--white);
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.fact-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 4px;
}

.fact-red::before { background: var(--red); }
.fact-blue::before { background: var(--blue); }
.fact-amber::before { background: var(--amber); }
.fact-green::before { background: var(--green); }

.fact-icon {
    font-size: 1.8rem;
    margin-bottom: 0.8rem;
    display: block;
}

.fact-label {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--gray-400);
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.fact-value {
    font-family: var(--mono);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 0.6rem;
    line-height: 1;
}

.fact-detail {
    font-size: 0.82rem;
    color: var(--gray-600);
    line-height: 1.5;
}

.fact-link {
    color: var(--black);
    font-weight: 600;
    border-bottom: 2px solid var(--amber);
}

.fact-link:hover { border-color: var(--red); }

.fact-meta {
    display: block;
    font-size: 0.72rem;
    color: var(--gray-400);
    margin-top: 0.3rem;
}

/* === PROGRESS BAR IN TABLES === */
.bar-cell {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.bar-track {
    flex: 1;
    height: 4px;
    background: var(--gray-100);
    overflow: hidden;
    min-width: 60px;
}

.bar-fill {
    height: 100%;
    background: var(--blue);
    transition: width 0.3s ease;
}

/* === TICKER (hero) === */
.hero-ticker {
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    overflow: hidden;
}

.ticker-label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--red);
    background: rgba(230,57,70,0.15);
    padding: 0.2rem 0.5rem;
    white-space: nowrap;
    border: 1px solid rgba(230,57,70,0.3);
}

.ticker-items {
    display: flex;
    gap: 2rem;
    animation: ticker 30s linear infinite;
    white-space: nowrap;
}

.ticker-item {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
    font-weight: 500;
}

.ticker-item strong {
    color: var(--amber);
    font-family: var(--mono);
}

@keyframes ticker {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

@media (max-width: 900px) {
    .facts-grid { grid-template-columns: 1fr; }
    .fact-value { font-size: 1.5rem; }
    .hero-ticker { display: none; }
}


/* === STYLED SELECT === */
.filter-field select,
.select-styled {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b6b63' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
    padding-right: 2.2rem !important;
    cursor: pointer;
}

.filter-field select:focus,
.select-styled:focus {
    border-color: var(--black);
    outline: none;
}

/* Due per mille select inline */
.filter-field select option {
    background: var(--white);
    color: var(--black);
    font-family: var(--font);
}

/* ============================================
   RESPONSIVE OVERRIDES (must be last)
   ============================================ */
@media (max-width: 900px) {
    /* Forms */
    .filter-grid { grid-template-columns: 1fr !important; }
    .filter-submit { flex-direction: column; }
    .filter-submit button { width: 100%; padding: 0.75rem; text-align: center; }
    .filter-field select { font-size: 0.82rem; }

    /* Export */
    .btn-export { display: none; }

    /* Fact cards */
    .facts-grid { grid-template-columns: 1fr !important; }
    .fact-card { padding: 1.5rem; }
    .fact-value { font-size: 1.4rem; }
    .fact-icon { font-size: 1.4rem; }

    /* Bar track */
    .bar-track { min-width: 40px; }

    /* Ticker */
    .hero-ticker { display: none; }

    /* Tables: force horizontal scroll */
    .tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table { min-width: 500px; }

    /* Stat band overflow fix */
    .stat-band { grid-template-columns: repeat(2, 1fr) !important; }
    .stat-band .stat-item { padding: 1rem 0.8rem; }
    .stat-band .value { font-size: 1.2rem; }
    .stat-band .label { font-size: 0.55rem; }

    /* Grid */
    .grid-2 { grid-template-columns: 1fr !important; }

    /* Container */
    .container { padding: 0 1rem; }

    /* Hero */
    .hero { padding: 2rem 1rem 2.5rem; }
    .hero-flex { flex-direction: column; gap: 1.5rem; }
    .hero-right { flex: none; width: 100%; }
    .hero h1 { font-size: 2rem; }
    .hero p { font-size: 0.85rem; }
    .hero-total .big { font-size: 1.8rem; }
    .hero-total { flex-direction: column; gap: 0.2rem; }
    .hero-shapes { display: none; }
    .hero-eyebrow { font-size: 0.52rem; padding: 0.2rem 0.5rem; margin-bottom: 0.8rem; }
    .hero-search { padding: 1rem; }
    .hero-search-label { font-size: 0.9rem; }
    .search-box--hero input { padding: 0.65rem 0.8rem 0.65rem 2rem; font-size: 0.85rem; }

    /* Nav */
    .site-nav { padding: 0 1rem; height: 52px; }
    .nav-logo-img { height: 30px; }
    .nav-toggle { display: block; }
    .nav-right { display: none; width: 100%; flex-direction: column; background: var(--black); padding: 0.5rem 1rem 1rem; border-top: 1px solid rgba(255,255,255,0.08); }
    .nav-right.open { display: flex; }
    .nav-right a { padding: 0.65rem 0; font-size: 0.82rem; border-bottom: 1px solid rgba(255,255,255,0.05); }

    /* Page head */
    .page-head { padding: 1.5rem 0 0; }
    .page-head h1 { font-size: 1.5rem; word-break: break-word; }
    .page-head .sub { font-size: 0.82rem; margin-bottom: 1rem; }

    /* Sections */
    .section { padding: 2rem 0; }
    .section-title { font-size: 1.3rem; margin-bottom: 1rem; }

    /* Cards */
    .card-header { padding: 0.7rem 1rem; font-size: 0.62rem; }
    .card-body { padding: 0.8rem; }
    .chart-wrap { height: 200px; }

    /* Tables */
    th { padding: 0.5rem 0.6rem; font-size: 0.55rem; }
    td { padding: 0.45rem 0.6rem; font-size: 0.75rem; }
    .amount { font-size: 0.7rem; }
    .rank { width: 22px; height: 22px; font-size: 0.6rem; }
    .badge { font-size: 0.58rem; padding: 0.1rem 0.35rem; }
    .party-link { font-size: 0.75rem; }

    /* Pagination */
    .pagination { padding: 0.8rem 0.5rem; flex-wrap: wrap; gap: 2px; }
    .pagination a, .pagination span { padding: 0.3rem 0.55rem; font-size: 0.68rem; }

    /* Footer */
    .site-footer { padding: 1.5rem 1rem; }
    .footer-inner { grid-template-columns: 1fr !important; gap: 1.2rem; }
    .footer-col img { height: 28px !important; }
}

@media (max-width: 480px) {
    .hero h1 { font-size: 1.6rem; }
    .hero-total .big { font-size: 1.5rem; }
    .stat-band { grid-template-columns: 1fr !important; }
    .stat-band .stat-item { border-right: none; }
    .nav-logo-img { height: 24px; }
    table { min-width: 400px; }
    .page-head h1 { font-size: 1.3rem; }
}


/* === SORTABLE TABLE HEADERS === */
.th-sort {
    color: var(--gray-400);
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s;
}

.th-sort:hover {
    color: var(--black);
}

.th-sort.active {
    color: var(--black);
}


/* === NEWSLETTER POPUP === */
.nl-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10,10,10,0.6);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.nl-overlay.active { display: flex; }

.nl-popup {
    background: var(--white);
    border: 2px solid var(--black);
    padding: 2.5rem;
    max-width: 420px;
    width: 90%;
    position: relative;
    text-align: center;
}

.nl-close {
    position: absolute;
    top: 0.8rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--gray-400);
    transition: color 0.15s;
}

.nl-close:hover { color: var(--black); }

.nl-icon { font-size: 2.5rem; margin-bottom: 1rem; }

.nl-title {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.nl-sub {
    font-size: 0.85rem;
    color: var(--gray-600);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.nl-form {
    display: flex;
    gap: 0;
}

.nl-form input {
    flex: 1;
    padding: 0.7rem 1rem;
    font-family: var(--font);
    font-size: 0.88rem;
    border: 2px solid var(--gray-200);
    border-right: none;
    outline: none;
}

.nl-form input:focus { border-color: var(--black); }

.nl-form button {
    padding: 0.7rem 1.5rem;
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--black);
    color: var(--white);
    border: 2px solid var(--black);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}

.nl-form button:hover { background: var(--red); border-color: var(--red); }
.nl-form button:disabled { opacity: 0.5; cursor: wait; }

.nl-msg {
    font-size: 0.82rem;
    font-weight: 600;
    margin-top: 0.8rem;
    min-height: 1.2em;
}

.nl-privacy {
    font-size: 0.68rem;
    color: var(--gray-400);
    margin-top: 1rem;
}

@media (max-width: 480px) {
    .nl-popup { padding: 1.5rem; }
    .nl-title { font-size: 1.1rem; }
    .nl-form { flex-direction: column; gap: 0.5rem; }
    .nl-form input { border-right: 2px solid var(--gray-200); }
    .nl-form button { width: 100%; }
}


/* === COOKIE BANNER === */
.cookie-banner {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--black);
    color: var(--gray-400);
    padding: 1rem 2rem;
    z-index: 9998;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    font-size: 0.82rem;
}

.cookie-banner.active { display: flex; }

.cookie-banner p { flex: 1; line-height: 1.5; }
.cookie-banner a { color: var(--amber); }

.cookie-btns {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.cookie-btns button {
    padding: 0.5rem 1.2rem;
    font-family: var(--font);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border: 2px solid var(--white);
    cursor: pointer;
    background: var(--white);
    color: var(--black);
    transition: all 0.15s;
}

.cookie-btns button:hover { background: var(--amber); border-color: var(--amber); }

.cookie-reject {
    background: transparent !important;
    color: var(--gray-400) !important;
    border-color: var(--gray-600) !important;
}

.cookie-reject:hover {
    color: var(--white) !important;
    border-color: var(--white) !important;
}

/* Newsletter consent checkbox */
.nl-consent {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--gray-600);
    margin-top: 0.8rem;
    cursor: pointer;
}

.nl-consent input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--black);
    cursor: pointer;
}

.nl-consent a { color: var(--black); font-weight: 600; }

@media (max-width: 900px) {
    .cookie-banner {
        flex-direction: column;
        padding: 1rem;
        gap: 0.8rem;
        text-align: center;
    }
    .cookie-banner p { font-size: 0.75rem; }
}
