:root {
    --navy: #0f2a44;
    --blauw: #1565c0;
    --groen: #1b8a3a;
    --oranje: #d97706;
    --rood: #c62828;
    --grijs: #5f6b7a;
    --lijn: #d8dee6;
    --achtergrond: #f3f5f8;
    --kaart: #ffffff;
    --tekst: #14202e;
    --tabs-hoogte: 64px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--tekst);
    -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; background: var(--achtergrond); }

h2 { margin: 4px 0 14px; font-size: 1.35rem; }
h2 small { font-weight: 400; color: var(--grijs); font-size: .85rem; }
h3 { margin: 22px 0 6px; font-size: 1.05rem; }
label { display: block; font-weight: 600; margin: 10px 0 6px; }
.klein { font-size: .85rem; color: var(--grijs); }
.fout { color: var(--rood); font-weight: 600; }
[hidden] { display: none !important; }

input[type=text], input[type=password], select {
    width: 100%;
    font-size: 1.1rem;
    padding: 12px 14px;
    border: 1px solid var(--lijn);
    border-radius: 10px;
    background: #fff;
    color: var(--tekst);
}
input.nummer {
    font-size: 2.6rem;
    font-weight: 700;
    letter-spacing: .3em;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.knop {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 12px;
    padding: 12px 18px;
    font-size: 1rem;
    font-weight: 600;
    background: var(--blauw);
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.knop:active { filter: brightness(.9); }
.knop:disabled { opacity: .5; }
.knop.groot { width: 100%; padding: 16px; font-size: 1.15rem; margin-top: 16px; }
.knop.secundair { background: #e3eaf3; color: var(--navy); }
.knop.klein-knop { padding: 8px 12px; font-size: .9rem; }
.knop.gevaar { background: var(--rood); }
.knop.geparkeerd {
    width: 100%;
    margin-top: 18px;
    padding: 30px 16px;
    font-size: 1.8rem;
    border-radius: 18px;
    background: var(--groen);
    box-shadow: 0 6px 18px rgba(27, 138, 58, .35);
}
.link { background: none; border: 0; padding: 0; color: var(--blauw); font: inherit; text-decoration: underline; cursor: pointer; }

.rij { display: flex; gap: 10px; margin-top: 10px; }
.rij > * { flex: 1; }

/* Balk en tabs */
.balk {
    position: sticky; top: 0; z-index: 1000;
    display: flex; align-items: center; justify-content: space-between;
    padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
    background: var(--navy); color: #fff;
}
.merk { font-weight: 800; letter-spacing: .04em; }
.merk span { font-weight: 400; opacity: .75; }
.gps-pil {
    border: 0; border-radius: 999px; padding: 6px 12px;
    font-weight: 700; font-size: .9rem; color: #fff; background: var(--grijs);
}
.gps-pil.goed { background: var(--groen); }
.gps-pil.matig { background: var(--oranje); }
.gps-pil.slecht { background: var(--rood); }

main { padding: 16px 16px calc(var(--tabs-hoogte) + 24px + env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto; }
.tab { display: none; }
.tab.actief { display: block; }

.tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
    display: flex; background: #fff; border-top: 1px solid var(--lijn);
    padding-bottom: env(safe-area-inset-bottom);
}
.tabs button {
    flex: 1; height: var(--tabs-hoogte); border: 0; background: none;
    font-size: .95rem; font-weight: 600; color: var(--grijs);
}
.tabs button.actief { color: var(--blauw); box-shadow: inset 0 3px 0 var(--blauw); }

/* Kaartjes */
.kaartje { background: var(--kaart); border: 1px solid var(--lijn); border-radius: 12px; padding: 12px 14px; margin-top: 14px; }
.kaartje dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; }
.kaartje dt { color: var(--grijs); }
.kaartje dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.hint { margin-top: 18px; font-size: .9rem; color: var(--grijs); }
.tester-regel { font-size: .9rem; color: var(--grijs); }

/* Meten */
.meet-status { margin-top: 14px; }
.balkje { height: 10px; background: var(--lijn); border-radius: 99px; overflow: hidden; }
#meet-voortgang { height: 100%; width: 0; background: var(--groen); transition: width .3s; }
#meet-tekst { margin: 8px 0; font-weight: 600; }

/* Zoeken */
.kompas { text-align: center; margin-top: 16px; }
#pijl { width: 150px; height: 150px; fill: var(--blauw); transition: transform .25s ease-out; }
.afstand { font-size: 2.4rem; font-weight: 800; margin-top: 6px; }
.mini-kaart { height: 260px; border-radius: 12px; margin-top: 14px; border: 1px solid var(--lijn); }

/* Kaart-tab: kaart vult het scherm tussen balk en tabs */
.tab-kaart.actief { display: flex; flex-direction: column; margin: -16px; height: calc(100dvh - 56px - env(safe-area-inset-top) - var(--tabs-hoogte) - env(safe-area-inset-bottom)); }
.kaart-balk { display: flex; gap: 8px; padding: 10px; background: #fff; border-bottom: 1px solid var(--lijn); }
.kaart-balk select { flex: 1; padding: 8px 10px; font-size: 1rem; }
.kaart { flex: 1; min-height: 300px; }
.banner { background: #fff4d6; padding: 10px 14px; font-weight: 600; border-bottom: 1px solid #f0d58c; }
.bok-label { background: rgba(15, 42, 68, .85); color: #fff; border: 0; font-weight: 700; padding: 1px 6px; box-shadow: none; }
.bok-label::before { display: none; }
.leaflet-popup-content { font-size: .9rem; }
.leaflet-popup-content .knop { margin: 6px 6px 0 0; }

/* Resultaten */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat { background: #fff; border: 1px solid var(--lijn); border-radius: 12px; padding: 12px; }
.stat b { display: block; font-size: 1.5rem; }
.stat span { font-size: .85rem; color: var(--grijs); }
.tabel-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--lijn); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; font-size: .85rem; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--lijn); text-align: left; white-space: nowrap; }
th { background: #f7f9fb; }
.acc-goed { color: var(--groen); font-weight: 700; }
.acc-matig { color: var(--oranje); font-weight: 700; }
.acc-slecht { color: var(--rood); font-weight: 700; }

/* Start en login */
.start { position: fixed; inset: 0; z-index: 2000; background: rgba(15, 42, 68, .92); display: flex; align-items: center; justify-content: center; padding: 16px; }
.start-kaart, .login-kaart { background: #fff; border-radius: 16px; padding: 22px; max-width: 440px; width: 100%; }
body.login { display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--navy); }
.login-kaart h1 { margin: 0 0 6px; }
.login-kaart h1 span { font-weight: 400; color: var(--grijs); }

.melding {
    position: fixed; left: 16px; right: 16px; z-index: 3000;
    bottom: calc(var(--tabs-hoogte) + 14px + env(safe-area-inset-bottom));
    padding: 14px 16px; border-radius: 12px; font-weight: 600;
    background: var(--navy); color: #fff; box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}
.melding.ok { background: var(--groen); }
.melding.fout { background: var(--rood); }
