/* ═══════════════════════════════════════════════════════════════
   Digicontract — gedeelde stijl
   Altijd lichte (witte) interface; kleuren via semantische tokens. Alle tekstkleuren
   halen ≥ 4,5:1 op hun achtergrond, randen van invoervelden ≥ 3:1.
═══════════════════════════════════════════════════════════════ */

:root {
    color-scheme: light;

    --bg:            #ffffff;
    --oppervlak:     #ffffff;
    --vulling:       #f2f2f7;   /* zachte vulling: secundaire knoppen, rijen */
    --vulling-hover: #e5e5ea;
    --knopvulling:   #e6e6eb;   /* zichtbaar op zowel wit als --bg */
    --knopvulling-hover: #d8d8de;
    --tekst:         #111111;
    --tekst-2:       #3a3a3f;   /* 11,2:1 op wit */
    --tekst-3:       #5c5f66;   /* 6,5:1 op wit, 5,9:1 op --bg */
    --scheiding:     #e3e3e8;   /* decoratieve lijnen */
    --rand:          #8a8a8e;   /* invoervelden: 3,5:1 op wit */

    --accent:        #111111;   /* primaire actie */
    --accent-hover:  #2c2c2e;
    --accent-druk:   #3a3a3c;
    --accent-tekst:  #ffffff;

    --focus:         #0a66d9;
    --fout:          #c5221f;   /* 5,8:1 op wit */
    --fout-bg:       #fdecea;
    --succes:        #146c2e;
    --succes-bg:     #e6f4ea;
    --waarsch:       #7a4b00;
    --waarsch-bg:    #fff4d6;
    --info:          #1a4fb0;
    --info-bg:       #e8f0fe;

    --schaduw:       0 0 0 1px #e3e3e8, 0 4px 16px rgba(0, 0, 0, .05);
    --radius:        14px;
    --radius-klein:  10px;
    --doel:          44px;      /* minimale aanraakdoelgrootte */

    --font: -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto,
            "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-contrast: more) {
    :root { --tekst-3: var(--tekst-2); --rand: var(--tekst-2); --scheiding: var(--rand); }
}

/* ─────────────────────────────
   Basis
───────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

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

body {
    font-family: var(--font);
    font-size: 1.0625rem;          /* 17px */
    line-height: 1.47;
    background: var(--bg);
    color: var(--tekst);
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    padding: env(safe-area-inset-top) env(safe-area-inset-right)
             env(safe-area-inset-bottom) env(safe-area-inset-left);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { color: var(--tekst); line-height: 1.2; margin: 0; }
h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; font-weight: 600; }
h3 { font-size: 1.0625rem; font-weight: 600; }
p  { margin: 0; }

a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

img { max-width: 100%; }

:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
    border-radius: 4px;
}

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ─────────────────────────────
   Pagina-opbouw
───────────────────────────── */
.pagina {
    max-width: 640px;
    margin: 0 auto;
    padding: 24px 16px 48px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.pagina.breed { max-width: 880px; }
.pagina.smal  { max-width: 420px; }

.kop {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: var(--doel);
}

.kop-logo { display: flex; align-items: center; text-decoration: none; }
.kop-logo img { height: 32px; width: auto; max-width: 200px; object-fit: contain; object-position: left center; display: block; }

.kaart {
    background: var(--oppervlak);
    border-radius: var(--radius);
    box-shadow: var(--schaduw);
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.titelblok { display: flex; flex-direction: column; gap: 6px; }
.ondertitel { color: var(--tekst-3); font-size: 1.0625rem; }
.uitleg { color: var(--tekst-2); }
.note, .klein { color: var(--tekst-3); font-size: 0.9375rem; }

.voet {
    text-align: center;
    color: var(--tekst-3);
    font-size: 0.9375rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 4px 16px;
}

.voet a, .voet .linkknop { min-height: var(--doel); display: inline-flex; align-items: center; }

/* ─────────────────────────────
   Taalkeuze (gesegmenteerd)
───────────────────────────── */
.taalkeuze {
    display: inline-flex;
    background: var(--knopvulling);
    border-radius: 999px;
    padding: 3px;
    gap: 2px;
    flex-shrink: 0;
}

.taalkeuze a {
    min-width: var(--doel);
    min-height: 38px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--tekst-3);
    text-decoration: none;
}

.taalkeuze a:hover { color: var(--tekst); }
.taalkeuze a[aria-current="true"] { background: var(--oppervlak); color: var(--tekst); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* ─────────────────────────────
   Formulieren en velden
───────────────────────────── */
form { display: flex; flex-direction: column; gap: 20px; margin: 0; }

.veld, label.veld { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 0.9375rem; color: var(--tekst); }
.veld .hint { font-weight: 400; color: var(--tekst-3); font-size: 0.875rem; }
.optioneel { font-weight: 400; color: var(--tekst-3); }

label { color: var(--tekst); }

input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="url"],
input[type="number"],
input[type="file"],
select,
textarea {
    font: inherit;
    font-size: 1.0625rem;             /* ≥16px voorkomt inzoomen op iOS */
    font-weight: 400;
    color: var(--tekst);
    background: var(--oppervlak);
    border: 1px solid var(--rand);
    border-radius: var(--radius-klein);
    padding: 11px 14px;
    min-height: var(--doel);
    width: 100%;
    margin: 0;
    transition: border-color .15s, box-shadow .15s;
}

input[type="file"] { padding: 8px; }
textarea { resize: vertical; min-height: 88px; }

input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: none;
    border-color: var(--focus);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 30%, transparent);
}

input:user-invalid, textarea:user-invalid { border-color: var(--fout); }

::placeholder { color: var(--tekst-3); opacity: 1; }

input[type="checkbox"], input[type="radio"] {
    width: 22px;
    height: 22px;
    margin: 0;
    flex-shrink: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

.rij-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Klikbare rij met checkbox of radio: hele rij is het doel */
.optie {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    padding: 12px 14px;
    border: 1px solid var(--scheiding);
    border-radius: var(--radius-klein);
    background: var(--oppervlak);
    font-weight: 500;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.optie:hover { background: var(--vulling); }
.optie:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.optie.akkoord { align-items: flex-start; font-weight: 400; line-height: 1.45; }
.optie.akkoord input { margin-top: 1px; }

fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
legend { font-weight: 600; font-size: 0.9375rem; padding: 0; margin-bottom: 10px; }

.keuze-velden { display: none; flex-direction: column; gap: 20px; }
.keuze-velden.zichtbaar { display: flex; }

.sectie-titel {
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--tekst-3);
    padding-top: 8px;
    border-top: 1px solid var(--scheiding);
}

/* ─────────────────────────────
   Handtekening
───────────────────────────── */
.handtekening-blok { display: flex; flex-direction: column; gap: 10px; }
.handtekening-kop { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

canvas#handtekening {
    display: block;
    width: 100%;
    height: 200px;
    border: 1px dashed var(--rand);
    border-radius: var(--radius-klein);
    background: #ffffff;            /* altijd wit: zo ziet de handtekening eruit op het PDF */
    touch-action: none;
    cursor: crosshair;
}

/* ─────────────────────────────
   PDF-voorbeeld
───────────────────────────── */
.pdf-viewer {
    background: var(--vulling);
    border-radius: var(--radius-klein);
    padding: 8px;
    min-height: 320px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

canvas.pdf-page {
    display: block;
    width: 100%;
    height: auto;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
}

.laden { color: var(--tekst-3); text-align: center; padding: 40px 0; }

/* ─────────────────────────────
   Knoppen
───────────────────────────── */
button, input[type="submit"], .knop {
    font: inherit;
    font-size: 1.0625rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 50px;
    padding: 12px 20px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: var(--accent);
    color: var(--accent-tekst);
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: background-color .15s, transform .1s;
    -webkit-tap-highlight-color: transparent;
}

button:hover, input[type="submit"]:hover, .knop:hover { background: var(--accent-hover); text-decoration: none; }
button:active, input[type="submit"]:active, .knop:active { background: var(--accent-druk); transform: scale(.98); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.knop-secundair, button.knop-secundair {
    background: var(--vulling);
    color: var(--tekst);
}
.knop-secundair:hover, button.knop-secundair:hover { background: var(--vulling-hover); }
.knop-secundair:active, button.knop-secundair:active { background: var(--vulling-hover); }

.knop-klein, button.knop-klein { min-height: var(--doel); padding: 8px 14px; font-size: 0.9375rem; border-radius: 10px; }

.linkknop, button.linkknop {
    background: none;
    border: 0;
    padding: 0;
    min-height: 0;
    color: inherit;
    font: inherit;
    font-weight: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.linkknop:hover, button.linkknop:hover, .linkknop:active, button.linkknop:active { background: none; transform: none; }

.knoppen { display: flex; flex-direction: column; gap: 10px; }
.knoppen > * { width: 100%; }

.terug {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: var(--doel);
    color: var(--tekst-2);
    text-decoration: none;
    font-weight: 500;
}
.terug:hover { color: var(--tekst); text-decoration: underline; }

/* ─────────────────────────────
   Productielijst (startpagina)
───────────────────────────── */
.lijst {
    list-style: none;
    margin: 0;
    padding: 0;
    background: var(--oppervlak);
    border-radius: var(--radius);
    box-shadow: var(--schaduw);
    overflow: hidden;
}

.lijst > li + li { border-top: 1px solid var(--scheiding); }

.lijst-rij {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 64px;
    padding: 12px 16px;
    color: var(--tekst);
    text-decoration: none;
    transition: background .15s;
}

a.lijst-rij:hover { background: var(--vulling); text-decoration: none; }
a.lijst-rij:active { background: var(--vulling-hover); }

.lijst-logo {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: var(--vulling);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--tekst-3);
}
.lijst-logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; padding: 4px; }

.lijst-tekst { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lijst-titel { font-weight: 600; overflow-wrap: anywhere; }
.lijst-sub { color: var(--tekst-3); font-size: 0.9375rem; }
.chevron { color: var(--tekst-3); font-size: 1.25rem; line-height: 1; flex-shrink: 0; }

.lijst-acties { padding: 0 16px 12px 78px; margin-top: -4px; }

.leeg {
    text-align: center;
    color: var(--tekst-3);
    padding: 32px 16px;
}

/* ─────────────────────────────
   Meldingen
───────────────────────────── */
.melding {
    border-radius: var(--radius-klein);
    padding: 12px 14px;
    font-size: 0.9375rem;
    line-height: 1.45;
}
.melding-fout   { background: var(--fout-bg);   color: var(--fout); }
.melding-succes { background: var(--succes-bg); color: var(--succes); }
.melding-info   { background: var(--info-bg);   color: var(--info); }

.form-error, .veld-fout { color: var(--fout); font-size: 0.9375rem; font-weight: 500; }
[hidden] { display: none !important; }

/* Bevestigingsscherm */
.status-icoon {
    width: 64px; height: 64px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--succes-bg); color: var(--succes);
    font-size: 2rem; font-weight: 700;
    margin: 0 auto;
}
.status-icoon.fout { background: var(--fout-bg); color: var(--fout); }
.centraal { text-align: center; align-items: center; }

/* ─────────────────────────────
   Bewegingen beperken
───────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
    button:active, input[type="submit"]:active, .knop:active { transform: none; }
}

/* ─────────────────────────────
   Groter scherm
───────────────────────────── */
@media (min-width: 640px) {
    .pagina { padding: 40px 24px 64px; gap: 24px; }
    .kaart { padding: 36px 40px; }
    .knoppen.naast { flex-direction: row-reverse; }
    .knoppen.naast > * { width: auto; flex: 1; }
}

@media (max-width: 420px) {
    .rij-2 { grid-template-columns: 1fr; }
    h1 { font-size: 1.5rem; }
}

hr.scheiding { border: 0; border-top: 1px solid var(--scheiding); margin: 4px 0; width: 100%; }



/* Digicontract-merk onderaan elke pagina */
.merk {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 0 4px;
    color: var(--tekst-3);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.merk img { width: 20px; height: 20px; display: block; }
