/* Interface-stijl volgens de HoS-tool "Digitale handtekening". Kleuren uit HoS-Kleurpalet.md. */
:root {
  --orange-dark: #FF5C01;
  --orange-light: #FFAA00;
  --grey: #6B6B6B;
  --black: #2F2F2F;
  --white: #FFFFFF;
  --page: #F4F4F4;      /* zeer lichte tint van grijs #6B6B6B */
  --line: #DCDCDC;
  --radius: 16px;
  --font: 'HG Regular', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --font-semibold: 'HG SemiBold', var(--font);
  --font-black: 'HG Black', var(--font);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--black);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.45;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

:focus-visible { outline: 3px solid var(--orange-dark); outline-offset: 2px; }

/* Kopbalk */
.topbar {
  background: var(--black);
  color: var(--white);
  border-bottom: 6px solid var(--orange-dark);
  border-image: linear-gradient(90deg, var(--orange-light), var(--orange-dark)) 1;
}
.topbar__inner {
  max-width: 1640px; margin: 0 auto;
  display: flex; align-items: center; gap: 24px;
  padding: 24px 16px;
}
@media (min-width: 720px) { .topbar__inner { padding: 26px 80px; } }
.topbar__logo { width: 72px; height: 72px; border-radius: 50%; flex: none; }
.topbar__title { margin: 0; font-family: var(--font-black); font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1.15; }
.topbar__sub { margin: 4px 0 0; font-size: 1.0625rem; color: rgba(255, 255, 255, .9); }

/* Indeling */
.layout {
  max-width: 1640px; margin: 0 auto;
  padding: 32px 16px 64px;
  display: grid; gap: 32px;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}
@media (min-width: 960px) {
  .layout { grid-template-columns: minmax(340px, 570px) minmax(0, 1fr); padding: 40px 80px 80px; }
  .card--preview { position: sticky; top: 24px; }
}

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 24px;
  min-width: 0;
}
@media (min-width: 720px) { .card { padding: 36px 30px; } }
.card__title {
  margin: 0 0 24px;
  font-family: var(--font-semibold);
  font-size: 1rem; letter-spacing: .14em; text-transform: uppercase;
}

/* Velden */
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.field { margin: 0 0 22px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.row .field { margin-bottom: 6px; }
@media (max-width: 420px) { .row { grid-template-columns: 1fr; } }

.label { display: block; font-family: var(--font-semibold); font-size: 1.0625rem; margin: 0 0 10px; padding: 0; }
.label--inline { margin: 0; }
.input {
  width: 100%;
  font: inherit; font-size: 1.125rem; color: var(--black);
  padding: 14px 16px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--white);
}
.input::placeholder { color: var(--grey); }
.input:focus { border-color: var(--orange-dark); outline: none; box-shadow: 0 0 0 3px rgba(255, 92, 1, .25); }

.help { margin: 8px 0 0; color: var(--grey); font-size: .9375rem; }
.row + .help { margin: 0 0 22px; }
.status { margin: 8px 0 0; font-size: .9375rem; min-height: 1px; }
.status:empty { display: none; }
.status--busy::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; background: var(--orange-light); }
.status--ok::before { content: '✓ '; color: var(--black); font-family: var(--font-black); }
.status--error { color: var(--black); }
.status--error::before { content: '! '; color: var(--orange-dark); font-family: var(--font-black); }

/* Keuzeknoppen (zoals 'Afdeling' in het voorbeeld) */
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice-grid--small { margin-bottom: 14px; }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 56px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 12px;
  font-family: var(--font-semibold); font-size: 1.0625rem;
  transition: background .15s, border-color .15s;
}
.choice:hover span { border-color: var(--grey); }
.choice input:checked + span {
  background: var(--orange-dark); border-color: var(--orange-dark);
  /* 19px vet: 'grote tekst' voor WCAG, contrast #2F2F2F op #FF5C01 = 4,3:1 */
  font-family: var(--font-black); font-size: 1.1875rem;
}
.choice input:focus-visible + span { outline: 3px solid var(--black); outline-offset: 2px; }

/* Upload */
.upload {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 64px; padding: 14px;
  border: 2px dashed var(--line); border-radius: 12px;
  font-family: var(--font-semibold); font-size: 1.0625rem;
  cursor: pointer;
}
.upload:hover { border-color: var(--orange-dark); }
input[type=file]:focus-visible + .upload,
.upload:focus-within { outline: 3px solid var(--orange-dark); outline-offset: 2px; }

/* Handtekening */
.sig-pad {
  display: block; width: 100%; height: 180px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--white);
  touch-action: none; cursor: crosshair;
}
.sig-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sig-actions .help { margin: 0; }
.sig-panel { margin-bottom: 8px; }

/* Knoppen */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 12px 24px;
  border-radius: 12px; border: 1px solid var(--line);
  font: inherit; font-family: var(--font-semibold); font-size: 1.125rem;
  cursor: pointer; background: var(--white); color: var(--black);
}
.btn--small { min-height: 44px; padding: 8px 16px; font-size: 1rem; }
.btn--ghost:hover { border-color: var(--grey); }
.btn--primary {
  background: var(--orange-dark); border-color: var(--orange-dark); color: var(--white);
  font-family: var(--font-black); font-size: 1.1875rem; /* vet 19px: grote tekst, contrast 3:1 */
}
.btn--primary:hover:not(:disabled) { filter: brightness(.93); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* Voorbeeld */
.preview { position: relative; max-width: 620px; }
.preview__canvas {
  display: block; width: 100%; height: auto; aspect-ratio: 3 / 4;
  border-radius: 10px; background: var(--page);
  cursor: grab; touch-action: none;
}
.preview__canvas.is-dragging { cursor: grabbing; }
.preview__busy {
  position: absolute; inset: 0; border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: rgba(47, 47, 47, .72); color: var(--white); text-align: center; padding: 24px;
  font-family: var(--font-semibold); font-size: 1.0625rem;
}
.preview__busy[hidden] { display: none; }
.spinner {
  width: 44px; height: 44px; border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, .3); border-top-color: var(--orange-light);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

.photo-controls {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px;
  max-width: 620px; margin-top: 18px;
}
.photo-controls[hidden] { display: none; }
.photo-controls .label { margin: 0; }
.exposure-label { margin-top: 10px !important; }
.exposure-label output { font-family: var(--font); color: var(--grey); margin-left: 6px; }
.range-end { font-size: .9375rem; color: var(--grey); }
.btn--icon { min-height: 44px; min-width: 44px; padding: 0; font-family: var(--font-black); font-size: 1.5rem; line-height: 1; }
.preview__hint {
  position: absolute; left: 50%; bottom: 46%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 999px;
  background: rgba(47, 47, 47, .82); color: var(--white);
  font-family: var(--font-semibold); font-size: 1rem; white-space: nowrap;
  pointer-events: none;
}
.preview__hint[hidden] { display: none; }
.range { flex: 1 1 160px; accent-color: var(--orange-dark); min-height: 44px; }
.help--full { flex-basis: 100%; margin: 0; }

.warning {
  max-width: 620px; margin: 16px 0 0; padding: 14px 16px;
  border-left: 4px solid var(--orange-dark); background: rgba(255, 92, 1, .08); border-radius: 8px;
  font-family: var(--font-semibold);
}

.actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 24px; }
.hint { display: flex; align-items: center; gap: 10px; margin: 16px 0 0; font-family: var(--font-semibold); font-size: 1.0625rem; }
.hint:empty { display: none; }
.hint::before { content: ''; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--orange-dark); }
