/* ── Trilho Map CSS ── */

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

/* ── THEME VARIABELEN ── */
:root {
    --layout-border:     rgba(78,203,141,0.1);
    --layout-nav:        #1d2520;
    --layout-sidebar:    #1a1f1c;
    --layout-bg:         #1a1f1c;
    --nav-text:          #e8f0eb;
    --nav-subtext:       #7a9a8a;
    --nav-search-bg:     #232e29;
    --nav-search-border: rgba(78,203,141,0.2);
    --pill-bg:           rgba(78,203,141,0.12);
    --pill-active-bg:    #4ecb8d;
    --pill-active-text:  #1a1f1c;
    --btn-primary-bg:    #4ecb8d;
    --btn-primary-text:  #1a1f1c;
    --btn-sec-border:    rgba(138,168,152,0.3);
    --btn-sec-text:      #b0c8bc;
    --logo-color:        #4ecb8d;
    /* ── Layout-grid: één bron van waarheid voor horizontale marges ── */
    --ui-margin: 20px;
    /* ── Navigatie-hoogte (zonder safe area) ── */
    --nav-height: 64px;
}

body.licht {
    --layout-border:     #e8e8e8;
    --layout-nav:        #ffffff;
    --layout-sidebar:    #f5f7f6;
    --layout-bg:         #f0f2f1;
    --nav-text:          #111111;
    --nav-subtext:       #666666;
    --nav-search-bg:     #f0f0f0;
    --nav-search-border: #d8d8d8;
    --pill-bg:           #ffffff;
    --pill-active-bg:    #1a2920;
    --pill-active-text:  #ffffff;
    --btn-primary-bg:    #4ecb8d;
    --btn-primary-text:  #111111;
    --btn-sec-border:    #d8d8d8;
    --btn-sec-text:      #444444;
    --logo-color:        #1a2920;
    /* sidebar content kleuren */
    --dew:       #1a1f1c;
    --sage:      #4a6a5a;
    --fern:      #2a4a3a;
    --forest:    #1a2920;
    --mist:         rgba(240,244,242,0.97);
    --mist-solid:   #eef2f0;
    --surface-item: rgba(0,0,0,0.04);
    --border-subtle:rgba(0,0,0,0.09);
}

/* ── BASE LAYOUT ── */
html, body {
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    display: flex;
    flex-direction: column;
    font-family: 'DM Sans', sans-serif;
    background: var(--layout-bg);
}

/* ── TOPNAV ── */
#topnav {
    height: calc(var(--nav-height) + env(safe-area-inset-top));
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding: env(safe-area-inset-top) var(--ui-margin) 0;
    gap: 10px;
    background: var(--layout-nav);
    border-bottom: 1px solid var(--layout-border);
    z-index: 300;
}

.nav-logo {
    font-family: Georgia, serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--logo-color);
    text-decoration: none;
    letter-spacing: -0.5px;
    flex: 0 0 auto; /* nooit krimpen — logo altijd volledig zichtbaar */
    margin-right: 4px;
}

.nav-search-wrap {
    flex: 1;
    max-width: 480px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--nav-search-bg);
    border: 1.5px solid var(--nav-search-border);
    border-radius: 12px;
    padding: 0 14px;
    height: 42px;
    color: var(--nav-subtext);
    position: relative;
}

/* ── ZOEK DROPDOWN ── */
.zoek-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0; right: 0;
    background: var(--mist-solid);
    border: 1px solid var(--layout-border);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px rgba(0,0,0,0.35);
    z-index: 600;
    max-height: 360px;
    overflow-y: auto;
}

.zoek-groep {
    font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--sage);
    padding: 10px 14px 4px;
}

.zoek-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 13px; color: var(--dew);
    transition: background 0.1s;
}

.zoek-item:hover { background: rgba(78,203,141,0.1); }
.zoek-icoon { font-size: 15px; flex-shrink: 0; }
.zoek-naam { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zoek-leeg { padding: 16px 14px; font-size: 13px; color: var(--sage); text-align: center; }

.nav-search-wrap input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-family: 'DM Sans', sans-serif;
    font-size: 16px;
    color: var(--nav-text);
}

.nav-search-wrap input::placeholder { color: var(--nav-subtext); }

.nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.nav-btn-sec {
    height: 36px;
    padding: 0 14px;
    background: transparent;
    color: var(--btn-sec-text);
    border: 1.5px solid var(--btn-sec-border);
    border-radius: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.nav-btn-primary {
    height: 36px;
    padding: 0 16px;
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border: none;
    border-radius: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(78,203,141,0.3);
}

.nav-btn-filters {
    height: 36px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    color: var(--btn-sec-text);
    border: 1.5px solid var(--btn-sec-border);
    border-radius: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.nav-btn-filters.actief {
    background: var(--pill-active-bg);
    color: var(--pill-active-text);
    border-color: transparent;
}

.nav-gebruiker {
    font-size: 13px;
    font-weight: 600;
    color: var(--amber);
    text-decoration: none;
}

/* ── MOBIEL ACCOUNT MENU ── */
.mob-account-wrap {
    display: none; /* alleen zichtbaar op mobiel */
    position: relative;
    flex-shrink: 0;
}

.mob-account-btn {
    /* Zelfde hoogte, border-radius en randkleur als de zoekbalk */
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1.5px solid var(--nav-search-border);
    background: var(--nav-search-bg);
    color: var(--nav-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.mob-account-btn:hover { background: rgba(255,255,255,0.08); }

.mob-account-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: auto;
    min-width: 180px;
    max-width: calc(100vw - 24px); /* nooit buiten het viewport */
    background: var(--mist-solid);
    border: 1px solid var(--layout-border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    z-index: 500;
    padding: 6px;
    pointer-events: auto;
}
.mob-account-menu.zichtbaar { display: block; }

.mob-account-naam {
    padding: 8px 12px 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--amber);
    border-bottom: 1px solid var(--layout-border);
    margin-bottom: 4px;
}

.mob-account-item {
    display: block;
    width: 100%;
    padding: 9px 12px;
    background: none;
    border: none;
    color: var(--nav-text);
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    text-decoration: none; /* voor <a> elementen */
    border-radius: 7px;
    transition: background 0.1s;
    box-sizing: border-box;
}
.mob-account-item:hover { background: rgba(78,203,141,0.12); }

.mob-theme-row {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin-top: 4px;
    padding-top: 12px;
}
.mob-inline-toggle { pointer-events: none; }

/* ── THEME TOGGLE ── */
.theme-toggle-wrap {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    flex-shrink: 0;
    cursor: pointer;
}

.sb-theme-toggle { display: none; }

.theme-toggle-switch {
    width: 38px;
    height: 20px;
    background: rgba(138,168,152,0.3);
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
}

body.donker .theme-toggle-switch { background: var(--amber); }

.theme-toggle-knob {
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: left 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

body.donker .theme-toggle-knob { left: 20px; }

/* ── FILTER BAR ── */
#filter-bar {
    display: none;
    flex-shrink: 0;
    align-items: center;
    gap: 6px;
    padding: 10px var(--ui-margin);
    background: var(--layout-nav);
    border-bottom: 1px solid var(--layout-border);
    overflow-x: auto;
    z-index: 299;
}

#filter-bar.open { display: flex; }

.fb-pill {
    height: 32px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--pill-bg);
    color: var(--nav-subtext);
    border: 1.5px solid var(--layout-border);
    border-radius: 20px;
    font-family: 'DM Sans', sans-serif;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
    flex-shrink: 0;
}

.fb-pill:hover { color: var(--nav-text); }

.fb-pill.active {
    background: var(--pill-active-bg);
    color: var(--pill-active-text);
    border-color: transparent;
    font-weight: 700;
}

.fb-divider {
    width: 1px;
    height: 20px;
    background: var(--layout-border);
    flex-shrink: 0;
    margin: 0 2px;
}

/* ── APP BODY ── */
#app-body {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

:root {
    --forest:       #1a2920;
    --moss:         #2c3530;
    --sage:         #8aa898;
    --fern:         #b4cfc4;
    --dew:          #eaf5ef;
    --amber:        #4ecb8d;
    --amber-dim:    #2ea86a;
    --ink:          #1a2920;
    --mist:         rgba(54,62,57,0.96);
    --mist-solid:   #363e39;
    --radius-sm:    8px;
    --radius-md:    14px;
    --radius-lg:    20px;
    --surface-item: rgba(255,255,255,0.05);
    --border-subtle:rgba(138,168,152,0.1);
}

/* ── MAP ── */
#map {
    flex: 1;
    position: relative;
    background: #1a2920;
}

/* ── SIDEBAR — DESKTOP ── */
#sidebar {
    width: 380px;
    flex-shrink: 0;
    background: var(--layout-sidebar);
    border-right: 1px solid var(--layout-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 100;
    transition: transform 0.35s cubic-bezier(.4,0,.2,1);
}

/* ── TABLET ── */
@media (max-width: 1100px) and (min-width: 768px) {
    #sidebar { width: 300px; }
    #route-detail-panel { left: 316px; }
}

/* ── MOBILE ── */
@media (max-width: 767px) {
    /* Één centrale marge — header, kaartcontrols en bottom sheet lijnen hier op uit */
    :root {
        --ui-margin: 16px;
    }

    #topnav {
        /* Safe area: header-achtergrond begint op y=0 (achter statusbalk),
           content begint op env(safe-area-inset-top) — verankerd aan de bovenkant van het
           veilige gebied; items gecentreerd in de --nav-height eronder. */
        padding: env(safe-area-inset-top) var(--ui-margin) 0;
        gap: 8px;
        pointer-events: none;
        border-bottom: none;
    }
    #topnav button,
    #topnav a,
    #topnav input,
    #zoek-dropdown {
        pointer-events: auto;
    }

    /* Zoekveld: flex-shrinkbaar, max 60% zodat logo en knop altijd ruimte houden */
    .nav-search-wrap { flex: 1 1 auto; min-width: 0; max-width: 60%; }
    .theme-toggle-wrap { display: none; }
    .theme-toggle-wrap.sb-theme-toggle { display: flex; }

    /* Volledige desktop nav-right verborgen — accountfunctie via mob-account-wrap */
    .nav-right { display: none !important; }
    .mob-account-wrap { display: flex; align-items: center; }

    #app-body {
        position: relative;
        overflow: hidden;
    }

    #map {
        position: fixed;
        inset: 0;
        flex: none;
        width: 100%;
        height: 100%;
    }

    #sidebar {
        position: absolute;
        left: 0; right: 0;
        bottom: 0; top: auto;
        width: 100%;
        height: 85%;
        border-right: none;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        border-top: none;
        transform: translateY(calc(100% - 80px));
        transition: transform 0.4s cubic-bezier(.4,0,.2,1);
        padding-bottom: env(safe-area-inset-bottom);
        z-index: 200;
        pointer-events: none;
    }
    #sidebar.sheet-open,
    #sidebar .sheet-handle,
    #sidebar .sb-body,
    #sidebar .sb-footer {
        pointer-events: auto;
    }

    /* Verberg sidebar volledig tijdens route tekenen */
    body.routing-actief #sidebar {
        transform: translateY(100%) !important;
        pointer-events: none !important;
    }

    #sidebar.sheet-open { transform: translateY(0); }
    #sidebar.sheet-open .sb-peek { display: none; }

    .sheet-handle { display: flex; }

    .map-controls {
        /* Zelfde linkermarge als de header (var(--ui-margin) = 16px).
           Top: header-hoogte + safe area + 12px spatiëring — zodat de knoppen
           nooit achter de header vallen, ook niet in standalone PWA-mode. */
        left: var(--ui-margin);
        right: auto;
        top: calc(var(--nav-height) + env(safe-area-inset-top) + 12px);
        transform: none;
        bottom: auto;
        pointer-events: none;
    }
    .map-ctrl-btn {
        pointer-events: auto;
    }
    .map-ctrl-divider {
        display: none;
    }

    .route-popup {
        bottom: 100px;
        left: 16px; right: 16px;
        transform: translateY(200px);
        min-width: unset;
    }

    .route-popup.visible { transform: translateY(0); }
}

@media (min-width: 768px) {
    .sheet-handle { display: none; }
    .sb-peek { display: none; }
}

/* ── DRAG HANDLE ── */
.sheet-handle {
    justify-content: center;
    align-items: center;
    padding: 16px 0 12px;
    min-height: 44px;
    cursor: grab;
    flex-shrink: 0;
}

.sheet-handle-bar {
    width: 36px; height: 4px;
    background: rgba(138,168,152,0.3);
    border-radius: 2px;
}

/* ── MOBILE PEEK BAR ── */
.sb-peek {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px 14px;
    flex-shrink: 0;
    position: relative;
    cursor: pointer;
}

.sb-peek-search {
    flex: 1;
    height: 44px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(138,168,152,0.2);
    border-radius: 12px;
    padding: 0 14px 0 40px;
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    color: rgba(234,245,239,0.5);
    pointer-events: none;
    display: flex;
    align-items: center;
}

.sb-peek-icon {
    position: absolute;
    left: 26px;
    top: 50%; margin-top: -7px;
    color: var(--sage);
    pointer-events: none;
    display: flex;
}

.sb-peek-upload {
    width: 44px; height: 44px;
    background: var(--forest);
    border: none; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--sage);
    flex-shrink: 0;
}

/* ── SIDEBAR HEADER ── */
.sb-header {
    padding: 18px var(--ui-margin) 14px;
    border-bottom: 1px solid rgba(138,168,152,0.12);
    flex-shrink: 0;
}

.sb-logo {
    display: flex; align-items: center; gap: 8px;
    text-decoration: none; margin-bottom: 14px;
}

.logo-mark {
    width: 28px; height: 28px;
    background: var(--forest); border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
}

.logo-wordmark {
    font-family: 'DM Serif Display', serif;
    font-size: 18px; color: var(--dew); letter-spacing: -0.3px;
}

.sb-search { position: relative; }

.sb-search input {
    width: 100%; height: 38px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(138,168,152,0.2);
    border-radius: var(--radius-sm);
    padding: 0 12px 0 36px;
    font-size: 13.5px; font-family: 'DM Sans', sans-serif; color: var(--dew);
    outline: none; transition: border-color 0.15s, background 0.15s;
}

.sb-search input:focus { border-color: var(--amber); background: rgba(255,255,255,0.1); }
.sb-search input::placeholder { color: rgba(234,245,239,0.35); }

.sb-search-icon {
    position: absolute; left: 10px; top: 50%;
    transform: translateY(-50%);
    color: var(--sage); pointer-events: none;
}

/* ── SIDEBAR BODY ── */
.sb-body {
    flex: 1; overflow-y: auto; overflow-x: hidden;
    padding: 14px var(--ui-margin);
    display: flex; flex-direction: column; gap: 18px;
    -webkit-overflow-scrolling: touch;
}

.sb-body::-webkit-scrollbar { width: 5px; }
.sb-body::-webkit-scrollbar-thumb { background: rgba(138,168,152,0.3); border-radius: 4px; }

.sb-label {
    font-size: 10.5px; font-weight: 500;
    letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--sage); margin-bottom: 8px;
}

.sb-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 0 -20px;
}

/* ── ACTIVITY PILLS ── */
.activity-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.act-pill {
    display: flex; flex-direction: column; align-items: center; gap: 5px;
    padding: 12px 4px 10px;
    background: var(--surface-item);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer; transition: all 0.15s;
    font-size: 11px; color: var(--sage); font-weight: 400;
    user-select: none; min-height: 64px;
}

.act-pill i { font-size: 22px; opacity: 0.75; }
.act-pill:hover { background: rgba(78,203,141,0.1); border-color: var(--sage); color: var(--dew); }
.act-pill.active { background: var(--amber); border-color: var(--amber); color: var(--forest); }
.act-pill.active i { opacity: 1; color: var(--forest); }

/* ── DIFFICULTY ── */
.diff-row { display: flex; gap: 6px; flex-wrap: wrap; }

.diff-btn {
    flex: 1; height: 36px;
    background: var(--surface-item);
    border: 1px solid var(--border-subtle);
    border-radius: 6px; font-size: 12px; padding: 0 10px;
    font-family: 'DM Sans', sans-serif; color: var(--dew);
    cursor: pointer; transition: all 0.15s;
}

.diff-btn:hover { background: rgba(78,203,141,0.1); }
.diff-btn.active { background: var(--amber); border-color: var(--amber); color: var(--forest); font-weight: 500; }

.upload-btn {
    height: 36px; padding: 0 12px;
    background: var(--amber); border: none;
    border-radius: 6px; font-size: 12px; font-weight: 600;
    font-family: 'DM Sans', sans-serif; color: var(--forest);
    cursor: pointer; transition: background 0.15s;
}
.upload-btn:hover { background: var(--amber-dim); color: var(--dew); }
.upload-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── ROUTE CALCULATE TOGGLE ── */
.route-panel-toggle {
    display: flex; align-items: center; justify-content: space-between;
    padding: 13px 14px; background: var(--forest); border: none;
    border-radius: var(--radius-sm); cursor: pointer; color: #eaf5ef;
    font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 500;
    width: 100%; transition: background 0.15s; min-height: 48px;
}

.route-panel-toggle:hover { background: rgba(26,41,32,0.8); }
.route-panel-toggle .rtg-left { display: flex; align-items: center; gap: 8px; }

.route-dot {
    width: 8px; height: 8px;
    border-radius: 50%; background: var(--amber);
}

.route-panel-toggle i.chevron { transition: transform 0.2s; }
.route-panel-toggle.open i.chevron { transform: rotate(180deg); }

.routing-sub { display: none; padding-top: 10px; }
.routing-sub.open { display: block; }

/* ── PROFILE BUTTONS ── */
.profile-row { display: flex; gap: 6px; flex-wrap: wrap; }

.prof-btn {
    display: flex; align-items: center; gap: 6px;
    height: 36px; padding: 0 12px;
    background: var(--surface-item);
    border: 1px solid var(--border-subtle);
    border-radius: 6px; font-size: 12px; padding: 0 10px;
    font-family: 'DM Sans', sans-serif; color: var(--dew);
    cursor: pointer; transition: all 0.15s; white-space: nowrap;
}

.prof-btn i { font-size: 15px; }
.prof-btn:hover { background: rgba(78,203,141,0.1); }
.prof-btn.active { background: var(--amber); border-color: var(--amber); color: var(--forest); font-weight: 500; }

.route-status {
    font-size: 12px; color: var(--sage);
    padding: 8px 0 2px;
    display: flex; align-items: center; gap: 6px;
}

.status-dot {
    width: 6px; height: 6px;
    border-radius: 50%; background: var(--amber);
    animation: pulse 2s infinite;
}

/* ── TOGGLE SWITCH ── */
.toggle { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
    position: absolute; inset: 0;
    background: rgba(138,168,152,0.25);
    border-radius: 11px; cursor: pointer; transition: background 0.2s;
}

.toggle-slider::before {
    content: ''; position: absolute;
    width: 16px; height: 16px; border-radius: 50%;
    background: white; top: 3px; left: 3px;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.toggle input:checked + .toggle-slider { background: var(--amber); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── ROUTE CARDS ── */
.route-card {
    padding: 14px 16px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(138,168,152,0.12);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.route-card:hover {
    background: rgba(255,255,255,0.09);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.route-card.selected {
    border-color: var(--amber);
    background: rgba(78,203,141,0.1);
}
.route-card-header {
    display: flex; align-items: center;
    justify-content: space-between; gap: 8px;
}
.rc-naam {
    font-size: 14px; font-weight: 600;
    color: var(--dew); line-height: 1.3;
    margin: 0;
}
.route-meta {
    display: flex; gap: 10px;
    font-size: 12px; color: var(--sage);
}
.meta-item { display: flex; align-items: center; gap: 3px; }
.rc-val { font-weight: 500; color: var(--dew); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag {
    font-size: 11px; font-weight: 500;
    padding: 3px 8px; border-radius: 20px;
    background: rgba(138,168,152,0.12);
    color: var(--sage);
}
.tag-level {
    background: rgba(78,203,141,0.12);
    color: var(--amber-dim);
}
.badge-prive {
    font-size: 10px; font-weight: 500;
    padding: 2px 7px; border-radius: 10px;
    background: rgba(78,203,141,0.12);
    color: var(--amber-dim);
    white-space: nowrap;
}
.route-acties { margin-top: 4px; }
.route-delete-btn {
    font-size: 11px; color: #e07070;
    background: none; border: 1px solid rgba(200,90,90,0.25);
    border-radius: 6px; padding: 3px 10px;
    cursor: pointer; font-family: 'DM Sans', sans-serif;
    transition: all 0.12s;
}
.route-delete-btn:hover {
    background: rgba(200,90,90,0.1);
}

/* ── ROUTING MARKERS ── */
.routing-marker-start,
.routing-marker-eind,
.routing-marker-waypoint {
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.routing-marker-start { background: #4ecb8d; }
.routing-marker-eind  { background: #c85a3a; }
.routing-marker-waypoint {
    box-sizing: border-box;
    background: var(--layout-sidebar);
    color: var(--dew);
    font-size: 9px;
    font-weight: 700;
    line-height: 10px;
    text-align: center;
}
.routing-marker-start,
.routing-marker-eind,
.routing-marker-waypoint { cursor: grab; touch-action: none; }
.routing-marker-start:active,
.routing-marker-eind:active,
.routing-marker-waypoint:active { cursor: grabbing; }

/* ── ROUTE MARKERS (start/eind bij geselecteerde route) ── */
.route-marker-start,
.route-marker-eind {
    width: 16px; height: 16px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.route-marker-start { background: #4ecb8d; }
.route-marker-eind  { background: #e05a00; }


/* ── TOAST ── */
.kaart-toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    background: #1a2920;
    color: #e8ede9;
    font-size: 13px;
    padding: 10px 18px;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s, transform 0.22s;
    white-space: nowrap;
    max-width: calc(100vw - 32px);
    text-align: center;
}
.kaart-toast.zichtbaar {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}
@media (max-width: 767px) {
    .kaart-toast { bottom: calc(env(safe-area-inset-bottom) + 80px); }
}

.recording-panel { position:fixed; z-index:210; top:82px; right:16px; width:min(340px,calc(100vw - 32px)); padding:16px; border-radius:var(--radius-md); background:var(--mist-solid); box-shadow:0 12px 36px rgba(0,0,0,.35); }
.recording-panel[hidden], #recording-recovery[hidden] { display:none; }
.recording-title { display:flex; align-items:center; gap:8px; margin-bottom:14px; }
#recording-dot { width:10px; height:10px; border-radius:50%; background:#ef6351; }
.recording-panel label { display:block; font-size:12px; margin-bottom:5px; color:var(--sage); }
.recording-panel select { width:100%; padding:9px; margin-bottom:14px; border-radius:var(--radius-sm); }
.recording-stats { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:14px; }
.recording-stats span { display:flex; flex-direction:column; padding:10px; background:rgba(78,203,141,.08); border-radius:var(--radius-sm); }
.recording-stats b { font-size:20px; }.recording-stats small { color:var(--sage); }
.recording-actions { display:flex; gap:8px; flex-wrap:wrap; }.recording-actions button { flex:1; min-width:90px; }
@media (max-width:767px) { .recording-panel { top:auto; bottom:calc(76px + env(safe-area-inset-bottom)); left:12px; right:12px; width:auto; } }

/* ── KNOOPPUNT MARKERS ── */
.locatie-stip {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #4285f4;
    border: 2.5px solid #fff;
    box-shadow: 0 0 0 0 rgba(66, 133, 244, 0.5);
    animation: locatie-pulse 2s ease-out infinite;
    cursor: default;
}

@keyframes locatie-pulse {
    0%   { box-shadow: 0 0 0 0   rgba(66, 133, 244, 0.5); }
    70%  { box-shadow: 0 0 0 14px rgba(66, 133, 244, 0); }
    100% { box-shadow: 0 0 0 0   rgba(66, 133, 244, 0); }
}

.locatie-start-stip {
    width: 20px;
    height: 28px;
    position: relative;
    cursor: default;
}
.locatie-start-stip::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 20px; height: 20px;
    background: #4ecb8d;
    border-radius: 50%;
    border: 2.5px solid white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.45);
    box-sizing: border-box;
}
.locatie-start-stip::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 9px solid #4ecb8d;
}

.knooppunt-marker {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: #1a2920;
    border: 2px solid #4ecb8d;
    color: #4ecb8d;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.6);
    transition: transform 0.15s, background 0.15s;
    user-select: none;
}
.knooppunt-marker:hover {
    background: #4ecb8d;
    color: #1a2920;
    transform: scale(1.2);
}

.knooppunt-popup .maplibregl-popup-content {
    background: var(--mist);
    color: var(--dew);
    border-radius: var(--radius-md);
    padding: 0;
    overflow: hidden;
    min-width: 160px;
}
.knooppunt-popup .maplibregl-popup-tip { border-top-color: var(--mist); }
.kp-popup-inner { padding: 12px; }
.kp-foto {
    width: 100%;
    max-height: 120px;
    object-fit: cover;
    display: block;
    margin: -12px -12px 10px -12px;
    width: calc(100% + 24px);
}
.kp-nummer {
    font-size: 20px;
    font-weight: 700;
    color: #4ecb8d;
    display: block;
    margin-bottom: 6px;
}
.kp-nav-rij {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
}
.kp-nav {
    font-size: 11px;
    color: var(--sage);
    background: rgba(255,255,255,0.07);
    padding: 2px 6px;
    border-radius: 4px;
}
.kp-link {
    font-size: 11px;
    color: #4ecb8d;
    text-decoration: none;
}
.kp-link:hover { text-decoration: underline; }

/* ── ALGEMENE TRILHO POPUP ── */
.trilho-popup .maplibregl-popup-content {
    background: var(--mist);
    color: var(--dew);
    border-radius: var(--radius-md);
    padding: 0;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.06);
}
.trilho-popup .maplibregl-popup-tip { border-top-color: var(--mist); }
.trilho-popup .maplibregl-popup-close-button {
    color: var(--sage);
    font-size: 16px;
    padding: 6px 10px;
}
.trilho-popup .maplibregl-popup-close-button:hover { color: var(--dew); background: transparent; }

.outdoor-poi-popup {
    padding: 14px 34px 14px 16px;
    font-family: 'DM Sans', sans-serif;
    overflow-wrap: anywhere;
}
.outdoor-poi-popup > div { margin-top: 4px; }

/* ── WATERTAPPUNT POPUP ── */
.wt-popup { font-family: 'DM Sans', sans-serif; }
.wt-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}
.wt-icoon {
    width: 32px;
    height: 32px;
    background: rgba(41,168,224,0.15);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.wt-header strong {
    font-size: 13px;
    font-weight: 600;
    color: var(--dew);
    line-height: 1.3;
}
.wt-straat {
    font-size: 11px;
    color: rgba(255,255,255,0.45);
    margin-top: 1px;
}
.wt-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 10px 16px 6px;
}
.wt-badge {
    font-size: 11px;
    font-weight: 500;
    padding: 3px 9px;
    border-radius: 20px;
    letter-spacing: 0.01em;
}
.wt-badge--groen { background: rgba(78,203,141,0.15); color: #4ecb8d; }
.wt-badge--blauw { background: rgba(41,168,224,0.15); color: #29a8e0; }
.wt-badge--grijs  { background: rgba(255,255,255,0.07); color: var(--sage); }
.wt-badge--oranje { background: rgba(224,140,66,0.15); color: #e08c42; }
.wt-details {
    padding: 6px 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.wt-rij {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    font-size: 12px;
    color: var(--dew);
}
.wt-label {
    color: var(--sage);
    white-space: nowrap;
    font-size: 11px;
}
.wt-footer {
    padding: 8px 16px 14px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.wt-meld-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.35);
    font-size: 11px;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}
.wt-meld-btn:hover { color: rgba(255,255,255,0.6); }
.melding-cat {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    color: var(--dew);
    font-size: 12px;
    padding: 5px 12px;
    cursor: pointer;
}
.melding-cat.actief {
    background: var(--fern);
    border-color: var(--fern);
    color: #fff;
}

.route-scrubber-marker {
    width: 14px; height: 14px;
    border-radius: 50%;
    background: white;
    border: 3px solid #4ecb8d;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    pointer-events: none;
}

/* ── ROUTE DETAIL PANEEL ── */
#route-detail-panel {
    position: fixed;
    bottom: -520px;
    left: 380px;
    width: 300px;
    max-height: 80vh;
    overflow-y: auto;
    background: var(--mist);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    padding: 16px 16px 0;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.4);
    transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 260;
    border: 1px solid rgba(138,168,152,0.15);
    border-bottom: none;
}
#route-detail-panel.open { bottom: 0; }

@media (max-width: 767px) {
    #route-detail-panel {
        left: 0;
        width: 100%;
        max-height: 65dvh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        padding-bottom: 0;
    }
}

.rd-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.rd-titel-blok { display: flex; align-items: center; gap: 8px; }
.rd-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    background: rgba(78,203,141,0.15);
    color: var(--amber);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.rd-ref { font-size: 12px; color: var(--sage); }
.rd-sluit {
    background: rgba(138,168,152,0.12);
    border: none;
    color: var(--sage);
    width: 28px; height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 13px;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
.rd-sluit:hover { background: rgba(138,168,152,0.25); color: var(--dew); }
.rd-naam {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--dew);
    margin-bottom: 12px;
    line-height: 1.3;
}
.rd-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 14px;
}
.rd-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--fern);
}
.rd-meta-item svg { color: var(--sage); flex-shrink: 0; }
.rd-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.rd-stat { display: flex; align-items: center; gap: 5px; }
.rd-stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--sage); }
.rd-stat-val { font-size: 14px; font-weight: 700; }
.rd-stat-up   { color: #4ecb8d; }
.rd-stat-down { color: #e05a00; }

.rd-profiel-wrap {
    position: relative;
    height: 72px;
    margin-bottom: 14px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: rgba(0,0,0,0.2);
}
.rd-profiel-svg {
    width: 100%; height: 100%;
    display: block;
}
.rd-profiel-laden {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--sage);
}

.rd-legenda {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--sage);
}
.rd-legenda-item { display: flex; align-items: center; gap: 6px; }
.rd-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    border: 2px solid white;
    flex-shrink: 0;
}
.rd-dot-start    { background: #4ecb8d; }
.rd-dot-eind     { background: #e05a00; }
.rd-dot-richting { background: white; border-color: #888; }

.rd-acties {
    position: sticky;
    bottom: 0;
    margin-top: 10px;
    padding: 10px 0 max(16px, env(safe-area-inset-bottom));
    display: flex;
    gap: 8px;
    background: var(--mist);
}
.rd-gpx-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.07);
    color: var(--sage);
    border: 1px solid rgba(255,255,255,0.1);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.rd-gpx-btn:hover {
    background: rgba(78,203,141,0.15);
    color: #4ecb8d;
    border-color: #4ecb8d;
}
.rd-locatie-prompt {
    display: none;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin-bottom: 10px;
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    border: 1px dashed var(--layout-border);
    background: transparent;
    color: var(--sage);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    text-align: left;
}
.rd-locatie-prompt.zichtbaar { display: flex; }
.rd-locatie-prompt:hover { background: rgba(78,203,141,0.08); border-color: #4ecb8d; color: #4ecb8d; }
.rd-locatie-prompt:disabled { opacity: 0.5; cursor: default; }

.rd-nav-btn {
    flex: 1;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    background: #4ecb8d;
    color: #1a2920;
    border: none;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}
.rd-nav-btn:hover { background: #3db87a; }

/* ── KNOOPPUNTENLIJST ── */
.rd-sectie-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--sage);
    margin-top: 14px;
    margin-bottom: 8px;
}
.rd-knooppunten-lijst {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}
.rd-kp-item {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}
.rd-kp-badge {
    background: rgba(78,203,141,0.15);
    color: #4ecb8d;
    border: 1px solid rgba(78,203,141,0.3);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    transition: background 0.15s;
}
.rd-kp-item:hover .rd-kp-badge {
    background: rgba(78,203,141,0.35);
}
.rd-kp-pijl {
    font-size: 11px;
    color: var(--sage);
}
.rd-kp-segment {
    font-size: 10px;
    color: var(--sage);
    padding: 0 4px;
}
.rd-kp-badge--eind {
    background: rgba(224,90,0,0.15);
    color: #e05a00;
    border-color: rgba(224,90,0,0.3);
}
.rd-kp-straat {
    font-size: 10px;
    color: var(--sage);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
}

/* ── RICHTINGSPIJLEN ── */
.richting-marker {
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    color: #333;
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
    cursor: default;
    pointer-events: none;
    transform-origin: center;
    line-height: 1;
}

/* ── SIDEBAR FOOTER ── */
.sb-footer {
    padding: 12px var(--ui-margin);
    border-top: 1px solid rgba(138,168,152,0.1);
    display: flex; align-items: center; justify-content: space-between;
    flex-shrink: 0;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.lang-row { display: flex; gap: 2px; }

.lang-btn {
    height: 30px; padding: 0 8px;
    background: transparent; border: none;
    border-radius: 5px; font-size: 11px;
    font-family: 'DM Sans', sans-serif; color: var(--sage);
    cursor: pointer; transition: all 0.12s;
}

.lang-btn:hover, .lang-btn.active {
    background: rgba(78,203,141,0.12);
    color: var(--dew); font-weight: 500;
}

.login-btn {
    height: 34px; padding: 0 14px;
    background: var(--forest); border: none;
    border-radius: var(--radius-sm); font-size: 12px;
    font-family: 'DM Sans', sans-serif; color: var(--dew);
    cursor: pointer; transition: background 0.15s; font-weight: 500;
    display: flex; align-items: center; gap: 6px;
}

.login-btn:hover { background: rgba(26,41,32,0.8); }

/* ── MAP CONTROLS ── */
.map-controls {
    position: fixed; right: 16px; top: 50%;
    transform: translateY(-50%);
    display: flex; flex-direction: column; gap: 6px; z-index: 100;
}

.map-ctrl-btn {
    width: 44px; height: 44px;
    background: var(--mist);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(138,168,152,0.15); border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--sage); transition: all 0.15s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.map-ctrl-btn i { font-size: 18px; }
.map-ctrl-btn:hover { background: rgba(78,203,141,0.15); color: var(--dew); transform: scale(1.05); }

.map-ctrl-divider { height: 1px; background: rgba(138,168,152,0.15); margin: 2px 0; }

.map-attribution {
    position: fixed; bottom: 12px; right: 16px;
    font-size: 10px; color: rgba(234,245,239,0.4); z-index: 100;
}

/* ── ROUTE POPUP ── */
.route-popup {
    position: fixed; bottom: 24px; left: 50%;
    transform: translateX(-50%) translateY(120px);
    background: var(--mist); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(138,168,152,0.15); border-radius: var(--radius-lg);
    padding: 16px 20px; display: flex; flex-direction: column; gap: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.35); z-index: 200;
    transition: transform 0.4s cubic-bezier(.34,1.56,.64,1);
    min-width: 340px; max-width: 480px; width: calc(100vw - 48px);
}

.route-popup.visible { transform: translateX(-50%) translateY(0); }

.rp-icon {
    width: 42px; height: 42px; background: var(--forest);
    border-radius: 10px; display: flex; align-items: center;
    justify-content: center; flex-shrink: 0;
}

.rp-info { flex: 1; }
.rp-name { font-size: 14px; font-weight: 500; color: var(--dew); margin-bottom: 2px; }
.rp-sub { font-size: 12px; color: var(--sage); }
.rp-stats { display: flex; gap: 16px; }
.rp-stat { text-align: center; }
.rp-val { font-size: 16px; font-weight: 500; color: var(--dew); line-height: 1.2; }
.rp-lbl { font-size: 10px; color: var(--sage); }

.rp-close {
    width: 30px; height: 30px; border-radius: 50%;
    border: 1px solid rgba(138,168,152,0.2); background: transparent;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    color: var(--sage); flex-shrink: 0; transition: all 0.12s;
}

.rp-close:hover { background: rgba(78,203,141,0.1); color: var(--dew); }

/* ── GPX UPLOAD MODAL ── */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(10,18,14,0.75);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    z-index: 300;
    display: none; align-items: flex-end; justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-backdrop.open { display: flex; }

/* ── Route opslaan modal ── */
.opslaan-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
    background: rgba(10,18,14,0.78);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.opslaan-modal-card {
    width: min(360px, 100%);
    max-height: calc(100dvh - max(32px, env(safe-area-inset-top) + env(safe-area-inset-bottom)));
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 24px;
    color: var(--dew);
    background: var(--mist-solid);
    border: 1px solid var(--layout-border);
    border-radius: 12px;
    box-shadow: 0 18px 60px rgba(0,0,0,0.45);
}
.opslaan-modal-titel { margin: 0; color: var(--dew); font-size: 16px; }
.opslaan-modal-label {
    display: block;
    margin-bottom: 5px;
    color: var(--sage);
    font-size: 12px;
    font-weight: 600;
}
.opslaan-modal-input {
    width: 100%;
    min-height: 44px;
    padding: 9px 11px;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    outline: none;
    background: var(--layout-sidebar);
    color: var(--dew);
    font: inherit;
    font-size: 16px;
}
.opslaan-modal-input:focus {
    border-color: var(--mint);
    box-shadow: 0 0 0 3px rgba(78,203,141,0.15);
}
.opslaan-modal-fout { min-height: 16px; color: #e05a00; font-size: 13px; }
.opslaan-modal-succes {
    align-items: center;
    gap: 6px;
    min-height: 24px;
    color: var(--mint);
    font-size: 13px;
    font-weight: 600;
}
.opslaan-modal-acties { display: flex; gap: 8px; }
.opslaan-modal-acties button { min-height: 44px; }

@media (max-width: 680px) {
    .opslaan-modal-backdrop { align-items: flex-end; padding-left: 12px; padding-right: 12px; }
    .opslaan-modal-card { padding: 20px; border-radius: 14px; }
}

/* Alleen route-opslag volgt het zichtbare scherm, ook boven het iOS-toetsenbord. */
#opslaan-dialoog {
    top: var(--opslaan-viewport-top, 0px);
    left: var(--opslaan-viewport-left, 0px);
    right: auto;
    bottom: auto;
    width: var(--opslaan-viewport-width, 100%);
    height: var(--opslaan-viewport-height, 100%);
    align-items: center;
}
#opslaan-dialoog .opslaan-modal-card { max-height: 100%; }
#opslaan-dialoog .opslaan-modal-card > * { flex-shrink: 0; }

@media (min-width: 681px) {
    .modal-backdrop { align-items: center; }
}

.upload-modal {
    max-height: 90vh;
    overflow-y: auto;
    background: var(--mist-solid);
    width: 100%; max-width: 480px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 24px 24px max(24px, env(safe-area-inset-bottom));
    animation: slideUp 0.35s cubic-bezier(.4,0,.2,1);
}

@media (min-width: 681px) {
    .upload-modal {
    max-height: 90vh;
    overflow-y: auto;
        border-radius: var(--radius-lg);
        padding: 28px;
    }
}

.um-header {
    display: flex; align-items: center;
    justify-content: space-between; margin-bottom: 20px;
}

.um-title { font-size: 16px; font-weight: 500; color: var(--dew); }

.um-close {
    width: 32px; height: 32px; border-radius: 50%;
    border: 1px solid rgba(138,168,152,0.2); background: transparent;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    color: var(--sage); transition: all 0.12s;
}

.um-close:hover { background: rgba(78,203,141,0.1); }

.drop-zone {
    border: 2px dashed rgba(138,168,152,0.3);
    border-radius: var(--radius-md);
    padding: 28px 20px; text-align: center;
    cursor: pointer; transition: all 0.2s; margin-bottom: 20px;
    background: rgba(255,255,255,0.04);
}

.drop-zone:hover, .drop-zone.drag-over {
    border-color: var(--amber);
    background: rgba(78,203,141,0.08);
}

.drop-zone.has-file {
    border-color: var(--amber);
    background: rgba(78,203,141,0.08);
}

.dz-icon { color: var(--sage); margin-bottom: 10px; display: flex; justify-content: center; }
.dz-icon i { font-size: 32px; }
.drop-zone.has-file .dz-icon { color: var(--amber); }

.dz-text { font-size: 13px; color: var(--sage); line-height: 1.5; }
.dz-text strong { color: var(--dew); font-weight: 500; display: block; margin-bottom: 3px; }

.um-field { margin-bottom: 14px; }

.um-label {
    font-size: 11px; font-weight: 500;
    letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--sage); margin-bottom: 5px; display: block;
}

.um-input {
    width: 100%; height: 42px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(138,168,152,0.2);
    border-radius: var(--radius-sm);
    padding: 0 12px; font-size: 16px;
    font-family: 'DM Sans', sans-serif; color: var(--dew);
    outline: none; transition: border-color 0.15s;
}

.um-input:focus { border-color: var(--amber); background: rgba(255,255,255,0.1); }
.um-input::placeholder { color: rgba(234,245,239,0.3); }

.um-activity-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }

.um-act-btn {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 10px 4px 8px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(138,168,152,0.15);
    border-radius: var(--radius-sm);
    cursor: pointer; transition: all 0.15s;
    font-size: 11px; color: var(--sage); font-weight: 400;
    min-height: 60px;
}

.um-act-btn i { font-size: 18px; opacity: 0.7; }
.um-act-btn:hover { background: rgba(78,203,141,0.1); color: var(--dew); }
.um-act-btn.active { background: var(--amber); border-color: var(--amber); color: var(--forest); }
.um-act-btn.active i { opacity: 1; color: var(--forest); }

.um-level-row { display: flex; gap: 6px; }

.um-lvl-btn {
    flex: 1; height: 38px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(138,168,152,0.15);
    border-radius: 6px; font-size: 12px; padding: 0 10px;
    font-family: 'DM Sans', sans-serif; color: var(--dew);
    cursor: pointer; transition: all 0.15s;
}

.um-lvl-btn.active { background: var(--amber); border-color: var(--amber); color: var(--forest); font-weight: 500; }

.um-privacy {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px;
    background: rgba(26,41,32,0.4);
    border-radius: var(--radius-sm); margin-bottom: 18px;
}

.um-privacy-left { display: flex; align-items: center; gap: 10px; }
.um-privacy-label { font-size: 13px; font-weight: 500; color: var(--dew); }
.um-privacy-sub { font-size: 11px; color: var(--sage); margin-top: 1px; }

.um-submit {
    width: 100%; height: 46px;
    background: var(--amber); border: none;
    border-radius: var(--radius-sm); font-size: 14px;
    font-family: 'DM Sans', sans-serif; color: var(--forest); font-weight: 600;
    cursor: pointer; transition: background 0.15s;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}

.um-submit:hover { background: var(--amber-dim); color: var(--dew); }
.um-submit:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── ANIMATIONS ── */
@keyframes drawRoute {
    to { stroke-dashoffset: 0; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: .6; transform: scale(1.3); }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── MAP SVG ANIMATIONS ── */
.route-line {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    animation: drawRoute 3s cubic-bezier(.4,0,.2,1) 0.8s forwards;
}

/* ── UPLOAD MODAL — SLIDERS ── */
.um-slider-row {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 8px;
}

.um-slider-row:last-child { margin-bottom: 0; }

.um-slider-label {
    font-size: 11px; color: var(--sage);
    width: 36px; flex-shrink: 0;
}

.um-slider-row input[type="range"] {
    flex: 1; accent-color: var(--amber);
    height: 4px; cursor: pointer;
}

.um-slider-val {
    font-size: 12px; font-weight: 500;
    color: var(--dew); width: 42px;
    text-align: right; flex-shrink: 0;
}

/* Sparkles animatie op Ontdek knop */
@keyframes twinkle {
    0%, 100% { opacity: 1; transform: scale(1) rotate(0deg); }
    25% { opacity: 0.7; transform: scale(1.15) rotate(10deg); }
    75% { opacity: 0.85; transform: scale(0.95) rotate(-8deg); }
}

#act-alle svg {
    animation: twinkle 4s ease-in-out infinite;
}

/* ══════════════════════════════════════════════════════════
   NAVIGATIE FLOW — FASE 1 / 2 / 3
   ══════════════════════════════════════════════════════════ */

/* ── Fase 1: Info box in routing panel ── */
.rtg-info-box {
    background: rgba(78,203,141,0.06);
    border: 1px solid var(--layout-border);
    border-radius: 10px;
    padding: 10px 12px;
    margin: 10px 0 10px;
    font-size: 12px;
}
.rtg-info-hint { color: var(--sage); }
.rtg-info-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
}
.rtg-info-wp  { color: var(--dew); font-weight: 600; font-size: 13px; }
.rtg-info-km  { color: #4ecb8d; font-weight: 700; font-size: 13px; }

.rtg-overzicht-btn { width: 100%; margin-bottom: 4px; }
.rtg-overzicht-btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }

/* ── Nav sheet (Fase 2 + Fase 3) ── */
.nav-sheet {
    position: fixed;
    z-index: 350;
    left: 0;
    top: 64px;
    width: 380px;
    height: calc(100vh - 64px);
    overflow-y: auto;
    background: var(--layout-sidebar);
    border-right: 1px solid var(--layout-border);
    padding: 16px 20px 32px;
    transform: translateX(-110%);
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
    -webkit-overflow-scrolling: touch;
}
.nav-sheet.open { transform: translateX(0); }

/* Tablet */
@media (max-width: 1100px) and (min-width: 768px) {
    .nav-sheet { width: 300px; }
}

/* Mobiel: bottom sheet */
@media (max-width: 767px) {
    .nav-sheet {
        left: 0; right: 0;
        top: auto; bottom: 0;
        width: 100%;
        height: auto;
        max-height: 72dvh;
        max-height: 72vh; /* fallback */
        border-right: none;
        border-top: 1px solid var(--layout-border);
        border-radius: 20px 20px 0 0;
        transform: translateY(110%);
        padding: 12px 16px max(32px, env(safe-area-inset-bottom));
    }
    .nav-sheet.open { transform: translateY(0); }
}

.nav-sheet-handle {
    display: none;
    justify-content: center;
    align-items: center;
    min-height: 44px;
    padding-bottom: 12px;
}
.nav-sheet-handle-bar {
    width: 32px; height: 3px;
    background: var(--layout-border);
    border-radius: 2px;
}
@media (max-width: 767px) {
    .nav-sheet-handle { display: flex; }
}

.nav-sheet-titel {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--sage);
    margin-bottom: 14px;
}

/* ── Stats rij (afstand / stijging / tijd) ── */
.nav-stats-rij {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}
.nav-stat-blok {
    flex: 1;
    background: rgba(78,203,141,0.06);
    border: 1px solid var(--layout-border);
    border-radius: 10px;
    padding: 10px 6px;
    text-align: center;
}
.nav-stat-val {
    font-size: 15px;
    font-weight: 800;
    color: var(--dew);
    line-height: 1.2;
}
.nav-stat-lbl {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--sage);
    margin-top: 3px;
}

/* ── Hoogteprofiel in Fase 2 ── */
.nav-profiel-wrap {
    background: rgba(78,203,141,0.06);
    border: 1px solid var(--layout-border);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 14px;
}
.nav-profiel-lbl {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--sage);
    margin-bottom: 6px;
}
#nav2-profiel-svg { width: 100%; height: 148px; display: block; overflow: hidden; }

@media (max-width: 767px) {
    #nav2-profiel-svg { height: 168px; }
}

.nav-ondergrond-wrap {
    background: rgba(78,203,141,0.06);
    border: 1px solid var(--layout-border);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 14px;
}
.nav-ondergrond-rij {
    display: grid;
    grid-template-columns: 78px 1fr 34px;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    color: var(--sage);
    font-size: 10px;
}
.nav-ondergrond-balk {
    height: 5px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--layout-border);
}
.nav-ondergrond-vulling {
    height: 100%;
    border-radius: inherit;
    background: var(--mint);
}
.nav-ondergrond-pct { text-align: right; color: var(--dew); font-weight: 700; }

/* ── Waypoint lijst in Fase 2 ── */
.nav-wp-sectie-lbl {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--sage);
    margin-bottom: 10px;
}
.nav-wp-rij { display: flex; gap: 10px; align-items: stretch; }
.nav-wp-lijn-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 20px;
    flex-shrink: 0;
}
.nav-wp-lijn { width: 2px; flex: 1; background: var(--layout-border); }
.nav-wp-cirkel {
    width: 14px; height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    z-index: 1;
}
.nav-wp-cirkel--start { background: #4ecb8d; }
.nav-wp-cirkel--eind  { background: #c85a3a; }
.nav-wp-cirkel--mid   {
    background: var(--layout-sidebar);
    border: 2px solid rgba(78,203,141,0.4);
}
.nav-wp-content {
    flex: 1;
    background: rgba(78,203,141,0.05);
    border: 1px solid var(--layout-border);
    border-radius: 10px;
    padding: 8px 10px;
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 48px;
}
.nav-wp-naam { font-size: 11px; font-weight: 700; color: var(--dew); }
.nav-wp-naam--start { color: #4ecb8d; }
.nav-wp-naam--eind  { color: #c85a3a; }
.nav-wp-rechts { display: flex; align-items: center; gap: 8px; }
.nav-wp-afstand-val {
    font-size: 11px; font-weight: 700;
    color: #4ecb8d; text-align: right;
}
.nav-wp-afstand-lbl { font-size: 9px; color: var(--sage); }
.nav-wp-sub {
    font-size: 10px;
    color: var(--sage);
    margin-top: 2px;
    line-height: 1.4;
}
.nav-wp-knooppunt {
    background: rgba(78,203,141,0.12);
    color: #4ecb8d;
    border-radius: 4px;
    padding: 0 4px;
    font-weight: 700;
    font-size: 10px;
}
.nav-wp-sectie-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.nav-wp-sectie-header .nav-wp-sectie-lbl { margin-bottom: 0; }
.nav-wp-header-acties { display: flex; gap: 6px; }
.nav-wp-header-acties .nav-wp-omkeer { min-height: 36px; min-width: 44px; }
.nav-wp-omkeer {
    background: rgba(78,203,141,0.06);
    border: 1px solid var(--layout-border);
    border-radius: 6px;
    color: var(--sage);
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
}
.nav-wp-omkeer:hover { color: var(--dew); border-color: rgba(78,203,141,0.4); }
.nav-wp-move {
    background: none; border: none;
    color: var(--sage); font-size: 13px;
    cursor: pointer; padding: 0;
    line-height: 1;
    min-width: 28px; min-height: 24px;
}
.nav-wp-move:hover { color: var(--dew); }
.nav-wp-del {
    background: none; border: none;
    color: var(--sage); font-size: 18px;
    cursor: pointer; padding: 0;
    line-height: 1;
    min-width: 36px; min-height: 36px;
}
.nav-wp-del:hover { color: #e05c5c; }

/* ── Actie knoppen (Fase 2 onderaan) ── */
.nav-actie-rij { display: flex; gap: 8px; margin-top: 16px; }
.nav-actie-sec {
    flex: 1;
    background: rgba(78,203,141,0.06);
    color: var(--dew);
    border: 1px solid var(--layout-border);
    border-radius: 10px;
    padding: 11px 6px;
    font-size: 12px; font-weight: 600;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    white-space: nowrap;
}
.nav-actie-start {
    flex: 2;
    background: #4ecb8d;
    color: #111;
    border: none;
    border-radius: 10px;
    padding: 11px 10px;
    font-size: 13px; font-weight: 800;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    box-shadow: 0 2px 8px rgba(78,203,141,0.35);
}

/* ── Fase 3: Instructie kaart (zweeft boven kaart) ── */
#nav-instructie-kaart {
    position: fixed;
    top: 76px;
    left: 392px; /* na sidebar (380px + 12px) */
    right: 12px;
    z-index: 300;
    background: rgba(26,31,28,0.96);
    border: 1px solid rgba(78,203,141,0.3);
    border-radius: 14px;
    padding: 14px 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    display: none;
}
body.licht #nav-instructie-kaart {
    background: rgba(255,255,255,0.97);
    border-color: #e0e0e0;
}
@media (max-width: 1100px) and (min-width: 768px) {
    #nav-instructie-kaart { left: 312px; }
}
@media (max-width: 767px) {
    #nav-instructie-kaart {
        left: 8px; right: 8px;
        top: calc(72px + env(safe-area-inset-top));
    }
}

.nav-instr-inner { display: flex; align-items: center; gap: 12px; }
.nav-instr-pijl {
    width: 44px; height: 44px;
    background: #4ecb8d;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.nav-instr-tekst { flex: 1; }
.nav-instr-actie { font-size: 16px; font-weight: 800; color: var(--dew); }
.nav-instr-straat { font-size: 12px; color: var(--sage); margin-top: 2px; }
.nav-instr-afstand-blok { text-align: right; flex-shrink: 0; }
.nav-instr-getal { font-size: 20px; font-weight: 800; color: #4ecb8d; }
.nav-instr-eenheid { font-size: 10px; color: var(--sage); }

/* ── Fase 3: Voortgang panel ── */
.nav-voortgang-rij {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.nav-voortgang-lbl { font-size: 12px; color: var(--sage); }
.nav-voortgang-km  { font-size: 12px; font-weight: 700; color: #4ecb8d; }
.nav-voortgang-wrap {
    height: 4px;
    background: rgba(78,203,141,0.12);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 14px;
}
#nav3-voortgang-balk {
    height: 100%;
    background: #4ecb8d;
    border-radius: 2px;
    transition: width 0.6s ease;
    width: 0%;
}
.nav-stop-btn {
    width: 100%;
    background: rgba(78,203,141,0.05);
    color: #e05c5c;
    border: 1.5px solid rgba(224,92,92,0.3);
    border-radius: 10px;
    padding: 12px;
    font-size: 14px; font-weight: 700;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
}
.nav-stop-btn:hover { background: rgba(224,92,92,0.08); }

.nav-sim-btn {
    width: 100%;
    margin-top: 8px;
    background: rgba(78,203,141,0.08);
    color: #4ecb8d;
    border: 1.5px solid rgba(78,203,141,0.3);
    border-radius: 10px;
    padding: 10px;
    font-size: 13px; font-weight: 700;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
}
.nav-sim-btn:hover { background: rgba(78,203,141,0.15); }

/* ── Mobiele routing toolbar ── */
#mob-routing-bar {
    display: none;
}
@media (max-width: 767px) {
    body.routing-actief #mob-routing-bar {
        display: flex;
        flex-direction: column;
        gap: 8px;
        position: fixed;
        bottom: max(16px, env(safe-area-inset-bottom));
        left: var(--ui-margin); right: var(--ui-margin);
        background: rgba(26,31,28,0.95);
        border: 1px solid rgba(78,203,141,0.25);
        border-radius: 16px;
        padding: 12px 14px;
        z-index: 250;
        backdrop-filter: blur(8px);
    }
    body.licht #mob-routing-bar {
        background: rgba(255,255,255,0.97);
    }
    #mob-routing-status {
        font-size: 13px;
        color: var(--sage);
        font-weight: 500;
    }
    #mob-routing-stats {
        display: flex;
        gap: 12px;
        font-size: 13px;
        font-weight: 700;
        color: var(--dew);
    }
    #mob-routing-bar > div:last-child {
        display: flex;
        gap: 8px;
    }
    #mob-routing-overzicht {
        flex: 1;
        background: #4ecb8d;
        color: #1a1f1c;
        border: none;
        border-radius: 10px;
        padding: 10px;
        font-size: 13px; font-weight: 700;
        cursor: pointer;
        font-family: 'DM Sans', sans-serif;
    }
    #mob-routing-wis {
        flex: 1;
        background: rgba(78,203,141,0.07);
        color: var(--sage);
        border: 1px solid rgba(78,203,141,0.2);
        border-radius: 10px;
        padding: 10px;
        font-size: 13px; font-weight: 600;
        cursor: pointer;
        font-family: 'DM Sans', sans-serif;
    }
}

/* ── Scrollbar nav sheet ── */
.nav-sheet {
    scrollbar-width: thin;
    scrollbar-color: rgba(78,203,141,0.25) transparent;
}
.nav-sheet::-webkit-scrollbar { width: 4px; }
.nav-sheet::-webkit-scrollbar-track { background: transparent; }
.nav-sheet::-webkit-scrollbar-thumb {
    background: rgba(78,203,141,0.25);
    border-radius: 2px;
}
.nav-sheet::-webkit-scrollbar-thumb:hover { background: rgba(78,203,141,0.5); }

.rp-top { display: flex; align-items: center; gap: 12px; width: 100%; }

/* Mobile: route-acties zitten voortaan in het accountmenu rechtsboven */
@media (max-width: 767px) {
    #sb-peek,
    #routing-toggle,
    #upload-form {
        display: none !important;
    }

    #sidebar:not(.sheet-open) {
        transform: translateY(100%);
    }
}

/* Outdoor POI popup action */
.outdoor-poi-popup > strong {
    display: block;
    font-size: 15px;
    line-height: 1.3;
}

.outdoor-poi-popup > .trilho-button {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 9px 12px;
    border: 1px solid var(--sage);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--dew);
    font: inherit;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.outdoor-poi-popup > .trilho-button:hover {
    border-color: var(--dew);
}

.outdoor-poi-popup > .trilho-button:disabled {
    opacity: .5;
    cursor: default;
}
