:root {
    --paper: #fbf7ef;
    --card: #ffffff;
    --ink: #2a2019;
    --muted: #6f6257;
    --line: #e6dccb;
    --accent: #c8161d;
    --accent-dark: #9f0f15;
    --accent-soft: #fdeceb;
    --ok: #256b3e;
    --ok-soft: #e4f3e8;
    --warn: #8a5a00;
    --warn-soft: #fdf2d5;
    --bad: #a12a22;
    --bad-soft: #fbe6e3;
    --radius: 10px;
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font: 17px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
a { color: var(--accent-dark); }
small, .muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .04em; }

.container { max-width: 760px; margin: 0 auto; padding: 0 20px; }
.container.wide { max-width: 1180px; }

.site-header { background: #fff; color: var(--ink); border-bottom: 3px solid var(--accent); }
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
.site-header a { color: var(--ink); text-decoration: none; }
.brand { font-family: Georgia, serif; font-size: 1.25rem; font-weight: bold; display: inline-flex; align-items: center; gap: 12px; }
.brand img { display: block; height: 56px; width: auto; }
.site-nav { display: flex; gap: 18px; align-items: center; font-size: .95rem; flex-wrap: wrap; }
.site-nav a:hover { text-decoration: underline; }
.site-nav form { margin: 0; }
.link-button { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; text-decoration: underline; }

main { padding: 32px 0 56px; }
.site-footer { border-top: 1px solid var(--line); padding: 20px 0 40px; color: var(--muted); font-size: .9rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; }
.card > :last-child { margin-bottom: 0; }
.step { display: inline-flex; align-items: center; justify-content: center; width: 1.7em; height: 1.7em; border-radius: 50%; background: var(--accent); color: #fff; font: bold .85em system-ui, sans-serif; margin-right: .45em; vertical-align: .1em; }

.alert { border-radius: var(--radius); padding: 14px 18px; margin-bottom: 20px; border: 1px solid transparent; }
.alert ul { margin: 0; padding-left: 1.2em; }
.alert-error { background: var(--bad-soft); border-color: #efc0ba; color: var(--bad); }
.alert-ok { background: var(--ok-soft); border-color: #bfe0c8; color: var(--ok); }
.alert-warn { background: var(--warn-soft); border-color: #f0dca0; color: var(--warn); }

fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
label { display: block; font-weight: 600; margin-bottom: 4px; }
.hint { display: block; font-weight: normal; color: var(--muted); font-size: .88rem; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number],
input[type=date], input[type=time], input[type=datetime-local], input[type=search], select, textarea {
    width: 100%; padding: 10px 12px; border: 1px solid #cfc3b0; border-radius: 8px; background: #fff; color: var(--ink); font: inherit;
}
input:focus, select:focus, textarea:focus, button:focus-visible, .button:focus-visible, .slot input:focus-visible + span {
    outline: 3px solid #f2a3a6; outline-offset: 1px;
}
textarea { min-height: 90px; resize: vertical; }
.field { margin-bottom: 16px; }
.field-error { color: var(--bad); font-size: .9rem; margin-top: 4px; }
.fields { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.check { display: flex; gap: 8px; align-items: center; font-weight: normal; }
.check input { width: 18px; height: 18px; }

.button, button.button {
    display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 12px 22px;
    font: 600 1rem system-ui, sans-serif; cursor: pointer; text-decoration: none;
}
.button:hover { background: var(--accent-dark); }
.button[disabled] { opacity: .6; cursor: wait; }
.button.secondary { background: #fff; color: var(--ink); border: 1px solid #cfc3b0; }
.button.secondary:hover { background: var(--accent-soft); }
.button.danger { background: #fff; color: var(--bad); border: 1px solid #e5b5af; }
.button.small { padding: 6px 12px; font-size: .88rem; }
.button.large { padding: 15px 28px; font-size: 1.1rem; }

/* Bots vullen dit veld in; mensen zien het niet. */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Producten */
.product { display: grid; grid-template-columns: 1fr auto 92px; gap: 14px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.product:first-of-type { border-top: 0; padding-top: 0; }
.product-name { font-weight: 600; }
.product-desc { color: var(--muted); font-size: .92rem; }
.product-price { white-space: nowrap; font-variant-numeric: tabular-nums; }
.product input { text-align: center; font-size: 1.05rem; }
.product label { margin: 0; font-weight: normal; }

/* Tijdssloten */
.slot-day { font: 600 1rem system-ui, sans-serif; text-transform: capitalize; margin: 18px 0 8px; }
.slot-day:first-of-type { margin-top: 0; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.slot { margin: 0; font-weight: normal; position: relative; }
.slot input { position: absolute; opacity: 0; }
.slot span { display: block; border: 1px solid #cfc3b0; border-radius: 8px; padding: 10px 12px; background: #fff; cursor: pointer; }
.slot strong { display: block; font-variant-numeric: tabular-nums; }
.slot em { font-style: normal; font-size: .85rem; color: var(--muted); }
.slot input:checked + span { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.slot.full span { background: #f3eee5; color: #9a8e80; cursor: not-allowed; text-decoration: line-through; }
.slot.full em { text-decoration: none; display: inline-block; }

.order-total { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.order-total .amount { font: bold 1.6rem Georgia, serif; font-variant-numeric: tabular-nums; }

/* Tabellen */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
td.right, th.right { text-align: right; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: bold; border-bottom: 0; }
.table-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .82rem; font-weight: 600; background: #eee6d8; color: var(--muted); white-space: nowrap; }
.badge.paid { background: var(--ok-soft); color: var(--ok); }
.badge.pending { background: var(--warn-soft); color: var(--warn); }
.badge.failed, .badge.cancelled, .badge.expired { background: var(--bad-soft); color: var(--bad); }

.summary { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0 0 1em; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 600; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; }
.stat b { display: block; font: bold 1.5rem Georgia, serif; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.toolbar .field { margin: 0; min-width: 160px; }
.toolbar .grow { flex: 1; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }
.inline-form input[type=text], .inline-form input[type=number] { width: auto; padding: 6px 8px; }
.w-xs { max-width: 80px; }
.w-sm { max-width: 110px; }
.w-md { max-width: 220px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.qr { background: #fff; display: inline-block; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
.codes { columns: 2; font-size: 1.1rem; list-style: none; padding: 0; }
.pagination { display: flex; gap: 12px; margin-top: 16px; }

@media (max-width: 560px) {
    body { font-size: 16px; }
    h1 { font-size: 1.6rem; }
    .card { padding: 18px; }
    .product { grid-template-columns: 1fr 80px; }
    .product-price { grid-column: 1; grid-row: 2; }
    .product > div:last-child { grid-row: 1 / span 2; grid-column: 2; }
}

@media print {
    .site-header, .site-footer, .no-print { display: none !important; }
    body { background: #fff; font-size: 12pt; }
    main { padding: 0; }
    .card { border: 0; padding: 0; break-inside: avoid; }
    .slot-block { break-inside: avoid; margin-bottom: 18pt; }
}

.card h3 { margin-top: 1.4em; }

.promo { display: inline-block; background: var(--accent); color: #fff; font: 700 .72rem system-ui, sans-serif; text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: 999px; margin-right: 6px; vertical-align: .12em; }
.product.is-promo { background: #f3f2ef; margin: 0 -12px; padding-left: 12px; padding-right: 12px; border-radius: 8px; border-top-color: transparent; }
.product.is-promo + .product { border-top-color: transparent; }
tfoot td.vat { font-weight: normal; color: var(--muted); padding-top: 2px; }

/* Correct ingevuld veld: groene rand met vinkje. */
input.is-valid, textarea.is-valid {
    border-color: var(--ok);
    box-shadow: inset 0 0 0 1px var(--ok);
    background: #fff url("../img/check.svg") no-repeat right 12px center / 20px 20px;
    padding-right: 42px;
}
textarea.is-valid { background-position: right 12px top 12px; }
input.is-valid:focus, textarea.is-valid:focus { outline-color: #9fd3b0; }

.consent { margin: 0 0 16px; }
.consent .check { align-items: flex-start; margin-bottom: 8px; }
.consent .check input { margin-top: 3px; flex: none; }

/* Bedanktpagina */
.pickup { border-left: 5px solid var(--ok); }
.pickup-when { font: bold 1.35rem Georgia, serif; margin: 2px 0 4px; }
.pickup-number { margin-top: 10px; }
.plain-list { margin: 0; padding-left: 1.2em; }
.plain-list li { margin-bottom: 6px; }

/* Fout ingevuld veld: rode rand met kruis. */
input.is-invalid, textarea.is-invalid, select.is-invalid { border-color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad); }
input.is-invalid, textarea.is-invalid {
    background: #fff url("../img/cross.svg") no-repeat right 12px center / 20px 20px;
    padding-right: 42px;
}
textarea.is-invalid { background-position: right 12px top 12px; }
input.is-invalid:focus, textarea.is-invalid:focus { outline-color: #ecb1ab; }

/* Hint onder het veld. */
small.hint { margin-top: 5px; }

/* Stappen */
.steps { display: flex; gap: 22px; flex-wrap: wrap; list-style: none; padding: 0; margin: 0 0 22px; color: var(--muted); }
.steps li { display: flex; align-items: center; }
.steps a { color: inherit; text-decoration: none; display: flex; align-items: center; }
.steps a:hover { text-decoration: underline; }
.steps .step { background: #cfc3b0; }
.steps .current { color: var(--ink); font-weight: 600; }
.steps .current .step, .steps a .step { background: var(--accent); }

/* Productpagina met winkelwagen */
.shop { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.shop > form > .card:last-child, .shop > .card { margin-bottom: 0; }
.cart { position: sticky; top: 16px; }
/* Afrekenen: rechts de winkelwagen met daaronder de vinkjes, het totaal en de bestelknop. */
.shop-main > .card:last-child, .shop-side > .card:last-child { margin-bottom: 0; }
.shop-side { position: sticky; top: 16px; }
.shop-side .cart { position: static; }
.cart button.button { width: 100%; }
.pay-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 12px 0 0; color: var(--muted); font-size: .88rem; }
.pay-note svg { flex: none; color: var(--ok); }
.shop-side > .card { margin-bottom: 0; }
.cart-edit { margin: 14px 0 0; text-align: center; }
.cart-lines { margin-bottom: 16px; }
.cart-lines td { padding: 7px 6px; }
.cart-lines td:first-child { padding-left: 0; color: var(--muted); }
.cart-lines td:last-child { padding-right: 0; }
.cart .button { display: block; text-align: center; }
.button.disabled { background: #cfc3b0; cursor: not-allowed; }

.stepper { display: flex; align-items: center; gap: 4px; }
.stepper input { width: 58px; padding: 9px 4px; text-align: center; font-size: 1.05rem; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper button { width: 38px; height: 42px; border: 1px solid #cfc3b0; border-radius: 8px; background: #fff; color: var(--ink); font: 600 1.25rem system-ui, sans-serif; cursor: pointer; }
.stepper button:hover { background: var(--accent-soft); }
.product { grid-template-columns: 1fr auto auto; }

/* Zonder JavaScript: geen plus/min-knoppen, wel de knop om bij te werken. */
.js-only { display: none; }
.js .js-only { display: inline-block; }
.js .no-js { display: none; }

@media (max-width: 860px) {
    .shop { grid-template-columns: 1fr; }
    .cart, .shop-side { position: static; }
}
@media (max-width: 560px) {
    .product { grid-template-columns: 1fr auto; }
    .product > .stepper { grid-row: 1 / span 2; grid-column: 2; }
}

/* Smal scherm: vaste balk onderaan met totaal en de knop naar de volgende stap. */
.buy-bar { display: none; }
.buy-bar [hidden] { display: none; }
@media (max-width: 860px) {
    .buy-bar {
        display: flex; align-items: center; justify-content: space-between; gap: 12px;
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
        padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
        background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -4px 14px rgba(0, 0, 0, .08);
    }
    .buy-bar-summary { font-weight: 600; font-variant-numeric: tabular-nums; }
    .buy-bar .button { flex: none; }
    .buy-bar button.button { flex: 1; }
    /* De balk neemt de knop over; ruimte onderaan zodat de balk niets afdekt. */
    .cart > .button { display: none; }
    body:has(.buy-bar) { padding-bottom: 76px; }
}

/* Beheer: mailteksten per actie */
.mail-template + .mail-template { margin-top: 28px; padding-top: 8px; border-top: 1px solid var(--line); }
.mail-template h3 .badge { vertical-align: middle; margin-left: 6px; }
textarea.mail-body { min-height: 340px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92rem; line-height: 1.5; }
.mail-variables { margin-bottom: 16px; }
.mail-variables summary { cursor: pointer; color: var(--accent); }
.mail-variables table { margin-top: 8px; }
