/* Klantportaal (cyclus 60): shell, login-schermen, Overzicht, lijsten en
   Facturen met PO. De schermen van aftekenen.js en bestellingen.js staan in
   schermen.css. Geen externe bron (CSP): systeemlettertypes. */

:root {
  --bg: #f3f5f7;
  --inkt: #1b2836;
  --tekst: #22303f;
  --zacht: #5b6c7e;
  --mid: #46566a;
  --rand: #e2e7ed;
  --rand-zacht: #eef1f5;
  --veld: #f6f7f9;
  --veld-rand: #d6dde5;
  --accent: #ff7a18;
  --nav: #2c3d52;
  --link: #3d5d8a;
  --wacht: #a8470a;
  --wacht-bg: #fff1e6;
  --wacht-rand: #ffd2ad;
  --ok: #2f7a45;
  --ok-bg: #e8f5ec;
  --fout: #b42318;
  --fout-bg: #fdecea;
  --geel: #fff4c2;
  --geel-rand: #f2d65c;
  --kop-font: "Archivo", "Segoe UI", system-ui, -apple-system, sans-serif;
  --romp-font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --nav-hoogte: 64px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--tekst);
  font-family: var(--romp-font);
  font-size: 15px;
  line-height: 1.45;
  min-height: 100vh;
}

a { color: var(--link); }
a:hover { color: var(--inkt); }

h1, h2, h3 { font-family: var(--kop-font); color: var(--inkt); margin: 0; line-height: 1.2; overflow-wrap: anywhere; }
h1 { font-size: 32px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 700; }
p { margin: 0; }

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

[hidden] { display: none !important; }

.verborgen {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px;
}

.zacht { color: var(--zacht); }
.groot { font-size: 16px; margin-top: 6px; }
.klein { font-size: 13px; }
.zacht strong { color: var(--inkt); }

.icoon { width: 18px; height: 18px; flex: 0 0 auto; }

/* ---------- kop ---------- */

.kop { background: var(--inkt); color: #ffffff; }
.kop-binnen {
  max-width: 1240px; margin: 0 auto; padding: 0 24px; min-height: 68px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 32px;
}
.merk { display: flex; align-items: center; gap: 12px; color: #ffffff; text-decoration: none; min-width: 0; }
.merk:hover { color: #ffffff; }
.merk-blok {
  width: 34px; height: 34px; border-radius: 8px; background: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; color: var(--inkt);
}
.merk-icoon { stroke-width: 2.4; }
.merk-naam { font-family: var(--kop-font); font-weight: 800; letter-spacing: .06em; font-size: 15px; white-space: nowrap; }
.merk-sub { font-weight: 500; letter-spacing: 0; color: #b6c1cc; }
.merk-donker { color: var(--inkt); }
.merk-donker .merk-sub { color: var(--zacht); }

.hoofdnav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1 1 auto; min-width: 0; }
.hoofdnav-link {
  color: #d6dde5; text-decoration: none; padding: 10px 14px; border-radius: 8px;
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
}
.hoofdnav-link:hover { color: #ffffff; background: rgba(255, 255, 255, .06); }
.hoofdnav-link.actief { color: #ffffff; background: var(--nav); font-weight: 600; }
.hoofdnav-icoon { display: none; }

.account { display: flex; align-items: center; gap: 12px; margin-left: auto; min-width: 0; }
.account-tekst { text-align: right; line-height: 1.25; min-width: 0; }
.account-naam { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.account-ent { font-size: 12px; color: #b6c1cc; overflow-wrap: anywhere; }
.account-plek { position: relative; }
.account-knop {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--nav); color: #ffffff;
  font-weight: 600; font-size: 14px; cursor: pointer;
}
.account-knop:hover { background: #3a4f69; }
.account-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 240px; max-width: calc(100vw - 32px);
  background: #ffffff; color: var(--tekst); border: 1px solid var(--rand); border-radius: 12px;
  box-shadow: 0 8px 24px rgba(27, 40, 54, .16); padding: 14px; display: flex; flex-direction: column; gap: 6px;
}
.account-menu-naam { font-weight: 600; color: var(--inkt); overflow-wrap: anywhere; }
.account-menu-sub { font-size: 13px; color: var(--zacht); margin-bottom: 6px; overflow-wrap: anywhere; }

.banner-bekijk {
  background: var(--geel); border-bottom: 1px solid var(--geel-rand); color: #5c4400;
  font-weight: 600; text-align: center; padding: 10px 16px; overflow-wrap: anywhere;
}

/* ---------- inhoud ---------- */

.inhoud {
  max-width: 1240px; margin: 0 auto; padding: 36px 24px 64px;
  display: flex; flex-direction: column; gap: 32px; min-width: 0;
}

.pagina-kop {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; min-width: 0;
}
.pagina-kop-tekst { min-width: 0; flex: 1 1 320px; }
.groet { font-size: 34px; }

.sectie { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.kaart {
  background: #ffffff; border: 1px solid var(--rand); border-radius: 14px; padding: 20px; min-width: 0;
}
.kaart > h1 + p, .kaart > h2 + p { margin-top: 8px; }
.kaart-smal { max-width: 460px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.kaart-tabel { padding: 0; overflow: hidden; }
.kaart-kop {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 20px; border-bottom: 1px solid var(--rand-zacht);
}

.leeg { color: var(--zacht); padding: 18px 20px; }
.kaart > .leeg { padding: 0; }

/* knoppen */
.knop {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--veld-rand);
  background: #ffffff; color: var(--inkt); font-weight: 600; text-decoration: none; cursor: pointer;
  text-align: center; overflow-wrap: anywhere;
}
.knop:hover { background: var(--veld); color: var(--inkt); }
.knop-accent { background: var(--accent); border-color: var(--accent); color: var(--inkt); }
.knop-accent:hover { background: #ff8c38; color: var(--inkt); }
.knop-donker { background: var(--inkt); border-color: var(--inkt); color: #ffffff; }
.knop-donker:hover { background: #2c3d52; color: #ffffff; }
.knop-vol { width: 100%; }
.knop-klein { min-height: 32px; padding: 4px 10px; font-size: 13px; margin-top: 6px; }
.knop:disabled, .knop-link:disabled { opacity: .55; cursor: not-allowed; }
.knop-link {
  background: none; border: 0; color: var(--link); cursor: pointer; padding: 6px 4px; font-size: 13px;
  min-height: 32px; text-align: left;
}
.knop-link:hover { color: var(--inkt); text-decoration: underline; }
.link-klein { font-size: 14px; align-self: flex-start; }

/* chips */
.chip {
  display: inline-block; font-size: 13px; font-weight: 600; border-radius: 999px; padding: 5px 11px;
  white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle;
}
.chip-wacht { color: var(--wacht); background: var(--wacht-bg); }
.chip-ok { color: var(--ok); background: var(--ok-bg); }
.chip-grijs { color: var(--mid); background: var(--rand-zacht); }

.bovenschrift { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--zacht); }

/* filter */
.filter { display: flex; flex-wrap: wrap; gap: 4px; background: #e9edf1; padding: 4px; border-radius: 10px; }
.kaart-kop .filter { background: var(--bg); }
.filter-knop {
  border: 0; cursor: pointer; font-size: 14px; font-weight: 600; padding: 8px 14px; border-radius: 8px;
  min-height: 36px; background: transparent; color: var(--mid);
}
.filter-knop.aan { background: #ffffff; color: var(--inkt); box-shadow: 0 1px 2px rgba(27, 40, 54, .12); }

/* formulieren */
.formulier h1 { font-size: 26px; }
.veld { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.veld-label { font-weight: 600; font-size: 14px; color: var(--inkt); }
.veld-hint { font-size: 13px; color: var(--zacht); }
.veld input, .po-invoer {
  width: 100%; min-width: 0; min-height: 44px; font-size: 15px; padding: 10px 12px;
  border: 1px solid var(--veld-rand); border-radius: 10px; background: var(--veld); color: var(--tekst);
}
.veld input:focus, .po-invoer:focus { background: #ffffff; border-color: var(--link); }
.po-invoer:disabled { opacity: .6; cursor: not-allowed; }
.foutzin { color: var(--fout); font-weight: 600; overflow-wrap: anywhere; }
.gegevens { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; font-size: 14px; }
.gegevens dt { color: var(--zacht); }
.gegevens dd { margin: 0; color: var(--inkt); font-weight: 600; overflow-wrap: anywhere; }

/* los scherm (login, uitnodiging, …) */
.los { min-height: 100vh; padding: 48px 16px; display: flex; flex-direction: column; align-items: center; gap: 24px; }
.los-merk { display: flex; align-items: center; gap: 12px; }

/* toast */
.toast-bak {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 100;
  display: flex; flex-direction: column; gap: 8px; width: max-content; max-width: calc(100vw - 32px); pointer-events: none;
}
.toast {
  background: var(--inkt); color: #ffffff; border-radius: 10px; padding: 10px 16px; font-weight: 600;
  box-shadow: 0 6px 18px rgba(27, 40, 54, .25); overflow-wrap: anywhere;
}
.toast-ok { background: var(--ok); }
.toast-fout { background: var(--fout); }

/* ---------- Overzicht ---------- */

.tegels { display: flex; flex-wrap: wrap; gap: 12px; }
.tegel { background: #ffffff; border: 1px solid var(--rand); border-radius: 12px; padding: 12px 18px; min-width: 0; }
.tegel-label { font-size: 12px; color: var(--zacht); text-transform: uppercase; letter-spacing: .06em; }
.tegel-waarde { font-family: var(--kop-font); font-weight: 700; font-size: 22px; color: var(--inkt); font-variant-numeric: tabular-nums; }
.tegel-sub { font-size: 12px; color: var(--zacht); }

.wacht-rooster { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 16px; }
.wacht-item { display: flex; flex-direction: column; gap: 12px; }
.wacht-kop { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.wacht-titel { font-family: var(--kop-font); font-weight: 700; font-size: 18px; color: var(--inkt); overflow-wrap: anywhere; }
.wacht-item .klein { margin-top: 4px; overflow-wrap: anywhere; }
.wacht-voet { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; }
.wacht-bedrag { font-family: var(--kop-font); font-weight: 600; font-size: 17px; font-variant-numeric: tabular-nums; }

.duo { display: flex; flex-wrap: wrap; gap: 24px; min-width: 0; }
.docs-kaart { flex: 999 1 560px; padding: 0; overflow: hidden; }
.best-kaart { flex: 1 1 340px; display: flex; flex-direction: column; gap: 18px; }
.kop-link { color: var(--inkt); text-decoration: none; }
.kop-link:hover { color: var(--link); }
.best-item { display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: inherit; border-radius: 8px; }
.best-item:hover .best-titel { color: var(--link); }
.best-rij { display: flex; justify-content: space-between; gap: 8px; min-width: 0; }
.best-tekst { min-width: 0; }
.best-titel { font-weight: 600; color: var(--inkt); overflow-wrap: anywhere; }
.best-fase { font-size: 13px; font-weight: 600; color: var(--mid); white-space: nowrap; }
.balk { height: 8px; background: var(--rand-zacht); border-radius: 99px; overflow: hidden; }
.balk-vul { height: 100%; border-radius: 99px; background: var(--accent); }
.balk-0 { width: 4%; background: #c5ced8; }
.balk-25 { width: 25%; }
.balk-60 { width: 60%; }
.balk-100 { width: 100%; background: var(--ok); }

/* ---------- tabellen ---------- */

.tabel-wrap { overflow-x: auto; min-width: 0; }
.tabel { width: 100%; border-collapse: collapse; }
.tabel th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--zacht);
  font-weight: 600; padding: 12px 8px; background: #f8fafb; white-space: nowrap;
}
.tabel td { padding: 14px 8px; border-top: 1px solid var(--rand-zacht); vertical-align: top; font-size: 14px; color: var(--mid); overflow-wrap: anywhere; }
.tabel th:first-child, .tabel td:first-child { padding-left: 20px; }
.tabel th:last-child, .tabel td:last-child { padding-right: 20px; }
.tabel .rechts { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--tekst); white-space: nowrap; }
.tabel.zonder-entiteit th:nth-child(3), .tabel.zonder-entiteit td:nth-child(3) { display: none; }
.doc-nr { font-weight: 600; color: var(--inkt); font-size: 15px; overflow-wrap: anywhere; }
a.doc-nr:hover { color: var(--link); }
.doc-rij { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.soort-label {
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--mid);
  background: var(--rand-zacht); border-radius: 6px; padding: 3px 7px;
}
.tabel-voet {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding: 14px 20px;
  border-top: 1px solid var(--rand-zacht); font-size: 13px; color: var(--zacht);
}

/* Facturen met PO */
.banner-po {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; background: var(--wacht-bg);
  border: 1px solid var(--wacht-rand); border-radius: 12px; padding: 14px 18px; color: #7a3307;
}
.banner-icoon { width: 22px; height: 22px; color: var(--wacht); }
.banner-po-kop { font-weight: 600; }
.banner-po-sub { font-size: 14px; }
.tabel .po-kol { width: 340px; }
.po-form { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.po-rij { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; }
.po-form .po-rij .po-invoer { flex: 1 1 auto; font-size: 14px; }
.po-form .knop { min-height: 44px; padding: 10px 14px; font-size: 14px; flex: 0 0 auto; }
.po-toon { display: flex; flex-direction: column; gap: 4px; padding-top: 4px; }
.po-waarde { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-weight: 600; color: var(--inkt); overflow-wrap: anywhere; }
.po-stand { font-size: 13px; color: var(--zacht); }
.po-stand.po-ok { color: var(--ok); font-weight: 600; }

/* ---------- smaller scherm: de PO-kolom geeft breedte vrij ---------- */

@media (max-width: 960px) {
  .tabel .po-kol { width: auto; }
}

/* ---------- gsm (tot 720 px): tabellen worden kaarten, navigatie onderaan ---------- */

@media (max-width: 720px) {
  h1 { font-size: 26px; }
  .groet { font-size: 28px; }
  .kop-binnen { padding: 10px 16px; min-height: 56px; gap: 8px 12px; flex-wrap: nowrap; }
  .account-tekst { display: none; }
  .inhoud { padding: 20px 16px 32px; gap: 22px; }
  body.met-nav { padding-bottom: calc(var(--nav-hoogte) + env(safe-area-inset-bottom, 0px)); }

  .hoofdnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; flex-wrap: nowrap; gap: 0;
    background: var(--inkt); border-top: 1px solid #2c3d52;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px));
  }
  .hoofdnav-link {
    flex: 1 1 0; min-width: 0; flex-direction: column; gap: 2px; padding: 6px 2px; min-height: 52px;
    font-size: 11px; line-height: 1.2; text-align: center;
  }
  .hoofdnav-link span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hoofdnav-icoon { display: block; width: 20px; height: 20px; }

  .kaart { padding: 16px; }
  .kaart-tabel, .docs-kaart { padding: 0; }
  .kaart-kop { padding: 14px 16px; }
  .tegels { width: 100%; }
  .tegel { flex: 1 1 140px; }
  .duo { gap: 22px; }
  .docs-kaart, .best-kaart { flex: 1 1 100%; }

  .tabel-wrap { overflow-x: visible; }
  .tabel, .tabel tbody, .tabel tr, .tabel td { display: block; width: 100%; }
  .tabel thead { display: none; }
  .tabel tr { border-top: 1px solid var(--rand-zacht); padding: 12px 16px; }
  .tabel td {
    border: 0; padding: 4px 0; display: grid; grid-template-columns: minmax(84px, 38%) minmax(0, 1fr);
    gap: 10px; align-items: start; justify-items: start;
  }
  .tabel th:first-child, .tabel td:first-child, .tabel th:last-child, .tabel td:last-child { padding-left: 0; padding-right: 0; }
  .tabel td::before {
    content: attr(data-label); font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
    color: var(--zacht); font-weight: 600; padding-top: 2px; overflow-wrap: anywhere;
  }
  .tabel td:first-child { display: block; padding-bottom: 6px; }
  .tabel td:first-child::before { content: none; }
  .tabel .rechts { text-align: left; white-space: normal; }
  .tabel.zonder-entiteit td:nth-child(3) { display: none; }
  .tabel.facturen td.po-kol { display: block; padding-top: 8px; }
  .tabel.facturen td.po-kol::before { display: block; margin-bottom: 6px; }
}
