/* SpendSmart - rustige, persoonlijke dashboardstijl.
   Kleuren uit de opdracht: #0F766E, #14B8A6, #FDE68A, #F8FAFC. Mobile first. */

:root {
    --color-primary: #0f766e;
    --color-primary-dark: #115e59;
    --color-accent: #14b8a6;
    --color-accent-soft: #ccfbf1;
    --color-highlight: #fde68a;
    --color-highlight-soft: #fef9e7;
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-text: #1e293b;
    --color-muted: #475569;
    --color-border: #e2e8f0;

    --color-ok: #166534;
    --color-ok-bg: #dcfce7;
    --color-warning: #92400e;
    --color-warning-bg: #fef3c7;
    --color-over: #b91c1c;
    --color-over-bg: #fee2e2;
    --color-info: #115e59;
    --color-info-bg: #ccfbf1;

    --radius: 12px;
    --radius-small: 8px;
    --shadow: 0 1px 2px rgb(15 23 42 / 0.06), 0 1px 3px rgb(15 23 42 / 0.08);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.55;
    color: var(--color-text);
    background: var(--color-bg);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

h1, h2, h3 {
    line-height: 1.25;
    margin: 0 0 0.5rem;
}

h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }

p { margin: 0 0 0.75rem; }

a { color: var(--color-primary); }
a:hover { color: var(--color-primary-dark); }

:focus-visible {
    outline: 3px solid var(--color-accent);
    outline-offset: 2px;
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px;
}

.main {
    flex: 1;
    padding-top: 1.5rem;
    padding-bottom: 2.5rem;
}

.muted { color: var(--color-muted); }
.optional { color: var(--color-muted); font-weight: 400; }

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    left: -999px;
    top: 0;
    background: var(--color-primary);
    color: #fff;
    padding: 0.5rem 1rem;
    z-index: 10;
}
.skip-link:focus { left: 1rem; }

/* Header en navigatie */
.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.site-header__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--color-text);
    text-decoration: none;
}

.brand__mark {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--color-primary);
    color: var(--color-highlight);
}

.nav-toggle {
    display: none;
    font: inherit;
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-small);
    background: var(--color-surface);
    cursor: pointer;
}

.js .nav-toggle { display: inline-block; }
.js .main-nav { display: none; }
.js .main-nav.is-open { display: flex; }

.main-nav {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
}

.main-nav__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.main-nav__link {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-small);
    color: var(--color-text);
    text-decoration: none;
}

.main-nav__link:hover { background: var(--color-bg); }

.main-nav__link[aria-current="page"] {
    background: var(--color-accent-soft);
    color: var(--color-primary-dark);
    font-weight: 600;
}

.main-nav__account {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
}

.role-badge {
    font-size: 0.8rem;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    background: var(--color-highlight);
    color: #713f12;
}

@media (min-width: 900px) {
    .js .nav-toggle { display: none; }
    .js .main-nav,
    .main-nav {
        display: flex;
        flex-direction: row;
        align-items: center;
        width: auto;
    }
    .main-nav__list { flex-direction: row; }
    .main-nav__account { padding: 0; }
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-muted);
    font-size: 0.875rem;
    padding: 1rem 0;
}
.site-footer p { margin: 0; }

/* Knoppen */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font: inherit;
    font-weight: 600;
    padding: 0.6rem 1.1rem;
    border-radius: var(--radius-small);
    border: 1px solid transparent;
    text-decoration: none;
    cursor: pointer;
    line-height: 1.2;
    min-height: 44px;
}

.button--small {
    padding: 0.35rem 0.75rem;
    font-size: 0.9rem;
    min-height: 36px;
}

.button--block { width: 100%; }

.button--primary { background: var(--color-primary); color: #fff; }
.button--primary:hover { background: var(--color-primary-dark); color: #fff; }

.button--secondary { background: var(--color-accent-soft); color: var(--color-primary-dark); }
.button--secondary:hover { background: #99f6e4; color: var(--color-primary-dark); }

.button--ghost { background: transparent; color: var(--color-primary); border-color: var(--color-border); }
.button--ghost:hover { background: var(--color-surface); border-color: var(--color-accent); }

.button--danger { background: var(--color-over-bg); color: var(--color-over); }
.button--danger:hover { background: #fecaca; }

.inline-form { display: inline; margin: 0; }

/* Kaarten en layout */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
}

.card--danger { border-color: #fecaca; }

.card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.section { margin-top: 1.5rem; }

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.page-header p { margin: 0; }

.section-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.card-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.dashboard-grid,
.profile-grid {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
}

@media (min-width: 900px) {
    .dashboard-grid { grid-template-columns: 1fr 1fr; }
    .profile-grid { grid-template-columns: 1fr 1fr; }
    .profile-grid .card--danger { grid-column: 1 / -1; }
}

/* Statistiekkaarten */
.stats {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.stat__label {
    color: var(--color-muted);
    font-size: 0.9rem;
    margin: 0;
}

.stat__value {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0.2rem 0 0.4rem;
    font-variant-numeric: tabular-nums;
}

/* Bedragen */
.amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
.amount--income { color: var(--color-ok); }
.amount--expense { color: var(--color-text); }

/* Status: altijd kleur én tekst */
.status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    white-space: nowrap;
}

.status::before {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: currentColor;
}

.status--ok { background: var(--color-ok-bg); color: var(--color-ok); }
.status--warning { background: var(--color-warning-bg); color: var(--color-warning); }
.status--over { background: var(--color-over-bg); color: var(--color-over); }
.status--progress { background: var(--color-info-bg); color: var(--color-info); }
.status--none { background: var(--color-bg); color: var(--color-muted); border: 1px solid var(--color-border); }

/* Voortgangsbalken */
.budget { padding: 0.75rem 0; border-bottom: 1px solid var(--color-border); }
.budget:last-child { border-bottom: 0; }

.budget__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.budget__name { font-weight: 600; }
.budget__meta { font-size: 0.875rem; color: var(--color-muted); margin: 0.35rem 0 0; }

.bar {
    width: 100%;
    height: 0.65rem;
    border-radius: 999px;
    background: var(--color-border);
    overflow: hidden;
}

.bar__fill { height: 100%; border-radius: 999px; }
.bar__fill--ok { background: var(--color-accent); }
.bar__fill--progress { background: var(--color-accent); }
.bar__fill--warning { background: #f59e0b; }
.bar__fill--over { background: var(--color-over); }
.bar__fill--none { background: var(--color-muted); }

.bar-with-value { display: flex; align-items: center; gap: 0.5rem; min-width: 140px; }

/* Breedtes in stappen van 5% (geen inline styles nodig) */
.w-0 { width: 0; }
.w-5 { width: 5%; }
.w-10 { width: 10%; }
.w-15 { width: 15%; }
.w-20 { width: 20%; }
.w-25 { width: 25%; }
.w-30 { width: 30%; }
.w-35 { width: 35%; }
.w-40 { width: 40%; }
.w-45 { width: 45%; }
.w-50 { width: 50%; }
.w-55 { width: 55%; }
.w-60 { width: 60%; }
.w-65 { width: 65%; }
.w-70 { width: 70%; }
.w-75 { width: 75%; }
.w-80 { width: 80%; }
.w-85 { width: 85%; }
.w-90 { width: 90%; }
.w-95 { width: 95%; }
.w-100 { width: 100%; }

/* Spaardoelkaart */
.goal-card { display: flex; flex-direction: column; gap: 0.5rem; }
.goal-card__header { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.goal-card__title { margin: 0; }
.goal-card__amount { margin: 0; font-variant-numeric: tabular-nums; }
.goal-card__meta { font-size: 0.875rem; color: var(--color-muted); margin: 0; }
.goal-card__deposit { margin-top: 0.5rem; }
.goal-card__deposit label { font-size: 0.875rem; font-weight: 600; }

/* Categoriechips */
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }

.chip {
    display: inline-block;
    padding: 0.2rem 0.75rem;
    border-radius: 999px;
    font-size: 0.85rem;
    text-decoration: none;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    white-space: nowrap;
}

.chip--income { border-color: #99f6e4; background: var(--color-accent-soft); color: var(--color-primary-dark); }
.chip--expense { border-color: #fcd34d; background: var(--color-highlight-soft); color: #713f12; }
.chip--active { outline: 2px solid var(--color-primary); font-weight: 600; }
.chip--button { font: inherit; font-size: 0.85rem; cursor: pointer; }
.chip--button:hover { filter: brightness(0.96); }

/* Lijsten */
.compact-list { list-style: none; margin: 0 0 1rem; padding: 0; }

.compact-list__item {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--color-border);
}
.compact-list__item:last-child { border-bottom: 0; }
.compact-list__item .muted { display: block; font-size: 0.85rem; }
.compact-list__title { font-weight: 600; }

/* Tabellen: op mobiel als kaartjes */
.table-wrapper { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; }

.table th,
.table td {
    text-align: left;
    padding: 0.65rem 0.5rem;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

.table th { font-size: 0.85rem; color: var(--color-muted); font-weight: 600; }
.table__number { text-align: right !important; }
.table__actions { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: flex-end; }

@media (max-width: 699px) {
    .table thead { display: none; }
    .table tr {
        display: block;
        padding: 0.5rem 0;
        border-bottom: 1px solid var(--color-border);
    }
    .table td {
        display: flex;
        justify-content: space-between;
        gap: 1rem;
        border: 0;
        padding: 0.25rem 0;
        text-align: right;
    }
    .table td[data-label]::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--color-muted);
        text-align: left;
    }
    .table__actions { justify-content: flex-start; padding-top: 0.5rem !important; }
}

.totals-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    margin-bottom: 0.75rem;
}

/* Filters */
.filters { margin-bottom: 1rem; }

.filters__form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
}

.month-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.month-filter .month-filter__input { width: auto; min-height: 36px; padding: 0.3rem 0.5rem; }

/* Formulieren */
.form { max-width: 640px; }

.form__row { display: grid; gap: 0 1rem; }
@media (min-width: 600px) {
    .form__row { grid-template-columns: 1fr 1fr; }
}

.form__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }

.field { margin: 0 0 1rem; border: 0; padding: 0; min-width: 0; }
.field--inline { margin: 0; }

.field label,
.field legend {
    display: block;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.field-hint { font-size: 0.85rem; color: var(--color-muted); margin: -0.15rem 0 0.35rem; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="month"],
select,
textarea {
    width: 100%;
    font: inherit;
    color: var(--color-text);
    padding: 0.55rem 0.7rem;
    border: 1px solid #94a3b8;
    border-radius: var(--radius-small);
    background: var(--color-surface);
    min-height: 44px;
}

textarea { resize: vertical; }

input:focus,
select:focus,
textarea:focus {
    border-color: var(--color-primary);
    outline: 3px solid var(--color-accent-soft);
    outline-offset: 0;
}

[aria-invalid="true"] { border-color: var(--color-over) !important; }

.field-error {
    color: var(--color-over);
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0.3rem 0 0;
}
.field-error::before { content: "⚠ "; }

.field--checkbox {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 0.6rem;
    align-items: start;
}
.field--checkbox input { width: 1.2rem; height: 1.2rem; margin-top: 0.2rem; }
.field--checkbox label { font-weight: 400; margin: 0; }
.field--checkbox .field-error { grid-column: 1 / -1; }

.radio { display: inline-flex !important; align-items: center; gap: 0.4rem; margin-right: 1.25rem; font-weight: 400 !important; }
.radio input { width: 1.1rem; height: 1.1rem; }

.input-group { display: flex; align-items: stretch; }
.input-group input { border-radius: 0 var(--radius-small) var(--radius-small) 0; min-width: 0; }
.input-group .button { margin-left: 0.4rem; border-radius: var(--radius-small); }

.input-group__prefix {
    display: grid;
    place-items: center;
    padding: 0 0.75rem;
    background: var(--color-bg);
    border: 1px solid #94a3b8;
    border-right: 0;
    border-radius: var(--radius-small) 0 0 var(--radius-small);
    color: var(--color-muted);
}

/* Meldingen: kleur én tekst ("Gelukt:", "Fout:" ...) */
.alert {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    padding: 0.8rem 1rem;
    border-radius: var(--radius-small);
    border: 1px solid;
    border-left-width: 5px;
    margin-bottom: 1rem;
}
.alert p { margin: 0; }
.alert__icon::before { font-weight: 700; }

.alert--success { background: var(--color-ok-bg); border-color: var(--color-ok); color: var(--color-ok); }
.alert--success .alert__icon::before { content: "✓"; }
.alert--error { background: var(--color-over-bg); border-color: var(--color-over); color: var(--color-over); }
.alert--error .alert__icon::before { content: "✕"; }
.alert--warning { background: var(--color-warning-bg); border-color: #d97706; color: var(--color-warning); }
.alert--warning .alert__icon::before { content: "!"; }
.alert--info { background: var(--color-info-bg); border-color: var(--color-primary); color: var(--color-info); }
.alert--info .alert__icon::before { content: "i"; }

.empty-state {
    text-align: center;
    padding: 1.5rem 1rem;
    border: 2px dashed var(--color-border);
    border-radius: var(--radius);
    color: var(--color-muted);
    background: var(--color-surface);
}

/* Startpagina */
.hero { display: grid; gap: 1.5rem; margin-bottom: 1.5rem; }
@media (min-width: 900px) {
    .hero { grid-template-columns: 1.2fr 1fr; align-items: center; }
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 0.25rem;
}

.lead { font-size: 1.1rem; color: var(--color-muted); }
.hero h1 { font-size: 2.1rem; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1rem; }

.feature-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.feature-list p { margin: 0; color: var(--color-muted); }

.tip-card {
    margin-top: 1.5rem;
    background: var(--color-highlight-soft);
    border-color: var(--color-highlight);
}

.notice { margin-top: 1.5rem; font-size: 0.9rem; color: var(--color-muted); }

/* Inloggen / registreren */
.auth-card { max-width: 460px; margin: 1rem auto; }
.auth-card__footer { margin: 1rem 0 0; text-align: center; }

/* Foutpagina */
.error-page { max-width: 560px; margin: 2rem auto; text-align: center; }
.error-page .form__actions { justify-content: center; }
.error-page__code { color: var(--color-muted); font-weight: 600; }
