:root {
    --paper: #eef1ee;
    --surface: #ffffff;
    --ink: #17211f;
    --muted: #6b7671;
    --rule: #dbe1dc;
    --accent: #c77d18;
    --accent-soft: #fbf1e0;
    --up: #1f6f5c;
    --down: #a3352a;
    --radius: 4px;
    --sans: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "SFMono-Regular", "Consolas", "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.5;
}

h1, h2 { font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 1.4rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 0 0 0.25rem; }
a { color: var(--ink); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- Kop ---------- */
.topbar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.85rem 1.5rem;
    background: var(--ink);
    color: #f4f6f4;
    border-bottom: 3px solid var(--accent);
    flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 0.7rem; text-decoration: none; color: inherit; }
.brand-name { font-weight: 600; letter-spacing: -0.01em; }
.logo { max-height: 38px; max-width: 190px; display: block; }
.logo-mark {
    display: grid;
    place-items: center;
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
}
.topnav { display: flex; gap: 1.1rem; margin-left: auto; }
.topnav a { color: #cfd6d1; text-decoration: none; padding-bottom: 2px; }
.topnav a:hover { color: #fff; }
.topnav a[aria-current="page"] { color: #fff; border-bottom: 2px solid var(--accent); }
.topuser { display: flex; align-items: center; gap: 0.9rem; font-size: 0.9rem; color: #cfd6d1; }
.topuser a { color: #cfd6d1; }

.page { max-width: 1080px; margin: 0 auto; padding: 1.5rem 1.5rem 3rem; }
.pagefoot {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 1.5rem 2rem;
    display: flex; justify-content: space-between;
    color: var(--muted); font-size: 0.8rem;
}

/* ---------- Samenvatting ---------- */
.summary {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}
.summary-label { margin: 0; color: var(--muted); font-size: 0.85rem; }
.summary-value {
    margin: 0.2rem 0 0.35rem;
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    font-size: clamp(1.9rem, 5vw, 2.6rem);
    letter-spacing: -0.03em;
}
.summary-sub { margin: 0; font-family: var(--mono); font-size: 0.9rem; color: var(--ink); }
.summary-note { margin: 0.6rem 0 0; color: var(--muted); font-size: 0.8rem; }
.up { color: var(--up); }
.down { color: var(--down); }

.summary-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem 1.25rem;
    margin: 0;
    align-content: center;
    border-left: 1px solid var(--rule);
    padding-left: 1.5rem;
}
.summary-stats dt { color: var(--muted); font-size: 0.8rem; }
.summary-stats dd {
    margin: 0.1rem 0 0;
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    font-size: 1.05rem;
}

/* ---------- Panelen ---------- */
.panel {
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem 1.5rem;
    margin-bottom: 1.25rem;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.exports { display: flex; gap: 0.5rem; }
.lede { color: var(--muted); margin: 0 0 1rem; max-width: 62ch; }

/* ---------- Formulieren ---------- */
label { display: block; font-size: 0.85rem; color: var(--muted); }
input, select {
    display: block;
    width: 100%;
    margin-top: 0.3rem;
    padding: 0.5rem 0.6rem;
    font: inherit;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
input:disabled { background: #f4f6f4; color: var(--muted); }
.hint { display: block; margin-top: 0.25rem; font-size: 0.75rem; color: var(--muted); }

.tx-form {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 0.9rem;
    align-items: end;
    margin-top: 0.75rem;
}
.tx-form .f-date { grid-column: span 2; }
.tx-form .f-type { grid-column: span 2; }
.tx-form .f-btc  { grid-column: span 3; }
.tx-form .f-eur  { grid-column: span 3; }
.tx-form .f-rate { grid-column: span 2; }
.tx-form .f-note { grid-column: span 12; }
.tx-form .f-desc { grid-column: span 9; }
.tx-form .f-actions { grid-column: span 3; display: flex; align-items: center; gap: 1rem; }

.calc-note {
    margin: -0.4rem 0 0;
    min-height: 1.15rem;
    font-size: 0.8rem;
    color: var(--muted);
}
.tx-form .f-eur input { background: #fcfdfc; }

.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 0.8rem;
    padding: 0.9rem 0 1.1rem;
}
.filters label { min-width: 140px; }
.filters .grow { flex: 1 1 220px; }

.stack { display: grid; gap: 0.9rem; justify-items: start; }
.stack label { width: 100%; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem; }
.grid-2.gap { gap: 2rem; }
.inline { display: inline; }

.button {
    display: inline-block;
    padding: 0.55rem 1.1rem;
    background: var(--ink);
    color: #fff;
    border: 1px solid var(--ink);
    border-radius: var(--radius);
    font: inherit;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
}
.button:hover { background: #223330; }
.button.ghost { background: #fff; color: var(--ink); border-color: var(--rule); }
.button.ghost:hover { border-color: var(--accent); color: var(--accent); }
.link-quiet {
    background: none; border: 0; padding: 0;
    font: inherit; font-size: 0.85rem;
    color: var(--muted); text-decoration: underline; cursor: pointer;
}
.link-quiet:hover { color: var(--ink); }
.link-quiet.danger:hover { color: var(--down); }

/* ---------- Afschrift ---------- */
.ledger { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.ledger th, .ledger td { padding: 0.55rem 0.6rem; text-align: left; border-bottom: 1px solid var(--rule); }
.ledger thead th { font-size: 0.78rem; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--ink); }
.ledger .num { text-align: right; }
.ledger tbody tr:nth-child(even) { background: #fafbfa; }
.ledger .opening td { background: var(--accent-soft); font-weight: 500; }
.ledger .empty td { color: var(--muted); padding: 1.5rem 0.6rem; text-align: center; }
.ledger .in { color: var(--up); }
.ledger .out { color: var(--down); }
.ledger tfoot td { border-top: 2px solid var(--ink); border-bottom: 0; font-weight: 600; padding-top: 0.7rem; }
.ledger .col-act { text-align: right; white-space: nowrap; }
.ledger .col-act a { margin-right: 0.6rem; }
.ledger .col-date { width: 92px; }

/* ---------- Afschriftpagina ---------- */
.statement-sub { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.85rem; }
.statement-close {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem 3rem;
    margin: 1.5rem 0 0;
    padding-top: 1.1rem;
    border-top: 1px solid var(--rule);
}
.statement-close dt { color: var(--muted); font-size: 0.8rem; }
.statement-close dd {
    margin: 0.15rem 0 0;
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    font-size: 1.05rem;
}
.statement-close .hint { display: inline; margin-left: 0.4rem; font-family: var(--sans); }

/* ---------- Accounts ---------- */
.role-tag {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0.05rem 0.4rem;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-size: 0.68rem;
    opacity: 0.75;
    vertical-align: middle;
}
.accounts { margin-bottom: 1.75rem; }
.accounts td, .accounts th { font-size: 0.88rem; }
.accounts-forms h3 { margin: 0; font-size: 0.95rem; font-weight: 600; }
.accounts-forms .hint { display: block; }

.sqlbox {
    margin: 0;
    padding: 0.9rem 1rem;
    background: var(--ink);
    color: #e7ece9;
    border-radius: var(--radius);
    font-family: var(--mono);
    font-size: 0.85rem;
    overflow-x: auto;
    white-space: pre-wrap;
}

/* ---------- Meldingen ---------- */
.notice {
    padding: 0.65rem 0.9rem;
    border-left: 3px solid var(--accent);
    background: var(--accent-soft);
    border-radius: 0 var(--radius) var(--radius) 0;
    margin: 0 0 1.25rem;
    font-size: 0.9rem;
}
.notice.ok { border-color: var(--up); background: #eaf3ef; }
.notice.error { border-color: var(--down); background: #f8ece9; }
.notice.warn { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- Inloggen en installatie ---------- */
.auth-page { display: grid; place-items: center; min-height: 100vh; padding: 1.5rem; }
.auth-card {
    width: 100%; max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--rule);
    border-top: 3px solid var(--accent);
    border-radius: var(--radius);
    padding: 1.75rem;
}
.auth-brand { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.5rem; }
/* Logo van rand tot rand, boven in de kaart. De negatieve marges halen de
   binnenruimte van .auth-card weg, zodat het logo de hele breedte pakt. */
.auth-brand.logo-only {
    display: block;
    margin: -1.75rem -1.75rem 1.6rem;
    padding: 0;
    overflow: hidden;
    border-radius: var(--radius) var(--radius) 0 0;
}
.auth-brand.logo-only .login-logo {
    display: block;
    width: 100%;
    height: auto;
    max-width: none;
    max-height: none;
}
.auth-brand.style-zwart .login-logo { filter: brightness(0); }
.auth-brand.logo-only.style-donker { background: var(--ink); padding: 1.25rem; }
.auth-card form { display: grid; gap: 0.9rem; }
.auth-card .button { justify-self: start; }
.auth-card .logo { max-height: 40px; }
.auth-card.wide { max-width: 520px; }
.auth-card h1 { margin-bottom: 1rem; }
.auth-card .sqlbox { margin-bottom: 1rem; }

.logo-row { display: flex; gap: 1.5rem; align-items: start; flex-wrap: wrap; }
.logo-preview {
    display: grid; place-items: center;
    min-width: 160px; min-height: 80px;
    background: var(--ink);
    border-radius: var(--radius);
    padding: 0.75rem;
}
.logo-preview img { max-height: 56px; max-width: 200px; }
.logo-row .grow { flex: 1 1 260px; display: grid; gap: 0.9rem; }

/* Voorbeeld van de inlogkaart, op dezelfde breedte als het echte scherm */
.login-preview {
    width: 100%;
    max-width: 320px;
    background: #fff;
    border: 1px solid var(--rule);
    border-top: 3px solid var(--accent);
    border-radius: var(--radius);
    overflow: hidden;
}
.login-preview img { display: block; width: 100%; height: auto; }
.login-preview img.to-black { filter: brightness(0); }
.login-preview.dark { padding-top: 0; }
.login-preview.dark img { background: var(--ink); padding: 1rem; }
.login-preview .logo-mark { margin: 1rem auto 0; }
.login-preview-body {
    margin: 0;
    padding: 0.9rem 1rem 1rem;
    color: var(--muted);
    font-size: 0.75rem;
    text-align: center;
}

@media (max-width: 820px) {
    .summary { grid-template-columns: 1fr; }
    .summary-stats { border-left: 0; padding-left: 0; border-top: 1px solid var(--rule); padding-top: 1rem; }
    .tx-form > label, .tx-form .f-actions, .tx-form .f-note { grid-column: span 12 !important; }
    .grid-2 { grid-template-columns: 1fr; }
    .panel { padding: 1rem; }
    .ledger { display: block; overflow-x: auto; white-space: nowrap; }
    .topbar { gap: 0.75rem; }
    .topnav { margin-left: 0; order: 3; width: 100%; }
    .topuser { margin-left: auto; }
}
