/* TiNi gaat bewust om met geld — blauwig papier met euroteken en spikkels, wijnrode accenten. */
:root {
  --papier: #e4ecf5;
  --vlak: #fffdf8;
  --ink: #2b2220;
  --ink-zacht: #6f5f58;
  --lijn: #cbd8e6;
  --wijn: #7d2e3a;
  --wijn-diep: #5f2029;
  --wijn-zacht: #f3e3e2;
  /* gevalideerde reeks (dataviz-validator: PASS) */
  --r1: #a83a4b;
  --r2: #b37a12;
  --r3: #0a7f9e;
  --goed: #2e7d32;
  --slecht: #b3261e;
  --schaduw: 0 1px 0 rgba(43, 34, 32, .04), 0 14px 30px -20px rgba(43, 34, 32, .55);
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--papier); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--sans); font-size: 15px; line-height: 1.5; color: var(--ink);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='280' height='280'%3E%3Cg fill='%235676a0' fill-opacity='.11' font-family='Georgia,serif' font-weight='700'%3E%3Ctext x='30' y='46' font-size='22' transform='rotate(-12 30 46)'%3E€%3C/text%3E%3Ctext x='150' y='30' font-size='16' transform='rotate(10 150 30)'%3E€%3C/text%3E%3Ctext x='220' y='120' font-size='26' transform='rotate(-6 220 120)'%3E€%3C/text%3E%3Ctext x='88' y='140' font-size='14' transform='rotate(18 88 140)'%3E€%3C/text%3E%3Ctext x='170' y='210' font-size='20' transform='rotate(8 170 210)'%3E€%3C/text%3E%3Ctext x='40' y='230' font-size='17' transform='rotate(-16 40 230)'%3E€%3C/text%3E%3Ctext x='250' y='250' font-size='13' transform='rotate(0 250 250)'%3E€%3C/text%3E%3C/g%3E%3Cg fill='%235676a0' fill-opacity='.22'%3E%3Ccircle cx='110' cy='70' r='1.6'/%3E%3Ccircle cx='200' cy='72' r='1.2'/%3E%3Ccircle cx='60' cy='100' r='1.1'/%3E%3Ccircle cx='130' cy='190' r='1.5'/%3E%3Ccircle cx='255' cy='180' r='1.2'/%3E%3Ccircle cx='20' cy='160' r='1.3'/%3E%3Ccircle cx='210' cy='30' r='1'/%3E%3Ccircle cx='100' cy='250' r='1.1'/%3E%3Ccircle cx='150' cy='110' r='1'/%3E%3C/g%3E%3C/svg%3E"),
    radial-gradient(ellipse 80% 45% at 50% -10%, rgba(255, 255, 255, .8), transparent 70%),
    var(--papier);
  background-attachment: fixed;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.zacht { color: var(--ink-zacht); }
.klein { font-size: .82rem; }
code { background: var(--wijn-zacht); padding: 0 .3em; border-radius: 4px; font-size: .88em; }

/* kop */
.kop { position: sticky; top: 0; z-index: 50; background: rgba(228, 236, 245, .94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--lijn); }
.kop-binnen { max-width: 1120px; margin: 0 auto; padding: .7rem 16px; display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; }
.merk { font-family: var(--serif); font-weight: 600; font-size: 1.15rem; }
.kop-acties { display: flex; gap: .5rem; align-items: center; }
select, input[type=search], input[type=password], input[type=text] {
  border: 1px solid var(--lijn); background: var(--vlak); border-radius: 10px; padding: .5rem .7rem; min-height: 40px;
}
select:focus, input:focus, button:focus-visible { outline: 2px solid var(--wijn); outline-offset: 1px; }
.knop { background: var(--wijn); color: #fff; border: 0; border-radius: 999px; padding: .65rem 1.3rem; font-weight: 600; }
.knop:hover { background: var(--wijn-diep); }
.knop[disabled] { opacity: .6; cursor: wait; }
.knop-stil { background: transparent; border: 1px solid var(--lijn); border-radius: 999px; padding: .45rem .9rem; }
.knop-stil:hover { background: var(--vlak); }

/* slot */
.slot { min-height: calc(100vh - 60px); display: grid; place-items: center; padding: 16px; }
.slot-kaart { width: min(420px, 100%); background: var(--vlak); border: 1px solid var(--lijn); border-radius: 22px; box-shadow: var(--schaduw); padding: 2rem 1.6rem; display: grid; gap: .8rem; text-align: center; }
.slot-kaart h1 { font-family: var(--serif); margin: 0; font-size: 1.7rem; }
.slot-kaart p { margin: 0; }
.slot-icoon { font-size: 2.2rem; }
.melding { min-height: 1.3em; margin: 0; font-size: .9rem; color: var(--slecht); }
.melding.ok { color: var(--goed); }

/* dashboard */
main#dash { max-width: 1120px; margin: 0 auto; padding: 0 16px 4rem; }
.hero { padding: 1.8rem 0 1rem; }
.hero h1 { font-family: var(--serif); font-size: clamp(1.6rem, 4vw, 2.3rem); margin: 0 0 .3rem; line-height: 1.15; }
.hero p { margin: 0; }
.bovenregel { font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--wijn); font-weight: 700; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .8rem; margin-bottom: 1.2rem; }
.kpi { background: var(--vlak); border: 1px solid var(--lijn); border-radius: 16px; padding: .9rem 1rem; box-shadow: var(--schaduw); }
.kpi-label { font-size: .78rem; color: var(--ink-zacht); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.kpi-waarde { font-family: var(--serif); font-size: 1.65rem; font-weight: 600; font-variant-numeric: tabular-nums; margin: .15rem 0; }
.kpi-sub { font-size: .8rem; color: var(--ink-zacht); }
.kpi .neg { color: var(--slecht); }
.kpi .pos { color: var(--goed); }

.tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin: .2rem 0 1rem; border-bottom: 1px solid var(--lijn); }
.tab { background: none; border: 0; padding: .6rem .9rem; border-bottom: 3px solid transparent; font-weight: 600; color: var(--ink-zacht); }
.tab.actief { color: var(--wijn); border-color: var(--wijn); }

.raster { display: grid; gap: 1rem; }
.raster.twee { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.breed { grid-column: 1 / -1; }
@media (max-width: 760px) { .raster.twee { grid-template-columns: 1fr; } }
.kaart { background: var(--vlak); border: 1px solid var(--lijn); border-radius: 18px; padding: 1.1rem 1.2rem; box-shadow: var(--schaduw); min-width: 0; }
.kaart-kop { display: flex; justify-content: space-between; align-items: baseline; gap: .6rem; flex-wrap: wrap; margin-bottom: .8rem; }
.kaart-kop h2 { font-family: var(--serif); font-size: 1.15rem; margin: 0; }
.kop-tweede { margin-top: 1.4rem; }

/* categoriebalken */
.cat-lijst { display: grid; gap: .45rem; }
.cat-rij { display: grid; grid-template-columns: minmax(110px, 190px) 1fr auto; gap: .7rem; align-items: center; background: none; border: 0; padding: .25rem .3rem; border-radius: 8px; text-align: left; width: 100%; }
.cat-rij:hover { background: var(--wijn-zacht); }
.cat-naam { font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-spoor { position: relative; height: 14px; background: #f1e8db; border-radius: 4px; }
.cat-balk { position: absolute; inset: 0 auto 0 0; background: var(--r1); border-radius: 0 4px 4px 0; min-width: 2px; }
.cat-budget { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); }
.cat-bedrag { font-variant-numeric: tabular-nums; font-size: .88rem; text-align: right; min-width: 92px; }
.cat-bedrag small { display: block; color: var(--ink-zacht); font-size: .75rem; }
.cat-bedrag .over { color: var(--slecht); }

/* gestapelde balk */
.stapel { display: flex; height: 26px; gap: 2px; border-radius: 6px; overflow: hidden; margin: .4rem 0 .6rem; }
.stapel span { display: block; height: 100%; min-width: 2px; }
.legende { display: grid; gap: .3rem; }
.legende div { display: flex; align-items: center; gap: .5rem; font-size: .9rem; }
.legende i { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.legende b { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; }
.legende em { font-style: normal; color: var(--ink-zacht); min-width: 3.2em; text-align: right; font-variant-numeric: tabular-nums; }

/* tabellen */
.mini { width: 100%; border-collapse: collapse; font-size: .9rem; }
.mini th, .mini td { padding: .4rem .3rem; border-bottom: 1px solid var(--lijn); text-align: left; }
.mini th { font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-zacht); }
.mini td.num, .mini th.num, .tabel .num { text-align: right; font-variant-numeric: tabular-nums; }
.mini tr.totaal td { font-weight: 700; border-bottom: 0; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .6rem; }
.filters input[type=search] { flex: 1 1 220px; }
.tabel-wrap { overflow-x: auto; }
.tabel { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tabel th { position: sticky; top: 0; background: var(--vlak); text-align: left; padding: .5rem .4rem; border-bottom: 2px solid var(--lijn); cursor: pointer; user-select: none; white-space: nowrap; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-zacht); }
.tabel th.sorted::after { content: " ▾"; }
.tabel th.sorted.asc::after { content: " ▴"; }
.tabel td { padding: .45rem .4rem; border-bottom: 1px solid #efe5d6; vertical-align: top; }
.tabel tr:nth-child(even) td { background: #fbf7f0; }
.tabel .notitie { display: block; color: var(--ink-zacht); font-size: .78rem; }
.label { display: inline-block; font-size: .75rem; padding: .05rem .5rem; border-radius: 999px; background: #f1e8db; white-space: nowrap; }
.label.Inkomst { background: #e3f1e4; color: #1f5e23; }
.label.Transfer { background: #ececec; color: #555; }
.label.Sparen, .label.Beleggen { background: #def0f5; color: #0a5a70; }

/* trend */
.trend-svg { display: block; max-width: none; }
.trend-svg text { font-size: 11px; fill: var(--ink-zacht); font-family: var(--sans); }
.trend-svg .as { stroke: var(--lijn); }

/* plan */
.plan-rij { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; border-bottom: 1px solid #efe5d6; }
.plan-rij span:last-child { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.plan-rij.min span:last-child { color: var(--ink-zacht); }
.plan-rij.uitkomst { border-bottom: 0; font-size: 1.05rem; }
.plan-rij.uitkomst span:last-child { color: var(--goed); font-size: 1.25rem; font-family: var(--serif); }
.uitleg { font-size: .85rem; color: var(--ink-zacht); margin: .7rem 0 0; }
.voetnoot { font-size: .8rem; color: var(--ink-zacht); margin-top: 1rem; }

.stappen { padding-left: 1.2rem; margin: 0 0 .8rem; }
.stappen li { margin-bottom: .3rem; }
#pw-form { display: grid; gap: .55rem; margin-bottom: .6rem; }
#import-resultaat { margin-top: .8rem; display: grid; gap: .6rem; }
.waarschuwing { background: #fff4d6; border: 1px solid #ecd7a0; border-radius: 10px; padding: .6rem .8rem; font-size: .88rem; }

.tooltip { position: fixed; z-index: 100; pointer-events: none; background: var(--ink); color: #fff; font-size: .82rem; padding: .4rem .6rem; border-radius: 8px; max-width: 260px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); white-space: pre-line; }

@media (max-width: 600px) {
  .cat-rij { grid-template-columns: 1fr auto; row-gap: .25rem; }
  .cat-spoor { grid-column: 1 / -1; grid-row: 2; }
  .mini.top th:nth-child(1), .mini.top td:nth-child(1), .mini.top th:nth-child(4), .mini.top td:nth-child(4) { display: none; }
  .kpi-waarde { font-size: 1.4rem; }
  .tab { padding: .55rem .6rem; }
}
