:root {
  --bg: #0F1417;
  --panel: #171E23;
  --line: #232B31;
  --text: #E8EDF0;
  --muted: #8B98A0;

  --c-import: #4FA3D1;
  --c-export: #6FCF97;
  --c-solar: #F2A93B;
  --c-price: #9B8AFB;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.flash {
  background: #3A2020;
  color: #F2B8B8;
  border-bottom: 1px solid #5A2C2C;
  padding: 10px 20px;
  font-size: 14px;
}

/* ---- Login ---- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-panel {
  width: 100%;
  max-width: 320px;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.login-mark {
  font-size: 28px;
  color: var(--c-solar);
  margin-bottom: 4px;
}

.login-panel h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
}

.login-sub {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13px;
}

.login-panel label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 12px;
}

.login-panel input {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 12px;
  margin-top: 4px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
}

.login-panel input:focus {
  outline: 2px solid var(--c-import);
  outline-offset: -1px;
}

.login-panel button {
  margin-top: 22px;
  background: var(--c-import);
  color: #0F1417;
  border: none;
  padding: 12px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.login-panel button:hover { filter: brightness(1.08); }

/* ---- Dashboard ---- */
/* min(1500px, 95vw) i.p.v. een hard afgekapte 1500px, zodat het op een
   laptop-breedte (bijv. 1280-1366px) meeschaalt i.p.v. een horizontale
   scrollbar te forceren. Was ooit 920px; sitebreed verruimd zodat brede
   tabellen (jaarsimulatie, accu-dimensionering met vergelijkingskolommen)
   niet meer knellen. Tekstblokken (.calc-intro) en formuliergrids
   (.calc-grid) krijgen hieronder een eigen, smallere max-width, zodat die
   niet lelijk uitrekken op de bredere pagina. */
.wrap {
  max-width: min(1500px, 95vw);
  margin: 0 auto;
  padding: 28px 20px 60px;
}

.top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 16px;
  margin-bottom: 24px;
}

.top h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

/* Menu (.hoofdmenu): zie static/menu.css. .logout is niet meer het menu,
   maar de stijl van losse links (CSV, PDF, Download, Dagdetail). */
.logout {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}

.logout:hover { color: var(--text); }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  margin-bottom: 20px;
  /* 1260 = 7/6 × 1080 (en die was 6/5 × de oude 900px): met de zevende
     tegel (Zonnepanelen verwacht) blijft elke tegel 178,8px breed. */
  max-width: 1260px;
}

.stat {
  background: var(--panel);
  padding: 18px 16px;
  border-top: 2px solid transparent;
}

.stat-import { border-top-color: var(--c-import); }
.stat-export { border-top-color: var(--c-export); }
.stat-solar  { border-top-color: var(--c-solar); }
.stat-price  { border-top-color: var(--c-price); }
.stat-netto  { border-top-color: var(--muted); }
.stat-saldering { border-top-color: var(--text); }

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.stat-value {
  font-family: "IBM Plex Mono", monospace;
  font-size: 26px;
  font-weight: 500;
}

.stat-value small {
  font-size: 13px;
  color: var(--muted);
  margin-left: 4px;
}

.stat-value-negative {
  color: var(--c-export);
}

.stat-note {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

/* Saldering-tegel: teruglevering boven afname is niet saldeerbaar.
   Na .stat-note, anders wint die (zelfde specificiteit). */
.stat-value-warn,
.stat-note-warn {
  color: var(--c-solar);
}

/* "Import dit jaar" + "6169.6 kWh" past niet op één regel in een tegel van
   ~179px; daarom één kopje "Dit jaar" en korte labels eronder. */
.stat-rows-kop {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-rows {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.stat-rows div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.stat-rows dt { margin: 0; white-space: nowrap; }

/* Tegel "Zonnepanelen verwacht" (dashboard.html, data uit /wp/api/zon). */
.zon-balk {
  height: 6px;
  margin-top: 8px;
  background: var(--line);
}

.zon-balk-vul {
  width: 0;
  height: 100%;
  background: var(--c-solar);
  transition: width 0.4s ease;
}

/* hidden-attribuut moet winnen van display: block op .stat-rows-kop e.d. */
.stat-zon [hidden] {
  display: none;
}

/* "niet beschikbaar" past niet in 26px mono in een tegel van ~179px. */
.stat-value.zon-fout {
  font-size: 15px;
  color: var(--muted);
}

.zon-bron {
  font-size: 11px;
  margin-top: 10px;
}

.zon-meer {
  display: inline-block;
  margin-top: 4px;
  font-size: 12px;
}

.stat-rows dd {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  color: var(--text);
  white-space: nowrap;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 20px;
  margin-bottom: 20px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.sub-label {
  color: var(--muted);
  font-weight: 400;
  font-size: 13px;
}

.muted-note {
  color: var(--muted);
  font-size: 13px;
  margin: 4px 0 0;
}

.panel-fallback {
  opacity: 0.7;
}

.panel-fallback h2 {
  font-weight: 500;
  font-size: 14px;
}

.range-label {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-family: "IBM Plex Mono", monospace;
}

.panel-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
  justify-content: space-between;
}

.nav-switch {
  display: flex;
}

.nav-switch button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  width: 36px;
  min-height: 36px;
  cursor: pointer;
}

.nav-switch button:first-child { border-right: none; }

.nav-switch button:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--muted);
}

.nav-switch button:disabled {
  opacity: 0.35;
  cursor: default;
}

.period-total {
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.period-total strong {
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
}

.range-switch button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  padding: 8px 10px;
  min-height: 36px;
  cursor: pointer;
}

.range-switch button + button { border-left: none; }

.range-switch button.active {
  background: var(--c-import);
  color: #0F1417;
  border-color: var(--c-import);
}

.price-strip {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 110px;
  overflow-x: auto;
}

.price-bar {
  flex: 1 1 20px;
  min-width: 20px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
}

.price-bar-fill {
  width: 100%;
  background: var(--c-price);
  min-height: 4px;
}

.price-bar-hour {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  color: var(--muted);
}

.price-bar-past .price-bar-fill {
  background: var(--muted);
  opacity: 0.5;
}

.price-bar-past .price-bar-hour {
  opacity: 0.5;
}

.chart-wrap {
  position: relative;
  height: clamp(220px, 45vh, 320px);
}

.foot {
  text-align: right;
}

.foot a {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.foot a:hover { color: var(--text); }

/* ---- Meterstanden ---- */
.filter-form {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-field label {
  font-size: 12px;
  color: var(--muted);
}

.filter-field input {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
}

.filter-field input:focus {
  outline: 2px solid var(--c-import);
  outline-offset: -1px;
}

.filter-form button {
  background: var(--c-import);
  color: #0F1417;
  border: none;
  padding: 9px 16px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

.filter-form button:hover { filter: brightness(1.08); }

.reset-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
  align-self: center;
}

.reset-link:hover { color: var(--text); }

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.data-table tr.row-gap {
  background: rgba(242, 169, 59, 0.12);
}

.data-table tr.row-gap td:last-child {
  color: var(--c-solar);
  font-weight: 600;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 18px;
}

.pager-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}

.pager-link:hover:not(.disabled) { color: var(--text); }

.pager-link.disabled {
  opacity: 0.35;
  border-bottom-color: transparent;
}

.pager-status {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--muted);
}

/* ---- Rekenmodule ---- */
.calc-intro {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  margin: 0 0 20px;
  max-width: 760px;
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px 20px;
  margin-bottom: 20px;
  max-width: 900px;
}

.calc-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.calc-field-label {
  font-size: 12px;
  color: var(--muted);
}

.calc-field input[type="number"],
.calc-field input[type="month"],
.calc-field input[type="date"],
.calc-field input[type="text"],
.calc-field select {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  width: 100%;
}

.calc-field input:focus,
.calc-field select:focus {
  outline: 2px solid var(--c-import);
  outline-offset: -1px;
}

.calc-radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 400;
  color: var(--text);
}

.calc-subgroup {
  grid-column: span 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 14px;
}

.calc-section-title {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 4px 0 -6px;
}

.calc-submit {
  background: var(--c-import);
  color: #0F1417;
  border: none;
  padding: 10px 20px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

.calc-submit:hover { filter: brightness(1.08); }

.calc-submit:disabled {
  opacity: 0.6;
  cursor: default;
  filter: none;
}

.data-table tr.row-total td {
  font-weight: 600;
  border-top: 2px solid var(--line);
  border-bottom: none;
}

.data-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.cov-yes { color: var(--c-export); font-weight: 600; }
.cov-no  { color: var(--muted); }

/* ---- Mobile-first: base styles above target ~360-400px, improvements from here up ---- */
@media (min-width: 640px) {
  .panel-controls { width: auto; justify-content: flex-start; }
}
