/* UHarvest Route Planner — shared design system (index, admin, clusters) */
/* ─────────────────────────────────────────────────────────────
   Design tokens
───────────────────────────────────────────────────────────── */
:root {
    --bg: #0f1117;
    --bg-elev: #161a23;
    --bg-panel: #1a1f2b;
    --bg-inset: #11141c;
    --bg-hover: #222838;
    --border: #2b3242;
    --border-strong: #3b4357;

    --text: #eef1f6;
    --text-2: #b7bfcd;
    --text-3: #8a93a5;

    --primary: #6366f1;
    --primary-hover: #7679f4;
    --primary-soft: rgba(99, 102, 241, 0.16);
    --accent: #22d3ee;

    --success: #34d399;
    --success-bg: rgba(52, 211, 153, 0.14);
    --warning: #fbbf24;
    --warning-bg: rgba(251, 191, 36, 0.14);
    --error: #f87171;
    --error-bg: rgba(248, 113, 113, 0.14);
    --info: #60a5fa;
    --info-bg: rgba(96, 165, 250, 0.14);

    --horeca: #fb923c;
    --horeca-bg: rgba(251, 146, 60, 0.16);
    --gt: #22d3ee;
    --gt-bg: rgba(34, 211, 238, 0.14);

    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 24px;
    --sp-6: 32px;
    --sp-7: 48px;

    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 14px;
    --r-full: 999px;

    --fs-xs: 0.75rem;
    --fs-sm: 0.8125rem;
    --fs-md: 0.9375rem;
    --fs-lg: 1.125rem;
    --fs-xl: 1.5rem;
    --fs-2xl: 2rem;
    --fw-regular: 400;
    --fw-semibold: 600;

    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.45);
    --shadow-2: 0 10px 28px rgba(0, 0, 0, 0.5);
    --focus-ring: 0 0 0 3px rgba(99, 102, 241, 0.6);

    --header-h: 60px;
    --sidebar-w: 400px;
}

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

html { font-size: 16px; }
body {
    font-family: 'Outfit', system-ui, -apple-system, sans-serif;
    font-weight: var(--fw-regular);
    font-size: var(--fs-md);
    line-height: 1.5;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
strong, b { font-weight: var(--fw-semibold); }
h1, h2, h3, h4 { font-weight: var(--fw-semibold); line-height: 1.25; color: var(--text); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85em; background: var(--bg-inset); padding: 1px 5px; border-radius: 4px; }
.num, .tabular { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }
.muted { color: var(--text-3); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--r-sm); }
.leaflet-container :focus-visible { box-shadow: none; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
    .spinner { animation: spin 1.5s linear infinite !important; animation-iteration-count: infinite !important; }
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--r-full); border: 2px solid var(--bg-panel); }

/* ─────────────────────────────────────────────────────────────
   Header
───────────────────────────────────────────────────────────── */
.app-header {
    height: var(--header-h);
    position: sticky; top: 0; z-index: 100;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--sp-4); padding: 0 var(--sp-5);
}
.brand { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, var(--primary), var(--accent)); flex-shrink: 0; display: grid; place-items: center; }
.brand-name { font-weight: var(--fw-semibold); font-size: var(--fs-lg); white-space: nowrap; }
.brand-sub { font-size: var(--fs-xs); color: var(--text-3); display: block; line-height: 1.1; }
.header-context { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; min-width: 0; }
.ctx-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--r-full); border: 1px solid var(--border); background: var(--bg-panel); font-size: var(--fs-sm); color: var(--text-2); white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.ctx-chip svg { flex-shrink: 0; color: var(--text-3); }
.header-actions { display: flex; align-items: center; gap: var(--sp-2); }

.user-menu { position: relative; }
.user-menu-btn { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; border-radius: var(--r-full); border: 1px solid var(--border); background: var(--bg-panel); cursor: pointer; color: var(--text); max-width: 240px; }
.user-menu-btn:hover { background: var(--bg-hover); }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: var(--fs-xs); font-weight: var(--fw-semibold); flex-shrink: 0; }
.user-menu-name { font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-dd { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-2); padding: var(--sp-2); z-index: 200; }
.user-menu-dd .dd-head { padding: var(--sp-2) var(--sp-3); font-size: var(--fs-xs); color: var(--text-3); border-bottom: 1px solid var(--border); margin-bottom: var(--sp-1); word-break: break-all; }
.dd-item { display: flex; width: 100%; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm); background: none; border: none; cursor: pointer; text-align: left; font-size: var(--fs-sm); color: var(--text); text-decoration: none; }
.dd-item:hover { background: var(--bg-hover); }
.dd-item.danger { color: var(--error); }

/* ─────────────────────────────────────────────────────────────
   Buttons, badges, inputs
───────────────────────────────────────────────────────────── */
.btn, .btn-secondary { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); padding: 9px 14px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--bg-panel); color: var(--text); font-size: var(--fs-sm); font-weight: var(--fw-semibold); cursor: pointer; white-space: nowrap; transition: background-color .15s, border-color .15s, color .15s; text-decoration: none; line-height: 1.2; }
.btn:hover:not(:disabled), .btn-secondary:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--border-strong); }
.btn:disabled, .btn-secondary:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { color: var(--error); border-color: rgba(248,113,113,0.4); }
.btn-danger:hover:not(:disabled) { background: var(--error-bg); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: var(--fs-xs); border-radius: var(--r-sm); }
.btn-lg { padding: 13px 18px; font-size: var(--fs-md); }
.btn-block { width: 100%; }
.btn-icon { width: 32px; height: 32px; padding: 0; }
.btn-link { background: none; border: none; color: var(--accent); cursor: pointer; padding: 0; font-size: var(--fs-sm); text-decoration: underline; text-underline-offset: 2px; }
.btn-link:hover { color: var(--text); }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--r-full); font-size: var(--fs-xs); font-weight: var(--fw-semibold); line-height: 1.5; white-space: nowrap; border: 1px solid transparent; }
.badge-success { background: var(--success-bg); color: var(--success); border-color: rgba(52,211,153,0.35); }
.badge-warning { background: var(--warning-bg); color: var(--warning); border-color: rgba(251,191,36,0.35); }
.badge-error { background: var(--error-bg); color: var(--error); border-color: rgba(248,113,113,0.35); }
.badge-info { background: var(--info-bg); color: var(--info); border-color: rgba(96,165,250,0.35); }
.badge-neutral { background: var(--bg-inset); color: var(--text-2); border-color: var(--border); }
.badge-horeca { background: var(--horeca-bg); color: var(--horeca); border-color: rgba(251,146,60,0.4); }
.badge-gt { background: var(--gt-bg); color: var(--gt); border-color: rgba(34,211,238,0.4); }

label { display: block; font-size: var(--fs-sm); color: var(--text-2); margin-bottom: 6px; }
.field { margin-bottom: var(--sp-4); }
.field:last-child { margin-bottom: 0; }
.hint { display: block; font-size: var(--fs-xs); color: var(--text-3); margin-top: 5px; line-height: 1.4; }
.field-error { display: block; font-size: var(--fs-xs); color: var(--error); margin-top: 5px; }
input[type="text"], input[type="number"], input[type="date"], input[type="time"], input[type="password"], input[type="email"], input[type="url"], input[type="search"], select, textarea {
    width: 100%; background: var(--bg-inset); border: 1px solid var(--border); border-radius: var(--r-sm);
    padding: 9px 11px; color: var(--text); font-size: var(--fs-sm); outline: none; min-height: 38px;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: var(--focus-ring); }
input[aria-invalid="true"] { border-color: var(--error); }
input::placeholder { color: var(--text-3); }
select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a93a5' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 16px; height: 16px; cursor: pointer; }
input[type="range"] { width: 100%; accent-color: var(--primary); }
input[type="date"]::-webkit-calendar-picker-indicator, input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(0.7); cursor: pointer; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--sp-3); }
.row { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }

.toggle-switch { position: relative; display: inline-block; width: 36px; height: 20px; flex-shrink: 0; margin: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: var(--border-strong); border-radius: 20px; transition: background-color .2s; }
.toggle-slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .2s; }
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(16px); }
.toggle-switch input:focus-visible + .toggle-slider { box-shadow: var(--focus-ring); }
.toggle-row { display: flex; align-items: flex-start; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.toggle-row label { margin: 0; color: var(--text); cursor: pointer; line-height: 1.35; }
.toggle-row .hint { margin-top: 2px; }
.toggle-row.boxed { padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg-inset); }
.toggle-row.emergency { border-color: rgba(248,113,113,0.5); background: rgba(248,113,113,0.08); }
.toggle-row.emergency.on { border-color: var(--error); background: rgba(248,113,113,0.16); }
.toggle-row.emergency label { color: var(--error); font-weight: var(--fw-semibold); }

.subsection-title { font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; margin: var(--sp-4) 0 var(--sp-3); }
.subsection-title:first-child { margin-top: 0; }

/* ─────────────────────────────────────────────────────────────
   Layout
───────────────────────────────────────────────────────────── */
.layout { max-width: 1480px; margin: 0 auto; padding: var(--sp-5); display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-5); align-items: start; }
.layout > * { min-width: 0; }
.tab-panel, .panel-body { min-width: 0; }
@media (min-width: 1024px) { .layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); } }
.panel { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border); }
.panel-body { padding: var(--sp-5); }

.setup-column { display: flex; flex-direction: column; gap: var(--sp-5); min-width: 0; }
.setup-panel { display: block; }
@media (min-width: 1024px) {
    /* The whole left column (form + history) is one scroll area so the wheel works anywhere over it. */
    .setup-column { position: sticky; top: calc(var(--header-h) + var(--sp-5)); max-height: calc(100vh - var(--header-h) - var(--sp-5) * 2); overflow-y: auto; overscroll-behavior: contain; padding-right: 2px; }
}
.setup-body { padding: var(--sp-4) var(--sp-5); }
.setup-footer { position: sticky; bottom: 0; z-index: 2; padding: var(--sp-3) var(--sp-5) var(--sp-4); border-top: 1px solid var(--border); background: var(--bg-panel); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.setup-footer .ready-note { font-size: var(--fs-xs); color: var(--text-3); margin-top: var(--sp-2); text-align: center; min-height: 1.2em; }
.setup-footer .ready-note.ok { color: var(--success); }

.step { margin-bottom: var(--sp-5); }
.step:last-child { margin-bottom: 0; }
.step-head { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.step-num { width: 24px; height: 24px; border-radius: 50%; background: var(--bg-inset); border: 1px solid var(--border-strong); color: var(--text-2); font-size: var(--fs-xs); font-weight: var(--fw-semibold); display: grid; place-items: center; flex-shrink: 0; }
.step.done .step-num { background: var(--success-bg); border-color: var(--success); color: var(--success); }
.step-title { font-size: var(--fs-md); font-weight: var(--fw-semibold); }
.step-status { margin-left: auto; font-size: var(--fs-xs); color: var(--text-3); }
.step-body { padding-left: 36px; }
@media (max-width: 480px) { .step-body { padding-left: 0; } }

details.adv { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg-inset); margin-top: var(--sp-4); }
details.adv > summary { list-style: none; cursor: pointer; padding: var(--sp-3) var(--sp-4); font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-2); display: flex; align-items: center; justify-content: space-between; user-select: none; border-radius: var(--r-md); }
details.adv > summary::-webkit-details-marker { display: none; }
details.adv > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3); transform: rotate(45deg); transition: transform .15s; margin-right: 4px; }
details.adv[open] > summary::after { transform: rotate(-135deg); }
details.adv[open] > summary { border-bottom: 1px solid var(--border); }
details.adv > .adv-body { padding: var(--sp-4); }
details.settings-accordion { border: 1px solid var(--border); border-radius: var(--r-md); margin-bottom: var(--sp-3); background: var(--bg-panel); }
details.settings-accordion > summary { list-style: none; cursor: pointer; padding: var(--sp-3) var(--sp-4); font-size: var(--fs-sm); font-weight: var(--fw-semibold); display: flex; justify-content: space-between; align-items: center; user-select: none; }
details.settings-accordion > summary::-webkit-details-marker { display: none; }
details.settings-accordion > summary::after { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3); transform: rotate(45deg); margin-right: 4px; }
details.settings-accordion[open] > summary::after { transform: rotate(-135deg); }
details.settings-accordion[open] > summary { border-bottom: 1px solid var(--border); }
.settings-accordion-content { padding: var(--sp-4); }

/* Dropzones */
.drop-zone { border: 1.5px dashed var(--border-strong); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); cursor: pointer; background: var(--bg-inset); display: flex; align-items: center; gap: var(--sp-3); transition: border-color .15s, background-color .15s; }
.drop-zone:hover, .drop-zone.dragover, .drop-zone:focus-visible { border-color: var(--primary); background: var(--primary-soft); }
.drop-zone.loaded { border-style: solid; border-color: rgba(52,211,153,0.6); }
.drop-zone .dz-icon { width: 34px; height: 34px; border-radius: var(--r-sm); background: var(--bg-panel); border: 1px solid var(--border); display: grid; place-items: center; color: var(--text-3); flex-shrink: 0; }
.drop-zone.loaded .dz-icon { color: var(--success); border-color: rgba(52,211,153,0.5); }
.dz-main { min-width: 0; flex: 1; }
.dz-title { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drop-zone-text { font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; }
.dz-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.dz-meta .badge { font-weight: var(--fw-regular); }
.dz-meta .badge strong { font-weight: var(--fw-semibold); }

/* ─────────────────────────────────────────────────────────────
   Tabs
───────────────────────────────────────────────────────────── */
.tabs-header { display: flex; gap: 4px; padding: 4px; background: var(--bg-inset); border: 1px solid var(--border); border-radius: var(--r-md); overflow-x: auto; margin: var(--sp-4) var(--sp-5) 0; scrollbar-width: none; }
.tabs-header::-webkit-scrollbar { display: none; }
.tab-btn { background: transparent; border: none; color: var(--text-2); padding: 8px 14px; cursor: pointer; font-size: var(--fs-sm); font-weight: var(--fw-semibold); border-radius: var(--r-sm); flex: 1 0 auto; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.tab-btn:hover { color: var(--text); background: var(--bg-hover); }
.tab-btn.active, .tab-btn[aria-selected="true"] { color: var(--text); background: var(--bg-panel); box-shadow: var(--shadow-1); }
.tab-count { font-size: var(--fs-xs); background: var(--bg-hover); color: var(--text-2); padding: 0 6px; border-radius: var(--r-full); }
.tab-panel { padding: var(--sp-5); }

/* Empty states */
.empty { text-align: center; padding: var(--sp-7) var(--sp-5); color: var(--text-3); border: 1.5px dashed var(--border); border-radius: var(--r-lg); }
.empty svg { color: var(--text-3); margin-bottom: var(--sp-3); }
.empty h3 { color: var(--text); margin-bottom: var(--sp-1); }
.empty p { font-size: var(--fs-sm); max-width: 420px; margin: 0 auto; }
.empty ol { text-align: left; display: inline-block; margin: var(--sp-3) auto 0; font-size: var(--fs-sm); padding-left: 1.2em; color: var(--text-2); }

/* Skeletons */
.skeleton { background: linear-gradient(90deg, var(--bg-inset) 25%, var(--bg-hover) 50%, var(--bg-inset) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--r-sm); height: 14px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-rows { display: flex; flex-direction: column; gap: 10px; }
.skeleton-rows .skeleton { height: 32px; }

/* Spinner */
.spinner, .loader { width: 20px; height: 20px; border: 3px solid var(--border-strong); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.9s linear infinite; flex-shrink: 0; }
.spinner.lg { width: 36px; height: 36px; border-width: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Progress panel */
.progress-card { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg-inset); padding: var(--sp-5); margin-bottom: var(--sp-5); }
.progress-top { display: flex; align-items: center; gap: var(--sp-4); }
.progress-title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
.progress-elapsed { margin-left: auto; font-variant-numeric: tabular-nums; font-size: var(--fs-xl); font-weight: var(--fw-semibold); }
.progress-phases { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-4); }
.phase { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: var(--r-full); border: 1px solid var(--border); font-size: var(--fs-xs); color: var(--text-3); }
.phase .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.phase.active { color: var(--text); border-color: var(--primary); }
.phase.active .dot { background: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.phase.done { color: var(--success); border-color: rgba(52,211,153,0.4); }
.phase.done .dot { background: var(--success); }
.progress-note { font-size: var(--fs-sm); color: var(--text-2); margin-top: var(--sp-3); }
.progress-bar { height: 4px; border-radius: 2px; background: var(--bg-hover); overflow: hidden; margin-top: var(--sp-4); }
.progress-bar > div { height: 100%; width: 35%; background: var(--primary); animation: indeterminate 1.6s ease-in-out infinite; }
@keyframes indeterminate { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }

.error-card { border: 1px solid rgba(248,113,113,0.45); background: var(--error-bg); border-radius: var(--r-lg); padding: var(--sp-4) var(--sp-5); margin-bottom: var(--sp-5); display: flex; gap: var(--sp-3); align-items: flex-start; }
.error-card svg { color: var(--error); flex-shrink: 0; margin-top: 2px; }
.error-card .ec-title { font-weight: var(--fw-semibold); color: var(--error); margin-bottom: 2px; }
.error-card .ec-msg { font-size: var(--fs-sm); color: var(--text); white-space: pre-wrap; word-break: break-word; }
.error-card .ec-actions { margin-left: auto; flex-shrink: 0; }

/* Status banner */
.banner { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); border: 1px solid; font-size: var(--fs-sm); margin-bottom: var(--sp-4); }
.banner svg { flex-shrink: 0; margin-top: 2px; }
.banner-warning { background: var(--warning-bg); border-color: rgba(251,191,36,0.45); color: var(--text); }
.banner-warning svg { color: var(--warning); }
.banner-info { background: var(--info-bg); border-color: rgba(96,165,250,0.45); }
.banner-info svg { color: var(--info); }
.banner-error { background: var(--error-bg); border-color: rgba(248,113,113,0.45); }
.banner-error svg { color: var(--error); }
.banner strong { display: block; }

/* ─────────────────────────────────────────────────────────────
   Results: KPI strip, slot table
───────────────────────────────────────────────────────────── */
.results-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.results-head .meta { font-size: var(--fs-sm); color: var(--text-3); margin-top: 2px; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-5); }
.kpi { background: var(--bg-inset); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); min-width: 0; }
.kpi-label { font-size: var(--fs-xs); color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: var(--fs-xl); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; margin-top: 2px; line-height: 1.2; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.kpi-value small { font-size: var(--fs-sm); color: var(--text-3); font-weight: var(--fw-regular); }
.kpi-sub { font-size: var(--fs-xs); color: var(--text-3); margin-top: 4px; }
.kpi.good { border-color: rgba(52,211,153,0.5); }
.kpi.good .kpi-value { color: var(--success); }
.kpi.bad { border-color: rgba(248,113,113,0.55); background: rgba(248,113,113,0.06); }
.kpi.bad .kpi-value { color: var(--error); }
.kpi.warn { border-color: rgba(251,191,36,0.5); }
.kpi.warn .kpi-value { color: var(--warning); }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-md); }
.data-table, .stops-table, .history-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.data-table th, .data-table td, .stops-table th, .stops-table td, .history-table th, .history-table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table th, .stops-table th, .history-table th { background: var(--bg-inset); color: var(--text-3); font-weight: var(--fw-semibold); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.04em; }
.scrollable-table-container th, .route-details .table-wrap th { position: sticky; top: 0; z-index: 1; }
.data-table td, .stops-table td, .history-table td { color: var(--text); font-variant-numeric: tabular-nums; }
.data-table tr:last-child td, .stops-table tr:last-child td, .history-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td, .stops-table tbody tr:hover td, .history-table tbody tr:hover td { background: rgba(255,255,255,0.025); }
.data-table td.r, .data-table th.r { text-align: right; }
.scrollable-table-container { max-height: 520px; overflow: auto; border: 1px solid var(--border); border-radius: var(--r-md); }

.section-title { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin: var(--sp-5) 0 var(--sp-3); flex-wrap: wrap; }
.section-title h3 { font-size: var(--fs-md); }
.section-title .muted { font-size: var(--fs-xs); }

/* ─────────────────────────────────────────────────────────────
   Route list
───────────────────────────────────────────────────────────── */
.route-toolbar { display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg-inset); margin-bottom: var(--sp-3); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: var(--r-full); border: 1px solid var(--border); background: var(--bg-panel); color: var(--text-2); font-size: var(--fs-xs); font-weight: var(--fw-semibold); cursor: pointer; }
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary); color: var(--text); }
.chip .cnt { background: var(--bg-hover); padding: 0 6px; border-radius: var(--r-full); font-weight: var(--fw-regular); }
.chip[aria-pressed="true"] .cnt { background: rgba(255,255,255,0.12); }
.search-box { position: relative; flex: 1 1 200px; max-width: 320px; }
.search-box input { padding-left: 32px; min-height: 34px; }
.search-box svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.route-list-summary { font-size: var(--fs-xs); color: var(--text-3); margin: 0 0 var(--sp-3); }

.route-card { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg-elev); margin-bottom: var(--sp-3); overflow: hidden; }
.route-card.has-issue { border-left: 3px solid var(--error); }
.route-card.has-gt-late { border-left: 3px solid var(--warning); }
.route-card.has-issue.has-gt-late { border-left-color: var(--error); }
.route-head { display: grid; grid-template-columns: auto 1fr auto; gap: var(--sp-3); align-items: start; padding: var(--sp-3) var(--sp-4); cursor: pointer; }
.route-head:hover { background: var(--bg-hover); }
.route-head .rc-check { padding-top: 3px; }
.route-title { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.route-title .name { font-weight: var(--fw-semibold); font-size: var(--fs-md); }
.route-title .vtype { font-size: var(--fs-xs); color: var(--text-3); }
.route-metrics { display: flex; gap: var(--sp-4); flex-wrap: wrap; margin-top: 6px; font-size: var(--fs-sm); color: var(--text-2); font-variant-numeric: tabular-nums; }
.route-metrics span b { color: var(--text); font-weight: var(--fw-semibold); }
.route-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.route-actions { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.route-actions .btn { padding: 5px 9px; }
.chev { width: 10px; height: 10px; border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3); transform: rotate(45deg); transition: transform .15s; margin: 0 6px; }
.route-card.open .chev { transform: rotate(-135deg); }
.route-details { display: none; border-top: 1px solid var(--border); }
.route-card.open .route-details { display: block; }
.route-details .table-wrap { border: none; border-radius: 0; max-height: 480px; overflow: auto; }
.stop-late { color: var(--error); }
.stop-row.match td { background: rgba(99,102,241,0.12) !important; }
.stop-select-cell { width: 28px; }
.stop-select-cell input { vertical-align: middle; }

/* History */
.history-table td { font-size: var(--fs-sm); }
.history-table .sub { font-size: var(--fs-xs); color: var(--text-3); display: block; }
.history-footer { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); padding-top: var(--sp-3); font-size: var(--fs-xs); color: var(--text-3); }

/* ─────────────────────────────────────────────────────────────
   Map tab (keeps ids used by map JS)
───────────────────────────────────────────────────────────── */
.route-metric-filters { margin-bottom: var(--sp-3); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg-inset); }
.route-metric-filters-header { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-3); }
.warehouse-context-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--r-full); font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--accent); background: var(--gt-bg); border: 1px solid rgba(34,211,238,0.4); }
.warehouse-context-badge.mismatch { color: var(--warning); background: var(--warning-bg); border-color: rgba(251,191,36,0.45); }
.route-filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--sp-2) var(--sp-3); }
.route-filter-field label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.route-filter-range { display: flex; gap: 6px; align-items: center; }
.route-filter-range input { min-height: 32px; padding: 5px 8px; font-size: var(--fs-xs); }
.route-filter-range span { color: var(--text-3); font-size: var(--fs-xs); }

/* Collapsible left pane + map-mode routes sidebar */
.left-toggle { display: none; align-items: center; gap: 6px; margin: 6px 8px 6px 10px; flex: none; }
@media (min-width: 1024px) { .left-toggle { display: inline-flex; } }
.routes-sidebar { display: none; flex-direction: column; min-width: 0; }
.layout.show-routes #setupColumn { display: none; }
.layout.show-routes #routesSidebar { display: flex; }
.layout.left-collapsed { grid-template-columns: minmax(0, 1fr); }
.layout.left-collapsed #setupColumn, .layout.left-collapsed #routesSidebar { display: none; }
@media (min-width: 1024px) {
    .routes-sidebar { position: sticky; top: calc(var(--header-h) + var(--sp-5)); max-height: calc(100vh - var(--header-h) - var(--sp-5) * 2); }
}
.routes-sidebar { gap: var(--sp-3); }
@media (min-width: 1024px) { .routes-sidebar { overflow-y: auto; overscroll-behavior: contain; } }
.routes-sidebar .rs-panel { display: flex; flex-direction: column; flex: none; }
.routes-sidebar .rs-list { flex: none; max-height: max(320px, calc(100vh - var(--header-h) - 330px)); }
.rs-fold { flex: none; }
.rs-fold > summary { cursor: pointer; padding: var(--sp-3) var(--sp-4); font-weight: var(--fw-semibold); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); }
.rs-fold > summary::-webkit-details-marker { display: none; }
.rs-fold > summary::after { content: '▸'; color: var(--text-3); transition: transform .15s; margin-left: auto; }
.rs-fold[open] > summary::after { transform: rotate(90deg); }
.rs-fold > summary .muted { font-size: var(--fs-xs); font-weight: var(--fw-regular); }
.rs-fold .panel { border: 0; box-shadow: none; border-top: 1px solid var(--border); border-radius: 0; }
#rsSetupSlot .setup-panel > .panel-head { display: none; }
.rs-top { padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); display: grid; gap: var(--sp-2); }
.rs-top input[type=search], .rs-top select { width: 100%; padding: 6px 8px; border-radius: var(--r-sm, 6px); border: 1px solid var(--border); background: var(--bg-inset); }
.rs-tools { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.rs-tools select { flex: 1; min-width: 0; width: auto; }
.rs-late-only { font-size: var(--fs-xs); color: var(--text-3); display: flex; gap: 6px; align-items: center; cursor: pointer; }
.rs-totals { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }
.rs-totals b { color: var(--text); }
.rs-list { overflow-y: auto; padding: var(--sp-3); overscroll-behavior: contain; }
.rs-item { border: 1px solid var(--border); border-left: 4px solid var(--c, var(--accent)); border-radius: var(--r-md); background: var(--bg-elev); margin-bottom: var(--sp-2); cursor: pointer; transition: opacity .15s, box-shadow .15s; }
.rs-item.off { opacity: 0.5; }
.rs-item.solo, .rs-item.flash { box-shadow: 0 0 0 2px var(--c, var(--accent)); }
.rs-item.issue { border-right: 3px solid var(--error); }
.rs-item.late { border-right: 3px solid var(--warning); }
.rs-head { display: flex; align-items: center; gap: 6px; padding: 6px 8px 2px; }
.rs-head .name { font-weight: var(--fw-semibold); }
.rs-head .sp { flex: 1; }
.rs-chev { background: none; border: 0; cursor: pointer; padding: 2px 6px; color: var(--text-3); transition: transform .15s; }
.rs-item.open .rs-chev { transform: rotate(90deg); }
.rs-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.rs-dot.ok { background: var(--success); } .rs-dot.bad { background: var(--error); } .rs-dot.warn { background: var(--warning); } .rs-dot.none { background: var(--text-3); opacity: .5; }
.rs-summary { padding: 0 8px 6px; font-size: var(--fs-xs); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; }
.rs-summary i { font-style: normal; color: var(--text-3); margin: 0 3px; font-weight: 400; }
.rs-summary .muted { font-weight: 400; }
.rs-head .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.rs-metrics { display: grid; grid-template-columns: auto 1fr; gap: 2px 24px; gap: 2px 8px; padding: 2px 10px 6px; font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }
.rs-metrics b { color: var(--text); display: block; font-size: var(--fs-sm); }
.rs-badges { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 8px 6px; }
.rs-loadbar { height: 3px; background: var(--bg-inset); margin: 0 10px 6px; border-radius: 2px; overflow: hidden; }
.rs-loadbar > i { display: block; height: 100%; background: var(--c, var(--accent)); }
.rs-stops { display: none; border-top: 1px solid var(--border); padding: 4px 6px 6px; font-size: var(--fs-xs); cursor: default; }
.rs-item.open .rs-stops { display: block; }
.rs-stop { display: grid; grid-template-columns: 22px 1fr auto; gap: 6px; align-items: center; padding: 3px 4px; border-radius: 4px; cursor: pointer; }
.rs-stop:hover { background: var(--bg-inset); }
.rs-stop .seq { display: inline-flex; width: 20px; height: 20px; align-items: center; justify-content: center; border-radius: 50%; background: var(--c); color: #fff; font-weight: 700; font-size: 10px; }
.rs-stop .seq.h { border-radius: 4px; }
.rs-stop .sub { color: var(--text-3); }
.rs-stop .st-late { color: var(--error); } .rs-stop .st-ok { color: var(--success); }
#map { height: max(520px, calc(100vh - 330px)); }
.map-shell { position: relative; }
#map { height: 560px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--bg-inset); position: relative; z-index: 1; }
.map-metrics-overlay { position: absolute; top: 12px; right: 12px; z-index: 1000; min-width: 210px; max-width: 280px; padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); border: 1px solid var(--border); background: rgba(22, 26, 35, 0.95); box-shadow: var(--shadow-2); pointer-events: none; }
.map-metrics-overlay .overlay-toggle { pointer-events: auto; display: flex; width: 100%; align-items: center; justify-content: space-between; gap: var(--sp-3); background: none; border: 0; padding: 0; cursor: pointer; color: inherit; }
.map-metrics-overlay .overlay-toggle .overlay-title { margin-bottom: 0; }
.map-metrics-overlay .overlay-chev { color: var(--text-3); transition: transform .15s; }
.map-metrics-overlay.collapsed .overlay-chev { transform: rotate(-90deg); }
.map-metrics-overlay.collapsed .overlay-body { display: none; }
.map-metrics-overlay.collapsed { min-width: 0; }
.map-metrics-overlay .overlay-body { margin-top: 4px; }
.map-metrics-overlay .overlay-title { font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.map-metrics-overlay .overlay-warehouse { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--accent); margin-bottom: 6px; }
.map-metrics-overlay .overlay-row { display: flex; justify-content: space-between; gap: var(--sp-3); font-size: var(--fs-sm); padding: 2px 0; font-variant-numeric: tabular-nums; }
.map-metrics-overlay .overlay-row span:first-child { color: var(--text-3); }
.map-metrics-overlay .overlay-note { margin-top: 6px; font-size: var(--fs-xs); color: var(--text-3); line-height: 1.35; }
#mapWarehouseMismatch { display: none; margin-bottom: var(--sp-3); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md); font-size: var(--fs-sm); color: var(--warning); background: var(--warning-bg); border: 1px solid rgba(251,191,36,0.4); }
.route-multiselect-container { display: inline-flex; align-items: center; gap: 8px; position: relative; }
.route-multiselect-label { font-size: var(--fs-sm); color: var(--text-3); white-space: nowrap; }
.route-multiselect-btn { display: inline-flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 200px; max-width: 320px; padding: 7px 12px; background: var(--bg-inset); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-sm); font-size: var(--fs-sm); cursor: pointer; text-align: left; }
.route-multiselect-btn:hover, .route-multiselect-btn.open { border-color: var(--primary); }
.route-multiselect-btn-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.route-multiselect-chevron { font-size: 0.6rem; color: var(--text-3); }
.route-multiselect-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 1200; width: 330px; max-width: 90vw; background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-3); box-shadow: var(--shadow-2); }
.route-multiselect-search { margin-bottom: var(--sp-2); min-height: 32px; }
.route-multiselect-actions { display: flex; align-items: center; gap: 6px; padding-bottom: var(--sp-2); border-bottom: 1px solid var(--border); margin-bottom: var(--sp-2); }
.btn-micro { font-size: var(--fs-xs); padding: 3px 8px; border-radius: var(--r-sm); background: var(--bg-inset); color: var(--text); border: 1px solid var(--border); cursor: pointer; }
.btn-micro:hover { border-color: var(--primary); }
.route-checklist { max-height: 250px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.route-checklist-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--r-sm); cursor: pointer; user-select: none; }
.route-checklist-item:hover { background: var(--bg-hover); }
.route-checklist-item.selected { background: var(--primary-soft); }
.route-color-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.route-item-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.route-item-title { font-size: var(--fs-sm); font-weight: var(--fw-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.route-item-sub { font-size: var(--fs-xs); color: var(--text-3); }
.route-solo-btn { font-size: var(--fs-xs); padding: 1px 6px; border-radius: 4px; background: var(--bg-inset); color: var(--text-2); border: 1px solid var(--border); cursor: pointer; margin-left: auto; }
.route-solo-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.route-pills-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: var(--sp-3) 0; max-height: 90px; overflow-y: auto; }
.route-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; font-size: var(--fs-xs); border-radius: var(--r-full); border: 1px solid var(--border); background: var(--bg-inset); color: var(--text-2); cursor: pointer; user-select: none; }
.route-pill:hover { border-color: var(--border-strong); color: var(--text); }
.route-pill.active { background: var(--primary-soft); border-color: var(--primary); color: var(--text); font-weight: var(--fw-semibold); }
.route-pill.active-all { background: var(--success-bg); border-color: var(--success); color: var(--text); }
.map-selected-count-badge { display: inline-flex; align-items: center; font-size: var(--fs-xs); font-weight: var(--fw-semibold); padding: 2px 8px; border-radius: var(--r-full); background: var(--gt-bg); color: var(--accent); border: 1px solid rgba(34,211,238,0.4); }

.leaflet-tooltip { background-color: var(--bg-panel) !important; border: 1px solid var(--border) !important; color: var(--text) !important; font-family: 'Outfit', sans-serif !important; border-radius: 6px !important; box-shadow: var(--shadow-2) !important; }
.leaflet-popup-content-wrapper { background-color: var(--bg-panel) !important; color: var(--text) !important; font-family: 'Outfit', sans-serif !important; border: 1px solid var(--border) !important; border-radius: 10px !important; }
.warn-list { margin: 4px 0 0; padding-left: 18px; font-weight: 400; }
.warn-list li { margin: 2px 0; }
.leaflet-popup-tip { background-color: var(--bg-panel) !important; }
.route-seq-marker { background: transparent !important; border: none !important; display: flex; align-items: center; justify-content: center; }
.route-seq-badge { display: flex; align-items: center; justify-content: center; color: #fff; font-weight: var(--fw-semibold); line-height: 1; border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.55); font-family: 'Outfit', sans-serif; }
.route-seq-badge-gt { width: 26px; height: 26px; border-radius: 50%; font-size: 12px; }
.route-seq-badge-horeca { width: 22px; height: 22px; border-radius: 4px; transform: rotate(45deg); }
.route-seq-badge-horeca > span { display: inline-block; transform: rotate(-45deg); font-size: 11px; line-height: 1; }
.depot-marker-icon { background: transparent !important; border: none !important; }

/* ─────────────────────────────────────────────────────────────
   Login
───────────────────────────────────────────────────────────── */
.login-screen { position: fixed; inset: 0; background: var(--bg); display: flex; justify-content: center; align-items: center; z-index: 9999; padding: var(--sp-4); }
.login-card { width: 100%; max-width: 400px; background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-6); box-shadow: var(--shadow-2); }
.login-card .brand-mark { width: 44px; height: 44px; margin: 0 auto var(--sp-3); }
.login-card h1 { font-size: var(--fs-xl); text-align: center; }
.login-card .login-sub { text-align: center; color: var(--text-3); font-size: var(--fs-sm); margin: var(--sp-1) 0 var(--sp-5); }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 68px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--text-2); font-size: var(--fs-xs); font-weight: var(--fw-semibold); cursor: pointer; padding: 4px 8px; border-radius: var(--r-sm); }
.pw-toggle:hover { background: var(--bg-hover); color: var(--text); }
.login-notice { font-size: var(--fs-sm); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm); margin-bottom: var(--sp-4); }
.login-notice.info { background: var(--info-bg); color: var(--info); border: 1px solid rgba(96,165,250,0.35); }
.login-notice.error { background: var(--error-bg); color: var(--error); border: 1px solid rgba(248,113,113,0.35); }

/* ─────────────────────────────────────────────────────────────
   Toasts, confirm dialog, modals
───────────────────────────────────────────────────────────── */
.toasts { position: fixed; bottom: var(--sp-5); left: 50%; transform: translateX(-50%); z-index: 10050; display: flex; flex-direction: column; gap: var(--sp-2); width: min(440px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); background: var(--bg-elev); border: 1px solid var(--border); box-shadow: var(--shadow-2); font-size: var(--fs-sm); animation: toast-in .2s ease-out; }
.toast svg { flex-shrink: 0; margin-top: 1px; }
.toast-success { border-color: rgba(52,211,153,0.5); } .toast-success svg { color: var(--success); }
.toast-error { border-color: rgba(248,113,113,0.55); } .toast-error svg { color: var(--error); }
.toast-info { border-color: rgba(96,165,250,0.5); } .toast-info svg { color: var(--info); }
.toast-warning { border-color: rgba(251,191,36,0.5); } .toast-warning svg { color: var(--warning); }
.toast .toast-msg { flex: 1; white-space: pre-wrap; word-break: break-word; }
.toast .toast-close { background: none; border: none; color: var(--text-3); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 2px; }
.toast .toast-close:hover { color: var(--text); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.modal-backdrop { position: fixed; inset: 0; z-index: 10000; background: rgba(0,0,0,0.65); display: flex; align-items: center; justify-content: center; padding: var(--sp-4); }
.modal { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-2); width: 100%; max-width: 440px; padding: var(--sp-5); }
.modal.wide { max-width: 640px; max-height: 92vh; overflow-y: auto; }
.modal h2 { font-size: var(--fs-lg); margin-bottom: var(--sp-2); }
.modal p { font-size: var(--fs-sm); color: var(--text-2); }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); margin-top: var(--sp-5); }
.settings-group { margin-bottom: var(--sp-4); padding: var(--sp-4); background: var(--bg-inset); border-radius: var(--r-md); border: 1px solid var(--border); }
.settings-group > .sg-title { font-weight: var(--fw-semibold); margin-bottom: var(--sp-3); }
.callout { padding: var(--sp-3); border-radius: var(--r-md); border: 1px solid var(--border); background: var(--bg-panel); margin-bottom: var(--sp-3); }
.callout.green { border-color: rgba(52,211,153,0.35); }
.callout.amber { border-color: rgba(251,191,36,0.4); }
.callout.amber label { color: var(--warning); }

/* Order queue drawer */
.queue-tab { position: fixed; right: 0; top: 50%; transform: translateY(-50%); z-index: 8000; background: var(--primary); color: #fff; padding: 12px 8px; border-radius: 10px 0 0 10px; cursor: pointer; writing-mode: vertical-rl; font-weight: var(--fw-semibold); font-size: var(--fs-xs); letter-spacing: 0.06em; box-shadow: var(--shadow-2); border: none; display: flex; align-items: center; gap: 6px; }
.queue-tab .q-badge { background: var(--error); color: #fff; border-radius: var(--r-full); padding: 1px 6px; font-size: var(--fs-xs); writing-mode: horizontal-tb; display: none; }
.queue-panel { position: fixed; right: 0; top: 0; width: 390px; max-width: 100vw; height: 100vh; z-index: 7999; background: var(--bg-panel); border-left: 1px solid var(--border); box-shadow: var(--shadow-2); transform: translateX(100%); transition: transform .25s ease; overflow-y: auto; display: flex; flex-direction: column; }
.queue-panel.open { transform: none; }
.queue-head { padding: var(--sp-4) var(--sp-5) var(--sp-3); border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: var(--bg-panel); z-index: 1; }
.queue-summary { padding: var(--sp-3) var(--sp-5); display: flex; gap: var(--sp-2); border-bottom: 1px solid var(--border); }
.queue-stat { text-align: center; flex: 1; border-radius: var(--r-md); padding: var(--sp-2); border: 1px solid var(--border); background: var(--bg-inset); }
.queue-stat .v { font-size: var(--fs-lg); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; }
.queue-stat .l { font-size: var(--fs-xs); color: var(--text-3); }
.queue-stat.quick .v { color: var(--horeca); }
.queue-stat.standard .v { color: var(--gt); }
.queue-stat.held .v { color: var(--warning); }
.queue-actions { padding: var(--sp-3) var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-2); border-bottom: 1px solid var(--border); }
.queue-actions .btn { justify-content: flex-start; }
.queue-list { padding: var(--sp-3) var(--sp-5); flex: 1; overflow-y: auto; }
.queue-item { padding: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-2); background: var(--bg-inset); border: 1px solid var(--border); border-radius: var(--r-sm); border-left-width: 3px; }
.queue-item.quick { border-left-color: var(--horeca); }
.queue-item.standard { border-left-color: var(--gt); }
.unassigned-panel { display: none; position: fixed; bottom: var(--sp-5); right: 420px; z-index: 7000; background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-4); min-width: 320px; box-shadow: var(--shadow-2); }
.gmaps-note { display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 5000; background: var(--warning-bg); border-top: 1px solid rgba(251,191,36,0.4); padding: var(--sp-2) var(--sp-4); font-size: var(--fs-xs); color: var(--warning); text-align: center; }

/* Tooltip (CSS-only) */
[data-tip] { position: relative; }
[data-tip]::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); background: var(--bg-elev); color: var(--text); border: 1px solid var(--border); padding: 6px 10px; border-radius: var(--r-sm); font-size: var(--fs-xs); font-weight: var(--fw-regular); white-space: normal; width: max-content; max-width: 280px; text-align: center; box-shadow: var(--shadow-2); opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 50; }
[data-tip]:hover::after, [data-tip]:focus-within::after { opacity: 1; }

/* ─────────────────────────────────────────────────────────────
   Responsive
───────────────────────────────────────────────────────────── */
@media (max-width: 1023px) {
    .app-header { height: auto; min-height: var(--header-h); flex-wrap: wrap; padding: var(--sp-2) var(--sp-4); row-gap: var(--sp-2); }
    .header-context { order: 3; width: 100%; }
    .layout { padding: var(--sp-4); gap: var(--sp-4); }
    .setup-body { padding: var(--sp-4); }
    .setup-footer { padding: var(--sp-3) var(--sp-4); }
    .panel-body, .tab-panel { padding: var(--sp-4); }
    .tabs-header { margin: var(--sp-4) var(--sp-4) 0; }
    .unassigned-panel { right: var(--sp-4); left: var(--sp-4); min-width: 0; }
}
@media (max-width: 640px) {
    .brand-name { font-size: var(--fs-md); }
    .brand-sub { display: none; }
    .header-link-text { display: none; }
    .ctx-chip { max-width: 180px; }
    .route-head { grid-template-columns: auto 1fr; }
    .route-actions { grid-column: 1 / -1; justify-content: flex-start; }
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-2 { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr; }
    #map { height: 420px; }
    .map-metrics-overlay { display: none; }
    .queue-panel { width: 100vw; }
    .toasts { bottom: auto; top: var(--sp-3); }
    .results-head .btn { width: 100%; }
}

/* ── Segmented control (order source) ── */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm, 8px); overflow: hidden; background: var(--bg-inset); }
.seg-btn { border: 0; background: transparent; color: var(--text-2); padding: 7px 14px; font: inherit; font-size: var(--fs-sm); cursor: pointer; }
.seg-btn + .seg-btn { border-left: 1px solid var(--border); }
.seg-btn.active { background: var(--primary-soft, rgba(99,102,241,0.18)); color: var(--text); font-weight: var(--fw-semibold); }
.seg-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
input[readonly] { opacity: 0.75; cursor: not-allowed; }

/* Options that only apply to some optimization algorithms */
.model-hidden { display: none !important; }

/* Info icon with an explanatory popover */
.info-icon { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; margin-left: 6px; border-radius: 50%; border: 1px solid var(--text-3); color: var(--text-3); font: italic 600 10px/1 Georgia, serif; cursor: help; vertical-align: middle; user-select: none; }
.info-icon:hover, .info-icon:focus, .info-icon.open { color: var(--text); border-color: var(--text); outline: none; }
.info-tip { display: none; position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); width: 240px; padding: 8px 10px; border-radius: 6px; background: var(--surface-2, #1f2937); color: var(--text); border: 1px solid var(--border, rgba(128,128,128,.4)); box-shadow: 0 6px 20px rgba(0,0,0,.35); font-style: normal; font-weight: 400; font-family: inherit; font-size: var(--fs-xs, 12px); line-height: 1.45; text-align: left; z-index: 50; white-space: normal; }
.info-icon:hover .info-tip, .info-icon:focus .info-tip, .info-icon.open .info-tip { display: block; }
