:root {
    color-scheme: light;
    --bg: #f5f6f2;
    --panel: rgba(250, 250, 248, .88);
    --panel-solid: #ffffff;
    --ink: #16201b;
    --muted: #68736c;
    --line: rgba(30, 42, 35, .12);
    --green: #176f4d;
    --green-strong: #0d5639;
    --yellow: #c48916;
    --red: #bf3434;
    --blue: #2366d1;
    --shadow: 0 18px 50px rgba(29, 43, 36, .14);
    --sheet-shadow: 0 22px 60px rgba(25, 31, 28, .22), 0 2px 8px rgba(25, 31, 28, .08);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    overflow: hidden;
    background: var(--bg);
    color: var(--ink);
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.login-screen {
    position: fixed;
    z-index: 2000;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(245, 246, 242, .82);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.login-screen.hidden {
    display: none;
}

.login-card {
    display: grid;
    gap: 14px;
    width: min(380px, 100%);
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: 22px;
    padding: 22px;
    background: rgba(250, 250, 248, .92);
    box-shadow: var(--sheet-shadow);
}

.login-card h1 {
    margin: 0;
}

.login-card p:last-child {
    min-height: 18px;
    margin: 0;
    color: var(--red);
    font-size: 13px;
    font-weight: 800;
}

.shell {
    position: relative;
    min-height: 100vh;
}

.map-pane {
    position: fixed;
    inset: 0;
}

.topbar {
    position: absolute;
    z-index: 600;
    top: 16px;
    left: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    pointer-events: none;
}

.topbar > * {
    pointer-events: auto;
}

.top-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.topbar h1,
.panel h2,
.history h3 {
    margin: 0;
    letter-spacing: 0;
}

.topbar h1 {
    font-size: clamp(26px, 3vw, 42px);
    line-height: 1;
}

.eyebrow {
    margin: 0 0 4px;
    color: rgba(22, 32, 27, .52);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.primary-action,
.save-button,
.actions button,
.report-form button {
    border: 0;
    border-radius: 12px;
    color: #fff;
    background: var(--green);
    font-weight: 800;
    min-height: 42px;
    padding: 0 16px;
    box-shadow: 0 10px 20px rgba(23, 111, 77, .18);
}

.primary-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.primary-action[aria-pressed="true"] {
    background: var(--blue);
}

.gps-action[aria-pressed="true"] {
    background: var(--red);
}

.map-action[aria-pressed="true"] {
    background: var(--ink);
}

.primary-action span {
    font-size: 22px;
    line-height: 1;
}

.map {
    width: 100%;
    height: 100vh;
    min-height: 100vh;
}

.maplibregl-ctrl-group {
    border: 0 !important;
    box-shadow: var(--shadow) !important;
}

.maplibregl-ctrl-bottom-left {
    bottom: 10px;
}

.layer-switcher {
    position: absolute;
    z-index: 620;
    left: 10px;
    bottom: 92px;
    display: grid;
    gap: 6px;
    width: 142px;
    border: 1px solid rgba(255, 255, 255, .62);
    border-radius: 14px;
    padding: 8px;
    background: rgba(250, 250, 248, .84);
    backdrop-filter: blur(18px) saturate(1.4);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    box-shadow: var(--shadow);
}

.layer-switcher button {
    min-height: 34px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, .74);
    color: var(--ink);
    font-size: 13px;
    font-weight: 800;
}

.layer-switcher button[aria-pressed="true"] {
    border-color: var(--green);
    background: var(--green);
    color: #fff;
}

.kolk-marker {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 3px solid #fff;
    border-radius: 999px;
    color: #fff;
    font-weight: 900;
    box-shadow: 0 8px 18px rgba(0, 0, 0, .24);
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.kolk-marker.open {
    background: var(--yellow);
}

.kolk-marker.geleegd {
    background: var(--green);
}

.kolk-marker.probleem {
    background: var(--red);
}

.kolk-marker.niet_bereikbaar {
    background: #5d6675;
}

.kolk-marker.selected {
    position: relative;
    z-index: 5;
    border-color: #111827;
    color: #111827;
    transform: scale(1.32);
    box-shadow:
        0 0 0 5px rgba(255, 255, 255, .96),
        0 0 0 9px rgba(245, 180, 31, .88),
        0 14px 26px rgba(0, 0, 0, .34);
}

.user-marker {
    position: relative;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border: 3px solid #fff;
    border-radius: 999px;
    background: var(--blue);
    box-shadow: 0 8px 18px rgba(0, 0, 0, .28);
}

.user-marker::after {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #fff;
}

.user-marker::before {
    content: "";
    position: absolute;
    inset: -10px;
    border: 2px solid rgba(35, 102, 209, .35);
    border-radius: 999px;
}

.panel {
    position: absolute;
    z-index: 650;
    right: 16px;
    bottom: 86px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(350px, calc(100vw - 32px));
    height: min(78vh, 780px);
    overflow: auto;
    padding: 8px 10px 12px;
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: 22px;
    box-shadow: var(--sheet-shadow);
    backdrop-filter: blur(24px) saturate(1.45);
    -webkit-backdrop-filter: blur(24px) saturate(1.45);
    scrollbar-width: thin;
}

.panel-grabber {
    align-self: center;
    width: 42px;
    height: 5px;
    margin: 2px 0 4px;
    border-radius: 999px;
    background: rgba(22, 32, 27, .22);
}

.panel-header {
    position: sticky;
    z-index: 2;
    top: -10px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: start;
    margin: 0 -10px;
    padding: 9px 10px 10px;
    background: linear-gradient(180deg, rgba(250, 250, 248, .96), rgba(250, 250, 248, .72));
    backdrop-filter: blur(20px) saturate(1.35);
    -webkit-backdrop-filter: blur(20px) saturate(1.35);
    border-bottom: 1px solid rgba(30, 42, 35, .07);
}

.panel h2 {
    max-width: 210px;
    font-size: 19px;
    line-height: 1.08;
}

.status-pill {
    flex: 0 0 auto;
    border-radius: 999px;
    padding: 7px 10px;
    background: rgba(239, 242, 239, .78);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.status-pill.open {
    background: #fff2c6;
    color: #76520f;
}

.status-pill.geleegd {
    background: #dff4e8;
    color: var(--green-strong);
}

.status-pill.probleem {
    background: #fbe0df;
    color: #8d2525;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(30, 42, 35, .1);
}

.stats div {
    min-height: 58px;
    border: 0;
    border-radius: 0;
    padding: 9px;
    background: rgba(255, 255, 255, .74);
}

.stats strong {
    display: block;
    font-size: 20px;
}

.stats span {
    color: var(--muted);
    font-size: 11px;
}

.gps-card {
    display: grid;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 10px;
    background: rgba(255, 255, 255, .7);
}

.gps-card div {
    display: grid;
    gap: 3px;
}

.municipality-picker {
    color: var(--muted);
}

.gps-card span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.gps-card strong {
    font-size: 15px;
}

.hidden-municipality-select {
    display: none;
}

.driver-footer {
    position: fixed;
    z-index: 720;
    right: 16px;
    bottom: 12px;
    left: 16px;
    display: grid;
    grid-template-columns: repeat(7, minmax(112px, 1fr));
    gap: 1px;
    overflow-x: auto;
    overflow-y: hidden;
    min-height: 54px;
    border: 1px solid rgba(255, 255, 255, .72);
    border-radius: 16px;
    background: rgba(30, 42, 35, .12);
    box-shadow: 0 16px 42px rgba(0, 0, 0, .18);
    backdrop-filter: blur(22px) saturate(1.35);
    -webkit-backdrop-filter: blur(22px) saturate(1.35);
    scrollbar-width: none;
}

.driver-footer::-webkit-scrollbar {
    display: none;
}

.driver-footer div {
    display: grid;
    align-content: center;
    gap: 2px;
    min-width: 0;
    padding: 8px 12px;
    background: rgba(255, 255, 255, .82);
}

.driver-footer span {
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.driver-footer strong {
    overflow: hidden;
    color: var(--ink);
    font-size: 14px;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.panel-hidden .panel {
    display: none;
}

.kolk-form,
.report-form,
.problem-presets {
    display: grid;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 10px;
    background: rgba(255, 255, 255, .7);
}

.hidden-kolk-form {
    display: none;
}

.problem-presets > span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.problem-presets > div {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.problem-presets button {
    min-height: 34px;
    border: 1px solid rgba(30, 42, 35, .12);
    border-radius: 9px;
    padding: 0 8px;
    background: rgba(255, 255, 255, .78);
    color: var(--ink);
    box-shadow: none;
    font-size: 11px;
    font-weight: 800;
}

.problem-presets button:hover,
.problem-presets button:focus-visible {
    border-color: rgba(191, 52, 52, .35);
    background: rgba(251, 224, 223, .85);
    outline: none;
}

.problem-presets button.selected {
    border-color: rgba(191, 52, 52, .78);
    background: var(--red);
    color: #fff;
}

.problem-presets button.selected:hover,
.problem-presets button.selected:focus-visible {
    border-color: rgba(141, 37, 37, .9);
    background: #8d2525;
}

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, .82);
    color: var(--ink);
    outline: none;
    padding: 11px 12px;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 4px rgba(23, 111, 77, .12);
}

textarea {
    resize: vertical;
}

.split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.actions {
    display: grid;
    gap: 7px;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 10px;
    background: rgba(255, 255, 255, .7);
}

#unreachableButton {
    background: var(--yellow);
}

button:disabled {
    cursor: not-allowed;
    opacity: .45;
    box-shadow: none;
}

.report-form button {
    background: var(--red);
}

.history {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 10px;
    background: rgba(255, 255, 255, .7);
}

.history h3 {
    font-size: 16px;
}

.history ol {
    display: grid;
    gap: 10px;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
}

.history li {
    border-left: 0;
    border-top: 1px solid rgba(30, 42, 35, .08);
    padding: 10px 0 0;
}

.history-toggle {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 34px;
    border: 1px solid rgba(23, 111, 77, .18);
    border-radius: 10px;
    padding: 6px 8px;
    background: rgba(223, 244, 232, .74);
    color: var(--ink);
    box-shadow: none;
    text-align: left;
}

.history-toggle.inactive {
    border-color: rgba(93, 102, 117, .2);
    background: rgba(239, 242, 239, .82);
    color: var(--muted);
}

.history-toggle span {
    border-radius: 999px;
    padding: 3px 7px;
    background: var(--green);
    color: #fff;
    font-size: 11px;
    font-weight: 900;
}

.history-toggle.inactive span {
    background: #5d6675;
}

.history time {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.history p {
    margin: 3px 0 0;
    line-height: 1.4;
}

.view-only-banner {
    position: fixed;
    z-index: 2100;
    left: 50%;
    top: 12px;
    transform: translateX(-50%);
    max-width: calc(100% - 24px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 1px solid rgba(196, 137, 22, .45);
    border-radius: 10px;
    padding: 8px 10px 8px 14px;
    background: #fff7e6;
    color: #5c4213;
    box-shadow: var(--shadow);
    font-size: 13px;
    font-weight: 900;
    text-align: center;
}

.view-only-banner button {
    min-height: 34px;
    border: 0;
    border-radius: 8px;
    padding: 0 12px;
    background: var(--ink);
    color: #fff;
    font-size: 12px;
    font-weight: 900;
}

@media (max-width: 900px) {
    .panel {
        left: 12px;
        right: 12px;
        bottom: 78px;
        width: auto;
        height: min(46vh, 520px);
    }

    .topbar {
        align-items: flex-start;
    }
}

@media (max-width: 560px) {
    .topbar {
        left: 12px;
        right: 12px;
        top: 12px;
    }

    .primary-action {
        width: 44px;
        padding: 0;
        justify-content: center;
        overflow: hidden;
        white-space: nowrap;
        font-size: 0;
    }

    .primary-action span {
        margin-left: 0;
        font-size: 22px;
    }

    .top-actions {
        max-width: 144px;
    }

    .panel {
        padding: 16px;
    }

    .driver-footer {
        right: 8px;
        bottom: 8px;
        left: 8px;
        grid-template-columns: repeat(7, minmax(112px, 1fr));
    }

    .driver-footer div {
        min-height: 46px;
        padding: 7px 9px;
    }

    .split,
    .stats {
        grid-template-columns: 1fr;
    }
}
