:root {
  --navy: #0e2747;
  --navy-dark: #081a31;
  --blue: #164b91;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --red: #b91c1c;
  --green: #15803d;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --border: #cbd5e1;
  --paper: #fffdf7;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
}

.hidden { display: none !important; }

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Embed-modus (?embed=1) */
body.embed-mode .hero { padding: 14px 0 12px; }
body.embed-mode .hero h1 { font-size: 22px; margin-bottom: 4px; }
body.embed-mode .hero-sub { font-size: 14px; margin-bottom: 0; }
body.embed-mode .hero-stats { display: none; }
body.embed-mode .site-footer { padding: 12px 0 16px; }

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 65%, var(--blue) 100%);
  color: #fff;
  padding: 28px 0 24px;
  border-bottom: 4px solid var(--amber);
}

.hero-badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #fde68a;
  margin-bottom: 8px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: 30px;
  line-height: 1.18;
}

.hero-sub {
  margin: 0 0 18px;
  font-size: 15.5px;
  color: #dbe7f5;
  max-width: 760px;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.hstat {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  padding: 10px 12px;
}

.hstat strong {
  display: block;
  font-size: 17px;
  color: #fff;
  white-space: nowrap;
}

.hstat span {
  font-size: 12px;
  color: #cbd5e1;
}

/* Main & Tabs */
.main-wrap {
  padding-top: 20px;
  padding-bottom: 36px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.tab {
  appearance: none;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--navy);
  font-weight: 800;
  font-size: 14px;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab:hover { border-color: var(--blue); }

.tab.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Presets */
.presets-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

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

.preset-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.preset-btn:hover { border-color: var(--amber); background: var(--amber-soft); }

.preset-btn.active {
  background: var(--amber);
  border-color: var(--amber);
  color: #fff;
}

/* Layout Tab 1 */
.grid-bon {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  gap: 20px;
  align-items: start;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.card h2 {
  margin: 0 0 14px;
  font-size: 19px;
  color: var(--navy);
}

.card h3 {
  margin: 18px 0 10px;
  font-size: 15.5px;
  color: var(--navy);
}

.field-group { margin-bottom: 14px; }

.field-group label {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 5px;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.val-pill {
  background: #e0f2fe;
  color: var(--navy);
  font-size: 14px;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

select,
input[type="number"] {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14.5px;
  color: var(--text);
  background: #fff;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--blue);
  margin: 4px 0 6px;
}

.num-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.num-row input[type="number"] { max-width: 155px; }

.hint {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.field-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.toggle-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.highlight-toggle {
  background: #fffbeb;
  border-color: #fcd34d;
}

.switch-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13.5px;
  cursor: pointer;
}

.switch-row input {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: var(--navy);
}

.sub-box {
  background: #f8fafc;
  border-left: 3px solid var(--blue);
  border-radius: 0 10px 10px 0;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.extra-details {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 16px;
  background: #fafcff;
}

.extra-details summary {
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--blue);
}

.extra-body { padding-top: 12px; }

/* Component breakdown under form */
.component-summary {
  border-top: 1px solid #e2e8f0;
  padding-top: 4px;
}

.comp-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 5px 0;
  font-size: 13.5px;
  border-bottom: 1px dashed #e2e8f0;
}

.comp-row:last-child { border-bottom: none; }

.comp-row strong {
  white-space: nowrap;
  flex-shrink: 0;
  color: var(--navy);
}

/* THE THERMAL RECEIPT (KASSABON) */
.receipt {
  position: relative;
  background: var(--paper);
  border-left: 1px solid #d6d3c9;
  border-right: 1px solid #d6d3c9;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.receipt-top-edge,
.receipt-bottom-edge {
  height: 12px;
  width: 100%;
  background-repeat: repeat-x;
  background-size: 16px 12px;
}

.receipt-top-edge {
  background-image: linear-gradient(135deg, var(--bg) 50%, transparent 50%),
                    linear-gradient(225deg, var(--bg) 50%, transparent 50%);
  background-position: 0 0;
}

.receipt-bottom-edge {
  background-image: linear-gradient(315deg, var(--bg) 50%, transparent 50%),
                    linear-gradient(45deg, var(--bg) 50%, transparent 50%);
  background-position: 0 0;
}

.receipt-inner {
  padding: 14px 22px 18px;
}

.receipt-head {
  text-align: center;
  border-bottom: 2px dashed #94a3b8;
  padding-bottom: 12px;
  margin-bottom: 14px;
}

.receipt-brand {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: #475569;
  font-weight: 700;
}

.receipt-title {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 23px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--navy);
  margin: 3px 0;
}

.receipt-meta {
  font-size: 12.5px;
  color: #475569;
}

.receipt-total-box {
  background: var(--navy);
  color: #fff;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.rt-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.rt-row span {
  font-size: 13.5px;
  color: #dbe7f5;
}

.rt-big {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 27px;
  color: #fde68a;
  white-space: nowrap;
  flex-shrink: 0;
}

.rt-sub-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  color: #cbd5e1;
  margin-top: 4px;
}

.receipt-divider {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11.5px;
  font-weight: 800;
  color: #334155;
  text-align: center;
  padding: 6px 0;
  border-top: 1px dashed #94a3b8;
  border-bottom: 1px dashed #94a3b8;
  margin-bottom: 10px;
}

.receipt-line {
  padding: 7px 0;
  border-bottom: 1px dotted #cbd5e1;
}

.receipt-line:last-child { border-bottom: none; }

.rl-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.rl-name {
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
}

.rl-amt {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 14.5px;
  font-weight: 800;
  color: var(--navy);
  white-space: nowrap;
  flex-shrink: 0;
}

.rl-sub {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
}

.rl-bar-track {
  flex: 1;
  height: 6px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.rl-bar-fill {
  height: 100%;
  border-radius: 999px;
}

.rl-pct {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11.5px;
  color: #64748b;
  white-space: nowrap;
  flex-shrink: 0;
}

.receipt-sum-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 10px;
  padding: 10px 0;
  border-top: 2px dashed var(--navy);
  border-bottom: 2px dashed var(--navy);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 15px;
  font-weight: 900;
  color: var(--navy);
}

.receipt-sum-row strong {
  white-space: nowrap;
  flex-shrink: 0;
}

.receipt-sub-highlights {
  margin-top: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
}

.rsh-title {
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  color: #475569;
  margin-bottom: 6px;
}

.rsh-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  padding: 3px 0;
}

.rsh-row strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: nowrap;
  flex-shrink: 0;
  color: var(--navy);
}

.receipt-deficit-box {
  margin-top: 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 10px 12px;
}

.rdef-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  color: #991b1b;
}

.rdef-row strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 15px;
  white-space: nowrap;
  flex-shrink: 0;
}

.rdef-note {
  margin: 4px 0 0;
  font-size: 11.5px;
  color: #7f1d1d;
}

.receipt-footer-note {
  margin-top: 12px;
  text-align: center;
  font-size: 11px;
  color: #64748b;
}

/* Action buttons */
.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 9px;
  padding: 10px 15px;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
}

.btn-primary { background: var(--amber); color: #fff; }
.btn-primary:hover { background: #b45309; }

.btn-secondary { background: var(--navy); color: #fff; }
.btn-secondary:hover { background: var(--navy-dark); }

.btn-ghost { background: #fff; color: var(--navy); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--navy); }

.copy-feedback {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--green);
  min-height: 20px;
}

/* Tab 2: Eigen Begroting */
.sim-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.sim-top p {
  margin: 4px 0 0;
  font-size: 14.5px;
  color: var(--muted);
  max-width: 660px;
}

.sim-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
}

.sim-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.sim-kpi {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 14px 16px;
}

.sim-kpi.is-positive {
  background: #f0fdf4;
  border-color: #86efac;
}

.sim-kpi.is-negative {
  background: #fef2f2;
  border-color: #fecaca;
}

.sim-kpi span {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

.sim-kpi strong {
  display: block;
  font-size: 24px;
  color: var(--navy);
  margin: 3px 0;
  white-space: nowrap;
}

.sim-kpi.is-positive strong { color: var(--green); }
.sim-kpi.is-negative strong { color: var(--red); }

.sim-kpi small {
  font-size: 12px;
  color: var(--muted);
}

.sim-sliders-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.sim-slider-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}

.sim-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}

.sim-card-head strong {
  font-size: 14.5px;
  color: var(--navy);
}

.sim-delta-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.sim-delta-badge.cut { background: #dcfce7; color: #166534; }
.sim-delta-badge.add { background: #fee2e2; color: #991b1b; }

.sim-card-sub {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

.sim-share-bar {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

/* Tab 3: Uitleg & Bronnen */
.method-note {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  color: #1e3a8a;
}

.table-wrap {
  overflow-x: auto;
  margin: 14px 0 18px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table th,
.data-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
}

.data-table th {
  background: #f8fafc;
  color: var(--navy);
  font-weight: 800;
}

.data-table th.num,
.data-table td.num {
  text-align: right;
  white-space: nowrap;
}

.data-table tr.total-row td {
  font-weight: 900;
  background: #f8fafc;
  border-top: 2px solid var(--navy);
}

.facts-list,
.sources-list {
  padding-left: 20px;
  font-size: 14px;
  color: #334155;
}

.facts-list li,
.sources-list li {
  margin-bottom: 8px;
}

.sources-list a {
  color: var(--blue);
  font-weight: 700;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: #fff;
  padding: 20px 0 28px;
  font-size: 13px;
  color: var(--muted);
}

.site-footer a {
  color: var(--blue);
  font-weight: 700;
}

/* Print */
@media print {
  .hero, .tabs, .presets-bar, .form-card, .share-actions, .copy-feedback, .site-footer { display: none !important; }
  .grid-bon { display: block; }
  .receipt { box-shadow: none; border: 1px solid #94a3b8; }
}

/* Mobile */
@media (max-width: 840px) {
  .hero h1 { font-size: 24px; }
  .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-bon { grid-template-columns: 1fr; }
  .sim-kpis { grid-template-columns: 1fr; }
  .sim-sliders-grid { grid-template-columns: 1fr; }
  .field-two { grid-template-columns: 1fr; }
  .receipt-inner { padding: 14px 14px 16px; }
  .rt-big { font-size: 23px; }
}
.opt-field { display: block; margin: .65rem 0; font-weight: 500; }
.opt-field input { width: auto; margin-right: .35rem; }
.quick-bon { display: none; }
@media (max-width: 840px) {
  .quick-bon { display: flex; gap: .5rem; align-items: center; color: #123d67; background: #edf4fb; padding: .75rem 1rem; margin: .5rem 0 1rem; border-radius: 8px; font-weight: 700; }
  .quick-bon strong { margin-left: auto; }
}
@media print {
  @page { size: A4 portrait; margin: 10mm; }
  html, body { background: #fff; }
  .quick-bon, .receipt-top-edge, .receipt-bottom-edge, noscript, #panel-begroting, #panel-uitleg { display: none !important; }
  #panel-bon, .receipt-col, .receipt { display: block !important; position: static; width: 100%; margin: 0; }
  .main-wrap, .container, .receipt-inner { margin: 0; padding: 0; max-width: none; }
  .receipt-inner { padding: 4mm; }
  .receipt-line { break-inside: avoid; padding: 2px 0; }
  .rl-bar-track { display: none; }
  .receipt-head, .receipt-total-box, .receipt-sum-row, .receipt-deficit-box, .receipt-footer-note, .receipt-divider, .receipt-sub-highlights { margin: 3px 0; padding: 3px 7px; }
  .receipt-title { font-size: 16px; }
  .receipt * { color: #182538 !important; }
}
@media print {
  .receipt-line { display: grid; grid-template-columns: minmax(0,1fr) 104px; align-items: baseline; gap: 10px; }
  .rl-sub { display: block; margin: 0; text-align: right; }
  .rl-pct { font-size: 9px; }
  .rsh-row { padding: 2px 0; }
}
@media print {
  .receipt-total-box { background: white !important; border: 1px solid #788797; }
}
