/* ============ Kleuren (donker = standaard) ============ */
:root {
  --bg: #0f1117;
  --bg2: #181c27;
  --bg3: #1e2330;
  --bg4: #252b3b;
  --border: rgba(255,255,255,0.09);
  --border2: rgba(255,255,255,0.16);
  --text: #e8eaf0;
  --text2: #8b93a8;
  --text3: #626b80;
  --accent: #4f8ef7;
  --accent-dim: rgba(79,142,247,0.12);
  --green: #2ecc8f;
  --green-dim: rgba(46,204,143,0.13);
  --red: #e05c6a;
  --red-dim: rgba(224,92,106,0.13);
  --amber: #f0a946;
  --amber-dim: rgba(240,169,70,0.13);
  --purple: #9b7ef0;
  --purple-dim: rgba(155,126,240,0.12);
  --teal: #3ec6c6;
  --teal-dim: rgba(62,198,198,0.12);
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 2px 12px rgba(0,0,0,0.35);
  --zijbalk: 220px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f0f2f7;
  --bg2: #ffffff;
  --bg3: #f7f8fc;
  --bg4: #eceef5;
  --border: rgba(0,0,0,0.09);
  --border2: rgba(0,0,0,0.16);
  --text: #1a1e2e;
  --text2: #505876;
  --text3: #848da6;
  --accent: #2563eb;
  --accent-dim: rgba(37,99,235,0.08);
  --green: #059669;
  --green-dim: rgba(5,150,105,0.08);
  --red: #dc2626;
  --red-dim: rgba(220,38,38,0.08);
  --amber: #d97706;
  --amber-dim: rgba(217,119,6,0.08);
  --purple: #7c3aed;
  --purple-dim: rgba(124,58,237,0.08);
  --teal: #0891b2;
  --teal-dim: rgba(8,145,178,0.08);
  --shadow: 0 2px 12px rgba(0,0,0,0.09);
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; }
.mono { font-family: 'IBM Plex Mono', monospace; }
.gedempt { color: var(--text2); }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 3px; }

/* ============ Knoppen & velden ============ */
.knop {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border: 1px solid var(--border2); background: var(--bg3);
  color: var(--text); border-radius: var(--radius-sm); cursor: pointer;
  font-size: 13px; font-weight: 500; white-space: nowrap; transition: background .15s, color .15s, border-color .15s;
}
.knop:hover { background: var(--bg4); }
.knop.primair { background: var(--accent); border-color: var(--accent); color: #fff; }
.knop.primair:hover { filter: brightness(1.1); }
.knop.gevaar { background: var(--red); border-color: var(--red); color: #fff; }
.knop.zacht { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.knop.zacht:hover { background: var(--accent); color: #fff; }
.knop.klein { padding: 5px 11px; font-size: 12px; }
.knop.breed { width: 100%; }
.knop:disabled { opacity: .45; cursor: not-allowed; }
.link { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 13px; padding: 0; text-decoration: underline; text-underline-offset: 2px; }

.fg { margin-bottom: 14px; }
.fg label { display: block; font-size: 12px; color: var(--text2); margin-bottom: 5px; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }
.fg input, .fg select, .fg textarea, .veld {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border2); background: var(--bg3);
  color: var(--text); border-radius: var(--radius-sm); font-size: 14px; outline: none; transition: border-color .15s;
}
.fg input:focus, .fg select:focus, .fg textarea:focus, .veld:focus { border-color: var(--accent); }
.fg .hulp { font-size: 12px; color: var(--text3); margin-top: 4px; }

/* ============ Aanmelden ============ */
.aanmelden { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.aanmelden-kaart {
  width: 360px; max-width: 100%; background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); text-align: left;
}
.aanmelden-kaart h1 { font-size: 19px; font-weight: 600; margin-bottom: 20px; text-align: center; }
.aanmelden-kaart p { margin-bottom: 18px; }
.aanmelden-logo { display: block; width: 52px; height: 52px; margin: 0 auto 10px; }
.aanmelden-kaart .link { display: block; margin: 14px auto 0; }
.aanmelden-fout { margin-top: 14px; color: var(--red); font-size: 13px; text-align: center; }

/* ============ App-indeling ============ */
.app { display: flex; min-height: 100%; }
.zijbalk {
  width: var(--zijbalk); flex-shrink: 0; background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; height: 100dvh; z-index: 150;
}
.zijbalk-kop { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.logo-img { width: 28px; height: 28px; }
.logo-tekst { font-weight: 600; font-size: 15px; letter-spacing: .3px; }
.menu { padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: none;
  background: transparent; color: var(--text2); border-radius: var(--radius-sm); cursor: pointer;
  text-decoration: none; font-size: 14px; text-align: left; transition: background .12s, color .12s;
}
.menu-item svg { flex-shrink: 0; }
.menu-item:hover { background: var(--bg4); color: var(--text); }
.menu-item.actief { background: var(--accent-dim); color: var(--accent); font-weight: 500; }
.menu-scheiding { height: 1px; background: var(--border); margin: 8px 4px; }
.zijbalk-voet { padding: 8px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.gebruiker { font-size: 12px; color: var(--text3); padding: 8px 12px 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zijbalk-scherm { display: none; }

.hoofd { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hoofding {
  display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: var(--bg2);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; min-height: 57px;
}
.hoofding-titel { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hoofding-rechts { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.menu-knop { display: none; border: none; background: none; color: var(--text); cursor: pointer; padding: 6px; margin-left: -6px; border-radius: var(--radius-sm); }
.menu-knop:hover { background: var(--bg4); }
.jaar-keuze {
  padding: 6px 10px; border: 1px solid var(--border2); background: var(--bg3); color: var(--text);
  border-radius: var(--radius-sm); font-size: 14px; cursor: pointer; outline: none; font-weight: 500;
}
.jaar-keuze:focus { border-color: var(--accent); }
.demo-balk { background: var(--amber-dim); color: var(--amber); border-bottom: 1px solid var(--border); padding: 7px 24px; font-size: 12px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.demo-balk .link { color: var(--amber); font-size: 12px; }
.inhoud { padding: 20px 24px 48px; width: 100%; max-width: 1150px; margin: 0 auto; container: inhoud / inline-size; }

/* ============ Gsm ============ */
@media (max-width: 860px) {
  .zijbalk { position: fixed; left: 0; top: 0; transform: translateX(-100%); box-shadow: var(--shadow); }
  .app.anim .zijbalk { transition: transform .2s ease; }  /* pas animeren na de eerste klik, niet bij het laden */
  .app.menu-open .zijbalk { transform: none; }
  .app.menu-open .zijbalk-scherm { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 140; }
  .menu-knop { display: inline-flex; }
  .hoofding { padding: 8px 16px; gap: 8px; min-height: 50px; }
  .hoofding-titel { font-size: 15px; }
  .demo-balk { padding: 6px 16px; }
  .inhoud { padding: 14px 16px 40px; }
}

/* ============ Laden ============ */
.laden { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); z-index: 300; }
.draaier { width: 30px; height: 30px; border: 3px solid var(--bg4); border-top-color: var(--accent); border-radius: 50%; animation: draai .8s linear infinite; }
@keyframes draai { to { transform: rotate(360deg); } }

/* ============ Pop-ups ============ */
.popup-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 200; display: flex;
  align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(3px);
}
.popup {
  background: var(--bg2); border: 1px solid var(--border2); border-radius: var(--radius);
  width: 420px; max-width: 100%; max-height: calc(100dvh - 32px); display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
}
.popup.breed { width: 640px; }
.popup-titel { font-size: 16px; font-weight: 600; padding: 20px 24px 14px; border-bottom: 1px solid var(--border); }
.popup-inhoud { padding: 18px 24px; overflow-y: auto; }
.popup-inhoud > p { color: var(--text2); line-height: 1.6; }
.popup-knoppen { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 24px 20px; flex-wrap: wrap; }
.popup-knoppen .knop.links { margin-right: auto; }
.popup .hulp, .popup .hulp-tekst { font-size: 12px; color: var(--text3); line-height: 1.5; }
.popup .hulp-tekst { margin-bottom: 12px; }
.fg-rij { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 500px) { .fg-rij { grid-template-columns: 1fr; } }
.vinkje { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--text2); margin: -4px 0 14px; cursor: pointer; }
.vinkje input { margin-top: 3px; accent-color: var(--accent); }
@media (max-width: 500px) {
  .popup-bg { align-items: flex-end; padding: 0; }
  .popup { border-radius: var(--radius) var(--radius) 0 0; max-height: 92dvh; }
  .popup-titel, .popup-inhoud, .popup-knoppen { padding-left: 16px; padding-right: 16px; }
  .popup-knoppen .knop { flex: 1; }
}

/* ============ Meldingen ============ */
.meldingen { position: fixed; bottom: 16px; right: 16px; left: 16px; z-index: 400; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
.melding {
  pointer-events: auto; max-width: 420px; background: var(--bg2); border: 1px solid var(--border2);
  border-left: 4px solid var(--accent); border-radius: var(--radius-sm); padding: 10px 14px;
  box-shadow: var(--shadow); font-size: 13px; animation: inschuif .2s ease;
}
.melding.ok { border-left-color: var(--green); }
.melding.fout { border-left-color: var(--red); }
.melding.weg { opacity: 0; transition: opacity .3s; }
@keyframes inschuif { from { transform: translateY(8px); opacity: 0; } }

/* ============ Gedeelde bouwstenen voor onderdelen ============ */
.kaart { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 14px; overflow: hidden; }
.kaart-kop { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--bg3); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.kaart-titel { font-size: 12px; font-weight: 500; color: var(--text3); text-transform: uppercase; letter-spacing: .07em; }
.kaart-meta { font-size: 12px; color: var(--text3); margin-left: auto; }
.kaart-inhoud { padding: 16px; }
.leeg { padding: 28px; text-align: center; color: var(--text3); font-size: 13px; }
.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 20px; font-weight: 500; letter-spacing: .03em; white-space: nowrap; }
.badge.prive { background: var(--green-dim); color: var(--green); border: 1px solid color-mix(in srgb, var(--green) 25%, transparent); }
.badge.zakelijk { background: var(--accent-dim); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.tabel-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { font-size: 11px; color: var(--text3); font-weight: 500; text-align: left; padding: 8px 16px; background: var(--bg3); border-bottom: 1px solid var(--border); text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
td { font-size: 13px; padding: 10px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th.r, td.r { text-align: right; }
td.bedrag { font-family: 'IBM Plex Mono', monospace; font-size: 12px; text-align: right; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
