/* Mobile-first. Basisstijl voor kleine schermen, opgeschaald via media queries. */

:root {
    color-scheme: light dark;
    --bg: #f4f5f7;
    --surface: #ffffff;
    --text: #1c1f26;
    --text-muted: #6b7280;
    --border: #e3e5ea;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --green: #16a34a;
    --red: #dc2626;
    --amber: #d97706;
    --radius: 12px;
    --nav-height: 68px;

    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    --font-display: 'Sora', var(--font-body);

    /* Categorale grafiekkleuren, vaste volgorde (dataviz-richtlijn). */
    --chart-1: #2a78d6;
    --chart-2: #eb6834;
    --chart-3: #1baf7a;
    --chart-4: #eda100;
    --chart-5: #e87ba4;
    --chart-6: #008300;
    --chart-7: #4a3aa7;
    --chart-8: #e34948;
    --chart-grid: #e1e0d9;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #14161b;
        --surface: #1e2128;
        --text: #eceef1;
        --text-muted: #9aa0ab;
        --border: #2c3038;

        --chart-1: #3987e5;
        --chart-2: #d95926;
        --chart-3: #199e70;
        --chart-4: #c98500;
        --chart-5: #d55181;
        --chart-6: #008300;
        --chart-7: #9085e9;
        --chart-8: #e66767;
        --chart-grid: #2c2c2a;
    }
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.02em;
}

strong, b { font-weight: 600; }

a { color: var(--primary); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; }

.app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

header.topbar h1 {
    font-size: 18px;
    margin: 0;
    font-weight: 700;
    flex: none;
}

/* Compacte periodekiezer in de header: geen kaartachtige marges, en
   krimpt liever dan de titel van het scherm te duwen. */
header.topbar .period-switcher-compact {
    margin-bottom: 0;
    min-width: 0;
}

header.topbar .period-switcher-compact select {
    max-width: 100%;
    min-width: 0;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

main.content {
    flex: 1;
    padding: 16px;
    padding-bottom: calc(var(--nav-height) + 24px);
    max-width: 760px;
    width: 100%;
    margin: 0 auto;
}

nav.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    z-index: 20;
}

nav.bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    text-decoration: none;
    padding: 8px 2px;
}

nav.bottom-nav a .icon {
    width: 24px;
    height: 24px;
    color: var(--text-muted);
    transition: color .15s ease;
}

nav.bottom-nav a .label { transition: color .15s ease; }

nav.bottom-nav a.active { text-decoration: none; }
nav.bottom-nav a.active .icon,
nav.bottom-nav a.active .label { color: var(--text); font-weight: 600; }
nav.bottom-nav a:hover .icon,
nav.bottom-nav a:hover .label { color: var(--text); }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}

.card h2, .card h3 {
    margin-top: 0;
}

.grid-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
}

.stat .label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .08em;
}

.stat .value {
    font-size: 22px;
    font-weight: 700;
    margin-top: 4px;
}

.value.positive { color: var(--green); }
.value.negative { color: var(--red); }

/* Algemene val voor .positive/.negative buiten de specifiekere varianten
   hierboven (o.a. gebruikt op td.num-cellen in tabellen). */
.positive { color: var(--green); }
.negative { color: var(--red); }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th, td {
    text-align: left;
    padding: 10px 8px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

th { color: var(--text-muted); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }

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

/* Naam/omschrijving-kolommen in scrollbare tabellen: liever de kolom laten
   meegroeien (de tabel scrolt toch al horizontaal) dan de tekst over twee
   regels laten breken. */
td.nowrap, th.nowrap { white-space: nowrap; }

tr:last-child td { border-bottom: none; }

/* Eenvoudige label/bedrag-tabel (bijv. "Totaal kapitaal" op het
   overzicht): geen lijntjes tussen de regels, wel een duidelijke,
   vetgedrukte totaalregel met wat lucht erboven. */
.detail-table td {
    padding: 8px 0;
    border-bottom: none;
    font-size: 15px;
}

.detail-table tfoot td {
    border-top: 1px solid var(--border);
    padding-top: 16px;
    margin-top: 8px;
    font-weight: 700;
}

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    white-space: nowrap;
}

.badge.paid, .badge.received { background: #dcfce7; color: #166534; }
.badge.open { background: #fef3c7; color: #92400e; }
.badge.next { background: #e0e7ff; color: #3730a3; }
.badge.neutral { background: var(--border); color: var(--text-muted); }
.badge.category { background: #e0f2fe; color: #075985; }
a.badge { text-decoration: none; }

.progress-bar {
    width: 100%;
    max-width: 220px;
    height: 6px;
    border-radius: 999px;
    background: var(--border);
    overflow: hidden;
    margin-top: 6px;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 999px;
}

@media (prefers-color-scheme: dark) {
    .badge.paid, .badge.received { background: #14351f; color: #4ade80; }
    .badge.open { background: #3a2a08; color: #fbbf24; }
    .badge.next { background: #23225c; color: #a5b4fc; }
    .badge.category { background: #0c3a52; color: #7dd3fc; }
}

/* Horizontale categorie-balken op het dashboard: één balk per categorie,
   gesorteerd op werkelijk betaald bedrag, in dezelfde kleurvolgorde als de
   diagrammen op de statistiekenpagina (var(--chart-1) t/m var(--chart-8)). */
.category-bars {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.category-bar-row {
    display: block;
    text-decoration: none;
    color: inherit;
}

.category-bar-label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}

.category-bar-track {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: var(--border);
    overflow: hidden;
}

.category-bar-fill {
    height: 100%;
    border-radius: 999px;
}

/* Aandachtsvenster op het dashboard: valt op tussen de gewone kaarten, voor
   dingen die de gebruiker echt even moet zien (bijv. een leningtermijn
   waarvan maar een deel betaald is). */
.attention-card {
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-left: 4px solid var(--amber);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 16px;
}

.attention-card h2 {
    font-size: 15px;
    color: #92400e;
}

.attention-row + .attention-row {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #fde68a;
}

.attention-row-title {
    font-weight: 600;
    color: #92400e;
}

.attention-row-detail {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
    color: #92400e;
    margin-top: 2px;
}

@media (prefers-color-scheme: dark) {
    .attention-card {
        background: #3a2a08;
        border-color: #5c4212;
    }
    .attention-card h2,
    .attention-row-title,
    .attention-row-detail {
        color: #fbbf24;
    }
    .attention-row + .attention-row {
        border-top-color: #5c4212;
    }
}

/* Waarschuwingsvenster op het dashboard: "meer betaald/ontvangen dan
   begroot". Rood (.negative) voor lasten/leningen, groen (.positive) voor
   inkomsten. Elke regel is een eigen form: de knop klikt de waarschuwing
   weg (blijvend) én springt naar de bijbehorende mutatie. */
.warning-card {
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 16px;
    border: 1px solid;
}

.warning-card.negative {
    background: #fee2e2;
    border-color: #fecaca;
}

.warning-card.positive {
    background: #dcfce7;
    border-color: #bbf7d0;
}

.warning-card h2 {
    font-size: 15px;
}

.warning-card.negative h2 { color: #991b1b; }
.warning-card.positive h2 { color: #166534; }

.warning-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.warning-row + .warning-row {
    margin-top: 10px;
    padding-top: 10px;
}

.warning-card.negative .warning-row + .warning-row { border-top: 1px solid #fecaca; }
.warning-card.positive .warning-row + .warning-row { border-top: 1px solid #bbf7d0; }

.warning-row-title { font-weight: 600; }
.warning-row-detail { font-size: 13px; margin-top: 2px; }

.warning-card.negative .warning-row-title,
.warning-card.negative .warning-row-detail { color: #991b1b; }
.warning-card.positive .warning-row-title,
.warning-card.positive .warning-row-detail { color: #166534; }

@media (prefers-color-scheme: dark) {
    .warning-card.negative {
        background: #3b1414;
        border-color: #5c1f1f;
    }
    .warning-card.positive {
        background: #0f2e1c;
        border-color: #16472b;
    }
    .warning-card.negative h2,
    .warning-card.negative .warning-row-title,
    .warning-card.negative .warning-row-detail {
        color: #fca5a5;
    }
    .warning-card.positive h2,
    .warning-card.positive .warning-row-title,
    .warning-card.positive .warning-row-detail {
        color: #86efac;
    }
    .warning-card.negative .warning-row + .warning-row { border-top-color: #5c1f1f; }
    .warning-card.positive .warning-row + .warning-row { border-top-color: #16472b; }
}

form.inline-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

form.filter-bar {
    margin-bottom: 16px;
}

label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}

input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
}

.field { margin-bottom: 4px; }

.field-row {
    display: flex;
    gap: 10px;
}
.field-row > .field { flex: 1; }

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 8px;
}
.checkbox-field label { margin: 0; }
.checkbox-field input { width: auto; }

.btn {
    display: inline-block;
    padding: 10px 16px;
    border-radius: 8px;
    border: none;
    background: var(--primary);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn.secondary { background: var(--border); color: var(--text); }
.btn.danger { background: var(--red); color: #fff; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.block { display: block; width: 100%; }

.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.row-actions form { display: inline; }

/* Alle badges (koppelingen, categorie, status) op een eigen rij die over de
   volle tabelbreedte loopt (colspan), onder de titel/bedragen-rij i.p.v.
   ernaast of beperkt tot de omschrijvingskolom — gebruikt bij inkomsten/
   vaste lasten en kasstroom. De twee rijen (titel+bedragen, badges) horen
   visueel bij elkaar: geen lijntje ertussenin, wel een normaal lijntje na
   de badges-rij als scheiding met het volgende item. */
.item-row-main td {
    border-bottom: none;
    padding-bottom: 2px;
}

.item-badges-row td {
    padding-top: 0;
}

.item-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* Klikbare tabelrij (bijv. inkomsten/lasten): opent het bewerkformulier
   i.p.v. een aparte "Bewerken"-knop per rij. */
.row-clickable { cursor: pointer; }
.row-clickable:hover td { background: var(--bg); }

.flash {
    padding: 12px 14px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
}
.flash.success { background: #dcfce7; color: #166534; }
.flash.error { background: #fee2e2; color: #991b1b; }
.flash.warning { background: #fef3c7; color: #92400e; }

.period-switcher {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.period-switcher select { width: auto; }

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

.guest-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.guest-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 24px;
    width: 100%;
    max-width: 380px;
}

.guest-card h1 {
    font-size: 20px;
    margin-top: 0;
}

.table-scroll {
    overflow-x: auto;
}

.pots-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.pot-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    row-gap: 10px;
    column-gap: 10px;
}

.pot-card .pot-icon { font-size: 24px; flex: none; }
.pot-card .pot-name { font-weight: 600; }
.pot-card .pot-note { font-size: 12px; color: var(--text-muted); }
.pot-card .pot-amount { font-weight: 700; font-size: 18px; white-space: nowrap; }

.pot-card-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.pot-card-info > div { min-width: 0; }

/* Bedrag (+ eventuele knoppen) schuift naar rechts op de eerste regel die
   past, en wrapt anders netjes naar een eigen regel i.p.v. af te snijden. */
.pot-card > .pot-amount {
    margin-left: auto;
}

/* Altijd bedrag boven knoppen, ongeacht hoe kort het bedrag is — nooit
   naast elkaar, zodat elke potje-kaart er hetzelfde uitziet. */
.pot-card-actions {
    margin-left: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.timeline {
    display: flex;
    flex-direction: column;
}

.timeline-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.timeline-item:last-child { border-bottom: none; padding-bottom: 0; }
.timeline-item:first-child { padding-top: 0; }

.timeline-icon {
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.timeline-body { flex: 1; min-width: 0; }

.timeline-desc { font-weight: 600; }

.timeline-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.timeline-amount {
    flex: none;
    font-weight: 700;
    white-space: nowrap;
}
.timeline-amount.positive { color: var(--green); }
.timeline-amount.negative { color: var(--red); }

.chart {
    width: 100%;
    height: auto;
    display: block;
}

.chart-grid { stroke: var(--chart-grid); stroke-width: 1; }

.chart-axis-label {
    fill: var(--text-muted);
    font-size: 10px;
    font-family: inherit;
}

.chart-end-label {
    fill: var(--text);
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
}

.chart-center-value {
    fill: var(--text);
    font-size: 18px;
    font-weight: 700;
    font-family: inherit;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-top: 12px;
    font-size: 13px;
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text);
}

.chart-legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex: none;
}

.tab-switch {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
}

.tab-btn {
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}

.tab-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.tab-panel[hidden] {
    display: none;
}

.fab-button {
    width: 44px;
    height: 44px;
    margin: 0 0 16px auto;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    font-size: 24px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
    cursor: pointer;
}

.fab-button:hover {
    background: var(--primary-dark);
}

.form-panel[hidden] {
    display: none;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

/* Saldokaart op het dashboard: bank-app-stijl rekeningkaartje. Twee
   rijen (label + bedrag), beide in hetzelfde lettertype en dezelfde grootte. */
.balance-card { padding: 18px; }

.balance-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    row-gap: 10px;
    column-gap: 12px;
    align-items: baseline;
}
/* Rechterkolom (bedrag/toelichting) altijd rechts uitgelijnd, ongeacht
   welke rij: de kolombreedte volgt de langste inhoud (bijv. het bedrag),
   dus zonder dit zou een korte tekst als "na vaste lasten" naar het
   midden lijken te schuiven. */
.balance-grid > *:nth-child(2n) {
    text-align: right;
}

.balance-label {
    font-weight: 600;
    font-size: 15px;
}

.balance-amount {
    font-weight: 700;
    font-size: 26px;
    white-space: nowrap;
}
.balance-amount.positive { color: var(--green); }
.balance-amount.negative { color: var(--red); }

.balance-card p { margin: 12px 0 0; }

.text-muted { color: var(--text-muted); }
.mt-0 { margin-top: 0; }

/* Hero-saldokaart bovenaan het dashboard: volle breedte (breekt uit de
   padding van main.content, geen witruimte boven/links/rechts), net als
   het saldoblok bovenin een bank-app. */
.hero-balance {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    text-align: center;
    padding: 28px 20px 56px;
    margin: -16px -16px 0;
    position: relative;
}

/* Zwevend rondje linksboven in de hero, voor een "terug"-link op
   detailpagina's — i.p.v. een losse tekstlink boven de hero die buiten
   het ontwerp valt. */
.hero-back {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .18);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
    text-decoration: none;
}

.hero-back:hover {
    background: rgba(255, 255, 255, .3);
    text-decoration: none;
}

/* Zelfde rondje, maar rechtsboven en voor een "bewerken"-actie i.p.v.
   terugnavigeren (bijv. categoriedetailpagina, waar de overlapkaart al
   bezet is met begroot/openstaand i.p.v. een quick-action). */
.hero-edit {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .18);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.hero-edit:hover {
    background: rgba(255, 255, 255, .3);
}

.hero-balance-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: rgba(255, 255, 255, .8);
}

.hero-balance-amount {
    font-family: var(--font-display);
    font-size: clamp(32px, 9vw, 40px);
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-top: 6px;
    line-height: 1.15;
}

/* Zwevende actiekaart die half over de hero-balance heen steekt, net als
   het snelkoppelingenblok bovenin een bank-app. */
.quick-actions {
    display: flex;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .16);
    margin: -40px 0 20px;
    padding: 14px 6px 10px;
    position: relative;
    z-index: 1;
}

.quick-action {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}
.quick-action:hover { text-decoration: none; }

/* Sommige quick-actions zijn een <button> (bijv. om een form-panel te
   tonen i.p.v. te navigeren) i.p.v. een <a> — reset de UA-buttonstijl
   zodat hij er identiek uitziet. */
button.quick-action {
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    cursor: pointer;
}

.quick-action-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}
.quick-action-icon .icon { width: 20px; height: 20px; }
.quick-action:hover .quick-action-icon { background: var(--border); }

/* Eén regel per vaste last/inkomst, elk in een eigen kader, onder elkaar
   (geen categorie-groepering, geen tegels) — met een geüpload icoon
   vooraan zoals op een startscherm, zie IconMapping. */
.expense-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.expense-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.expense-list-item:hover { background: var(--bg); text-decoration: none; }

/* Onder-uit-openend paneel (bijv. gekoppelde kasstroommutaties bij een
   vaste last): altijd in de DOM, maar onzichtbaar en niet-klikbaar tot
   de .open-klasse toegevoegd wordt door app.js. */
.bottom-sheet {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(0, 0, 0, 0);
    visibility: hidden;
    pointer-events: none;
    transition: background .2s ease, visibility 0s linear .2s;
}
.bottom-sheet.open {
    background: rgba(0, 0, 0, .5);
    visibility: visible;
    pointer-events: auto;
    transition: background .2s ease;
}

.bottom-sheet-panel {
    width: 100%;
    max-width: 760px;
    max-height: 80vh;
    overflow-y: auto;
    background: var(--surface);
    border-radius: 16px 16px 0 0;
    padding: 16px 20px calc(20px + env(safe-area-inset-bottom));
    transform: translateY(100%);
    transition: transform .25s ease;
}
.bottom-sheet.open .bottom-sheet-panel { transform: translateY(0); }

.bottom-sheet-handle {
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: var(--border);
    margin: 0 auto 16px;
}

.expense-list-icon {
    flex: none;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.expense-list-icon img { width: 40px; height: 40px; object-fit: cover; border-radius: inherit; }
.expense-list-icon .placeholder { font-weight: 700; font-size: 15px; color: var(--text-muted); }

.expense-list-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.expense-list-title {
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.expense-list-amount {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 12px;
    color: var(--text-muted);
}

.amount-figure { display: inline-flex; align-items: center; gap: 3px; }

.amount-arrow { width: 10px; height: 10px; flex: none; }
.amount-arrow.up { color: var(--green); }
.amount-arrow.down { color: var(--red); }

.expense-list-icon .emoji { font-size: 26px; line-height: 1; }

.expense-list-value {
    flex: none;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
}

/* Zelfde zwevende overlapkaart als .quick-actions, maar met begroot/
   openstaand-achtige statistieken i.p.v. navigatie-iconen (bijv. de
   categoriedetailpagina). */
.stats-overlap {
    display: flex;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .16);
    margin: -40px 0 20px;
    padding: 16px;
    position: relative;
    z-index: 1;
    gap: 12px;
}

.stat-overlap-item {
    flex: 1;
    text-align: center;
}

.stat-overlap-item .label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .08em;
}

.stat-overlap-item .value {
    font-size: 20px;
    font-weight: 700;
    margin-top: 4px;
}

/* Desktop: bredere layout, zijnav i.p.v. bottom-nav */
@media (min-width: 900px) {
    :root { --nav-height: 0px; }

    .app {
        flex-direction: row;
    }

    nav.bottom-nav {
        order: -1;
        position: sticky;
        top: 0;
        left: 0;
        height: 100vh;
        width: 220px;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        border-top: none;
        border-right: 1px solid var(--border);
        padding: 20px 12px;
    }

    nav.bottom-nav a {
        flex: 0 0 auto;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 12px;
        padding: 9px 12px;
        border-radius: 10px;
        font-size: 14px;
    }

    nav.bottom-nav a:hover { background: var(--bg); }
    nav.bottom-nav a.active { background: var(--bg); }
    nav.bottom-nav a .icon { width: 20px; height: 20px; flex: none; }
    nav.bottom-nav a .label { flex: 1; }

    main.content {
        padding: 28px 32px;
        padding-bottom: 32px;
        max-width: 960px;
    }

    .pots-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-stats {
        grid-template-columns: repeat(4, 1fr);
    }

    .hero-balance {
        margin: -28px -32px 20px;
        border-radius: 0 0 var(--radius) var(--radius);
    }
}
