:root {
    /* Dapper Delivery brand tokens - see /brand/STYLE_GUIDE.md.
       Monochrome charcoal + ivory with a single brass accent. */
    --ink: #1a1814;            /* charcoal - dark bars, on-dark ground */
    --ink-2: #14130f;          /* onyx - deepest */
    --ivory: #f4efe6;          /* cream - marks/text on dark */
    --bg: #1a1814;
    --sidebar-bg: #14130f;
    --surface: #ffffff;
    --content-bg: #fbf8f2;     /* warm paper */
    --border: #e6dfd2;         /* warm hairline */
    --text: #211e18;           /* warm near-black */
    --muted: #6e675b;          /* warm grey */
    --accent: #8a6d40;         /* text-safe brass: links, button text, focus */
    --brass: #b08d57;          /* brass fills: primary buttons, active nav */
    --brass-dark: #7e6435;     /* fill hover */
    --accent-soft: rgba(176, 141, 87, 0.14);
    --font-sans: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
    --font-display: "Cormorant Garamond", "EB Garamond", "Hoefler Text", Baskerville, Georgia, "Times New Roman", serif;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    color: var(--text);
    background: var(--content-bg);
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

h1 {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    margin: 0 0 1rem;
}

/* <FocusOnNavigate Selector="h1"> moves focus to the heading on every navigation (keeps keyboard/
   screen-reader users oriented). The focus move is what we want; the visible outline box around the
   heading isn't - a heading is not an interactive control, so suppress its ring only. */
h1:focus,
h1:focus-visible {
    outline: none;
}

h2 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 600;
    margin: 1.75rem 0 0.75rem;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.muted {
    color: var(--muted);
}

/* ---------- Layout ---------- */

.page {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    background: var(--sidebar-bg);
    color: var(--ivory);
    width: 240px;
    flex-shrink: 0;
    padding: 1.25rem 0.75rem;
    /* On iOS standalone (viewport-fit=cover + black-translucent status bar) the
       web view runs fullscreen behind the status bar / Dynamic Island. Reserve
       the inset so the brand/nav isn't hidden under the clock and island. */
    padding-top: max(1.25rem, env(safe-area-inset-top));
}

main {
    flex: 1;
    min-width: 0;
}

.content {
    padding: 1.5rem;
    max-width: 1200px;
}

/* ---------- Nav ---------- */

.nav-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.4rem;
    padding: 0.25rem 0.5rem 1.1rem;
    border-bottom: 1px solid rgba(244, 239, 230, 0.12);
    margin-bottom: 0.9rem;
}

/* Official gentleman emblem, framed as an ivory oval cameo (echoes the poster).
   The transparent PNG sits on the ivory medallion fill. */
.nav-brand .cameo {
    width: 78px;
    height: 84px;
    border-radius: 50%;
    background: var(--ivory);
    border: 2px solid var(--brass);
    box-shadow: 0 6px 18px rgba(20, 19, 15, 0.35);
    overflow: hidden;
    flex-shrink: 0;
}

.nav-brand .cameo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 8%;
    display: block;
}

.nav-brand .brand-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    line-height: 1.15;
}

.nav-brand .title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.2rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ivory);
}

.nav-brand .subtitle {
    font-size: 0.68rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--brass);
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 0.75rem;
    border-radius: 0.5rem;
    color: rgba(244, 239, 230, 0.72);
    font-weight: 500;
    white-space: nowrap;
}

.nav-link:hover {
    background: rgba(244, 239, 230, 0.08);
    color: var(--ivory);
    text-decoration: none;
}

.nav-link.active {
    background: var(--brass);
    color: var(--ink-2);
    font-weight: 600;
}

.nav-link .icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.2rem;
    height: 1.2rem;
    flex-shrink: 0;
}

.nav-link .icon svg {
    width: 100%;
    height: 100%;
}

/* ---------- Signed-in user chip (sidebar foot) ---------- */

/* Make the sidebar a column so the identity chip can settle at the bottom on desktop. */
.sidebar {
    display: flex;
    flex-direction: column;
}

.nav-user {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.85rem 0.75rem 0.25rem;
    border-top: 1px solid rgba(244, 239, 230, 0.12);
}

.nav-user-name {
    color: var(--ivory);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-user-role {
    color: var(--brass);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.nav-user-signout {
    margin-top: 0.35rem;
    color: rgba(244, 239, 230, 0.72);
    font-size: 0.85rem;
}

.nav-user-signout:hover {
    color: var(--ivory);
}

@media (max-width: 720px) {
    /* On the mobile sticky strip the chip shouldn't be pushed to the bottom. */
    .nav-user {
        margin-top: 0.5rem;
        flex-direction: row;
        align-items: baseline;
        flex-wrap: wrap;
        gap: 0.6rem;
    }
}

/* ---------- Error / status pages (403, 404, ...) ---------- */

.error-page {
    max-width: 30rem;
    margin: 3.5rem auto;
    text-align: center;
}

.error-page .error-code {
    font-size: 4.5rem;
    font-weight: 700;
    line-height: 1;
    color: var(--brass);
    margin-bottom: 0.5rem;
}

.error-page h1 {
    margin-bottom: 0.6rem;
}

.error-page .error-message {
    margin-bottom: 1.5rem;
}

/* ---------- Cards (dashboard) ---------- */

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    color: var(--text);
}

.card:hover {
    border-color: var(--accent);
    text-decoration: none;
}

.card-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.card-label {
    color: var(--muted);
    font-size: 0.9rem;
}

.status-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.status-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
}

.status-count {
    font-weight: 700;
}

/* ---------- Tables ---------- */

.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    overflow-x: auto;
}

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

table.data th,
table.data td {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

table.data th {
    background: #f7f3ec;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
    position: sticky;
    top: 0;
}

table.data tbody tr:last-child td {
    border-bottom: none;
}

table.data tbody tr:hover {
    background: #f7f3ec;
}

/* ---------- Badges ---------- */

.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-grey { background: #e2e8f0; color: #475569; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-amber { background: #fef3c7; color: #b45309; }
.badge-red { background: #fee2e2; color: #b91c1c; }

.alert {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
}

/* ---------- Buttons ---------- */

.btn-primary,
.btn-secondary,
.btn-sm,
.btn-move {
    font-family: inherit;
    font-weight: 600;
    border-radius: 0.5rem;
    cursor: pointer;
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--brass);
    color: var(--ink-2);
    padding: 0.55rem 1rem;
    font-size: 0.95rem;
}

.btn-primary:hover {
    background: var(--brass-dark);
    color: var(--ivory);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
    padding: 0.55rem 1rem;
    font-size: 0.95rem;
}

.btn-secondary:hover {
    border-color: var(--accent);
}

.btn-sm {
    background: var(--surface);
    color: var(--accent);
    border-color: var(--border);
    padding: 0.3rem 0.7rem;
    font-size: 0.82rem;
    white-space: nowrap;
}

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

.btn-sm.active {
    background: var(--brass);
    color: var(--ink-2);
    border-color: var(--brass);
}

.filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.btn-primary:disabled,
.btn-secondary:disabled,
.btn-sm:disabled,
.btn-move:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ---------- Form controls ---------- */

.field-label {
    display: block;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
    font-weight: 700;
    margin: 1rem 0 0.35rem;
}

.select,
.input,
.textarea {
    width: 100%;
    max-width: 32rem;
    padding: 0.6rem 0.75rem;
    font-size: 0.95rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
}

.textarea {
    resize: vertical;
    min-height: 3.5rem;
}

.select:focus,
.input:focus,
.textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* A scrollable list of checkboxes (e.g. scoping a driver to specific clients). */
.checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-width: 32rem;
    max-height: 12rem;
    overflow-y: auto;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--surface);
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    cursor: pointer;
}

/* Tighter, full-bleed variants for inputs sitting inside repeating rows/grids. */
.field-label.tight {
    margin-top: 0.5rem;
}

.input.compact,
.select.compact {
    max-width: none;
    padding: 0.45rem 0.6rem;
    font-size: 0.9rem;
}

/* A header row with the page heading on the left and a primary action on the right. */
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-head h1 {
    margin-bottom: 0;
}

.btn-danger {
    font-family: inherit;
    font-weight: 600;
    border-radius: 0.5rem;
    cursor: pointer;
    border: 1px solid #fecaca;
    background: #fee2e2;
    color: #b91c1c;
    padding: 0.3rem 0.7rem;
    font-size: 0.82rem;
    white-space: nowrap;
}

.btn-danger:hover {
    border-color: #f87171;
}

.btn-danger:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.row-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

/* A wider modal for the multi-section client editor. */
.modal.modal-wide {
    max-width: 44rem;
}

.modal-scroll {
    max-height: 70vh;
    overflow-y: auto;
    margin: 0 -0.25rem;
    padding: 0 0.25rem;
}

/* A repeating sub-record (a location row, a phone row) inside a form. */
.subrow {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.5rem 0.75rem;
    align-items: start;
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    padding: 0.75rem;
    margin-bottom: 0.6rem;
}

.subrow .subrow-fields {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
}

.subrow-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    gap: 0.4rem 0.6rem;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 1.5rem 0 0.5rem;
}

.section-head h3 {
    margin: 0;
    font-size: 0.95rem;
}

.inline-note {
    font-size: 0.82rem;
    color: var(--muted);
}

/* ---------- Result banner ---------- */

.banner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding: 0.7rem 1rem;
    border-radius: 0.5rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
    border: 1px solid;
}

.banner-ok {
    background: #dcfce7;
    border-color: #bbf7d0;
    color: #15803d;
}

.banner-err {
    background: #fee2e2;
    border-color: #fecaca;
    color: #b91c1c;
}

.banner-warn {
    font-size: 0.88rem;
    font-weight: 600;
}

.banner-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    font-size: 1rem;
    opacity: 0.7;
}

/* ---------- Modal ---------- */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(20, 19, 15, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 100;
}

.modal {
    background: var(--surface);
    border-radius: 0.75rem;
    padding: 1.5rem;
    width: 100%;
    max-width: 30rem;
    box-shadow: 0 10px 40px rgba(20, 19, 15, 0.3);
}

.modal h2 {
    margin: 0 0 0.25rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 1.5rem;
}

/* ---------- Route reorder list ---------- */

.route-list {
    list-style: none;
    margin: 1rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 48rem;
}

.route-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left-width: 4px;
    border-radius: 0.6rem;
    padding: 0.6rem 0.85rem;
}

.route-item.is-pickup { border-left-color: var(--ink); }
.route-item.is-dropoff { border-left-color: var(--brass); }
.route-item.is-done { opacity: 0.65; }

.route-seq {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 999px;
    background: var(--content-bg);
    color: var(--muted);
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.route-job {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--muted);
    white-space: nowrap;
}

.route-addr {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.route-move {
    display: flex;
    gap: 0.3rem;
    margin-left: auto;
    flex-shrink: 0;
}

.btn-move {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
    width: 2rem;
    height: 2rem;
    font-size: 1rem;
    line-height: 1;
}

.btn-move:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}

.route-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 1rem;
}

/* ---------- Blazor error UI ---------- */

#blazor-error-ui {
    background: #fef3c7;
    border-top: 1px solid #fcd34d;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.1);
    display: none;
    left: 0;
    padding: 0.75rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 0.75rem;
}

/* ---------- Mobile ---------- */

@media (max-width: 720px) {
    .page {
        flex-direction: column;
        min-height: 100dvh;
    }

    .sidebar {
        width: 100%;
        padding: 0.75rem;
        /* Sticky top bar on mobile sits under the status bar / island - reserve the inset. */
        padding-top: max(0.75rem, env(safe-area-inset-top));
        position: sticky;
        top: 0;
        z-index: 20;
    }

    .nav-brand {
        flex-direction: row;
        align-items: center;
        gap: 0.6rem;
        padding-bottom: 0.6rem;
        margin-bottom: 0.6rem;
    }

    .nav-brand .cameo {
        width: 40px;
        height: 40px;
    }

    .nav-brand .brand-text {
        align-items: flex-start;
    }

    /* Horizontal, swipeable nav strip - no JS hamburger needed. */
    .nav-links {
        flex-direction: row;
        overflow-x: auto;
        gap: 0.5rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .nav-links::-webkit-scrollbar {
        display: none;
    }

    .nav-link {
        padding: 0.55rem 0.85rem;
    }

    .content {
        padding: 1rem;
    }

    /* Reflow each table row into a stacked card with inline labels. */
    table.data thead {
        display: none;
    }

    table.data,
    table.data tbody,
    table.data tr,
    table.data td {
        display: block;
        width: 100%;
    }

    table.data tr {
        border-bottom: 8px solid var(--content-bg);
        padding: 0.35rem 0;
    }

    table.data td {
        border: none;
        padding: 0.3rem 1rem;
        display: flex;
        justify-content: space-between;
        gap: 1rem;
        text-align: right;
    }

    table.data td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--muted);
        text-align: left;
        text-transform: uppercase;
        font-size: 0.72rem;
        letter-spacing: 0.03em;
        padding-top: 0.1rem;
    }

    table.data tbody tr:hover {
        background: transparent;
    }
}

/* ---------- Activity feed ---------- */

.activity-head {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
}

.live-dot {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #15803d;
    animation: live-pulse 2s ease-in-out infinite;
}

@keyframes live-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.activity-feed {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    overflow: hidden;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-item.is-warning {
    background: #fef6f6;
    border-left: 3px solid #b91c1c;
}

.activity-icon {
    flex: 0 0 auto;
    width: 1.2rem;
    height: 1.2rem;
    margin-top: 0.1rem;
    color: var(--accent);
}

.activity-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.activity-item.is-warning .activity-icon {
    color: #b91c1c;
}

.activity-body {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.activity-summary {
    color: var(--text);
}

.activity-link {
    margin-left: 0.4rem;
    font-size: 0.8rem;
    color: var(--accent);
}

.activity-time {
    font-size: 0.76rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

/* ── Live Map ──────────────────────────────────────────────────────────────────────────────────────
   The fleet board: an Azure Maps control beside a driver/waiting/legend panel. Marker classes
   (.fleet-pin/.fleet-dot/.fleet-unassigned/.fleet-popup) style HTML markers the atlas SDK injects into
   the map DOM, so they live here with the rest of the app's styles rather than in the JS module. */
.map-head {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
}

.map-layout {
    display: flex;
    gap: 1rem;
    align-items: stretch;
    height: calc(100vh - 11rem);
    min-height: 480px;
}

.map-wrap {
    flex: 1 1 auto;
    min-width: 0;
}

.fleet-map {
    width: 100%;
    height: 100%;
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    overflow: hidden;
    background: #e9e4d8;
    /* Own stacking context below the sticky header (z-index 20) so the atlas
       zoom/compass controls can't paint over the chrome when the map scrolls
       up behind the header on mobile. */
    position: relative;
    z-index: 0;
}

.map-panel {
    flex: 0 0 320px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.map-panel-section {
    margin-bottom: 1.25rem;
}

.map-panel-section h2 {
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    margin: 0 0 0.5rem;
}

.fleet-swatch {
    display: inline-block;
    width: 0.8rem;
    height: 0.8rem;
    border-radius: 50%;
    flex: 0 0 auto;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15) inset;
}

.map-driver-list,
.map-waiting-list,
.map-legend ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.map-driver-list li {
    margin-bottom: 0.3rem;
}

.map-driver {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    width: 100%;
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.5rem 0.6rem;
    cursor: pointer;
    font: inherit;
    color: var(--text);
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.map-driver:hover:not(:disabled) {
    border-color: var(--brass);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.map-driver:disabled {
    opacity: 0.6;
    cursor: default;
}

.map-driver .fleet-swatch {
    margin-top: 0.2rem;
}

.map-driver-main {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    min-width: 0;
}

.map-driver-name {
    font-weight: 600;
}

.map-driver-sub,
.map-driver-loc {
    font-size: 0.78rem;
    color: var(--muted);
}

/* "Off shift" in the driver list means clocked off but still finishing assigned work - flagged, not hidden. */
.map-off-badge {
    color: #6b7177;
    font-weight: 600;
    border-bottom: 1px dashed #9aa0a6;
}

.map-waiting-list li {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    padding: 0.3rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

.map-waiting-num {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.fleet-urgent {
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #b91c1c;
    background: #fee2e2;
    border-radius: 0.3rem;
    padding: 0.05rem 0.3rem;
}

.map-legend ul li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    padding: 0.15rem 0;
}

.legend-glyph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 1.1rem;
    height: 1.1rem;
    font-size: 1rem;
    line-height: 1;
    color: var(--muted);
}

.legend-pin {
    background: var(--brass);
    border: 2px solid var(--ivory);
    border-radius: 50%;
    width: 1rem;
    height: 1rem;
    box-shadow: 0 0 0 1px var(--border);
}

.legend-pin-offshift {
    background: #c9c1b2;
    border-style: dashed;
    border-color: #a89c88;
    box-shadow: 0 0 0 1px rgba(110, 103, 91, 0.38);
}

.legend-unassigned {
    color: #8a6d40;
    font-weight: 700;
    font-size: 0.82rem;
    letter-spacing: -0.05em;
}

.map-legend-note {
    font-size: 0.76rem;
    margin-top: 0.5rem;
}

/* Map markers (injected by the atlas SDK into the map container) */
.fleet-pin {
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 50%;
    background: var(--c, #3f6f7d);
    border: 2px solid var(--ivory);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.fleet-pin.is-stale {
    opacity: 0.78;
    border-style: dashed;
}

/* Off shift but still carrying assigned deliveries: keep the driver's colour (identity) but ring it in
   grey so it reads as "winding down, not taking new work" at a glance. */
.fleet-pin.is-offshift {
    border-color: #a89c88;
    border-style: dashed;
    box-shadow: 0 0 0 3px rgba(110, 103, 91, 0.38), 0 1px 4px rgba(0, 0, 0, 0.35);
}

.fleet-pin-glyph {
    color: var(--ivory);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.fleet-dot {
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 0.3rem;
    background: var(--c, #3f6f7d);
    border: 1.5px solid var(--ivory);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.fleet-dot.is-next {
    box-shadow: 0 0 0 3px rgba(244, 239, 230, 0.7), 0 1px 3px rgba(0, 0, 0, 0.4);
}

.fleet-dot-glyph {
    color: var(--ivory);
    font-size: 0.62rem;
    line-height: 1;
}

.fleet-unassigned {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    background: #fbf8f2;
    border: 2px solid #8a6d40;
    color: #7e6435;
    font-weight: 700;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.fleet-unassigned-dropoff.is-approx {
    border-style: dashed;
}

/* Popup body (atlas renders the chrome; we style the content we inject) */
.fleet-popup {
    font-family: var(--font-sans);
    font-size: 0.82rem;
    color: var(--text);
    padding: 0.5rem 0.65rem;
    max-width: 240px;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: break-word;
}

.fleet-popup-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.2rem;
}

.fleet-popup-next {
    margin-top: 0.35rem;
}

.fleet-popup-label {
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    margin-right: 0.25rem;
}

@media (max-width: 900px) {
    .map-layout {
        flex-direction: column;
        height: auto;
    }

    .map-wrap {
        height: 60vh;
    }

    .map-panel {
        flex: 1 1 auto;
    }
}
