:root {
  --red: #e1251b;
  --red-dark: #b51d15;
  --ink: #1b1b1f;
  --muted: #5b6068;
  --line: #e2e4e8;
  --bg: #f4f5f7;
  --card: #ffffff;
  --green: #1a7f4b;
  --green-bg: #e7f4ec;
  --amber: #b76e00;
  --amber-bg: #fdf1dd;
  --red-bg: #fde7e6;
  --blue: #1f5fa8;
  --blue-bg: #e8f0fa;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  font-size: 16px;
}

.container {
  width: min(960px, 92vw);
  margin: 0 auto;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--card);
  border-bottom: 3px solid var(--red);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem 0;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .7rem; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 7px;
  background: var(--red);
  display: inline-block;
  flex: none;
  position: relative;
}
.brand-mark::after {
  content: "E";
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 20px;
}
.brand-org { display: block; font-size: .78rem; color: var(--muted); letter-spacing: .02em; }
.brand-title { display: block; font-weight: 700; font-size: 1.02rem; }

.steps {
  display: flex; gap: .5rem; margin: 0; padding: 0; list-style: none;
}
.step {
  display: flex; align-items: center; gap: .4rem;
  font-size: .82rem; color: var(--muted);
  padding: .25rem .6rem; border-radius: 999px;
}
.step span {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--line); color: var(--muted);
  font-weight: 700; font-size: .78rem;
}
.step.is-active { color: var(--ink); font-weight: 600; }
.step.is-active span { background: var(--red); color: #fff; }
.step.is-done span { background: var(--green); color: #fff; }

/* ---------- Pages ---------- */
.page { padding: 1.6rem 0 3rem; }
.intro h1 { margin: .2rem 0 .4rem; font-size: 1.6rem; }
.intro p { color: var(--muted); max-width: 70ch; margin: 0 0 1.2rem; }

/* ---------- Cards / fieldsets ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.2rem 1.3rem 1.4rem;
  margin: 0 0 1.1rem;
}
.card > legend {
  font-weight: 700; font-size: 1.05rem;
  padding: 0 .4rem; margin-left: -.4rem;
  color: var(--ink);
}

/* ---------- Fields ---------- */
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 620px) { .grid-2 { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: .3rem; }
.field > span { font-weight: 600; font-size: .92rem; }
.field small, .q-title small { font-weight: 400; color: var(--muted); }
.field input[type="text"],
.field input[type="date"] {
  padding: .55rem .65rem;
  border: 1px solid #cfd3da;
  border-radius: 8px;
  font: inherit;
  background: #fff;
}
.field input:focus { outline: 2px solid var(--red); outline-offset: 1px; border-color: var(--red); }

/* ---------- Questions ---------- */
.question { padding: .9rem 0; border-top: 1px solid var(--line); }
.card > .question:first-of-type { border-top: 0; padding-top: .4rem; }
.q-title { font-weight: 600; margin: 0 0 .55rem; }

.options { display: grid; gap: .45rem; }
.options.inline { grid-template-columns: repeat(auto-fit, minmax(90px, max-content)); gap: .5rem; }

.opt {
  display: flex; align-items: flex-start; gap: .55rem;
  border: 1px solid #d6dae0;
  border-radius: 8px;
  padding: .55rem .7rem;
  cursor: pointer;
  background: #fff;
  transition: border-color .12s, background .12s;
}
.opt:hover { border-color: var(--red); }
.opt input { margin-top: .15rem; accent-color: var(--red); flex: none; }
.opt span { font-size: .94rem; }
.opt small { display: inline; color: var(--muted); }
.opt:has(input:checked) { border-color: var(--red); background: #fff5f4; }

.conditional { animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; } }

/* ---------- Form actions ---------- */
.form-actions {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 1rem; flex-wrap: wrap; margin-top: 1.4rem;
}
.form-hint { margin: 0; color: var(--amber); font-size: .9rem; font-weight: 600; }

.btn {
  font: inherit; font-weight: 600;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: .7rem 1.1rem;
  cursor: pointer;
  background: #fff;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); }
.btn-ghost { background: #fff; border-color: #cfd3da; color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink); }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- Report ---------- */
.report-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem;
}
.report-head h1 { margin: 0 0 .2rem; font-size: 1.55rem; }
.report-meta { color: var(--muted); font-size: .92rem; }
.report-actions { display: flex; gap: .6rem; flex-wrap: wrap; }

.summary-table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.summary-table td { padding: .35rem .6rem .35rem 0; vertical-align: top; }
.summary-table td:first-child { color: var(--muted); width: 42%; }

.section-title {
  font-size: 1.15rem; margin: 1.8rem 0 .8rem; padding-bottom: .3rem;
  border-bottom: 2px solid var(--line);
}

/* Advice banner */
.advice {
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  border: 1px solid;
  display: flex; gap: .9rem; align-items: flex-start;
  margin-bottom: .5rem;
}
.advice .a-icon { font-size: 1.4rem; line-height: 1; }
.advice h2 { margin: 0 0 .25rem; font-size: 1.15rem; }
.advice p { margin: 0; font-size: .95rem; }
.advice.go { background: var(--green-bg); border-color: #b7dcc6; }
.advice.go h2 { color: var(--green); }
.advice.cond { background: var(--amber-bg); border-color: #f0d9a8; }
.advice.cond h2 { color: var(--amber); }
.advice.stop { background: var(--red-bg); border-color: #f1bdba; }
.advice.stop h2 { color: var(--red-dark); }

/* Legislation cards */
.law-grid { display: grid; gap: .8rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 620px) { .law-grid { grid-template-columns: 1fr; } }
.law {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); box-shadow: var(--shadow);
  padding: .9rem 1rem;
}
.law-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.law-head h3 { margin: 0; font-size: 1rem; }
.law-head .sub { font-size: .76rem; color: var(--muted); font-weight: 400; display:block; }
.law p { margin: .55rem 0 0; font-size: .9rem; color: var(--muted); }

.badge {
  font-size: .73rem; font-weight: 700; padding: .2rem .55rem;
  border-radius: 999px; white-space: nowrap;
}
.badge.yes { background: var(--red-bg); color: var(--red-dark); }
.badge.maybe { background: var(--amber-bg); color: var(--amber); }
.badge.no { background: #eceef1; color: var(--muted); }

/* Measures table */
.measures { width: 100%; border-collapse: collapse; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); font-size: .92rem; }
.measures th, .measures td { text-align: left; padding: .65rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.measures thead th { background: #fafafb; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.measures tr:last-child td { border-bottom: 0; }
.measures .m-name { font-weight: 600; }
.measures .pill {
  display: inline-block; font-size: .72rem; font-weight: 700;
  padding: .12rem .5rem; border-radius: 999px;
}
.pill.req { background: var(--red-bg); color: var(--red-dark); }
.pill.rec { background: var(--amber-bg); color: var(--amber); }
.pill.std { background: var(--blue-bg); color: var(--blue); }

.note { font-size: .88rem; color: var(--muted); margin-top: .6rem; }

.roles-table { width: 100%; border-collapse: collapse; font-size: .92rem; margin-top: .4rem; }
.roles-table th, .roles-table td { border: 1px solid var(--line); padding: .5rem .7rem; text-align: left; }
.roles-table thead th { background: #fafafb; }
.roles-table .chk { width: 90px; text-align: center; }

.maatregelen-box {
  border: 1px dashed #cfd3da; border-radius: var(--radius);
  padding: 1rem; background: #fff; min-height: 70px; color: var(--ink);
  font-size: .92rem; white-space: pre-wrap;
}
textarea.maatregelen-box {
  width: 100%; display: block; font: inherit; font-size: .92rem;
  resize: vertical; line-height: 1.5;
}
textarea.maatregelen-box:focus { outline: none; border-color: var(--red); }

/* Invulbare velden in de betrokkenen-tabel */
.roles-table .rt-input {
  width: 100%; border: 0; border-bottom: 1px solid #cfd3da;
  padding: .25rem .15rem; font: inherit; background: transparent; color: var(--ink);
}
.roles-table .rt-input:focus { outline: none; border-bottom-color: var(--red); }
.roles-table .rt-anders { width: auto; min-width: 110px; }

/* Aanvinkbare vakjes — span i.p.v. <input> zodat ze betrouwbaar printen én in de PDF renderen */
.akk-box {
  display: inline-block; width: 18px; height: 18px;
  border: 2px solid #9aa0a8; border-radius: 4px; background: #fff;
  cursor: pointer; vertical-align: middle; position: relative;
}
.akk-box:hover { border-color: var(--red); }
.akk-box.checked { background: var(--red); border-color: var(--red); }
.akk-box.checked::after {
  content: "\2713"; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 700; line-height: 1;
}
.akk-box:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }

/* ---------- PDF-export (html2pdf) ---------- */
/* Verberg de actieknoppen terwijl de rapportage naar PDF wordt vastgelegd. */
.pdf-capturing .report-actions { display: none !important; }

/* ---------- Print / Opslaan als PDF ---------- */
@media print {
  @page { size: A4; margin: 14mm; }

  /* Behoud achtergrondkleuren van badges/banners in de PDF. */
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }

  .site-header, .site-footer, .report-actions, .steps { display: none !important; }
  body { background: #fff; }
  .card, .law, .measures, .advice { box-shadow: none; }
  .page { padding: 0; }
  .container { width: 100%; }
  .law-grid { grid-template-columns: 1fr 1fr; }

  /* Voorkom lelijke afbrekingen midden in een blok. */
  .advice, .law, .card, .roles-table tr, .measures tr { break-inside: avoid; }
  .section-title { break-after: avoid; }

  a[href]::after { content: ""; }
}
