:root {
  --cm-groen: #4EA553;
  --cm-groen-donker: #1D4A2C;
  --cm-groen-licht: #E6F4E8;
  --tekst: #1b1f1d;
  --tekst-zacht: #5a655e;
  --rand: #dfe6e1;
  --achtergrond: #f5f7f6;
  --wit: #ffffff;
  --fout: #c0392b;
  --waarschuwing: #b8860b;
  --radius: 10px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--achtergrond);
  color: var(--tekst);
}

button, input, select, textarea { font-family: inherit; font-size: 14px; }

a { color: var(--cm-groen-donker); }

/* ---------- Login ---------- */
#login-scherm {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cm-groen-donker);
}
.login-kaart {
  background: var(--wit);
  border-radius: var(--radius);
  padding: 40px;
  width: 340px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0,0,0,0.25);
}
.login-kaart img { width: 72px; margin-bottom: 16px; }
.login-kaart h1 { font-size: 18px; margin: 0 0 24px; color: var(--cm-groen-donker); }
.login-kaart input {
  width: 100%; padding: 10px 12px; margin-bottom: 12px;
  border: 1px solid var(--rand); border-radius: 6px;
}
.login-kaart button {
  width: 100%; padding: 11px; background: var(--cm-groen); color: white;
  border: none; border-radius: 6px; font-weight: 600; cursor: pointer;
}
.login-kaart button:hover { background: var(--cm-groen-donker); }
.login-fout { color: var(--fout); font-size: 13px; margin-top: 10px; min-height: 16px; }

/* ---------- App-layout ---------- */
#app-scherm { display: none; min-height: 100vh; }
#app-scherm.actief { display: flex; }

#zijbalk {
  width: 230px;
  flex-shrink: 0;
  background: var(--cm-groen-donker);
  color: white;
  display: flex;
  flex-direction: column;
  padding: 20px 0;
}
.zijbalk-logo { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px 20px 20px; border-bottom: 1px solid rgba(255,255,255,0.15); margin-bottom: 12px; text-align: center; }
.zijbalk-logo img { width: 72px; height: 72px; }
.zijbalk-logo .zijbalk-merk { font-weight: 700; font-size: 14px; line-height: 1.3; display: block; letter-spacing: 0.02em; }
.zijbalk nav { flex: 1; }
.nav-item {
  display: block; padding: 11px 20px; color: rgba(255,255,255,0.85);
  text-decoration: none; cursor: pointer; font-size: 14px; border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.08); }
.nav-item.actief { background: rgba(255,255,255,0.12); border-left-color: var(--cm-groen); color: white; font-weight: 600; }
.zijbalk-onder { padding: 14px 20px 0; border-top: 1px solid rgba(255,255,255,0.15); font-size: 12px; color: rgba(255,255,255,0.7); }
.zijbalk-onder button { margin-top: 8px; background: none; border: 1px solid rgba(255,255,255,0.4); color: white; padding: 6px 10px; border-radius: 6px; cursor: pointer; width: 100%; }
.zijbalk-onder button:hover { background: rgba(255,255,255,0.1); }

.zijbalk-footer { padding: 10px 20px 4px; text-align: center; font-size: 10.5px; color: rgba(255,255,255,0.45); }

.zijbalk-sectie-titel { padding: 14px 20px 4px; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; color: rgba(255,255,255,0.45); }
.nav-groep-kop {
  display: flex; align-items: center; justify-content: space-between; padding: 11px 20px;
  cursor: pointer; font-size: 14px; color: rgba(255,255,255,0.85); border-left: 3px solid transparent;
}
.nav-groep-kop:hover { background: rgba(255,255,255,0.08); }
.nav-groep-kop .nav-chevron { font-size: 10px; color: rgba(255,255,255,0.45); }
.nav-groep-kop-sub { padding-left: 32px; font-size: 13px; }
.nav-subitems { background: rgba(0,0,0,0.12); }
.nav-item.nav-subitem { padding: 9px 20px 9px 32px; font-size: 13px; }

#inhoud { flex: 1; padding: 28px 36px; overflow-y: auto; max-height: 100vh; }
#inhoud h2 { margin-top: 0; color: var(--cm-groen-donker); }

/* ---------- Algemene componenten ---------- */
.kaart {
  background: var(--wit); border: 1px solid var(--rand); border-radius: var(--radius);
  padding: 20px; margin-bottom: 20px;
}
.kaart h3 { margin-top: 0; font-size: 15px; color: var(--cm-groen-donker); }

.knop {
  background: var(--cm-groen); color: white; border: none; padding: 9px 16px;
  border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 13px;
}
.knop:hover { background: var(--cm-groen-donker); }
.knop.secundair { background: var(--wit); color: var(--cm-groen-donker); border: 1px solid var(--cm-groen); }
.knop.secundair:hover { background: var(--cm-groen-licht); }
.knop.gevaar { background: var(--fout); }
.knop.gevaar:hover { background: #972c20; }
.knop:disabled { opacity: 0.5; cursor: not-allowed; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--rand); }
th { color: var(--tekst-zacht); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }
tr:hover td { background: var(--cm-groen-licht); }
tr.klikbaar { cursor: pointer; }

.label { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }
.label.nieuw { background: #fdf0d5; color: var(--waarschuwing); }
.label.bevestigd_distributiepunt { background: var(--cm-groen-licht); color: var(--cm-groen-donker); }
.label.geannuleerd { background: #f6e3e1; color: var(--fout); }

.veld { margin-bottom: 14px; }
.veld label { display: block; font-size: 12.5px; color: var(--tekst-zacht); margin-bottom: 4px; font-weight: 600; }
.veld input, .veld select, .veld textarea {
  width: 100%; padding: 9px 10px; border: 1px solid var(--rand); border-radius: 6px;
}
.veld textarea { min-height: 90px; resize: vertical; }
.rij-velden { display: flex; gap: 14px; }
.rij-velden > .veld { flex: 1; }

.melding { padding: 10px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 14px; }
.melding.fout { background: #f6e3e1; color: var(--fout); }
.melding.ok { background: var(--cm-groen-licht); color: var(--cm-groen-donker); }
.melding.waarschuwing { background: #fdf0d5; color: var(--waarschuwing); }

.tellingen { display: flex; gap: 16px; margin-bottom: 20px; }
.telling { background: var(--wit); border: 1px solid var(--rand); border-radius: var(--radius); padding: 16px 22px; flex: 1; }
.telling .getal { font-size: 26px; font-weight: 700; color: var(--cm-groen-donker); }
.telling .omschrijving { font-size: 12.5px; color: var(--tekst-zacht); }

.toelichting { font-size: 12.5px; color: var(--tekst-zacht); margin-top: -8px; margin-bottom: 14px; }
.terug-link { display: inline-block; margin-bottom: 14px; font-size: 13px; cursor: pointer; color: var(--cm-groen-donker); }
.bijlage-rij { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--rand); font-size: 13px; }

.product-kaarten-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-top: 10px; }
.product-kaart {
  border: 1px solid var(--rand); border-radius: var(--radius); overflow: hidden; cursor: pointer;
  background: var(--wit); transition: box-shadow 0.15s, transform 0.15s;
}
.product-kaart:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.08); transform: translateY(-1px); }
.product-kaart-foto { width: 100%; height: 110px; object-fit: cover; display: block; background: var(--cm-groen-licht); }
.product-kaart-foto-leeg {
  width: 100%; height: 110px; display: flex; align-items: center; justify-content: center;
  background: var(--cm-groen-licht); color: var(--cm-groen-donker); font-size: 12px;
}
.product-kaart-inhoud { padding: 10px 12px; }
.product-kaart-inhoud h4 { margin: 0 0 4px; font-size: 14px; }
.product-kaart-detail { display: block; font-size: 12px; color: var(--tekst-zacht); }

.productenkiezer-categorie { margin-bottom: 8px; border: 1px solid var(--rand); border-radius: 6px; overflow: hidden; }
.productenkiezer-categorie summary { padding: 9px 12px; cursor: pointer; font-weight: 600; font-size: 13.5px; background: var(--cm-groen-licht); color: var(--cm-groen-donker); }
.productenkiezer-rij {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer;
  border-top: 1px solid var(--rand); font-size: 13.5px;
}
.productenkiezer-rij:hover { background: var(--cm-groen-licht); }
.productenkiezer-plus { color: var(--cm-groen); font-weight: 700; }
.productenkiezer-naam { flex: 1; }
.productenkiezer-voorraad { font-size: 12px; color: var(--tekst-zacht); }
.leeg-bericht { color: var(--tekst-zacht); font-style: italic; }
