/* Driver — tokens + base + topbar inherited from
   _tokens.css and _components.css. This file holds driver-
   specific layout (mobile shell, tabbar, sheet, map). */

:root {
    --shadow: var(--shadow-sm);
    --neutral-soft: var(--bg-sunk);
    --topbar-h: 68px;
    --tabbar-h: 70px;
}
[data-theme='dark'] { color-scheme: light; }

.driver-app,
.driver-tabbar,
.driver-sheet {
    width: min(100%, 720px);
}
.driver-app {
    min-height: 100vh;
    margin: 0 auto;
    padding: 16px 16px calc(var(--tabbar-h) + 18px);
}
@media (min-width: 960px) {
    .driver-app,
    .driver-tabbar { width: min(100%, 980px); }
    .driver-app { padding: 24px 24px calc(var(--tabbar-h) + 22px); }
}
@media (min-width: 1180px) {
    .driver-app,
    .driver-tabbar { width: min(100%, 1180px); }
}
.driver-tour-select {
    max-width: 190px;
}

.screen { display: none; }
.screen.is-active { display: block; }
.hero {
    padding: 18px 14px 14px;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--border);
}
.hero-greet {
    font-size: 24px;
    line-height: 1.15;
    font-weight: 800;
}
.hero-meta {
    margin-top: 5px;
    color: var(--fg-muted);
    font-size: 13px;
}
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 12px;
}
.kpi-card,
.section-card,
.stop-card,
.map-wrap {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
}
.kpi-card { padding: 12px; }
.kpi-label {
    color: var(--fg-faint);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.kpi-value {
    margin-top: 4px;
    font-size: 25px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.kpi-hint {
    margin-top: 2px;
    color: var(--fg-muted);
    font-size: 12px;
}
.section-card {
    margin: 12px;
    overflow: hidden;
}
.section-card h3 {
    margin: 0;
    padding: 12px 14px;
    font-size: 15px;
    border-bottom: 1px solid var(--border);
}
.section-card-body {
    padding: 12px 14px;
    color: var(--fg-muted);
}

.tour-head {
    position: sticky;
    top: var(--topbar-h);
    z-index: 45;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--border);
    padding: 12px 14px;
}
.tour-head-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}
.tour-head-eyebrow {
    color: var(--fg-faint);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.tour-head-customer {
    margin-top: 3px;
    font-size: 19px;
    font-weight: 800;
}
.tour-head-address {
    color: var(--fg-muted);
    font-size: 13px;
}
.eta-box {
    min-width: 74px;
    align-self: flex-start;
    padding: 8px 10px;
    text-align: center;
    border-radius: 12px;
    background: var(--bg-sunk);
}
.eta-time {
    font-size: 18px;
    font-weight: 800;
}
.eta-delta {
    color: var(--fg-muted);
    font-size: 11px;
    font-weight: 700;
}
.tour-progress {
    margin-top: 10px;
    height: 7px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--bg-sunk);
}
.tour-progress span {
    display: block;
    height: 100%;
    float: left;
}
.seg-done { background: var(--good); }
.seg-bad { background: var(--bad); }
.seg-now { background: var(--accent); }

.map-wrap {
    margin: 12px;
    overflow: hidden;
    /* Eigener Stacking-Context: kapselt alle Leaflet-Panes (z-index 200–700)
       und -Controls (bis 1000) in die Karte. Sonst steigen diese in den
       Wurzel-Kontext auf und übermalen beim Scrollen die sticky .tour-head
       (z-45) und die Topbar (z-80). `isolation` statt `position:relative;
       z-index:0`, weil der Desktop-Override `position:static` setzt und
       z-index dort wirkungslos wäre — isolation greift unabhängig davon. */
    isolation: isolate;
}
.map-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    font-size: 12px;
    font-weight: 800;
    border-bottom: 1px solid var(--border);
}
.map-header-toggle {
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
}
.driver-map {
    height: 230px;
    transition: height .2s ease;
    background: var(--bg-sunk);
}
.driver-map.is-collapsed {
    height: 0;
    min-height: 0;
}
.leaflet-container { font: inherit; }
.map-marker {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--fg-muted);
    color: #fff;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .25);
    font-size: 12px;
    font-weight: 800;
}
.map-marker.delivered { background: var(--good); }
.map-marker.in_progress { background: var(--accent); }
.map-marker.problem { background: var(--bad); }

/* Google-Maps-Übergabe (Deep-Link, ganze Resttour) */
.driver-maps-nav {
    margin: 0 12px 4px;
    padding: 12px 14px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}
.maps-nav-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.maps-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
    justify-content: center;
    min-height: var(--tap);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: var(--accent-fg);
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    border: 1px solid var(--accent-dark);
}
.maps-nav-btn:hover { background: var(--accent-dark); }
.maps-nav-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.maps-nav-hint {
    margin: 8px 0 0;
    font-size: 11px;
    line-height: 1.45;
    color: var(--fg-muted);
}

.stop-list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 14px 8px;
}
.stop-list-head h3 { margin: 0; font-size: 15px; }
.count { color: var(--fg-muted); font-size: 12px; }
.stop-list {
    display: grid;
    gap: 10px;
    padding: 0 12px 12px;
}
.stop-card {
    padding: 12px;
    text-align: left;
}
.stop-card.delivered { background: var(--good-soft); }
.stop-card.problem { background: var(--bad-soft); }
.stop-card.in_progress { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.stop-card-row {
    display: flex;
    gap: 10px;
}
.stop-card-num {
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--bg-sunk);
    font-weight: 800;
    font-size: 12px;
}
.stop-card-main { min-width: 0; flex: 1; }
.stop-card-customer {
    font-weight: 800;
    overflow-wrap: anywhere;
}
.stop-card-address,
.stop-card-detail {
    color: var(--fg-muted);
    font-size: 12px;
}
.stop-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.tag {
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 800;
    background: var(--bg-sunk);
    color: var(--fg-muted);
}
.tag.good { background: var(--good-soft); color: var(--good); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }

.driver-tabbar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 80;
    height: var(--tabbar-h);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: var(--bg-elev);
    border-top: 1px solid var(--border);
}
.driver-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--fg-muted);
    font-size: 11px;
    font-weight: 800;
}
.driver-tab svg {
    width: 21px;
    height: 21px;
}
.driver-tab.is-active { color: var(--accent); }

.sheet-scrim,
.pause-scrim {
    position: fixed;
    inset: 0;
    /* Muss über Topbar (1500), Tabs (1400) und Karten-Layer (≤1000) liegen. */
    z-index: 1700;
    opacity: 0;
    pointer-events: none;
    background: rgba(15, 23, 42, .42);
    transition: opacity .2s ease;
}
.sheet-scrim.is-open,
.pause-scrim.is-open {
    opacity: 1;
    pointer-events: auto;
}
.driver-sheet {
    position: fixed;
    left: 50%;
    bottom: 0;
    z-index: 1710;
    max-height: min(86vh, 780px);
    display: flex;
    flex-direction: column;
    background: var(--bg-elev);
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -12px 34px rgba(15, 23, 42, .22);
    transform: translateX(-50%) translateY(104%);
    transition: transform .22s ease;
}
.driver-sheet.is-open { transform: translateX(-50%) translateY(0); }
.sheet-grabber {
    width: 44px;
    height: 5px;
    margin: 10px auto 5px;
    border-radius: 999px;
    background: var(--border);
}
.sheet-head {
    padding: 6px 16px 12px;
    border-bottom: 1px solid var(--border);
}
.sheet-head-num {
    color: var(--fg-faint);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
}
.sheet-head-customer {
    margin-top: 2px;
    font-size: 20px;
    font-weight: 800;
}
.sheet-head-address {
    color: var(--fg-muted);
    font-size: 13px;
}
.sheet-body {
    overflow-y: auto;
}
.sheet-section {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}
.sheet-section h4 {
    margin: 0 0 9px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--fg-faint);
}
.quickrow,
.status-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}
.quick-btn,
.status-chip,
.btn-ghost,
.btn-save,
.btn-primary {
    min-height: 44px;
    border-radius: 12px;
    font-weight: 800;
    text-align: center;
}
.quick-btn {
    display: grid;
    place-items: center;
    text-decoration: none;
    background: var(--bg-sunk);
    color: var(--fg);
}
.status-chip {
    background: var(--bg-sunk);
}
.status-chip.is-active.good { background: var(--good); color: #fff; }
.status-chip.is-active.warn { background: var(--warn); color: #fff; }
.status-chip.is-active.bad { background: var(--bad); color: #fff; }
.customer-hints {
    display: grid;
    gap: 6px;
    color: var(--fg-muted);
    font-size: 13px;
}
.customer-hints b { color: var(--fg); }
.customer-photo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 8px;
}
.customer-photo-grid img {
    width: 100%;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
}
.item-proof-list {
    display: grid;
    gap: 8px;
}
.item-proof {
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: 9px;
    align-items: start;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
}
.item-proof input[type="checkbox"] {
    width: 22px;
    height: 22px;
    accent-color: var(--accent);
}
.item-proof-main b {
    display: block;
    font-size: 13px;
}
.item-proof-main span {
    color: var(--fg-muted);
    font-size: 12px;
}
.proof-file {
    margin-top: 7px;
    width: 100%;
    font-size: 12px;
}
.input-field {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-sunk);
    padding: 10px 12px;
}
textarea.input-field {
    min-height: 82px;
    resize: vertical;
}
.signature-canvas {
    width: 100%;
    height: 150px;
    margin-top: 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    touch-action: none;
}
.sheet-foot {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}
.btn-ghost {
    background: var(--bg-sunk);
    color: var(--fg);
}
.btn-ghost.small {
    min-height: 36px;
    margin-top: 8px;
    padding: 0 12px;
    font-size: 12px;
}
.btn-save,
.btn-primary {
    background: var(--accent);
    color: var(--accent-fg);
}
.btn-primary {
    width: calc(100% - 24px);
    margin: 0 12px 14px;
}
.btn-primary:disabled,
.btn-save:disabled {
    background: var(--neutral-soft);
    color: var(--fg-faint);
}
.pause-card {
    position: fixed;
    left: 50%;
    top: 50%;
    width: min(92vw, 360px);
    transform: translate(-50%, -50%);
    border-radius: 20px;
    padding: 22px;
    background: var(--bg-elev);
    box-shadow: var(--shadow);
    text-align: center;
}
.pause-card h3 { margin: 0; }
.pause-card p { color: var(--fg-muted); }
.pause-time {
    margin: 18px 0;
    font-size: 44px;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}
.pause-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.toast-host {
    position: fixed;
    left: 50%;
    bottom: calc(var(--tabbar-h) + 14px);
    z-index: 150;
    width: min(92vw, 480px);
    transform: translateX(-50%);
    display: grid;
    gap: 8px;
    pointer-events: none;
}
.toast {
    justify-self: center;
    border-radius: 12px;
    padding: 10px 14px;
    background: var(--fg);
    color: var(--bg-elev);
    box-shadow: var(--shadow);
    font-size: 13px;
    font-weight: 800;
}
.toast.good { background: var(--good); color: #fff; }
.toast.warn { background: var(--warn); color: #fff; }
.toast.bad { background: var(--bad); color: #fff; }

@media (min-width: 720px) {
    :root {
        --topbar-h: 56px;
        --tabbar-h: 72px;
    }

    .driver-topbar {
        padding: 0 18px;
    }

    .driver-tour-select {
        max-width: 360px;
        height: 38px;
        font-size: 13px;
    }

    .icon-btn {
        width: 38px;
        height: 38px;
    }

    .hero,
    .tour-head {
        border: 1px solid var(--border);
        border-radius: 14px;
        box-shadow: var(--shadow);
    }

    .hero {
        margin-top: 0;
        padding: 18px;
        border-bottom: 1px solid var(--border);
    }

    #screen-briefing.is-active,
    #screen-stats.is-active {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
        align-items: start;
    }

    #screen-briefing .hero,
    #screen-stats .hero,
    #screen-briefing .kpi-grid,
    #screen-stats .kpi-grid {
        grid-column: 1 / -1;
    }

    .kpi-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        padding: 0;
    }

    .section-card {
        margin: 0;
    }

    .btn-primary {
        grid-column: 1 / -1;
        width: 100%;
        margin: 0;
    }

    .tour-head {
        position: sticky;
        top: calc(var(--topbar-h) + 8px);
        margin: 0 0 12px;
        padding: 13px 16px;
    }

    .map-wrap {
        margin: 0 0 12px;
    }

    .driver-map {
        height: min(46vh, 430px);
        min-height: 340px;
    }

    .driver-map.is-collapsed {
        height: 0;
        min-height: 0;
    }

    .stop-list-head {
        padding: 4px 2px 8px;
    }

    .stop-list {
        padding: 0 0 12px;
    }

    .driver-tabbar {
        border: 1px solid var(--border);
        border-bottom: 0;
        border-radius: 18px 18px 0 0;
        overflow: hidden;
        box-shadow: 0 -8px 24px rgba(15, 23, 42, .08);
    }

    .driver-sheet {
        width: min(calc(100% - 32px), 760px);
    }

    .sheet-body {
        max-height: calc(82vh - 142px);
    }

    .quickrow {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .status-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 960px) {
    /* Karte volle Breite, darunter Stoppliste — kein 2-Spalten-Layout mehr */
    #screen-tour.is-active {
        display: flex;
        flex-direction: column;
        gap: 14px;
    }

    #screen-tour .map-wrap {
        position: static;
        margin-bottom: 0;
    }

    #screen-tour .driver-map {
        height: 52vh;
        min-height: 380px;
        max-height: 620px;
    }

    #screen-tour .driver-map.is-collapsed {
        height: 0;
        min-height: 0;
    }

    #screen-tour .stop-list {
        max-height: none;
        overflow-y: visible;
        padding: 0;
    }

    .driver-sheet {
        width: min(calc(100% - 48px), 900px);
        max-height: min(84vh, 820px);
    }

    .sheet-body {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
    }

    .sheet-section:first-child,
    #customerHintSection,
    #recipientSection {
        grid-column: 1 / -1;
    }

    .signature-canvas {
        height: 180px;
    }
}

/* width handled by top section */

/* =========================================================
   Driver — driver-specific surfaces only.
   Topbar, brand, buttons live in _components.css.
   ========================================================= */


.brand-subline {
    color: var(--fg-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.pill,
.driver-tour-select,
.icon-btn,
.eta-box,
.kpi-card,
.section-card,
.stop-card,
.map-wrap,
.quick-btn,
.status-chip,
.btn-ghost,
.btn-save,
.btn-primary,
.input-field,
.item-proof,
.toast {
    border-radius: var(--radius-md);
}

.pill {
    border: 1px solid var(--border);
    font-weight: 650;
}

.pill.online,
.pill.offline,
.pill.outbox {
    border-color: transparent;
}

.driver-tour-select {
    background: var(--bg-sunk);
    border-color: var(--border);
}

.icon-btn:hover,
.icon-btn.is-active {
    background: var(--accent-soft);
    color: var(--accent);
}

.hero,
.tour-head {
    background: var(--bg-elev);
}

.hero-greet,
.tour-head-customer,
.sheet-head-customer,
.pause-card h3 {
    font-family: var(--font-serif);
    font-weight: 600;
    letter-spacing: 0;
}

.hero-greet {
    font-size: 30px;
}

.tour-head-customer {
    font-size: 25px;
}

.tour-head-eyebrow,
.kpi-label,
.sheet-head-num,
.sheet-section h4,
.stop-list-head h3 {
    letter-spacing: .12em;
}

.kpi-card,
.section-card,
.stop-card,
.map-wrap,
.tour-head,
.driver-sheet,
.pause-card {
    background: var(--bg-elev);
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}

.kpi-value {
    color: var(--fg);
    font-weight: 650;
}

.tour-progress {
    background: var(--bg-sunk);
}

.seg-done { background: var(--good); }
.seg-bad { background: var(--bad); }
.seg-now { background: var(--accent); }

.driver-map {
    background: var(--bg-sunk);
}

.map-header {
    background: var(--bg-elev);
    color: var(--fg-muted);
}

.map-header-toggle {
    color: var(--accent);
    border-radius: var(--radius-md);
}

.map-marker {
    border-color: var(--bg-elev);
    background: var(--fg-muted);
}

.map-marker.in_progress {
    background: var(--accent);
}

.map-marker.delivered {
    background: var(--good);
}

.map-marker.problem {
    background: var(--bad);
}

.stop-card {
    border-left: 3px solid transparent;
}

.stop-card.delivered {
    background: var(--good-soft);
    border-left-color: var(--good);
}

.stop-card.problem {
    background: var(--warn-soft);
    border-left-color: var(--warn);
}

.stop-card.in_progress {
    background: var(--accent-soft);
    border-color: var(--accent);
    border-left-color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
}

.stop-card-num {
    background: var(--bg-sunk);
    color: var(--fg-muted);
}

.stop-card.in_progress .stop-card-num {
    background: var(--accent);
    color: var(--accent-fg);
}

.tag {
    border-radius: var(--radius-md);
    font-weight: 650;
}

.tag.good { background: var(--good-soft); color: var(--good); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }

.driver-tabbar {
    background: var(--bg-elev);
    border-top-color: var(--border);
}

.driver-tab.is-active {
    color: var(--accent);
}

.cta-bar {
    position: sticky;
    bottom: calc(var(--tabbar-h) + 12px);
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 12px 12px;
    padding: 12px 14px;
    min-height: 56px;
    border-radius: var(--radius-lg);
    background: var(--accent);
    color: var(--accent-fg);
    box-shadow: var(--shadow-md);
    text-decoration: none;
}

.cta-bar[hidden] {
    display: none;
}

.cta-bar svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.cta-bar-main {
    display: flex;
    flex: 1;
    min-width: 0;
    flex-direction: column;
    gap: 1px;
}

.cta-bar-title {
    font-size: 15px;
    font-weight: 700;
}

.cta-bar-sub {
    overflow: hidden;
    color: rgba(251, 250, 246, .82);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.driver-sheet {
    border: 1px solid var(--border);
    border-bottom: 0;
}

.sheet-grabber {
    background: var(--border-strong);
}

.sheet-section {
    border-bottom-color: var(--border);
}

.quick-btn,
.status-chip,
.btn-ghost,
.input-field,
.item-proof,
.signature-canvas {
    background: var(--bg-sunk);
    border: 1px solid var(--border);
}

.quick-btn {
    color: var(--fg);
}

.quick-btn:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

.status-chip.is-active.good { background: var(--good); color: var(--bg-elev); }
.status-chip.is-active.warn { background: var(--warn); color: var(--bg-elev); }
.status-chip.is-active.bad { background: var(--bad); color: var(--bg-elev); }

.btn-save,
.btn-primary {
    background: var(--accent);
    color: var(--accent-fg);
    box-shadow: var(--shadow-sm);
}

.signature-canvas {
    background: var(--bg-elev);
}

.sheet-scrim,
.pause-scrim {
    background: rgba(31, 35, 48, .48);
}

.customer-photo-grid img {
    border-radius: var(--radius-md);
}

.load-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.brief-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.brief-row:last-child {
    border-bottom: 0;
}

.brief-row span {
    color: var(--fg-muted);
}

.brief-row b {
    color: var(--fg);
}

@media (max-width: 719px) {
    .driver-brand .brand-subline {
        display: none;
    }

    .brand-mark {
        font-size: 22px;
    }

    .driver-topbar {
        padding: 0 10px;
    }

    .driver-tour-select {
        max-width: 142px;
    }
}

@media (min-width: 720px) {
    .driver-app,
    .driver-topbar,
    .driver-tabbar {
        width: min(100%, 1180px);
    }

    .driver-app {
        padding: calc(var(--topbar-h) + 16px) 20px calc(var(--tabbar-h) + 24px);
    }

    .driver-topbar {
        padding: 0 20px;
    }
}

@media (min-width: 960px) {
    /* Volle Breite beibehalten; nur Höhenwerte hier feinjustieren */
    #screen-tour .driver-map {
        max-height: 640px;
    }
}

/* =========================================================
   Unified Mastri Topbar — overrides any earlier width / fixed
   positioning so the driver dashboard matches all other
   dashboards (full-width, sticky to top).
   ========================================================= */
.driver-topbar {
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    transform: none;
    height: 68px;
    padding: 0 18px;
    z-index: 80;
}
@media (max-width: 720px) {
    .driver-topbar { height: 60px; padding: 0 14px; }
}
.driver-brand {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

/* =========================================================
   Erweiterungen: Hotel-Trennzeile, Anruf-Button, Briefing
   ========================================================= */

/* Stop-Card mit Anruf-Knopf rechts neben dem Stopp-Button */
.stop-list .stop-card {
    display: flex;
    align-items: stretch;
    gap: 0;
    overflow: hidden;
}
.stop-list .stop-card .stop-card-row {
    flex: 1;
    text-align: left;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 12px 14px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    min-width: 0;
}
.stop-card-call {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    flex-shrink: 0;
    color: var(--accent);
    border-left: 1px solid var(--border);
    transition: background .15s;
    text-decoration: none;
}
.stop-card-call:hover { background: var(--accent-soft); text-decoration: none; }
.stop-card-call svg { width: 22px; height: 22px; }

/* Hotel-Trennzeile zwischen Tag 1 und Tag 2 */
.hotel-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    margin: 8px 0;
    background: var(--bg-warm);
    border: 1px solid var(--border);
    border-left: 3px solid var(--warn);
    border-radius: var(--radius-md);
}
.hotel-row-icon {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--warn-soft);
    color: var(--warn);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.hotel-row-icon svg { width: 18px; height: 18px; }
.hotel-row-main { flex: 1; min-width: 0; }
.hotel-row-eyebrow {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: var(--warn);
    margin-bottom: 2px;
}
.hotel-row-main b { display: block; font-size: 15px; font-weight: 600; color: var(--fg); }
.hotel-row-main span {
    display: block;
    font-size: 13px;
    color: var(--fg-muted);
    margin-top: 2px;
}

/* Briefing für den nächsten Stopp (Kundenhinweise/Fotos) */
.next-stop-briefing {
    margin-top: 10px;
    padding: 12px 14px;
    background: var(--bg-warm);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}
.briefing-eyebrow {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: var(--accent);
    margin-bottom: 10px;
}
.briefing-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}
@media (min-width: 720px) {
    .briefing-grid { grid-template-columns: 1.4fr 1fr; }
}
.briefing-rows { display: flex; flex-direction: column; gap: 8px; }
.briefing-row {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 10px;
    align-items: baseline;
    font-size: 14px;
    line-height: 1.4;
}
.briefing-row b {
    font-weight: 600;
    color: var(--fg-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.briefing-row span { color: var(--fg); }
.briefing-row.park b { color: var(--warn); }
.briefing-row.alt b { color: var(--accent); }
.briefing-call {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 14px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: var(--accent-fg);
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    align-self: flex-start;
    margin-top: 4px;
}
.briefing-call svg { width: 16px; height: 16px; }
.briefing-call:hover { background: var(--accent-dark); text-decoration: none; }
.briefing-photos {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}
.briefing-photos a {
    display: block;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-sunk);
}
.briefing-photos img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Beladungsschema im Briefing — vertikale Liste statt horizontaler Blöcke.
   Bei vielen Stops sind volumen-proportionale Spalten zu schmal; eine Liste
   ist immer lesbar und entspricht zudem dem üblichen Beladungs-Protokoll
   (Position 1 = vorne am Heck, letzte Position = hinten am Fahrerhaus). */
.briefing-load { display: flex; flex-direction: column; gap: 12px; }
.briefing-load-hint {
    margin: 0;
    font-size: 13px;
    color: var(--fg-muted);
    line-height: 1.5;
}
.briefing-load-hint b { color: var(--fg); font-weight: 600; }
.briefing-load-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-elev);
}
.briefing-load-row {
    display: grid;
    grid-template-columns: 32px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}
.briefing-load-row:last-child { border-bottom: none; }
.briefing-load-row:nth-child(2n) { background: var(--bg-warm); }
.briefing-load-pos {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-fg);
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.briefing-load-main { min-width: 0; }
.briefing-load-line {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
}
.briefing-load-line b {
    font-size: 14px;
    font-weight: 600;
    color: var(--fg);
}
.briefing-load-city {
    font-size: 12px;
    color: var(--fg-muted);
}
.briefing-load-items {
    margin-top: 2px;
    font-size: 12px;
    color: var(--fg-muted);
    line-height: 1.35;
}
.briefing-load-numbers {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}
.briefing-load-vol {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
}
.briefing-load-count {
    font-size: 11px;
    color: var(--fg-muted);
    text-transform: uppercase;
    letter-spacing: .08em;
}
.briefing-load-total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-warm);
    border: 1px solid var(--border);
}
.briefing-load-total span {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: var(--fg-muted);
}
.briefing-load-total b {
    font-size: 14px;
    font-weight: 700;
    color: var(--fg);
    font-variant-numeric: tabular-nums;
}

/* Depot-/Endpunkt-Marker auf der Fahrer-Karte */
.map-depot {
    width: 26px; height: 26px;
    display: grid;
    place-items: center;
    background: var(--brand);
    color: var(--accent-fg);
    border: 2px solid var(--bg-elev);
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(31, 35, 48, .25);
    transform: rotate(45deg);
}
.map-depot svg {
    width: 14px; height: 14px;
    transform: rotate(-45deg);
}

/* =========================================================
   Barrierefreiheit Stopp-Sheet (v10.9.59)
   Optimiert für ältere Fahrer/innen: größere Schrift, große
   Tap-Flächen (≥56–64px), stärkerer Kontrast, farbcodierte
   Status-Aktionen. Scoped auf .driver-sheet — wirkt nur auf
   die Box, die beim Antippen einer Adresse aufgeht.
   ========================================================= */

/* Kopf: Name groß & klar, Adresse gut lesbar */
.driver-sheet .sheet-head { padding: 8px 18px 14px; }
.driver-sheet .sheet-head-num {
    font-size: 13px;
    color: var(--fg-muted);
    letter-spacing: .06em;
}
.driver-sheet .sheet-head-customer {
    font-size: clamp(24px, 6vw, 30px);
    line-height: 1.15;
    margin-top: 4px;
}
.driver-sheet .sheet-head-address {
    font-size: 17px;
    line-height: 1.35;
    color: var(--fg);
    margin-top: 4px;
}

/* Abschnitts-Überschriften: lesbar statt winzig-grau */
.driver-sheet .sheet-section { padding: 16px 18px; }
.driver-sheet .sheet-section h4 {
    font-size: 15px;
    letter-spacing: .02em;
    text-transform: none;
    color: var(--fg-muted);
    margin-bottom: 12px;
    font-weight: 800;
}

/* Schnell-Aktionen (Anrufen / Navigation / …): hohe Tap-Flächen */
.driver-sheet .quick-btn {
    min-height: 60px;
    font-size: 16px;
    border-width: 2px;
    gap: 4px;
}

/* Status-Buttons: das Wichtigste. Groß, fett, farbcodiert. */
.driver-sheet .status-grid { gap: 10px; }
.driver-sheet .status-chip {
    min-height: 64px;
    font-size: 17px;
    border-width: 2px;
    line-height: 1.2;
    padding: 8px 6px;
}
/* Farbliche Vorabkennung schon im inaktiven Zustand (schnelles Erfassen) */
.driver-sheet .status-chip[data-tone="good"] {
    border-color: var(--good);
    color: var(--good);
    background: var(--good-soft);
}
.driver-sheet .status-chip[data-tone="warn"] {
    border-color: var(--warn);
    color: var(--warn);
    background: var(--warn-soft);
}
.driver-sheet .status-chip[data-tone="bad"] {
    border-color: var(--bad);
    color: var(--bad);
    background: var(--bad-soft);
}
/* Aktiver Zustand: voll ausgefüllt, maximaler Kontrast */
.driver-sheet .status-chip.is-active.good { background: var(--good); color: #fff; border-color: var(--good); }
.driver-sheet .status-chip.is-active.warn { background: var(--warn); color: #fff; border-color: var(--warn); }
.driver-sheet .status-chip.is-active.bad  { background: var(--bad);  color: #fff; border-color: var(--bad); }

/* Instrumente: größere Checkboxen + lesbarer Text */
.driver-sheet .item-proof {
    grid-template-columns: 32px 1fr;
    gap: 12px;
    padding: 14px;
    border-width: 2px;
}
.driver-sheet .item-proof input[type="checkbox"] {
    width: 30px;
    height: 30px;
}
.driver-sheet .item-proof-main b { font-size: 16px; line-height: 1.3; }
.driver-sheet .item-proof-main span { font-size: 14px; }

/* Eingaben: 16px (verhindert iOS-Zoom + besser lesbar), mehr Höhe */
.driver-sheet .input-field {
    font-size: 16px;
    padding: 14px 14px;
    border-width: 2px;
}
.driver-sheet textarea.input-field { min-height: 96px; line-height: 1.4; }
.driver-sheet .signature-canvas { height: 180px; border-width: 2px; }
.driver-sheet .btn-ghost.small {
    min-height: 48px;
    font-size: 14px;
    padding: 0 16px;
}

/* Kundenhinweise lesbarer */
.driver-sheet .customer-hints { font-size: 15px; line-height: 1.45; }

/* Fußzeile: große Buttons, „Speichern" klar dominant */
.driver-sheet .sheet-foot { padding: 14px 16px; gap: 10px; }
.driver-sheet .sheet-foot .btn-ghost,
.driver-sheet .sheet-foot .btn-save {
    min-height: 62px;
    font-size: 18px;
    border-radius: 14px;
}
.driver-sheet .sheet-foot .btn-save { border: 2px solid var(--accent-dark); }

/* Größerer Greifbereich oben zum Schließen */
.driver-sheet .sheet-grabber {
    width: 52px;
    height: 6px;
    margin: 10px auto 4px;
}

/* =========================================================
   Kundenangaben im Stopp-Sheet: Mini-Karte (Haus/Park),
   Notiz-Box, prominente Fotos (v10.9.63)
   ========================================================= */
.hint-map {
    width: 100%;
    height: 180px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 6px;
    background: var(--bg-sunk);
    isolation: isolate;       /* Leaflet-Panes innerhalb der Karte halten */
}
.hint-map .leaflet-container { font: inherit; background: var(--bg-sunk); }
.hint-pin {
    width: 22px; height: 22px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(15,23,42,.35);
}
.hint-pin.house { background: var(--accent); }
.hint-pin.park  { background: var(--pin-park, #8a5a1d); }
.hint-map-legend {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--fg-muted);
    margin-bottom: 12px;
}
.hint-map-legend i {
    display: inline-block;
    width: 11px; height: 11px;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: -1px;
}
.hint-dot.house { background: var(--accent); }
.hint-dot.park  { background: var(--pin-park, #8a5a1d); }

.customer-note-box {
    display: grid;
    gap: 3px;
    padding: 12px 14px;
    margin-bottom: 12px;
    border: 1px solid var(--accent);
    border-left-width: 4px;
    border-radius: var(--radius-md);
    background: var(--accent-soft);
}
.customer-note-box b { font-size: 12px; color: var(--accent-dark); text-transform: uppercase; letter-spacing: .04em; }
.customer-note-box span { font-size: 16px; line-height: 1.4; color: var(--fg); }

.customer-photo-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--fg-muted);
    margin: 10px 0 6px;
}
/* Fotos im Sheet größer/besser sichtbar für ältere Augen */
.driver-sheet .customer-photo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.driver-sheet .customer-photo-grid img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}
