:root {
  --groen: #3f7d20;
  --groen-donker: #2e5c17;
  --groen-licht: #eaf3e1;
  --oranje: #e8792c;
  --oranje-donker: #c8621f;
  --tekst: #2b2b2b;
  --grijs: #6b6b6b;
  --rand: #e0e0e0;
  --bg: #f7f8f5;
  --wit: #ffffff;
  --rood: #b3261e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--tekst);
}

.topbar {
  background: var(--wit);
  border-bottom: 3px solid var(--groen);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  background: var(--groen);
  color: white;
  font-weight: 700;
  border-radius: 8px;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
}
.brand-title { font-weight: 700; font-size: 18px; color: var(--groen-donker); }
.brand-sub { font-size: 12px; color: var(--grijs); }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab-btn {
  border: none;
  background: var(--groen-licht);
  color: var(--groen-donker);
  padding: 8px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
.tab-btn.active, .tab-btn:hover { background: var(--groen); color: white; }

main { padding: 20px 24px 60px; max-width: 1200px; margin: 0 auto; }

h1 { color: var(--groen-donker); font-size: 22px; margin-bottom: 16px; }
h2 { color: var(--groen-donker); font-size: 16px; margin: 0 0 10px; }

.hidden { display: none !important; }

.cards { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.card {
  background: var(--wit);
  border: 1px solid var(--rand);
  border-left: 5px solid var(--oranje);
  border-radius: 8px;
  padding: 14px 18px;
  min-width: 180px;
  flex: 1;
}
.card .value { font-size: 26px; font-weight: 700; color: var(--groen-donker); }
.card .label { font-size: 13px; color: var(--grijs); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

.panel {
  background: var(--wit);
  border: 1px solid var(--rand);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.scroll-box { max-height: 260px; overflow-y: auto; }
.scroll-box.tall { max-height: 340px; }

.row-line {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 6px 0; border-bottom: 1px solid #f0f0f0; font-size: 14px;
}
.row-line:last-child { border-bottom: none; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 700;
}
.badge-orange { background: #fce6d3; color: var(--oranje-donker); }
.badge-red { background: #f8d7d5; color: var(--rood); }
.badge-green { background: var(--groen-licht); color: var(--groen-donker); }

.form-card {
  background: var(--wit);
  border: 1px solid var(--rand);
  border-radius: 8px;
  padding: 20px;
  max-width: 900px;
}
.form-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; align-items: end; }
.form-row label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 13px; color: var(--grijs); flex: 1; min-width: 200px;
}
.form-row label.full { flex-basis: 100%; }
.checkbox-label { flex-direction: row !important; align-items: center; gap: 8px !important; }
.checkbox-label input { width: auto; }

input, select {
  padding: 8px 10px;
  border: 1px solid var(--rand);
  border-radius: 6px;
  font-size: 14px;
  color: var(--tekst);
  background: var(--wit);
}
input:focus, select:focus { outline: 2px solid var(--groen); }

.primary-btn {
  background: var(--groen);
  color: white; border: none; border-radius: 6px;
  padding: 10px 20px; font-size: 14px; font-weight: 700; cursor: pointer;
}
.primary-btn:hover { background: var(--groen-donker); }

.secondary-btn {
  background: var(--wit);
  color: var(--groen-donker);
  border: 1.5px solid var(--groen);
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.secondary-btn:hover { background: var(--groen-licht); }

.link-btn {
  background: none; border: none; color: var(--oranje-donker);
  font-weight: 600; cursor: pointer; text-decoration: underline; font-size: 13px;
}

.form-feedback { margin-top: 10px; font-size: 14px; }
.form-feedback.error { color: var(--rood); }
.form-feedback.ok { color: var(--groen-donker); }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input { flex: 1; min-width: 220px; }
.spacer { flex: 1; }

.table-wrap {
  background: var(--wit);
  border: 1px solid var(--rand);
  border-radius: 8px;
  overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #f0f0f0; }
th { background: var(--groen-licht); color: var(--groen-donker); position: sticky; top: 0; }
tr:hover td { background: #fafcf7; }

.hint { color: var(--grijs); font-size: 13px; margin: -8px 0 16px; }

.esf-box {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff6ee;
  border: 2px solid var(--oranje);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 16px;
  cursor: pointer;
}
.esf-box input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--oranje); flex: none; }
.esf-box-text { display: flex; flex-direction: column; gap: 2px; }
.esf-box-text strong { color: var(--oranje-donker); font-size: 15px; }
.esf-box-text small { color: var(--grijs); font-size: 12px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: var(--groen-licht);
  color: var(--groen-donker);
  border-radius: 14px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 600;
}

.infographic-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  flex-wrap: wrap; gap: 12px; margin-bottom: 16px;
}
.infographic-periode { display: flex; align-items: center; gap: 8px; }

.infographic-card {
  background: var(--wit);
  border: 1px solid var(--rand);
  border-radius: 12px;
  padding: 32px 36px;
}

.infographic-hero { text-align: center; padding-bottom: 20px; border-bottom: 1px solid #f0f0f0; margin-bottom: 24px; }
.infographic-hero .hero-value { font-size: 48px; font-weight: 800; color: var(--groen-donker); line-height: 1; }
.infographic-hero .hero-label { font-size: 15px; color: var(--grijs); margin-top: 6px; }

.infographic-substats {
  display: flex; justify-content: center; gap: 0; flex-wrap: wrap;
  margin-bottom: 32px;
}
.infographic-substat {
  padding: 0 28px; text-align: center; border-right: 1px solid #eee;
}
.infographic-substat:last-child { border-right: none; }
.infographic-substat .value { font-size: 24px; font-weight: 700; color: var(--tekst); }
.infographic-substat .value.accent { color: var(--oranje-donker); }
.infographic-substat .label { font-size: 12px; color: var(--grijs); margin-top: 2px; }

.infographic-section { margin-bottom: 32px; }
.infographic-section:last-child { margin-bottom: 0; }
.infographic-section h3 { font-size: 15px; color: var(--groen-donker); margin: 0 0 4px; }
.infographic-section .caption { font-size: 13px; color: var(--grijs); margin: 0 0 14px; }

.flow-row { display: flex; align-items: center; gap: 18px; }
.flow-col { flex: 1; }
.flow-col-label { font-size: 12px; color: var(--grijs); margin-bottom: 6px; }
.flow-icon {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  background: var(--groen-licht); color: var(--groen-donker);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
}

.rank-list { display: flex; flex-direction: column; gap: 10px; }
.rank-item { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.rank-item .rank-naam { flex: 0 0 140px; color: var(--tekst); }
.rank-bar-track { display: block; flex: 1; background: #f0f0f0; border-radius: 4px; height: 10px; overflow: hidden; }
.rank-bar-fill { display: block; height: 100%; border-radius: 4px; }
.rank-item .rank-waarde { flex: 0 0 90px; text-align: right; color: var(--grijs); font-size: 12px; }

.tick-label { font-size: 11px; fill: var(--grijs); font-family: inherit; }
.baseline { stroke: var(--rand); stroke-width: 1; }
.stack-seg { stroke: var(--wit); stroke-width: 1; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--grijs); }
.legend-item { display: flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

.subtabs { display: flex; gap: 8px; margin-bottom: 16px; }
.subtab-btn {
  border: 1.5px solid var(--groen);
  background: var(--wit);
  color: var(--groen-donker);
  padding: 6px 16px;
  border-radius: 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.subtab-btn.active { background: var(--groen); color: white; }

.link-btn.danger { color: var(--rood); }

.tag-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-pill {
  display: inline-flex; align-items: center;
  border: 1.5px solid var(--rand);
  border-radius: 14px;
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  background: var(--wit);
  color: var(--tekst);
}
.tag-pill input { display: none; }
.tag-pill.selected { background: var(--oranje); border-color: var(--oranje); color: white; font-weight: 600; }
.tag-pill-archived { border-style: dashed; opacity: .8; }
.tag-pill-empty { color: var(--grijs); font-size: 13px; }

.product-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.product-tag {
  background: #fff2e6; color: var(--oranje-donker);
  border-radius: 10px; padding: 2px 8px; font-size: 11px; font-weight: 600;
}

.card.card-clickable { cursor: pointer; transition: box-shadow .15s, transform .15s; }
.card.card-clickable:hover { box-shadow: 0 2px 8px rgba(0,0,0,.1); transform: translateY(-1px); }

.setup-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, var(--groen-licht), var(--bg));
}
.setup-box {
  background: var(--wit);
  border: 1px solid var(--rand);
  border-top: 6px solid var(--oranje);
  border-radius: 10px;
  padding: 32px;
  max-width: 520px;
  text-align: center;
}
.setup-box h1 { font-size: 20px; }
.setup-box p { color: var(--grijs); font-size: 14px; line-height: 1.5; }
.setup-box code {
  background: var(--groen-licht); color: var(--groen-donker);
  padding: 1px 6px; border-radius: 4px; font-size: 13px;
}
.setup-remembered { margin-bottom: 16px; }
.setup-or { font-size: 12px; color: var(--grijs); margin: 10px 0; }

.conflict-banner {
  background: #fce6d3;
  color: var(--oranje-donker);
  padding: 10px 20px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
}
.conflict-banner button { color: var(--oranje-donker); margin-left: 8px; }

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal-box {
  background: white; border-radius: 10px; padding: 24px; width: 360px;
  display: flex; flex-direction: column; gap: 12px;
}
.modal-box label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--grijs); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
