:root {
    --groen: #289858;
    --groen-zacht: rgba(40, 152, 88, 0.15);
    --blauw: #007aff;
    --rood: #ff3b30;
    --achtergrond: #ffffff;
    --tekst: #1c1c1e;
    --tekst-zwak: #6e6e73;
    --scheiding: rgba(60, 60, 67, 0.29);
    --kaart: #f2f2f7;
    --rand: rgba(60, 60, 67, 0.29);
}

@media (prefers-color-scheme: dark) {
    :root {
        --achtergrond: #1c1c1e;
        --tekst: #f2f2f7;
        --tekst-zwak: #98989d;
        --scheiding: rgba(235, 235, 245, 0.29);
        --kaart: #2c2c2e;
        --rand: rgba(235, 235, 245, 0.29);
    }
}

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

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
    background: var(--achtergrond);
    color: var(--tekst);
    -webkit-font-smoothing: antialiased;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 8px 16px 24px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

#logo {
    height: 90px;
    width: auto;
    margin: 8px auto 12px;
}

#klantcode-rij {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px;
    margin-bottom: 16px;
}

#klantcode-rij label {
    font-size: 17px;
    font-weight: 600;
}

#klantcode {
    width: 220px;
    padding: 8px 12px;
    font-size: 16px;
    color: var(--tekst);
    background: var(--kaart);
    border: 1px solid var(--rand);
    border-radius: 8px;
    text-transform: uppercase;
    font-variant: all-small-caps;
}

#klantcode:focus {
    outline: none;
    border-color: var(--groen);
}

#hoofd-rij {
    display: flex;
    gap: 0;
    align-items: stretch;
}

#producten {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
}

#product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    padding: 8px;
    max-height: 62vh;
    overflow-y: auto;
}

.product-knop {
    border: none;
    background: var(--groen-zacht);
    border-radius: 15px;
    padding: 16px 12px;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.06s ease, filter 0.06s ease;
}

.product-knop:hover {
    filter: brightness(0.97);
}

.product-knop:active {
    transform: scale(0.97);
}

.product-naam {
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    color: var(--tekst);
}

.product-prijs {
    font-size: 22px;
    color: var(--tekst);
}

#scheiding {
    width: 1px;
    background: var(--scheiding);
    margin: 0 16px;
}

#winkelwagen {
    width: 320px;
    display: flex;
    flex-direction: column;
}

#winkelwagen h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

#winkelwagen-lijst {
    list-style: none;
    flex: 1;
    min-height: 120px;
    max-height: 34vh;
    overflow-y: auto;
    border-top: 1px solid var(--scheiding);
}

.winkelwagen-regel {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 4px;
    border-bottom: 1px solid var(--scheiding);
    font-size: 16px;
}

.winkelwagen-aantal {
    min-width: 28px;
    font-variant-numeric: tabular-nums;
}

.winkelwagen-naam {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.winkelwagen-prijs {
    font-variant-numeric: tabular-nums;
}

#winkelwagen-leeg {
    color: var(--tekst-zwak);
    padding: 16px 4px;
    font-size: 15px;
}

#betaal-balk {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 16px 0;
}

#totaal-rij {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#totaal-label,
#totaal-bedrag {
    font-size: 22px;
    font-weight: 700;
}

#totaal-bedrag {
    font-variant-numeric: tabular-nums;
}

button {
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    border-radius: 10px;
    padding: 10px 16px;
    cursor: pointer;
    border: none;
    transition: filter 0.1s ease, opacity 0.1s ease;
}

button:hover {
    filter: brightness(0.95);
}

button:active {
    filter: brightness(0.9);
}

button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.prominent {
    background: var(--groen);
    color: #fff;
}

.prominent.groen {
    background: var(--groen);
}

.prominent.blauw {
    background: var(--blauw);
}

.border {
    background: transparent;
    border: 1px solid var(--rand);
}

.rood {
    color: var(--rood);
}

#btn-afrekenen {
    margin-top: 4px;
}

#melding {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 15px;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

#modal-overlay[hidden],
#melding[hidden] {
    display: none;
}

#modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 16px;
}

#modal {
    background: var(--achtergrond);
    border-radius: 14px;
    max-width: 560px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 24px;
    position: relative;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

#modal-sluit {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    color: var(--tekst-zwak);
    font-size: 18px;
    padding: 6px 10px;
}

#modal h2 {
    font-size: 20px;
    margin-bottom: 12px;
    padding-right: 32px;
}

#modal h3 {
    font-size: 17px;
    margin: 18px 0 8px;
}

#modal p {
    color: var(--tekst-zwak);
    font-size: 14px;
    margin-bottom: 10px;
}

#modal .knoppen-rij {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

#modal .knoppen-rij button {
    flex: 1;
    min-width: 120px;
}

#modal .toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

#modal .toolbar button {
    flex: 1;
    padding: 8px 12px;
    font-size: 14px;
}

#producten-lijst {
    list-style: none;
}

#producten-lijst li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--scheiding);
}

#producten-lijst .info {
    flex: 1;
    min-width: 0;
}

#producten-lijst .info .naam {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#producten-lijst .info .prijs {
    font-size: 14px;
    color: var(--tekst-zwak);
}

#producten-lijst .kleine-knop {
    padding: 6px 10px;
    font-size: 14px;
    border: 1px solid var(--rand);
    background: transparent;
    color: var(--tekst);
    border-radius: 8px;
}

#producten-lijst .verwijder {
    color: var(--rood);
}

#product-formulier {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

#product-formulier label {
    font-size: 14px;
    font-weight: 600;
}

#product-formulier input {
    width: 100%;
    padding: 8px 12px;
    font-size: 16px;
    border: 1px solid var(--rand);
    border-radius: 8px;
    background: var(--kaart);
    color: var(--tekst);
}

#product-formulier input:focus {
    outline: none;
    border-color: var(--groen);
}

#export-periode {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    padding: 12px;
    border: 1px solid var(--rand);
    border-radius: 10px;
}

#export-periode label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
}

#export-periode input[type="date"] {
    padding: 6px 10px;
    font-size: 15px;
    font-family: inherit;
    border: 1px solid var(--rand);
    border-radius: 8px;
    background: var(--kaart);
    color: var(--tekst);
}

#export-periode .knoppen-rij {
    margin: 0 0 0 auto;
}

#export-periode .knoppen-rij button {
    flex: none;
    min-width: 0;
}

#export-lijst {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

#export-lijst button {
    text-align: left;
    padding: 12px 14px;
    border: 1px solid var(--rand);
    background: transparent;
    color: var(--tekst);
    border-radius: 10px;
    font-size: 15px;
}

#export-lijst .beschrijving {
    display: block;
    font-size: 13px;
    font-weight: 400;
    color: var(--tekst-zwak);
    margin-top: 2px;
}

#verkoop-telling {
    font-size: 14px;
    color: var(--tekst-zwak);
    margin-bottom: 8px;
}

@media (max-width: 900px) {
    #hoofd-rij {
        flex-direction: column;
    }

    #scheiding {
        width: 100%;
        height: 1px;
        margin: 8px 0;
    }

    #winkelwagen {
        width: 100%;
    }

    #product-grid {
        max-height: none;
    }

    #klantcode {
        width: 100%;
        flex: 1;
    }

    #klantcode-rij {
        flex-wrap: wrap;
    }
}
