:root {
  --zwart: #111;
  --wit: #fff;
  --grijs-bg: #f4f4f4;
  --grijs-lijn: #ddd;
  --grijs-tekst: #666;
  --groen: #148236;
  --rood: #c02020;
  --radius: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--grijs-bg);
  color: var(--zwart);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--zwart);
  color: var(--wit);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.logo { height: 26px; width: auto; display: block; }
.sub { font-size: 12px; color: #bbb; letter-spacing: .04em; white-space: nowrap; }

.progress { background: var(--wit); border-bottom: 1px solid var(--grijs-lijn); padding: 10px 18px; }
.progress-label { font-size: 12.5px; color: var(--grijs-tekst); margin-bottom: 6px; font-weight: 600; }
.progress-track { height: 5px; background: #e6e6e6; border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--zwart); width: 0; transition: width .25s ease; }

main {
  flex: 1;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 18px 16px 110px;
}

h1 { font-size: 21px; margin-bottom: 4px; }
h2 { font-size: 17px; margin: 18px 0 8px; }
.hint { font-size: 13.5px; color: var(--grijs-tekst); line-height: 1.45; margin-bottom: 14px; }
.hint strong { color: var(--zwart); }

.card {
  background: var(--wit);
  border: 1px solid var(--grijs-lijn);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}

label.field { display: block; margin-bottom: 12px; }
label.field span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
label.field span em { color: var(--rood); font-style: normal; }
input[type=text], input[type=date], input[type=time], textarea, select {
  width: 100%;
  font: inherit;
  font-size: 16px;
  padding: 11px 12px;
  border: 1px solid #c9c9c9;
  border-radius: 8px;
  background: var(--wit);
}
input:focus, textarea:focus { outline: 2px solid var(--zwart); outline-offset: -1px; }
textarea { min-height: 96px; resize: vertical; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row2 label.field { min-width: 0; }
.row2 input {
  min-width: 0;
  width: 100%;
  padding-left: 8px;
  padding-right: 8px;
  -webkit-appearance: none;
  appearance: none;
}

/* Grote keuzeknoppen (type-keuze) */
.bigchoice {
  display: block; width: 100%;
  background: var(--wit);
  border: 2px solid var(--grijs-lijn);
  border-radius: var(--radius);
  padding: 18px 16px;
  margin-bottom: 12px;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.bigchoice:active { border-color: var(--zwart); }
.bigchoice .t { font-size: 17px; font-weight: 700; display: block; margin-bottom: 3px; }
.bigchoice .d { font-size: 13.5px; color: var(--grijs-tekst); }

/* Controlepunten */
.check-item { border-bottom: 1px solid #eee; padding: 12px 0; }
.check-item:last-child { border-bottom: none; }
.check-label { font-size: 14.5px; margin-bottom: 9px; line-height: 1.35; }
.seg { display: flex; gap: 7px; }
.seg button {
  flex: 1;
  font: inherit; font-size: 14px; font-weight: 600;
  padding: 10px 4px;
  border: 1.5px solid #c9c9c9;
  border-radius: 8px;
  background: var(--wit);
  color: var(--grijs-tekst);
  cursor: pointer;
  min-height: 44px;
}
.seg button.sel-ok  { background: var(--groen); border-color: var(--groen); color: #fff; }
.seg button.sel-nvt { background: #777; border-color: #777; color: #fff; }
.seg button.sel-av  { background: var(--rood); border-color: var(--rood); color: #fff; }
.check-note { margin-top: 9px; }
.check-item.missing .check-label { color: var(--rood); font-weight: 600; }

/* Foto's */
.photo-cat { margin-bottom: 14px; }
.photo-cat .head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.photo-cat .head b { font-size: 14.5px; }
.badge { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 20px; background: #eee; color: var(--grijs-tekst); white-space: nowrap; }
.badge.req { background: #fdecec; color: var(--rood); }
.badge.done { background: #e6f4ea; color: var(--groen); }
.photo-cat .chint { font-size: 12.5px; color: var(--grijs-tekst); margin-bottom: 8px; line-height: 1.4; }
.card.intern { background: #fffbea; border-color: #e8d98a; }
.card.intern .chint { font-size: 12.5px; color: #7a5b00; }

.veld-intern {
  background: #fffbea;
  border: 1px solid #e8d98a;
  border-radius: 8px;
  padding: 12px 12px 8px;
  margin-bottom: 12px;
}
.intern-hint { font-size: 12.5px; color: #7a5b00; margin-top: -4px; padding-bottom: 4px; }

.afvalq { margin-top: 14px; border-top: 1px solid #eee; padding-top: 12px; }
.afvalq .check-label { font-weight: 600; }
.req-ster { color: var(--rood); font-style: normal; }

.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb { position: relative; width: 72px; height: 72px; border-radius: 8px; overflow: hidden; border: 1px solid var(--grijs-lijn); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .del {
  position: absolute; top: 2px; right: 2px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0,0,0,.65); color: #fff;
  border: none; font-size: 13px; line-height: 22px; text-align: center; cursor: pointer; padding: 0;
}
.addphoto {
  width: 72px; height: 72px;
  border: 1.5px dashed #aaa; border-radius: 8px;
  background: var(--wit); color: var(--grijs-tekst);
  font-size: 26px; cursor: pointer;
}

/* Handtekening */
.sigwrap { margin-bottom: 16px; }
.sigwrap .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.sigwrap .head b { font-size: 14.5px; }
.sig-clear { font: inherit; font-size: 13px; background: none; border: none; color: var(--grijs-tekst); text-decoration: underline; cursor: pointer; padding: 4px; }
canvas.sig {
  width: 100%; height: 160px;
  background: var(--wit);
  border: 1.5px dashed #aaa;
  border-radius: 8px;
  touch-action: none;
  display: block;
}
canvas.sig.signed { border-style: solid; border-color: var(--zwart); }

.akkoord { font-size: 13px; color: var(--grijs-tekst); line-height: 1.5; margin: 4px 0 16px; }

/* Samenvatting */
.sumrow { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid #eee; font-size: 14px; }
.sumrow:last-child { border-bottom: none; }
.sumrow .k { color: var(--grijs-tekst); }
.sumrow .v { font-weight: 600; text-align: right; }
.sumrow .v.warn { color: var(--rood); }

/* Navigatie */
.nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--wit);
  border-top: 1px solid var(--grijs-lijn);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  display: flex; gap: 10px;
  justify-content: space-between;
}
.nav .btn { max-width: 640px; }
.btn {
  font: inherit; font-size: 16px; font-weight: 700;
  padding: 13px 22px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  min-height: 50px;
}
.btn.primary { background: var(--zwart); color: var(--wit); flex: 1; }
.btn.primary:disabled { background: #999; }
.btn.ghost { background: none; border: 1.5px solid #c9c9c9; color: var(--zwart); }

.error-box {
  background: #fdecec; color: var(--rood);
  border: 1px solid #f3c2c2; border-radius: 8px;
  padding: 11px 13px; font-size: 14px; margin-bottom: 12px;
  line-height: 1.45;
}
.warn-box {
  background: #fff7e0; color: #7a5b00;
  border: 1px solid #eedd9a; border-radius: 8px;
  padding: 11px 13px; font-size: 14px; margin-bottom: 12px;
  line-height: 1.45;
}

/* Verstuur / klaar-scherm */
.center { text-align: center; padding: 40px 10px; }
.center .icon { font-size: 52px; margin-bottom: 14px; }
.spinner {
  width: 44px; height: 44px; margin: 0 auto 16px;
  border: 4px solid #ddd; border-top-color: var(--zwart);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

button, .btn, input, select { touch-action: manipulation; }

@media (min-width: 640px) {
  .nav { padding-left: calc(50% - 320px + 16px); padding-right: calc(50% - 320px + 16px); }
}

/* Tablet / iPad */
@media (min-width: 768px) {
  main { padding-top: 26px; }
  .logo { height: 30px; }
  canvas.sig { height: 200px; }
}
