*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f4; color: #1c1c1a; line-height: 1.5;
    min-height: 100vh;
}

/* Header */
.header {
    background: #fff; border-bottom: 1px solid #e5e5e3;
    padding: 10px 20px; display: flex; justify-content: space-between; align-items: center;
    position: sticky; top: 0; z-index: 200;
}
.header-left { display: flex; align-items: center; gap: 8px; }
.header-left svg { color: #6b6b67; }
.header h1 { font-size: 16px; font-weight: 600; }
.header-badge { font-size: 10px; padding: 2px 8px; border-radius: 10px; background: #fef3c7; color: #92400e; }
.header-badge.ok { background: #d1fae5; color: #065f46; }
.header-badge.err { background: #fee2e2; color: #991b1b; }
.header-time { font-size: 11px; color: #6b6b67; }

/* Tabs */
.tabs { display: flex; background: #fff; padding: 0 20px; border-bottom: 1px solid #e5e5e3; }
.tab {
    background: none; border: none; padding: 8px 16px; font-size: 12px;
    color: #6b6b67; cursor: pointer; border-bottom: 2px solid transparent; font-family: inherit;
}
.tab:hover { color: #1c1c1a; }
.tab.active { color: #1c1c1a; border-bottom-color: #6d28d9; font-weight: 500; }

/* Panels */
.panel { display: none; padding: 12px 16px; }
.panel.active { display: block; }

/* Planning Bar */
.planning-bar {
    background: #fff; border: 1px solid #e5e5e3; border-radius: 8px;
    padding: 10px 14px; margin-bottom: 10px;
}
.pb-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 8px; }
.pb-row:last-child { margin-bottom: 0; }
.pb-field { display: flex; flex-direction: column; gap: 3px; min-width: 120px; flex: 1; }
.pb-field-wide { flex: 2; min-width: 220px; }
.pb-field label { font-size: 10px; color: #6b6b67; font-weight: 500; text-transform: uppercase; letter-spacing: .3px; }

.slider-with-value { display: flex; align-items: center; gap: 6px; }
.slider-with-value input[type="range"] { flex: 1; }
.slider-with-value input[type="number"] { width: 50px; padding: 4px 6px; font-size: 12px; border: 1px solid #d4d4d0; border-radius: 4px; }
.slider-val { font-size: 12px; font-weight: 600; min-width: 28px; }
.slider-unit { font-size: 11px; color: #6b6b67; }

.btn-toggle { display: flex; border: 1px solid #d4d4d0; border-radius: 5px; overflow: hidden; }
.btn-toggle button {
    padding: 5px 12px; background: #fff; border: none; border-right: 1px solid #d4d4d0;
    font-size: 11px; cursor: pointer; font-family: inherit; color: #6b6b67;
}
.btn-toggle button:last-child { border-right: none; }
.btn-toggle button.active { background: #1c1c1a; color: #fff; }
.direction-toggle button { padding: 5px 8px; font-size: 10px; }

/* Vehicle Chips */
.vehicle-chips { display: flex; gap: 5px; flex-wrap: wrap; }
.vehicle-chip {
    padding: 5px 10px; border: 1px solid #d4d4d0; border-radius: 14px;
    background: #fff; cursor: pointer; font-size: 11px; transition: all .15s;
    display: flex; align-items: center; gap: 4px;
}
.vehicle-chip:hover { border-color: #a5a5a0; }
.vehicle-chip.active { background: #6d28d9; color: #fff; border-color: #6d28d9; }
.vehicle-chip-location { font-size: 9px; opacity: .7; }

/* ═══ Varianten (kompakt, über der Karte) ═══ */
.variants-header-inline { margin-bottom: 8px; font-size: 11px; color: #6b6b67; display: flex; justify-content: space-between; }
.variants-grid { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; }
.variant-card {
    background: #fff; border: 2px solid #e5e5e3; border-radius: 8px;
    padding: 10px; cursor: pointer; transition: all .15s; position: relative;
    min-width: 200px; flex: 0 0 auto;
}
.variant-card:hover { border-color: #a5a5a0; box-shadow: 0 2px 6px rgba(0,0,0,.06); }
.variant-card.selected { border-color: #6d28d9; }
.variant-card.best { border-color: #059669; background: #f0fdf4; }
.variant-card.best.selected { border-color: #047857; }

.variant-letter {
    position: absolute; top: 8px; right: 8px;
    width: 24px; height: 24px; border-radius: 50%;
    background: #6d28d9; color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 11px;
}
.variant-card.best .variant-letter { background: #059669; }
.variant-best-badge {
    position: absolute; top: -7px; left: 8px;
    background: #059669; color: #fff; font-size: 8px;
    padding: 1px 6px; border-radius: 8px; font-weight: 500;
    text-transform: uppercase; letter-spacing: .4px;
}
.variant-strategy-sm { font-size: 9px; color: #6b6b67; text-transform: uppercase; letter-spacing: .3px; padding-right: 28px; }
.variant-title-sm { font-size: 13px; font-weight: 600; margin: 2px 0; padding-right: 28px; }

.variant-util-bar { height: 4px; background: #e5e5e3; border-radius: 2px; overflow: hidden; margin: 6px 0 4px; }
.variant-util-fill { height: 100%; border-radius: 2px; }

.variant-metrics-row { display: flex; gap: 4px; font-size: 10px; color: #1c1c1a; }
.variant-metrics-row > div { flex: 1; text-align: center; }
.variant-metrics-row b { font-size: 12px; display: block; }
.variant-metrics-row span { color: #6b6b67; font-size: 9px; }

/* ═══ Fullscreen Map ═══ */
.map-fullscreen-wrap {
    position: relative; border-radius: 8px; overflow: hidden;
    border: 1px solid #e5e5e3;
}
.map-fullscreen {
    width: 100%; height: calc(100vh - 260px); min-height: 400px;
}
.map-sidebar {
    position: absolute; top: 10px; right: 10px; z-index: 150;
    width: 300px; max-height: calc(100% - 20px); overflow-y: auto;
    background: rgba(255,255,255,.96); border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,.12); font-size: 12px;
}
.sidebar-hint { padding: 14px; color: #6b6b67; text-align: center; font-size: 11px; }

.map-legend {
    position: absolute; bottom: 30px; left: 10px; z-index: 150;
    background: rgba(255,255,255,.92); padding: 6px 10px; border-radius: 6px;
    display: flex; gap: 10px; font-size: 10px; color: #6b6b67;
    box-shadow: 0 1px 4px rgba(0,0,0,.1);
}
.map-legend span { display: flex; align-items: center; gap: 4px; }
.map-legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

.map-pool-info {
    position: absolute; top: 10px; left: 10px; z-index: 150;
    background: rgba(255,255,255,.92); padding: 8px 12px; border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,.1); font-size: 11px;
}

/* Sidebar Tour Details */
.sb-tour { padding: 10px 12px; border-bottom: 1px solid #f0f0ee; }
.sb-tour:last-child { border: none; }
.sb-tour-name { font-weight: 500; font-size: 12px; }
.sb-tour-meta { font-size: 10px; color: #6b6b67; margin-top: 2px; }
.sb-stops { list-style: none; margin-top: 6px; }
.sb-stops li { padding: 3px 0; display: flex; gap: 5px; align-items: center; font-size: 11px; }
.stop-num {
    width: 16px; height: 16px; border-radius: 50%; background: #f5f5f4;
    display: flex; align-items: center; justify-content: center;
    font-size: 8px; font-weight: 600; flex-shrink: 0;
}
.stop-num.fix { background: #dc2626; color: #fff; }

/* ═══ Standard Elements ═══ */
.card { background: #fff; border: 1px solid #e5e5e3; border-radius: 8px; padding: 12px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.card-header h3 { font-size: 13px; font-weight: 500; }
.text-muted { color: #6b6b67; }
.text-sm { font-size: 11px; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 6px; margin-bottom: 12px; }
.metric { background: #fff; border-radius: 6px; padding: 8px 10px; border: 1px solid #e5e5e3; }
.metric-label { font-size: 10px; color: #6b6b67; }
.metric-value { font-size: 18px; font-weight: 600; }
.metric-value.green { color: #059669; }
.metric-value.red { color: #dc2626; }
.metric-value.blue { color: #2563eb; }

.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 11px; }
.tbl th { text-align: left; font-weight: 500; padding: 6px; border-bottom: 1px solid #e5e5e3; color: #6b6b67; font-size: 10px; }
.tbl td { padding: 5px 6px; border-bottom: 1px solid #f0f0ee; }
.tbl tr:hover { background: #fafaf9; }

.pill { font-size: 9px; padding: 2px 6px; border-radius: 5px; font-weight: 500; display: inline-block; }
.pill-l { background: #ede9fe; color: #5b21b6; }
.pill-m { background: #fff7ed; color: #c2410c; }
.pill-fix { background: #dc2626; color: #fff; }
.pill-dn { background: #d1fae5; color: #065f46; }
.pill-so { background: #dbeafe; color: #1e40af; }
.pill-manual { background: #fce7f3; color: #9f1239; }
.pill-1d { background: #dbeafe; color: #1e40af; }
.pill-2d { background: #fef3c7; color: #92400e; }
.pill-ok { background: #d1fae5; color: #065f46; }
.pill-no { background: #fee2e2; color: #991b1b; }
.pill-draft { background: #fef3c7; color: #92400e; }

.manual-stop-form { padding: 4px 0; }
.form-row { display: flex; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.form-group { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 110px; }
.form-group label { font-size: 10px; color: #6b6b67; font-weight: 500; text-transform: uppercase; }
.form-group input, .form-group select { padding: 6px 8px; border: 1px solid #d4d4d0; border-radius: 5px; font-size: 12px; font-family: inherit; }

.stop-filter { display: flex; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.stop-filter label { display: flex; align-items: center; gap: 4px; font-size: 11px; cursor: pointer; }

.dt-card { background: #fff; border: 1px solid #e5e5e3; border-radius: 8px; padding: 14px; margin-bottom: 10px; }
.dt-head { display: flex; justify-content: space-between; margin-bottom: 10px; }
.dt-stops { list-style: none; }
.dt-stops li { display: grid; grid-template-columns: 28px 1fr 70px 50px 70px; gap: 6px; padding: 6px 0; border-bottom: 1px solid #f0f0ee; font-size: 11px; align-items: center; }
.num-circle { width: 22px; height: 22px; border-radius: 50%; background: #f5f5f4; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; }
.num-circle.fix { background: #dc2626; color: #fff; }

.btn { padding: 5px 12px; border: 1px solid #d4d4d0; border-radius: 5px; background: #fff; font-size: 11px; cursor: pointer; font-family: inherit; transition: all .12s; }
.btn:hover { background: #f5f5f4; }
.btn-sm { padding: 3px 8px; font-size: 10px; }
.btn-lg { padding: 8px 18px; font-size: 13px; font-weight: 500; }
.btn-primary { background: #6d28d9; color: #fff; border-color: #6d28d9; }
.btn-primary:hover { background: #5b21b6; }
.btn-success { background: #059669; color: #fff; border-color: #059669; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Leaflet Popup Override */
.pin-popup { font-size: 12px; line-height: 1.5; min-width: 180px; }
.pin-popup b { font-size: 13px; }
.pin-popup .pin-phone { color: #2563eb; }
.pin-popup .pin-actions { margin-top: 6px; display: flex; gap: 4px; }

@media (max-width: 900px) {
    .map-sidebar { width: 240px; }
    .variants-grid { flex-wrap: wrap; }
    .variant-card { min-width: 160px; }
}

/* Fix: Sidebar über Leaflet-Karte */
.map-sidebar { z-index: 1000 !important; }
.map-legend { z-index: 1000 !important; }
.map-pool-info { z-index: 1000 !important; }
.leaflet-top, .leaflet-bottom { z-index: 999 !important; }

/* Vehicle Chip Endpoint Menu */
.vchip-wrap { position: relative; display: inline-flex; flex-direction: column; align-items: flex-start; }
.vchip-endpoint {
    font-size: 9px; color: #6b6b67; cursor: pointer; padding: 1px 10px;
    margin-top: -2px; background: #fafaf9; border-radius: 0 0 10px 10px;
    border: 1px solid #e5e5e3; border-top: none;
    transition: background .1s;
}
.vchip-endpoint:hover { background: #f0f0ee; color: #1c1c1a; }
.vchip-menu {
    position: absolute; top: 100%; left: 0; z-index: 500;
    background: #fff; border: 1px solid #d4d4d0; border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,.12); min-width: 200px;
    margin-top: 4px; overflow: hidden;
}
.vchip-menu-title {
    font-size: 10px; color: #6b6b67; padding: 8px 12px 4px;
    text-transform: uppercase; letter-spacing: .3px; font-weight: 500;
}
.vchip-menu-item {
    padding: 8px 12px; cursor: pointer; font-size: 12px;
    border-bottom: 1px solid #f5f5f4; transition: background .1s;
}
.vchip-menu-item:last-child { border: none; }
.vchip-menu-item:hover { background: #f5f5f4; }
.vchip-menu-item.sel { background: #ede9fe; color: #5b21b6; }
.vchip-menu-item span {
    display: block; font-size: 10px; color: #6b6b67; margin-top: 1px;
}
.vchip-menu-item.sel span { color: #7c3aed; }

/* v7: Variant Category Labels */
.variant-category-label {
    font-size: 10px; color: #6b6b67; text-transform: uppercase;
    letter-spacing: .4px; font-weight: 500; padding: 4px 2px;
    flex: 0 0 100%; margin-top: 4px;
}
.variant-category-label:first-child { margin-top: 0; }

/* v7: Fix sidebar/legend z-index */
.map-sidebar { z-index: 1000 !important; }
.map-legend { z-index: 1000 !important; }
.map-pool-info { z-index: 1000 !important; }
.leaflet-top, .leaflet-bottom { z-index: 999 !important; }

/* v7: Variant grid wraps with category labels */
.variants-grid { flex-wrap: wrap; }

/* v8: Nearby Panel (links auf der Karte) */
.nearby-panel {
    position: absolute; top: 10px; left: 10px; z-index: 1000;
    width: 260px; max-height: calc(100% - 60px); overflow-y: auto;
    background: rgba(255,255,255,.96); border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,.12);
}
.nearby-title {
    padding: 10px 12px; font-size: 13px; font-weight: 600;
    border-bottom: 1px solid #e5e5e3; position: sticky; top: 0;
    background: rgba(255,255,255,.98); border-radius: 8px 8px 0 0;
}
.nearby-item {
    padding: 8px 12px; border-bottom: 1px solid #f0f0ee; font-size: 11px;
}
.nearby-item:last-child { border: none; }
.nearby-item.on-route { background: #fef2f2; }
.nearby-header { font-size: 12px; margin-bottom: 2px; }
.nearby-detail { color: #6b6b67; margin-bottom: 2px; }

/* v8: Fix z-index */
.map-sidebar { z-index: 1000 !important; }
.map-legend { z-index: 1000 !important; }
.map-pool-info { z-index: 1000 !important; }
.leaflet-top, .leaflet-bottom { z-index: 999 !important; }

/* v8: Category labels */
.variant-category-label {
    font-size: 10px; color: #6b6b67; text-transform: uppercase;
    letter-spacing: .4px; font-weight: 500; padding: 4px 2px;
    flex: 0 0 100%; margin-top: 4px;
}
.variant-category-label:first-child { margin-top: 0; }
.variants-grid { flex-wrap: wrap; }

/* v8: Pin popup */
.pin-popup { font-size: 12px; line-height: 1.5; min-width: 180px; }
.pin-popup b { font-size: 13px; }
.pin-actions { margin-top: 6px; display: flex; gap: 4px; }

/* v9: Nearby Cards */
.nearby-card {
    padding: 10px 12px; border-bottom: 1px solid #f0f0ee;
    cursor: default; transition: background .1s;
}
.nearby-card:hover { background: #fef3c7; }
.nearby-card:last-child { border: none; }
.nearby-card.on-route { border-left: 3px solid #ea580c; }
.nearby-header { font-size: 11px; margin-bottom: 2px; }
.nearby-city { font-size: 13px; font-weight: 600; }
.nearby-detail { font-size: 11px; color: #6b6b67; margin-top: 2px; }

/* ═══════════════ VARIANTEN-Δ (ggü. Basis A) ═══════════════ */
.variant-delta {
    font-size: 10px;
    color: #6b6b67;
    margin: 4px 0 6px;
    padding: 3px 6px;
    background: #f5f5f4;
    border-radius: 4px;
    border-left: 2px solid #d1d5db;
}
.variant-delta-base {
    background: transparent;
    color: #9ca3af;
    border-left-color: transparent;
    font-style: italic;
    padding-left: 0;
}

/* ═══════════════ WHAT-IF MODAL ═══════════════ */
.wi-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}
.wi-modal-inner {
    background: #fff;
    border-radius: 10px;
    width: 100%;
    max-width: 780px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}
.wi-modal-head {
    padding: 14px 18px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    background: linear-gradient(180deg, #fafafa 0%, #fff 100%);
}
.wi-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
}
.wi-modal-sub {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}
.wi-modal-close {
    background: transparent;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    padding: 0 6px;
    line-height: 1;
    border-radius: 4px;
}
.wi-modal-close:hover {
    background: #f3f4f6;
    color: #111827;
}
.wi-modal-body {
    padding: 14px 18px;
    overflow-y: auto;
    flex: 1;
}

/* Abschnitte im Modal */
.wi-summary {
    padding: 10px 12px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    margin-bottom: 14px;
    font-size: 13px;
    color: #1e3a8a;
}
.wi-summary-meta {
    font-size: 11px;
    color: #475569;
    margin-top: 3px;
}
.wi-section {
    margin-bottom: 14px;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fafafa;
}
.wi-section.wi-disabled {
    opacity: 0.45;
    pointer-events: none;
}
.wi-section.wi-result {
    background: #f0fdf4;
    border-color: #86efac;
}
.wi-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #374151;
    margin-bottom: 8px;
}
.wi-hint {
    font-size: 11px;
    color: #6b7280;
    margin: 4px 0;
}
.wi-warn {
    font-size: 12px;
    color: #b91c1c;
    background: #fef2f2;
    border: 1px solid #fecaca;
    padding: 6px 8px;
    border-radius: 4px;
    margin-top: 6px;
}

/* Eingabezeilen */
.wi-input-row {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}
.wi-input-row input[type="text"] {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
}
.wi-input-row input[type="text"]:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
.wi-input-row input[type="text"]:disabled {
    background: #f3f4f6;
    color: #9ca3af;
}

/* Ausgewählter Ort (Pill) */
.wi-pill-sel {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #dbeafe;
    border: 1px solid #93c5fd;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: #1e3a8a;
}
.wi-pill-meta {
    font-size: 10px;
    color: #64748b;
    font-weight: 400;
    margin-left: 4px;
}
.wi-pill-clear {
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 16px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
}
.wi-pill-clear:hover { color: #dc2626; }

/* Geocode-Ergebnisse */
.wi-geocode-results {
    margin-top: 4px;
    max-height: 160px;
    overflow-y: auto;
}
.wi-geo-hit {
    padding: 6px 8px;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
}
.wi-geo-hit:hover {
    background: #eff6ff;
}
.wi-geo-hit b {
    display: block;
    color: #111827;
    font-weight: 600;
}
.wi-geo-sub {
    font-size: 10px;
    color: #6b7280;
    margin-top: 1px;
}

/* Endpunkt-Optionen */
.wi-endpoint-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.wi-eopt {
    text-align: left;
    padding: 7px 10px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    color: #374151;
}
.wi-eopt:hover {
    background: #f9fafb;
    border-color: #2563eb;
    color: #2563eb;
}

/* Aktions-Zeile */
.wi-actions-row {
    display: flex;
    gap: 6px;
    margin: 6px 0;
}

/* Tag-2-Kandidaten */
.wi-candidates {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 2px;
    margin-top: 6px;
}
.wi-cand {
    display: flex;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 5px;
    cursor: pointer;
    background: #fff;
    transition: all 0.15s;
}
.wi-cand:hover {
    border-color: #93c5fd;
    background: #f9fafb;
}
.wi-cand.rec {
    border-left: 3px solid #f59e0b;
}
.wi-cand.sel {
    background: #ecfdf5;
    border-color: #86efac;
    border-left: 3px solid #059669;
}
.wi-cand input[type="checkbox"] {
    margin-top: 3px;
    cursor: pointer;
}
.wi-cand-main { flex: 1; min-width: 0; }
.wi-cand-head {
    font-size: 12px;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}
.wi-cand-sub {
    font-size: 11px;
    color: #6b7280;
    margin-top: 2px;
}
.wi-cand-geo {
    font-size: 10px;
    color: #64748b;
    margin-top: 3px;
    font-family: ui-monospace, monospace;
}
.wi-rec {
    font-size: 10px;
    color: #b45309;
    background: #fef3c7;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 600;
}

/* Ergebnis-Karten */
.wi-result-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}
.wi-result-grid > div {
    background: #fff;
    border: 1px solid #d1fae5;
    border-radius: 5px;
    padding: 6px 8px;
    text-align: center;
}
.wi-result-grid b {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: #065f46;
}
.wi-result-grid span {
    font-size: 10px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.wi-result-days {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: #065f46;
    padding-top: 6px;
    border-top: 1px dashed #a7f3d0;
}

/* Modal-Fußzeile */
.wi-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid #e5e7eb;
    margin-top: 10px;
}
.wi-actions .btn[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Pill-Farben für Kandidaten-Klassen (Fallback falls nicht schon vorhanden) */
.pill-fix { background: #fee2e2; color: #991b1b; }
.pill-l { background: #d1fae5; color: #065f46; }
.pill-m { background: #ffedd5; color: #9a3412; }
.pill-so { background: #dbeafe; color: #1e3a8a; }
.pill-manual { background: #ede9fe; color: #5b21b6; }

@media (max-width: 640px) {
    .wi-result-grid { grid-template-columns: repeat(2, 1fr); }
    .wi-modal { padding: 0; }
    .wi-modal-inner { max-height: 100vh; border-radius: 0; }
}

/* ═══════════════ ON-ROUTE-BADGE (v9.1) ═══════════════ */
.sb-onroute {
    display: inline-block;
    font-size: 9px;
    font-weight: 600;
    color: #0e7490;
    background: #cffafe;
    border: 1px solid #67e8f9;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 4px;
    letter-spacing: 0.2px;
}

/* ═══════════════ CLUSTER-BADGE + EDITED (v9.2) ═══════════════ */
.sb-cluster {
    display: inline-block;
    font-size: 9px;
    font-weight: 600;
    color: #6d28d9;
    background: #ede9fe;
    border: 1px solid #c4b5fd;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 4px;
    letter-spacing: 0.2px;
}
.variant-edited {
    display: inline-block;
    font-size: 13px;
    color: #f59e0b;
    margin-left: 4px;
    vertical-align: middle;
    cursor: help;
}

/* ═══════════════ v10: FOKUS-MODUS + STADT-LABEL ═══════════════ */

/* Card-Erweiterung: Stadt-Titel, Letter-Badge klein */
.variant-letter-sm {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 22px;
    height: 22px;
    border-radius: 11px;
    background: #6b6b67;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.variant-card.best .variant-letter-sm {
    background: #059669;
}
.variant-city-title {
    font-weight: 600;
    font-size: 13px;
    color: #111;
    margin-bottom: 4px;
    padding-right: 30px;  /* Platz für Letter-Badge */
    letter-spacing: 0.2px;
}
.variant-dir-sm {
    color: #9ca3af;
    font-size: 10px;
    margin-left: 4px;
}
.variant-focus-btn {
    background: transparent;
    border: 1px solid #d1d5db;
    color: #6d28d9;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.variant-focus-btn:hover {
    background: #6d28d9;
    color: #fff;
    border-color: #6d28d9;
}
.variant-footer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

/* Faded + Focused States */
.variant-card.faded {
    opacity: 0.25;
    pointer-events: none;
    transform: scale(0.96);
    transition: opacity 250ms ease, transform 250ms ease;
}
.variant-card.focused {
    box-shadow: 0 4px 12px rgba(109, 40, 217, 0.2);
    border-color: #6d28d9;
    transition: box-shadow 250ms ease, border-color 250ms ease;
}

/* Fokus-Panel (volle Breite, taucht unter dem Varianten-Grid auf) */
#variantsFocusPanel {
    margin-top: 12px;
    animation: focusSlideIn 300ms ease;
}
@keyframes focusSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.focus-panel-inner {
    background: #fff;
    border: 1px solid #6d28d9;
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(109, 40, 217, 0.12);
    padding: 16px 20px;
}
.focus-panel-head {
    display: flex;
    align-items: center;
    gap: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid #ede9fe;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.focus-panel-title-col {
    flex: 1;
    min-width: 200px;
}
.focus-panel-city {
    font-size: 18px;
    font-weight: 700;
    color: #111;
}
.focus-panel-sub {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 2px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}
.focus-panel-metrics {
    display: flex;
    gap: 18px;
}
.focus-panel-metrics > div {
    text-align: center;
}
.focus-panel-metrics b {
    display: block;
    font-size: 18px;
    color: #111;
    font-weight: 700;
}
.focus-panel-metrics span {
    display: block;
    font-size: 10px;
    color: #6b6b67;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 1px;
}
.focus-panel-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* Chips-Bereich */
.focus-panel-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.focus-chip {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 8px 12px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.15s, box-shadow 0.15s;
    text-align: left;
    min-width: 140px;
}
.focus-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,.08);
}
.focus-chip .chip-label {
    font-size: 12px;
    font-weight: 600;
}
.focus-chip .chip-detail {
    font-size: 10px;
    opacity: 0.85;
    margin-top: 2px;
}
.focus-chip-time {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}
.focus-chip-time:hover {
    background: #d1fae5;
}
.focus-chip-reduce {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}
.focus-chip-reduce:hover {
    background: #fee2e2;
}
.focus-chip-overnight {
    background: #f5f3ff;
    color: #6d28d9;
    border: 1px solid #ddd6fe;
}
.focus-chip-loading {
    background: #f9fafb;
    color: #6b6b67;
    border: 1px dashed #e5e5e3;
    font-size: 12px;
    cursor: default;
}
.focus-chip-none {
    color: #9ca3af;
    font-size: 12px;
    padding: 10px 4px;
}

/* Shake-Animation beim Chip-Klick */
.focus-shake {
    animation: focusShake 380ms cubic-bezier(.36,.07,.19,.97) both;
}
@keyframes focusShake {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-3px); }
    40%, 60% { transform: translateX(3px); }
}

/* Δ-Zeile aus v9 komplett verstecken (bei Richtungsvarianten sinnlos) */
.variant-delta, .variant-delta-base {
    display: none !important;
}

/* ═══════════════ v10.1: Fokus-UX + Gantt-Chart ═══════════════ */

/* Back-Button oben links im Panel */
.focus-back-btn {
    background: transparent;
    border: 1px solid #d1d5db;
    color: #6b6b67;
    width: 32px;
    height: 32px;
    border-radius: 16px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}
.focus-back-btn:hover {
    background: #f3f4f6;
    color: #111;
    border-color: #6d28d9;
}

/* Chip-Type-Hints stärker ausdifferenziert */
.focus-chip-overnight {
    background: #f5f3ff;
    color: #5b21b6;
    border: 1px solid #ddd6fe;
}
.focus-chip-overnight:hover {
    background: #ede9fe;
}

/* Chart-Bereich */
.focus-panel-chart-title {
    font-size: 10px;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 18px;
    margin-bottom: 6px;
}
.focus-panel-chart {
    background: #fff;
    max-height: 220px;
    overflow: hidden;
}
.util-chart-svg {
    width: 100%;
    max-width: 900px;
    max-height: 220px;
    height: auto;
    display: block;
    margin: 0 auto;
}
.chart-empty {
    padding: 40px;
    text-align: center;
    color: #9ca3af;
    font-size: 12px;
}

/* Fokus-Card-Wiedereinblendung: Grid kommt zurück wenn unfocus */
#variantsGrid { transition: opacity 200ms; }

/* ═══════════════ v10.3: Auslastungs-Diagramm Legende ═══════════════ */
.util-chart-legend {
    display: flex;
    gap: 20px;
    justify-content: center;
    font-size: 11px;
    color: #6b7280;
    margin-top: 8px;
    padding: 8px;
    border-top: 1px solid #f3f4f6;
}
.util-chart-legend .legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.util-chart-legend .legend-arrow {
    display: inline-block;
    width: 16px;
    height: 16px;
    text-align: center;
    font-weight: 700;
    border-radius: 50%;
    color: #fff;
    font-size: 11px;
    line-height: 16px;
}
.util-chart-legend .legend-down { background: #dc2626; }
.util-chart-legend .legend-up { background: #059669; }

/* ═══════════════ v10.4: Kompaktes Fokus-Panel ═══════════════ */

.focus-panel-compact {
    background: #fff;
    border: 1px solid #6d28d9;
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(109, 40, 217, 0.08);
    overflow: hidden;
}

.focus-head {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 14px;
    border-bottom: 1px solid #ede9fe;
}

.focus-title-col {
    flex: 1;
    min-width: 180px;
}
.focus-city {
    font-size: 15px;
    font-weight: 600;
    color: #111;
    line-height: 1.2;
}
.focus-sub {
    font-size: 10px;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-top: 2px;
}

.focus-metrics {
    display: flex;
    gap: 16px;
    flex-shrink: 0;
}
.focus-metrics > div {
    text-align: center;
    min-width: 44px;
}
.focus-metrics b {
    display: block;
    font-size: 15px;
    color: #111;
    font-weight: 700;
    line-height: 1.1;
}
.focus-metrics span {
    display: block;
    font-size: 9px;
    color: #6b6b67;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 1px;
}

.focus-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.focus-chips-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 14px;
    align-items: center;
    min-height: 36px;
}
.focus-chips-row .focus-chip {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid;
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.2;
    transition: transform 0.1s, box-shadow 0.1s;
    white-space: nowrap;
}
.focus-chips-row .focus-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,.08);
}
.focus-chip-time {
    background: #ecfdf5;
    color: #047857;
    border-color: #a7f3d0;
}
.focus-chip-overnight {
    background: #f5f3ff;
    color: #5b21b6;
    border-color: #ddd6fe;
}
.focus-chip-overnight-b {
    background: #ede9fe;
    color: #4c1d95;
    border-color: #c4b5fd;
    border-left: 3px solid #7c3aed;
}
.focus-chip-overnight-b::before {
    content: "⏱ ";
    font-weight: 700;
}
.focus-chip-reduce {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
}
.focus-chip-loading, .focus-chip-loading-small {
    color: #9ca3af;
    font-size: 11px;
    font-style: italic;
}
.focus-chip-none {
    color: #9ca3af;
    font-size: 11px;
    font-style: italic;
}

/* 30px-Auslastungs-Streifen */
.focus-util-strip {
    position: relative;
    padding: 2px 14px 4px;
    background: #fafafa;
    border-top: 1px solid #f3f4f6;
}
