/* Energylab — gedeelde stijl. Rollen als CSS-variabelen, licht/donker automatisch. */
:root {
  --surface-0: #f4f3f0;
  --surface-1: #fcfcfb;
  --surface-2: #edecf0;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #8a887f;
  --border: #e2e1dc;
  --accent: #2a78d6;        /* net/inkoop */
  --accent-pv: #eda100;     /* zon */
  --accent-accu: #1baf7a;   /* accu */
  --accent-prijs: #4a3aa7;  /* prijs */
  --status-goed: #0ca30c;
  --status-amber: #fab219;
  --status-rood: #d03b3b;
  --grid: #eeede9;
  --shadow: 0 1px 3px rgb(0 0 0 / 0.07), 0 6px 18px rgb(0 0 0 / 0.05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --surface-0: #121211;
    --surface-1: #1a1a19;
    --surface-2: #232322;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #8a887f;
    --border: #32322f;
    --accent: #3987e5;
    --accent-pv: #c98500;
    --accent-accu: #199e70;
    --accent-prijs: #9085e9;
    --grid: #262624;
    --shadow: 0 1px 3px rgb(0 0 0 / 0.4);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--surface-0);
  color: var(--text-primary);
  line-height: 1.55;
  font-size: 16px;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* Topbalk */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
}
.topbar .logo {
  font-weight: 700; font-size: 1.05rem; letter-spacing: 0.02em;
  color: var(--text-primary); display: flex; align-items: center; gap: 8px;
}
.topbar .logo .bolt { color: var(--accent-pv); }
.topbar nav { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.topbar nav a { color: var(--text-secondary); font-size: 0.92rem; }
.topbar nav a.actief { color: var(--text-primary); font-weight: 600; }

/* Kaarten & tegels */
.grid { display: grid; gap: 16px; }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 4px; font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }
.card h3 { margin: 0 0 12px; font-size: 1.05rem; }
.kpi { font-size: 1.9rem; font-weight: 700; font-variant-numeric: tabular-nums; margin: 2px 0; }
.kpi .eenheid { font-size: 0.95rem; font-weight: 500; color: var(--text-muted); margin-left: 4px; }
.kpi-sub { font-size: 0.85rem; color: var(--text-muted); }
.kpi.pv { color: var(--accent-pv); }
.kpi.accu { color: var(--accent-accu); }
.kpi.net { color: var(--accent); }
.kpi.prijs { color: var(--accent-prijs); }

/* Stroomrichting-indicator */
.richting { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--text-secondary); }
.richting .dot { width: 8px; height: 8px; border-radius: 50%; }

/* Grafieken */
.chart-box { position: relative; height: 300px; }
.chart-box.klein { height: 220px; }

/* Tabellen */
.tabel-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--text-secondary); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:hover td { background: var(--surface-2); }

/* Status-stipjes (datakwaliteit) */
.stip { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: baseline; }
.stip.groen { background: var(--status-goed); }
.stip.amber { background: var(--status-amber); }
.stip.rood { background: var(--status-rood); }

/* Labels investeringen */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600;
  background: var(--surface-2); color: var(--text-secondary);
  border: 1px solid var(--border); white-space: nowrap;
}
.badge.verdient-terug { color: var(--status-goed); border-color: currentColor; }
.badge.deels-terug { color: var(--accent); border-color: currentColor; }
.badge.versterkt-ander { color: var(--accent-prijs); border-color: currentColor; }
.badge.comfort-zekerheid { color: var(--text-secondary); }
.badge.onvoldoende-data { color: var(--status-amber); border-color: currentColor; }

/* Formulieren */
form.veldgroep { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
input, select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-1); color: var(--text-primary); font-size: 0.95rem; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
button, .knop {
  display: inline-block; padding: 10px 20px; border: none; border-radius: 8px;
  background: var(--accent); color: #fff; font-weight: 600; font-size: 0.95rem;
  cursor: pointer; font-family: inherit;
}
button:hover, .knop:hover { filter: brightness(1.1); text-decoration: none; }
button.stil { background: var(--surface-2); color: var(--text-primary); border: 1px solid var(--border); }
button.gevaar { background: var(--status-rood); }

/* Auth-pagina's */
.auth-kader { max-width: 400px; margin: 8vh auto; }
.auth-kader .card { padding: 32px; }
.auth-kader h1 { font-size: 1.3rem; margin: 0 0 18px; }
.auth-kader form > * + * { margin-top: 14px; }
.fout { background: color-mix(in srgb, var(--status-rood) 12%, transparent); color: var(--status-rood);
  padding: 10px 14px; border-radius: 8px; font-size: 0.9rem; }

.melding { color: var(--text-muted); font-size: 0.88rem; }
.sectie { margin-bottom: 28px; }
h1.pagina-titel { font-size: 1.5rem; margin: 0 0 20px; }
.voet { margin: 48px 0 24px; text-align: center; color: var(--text-muted); font-size: 0.82rem; }

/* Tijdlijn */
.tijdlijn { list-style: none; margin: 0; padding: 0 0 0 24px; border-left: 2px solid var(--border); }
.tijdlijn li { position: relative; padding: 0 0 20px 18px; }
.tijdlijn li::before {
  content: ''; position: absolute; left: -30px; top: 6px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--accent); border: 2px solid var(--surface-1);
}
.tijdlijn .datum { font-size: 0.8rem; color: var(--text-muted); }
.tijdlijn .titel { font-weight: 600; }

@media (max-width: 640px) {
  .kpi { font-size: 1.5rem; }
  .chart-box { height: 240px; }
}
