:root {
    --blue: #1b3a6b;
    --blue-dark: #142c52;
    --red: #e2001a;
    --ink: #1f2733;
    --muted: #6b7686;
    --line: #dfe4ec;
    --bg: #eef2f7;
    --ok: #1e8e58;
    --warn: #b2600f;
    --radius: 14px;
    --shadow: 0 10px 30px rgba(20, 44, 82, .10);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    padding: 0 16px calc(32px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, #f6f8fb 0%, var(--bg) 320px);
    color: var(--ink);
    font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

.page { max-width: 920px; margin: 0 auto; }

/* ---------- Header ---------- */
.brand {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 22px 0 16px;
    padding: 16px 24px;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.brand__logo {
    width: min(320px, 54vw);
    height: auto;
}

/* ---------- Card ---------- */
.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
}

.card__head h1 {
    margin: 0 0 6px;
    font-size: clamp(20px, 3.4vw, 28px);
    color: var(--blue);
}

.lead { margin: 0; color: var(--muted); }

/* ---------- Blokken ---------- */
.block { padding-top: 26px; }

.block + .block {
    margin-top: 26px;
    border-top: 1px solid var(--line);
}

.block__title {
    margin: 0 0 18px;
    font-size: 18px;
    color: var(--blue);
}

.block__title::before {
    content: "";
    display: inline-block;
    width: 3px; height: 15px;
    margin-right: 9px;
    background: var(--red);
    vertical-align: -2px;
}

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }

/* ---------- Velden ---------- */
.field { margin-bottom: 18px; }

.field > label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 14px;
}

.req { color: var(--red); }

input[type="text"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    font: inherit;
    color: inherit;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    transition: border-color .15s, box-shadow .15s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(27, 58, 107, .14);
}

input:disabled { background: #f3f5f9; color: var(--muted); }

textarea { resize: vertical; min-height: 100px; }

.hint { margin: 6px 0 0; font-size: 12px; color: var(--muted); text-align: right; }
.hint--left { text-align: left; }

.privacy {
    margin-top: 22px;
    padding: 12px 14px;
    background: #f5f8fc;
    border-left: 3px solid var(--blue);
    border-radius: 0 8px 8px 0;
    font-size: 13px;
    color: var(--muted);
}

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Keuzeknoppen ---------- */
.question { border: 0; margin: 0 0 18px; padding: 0; }

.question__label {
    display: block;
    margin-bottom: 10px;
    font-size: 15px;
    font-weight: 600;
}

.scale { display: grid; gap: 8px; }
.scale--duo { grid-template-columns: repeat(2, minmax(0, 220px)); }

.scale__option { position: relative; display: block; }

.scale__option input {
    position: absolute;
    opacity: 0;
    width: 100%; height: 100%;
    margin: 0;
    cursor: pointer;
}

.scale__pill {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 6px 4px;
    text-align: center;
    font-size: 13px;
    line-height: 1.2;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    transition: .15s;
}

.scale__option input:hover + .scale__pill { border-color: #b9c6db; }

.scale__option input:focus-visible + .scale__pill {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(27, 58, 107, .18);
}

.scale__option input:checked + .scale__pill {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
    font-weight: 600;
}

.question.has-error .scale__pill,
.check.has-error .scale__pill { border-color: var(--red); }

/* ---------- Visuele controle ---------- */
.checks__head { display: none; }

.check { padding: 16px 0; }
.check + .check { border-top: 1px solid var(--line); }

.check__label {
    display: block;
    margin-bottom: 10px;
    font-size: 15px;
    font-weight: 600;
}

.check__options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

.check__remark { margin-top: 8px; }

/* ---------- Metingen ---------- */
.meting { padding: 16px 0; }
.meting + .meting { border-top: 1px solid var(--line); }

.meting.is-disabled .meting__input { opacity: .5; }

.meting__info label {
    display: block;
    font-size: 15px;
    font-weight: 600;
}

.meting__input { display: flex; align-items: center; gap: 10px; }

.meting__unit {
    flex: 0 0 auto;
    min-width: 42px;
    font-weight: 600;
    color: var(--muted);
}

.warn {
    margin: 6px 0 0;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--warn);
    background: #fdf4e6;
    border-radius: 8px;
}

.warn:empty { display: none; }

/* ---------- Handtekening ---------- */
.sigpad {
    position: relative;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
}

.sigpad canvas {
    display: block;
    width: 100%;
    height: 180px;
    touch-action: none;
    cursor: crosshair;
}

.sigpad__clear {
    position: absolute;
    top: 8px; right: 8px;
    padding: 6px 12px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--blue);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
}

.sigpad__clear:hover { border-color: var(--blue); }

[data-question="handtekening"].has-error .sigpad { border-color: var(--red); }

/* ---------- Foutmeldingen ---------- */
.error {
    margin: 6px 0 0;
    font-size: 13px;
    color: var(--red);
}

.error:empty { display: none; }

.error--form {
    margin-top: 16px;
    padding: 10px 14px;
    background: #fdeaec;
    border-radius: 8px;
}

/* ---------- Knoppen ---------- */
.actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 26px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.btn {
    position: relative;
    min-height: 48px;
    padding: 0 26px;
    font: inherit;
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: .15s;
}

.btn--primary { background: var(--blue); color: #fff; }
.btn--primary:hover { background: var(--blue-dark); }
.btn:disabled { opacity: .6; cursor: progress; }

.spinner { display: none; }

.btn.is-busy .btn__label { visibility: hidden; }

.btn.is-busy .spinner {
    display: block;
    position: absolute;
    inset: 0;
    margin: auto;
    width: 20px; height: 20px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Bedankt ---------- */
.done { text-align: center; padding: 30px 10px 10px; }

.done__icon {
    width: 68px; height: 68px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: var(--ok);
    color: #fff;
    font-size: 36px;
    line-height: 68px;
}

.done h2 { margin: 0 0 8px; color: var(--blue); }
.done p { margin: 0 auto; max-width: 460px; color: var(--muted); }

.foot { text-align: center; padding: 20px 0 0; font-size: 12px; color: var(--muted); }

/* ---------- Desktop: tabelweergave ---------- */
@media (min-width: 760px) {
    .checks__head,
    .check {
        display: grid;
        grid-template-columns: minmax(0, 1fr) repeat(3, 64px) minmax(0, 230px);
        gap: 10px;
        align-items: center;
    }

    .checks__head {
        padding-bottom: 8px;
        border-bottom: 2px solid var(--line);
        font-size: 12px;
        font-weight: 700;
        color: var(--muted);
        text-transform: uppercase;
        letter-spacing: .3px;
    }

    .checks__head span:nth-child(n+2):nth-child(-n+4) { text-align: center; }

    .check__label { margin: 0; font-weight: 500; font-size: 14px; }
    .check__options { display: contents; }
    .check__remark { margin: 0; padding: 9px 12px; font-size: 14px; }

    .scale__pill { font-size: 0; min-height: 40px; }

    .scale__pill::before {
        content: "";
        width: 20px; height: 20px;
        border: 2px solid #c3cddd;
        border-radius: 50%;
        transition: .15s;
    }

    .scale__option input:checked + .scale__pill::before {
        border-color: #fff;
        background: radial-gradient(#fff 38%, transparent 40%);
    }

    .check .error { grid-column: 1 / -1; margin: 0; }

    /* Ja/Nee-achtige vragen blijven als knoppen tonen */
    .question--block .scale__pill { font-size: 15px; }
    .question--block .scale__pill::before { display: none; }

    .meting {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 220px;
        gap: 10px 20px;
        align-items: center;
    }

    .meting .error,
    .meting .warn { grid-column: 1 / -1; }
}

@media (max-width: 759px) {
    body { padding-left: 12px; padding-right: 12px; }
    .card { padding: 20px 16px; }
    .grid { grid-template-columns: minmax(0, 1fr); }
    .brand { padding: 16px; }
    .brand__logo { width: min(290px, 76vw); }
    .scale--duo { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .meting__info { margin-bottom: 10px; }

    .actions {
        position: sticky;
        bottom: 0;
        background: #fff;
        padding: 14px 0 calc(6px + env(safe-area-inset-bottom));
        box-shadow: 0 -10px 14px rgba(255, 255, 255, .95);
    }

    .btn { flex: 1 1 auto; padding: 0 12px; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}
