/* ==========================================================================
   Aqorin.Motion – fleet operations UI
   Light workspace, dark navigation rail, dense data surfaces.
   ========================================================================== */

:root {
    --font: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    --mono: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;

    --bg: #f4f6fa;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e3e8ef;
    --border-strong: #cfd7e3;
    --text: #0f172a;
    --text-2: #475569;
    --text-3: #8391a7;

    --nav-bg: #0b1324;
    --nav-bg-2: #111c33;
    --nav-text: #a9b6cc;
    --nav-active: #ffffff;

    --primary: #2563eb;
    --primary-600: #1d4ed8;
    --primary-50: #eff4ff;
    --success: #16a34a;
    --success-50: #ecfdf3;
    --warning: #d97706;
    --warning-50: #fff7e6;
    --danger: #dc2626;
    --danger-50: #fef2f2;
    --info: #0891b2;
    --info-50: #ecfeff;

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 12px rgba(15, 23, 42, .05);
    --shadow-lg: 0 10px 30px rgba(15, 23, 42, .18);

    --sidebar-w: 240px;
    --topbar-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.45;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }

/* ---------- Icons (inline SVG injected by ui.js) ---------- */
.i { display: inline-flex; width: 18px; height: 18px; flex: none; }
.i svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i-sm { width: 15px; height: 15px; }
.i-lg { width: 22px; height: 22px; }

/* ---------- Buttons & inputs ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 36px; padding: 0 14px;
    border: 1px solid transparent; border-radius: var(--radius-sm);
    font: 550 13.5px var(--font); cursor: pointer; white-space: nowrap;
    background: var(--primary); color: #fff;
    transition: background .15s, border-color .15s, box-shadow .15s, opacity .15s;
}
.btn:hover { background: var(--primary-600); }
.btn:focus-visible, .icon-btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--primary) 45%, transparent); outline-offset: 1px;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--text-3); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: #eef2f7; color: var(--text); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--success); }
.btn-success:hover { background: #15803d; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; gap: 6px; }
.btn-block { width: 100%; }
.btn .spinner { width: 14px; height: 14px; }

.icon-btn {
    display: inline-grid; place-items: center; width: 32px; height: 32px;
    border: 1px solid transparent; border-radius: var(--radius-sm);
    background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: #eef2f7; color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-50); color: var(--danger); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); }
.field .error-text { font-size: 12px; color: var(--danger); }
input, select, textarea {
    width: 100%; height: 38px; padding: 0 12px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text);
    font: 14px var(--font);
    transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: var(--text-3); }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent); outline: none; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; padding: 0; accent-color: var(--primary); flex: none; }
input[type="file"] { padding: 7px 10px; height: auto; }
input.invalid, select.invalid { border-color: var(--danger); }
.input-group { position: relative; }
.input-group input { padding-right: 40px; }
.input-group .icon-btn { position: absolute; right: 3px; top: 3px; }
.input-search { position: relative; }
.input-search .i { position: absolute; left: 11px; top: 10px; color: var(--text-3); pointer-events: none; }
.input-search input { padding-left: 36px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-section { display: flex; flex-direction: column; gap: 14px; }
.form-section + .form-section { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--border); }
.form-section h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 650; }

/* ---------- Spinner & skeleton ---------- */
.spinner {
    width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid color-mix(in srgb, currentColor 25%, transparent); border-top-color: currentColor;
    animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, #eef2f7 25%, #f6f8fb 37%, #eef2f7 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.loading-block { display: grid; place-items: center; gap: 10px; padding: 60px 0; color: var(--text-3); }

/* ==========================================================================
   Auth
   ========================================================================== */
.auth-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(420px, .95fr); }
.auth-hero {
    position: relative; overflow: hidden;
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 44px 56px; color: #dbe6ff;
    background:
        radial-gradient(1200px 600px at -10% 110%, rgba(37, 99, 235, .55), transparent 60%),
        radial-gradient(800px 500px at 110% -10%, rgba(8, 145, 178, .45), transparent 60%),
        linear-gradient(160deg, #0b1324, #0f1e3d);
}
.auth-hero::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
    background-size: 36px 36px;
}
.auth-hero__brand { display: flex; align-items: center; gap: 12px; font-size: 18px; color: #fff; position: relative; z-index: 1; }
.auth-hero__copy { max-width: 520px; position: relative; z-index: 1; }
.auth-hero__copy h1 { font-size: 36px; line-height: 1.15; color: #fff; margin-bottom: 16px; }
.auth-hero__copy p { font-size: 16px; color: #b8c7e6; margin-bottom: 26px; }
.auth-hero__points { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.auth-hero__points li { display: flex; gap: 10px; align-items: flex-start; color: #d5e0f7; }
.auth-hero__points li::before { content: ""; width: 18px; height: 18px; flex: none; margin-top: 1px; border-radius: 50%; background: rgba(147, 197, 253, .18) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2393c5fd' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") center / 11px no-repeat; }
.auth-hero__art { color: #60a5fa; width: 100%; max-width: 480px; position: relative; z-index: 1; }
.auth-panel { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 40px 24px; background: var(--surface); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { font-size: 24px; margin-bottom: 6px; }
.auth-card .lead { color: var(--text-2); margin-bottom: 26px; }
.auth-card form { display: flex; flex-direction: column; gap: 16px; }
.auth-card .row-between { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.auth-card .switch { margin-top: 22px; text-align: center; color: var(--text-2); font-size: 13.5px; }
.auth-footer { margin-top: 40px; color: var(--text-3); font-size: 12px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

.strength { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 2px; }
.strength span { height: 4px; border-radius: 2px; background: var(--border); transition: background .2s; }
.strength[data-score="1"] span:nth-child(-n+1) { background: var(--danger); }
.strength[data-score="2"] span:nth-child(-n+2) { background: var(--warning); }
.strength[data-score="3"] span:nth-child(-n+3) { background: #65a30d; }
.strength[data-score="4"] span { background: var(--success); }
.policy { list-style: none; padding: 0; margin: 4px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 3px 12px; font-size: 12px; color: var(--text-3); }
.policy li::before { content: "○ "; }
.policy li.ok { color: var(--success); }
.policy li.ok::before { content: "● "; }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: var(--radius-sm); font-size: 13.5px; border: 1px solid; }
.alert .i { margin-top: 1px; }
.alert-info { background: var(--info-50); border-color: #a5e8f3; color: #155e75; }
.alert-success { background: var(--success-50); border-color: #a6e9bf; color: #166534; }
.alert-warning { background: var(--warning-50); border-color: #fcd9a0; color: #92400e; }
.alert-danger { background: var(--danger-50); border-color: #fbc5c5; color: #991b1b; }
.alert a { word-break: break-all; }

/* ==========================================================================
   App shell
   ========================================================================== */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.brand-mark {
    display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none;
    border-radius: 9px; font-weight: 800; font-size: 13px; color: #fff;
    background: linear-gradient(135deg, #3b82f6, #0891b2); box-shadow: 0 4px 14px rgba(37, 99, 235, .4);
}
.sidebar {
    position: sticky; top: 0; height: 100vh;
    display: flex; flex-direction: column;
    background: linear-gradient(180deg, var(--nav-bg), var(--nav-bg-2));
    color: var(--nav-text); border-right: 1px solid #1a2744;
}
.sidebar__brand { display: flex; align-items: center; gap: 11px; height: var(--topbar-h); padding: 0 18px; border-bottom: 1px solid rgba(255,255,255,.06); }
.sidebar__brand strong { display: block; color: #fff; font-size: 14.5px; }
.sidebar__brand span:not(.brand-mark) { display: block; font-size: 12px; color: #7f8eaa; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__nav { flex: 1; overflow-y: auto; padding: 8px 10px 14px; display: flex; flex-direction: column; gap: 2px; }
.nav-section { padding: 16px 10px 6px; font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: #5d6c89; font-weight: 650; }
.nav-link {
    display: flex; align-items: center; gap: 11px; height: 38px; padding: 0 12px;
    border-radius: 8px; color: var(--nav-text); font-weight: 520; text-decoration: none !important;
    transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(255,255,255,.05); color: #e2e8f5; }
.nav-link.active { background: rgba(59, 130, 246, .16); color: var(--nav-active); box-shadow: inset 3px 0 0 #3b82f6; }
.nav-link .badge-count { margin-left: auto; font-size: 11px; padding: 1px 7px; border-radius: 10px; background: rgba(255,255,255,.08); color: #cbd5e1; }
.sidebar__footer { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.06); }
.provider-chip { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #8b9ab5; }
.provider-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: #64748b; }
.provider-chip.ok .dot { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.18); }
.provider-chip.warn .dot { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.18); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 500;
    display: flex; align-items: center; gap: 16px;
    height: var(--topbar-h); padding: 0 24px;
    background: rgba(255,255,255,.92); backdrop-filter: saturate(1.4) blur(8px);
    border-bottom: 1px solid var(--border);
}
/* The menu button is always available: it hides/shows the pane on desktop and opens it on smaller screens. */
.topbar__menu { display: inline-grid; margin-left: -6px; }
.topbar__title { min-width: 0; }
.topbar__title h1 { font-size: 18px; }
.topbar__title p { font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.topbar__clock { font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 13px; padding: 0 12px; border-left: 1px solid var(--border); border-right: 1px solid var(--border); height: 32px; display: flex; align-items: center; gap: 6px; white-space: nowrap; }

.user-menu { position: relative; }
.user-menu__trigger { display: flex; align-items: center; gap: 10px; background: none; border: 0; cursor: pointer; padding: 4px 6px; border-radius: var(--radius-sm); font: inherit; color: inherit; text-align: left; }
.user-menu__trigger:hover { background: #eef2f7; }
.user-menu__meta strong { display: block; font-size: 13px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu__meta small { display: block; font-size: 11.5px; color: var(--text-3); }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, #1e3a8a, #2563eb); color: #fff; font-weight: 700; font-size: 13px; flex: none; }
.user-menu__panel { position: absolute; right: 0; top: calc(100% + 8px); width: 240px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; }
.user-menu__header { padding: 10px 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.user-menu__header strong { display: block; }
.user-menu__header small { color: var(--text-3); word-break: break-all; }
.user-menu__panel button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: var(--radius-sm); font: inherit; color: var(--text); cursor: pointer; text-align: left; }
.user-menu__panel button:hover { background: var(--surface-2); }

.view { padding: 22px 24px 40px; outline: none; min-width: 0; }
.view.view--flush { padding: 0; }

/* ---------- Page building blocks ---------- */
.page-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.page-toolbar .input-search { width: 300px; max-width: 100%; }
.page-toolbar select, .page-toolbar input[type="date"] { width: auto; min-width: 150px; }
.page-toolbar .spacer { flex: 1; }
.segmented { display: inline-flex; background: #e9edf3; padding: 3px; border-radius: 8px; gap: 2px; }
.segmented button { border: 0; background: none; padding: 5px 12px; border-radius: 6px; font: 550 12.5px var(--font); color: var(--text-2); cursor: pointer; }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); min-width: 0; }
.card__header { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card__header h2 { font-size: 15px; }
.card__header .muted { font-size: 12.5px; }
.card__header .actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.card__body { padding: 16px 18px; }
.muted { color: var(--text-3); }

.grid { display: grid; gap: 16px; }
.grid-kpi { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }

.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; cursor: default; }
button.kpi { text-align: left; font: inherit; color: inherit; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
button.kpi:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.kpi__top { display: flex; align-items: center; justify-content: space-between; color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.kpi__icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--primary-50); color: var(--primary); flex: none; }
.kpi__icon.green { background: var(--success-50); color: var(--success); }
.kpi__icon.amber { background: var(--warning-50); color: var(--warning); }
.kpi__icon.cyan { background: var(--info-50); color: var(--info); }
.kpi__icon.red { background: var(--danger-50); color: var(--danger); }
.kpi__value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi__value small { font-size: 14px; font-weight: 550; color: var(--text-3); margin-left: 3px; }
.kpi__foot { font-size: 12px; color: var(--text-3); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table.data th {
    text-align: left; font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em;
    color: var(--text-3); background: var(--surface-2); padding: 10px 14px; border-bottom: 1px solid var(--border);
    white-space: nowrap; user-select: none;
}
table.data thead tr:first-child th:first-child { border-top-left-radius: var(--radius-lg); }
table.data thead tr:first-child th:last-child { border-top-right-radius: var(--radius-lg); }
table.data th[data-sort] { cursor: pointer; }
table.data th[data-sort]:hover { color: var(--text); }
table.data th .sort-ind { opacity: .35; margin-left: 4px; }
table.data th.sorted .sort-ind { opacity: 1; color: var(--primary); }
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: #fafbfd; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.actions { width: 1%; white-space: nowrap; text-align: right; }
.cell-title { font-weight: 600; color: var(--text); }
.cell-sub { font-size: 12px; color: var(--text-3); }
.cell-flex { display: flex; align-items: center; gap: 10px; }
.table-footer { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-top: 1px solid var(--border); color: var(--text-3); font-size: 12.5px; }

.pill {
    display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px;
    border-radius: 11px; font-size: 12px; font-weight: 600; white-space: nowrap;
    background: #eef2f7; color: var(--text-2);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.pill.no-dot::before { display: none; }
.pill-blue { background: var(--primary-50); color: var(--primary-600); }
.pill-green { background: var(--success-50); color: #15803d; }
.pill-amber { background: var(--warning-50); color: #b45309; }
.pill-red { background: var(--danger-50); color: #b91c1c; }
.pill-cyan { background: var(--info-50); color: #0e7490; }
.pill-violet { background: #f3efff; color: #6d28d9; }

.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 6px; background: #eef2f7; color: var(--text-2); font-size: 12px; font-weight: 550; white-space: nowrap; }
.plate { display: inline-flex; align-items: center; height: 24px; padding: 0 8px 0 18px; border: 1.5px solid #1e293b; border-radius: 4px; font: 700 12px var(--mono); letter-spacing: .06em; background: #fff linear-gradient(90deg, #1d4ed8 0 11px, transparent 11px); color: #0f172a; white-space: nowrap; }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.vehicle-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: #eef2f7; color: var(--text-2); flex: none; }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 48px 24px; color: var(--text-2); }
.empty > .i { width: 40px; height: 40px; color: var(--text-3); }
.empty h3 { font-size: 15px; color: var(--text); }
.empty p { max-width: 380px; color: var(--text-3); }

.progress { height: 6px; border-radius: 3px; background: #e9edf3; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 3px; background: var(--primary); }
.progress.amber > span { background: var(--warning); }
.progress.red > span { background: var(--danger); }
.progress.green > span { background: var(--success); }

/* ---------- Checklist / onboarding ---------- */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px dashed var(--border); }
.checklist li:last-child { border-bottom: 0; }
.checklist .tick { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); color: transparent; flex: none; }
.checklist .tick .i { width: 12px; height: 12px; }
.checklist li.done .tick { background: var(--success); border-color: var(--success); color: #fff; }
.checklist li.done .label { color: var(--text-3); text-decoration: line-through; }
.checklist .label { flex: 1; }

.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
button.list-item { width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
button.list-item:last-child { border-bottom: 0; }
button.list-item:hover { background: var(--surface-2); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ==========================================================================
   Maps
   ========================================================================== */
.map { width: 100%; height: 100%; min-height: 320px; background: #e8edf3; z-index: 0; }
.map-card { overflow: hidden; }
.map-card .map { height: 420px; }
.leaflet-container { font-family: var(--font); }
.tiles-muted { filter: grayscale(.85) brightness(1.06) contrast(.92); }
.leaflet-popup-content-wrapper { border-radius: 10px; box-shadow: var(--shadow-lg); }
.leaflet-popup-content { margin: 12px 14px; font-size: 13px; line-height: 1.45; }
.map-popup strong { display: block; font-size: 13.5px; margin-bottom: 2px; }
.map-popup .muted { font-size: 12px; }
.stop-marker {
    display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
    color: #fff; font: 700 11.5px var(--font); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(15,23,42,.35);
}
.stop-marker.pickup { border-radius: 6px; }
.stop-marker.done { filter: saturate(.35) brightness(1.15); font-size: 13px; }
.stop-marker.onsite { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--warning); }
.stop-marker.skipped { opacity: .45; text-decoration: line-through; }

/* ---------------- Live tracking ---------------- */
.overview-live { overflow: hidden; }
/* Plan editing on the dispatch board */
.plan-tools { display: flex; align-items: center; gap: 10px; padding: 6px 12px; border-bottom: 1px solid var(--border); background: var(--surface); }
.plan-tools .muted { font-size: 11.5px; }
.stop-edit { display: flex; gap: 2px; margin-top: 4px; opacity: .55; transition: opacity .15s; }
.timeline li:hover .stop-edit, .stop-edit:focus-within { opacity: 1; }
@media (hover: none) { .stop-edit { opacity: 1; } }
.stop-edit .icon-btn { width: 26px; height: 26px; }
.stop-edit .icon-btn .i { width: 14px; height: 14px; }
.stop-edit .icon-btn:disabled { opacity: .3; cursor: default; }
.stop-edit .icon-btn.on { color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); }
.pin-pill { font-size: 10.5px; padding: 1px 6px; vertical-align: 1px; }
.pin-pill::before { display: none; }
.pin-pill .i { width: 11px; height: 11px; }
.timeline li[draggable="true"] { cursor: grab; }
.timeline li.dragging { opacity: .45; }
.timeline li.drop-before { box-shadow: inset 0 3px 0 var(--primary); }
.route-card.drop-target { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); }
.edit-warnings { margin: 10px 10px 0; position: relative; padding-right: 40px; }
.edit-warnings ul { margin: 4px 0 0; padding-left: 18px; }
.edit-warnings [data-close-warnings] { position: absolute; top: 8px; right: 8px; }
.unplanned-list [data-place-order] { margin-left: 4px; }
.route-card__actions { flex-wrap: wrap; }
.pick-list .crew-select { width: 190px; flex: none; font-size: 12.5px; padding: 4px 8px; height: 30px; }

/* Roles: hide what a role cannot change (the API refuses it anyway). */
body[data-role="Viewer"] #pageActions > *:not([data-go]):not(.run-picker),
body[data-role="Viewer"] :is([data-edit], [data-delete], [data-new-empty], [data-accept], [data-stop-action], [data-simulate],
    [data-stop-sim], [data-close-sim], [data-replan], [data-replan-run], [data-optimize], [data-export], [data-invite-app], [data-edit-plan],
    [data-tracking-link]),
body[data-role="Dispatcher"]:is([data-page="fleet"], [data-page="drivers"], [data-page="places"],
    [data-page="customers"], [data-page="planning"]) :is(#pageActions > *, [data-edit], [data-delete], [data-new-empty], [data-optimize], [data-invite-app]),
body[data-role="Dispatcher"][data-page="orders"] :is([data-import], [data-delete]) {
    display: none !important;
}
body[data-role="Viewer"] #table tbody tr,
body[data-role="Dispatcher"]:not([data-page="orders"]) #table tbody tr { cursor: default; }
.users-roles { margin-top: 12px; line-height: 1.6; }
.invite-link { width: 100%; font-family: var(--mono); font-size: 12px; }

/* Clickable rows and live cells */
#table .data tbody tr, tr.row-link { cursor: pointer; }
#table .data tbody tr:hover > td, tr.row-link:hover > td { background: #f5f8ff; }
.live-cell.clickable { cursor: pointer; border-radius: 6px; margin: -4px; padding: 4px; }
.live-cell.clickable:hover { background: #eef3ff; box-shadow: inset 0 0 0 1px #c7d7fe; }
#fleetStatus .vehicle-load { max-width: 230px; min-width: 190px; }
#fleetStatus .vehicle-load > span:first-child, #fleetStatus td[data-label="Distance"] { white-space: nowrap; }
.live-cell { min-width: 150px; }
.shift-bar { position: relative; height: 10px; min-width: 240px; margin: 2px 0 5px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.shift-bar > span { position: absolute; top: 0; bottom: 0; }
.shift-bar .shift-window { background: rgba(22, 163, 74, .12); box-shadow: inset 1px 0 0 rgba(22, 163, 74, .45), inset -1px 0 0 rgba(22, 163, 74, .45); }
.shift-bar .shift-planned { top: 3px; bottom: 3px; border-radius: 2px; background: repeating-linear-gradient(135deg, #93c5fd 0 3px, #dbeafe 3px 6px); }
.shift-bar .shift-worked { top: 2px; bottom: 2px; border-radius: 2px; background: #2563eb; }
.shift-bar .shift-forecast { top: 3px; bottom: 3px; border-radius: 2px; border: 1.5px dashed #2563eb; background: transparent; }
.shift-bar.risk .shift-forecast { border-color: var(--danger); }
.shift-bar .shift-break { top: 1px; bottom: 1px; border-radius: 2px; background: #fde68a; box-shadow: inset 0 0 0 1px #f59e0b; }
.shift-bar .shift-now { width: 2px; margin-left: -1px; background: var(--danger); }
.shift-text { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 6px; font-size: 12px; color: var(--text-2); }
.shift-text .live-chip { height: 19px; font-size: 11px; }
.order-steps { display: grid; gap: 2px; margin-top: 4px; }
.order-step { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.order-step b { font-weight: 650; color: var(--text); }
.order-step .step-dot { width: 8px; height: 8px; border-radius: 50%; border: 2px solid #94a3b8; background: #fff; flex: none; }
.order-step.done .step-dot { background: var(--success); border-color: var(--success); }
.order-step.onsite .step-dot { background: var(--warning); border-color: var(--warning); }
.order-step.next .step-dot { border-color: #2563eb; }
.order-step.risk .step-dot { border-color: var(--danger); }
.order-step.risk { color: var(--danger); }
.order-step.skipped { text-decoration: line-through; color: var(--text-3); }
.order-step .step-window { font-size: 11px; color: var(--text-3); }
.order-step .delay { padding: 0 4px; }
.vehicle-load { display: grid; grid-template-columns: auto minmax(60px, 120px) auto; align-items: center; gap: 6px; margin-top: 4px; font-size: 11.5px; color: var(--text-3); }
.vehicle-load .progress { height: 5px; }
.vehicle-load > span:last-child { white-space: nowrap; }
.sched-meta .vehicle-load { grid-template-columns: auto minmax(30px, 1fr) auto; margin-top: 0; }
.shift-warn { display: flex; align-items: center; gap: 4px; margin-top: 3px; font-size: 11.5px; font-weight: 600; color: var(--danger); }
.shift-warn .i { width: 13px; height: 13px; }
.live-cell .live-chip { height: 19px; font-size: 11px; }
.live-cell__text { margin-top: 3px; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.live-cell__text b { color: var(--text); }
.capacity-card { margin-top: 14px; }
.capacity-shift { min-width: 320px; }
.vehicle-today { min-width: 300px; }
.vehicle-today .vehicle-load { max-width: 320px; }
.capacity { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--success); white-space: nowrap; }
.capacity b { font-size: 14px; }
.capacity.low { color: var(--warning); }
.capacity.none { color: var(--danger); font-weight: 650; }
.capacity .i { width: 13px; height: 13px; }
td.road-time { white-space: nowrap; }
.road-time .road-live { font-variant-numeric: tabular-nums; }
.road-time .road-live.amber { color: var(--warning); }
.road-time .road-live.red { color: var(--danger); }
.road-time .road-eta { font-size: 10.5px; font-weight: 650; color: var(--text-3); }
.road-time .road-planned { display: block; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.overview-live .live-bar { border-bottom: 0; padding: 10px 14px; font-size: 12.5px; }
.overview-live__links { display: inline-flex; gap: 4px; margin-left: auto; }
.sched.live .sched-row:not(.sched-head) { min-height: 70px; }
.sched.live .seg { bottom: 21px; }
.sched.live .seg-depot { bottom: 19px; }
.sched.live .seg-wait { bottom: 27px; }
.act-track { position: absolute; inset: 0; pointer-events: none; --t: var(--success); }
.sched-overrun { position: absolute; top: 0; bottom: 0; pointer-events: auto; background: repeating-linear-gradient(135deg, rgba(220, 38, 38, .14) 0 4px, rgba(220, 38, 38, .04) 4px 8px); border-left: 1px dashed rgba(220, 38, 38, .6); }
.progress.shift-progress { position: relative; }
.progress.shift-progress > span { position: absolute; left: 0; top: 0; bottom: 0; background: #2563eb; }
.progress.shift-progress > span.expected { background: #bfdbfe; }
.progress.shift-progress.red > span.expected { background: #fecaca; }
.sched-shift-warn { display: flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 650; color: var(--danger); white-space: nowrap; }
.sched-shift-warn .i { width: 12px; height: 12px; }
.act-track.tone-late { --t: var(--warning); }
.act-track.tone-risk { --t: var(--danger); }
.act-track.tone-done { --t: #6366f1; }
.act-track.tone-idle { --t: #94a3b8; }
.act { position: absolute; }
.act-line { bottom: 9px; height: 3px; border-radius: 2px; background: var(--t); opacity: .55; }
.act-stop { bottom: 6px; height: 9px; border-radius: 2px; background: var(--t); }
.act-eta { bottom: 6px; height: 9px; border-radius: 2px; border: 1.5px dashed var(--t); background: color-mix(in srgb, var(--t) 10%, transparent); }
.act-stop.miss, .act-eta.miss { --t: var(--danger); }
.act-proj { bottom: 10px; height: 0; border-top: 2px dashed var(--t); opacity: .7; }
.act-now { bottom: 4px; width: 13px; height: 13px; margin-left: -6.5px; border-radius: 50%; background: var(--t); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(15, 23, 42, .4); }
.act-now.stale { background: #94a3b8; }
.act-label { position: absolute; bottom: 3px; margin-left: 5px; font-size: 10.5px; font-weight: 700; color: var(--t); white-space: nowrap; }
.seg-stop.done { filter: saturate(.35) brightness(1.1); }
.seg-stop.focus { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--text); z-index: 3; }
.seg-stop.faded { opacity: .3; }
.act.focus { box-shadow: 0 0 0 2px var(--text); z-index: 2; }
.act.faded { opacity: .3; }
.seg-stop.onsite { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--warning); z-index: 2; }
.seg-stop.skipped { opacity: .35; text-decoration: line-through; }
.sched-live-chip { margin-top: 2px; }
.sched-live-chip .live-chip { height: 19px; font-size: 11px; }
.sched-card .live-bar { border-bottom: 1px solid var(--border); }
.sched-live-legend { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; color: var(--text-3); }
.lg-actual { background: var(--success); height: 8px; }
.lg-forecast { background: transparent; border: 1.5px dashed var(--success); height: 8px; }
.btn-xs { height: 24px; padding: 0 8px; font-size: 11.5px; gap: 4px; border-radius: 6px; }
.btn-xs .i { width: 13px; height: 13px; }
.pulse { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; animation: pulse 1.6s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 55%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.live-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); background: linear-gradient(90deg, var(--success-50), var(--surface) 70%); font-size: 12px; color: var(--text-2); }
.live-bar.idle { background: var(--surface-2); justify-content: space-between; }
.live-bar.idle > span { display: inline-flex; align-items: center; gap: 6px; }
.live-bar__clock { display: inline-flex; align-items: center; gap: 6px; color: var(--success); font-weight: 650; }
.live-bar__clock b { color: var(--text); font-variant-numeric: tabular-nums; }
.live-bar__stats { display: inline-flex; flex-wrap: wrap; gap: 4px 10px; flex: 1; }
.live-stat b { font-variant-numeric: tabular-nums; color: var(--text); }
.live-stat.green b { color: var(--success); }
.live-stat.amber b { color: var(--warning); }
.live-stat.red b { color: var(--danger); }
.live-stat.grey b { color: var(--text-3); }

.route-live { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 7px; font-size: 12px; color: var(--text-2); }
.route-live__text b { color: var(--text); font-variant-numeric: tabular-nums; }
.route-progress { height: 3px; margin-top: 6px; border-radius: 2px; background: var(--border); overflow: hidden; }
.route-progress span { display: block; height: 100%; transition: width .6s ease; }
.live-chip { display: inline-flex; align-items: center; gap: 5px; height: 21px; padding: 0 8px; border-radius: 11px; font-size: 11.5px; font-weight: 650; white-space: nowrap; }
.live-chip .i { width: 13px; height: 13px; }
.live-chip.green { background: var(--success-50); color: var(--success); }
.live-chip.amber { background: var(--warning-50); color: var(--warning); }
.live-chip.red { background: #fef2f2; color: var(--danger); }
.live-chip.grey { background: var(--surface-2); color: var(--text-3); }
.live-chip.done { background: #eef2ff; color: #4338ca; }

.live-stop { display: flex !important; flex-wrap: wrap; align-items: center; gap: 2px 5px; margin-top: 3px; color: var(--text-2) !important; }
.live-stop .i { width: 13px; height: 13px; }
.live-stop.done { color: var(--success) !important; }
.live-stop.note { color: #6d28d9 !important; font-style: italic; }
.live-stop.onsite { color: var(--warning) !important; font-weight: 600; }
.live-stop.skipped { color: var(--text-3) !important; }
.live-stop.proof { color: var(--success) !important; }
.live-stop.missing { color: var(--warning) !important; font-weight: 600; }
/* Proof of delivery viewer */
.proof-view { display: grid; gap: 14px; }
.proof-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.proof-facts div { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.proof-facts span { display: block; font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; font-weight: 650; }
.proof-signature { border: 1px solid var(--border); border-radius: 10px; background: #fff; max-width: 100%; max-height: 180px; display: block; }
.link-btn.small { font-size: 11.5px; display: inline-flex; align-items: center; gap: 3px; margin-top: 2px; }
.link-btn.small .i { width: 12px; height: 12px; }
.tracking-url { width: 100%; font-family: var(--mono); font-size: 12px; }
.proof-far { color: var(--warning) !important; }
.proof-far .i { width: 14px; height: 14px; vertical-align: -2px; }
.proof-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.proof-photos a img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); display: block; }
.live-stop.risk { color: var(--danger) !important; }
.live-stop b { color: inherit; }
.delay { padding: 0 5px; border-radius: 4px; font-size: 11px; font-weight: 650; background: var(--surface-2); color: var(--text-2); }
.delay.green { background: var(--success-50); color: var(--success); }
.delay.amber { background: var(--warning-50); color: var(--warning); }
.delay.red { background: #fef2f2; color: var(--danger); }
.stop-actions { display: inline-flex; gap: 4px; margin-top: 4px; }
.route-km { margin-top: 5px; font-size: 12px; color: var(--text-2); }
.route-km b { color: var(--text); font-variant-numeric: tabular-nums; }
.route-card .vehicle-load { max-width: 300px; }
.route-shift { padding: 2px 0 10px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
.route-shift__label { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); margin-bottom: 4px; }
.route-shift .shift-bar { min-width: 0; }

.vehicle-marker-wrap { background: none; border: 0; transition: transform 1.8s linear; }
.leaflet-zoom-anim .vehicle-marker-wrap, .vehicle-still .vehicle-marker-wrap { transition: none; }
.vehicle-marker { position: relative; width: 36px; height: 36px; display: grid; place-items: center; }
.vehicle-dot { position: relative; z-index: 1; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--c); color: #fff; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(15, 23, 42, .35); }
.vehicle-dot svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.vehicle-heading { position: absolute; inset: -6px; z-index: 0; }
.vehicle-heading::before { content: ""; position: absolute; left: 50%; top: 0; transform: translateX(-50%); border: 7px solid transparent; border-bottom: 11px solid var(--c); border-top: 0; filter: drop-shadow(0 0 1px #fff); }
.vehicle-label { position: absolute; top: 34px; left: 50%; transform: translateX(-50%); z-index: 1; padding: 1px 5px; border-radius: 4px; background: rgba(11, 19, 36, .82); color: #fff; font-size: 10px; font-weight: 650; white-space: nowrap; letter-spacing: .02em; }
.vehicle-marker.late .vehicle-dot { box-shadow: 0 0 0 3px var(--warning), 0 2px 8px rgba(15, 23, 42, .35); }
.vehicle-marker.risk .vehicle-dot { box-shadow: 0 0 0 3px var(--danger), 0 2px 8px rgba(15, 23, 42, .35); }
.vehicle-marker.stale .vehicle-dot { background: #94a3b8; }
.vehicle-tip { font-size: 12px; line-height: 1.45; }
.vehicle-tip__head { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
@media (prefers-reduced-motion: reduce) { .vehicle-marker-wrap { transition: none; } .pulse { animation: none; } }
.depot-marker { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: #0b1324; color: #fff; border: 2px solid #fff; box-shadow: 0 3px 10px rgba(15,23,42,.45); }
.depot-marker svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 2; }
.place-marker { width: 14px; height: 14px; border-radius: 50%; border: 2.5px solid #fff; box-shadow: 0 1px 4px rgba(15,23,42,.4); background: var(--primary); }
.map-legend { background: rgba(255,255,255,.95); padding: 8px 10px; border-radius: 8px; box-shadow: var(--shadow); font-size: 12px; color: var(--text-2); display: grid; gap: 4px; }
.map-legend .row { display: flex; align-items: center; gap: 7px; }
.map-badge { white-space: nowrap; background: rgba(255,255,255,.96); padding: 5px 11px; border-radius: 16px; box-shadow: var(--shadow); font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.map-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
.map-badge.warn .dot { background: var(--warning); }

/* ==========================================================================
   Dispatch board
   ========================================================================== */
.dispatch { display: grid; grid-template-columns: 410px minmax(0, 1fr); height: calc(100vh - var(--topbar-h)); }
.dispatch__panel { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-right: 1px solid var(--border); }
.dispatch__head { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.dispatch__head .row { display: flex; gap: 8px; }
.dispatch__head .row select { flex: 1; min-width: 0; }
.dispatch__kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--border); border-bottom: 1px solid var(--border); }
.dispatch__kpis div { background: var(--surface); padding: 10px 12px; }
.dispatch__kpis strong { display: block; font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dispatch__kpis span { font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; font-weight: 650; }
.dispatch__list { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); }
.dispatch__map { position: relative; min-width: 0; }
.dispatch__map .map { height: 100%; }
.dispatch__map-overlay { position: absolute; top: 12px; left: 56px; z-index: 400; display: flex; gap: 8px; flex-wrap: wrap; }

.route-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: border-color .15s, box-shadow .15s, opacity .15s; flex: none; }
.route-card.selected { border-color: var(--route-color, var(--primary)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--route-color, var(--primary)) 18%, transparent); }
.route-card.dimmed { opacity: .62; }
.route-card__head { display: flex; gap: 12px; align-items: stretch; padding: 12px; cursor: pointer; background: none; border: 0; width: 100%; font: inherit; color: inherit; text-align: left; }
.route-card__bar { width: 4px; border-radius: 2px; background: var(--route-color, var(--primary)); flex: none; }
.route-card__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.route-card__title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.route-card__title strong { font-size: 14px; }
.route-card__title .pill { margin-left: auto; }
.route-card__meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--text-2); }
.route-card__meta span { display: inline-flex; align-items: center; gap: 4px; }
.route-card__meta .i { width: 14px; height: 14px; color: var(--text-3); }
.route-card__util { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-3); }
.route-card__util .progress { flex: 1; }
.route-card__body { border-top: 1px solid var(--border); padding: 6px 12px 12px; }
.route-card__actions { display: flex; gap: 6px; padding-top: 10px; }

.timeline { list-style: none; margin: 0; padding: 6px 0 0; position: relative; }
.timeline li { position: relative; display: grid; grid-template-columns: 48px 24px minmax(0, 1fr); gap: 10px; padding: 6px 0; }
.timeline li::before { content: ""; position: absolute; left: 69px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.timeline li:first-child::before { top: 50%; }
.timeline li:last-child::before { bottom: 50%; }
.timeline .eta { font: 650 12.5px var(--font); font-variant-numeric: tabular-nums; color: var(--text); text-align: right; padding-top: 3px; }
.timeline .node { position: relative; z-index: 1; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: #fff; font-size: 10.5px; font-weight: 700; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--border-strong); }
.timeline .node.pickup { border-radius: 6px; }
.timeline .node.depot { background: #0b1324; border-radius: 6px; }
.timeline .node.depot .i { width: 12px; height: 12px; }
.timeline .what { min-width: 0; }
.timeline .what strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timeline .what small { display: block; color: var(--text-3); font-size: 11.5px; }

/* ==========================================================================
   Drawer, modal, toast
   ========================================================================== */
.overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .42); z-index: 1000; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.drawer {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 1001;
    width: min(560px, 100vw); display: flex; flex-direction: column;
    background: var(--surface); box-shadow: var(--shadow-lg);
    animation: slide-in .2s ease;
}
.drawer.wide { width: min(760px, 100vw); }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }
.drawer__head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.drawer__head h2 { font-size: 17px; }
.drawer__head p { font-size: 12.5px; color: var(--text-3); }
.drawer__head .icon-btn { margin-left: auto; }
.drawer__body { flex: 1; overflow-y: auto; padding: 20px; }
.drawer__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }
.drawer__foot .left { margin-right: auto; }

.modal {
    position: fixed; z-index: 1001; left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow-y: auto;
    background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
    animation: pop .16s ease;
}
@keyframes pop { from { transform: translate(-50%, -48%) scale(.98); opacity: 0; } }
.modal__head { display: flex; gap: 12px; align-items: flex-start; padding: 20px 20px 0; }
.modal__head h2 { font-size: 16px; margin-bottom: 4px; }
.modal__head p { color: var(--text-2); }
.modal__body { padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 20px 20px; }
/* Re-plan the rest of the day */
.modal.modal--wide { width: min(860px, calc(100vw - 40px)); max-height: calc(100vh - 60px); display: flex; flex-direction: column; }
.modal--wide .modal__body { overflow-y: auto; }
.replan-body { display: flex; flex-direction: column; gap: 12px; }
.replan-summary { display: flex; flex-wrap: wrap; gap: 8px; }
.replan-stat { background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 13px; }
.replan-stat s { color: var(--text-3); }
.replan-stat .good, .replan-stat.good b { color: #15803d; }
.replan-stat .bad, .replan-stat.bad b { color: #b91c1c; }
.replan-note { background: #eff6ff; border-left: 3px solid #2563eb; border-radius: 6px; padding: 8px 12px; font-size: 13px; }
.replan-note.red { background: #fef2f2; border-color: #dc2626; }
.replan-routes { display: flex; flex-direction: column; gap: 10px; }
.replan-route { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.replan-route.changed { border-color: #93c5fd; background: #fbfdff; }
.replan-route__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.replan-back { margin-left: auto; font-size: 13px; }
.replan-back s, .replan-time s { color: var(--text-3); margin-right: 4px; }
.replan-stops { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.replan-stops li { display: grid; grid-template-columns: 96px 1fr auto; gap: 10px; align-items: center; font-size: 13px; padding: 3px 0; border-top: 1px dashed var(--border); }
.replan-stops li.late .replan-time b { color: #b91c1c; }
.replan-tags { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.replan-unplanned h4 { font-size: 13px; margin-bottom: 6px; }
.replan-unplanned ul { margin: 0; padding-left: 18px; font-size: 13px; display: flex; flex-direction: column; gap: 6px; }

.toast-root { position: fixed; right: 20px; bottom: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 40px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); background: #0f172a; color: #cbd5e1; box-shadow: var(--shadow-lg); animation: toast-in .2s ease; font-size: 13.5px; }
.toast .i { margin-top: 1px; }
.toast strong { display: block; color: #fff; }
.toast.success > .i { color: #4ade80; }
.toast.error > .i { color: #f87171; }
.toast.warning > .i { color: #fbbf24; }
.toast.info > .i { color: #60a5fa; }
.toast .icon-btn { margin-left: auto; color: #94a3b8; width: 24px; height: 24px; flex: none; }
.toast .icon-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ---------- Pickers inside drawers ---------- */
.pick-list { border: 1px solid var(--border); border-radius: var(--radius); max-height: 260px; overflow-y: auto; }
.pick-list label { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.pick-list label:last-child { border-bottom: 0; }
.pick-list label:hover { background: var(--surface-2); }
.pick-list .grow { flex: 1; min-width: 0; }
.pick-list .empty { padding: 20px; }
.pick-head { display: flex; align-items: center; gap: 10px; }
.pick-head .input-search { flex: 1; }
.pick-head .count { font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.stop-row { display: grid; grid-template-columns: 26px 130px minmax(0, 1fr) 32px; gap: 8px; align-items: center; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.stop-row + .stop-row { margin-top: 8px; }
.stop-window { grid-column: 2 / 5; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.stop-window input { width: 108px; height: 30px; padding: 0 8px; }
.stop-window .muted { font-size: 11.5px; }
.small { font-size: 12px; }
.unplanned-list { margin: 6px 0; padding-left: 18px; display: grid; gap: 2px; }
.timeline li.late .eta { color: var(--danger); font-weight: 700; }
.timeline .eta .eta-live { display: block; color: var(--text); }
.timeline .eta .eta-live.amber { color: var(--warning); }
.timeline .eta .eta-live.red { color: var(--danger); }
.timeline .eta s { display: block; font-size: 10.5px; font-weight: 500; color: var(--text-3); }
.stop-row .seq { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 11.5px; font-weight: 700; }
.mini-map { height: 240px; border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; }
.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 26px; text-align: center; color: var(--text-2); background: var(--surface-2); display: grid; gap: 8px; justify-items: center; }
.dropzone.drag { border-color: var(--primary); background: var(--primary-50); }

/* ==========================================================================
   Schedule (Gantt)
   ========================================================================== */
.flip { transform: scaleX(-1); }
.sched-toolbar .sched-date { display: flex; align-items: center; gap: 4px; }
.sched-toolbar .sched-date input { width: 150px; }
.sched-toolbar .input-search { margin-left: auto; width: 280px; }
.sched-summary { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; margin-bottom: 14px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.sched-summary div { background: var(--surface); padding: 10px 14px; }
.sched-summary strong { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.sched-summary strong small { font-size: 12px; font-weight: 550; color: var(--text-3); }
.sched-summary span { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 650; }

.sched-card { overflow: hidden; }
.sched-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--text-2); }
.sched-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sched-legend .muted { margin-left: auto; }
.lg { display: inline-block; width: 16px; height: 10px; border-radius: 3px; flex: none; }
.lg-drive { background: repeating-linear-gradient(135deg, #94a3b8 0 3px, #e2e8f0 3px 6px); }
.lg-depot { width: 4px; height: 12px; background: var(--nav-bg); border-radius: 1px; }
.lg-shift { background: rgba(22, 163, 74, .10); border: 1px dashed rgba(22, 163, 74, .5); }
.lg-wait { background: repeating-linear-gradient(90deg, #cbd5e1 0 2px, transparent 2px 5px); border: 1px solid #cbd5e1; }
.lg-break { background: #fde68a; border: 1px solid #f59e0b; }
.lg-late { background: #fff; box-shadow: inset 0 3px 0 var(--danger); border: 1px solid var(--border-strong); }

.sched-scroll { overflow: auto; max-height: calc(100vh - 290px); min-height: 240px; }
.sched { position: relative; min-width: calc(440px + var(--hours) * 58px); }
.sched-row { display: grid; grid-template-columns: 230px 210px minmax(0, 1fr); min-height: 58px; border-bottom: 1px solid var(--border); }
.sched-row:hover .sched-name, .sched-row:hover .sched-meta { background: #fafbfd; }
.sched-name, .sched-meta, .sched-meta-h { position: sticky; background: var(--surface); z-index: 2; }
.sched-name { left: 0; display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 16px; cursor: pointer; min-width: 0; }
.sched-name > div { min-width: 0; }
.sched-name .cell-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sched-meta, .sched-meta-h { left: 230px; padding: 8px 12px; border-right: 1px solid var(--border); display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.sched-meta .cell-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sched-hours { display: flex; align-items: baseline; gap: 4px; font-variant-numeric: tabular-nums; }
.sched-hours strong { font-size: 14px; }
.sched-hours span { color: var(--text-3); font-size: 12px; }
.sched-hours .pill { margin-left: auto; height: 18px; font-size: 10.5px; }
.avatar.sm { width: 30px; height: 30px; font-size: 11px; }

.sched-head { position: sticky; top: 0; z-index: 3; min-height: 38px; background: var(--surface-2); }
.sched-head .sched-name, .sched-head .sched-meta-h { background: var(--surface-2); font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); cursor: default; }
.sched-axis { position: relative; }
.sched-axis span { position: absolute; top: 11px; padding-left: 5px; border-left: 1px solid var(--border-strong); font-size: 11.5px; line-height: 16px; color: var(--text-2); font-variant-numeric: tabular-nums; }

.sched-lane { position: relative; background-image: repeating-linear-gradient(to right, var(--border) 0 1px, transparent 1px calc(100% / var(--hours))); }
.sched-row.idle .sched-name { opacity: .6; }
.sched-shift { position: absolute; top: 0; bottom: 0; background: rgba(22, 163, 74, .06); border-left: 1px dashed rgba(22, 163, 74, .45); border-right: 1px dashed rgba(22, 163, 74, .45); pointer-events: none; }
.sched-envelope { position: absolute; top: 5px; bottom: 5px; border-radius: 6px; background: color-mix(in srgb, var(--c) 7%, transparent); box-shadow: inset 3px 0 0 var(--c); cursor: pointer; }
.sched-envelope.conflict { outline: 2px dashed var(--danger); outline-offset: 1px; }
.sched-code { position: absolute; top: 1px; left: 7px; font-size: 10px; font-weight: 700; color: var(--c); letter-spacing: .02em; white-space: nowrap; }
.seg { position: absolute; top: 20px; bottom: 9px; border-radius: 3px; cursor: pointer; transition: filter .1s, box-shadow .1s; }
.seg-drive { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 55%, #fff) 0 3px, color-mix(in srgb, var(--c) 18%, #fff) 3px 6px); }
.seg-stop { background: var(--s); color: #fff; font-size: 10.5px; font-weight: 600; line-height: 29px; padding: 0 3px; overflow: hidden; white-space: nowrap; text-overflow: clip; box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); z-index: 1; }
.seg-stop.late { box-shadow: inset 0 3px 0 var(--danger), inset 0 0 0 1px rgba(255,255,255,.35); }
.seg-wait { top: 26px; bottom: 15px; background: repeating-linear-gradient(90deg, #94a3b8 0 2px, transparent 2px 5px); opacity: .7; }
.seg-break { background: #fde68a; box-shadow: inset 0 0 0 1px #f59e0b; color: #92400e; display: flex; align-items: center; justify-content: center; overflow: hidden; z-index: 1; }
.seg-break .i { width: 12px; height: 12px; }
.timeline .node.break { background: #f59e0b; }
.timeline .node.break .i { width: 12px; height: 12px; }
.seg-depot { width: 4px; margin-left: -2px; top: 16px; bottom: 7px; background: var(--nav-bg); border-radius: 1px; z-index: 1; }
.seg.hover { filter: brightness(1.08); box-shadow: 0 0 0 2px var(--text); z-index: 3; }
.sched-now { position: absolute; top: 0; width: 2px; margin-left: -1px; background: var(--danger); z-index: 4; pointer-events: none; }
.sched-now::before { content: attr(data-label); position: absolute; top: 27px; left: 50%; transform: translateX(-50%); padding: 0 5px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; line-height: 15px; white-space: nowrap; }

.sched-tip { position: fixed; left: 0; top: 0; z-index: 1500; width: 300px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); font-size: 12.5px; pointer-events: none; overflow: hidden; }
.tip-head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; font-weight: 650; border-bottom: 1px solid var(--border); }
.tip-seq { margin-left: auto; color: var(--text-3); font-weight: 600; }
.tip-body { display: grid; gap: 4px; padding: 10px 12px; }
.tip-body .pill { height: 18px; font-size: 10.5px; margin-left: 4px; }
.tip-note { margin-top: 2px; padding: 5px 8px; background: var(--warning-50); border-radius: 6px; color: #92400e; font-size: 12px; }
.tip-foot { padding: 7px 12px; background: var(--surface-2); color: var(--text-2); font-size: 11.5px; border-top: 1px solid var(--border); }
.tip-foot span { color: var(--text-3); }

.trip-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin-bottom: 14px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.trip-kpis > div { background: var(--surface); padding: 9px 12px; }
.trip-kpis > div > span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 650; }
.trip-kpis strong { font-size: 14px; font-variant-numeric: tabular-nums; }
.trip-map { height: 280px; margin-bottom: 14px; }
.trip-timeline li.active { background: var(--primary-50); border-radius: 8px; box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 30%, transparent); }

@media (max-width: 1180px) {
    .sched-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .sched-toolbar .input-search { margin-left: 0; }
}
@media (max-width: 768px) {
    .sched-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sched-row { grid-template-columns: 150px minmax(0, 1fr); } /* planned/shift column is hidden */
    .sched-meta, .sched-meta-h { display: none; }
    .sched { min-width: calc(150px + var(--hours) * 46px); }
    .sched-name { padding-left: 10px; }
    .sched-name .avatar { display: none; }
    .sched-legend .muted { display: none; }
    .sched-scroll { max-height: none; }
    .trip-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
.nav-backdrop { display: none; }

/* Desktop: navigation pane can be hidden; content takes the full width. */
@media (min-width: 1025px) {
    .app-shell { transition: grid-template-columns .2s ease; }
    .sidebar { transition: transform .2s ease, visibility .2s; }
    .app-shell.nav-hidden { grid-template-columns: 0 minmax(0, 1fr); }
    .app-shell.nav-hidden .sidebar { transform: translateX(-100%); visibility: hidden; overflow: hidden; border-right: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .app-shell, .sidebar { transition: none !important; }
}

/* Laptops */
@media (max-width: 1360px) {
    .grid-kpi { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
    .grid-2 { grid-template-columns: minmax(0, 1fr); }
    .dispatch { grid-template-columns: 350px minmax(0, 1fr); }
    .topbar__clock { display: none; }
}

/* Tablets: the sidebar collapses to an icon rail; the menu button expands it over the content. */
@media (max-width: 1024px) and (min-width: 769px) {
    .app-shell { grid-template-columns: 68px minmax(0, 1fr); }
    .main { grid-column: 2; } /* stays put while the expanded rail floats above it */
    .sidebar__brand { justify-content: center; padding: 0; }
    .sidebar__brand > div, .nav-link > span:not(.i), .provider-chip span:last-child { display: none; }
    .topbar__title p, .user-menu__meta { display: none; }
    .nav-section { height: 1px; padding: 0; margin: 10px 12px; background: rgba(255,255,255,.08); font-size: 0; }
    .nav-link { justify-content: center; padding: 0; }
    .sidebar__footer { display: flex; justify-content: center; }
    .topbar__menu { display: inline-grid; }
    .dispatch { grid-template-columns: 320px minmax(0, 1fr); }

    .app-shell.nav-open .sidebar { position: fixed; left: 0; z-index: 900; width: var(--sidebar-w); box-shadow: var(--shadow-lg); }
    .app-shell.nav-open .sidebar__brand { justify-content: flex-start; padding: 0 18px; }
    .app-shell.nav-open .sidebar__brand > div, .app-shell.nav-open .nav-link > span:not(.i), .app-shell.nav-open .provider-chip span:last-child { display: block; }
    .app-shell.nav-open .nav-section { height: auto; margin: 0; padding: 16px 10px 6px; background: none; font-size: 11px; }
    .app-shell.nav-open .nav-link { justify-content: flex-start; padding: 0 12px; }
    .app-shell.nav-open .sidebar__footer { justify-content: flex-start; }
    .app-shell.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 850; background: rgba(15, 23, 42, .35); }
}

/* Phones and portrait tablets: off-canvas navigation, stacked layouts. */
@media (max-width: 768px) {
    .auth-screen { grid-template-columns: 1fr; }
    .auth-hero { display: none; }
    .auth-panel { padding: 28px 18px; justify-content: flex-start; }

    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: fixed; left: 0; z-index: 900; width: min(var(--sidebar-w), 82vw); transform: translateX(-100%); transition: transform .2s ease; }
    .app-shell.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
    .app-shell.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 850; background: rgba(15, 23, 42, .45); animation: fade .15s ease; }

    .topbar { padding: 0 12px; gap: 10px; }
    .topbar__menu { display: inline-grid; }
    .topbar__title p { display: none; }
    .topbar__title h1 { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .user-menu__meta { display: none; }
    /* Page actions become icon buttons (their text nodes collapse, icons stay). */
    .topbar__actions .btn { font-size: 0; gap: 0; width: 36px; padding: 0; }
    .topbar__actions .btn .i { width: 18px; height: 18px; }

    .view { padding: 14px; }
    .form-grid { grid-template-columns: 1fr; }
    .grid-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .kpi { padding: 12px 14px; gap: 6px; }
    .kpi__value { font-size: 22px; }
    .kpi__icon { width: 28px; height: 28px; }

    .page-toolbar .input-search { flex: 1 1 100%; width: auto; }
    .page-toolbar select, .page-toolbar input[type="date"] { flex: 1 1 140px; min-width: 0; }
    .page-toolbar .spacer { display: none; }

    .card__header { flex-wrap: wrap; padding: 12px 14px; }
    .map-card .map { height: 300px; }
    #placesMap { height: 260px !important; }

    .dispatch { grid-template-columns: 1fr; height: auto; }
    .dispatch__map { height: 55vh; min-height: 320px; order: -1; }
    .dispatch__panel { border-right: 0; border-top: 1px solid var(--border); }
    .dispatch__list { overflow: visible; }
    .dispatch__map-overlay { left: 52px; right: 52px; }

    .drawer, .drawer.wide { width: 100vw; }
    .drawer__body { padding: 16px; }
    .drawer__foot { padding: 12px 16px; }
    .pick-head { flex-wrap: wrap; }
    .pick-head .input-search { flex: 1 1 100%; }
    .stop-row { grid-template-columns: 26px minmax(0, 1fr) 32px; }
    .stop-row [data-location] { grid-column: 2 / 3; }
    .stop-row [data-remove-stop] { grid-row: 1; grid-column: 3; }
    .stop-window { grid-column: 2 / 4; }

    .toast-root { left: 12px; right: 12px; bottom: 12px; width: auto; }
}

/* Phones: data tables turn into stacked cards (labels come from data-label). */
@media (max-width: 640px) {
    table.data--cards thead { display: none; }
    table.data--cards, table.data--cards tbody, table.data--cards tr, table.data--cards td { display: block; width: 100%; }
    table.data--cards tr { padding: 12px 14px; border-bottom: 1px solid var(--border); }
    table.data--cards tbody tr:last-child { border-bottom: 0; }
    table.data--cards tbody tr:hover td { background: none; }
    table.data--cards td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 0; border: 0; text-align: right; }
    table.data--cards td::before { content: attr(data-label); flex: none; text-align: left; font-size: 11px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
    table.data--cards td:first-child { display: block; text-align: left; padding-bottom: 8px; }
    table.data--cards td:first-child::before, table.data--cards td.actions::before, table.data--cards td[data-label=""]::before { display: none; }
    table.data--cards td.actions { justify-content: flex-end; width: 100%; padding-top: 8px; }
    table.data--cards td.num { text-align: right; }
    table.data--cards td > .cell-value { min-width: 0; }
    table.data--cards td:not(:first-child) > .cell-value .cell-flex { justify-content: flex-end; }
    table.data--cards td.actions > .cell-value { display: flex; gap: 4px; justify-content: flex-end; }
    .table-footer { padding: 10px 14px; }

    .grid-kpi { grid-template-columns: 1fr 1fr; }
    .kpi__foot { display: none; }
    .dispatch__kpis strong { font-size: 14px; }
    .modal { width: calc(100vw - 20px); }
    .auth-card h2 { font-size: 21px; }
}

/* Touch screens: bigger hit targets. */
@media (pointer: coarse) {
    .btn { min-height: 40px; }
    .btn-sm { min-height: 34px; }
    .icon-btn { width: 40px; height: 40px; }
    .nav-link { height: 44px; }
    input, select { height: 42px; font-size: 16px; } /* 16px avoids iOS zoom-on-focus */
}

/* Settings */
.settings { max-width: 760px; }
.settings .form-section { padding: 18px 22px; }
.policy-list { display: grid; gap: 8px; }
.policy { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; }
.policy:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, transparent); }
.policy input { margin-top: 3px; }
.settings__foot { display: flex; justify-content: flex-end; padding: 12px 20px 18px; }

/* Reports */
.report-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.report-range { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.report-range input { width: auto; }
#report { display: flex; flex-direction: column; gap: 16px; }
.kpi__value.good { color: var(--success); }
.kpi__value.bad { color: var(--danger); }
.report-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 1100px) { .report-grid { grid-template-columns: 1fr; } }
.report-days { display: flex; align-items: flex-end; gap: 6px; height: 190px; padding: 8px 18px 0; overflow-x: auto; }
.report-day { flex: 1 0 28px; display: flex; flex-direction: column; align-items: center; gap: 3px; height: 100%; }
.report-day b { font-size: 11px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.report-day small { font-size: 10.5px; color: var(--text-3); white-space: nowrap; }
.report-bar { flex: 1; width: 100%; max-width: 34px; display: flex; flex-direction: column; justify-content: flex-end; background: var(--surface-2); border-radius: 6px 6px 0 0; overflow: hidden; }
.report-bar .done, .report-legend .swatch.done { background: var(--primary); }
.report-bar .skipped, .report-legend .swatch.skipped { background: #f59e0b; }
.report-legend { font-size: 11.5px; color: var(--text-3); padding: 10px 18px 16px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.report-legend .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.report-reasons { list-style: none; margin: 0; padding: 0 18px 18px; display: grid; gap: 8px; }
.report-reasons li { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) 28px; align-items: center; gap: 8px; font-size: 13px; }
.report-reason-bar { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.report-reason-bar span { display: block; height: 100%; background: #f59e0b; }
.report-reasons b { text-align: right; font-variant-numeric: tabular-nums; }
.input-unit { display: flex; align-items: center; gap: 8px; }
.input-unit input { width: 110px; }
.input-unit span { color: var(--text-3); font-size: 13px; }
.audit-changes { font-size: 12.5px; color: var(--text-2); max-width: 560px; white-space: normal; }
.twofactor-steps { margin: 0 0 12px; padding-left: 20px; display: grid; gap: 8px; font-size: 13.5px; }
.twofactor-key { display: block; margin: 6px 0; padding: 8px 10px; background: var(--surface-2); border-radius: 8px; font: 600 15px var(--mono); letter-spacing: .06em; word-break: break-all; }
.row-actions { display: inline-flex; gap: 6px; align-items: center; }
.text-danger { color: var(--danger); }
.integration-help h4 { font-size: 13.5px; margin: 4px 0 6px; }
.integration-help h4:not(:first-child) { margin-top: 18px; }
.code-sample { margin: 8px 0 4px; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; font: 12px/1.5 var(--mono); overflow-x: auto; white-space: pre; }
.tracking-url { width: 100%; font-family: var(--mono); font-size: 12.5px; }
.tracking-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.btn.danger-text { color: var(--danger); }
.find-address { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
