/* Smart Dispatch board chrome. Loaded from App.razor (this app does not include
   ICOS.TMS.Web.styles.css, so .razor.css isolation never reaches the browser).
   Appointment backgrounds use !important: Syncfusion's CDN tailwind-lite.css is
   CORS-opaque and otherwise wins the cascade. */

.smart-dispatch-shell {
    background: #f8fafc;
}

.smart-dispatch-header {
    background-color: #1a1f2e;
    min-height: 52px;
}

/* Phase 1: nothing is saved. Plain, always-visible text, not a control. */
.smart-dispatch-preview-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #fde68a;
}

.smart-dispatch-nav-divider {
    width: 1px;
    height: 22px;
    background: rgba(255, 255, 255, 0.12);
    flex-shrink: 0;
}

.smart-dispatch-view-toggle {
    display: inline-flex;
    align-items: stretch;
    height: 28px;
    border: 1px solid #3a4155;
    border-radius: 0.5rem;
    overflow: hidden;
    background: transparent;
}

.smart-dispatch-view-toggle > button {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    border: 0;
    background: transparent;
    color: #888888;
    padding: 0 0.75rem;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    height: 28px;
}

.smart-dispatch-view-toggle > button.is-active {
    background-color: #0073CF;
    color: #ffffff;
}

.smart-dispatch-jobs-pane {
    width: 280px;
    flex-shrink: 0;
    background: #ffffff;
    border-right: 1px solid #e0e4e8;
    font-family: Inter, system-ui, sans-serif;
    transition: width 0.2s ease;
    overflow: hidden;
}

.smart-dispatch-jobs-pane.is-collapsed {
    width: 36px;
}

.smart-dispatch-detail-pane {
    width: 300px;
    flex-shrink: 0;
    background: #ffffff;
    border-left: 1px solid #e0e4e8;
    transition: width 0.2s ease;
    overflow: hidden;
}

.smart-dispatch-detail-pane.is-collapsed {
    width: 36px;
}

.smart-dispatch-pane-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.smart-dispatch-pane-collapse {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border: 0;
    border-radius: 0.25rem;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    flex-shrink: 0;
}

.smart-dispatch-pane-collapse:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.smart-dispatch-pane-rail {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    height: 100%;
    padding: 0.65rem 0.2rem;
    border: 0;
    background: #f8fafc;
    color: #475569;
    cursor: pointer;
}

.smart-dispatch-pane-rail:hover {
    background: #eff6ff;
    color: #0073CF;
}

.smart-dispatch-pane-rail-label {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.smart-dispatch-pane-rail-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.25rem;
    border-radius: 999px;
    background: #FCA841;
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
}

.smart-dispatch-legs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 38px;
    padding: 0 0.75rem;
    border-bottom: 1px solid #e0e4e8;
    flex-shrink: 0;
}

.smart-dispatch-legs-title {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.smart-dispatch-legs-zap {
    width: 0.85rem;
    height: 0.85rem;
    color: #FCA841;
}

.smart-dispatch-legs-title h2 {
    margin: 0;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #1a1f2e;
}

.smart-dispatch-legs-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1.2rem;
    padding: 0 0.4rem;
    border-radius: 999px;
    background: #e8ecf0;
    color: #64748b;
    font-size: 0.65rem;
    font-weight: 600;
}

.smart-dispatch-legs-filters {
    padding: 0.55rem 0.65rem 0.6rem;
    border-bottom: 1px solid #e0e4e8;
    flex-shrink: 0;
}

.smart-dispatch-search-wrap {
    position: relative;
}

.smart-dispatch-search-icon {
    position: absolute;
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0.85rem;
    height: 0.85rem;
    color: #94a3b8;
    pointer-events: none;
}

.smart-dispatch-search {
    width: 100%;
    height: 1.85rem;
    padding: 0 0.5rem 0 1.7rem;
    border: 1px solid #e0e4e8;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    color: #0f172a;
    background: #fff;
}

.smart-dispatch-leg-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* One line high also while empty, so a note that comes and goes does not shift the list. */
.smart-dispatch-legs-notice {
    min-height: 1rem;
    line-height: 1rem;
}

.smart-dispatch-legs-empty {
    margin: auto;
    padding: 1.5rem 0.75rem;
    text-align: center;
    font-size: 0.75rem;
    color: #94a3b8;
}

.smart-dispatch-job-card {
    position: relative;
    display: block;
    width: 100%;
    text-align: left;
    border: 1px solid #e0e4e8;
    border-radius: 8px;
    background: #fff;
    cursor: grab;
    overflow: hidden;
}

.smart-dispatch-job-card:hover {
    background: #fafbfc;
}

.smart-dispatch-job-card:hover .smart-dispatch-job-drag {
    opacity: 0.7;
}

.smart-dispatch-job-card.is-selected {
    border-color: #0073CF;
    background: #F0F7FF;
    box-shadow: 0 0 0 1px rgba(0, 115, 207, 0.35);
}

.smart-dispatch-job-card-accent {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
}

.smart-dispatch-job-card[data-job-type="Freight"] .smart-dispatch-job-card-accent { background: #0073CF; }
.smart-dispatch-job-card[data-job-type="Container"] .smart-dispatch-job-card-accent { background: #7B3FBF; }
.smart-dispatch-job-card[data-job-type="Hiab"] .smart-dispatch-job-card-accent { background: #B36A00; }
.smart-dispatch-job-card[data-job-type="Bulk"] .smart-dispatch-job-card-accent { background: #3A7D1C; }

.smart-dispatch-job-drag {
    position: absolute;
    right: 0.35rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    opacity: 0.35;
    pointer-events: none;
}

.smart-dispatch-job-card-body {
    padding: 0.625rem 1.75rem 0.625rem 0.75rem;
}

.smart-dispatch-job-row-id {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    min-width: 0;
}

.smart-dispatch-job-ref {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #1a1f2e;
    white-space: nowrap;
}

.smart-dispatch-linehaul-icon {
    width: 0.75rem;
    height: 0.75rem;
    color: #FCA841;
    flex-shrink: 0;
}

.smart-dispatch-job-row-route {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    margin-top: 0.35rem;
    min-width: 0;
    font-size: 11px;
    color: #1a1f2e;
}

.smart-dispatch-pin {
    width: 0.7rem;
    height: 0.7rem;
    flex-shrink: 0;
}

.smart-dispatch-pin.is-pickup { color: #0073CF; }
.smart-dispatch-pin.is-delivery { color: #e06b5c; }

.smart-dispatch-route-arrow {
    color: #cbd5e1;
    flex-shrink: 0;
    margin: 0 0.1rem;
}

.smart-dispatch-job-row-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    margin-top: 0.3rem;
    font-size: 10px;
    color: #94a3b8;
    min-width: 0;
}

.smart-dispatch-job-window {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}

.smart-dispatch-job-row-vehicle {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.3rem;
    font-size: 10px;
    color: #94a3b8;
}

.smart-dispatch-job-vehicle-id {
    font-weight: 500;
    color: #555555;
}

.smart-dispatch-job-driver {
    color: #999999;
}

.smart-dispatch-job-note {
    margin: 0.3rem 0 0;
    font-size: 9px;
    font-style: italic;
    color: #aaaaaa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.smart-dispatch-drop-hint {
    position: absolute;
    right: 0.25rem;
    top: 50%;
    transform: translateY(-50%);
    padding: 0.1rem 0.35rem;
    border-radius: 999px;
    background: #0073CF;
    color: #fff;
    font-size: 0.55rem;
    font-weight: 700;
    white-space: nowrap;
}

/* Allocation Detail panel header */
.smart-dispatch-detail-header {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    height: 38px;
    padding: 0 0.75rem;
    border-bottom: 1px solid #e0e4e8;
    flex-shrink: 0;
}

.smart-dispatch-detail-header h2 {
    margin: 0;
    flex: 1;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #1a1f2e;
}

.smart-dispatch-detail-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border: 0;
    border-radius: 0.25rem;
    background: transparent;
    color: #64748b;
    cursor: pointer;
}

.smart-dispatch-detail-close:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.smart-dispatch-detail-idle {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.25rem;
    text-align: center;
}

.smart-dispatch-idle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 999px;
    background: #f1f5f9;
    color: #94a3b8;
}

.smart-dispatch-detail-idle p {
    margin: 0;
    font-size: 0.75rem;
    line-height: 1.45;
    color: #64748b;
    max-width: 14rem;
}

.smart-dispatch-detail-section {
    padding: 0.75rem;
    border-bottom: 1px solid #f0f3f6;
}

.smart-dispatch-section-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0 0 0.5rem;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #aaaaaa;
}

.smart-dispatch-detail-ref {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #1a1f2e;
    line-height: 1.2;
}

.smart-dispatch-meta-row {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin: 0;
    font-size: 0.7rem;
    color: #64748b;
}

.smart-dispatch-route-card {
    display: flex;
    gap: 0.55rem;
    padding: 0.55rem 0.6rem;
    background: #f8f9fb;
    border: 1px solid #e8ecf0;
    border-radius: 0.4rem;
}

.smart-dispatch-route-rail {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 0.15rem;
}

.smart-dispatch-route-rail .is-pickup,
.smart-dispatch-route-rail .is-delivery {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 999px;
    flex-shrink: 0;
}

.smart-dispatch-route-rail .is-pickup { background: #0073CF; }
.smart-dispatch-route-rail .is-delivery { background: #e06b5c; }
.smart-dispatch-route-rail .is-line {
    width: 1px;
    flex: 1;
    min-height: 0.85rem;
    margin: 0.15rem 0;
    background: #cbd5e1;
}

.smart-dispatch-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.3rem;
    background: #1a1f2e;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}

.smart-dispatch-status-dot {
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 999px;
    flex-shrink: 0;
}

.smart-dispatch-status-dot.is-available { background: #22c55e; }
.smart-dispatch-status-dot.is-allocated { background: #0073CF; }

.smart-dispatch-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.05rem 0.4rem;
    border-radius: 999px;
    font-size: 0.6rem;
    font-weight: 600;
    line-height: 1.35;
    background: #e8eef5;
    color: #334155;
}

.smart-dispatch-pill.is-manual {
    background: #dbe4f0;
    color: #3b5b8a;
}

.smart-dispatch-pill.is-linehaul {
    background: #fef3c7;
    color: #b45309;
}

.smart-dispatch-pill.is-cancelled {
    background: #fee2e2;
    color: #b91c1c;
}

.smart-dispatch-pill[data-vbs-status="Booked"] {
    background: #dbeafe;
    color: #1e40af;
}

.smart-dispatch-pill[data-vbs-status="Manifested"] {
    background: #fef3c7;
    color: #92400e;
}

.smart-dispatch-pill[data-vbs-status="Cancelled"] {
    background: #fee2e2;
    color: #b91c1c;
}

.smart-dispatch-linked-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.55rem 0.6rem;
    border: 1px solid #e8ecf0;
    border-radius: 0.4rem;
    background: #fff;
}

.smart-dispatch-detail-actions {
    flex-shrink: 0;
    padding: 0.75rem;
    border-top: 1px solid #f0f3f6;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.smart-dispatch-primary-btn {
    height: 36px;
    width: 100%;
    border: 0;
    border-radius: 0.375rem;
    background: #0073CF;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}

.smart-dispatch-primary-btn:hover {
    background: #0060b0;
}

.smart-dispatch-danger-btn {
    height: 36px;
    width: 100%;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    background: #fff;
}

.smart-dispatch-danger-btn {
    border: 1px solid #fca5a5;
    color: #b91c1c;
}

.smart-dispatch-danger-btn:hover {
    background: #fef2f2;
}

.smart-dispatch-ghost-link {
    border: 0;
    background: transparent;
    color: #0073CF;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0;
    cursor: pointer;
}

.smart-dispatch-ghost-link.is-unlink:hover {
    color: #b91c1c;
}

.smart-dispatch-board-pane {
    background: #edf0f3;
    font-family: Inter, system-ui, sans-serif;
}

.smart-dispatch-board-header {
    display: flex;
    height: 38px;
    flex-shrink: 0;
    background: #f5f6f8;
    border-bottom: 1px solid #d8dce2;
    position: sticky;
    top: 0;
    z-index: 5;
}

.smart-dispatch-board-label-col {
    width: 200px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding: 0 0.65rem;
    border-right: 1px solid #d8dce2;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #888888;
}

.smart-dispatch-board-timeline-header {
    position: relative;
    flex: 1;
    min-width: 0;
    /* Hour labels thin out by the width of this track (container queries below). */
    container-type: inline-size;
}

/*
 * Hour labels never overlap. The widest label (the highlighted "is-now" pill) measured 38 px in
 * Chromium; with a 4 px gap one label needs 42 px. W = track width, 15 hours across:
 *   W >= 630 (42 × 15)   every hour
 *   W >= 315 (42 × 7.5)  every 2 h
 *   W >= 210 (42 × 5)    every 3 h (05, 08, 11, 14, 17, 20)
 *   below                every 5 h (05, 10, 15, 20)
 * Grid lines are not affected.
 */
@container (max-width: 629.98px) {
    .smart-dispatch-hour-label.is-off-2h { display: none; }
}

@container (max-width: 314.98px) {
    .smart-dispatch-hour-label.is-off-2h { display: inline; }
    .smart-dispatch-hour-label.is-off-3h { display: none; }
}

@container (max-width: 209.98px) {
    .smart-dispatch-hour-label.is-off-3h { display: inline; }
    .smart-dispatch-hour-label.is-off-5h { display: none; }
}

.smart-dispatch-hour-labels {
    position: absolute;
    inset: 0;
}

.smart-dispatch-hour-label {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 9px;
    font-weight: 700;
    color: #a0a6ae;
    white-space: nowrap;
}

/* The last label (20:00) sits on the track's right edge; right-align it so it stays inside the header. */
.smart-dispatch-hour-label:last-child {
    transform: translate(-100%, -50%);
}

.smart-dispatch-hour-label.is-now {
    color: #0073CF;
    background: #E8F3FC;
    padding: 0.1rem 0.35rem;
    border-radius: 999px;
}

.smart-dispatch-now-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #0073CF;
    opacity: 0.6;
    z-index: 10;
    pointer-events: none;
}

.smart-dispatch-now-line.is-header {
    opacity: 0.5;
}

.smart-dispatch-board-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.smart-dispatch-division-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    height: 26px;
    padding: 0 0.65rem;
    background: #e4e8ec;
    border-bottom: 1px solid #d8dce2;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #888888;
}

.smart-dispatch-division-header.has-top {
    border-top: 1px solid #d0d5dd;
}

.smart-dispatch-division-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.1rem;
    height: 1rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: #cfd5db;
    color: #555;
    font-size: 0.55rem;
}

.smart-dispatch-vehicle-row {
    display: flex;
    height: 92px; /* TimelineGeometry.TruckRowHeight; also set inline */
    background: #fff;
    border-bottom: 1px solid #e8ecf0;
}

.smart-dispatch-vehicle-row.is-alt {
    background: #f9fafb;
}

.smart-dispatch-vehicle-row.is-drop-target {
    outline: 2px solid #0073CF;
    outline-offset: -2px;
    z-index: 2;
}

.smart-dispatch-vehicle-info {
    width: 200px;
    flex-shrink: 0;
    padding: 0.35rem 0.55rem;
    border-right: 1px solid #e0e4e8;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.1rem;
    min-width: 0;
}

.smart-dispatch-vehicle-id-row {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    min-width: 0;
}

.smart-dispatch-vehicle-id {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #1a1f2e;
}

.smart-dispatch-vehicle-name {
    font-size: 10px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.smart-dispatch-vehicle-status {
    flex-shrink: 0;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: #f1f5f9;
    font-size: 9px;
    font-weight: 600;
    color: #475569;
}

.smart-dispatch-vehicle-driver {
    margin: 0;
    font-size: 10px;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.smart-dispatch-vehicle-location {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 10px;
    color: #64748b;
    min-width: 0;
}

.smart-dispatch-location-dot {
    width: 5px;
    height: 5px;
    border-radius: 999px;
    flex-shrink: 0;
}

.smart-dispatch-location-dot.is-moving,
.smart-dispatch-vehicle-location .is-moving { color: #7BBA34; }
.smart-dispatch-location-dot.is-moving { background: #7BBA34; }

.smart-dispatch-location-dot.is-onsite,
.smart-dispatch-vehicle-location .is-onsite { color: #FCA841; }
.smart-dispatch-location-dot.is-onsite { background: #FCA841; }

.smart-dispatch-location-dot.is-yard,
.smart-dispatch-vehicle-location .is-yard { color: #BDBDBD; }
.smart-dispatch-location-dot.is-yard { background: #BDBDBD; }

.smart-dispatch-timeline-track {
    position: relative;
    flex: 1;
    min-width: 0;
    /* Clip blocks sideways only, so the "+N more" list and tooltips can rise out of the row. */
    overflow-x: clip;
    overflow-y: visible;
    /* 15-minute cells: 60 across 05:00–20:00. Hour lines sit on top as spans. */
    background-image: linear-gradient(to right, #f0f2f5 1px, transparent 1px);
    background-size: calc(100% / 60) 100%;
}

.smart-dispatch-grid-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
}

.smart-dispatch-grid-line.is-even { background: #dde0e5; }
.smart-dispatch-grid-line.is-odd { background: #eaecef; }

.smart-dispatch-drop-hint {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 15;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: #0073CF;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    pointer-events: none;
    white-space: nowrap;
}

.smart-dispatch-job-block {
    position: absolute;
    top: 4px; /* lane offset is set inline */
    height: 26px; /* TimelineGeometry.BlockHeight */
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0 0.35rem 0 0.45rem;
    border: 1px solid transparent;
    border-radius: 0.35rem;
    background: #E8F3FC;
    color: #0055a5;
    cursor: grab;
    overflow: hidden;
    z-index: 3;
    text-align: left;
    min-width: 0;
}

.smart-dispatch-job-block:active { cursor: grabbing; }

.smart-dispatch-job-block-accent {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    /* Own corners, so the accent stays rounded while the block's overflow is opened for a tooltip. */
    border-radius: 0.3rem 0 0 0.3rem;
}

/* The block clips its content, which would also clip the VBS tooltip. While the badge is hovered, open the
   block and lift it above the VBS pills (z-index 20) so the tooltip is fully visible. */
.smart-dispatch-job-block:has(.smart-dispatch-job-vbs-badge:hover) {
    overflow: visible;
    z-index: 25;
}

.smart-dispatch-job-block[data-job-type="Freight"] .smart-dispatch-job-block-accent { background: #0073CF; }
.smart-dispatch-job-block[data-job-type="Container"] .smart-dispatch-job-block-accent { background: #7B3FBF; }
.smart-dispatch-job-block[data-job-type="Hiab"] .smart-dispatch-job-block-accent { background: #B36A00; }
.smart-dispatch-job-block[data-job-type="Bulk"] .smart-dispatch-job-block-accent { background: #3A7D1C; }

.smart-dispatch-job-block[data-status="Confirmed"] {
    background: #E8F3FC;
    border-color: #B1D4F5;
    color: #0055a5;
}

.smart-dispatch-job-block[data-status="Dispatched"] {
    background: #FFF8E1;
    border-color: #FFE082;
    color: #7a5200;
}

.smart-dispatch-job-block[data-status="OnSite"] {
    background: #EDF6E5;
    border-color: #C7DBAF;
    color: #2d6b14;
}

.smart-dispatch-job-block[data-status="Complete"] {
    background: #eceff1;
    border-color: #cfd8dc;
    color: #607d8b;
}

/* Fade the children, not the block: opacity on the block would also fade the VBS tooltip inside it. */
.smart-dispatch-job-block.is-past {
    background: #e8eaed !important;
    border-color: #d0d5dd !important;
    color: #90a4ae !important;
}

.smart-dispatch-job-block.is-past > :not(.smart-dispatch-job-vbs-badge) {
    opacity: 0.72;
}

.smart-dispatch-job-block.is-selected {
    border-width: 2px;
    box-shadow: 0 0 0 2px rgba(0, 115, 207, 0.25);
    z-index: 6;
}

.smart-dispatch-job-block[data-job-type="Container"].is-selected {
    box-shadow: 0 0 0 2px rgba(123, 63, 191, 0.25);
}

.smart-dispatch-job-block-content {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    min-width: 0;
    overflow: hidden;
}

.smart-dispatch-job-block-ref {
    font-size: 9px;
    font-weight: 700;
    white-space: nowrap;
}

.smart-dispatch-job-block-route {
    font-size: 8px;
    opacity: 0.85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.smart-dispatch-job-vbs-badge {
    position: relative;
    margin-left: auto;
    flex-shrink: 0;
    padding: 0.05rem 0.3rem;
    border-radius: 999px;
    background: #0073CF;
    color: #fff;
    font-size: 0.5rem;
    font-weight: 700;
    white-space: nowrap;
}

.smart-dispatch-job-vbs-badge.is-cancelled {
    background: #eceff1;
    color: #78909c;
    outline: 1px solid #e06b5c;
}

.smart-dispatch-vbs-pill {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    height: 20px;
    min-width: 44px;
    padding: 0 0.4rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 9px;
    font-weight: 700;
    cursor: grab;
    background: #FFF8E1;
    color: #B36A00;
    border-color: #FFE082;
}

.smart-dispatch-vbs-pill:active { cursor: grabbing; }

.smart-dispatch-vbs-pill[data-vbs-status="Manifested"] {
    background: #EDF6E5;
    color: #3A7D1C;
    border-color: #C7DBAF;
}

.smart-dispatch-vbs-pill[data-vbs-status="Cancelled"] {
    background: #eceff1;
    color: #78909c;
    border-color: #cfd8dc;
    cursor: not-allowed;
}

/* Fade the pill's content, not the pill: opacity on the pill would also fade its tooltip. */
.smart-dispatch-vbs-pill[data-vbs-status="Cancelled"] > :not(.smart-dispatch-board-tooltip) {
    opacity: 0.45;
}

.smart-dispatch-vbs-pill.is-manual {
    border-color: #7b8fa8;
    color: #3b5b8a;
    background: #e8eef5;
}

.smart-dispatch-vbs-pill.is-selected {
    box-shadow: 0 0 0 2px rgba(0, 115, 207, 0.3);
}

.smart-dispatch-vbs-manual-dot {
    width: 4px;
    height: 4px;
    border-radius: 999px;
    background: #3b5b8a;
}

.smart-dispatch-vbs-linked {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 999px;
    background: #0073CF;
    color: #fff;
    font-size: 0.5rem;
    font-weight: 700;
}

.smart-dispatch-board-tooltip {
    display: none;
    position: absolute;
    left: 50%;
    bottom: calc(100% + 6px);
    transform: translateX(-50%);
    z-index: 40;
    min-width: 10rem;
    max-width: 14rem;
    padding: 0.45rem 0.55rem;
    border-radius: 0.4rem;
    background: #1a1f2e;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 500;
    line-height: 1.35;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
    flex-direction: column;
    gap: 0.2rem;
    pointer-events: none;
    text-align: left;
}

.smart-dispatch-board-tooltip strong {
    font-size: 0.7rem;
}

/* The tooltip is a column flexbox; keep the status pill its own width instead of a full-width bar. */
.smart-dispatch-board-tooltip .smart-dispatch-pill {
    align-self: flex-start;
}

.smart-dispatch-board-tooltip em {
    font-style: italic;
    color: #fca5a5;
}

.smart-dispatch-vbs-pill:hover .smart-dispatch-board-tooltip,
.smart-dispatch-job-vbs-badge:hover .smart-dispatch-board-tooltip {
    display: flex;
}

/* —— Centre map panel —— */
.smart-dispatch-map-panel {
    position: relative;
    background: #e8ecf1;
}

.smart-dispatch-map-canvas {
    width: 100%;
    height: 100%;
}

.smart-dispatch-map-missing {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #888888;
    font-size: 0.875rem;
    background: #e8ecf1;
}

.smart-dispatch-map-legend {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 400;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
    padding: 8px 10px;
    min-width: 140px;
}

.smart-dispatch-map-legend-title {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #888888;
    margin-bottom: 6px;
}

.smart-dispatch-map-legend-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    color: #334155;
    margin-bottom: 4px;
}

/* Why some legs are not drawn (no map position). Bottom-left, clear of the legend and zone panel. */
.smart-dispatch-map-notice-region {
    position: absolute;
    left: 12px;
    bottom: 32px;
    z-index: 400;
    max-width: min(360px, calc(100% - 24px));
    pointer-events: none;
}

.smart-dispatch-map-notice {
    margin: 0;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
    padding: 8px 10px;
    font-size: 12px;
    color: #334155;
}

.smart-dispatch-map-legend-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 6px 0;
}

.sd-swatch {
    width: 10px;
    height: 10px;
    flex-shrink: 0;
    border: 1.5px solid #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.sd-swatch.is-circle { border-radius: 999px; }
.sd-swatch.is-square { border-radius: 2px; }

.smart-dispatch-zone-panel {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 400;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.14);
    overflow: hidden;
    transition: width 0.2s ease;
}

.smart-dispatch-zone-panel.is-open { width: 220px; }
.smart-dispatch-zone-panel.is-collapsed { width: 32px; }

.smart-dispatch-zone-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    height: 32px;
    padding: 0 8px;
    border: 0;
    background: transparent;
    font-size: 11px;
    font-weight: 700;
    color: #334155;
    cursor: pointer;
}

.smart-dispatch-zone-panel.is-collapsed .smart-dispatch-zone-toggle {
    justify-content: center;
    padding: 0;
}

.smart-dispatch-zone-list {
    max-height: 280px;
    overflow-y: auto;
    padding: 0 4px 6px;
}

.smart-dispatch-zone-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
}

.smart-dispatch-zone-row:hover {
    background: #eff6ff;
}

.sd-zone-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    margin-top: 3px;
    flex-shrink: 0;
}

.smart-dispatch-zone-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.smart-dispatch-zone-name {
    font-size: 10px;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.smart-dispatch-zone-meta {
    font-size: 9px;
    color: #94a3b8;
}

.smart-dispatch-zone-bar {
    display: flex;
    height: 4px;
    border-radius: 2px;
    overflow: hidden;
    background: #e2e8f0;
    margin-top: 2px;
}

.smart-dispatch-zone-bar .is-empty { flex: 1; background: #e2e8f0; }
.smart-dispatch-zone-bar .is-auto { background: #1D9E75; }
.smart-dispatch-zone-bar .is-suggested { background: #BA7517; }
.smart-dispatch-zone-bar .is-manual { background: #888780; }

.sd-zone-label {
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
    padding: 4px 6px;
    pointer-events: none;
    white-space: nowrap;
}

.sd-zone-label-name {
    font-size: 9px;
    font-weight: 700;
    color: #1e293b;
}

.sd-zone-label-meta {
    font-size: 8px;
    color: #94a3b8;
}

.sd-marker-depot {
    width: 22px;
    height: 22px;
    border-radius: 3px;
    background: #0073CF;
    border: 2px solid #fff;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.25);
}

.sd-marker-port-wrap {
    position: relative;
    width: 22px;
    height: 22px;
}

.sd-marker-port {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: #FA9678;
    border: 2px solid #fff;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.25);
}

.sd-marker-port-exception {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #F59E0B;
    color: #fff;
    font-size: 7px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.sd-marker-vehicle {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 2.5px solid #fff;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.28);
}

.sd-cluster {
    border-radius: 999px;
    border: 2px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
}

/* ---------- Timeline grid: lanes, resize, keyboard focus, last action ---------- */

/* Last action (left) and the VBS legend (right) share one row, so neither covers the hour labels. */
.smart-dispatch-board-toolbar {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 0.75rem;
    padding: 0.2rem 0.65rem;
    border-bottom: 1px solid #d8dce2;
    background: #fbfcfd;
}

.smart-dispatch-last-action {
    flex: 1;
    min-width: 0;
    margin: 0;
    color: #4b5563;
    font-size: 0.65rem;
}

/* Virtualisation spacers: exact heights from TimelineRowLayout; never give them borders or margins. */
.smart-dispatch-row-spacer {
    flex-shrink: 0;
}

.smart-dispatch-timeline-grid {
    position: relative;
}

.smart-dispatch-job-block-time {
    font-size: 8px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0.85;
}

.smart-dispatch-job-block-resize {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    /* A 15-minute block is ~15 px with a handle at each end: each keeps at most a fifth, the middle moves the block. */
    width: min(6px, 20%);
    cursor: ew-resize;
    z-index: 2;
}

.smart-dispatch-job-block-resize:hover {
    background: rgba(0, 115, 207, 0.25);
}

/* Picked up with the keyboard (Space): a dashed outline while it shows its preview place. The
   :focus-visible form outranks the solid focus outline below, since a picked-up block has focus. */
.smart-dispatch-job-block.is-picked-up,
.smart-dispatch-job-block.is-picked-up:focus-visible {
    outline: 2px dashed #0073CF;
    outline-offset: 2px;
    z-index: 6;
}

/* Start-edge handle: same size rule as the end handle, on the left (over the 3 px accent). */
.smart-dispatch-job-block-resize.is-start {
    right: auto;
    left: 0;
}

/* A job cut at the 05:00 or 20:00 edge: square, dashed edge plus a chevron on the cut side. */
.smart-dispatch-job-block.is-cut-start {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-left: 2px dashed currentColor;
}

.smart-dispatch-job-block.is-cut-end {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: 2px dashed currentColor;
    padding-right: 0.7rem;
}

.smart-dispatch-job-continues {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    pointer-events: none;
}

.smart-dispatch-job-continues.is-start { left: 2px; }
.smart-dispatch-job-continues.is-end { right: 2px; }

.smart-dispatch-focus-cell {
    position: absolute;
    top: 2px;
    bottom: 2px;
    z-index: 4;
    border-radius: 0.25rem;
    outline: none;
}

.smart-dispatch-focus-cell:focus-visible,
.smart-dispatch-job-block:focus-visible {
    outline: 2px solid #0073CF;
    outline-offset: 1px;
}

.smart-dispatch-focus-cell:focus-visible {
    background: rgba(0, 115, 207, 0.12);
}

.smart-dispatch-more-marker {
    position: absolute;
    bottom: 1px;
    z-index: 7;
    transform: translateX(2px);
    padding: 0 0.35rem;
    border-radius: 999px;
    background: #374151;
    color: #fff;
    font-size: 8px;
    font-weight: 700;
    line-height: 12px;
    white-space: nowrap;
}

.smart-dispatch-confirm-remove {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    padding: 0.3rem 0.65rem;
    border-bottom: 1px solid #f5c2c0;
    background: #fdf1f0;
    color: #7f1d1d;
    font-size: 0.7rem;
}

.smart-dispatch-confirm-remove button {
    padding: 0.1rem 0.6rem;
    border-radius: 0.3rem;
    font-weight: 600;
}

.smart-dispatch-confirm-remove-yes {
    background: #b91c1c;
    color: #fff;
}

.smart-dispatch-confirm-remove-no {
    background: #fff;
    border: 1px solid #d0d5dd;
    color: #374151;
}

.smart-dispatch-more-list {
    position: absolute;
    top: 4px;
    z-index: 25;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 9rem;
    padding: 0.25rem;
    border: 1px solid #d0d5dd;
    border-radius: 0.35rem;
    background: #fff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
}

.smart-dispatch-more-item {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    padding: 0.15rem 0.35rem;
    border-radius: 0.25rem;
    background: #E8F3FC;
    color: #0055a5;
    cursor: grab;
}

/* Drop-time guide: drawn by smart-dispatch-timeline.js during a drag. Fixed, so it is not inside the
   scrolled rows; never a drop target itself. */
.smart-dispatch-drop-guide {
    display: none;
    position: fixed;
    width: 0;
    border-left: 2px solid #0073cf;
    pointer-events: none;
    z-index: 30;
}

.smart-dispatch-drop-guide-label {
    display: none;
    position: fixed;
    transform: translateX(-50%);
    padding: 0 0.3rem;
    border-radius: 0.25rem;
    background: #0073cf;
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    pointer-events: none;
    z-index: 30;
}

/* —— Reduced motion ——
   The legs pane, the detail pane and the map zone panel slide (width transitions above). With
   "reduce motion" on, they and anything added later in the board snap instead of moving. */
@media (prefers-reduced-motion: reduce) {
    .smart-dispatch-shell *,
    .smart-dispatch-shell *::before,
    .smart-dispatch-shell *::after {
        transition: none !important;
        animation: none !important;
        scroll-behavior: auto !important;
    }
}
