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

:root {
    --orange:   #F47920;
    --blue:     #003DA5;
    --nl-blue:  #003DA5;
    --nl-yellow:#F5C518;
    --black:    #111111;
    --gray-bg:  #F0F0F0;
    --gray-mid: #CCCCCC;
    --text:     #111111;
    --link:     #0066CC;
    --radius:   14px;
    --bottom-h: 84px;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #fff;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

#app {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

@media (min-width: 640px) {
    body { background: var(--gray-bg); }
    #app {
        max-width: 480px;
        margin: 0 auto;
        height: 100dvh;
        height: 100vh;
        box-shadow: 0 0 0 1px rgba(0,0,0,.07), 0 8px 40px rgba(0,0,0,.12);
        background: #fff;
    }
}

/* ── Screen shell ── */
.screen {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    background: #fff;
}

/* ── Top nav ── */
.nav-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px 8px;
    flex: 0 0 auto;
}

.nav-link {
    background: none;
    border: none;
    color: var(--link);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 0;
    min-width: 60px;
}

.vang-logo {
    font-size: 22px;
    font-weight: 900;
    color: var(--orange);
    letter-spacing: -0.5px;
}
.home-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.home-greeting {
    margin-bottom: 32px;
}
.nav-logo {
    height: 28px;
    width: auto;
}

/* ── Content area ── */
.content {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 12px 20px 24px;
    -webkit-overflow-scrolling: touch;
}

/* ── Headings ── */
h1 {
    font-size: 36px;
    font-weight: 900;
    line-height: 1.1;
    color: var(--black);
    margin-bottom: 28px;
}

label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: var(--black);
    margin-bottom: 8px;
    margin-top: 20px;
}
label:first-of-type { margin-top: 0; }

/* ── Inputs ── */
input[type=email],
input[type=password],
input[type=text],
input[type=number] {
    display: block;
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid #DDD;
    border-radius: var(--radius);
    font-size: 17px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}
input:focus {
    border-color: var(--orange);
}

/* ── Bottom bar ── */
.bottom-bar {
    flex: 0 0 auto;
    padding: 12px 20px 28px;
    background: #fff;
}

/* ── Primary button ── */
.btn-primary {
    display: block;
    width: 100%;
    padding: 18px;
    background: var(--black);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    transition: opacity .15s;
}
.btn-primary:active { opacity: .8; }
.btn-primary.disabled {
    background: var(--gray-bg);
    color: var(--gray-mid);
    pointer-events: none;
}

/* ── Secondary button ── */
.btn-secondary {
    display: block;
    width: 100%;
    padding: 16px;
    background: #fff;
    color: var(--black);
    border: 1.5px solid #DDD;
    border-radius: var(--radius);
    font-size: 17px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    margin-bottom: 10px;
}
.btn-secondary:active { background: var(--gray-bg); }

/* ── Login tabs ── */
.login-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: var(--gray-bg);
    border-radius: var(--radius);
    padding: 4px;
}
.tab-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    color: #888;
    transition: background .15s, color .15s;
}
.tab-btn.active {
    background: #fff;
    color: var(--black);
    box-shadow: 0 1px 4px rgba(0,0,0,.1);
}

.inp-token {
    display: block;
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid #DDD;
    border-radius: var(--radius);
    font-size: 13px;
    font-family: monospace;
    background: #fff;
    color: var(--text);
    outline: none;
    resize: none;
    height: 120px;
    word-break: break-all;
}
.inp-token:focus { border-color: var(--orange); }

/* ── Login screen ── */
.login-screen {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    background: #fff;
    padding: 0 24px;
}
.login-header {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: max(56px, env(safe-area-inset-top, 40px));
    padding-bottom: 36px;
}
.login-logo-img {
    height: 48px;
    width: auto;
}
.login-sub {
    margin-top: 8px;
    font-size: 15px;
    font-weight: 500;
    color: #888;
    letter-spacing: 0.2px;
}
.login-env {
    font-size: 18px;
    font-weight: 700;
    vertical-align: middle;
    padding: 2px 10px;
    border-radius: 8px;
    letter-spacing: 0;
}
.login-env--test   { background: #FEF3C7; color: #92400E; }
.login-env--accept { background: #DBEAFE; color: #1E40AF; }
.login-env--prod   { background: #DCFCE7; color: #166534; }
.login-form {
    flex: 1 1 auto;
}
.login-footer {
    flex: 0 0 auto;
    padding: 16px 0 max(32px, env(safe-area-inset-bottom, 24px));
}

@media (min-width: 640px) {
    .login-header {
        padding-top: 40px;
        padding-bottom: 32px;
    }
    .login-footer {
        padding-bottom: 32px;
    }
}

/* ── Category list ── */
.category-list { margin-bottom: 4px; }

.cat-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--gray-bg);
    border-radius: var(--radius);
    margin-bottom: 8px;
    cursor: pointer;
    font-size: 17px;
    font-weight: 600;
    transition: background .1s;
}
.cat-row.selected {
    background: #E8E8E8;
    outline: 2px solid #AAA;
    outline-offset: -2px;
}
.cat-check {
    width: 26px;
    height: 26px;
    border: 2px solid #BBB;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 800;
    flex-shrink: 0;
    background: #fff;
    color: var(--black);
}
.cat-row.selected .cat-check {
    background: #555;
    border-color: #555;
    color: #fff;
}

/* ── NL Kenteken input ── */
.kenteken-wrap {
    display: flex;
    align-items: stretch;
    border: 1.5px solid #DDD;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--nl-yellow);
}
.nl-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--nl-blue);
    color: #fff;
    font-size: 15px;
    font-weight: 900;
    padding: 0 14px;
    letter-spacing: 1px;
    flex-shrink: 0;
}
.inp-kenteken {
    flex: 1;
    padding: 14px 12px;
    border: none;
    background: var(--nl-yellow);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--black);
    outline: none;
    border-radius: 0;
    width: 0;
}
.inp-kenteken::placeholder { color: rgba(0,0,0,.3); }
.kenteken-suggest-btn {
    background: none;
    border: none;
    padding: 0 14px;
    font-size: 22px;
    color: var(--nl-blue);
    cursor: pointer;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.kenteken-wrap:focus-within { border-color: var(--orange); }

/* ── Suggestions dropdown ── */
.suggest-dropdown {
    margin-top: 4px;
    border: 1.5px solid #DDD;
    border-radius: var(--radius);
    overflow: hidden;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
}
.suggest-item {
    padding: 14px 16px;
    font-size: 16px;
    border-bottom: 1px solid #F0F0F0;
    cursor: pointer;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.suggest-item:last-child { border-bottom: none; }
.suggest-item:active { background: var(--gray-bg); }

/* ── Stoorstoffen screen ── */
.search-wrap {
    display: flex;
    align-items: center;
    border: 1.5px solid #DDD;
    border-radius: var(--radius);
    padding: 0 14px;
    margin-bottom: 16px;
    background: #fff;
}
.search-icon {
    font-size: 17px;
    margin-right: 10px;
    color: #888;
    flex-shrink: 0;
}
.inp-search {
    flex: 1;
    border: none;
    padding: 14px 0;
    font-size: 17px;
    font-family: inherit;
    outline: none;
    background: transparent;
    color: var(--text);
}
.inp-search::placeholder { color: #AAA; }
.search-wrap:focus-within { border-color: var(--orange); }

.stoor-list { }
.stoor-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--gray-bg);
    border-radius: var(--radius);
    margin-bottom: 8px;
    cursor: pointer;
    font-size: 17px;
    font-weight: 600;
    transition: background .1s;
}
.stoor-row.selected { background: #E0E0E0; }
.stoor-check {
    width: 26px;
    height: 26px;
    border: 2px solid #BBB;
    border-radius: 6px;
    background: #fff;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.stoor-check.checked {
    background: var(--black);
    border-color: var(--black);
}
.stoor-check.checked::after {
    content: '✓';
    color: #fff;
    font-size: 14px;
    font-weight: 900;
}
.stoor-empty {
    text-align: center;
    color: #888;
    padding: 24px;
    font-size: 15px;
}

/* ── Foto screen ── */
.foto-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}
.foto-slot {
    aspect-ratio: 1;
    background: var(--gray-bg);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
}
.foto-slot.empty { }
.foto-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.foto-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    background: rgba(0,0,0,.55);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.foto-btns { display: flex; flex-direction: column; gap: 10px; }

/* ── Afhandeling screen ── */
.choice-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 8px;
    padding: 16px;
    background: var(--gray-bg);
    border-radius: var(--radius);
}
.choice-btn {
    display: block;
    width: 100%;
    padding: 18px;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    background: #DCDCDC;
    color: var(--black);
    transition: opacity .1s;
}
.choice-btn:active { opacity: .85; }
.choice-btn.choice-orange { background: var(--orange); color: #fff; }
.choice-btn.choice-selected {
    background: #888;
    color: #fff;
}
.choice-btn.choice-selected-orange {
    background: var(--orange);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(244,121,32,.35);
}

.weight-wrap {
    display: flex;
    align-items: stretch;
    border: 1.5px solid #DDD;
    border-radius: var(--radius);
    overflow: hidden;
}
.inp-weight {
    flex: 1;
    border: none;
    padding: 14px 16px;
    font-size: 22px;
    font-weight: 600;
    outline: none;
    background: #fff;
    border-radius: 0;
    width: 0;
    -moz-appearance: textfield;
    appearance: textfield;
}
.inp-weight::-webkit-outer-spin-button,
.inp-weight::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.weight-unit {
    display: flex;
    align-items: center;
    padding: 0 16px;
    background: var(--gray-bg);
    font-size: 16px;
    font-weight: 600;
    color: #666;
    border-left: 1.5px solid #DDD;
    flex-shrink: 0;
}
.weight-wrap:focus-within { border-color: var(--orange); }

/* ── Container screen ── */
.inp-container {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid #DDD;
    border-radius: var(--radius);
    font-size: 20px;
    font-weight: 600;
    outline: none;
    letter-spacing: 1px;
}
.inp-container:focus { border-color: var(--orange); }

/* ── Error message ── */
.error-msg {
    margin-top: 12px;
    padding: 12px 16px;
    background: #FEE2E2;
    border-radius: 10px;
    color: #B91C1C;
    font-size: 14px;
    font-weight: 500;
}

/* ── Toast ── */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--black);
    color: #fff;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 600;
    opacity: 0;
    transition: opacity .2s, transform .2s;
    white-space: nowrap;
    z-index: 1000;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── Device code login ── */
.device-code-box {
    background: var(--gray-bg);
    border-radius: var(--radius);
    padding: 24px 16px;
    text-align: center;
    margin: 8px 0 4px;
}
.device-code {
    font-size: 36px;
    font-weight: 900;
    letter-spacing: 6px;
    color: var(--black);
    font-variant-numeric: tabular-nums;
}
.vang-link {
    display: block;
    color: var(--link);
    font-size: 14px;
    word-break: break-all;
    text-decoration: underline;
    padding: 8px 0;
}
.poll-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    color: #666;
    font-size: 15px;
}
.poll-dot {
    width: 10px; height: 10px;
    background: var(--orange);
    border-radius: 50%;
    flex-shrink: 0;
    animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: .4; transform: scale(.75); }
}

/* ── Loading ── */
.spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    color: var(--orange);
    font-size: 18px;
    font-weight: 600;
}
