/* Operations Center — Dispatch Board 2.0 Phase 1 */

.dispatch-board {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px);
    overflow: hidden;
    background: var(--fo-bg, #0f172a);
    animation: dispatchFadeIn 0.35s ease;
}

.dispatch-board--mobile {
    height: auto;
    min-height: calc(100vh - 48px);
    overflow: auto;
}

@keyframes dispatchFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes dispatchFadeInItem {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.dispatch-fade-in {
    animation: dispatchFadeInItem 0.3s ease backwards;
}

/* ── Top bar ─────────────────────────────────────────────────── */
.dispatch-topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--fo-border, #334155);
    background: var(--fo-card, #172033);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.dispatch-page-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--fo-text-primary, #f1f5f9);
}

.dispatch-topbar-center {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    justify-content: center;
    flex-wrap: wrap;
}

.dispatch-topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.dispatch-date-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 4px 8px;
}

.dispatch-icon-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.dispatch-icon-btn:hover {
    background: #334155;
    color: #e2e8f0;
}

.dispatch-today-btn {
    border: none;
    background: #2563eb;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.dispatch-today-btn:hover { background: #1d4ed8; }

.dispatch-date-input {
    border: none;
    background: transparent;
    color: #e2e8f0;
    font-size: 0.85rem;
    padding: 4px 6px;
}

.dispatch-view-toggle {
    display: flex;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 3px;
}

.dispatch-view-btn {
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.dispatch-view-btn.active {
    background: #334155;
    color: #f1f5f9;
}

.dispatch-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 6px 12px;
    min-width: 180px;
}

.dispatch-search-wrap i { color: #64748b; }

.dispatch-search-input {
    border: none;
    background: transparent;
    color: #e2e8f0;
    font-size: 0.85rem;
    width: 140px;
    outline: none;
}

.dispatch-optimize-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #334155;
    background: #1e293b;
    color: #64748b;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 10px;
    cursor: not-allowed;
    opacity: 0.7;
}

/* ── Crew filter chips ───────────────────────────────────────── */
.dispatch-crew-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    border-bottom: 1px solid #1e293b;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.dispatch-crew-filter-label {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dispatch-crew-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #334155;
    background: #1e293b;
    color: #cbd5e1;
    font-size: 0.78rem;
    padding: 4px 10px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.dispatch-crew-chip.selected {
    background: #273449;
    color: #f1f5f9;
}

.dispatch-crew-chip:hover { background: #273449; }

.dispatch-crew-clear {
    border: none;
    background: none;
    color: #60a5fa;
    font-size: 0.75rem;
    cursor: pointer;
}

.dispatch-crew-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dispatch-crew-dot-lg {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Three-column layout ─────────────────────────────────────── */
.dispatch-columns {
    display: grid;
    grid-template-columns: 300px 1fr 320px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.dispatch-col {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.dispatch-col--left,
.dispatch-col--right {
    border-right: 1px solid #1e293b;
    background: #131c2e;
}

.dispatch-col--right {
    border-right: none;
    border-left: 1px solid #1e293b;
}

.dispatch-col--center {
    overflow: auto;
    background: #0f172a;
}

.dispatch-week-view {
    flex: 1;
    min-height: 0;
    padding: 8px;
    overflow: hidden;
}

.dispatch-week-view #fieldops-calendar {
    height: calc(100vh - 160px) !important;
}

/* ── Loading ─────────────────────────────────────────────────── */
.dispatch-loading {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dispatch-loading-inner {
    text-align: center;
    color: #94a3b8;
}

/* ── Work queue ──────────────────────────────────────────────── */
.dispatch-queue {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 16px;
    gap: 12px;
}

.dispatch-panel-header { margin-bottom: 4px; }

.dispatch-panel-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    color: #f1f5f9;
}

.dispatch-panel-sub {
    font-size: 0.75rem;
    color: #64748b;
    margin: 2px 0 0;
}

.dispatch-filters {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dispatch-filter-input,
.dispatch-filter-select {
    width: 100%;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 10px;
    color: #e2e8f0;
    font-size: 0.82rem;
    padding: 8px 10px;
}

.dispatch-filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.dispatch-quick-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.dispatch-chip {
    border: 1px solid #334155;
    background: #1e293b;
    color: #94a3b8;
    font-size: 0.72rem;
    padding: 4px 10px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.dispatch-chip.active,
.dispatch-chip:hover {
    background: #273449;
    color: #e2e8f0;
    border-color: #475569;
}

.dispatch-queue-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.dispatch-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    font-weight: 600;
    color: #94a3b8;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dispatch-count-badge {
    background: #334155;
    color: #e2e8f0;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 999px;
}

.dispatch-queue-scroll {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 4px;
}

.dispatch-queue-scroll--short { max-height: 200px; flex: none; }

.dispatch-wo-card,
.dispatch-job-card {
    display: block;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 14px;
    padding: 12px 14px;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.dispatch-wo-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
    border-color: #475569;
    text-decoration: none;
    color: inherit;
}

.dispatch-wo-card-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.dispatch-wo-number {
    font-size: 0.78rem;
    font-weight: 700;
    color: #60a5fa;
}

.dispatch-wo-customer {
    font-size: 0.75rem;
    color: #94a3b8;
}

.dispatch-wo-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #f1f5f9;
    margin: 4px 0;
    line-height: 1.3;
}

.dispatch-wo-meta {
    display: flex;
    gap: 10px;
    font-size: 0.72rem;
    color: #64748b;
}

.dispatch-status-badge {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 6px;
    background: #334155;
    color: #cbd5e1;
}

.dispatch-priority.priority-critical { color: #f87171; }
.dispatch-priority.priority-high { color: #fb923c; }
.dispatch-priority.priority-normal { color: #fbbf24; }
.dispatch-priority.priority-low { color: #64748b; }

.dispatch-empty {
    text-align: center;
    padding: 32px 16px;
    color: #64748b;
}

.dispatch-empty i {
    font-size: 2rem;
    display: block;
    margin-bottom: 8px;
    color: #475569;
}

.dispatch-empty p {
    font-weight: 600;
    color: #94a3b8;
    margin: 0 0 4px;
}

.dispatch-empty span { font-size: 0.78rem; }

.dispatch-empty--compact { padding: 20px 12px; }
.dispatch-empty--center { padding: 64px 24px; }

/* ── Crew dashboard ──────────────────────────────────────────── */
.dispatch-crew-dashboard {
    padding: 16px;
    min-height: 100%;
}

.dispatch-crew-columns {
    display: flex;
    gap: 16px;
    min-height: 100%;
    align-items: flex-start;
}

.dispatch-crew-column {
    flex: 1;
    min-width: 260px;
    max-width: 360px;
    background: #172033;
    border: 1px solid #334155;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.dispatch-crew-header {
    padding: 14px 16px;
    border-top: 4px solid #64748b;
    background: #1e293b;
    border-bottom: 1px solid #334155;
}

.dispatch-crew-header-top {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.dispatch-crew-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #f1f5f9;
}

.dispatch-crew-employees {
    font-size: 0.72rem;
    color: #64748b;
    margin-top: 2px;
}

.dispatch-crew-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.dispatch-metric-label {
    display: block;
    font-size: 0.62rem;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: 0.04em;
}

.dispatch-metric-value {
    font-size: 0.82rem;
    font-weight: 700;
    color: #f1f5f9;
}

.dispatch-metric-value.profit { color: #34d399; }

.dispatch-util-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.dispatch-util-label {
    font-size: 0.72rem;
    color: #94a3b8;
}

.dispatch-overbook-badge {
    font-size: 0.65rem;
    font-weight: 700;
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.15);
    padding: 2px 8px;
    border-radius: 6px;
}

.dispatch-util-bar {
    height: 6px;
    background: #0f172a;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 8px;
}

.dispatch-util-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.5s ease;
}

.dispatch-util-fill.util-green  { background: linear-gradient(90deg, #22c55e, #4ade80); }
.dispatch-util-fill.util-yellow { background: linear-gradient(90deg, #eab308, #facc15); }
.dispatch-util-fill.util-orange { background: linear-gradient(90deg, #f97316, #fb923c); }
.dispatch-util-fill.util-red    { background: linear-gradient(90deg, #ef4444, #f87171); }

.dispatch-crew-times {
    display: flex;
    gap: 12px;
    font-size: 0.72rem;
    color: #64748b;
}

/* Timeline */
.dispatch-timeline {
    display: flex;
    min-height: 520px;
    position: relative;
}

.dispatch-timeline-hours {
    width: 42px;
    flex-shrink: 0;
    padding: 8px 4px;
    border-right: 1px solid #1e293b;
}

.dispatch-hour-label {
    height: calc(100% / 13);
    font-size: 0.62rem;
    color: #475569;
    text-align: right;
    padding-right: 4px;
}

.dispatch-timeline-track {
    flex: 1;
    position: relative;
    margin: 8px 8px 8px 0;
    min-height: 500px;
}

.dispatch-hour-line {
    height: calc(100% / 12);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.dispatch-block {
    background: #273449;
    border: 1px solid #475569;
    border-left: 4px solid #64748b;
    border-radius: 10px;
    padding: 6px 8px;
    overflow: hidden;
    color: #f1f5f9;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.15s, box-shadow 0.15s;
    z-index: 1;
}

.dispatch-block:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    z-index: 2;
    color: #fff;
    text-decoration: none;
}

.dispatch-block-number {
    font-size: 0.68rem;
    font-weight: 700;
    color: #93c5fd;
}

.dispatch-block-customer {
    font-size: 0.62rem;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dispatch-block-title {
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.dispatch-block-time {
    font-size: 0.62rem;
    color: #64748b;
    margin-top: 2px;
}

.dispatch-block-status {
    font-size: 0.58rem;
    text-transform: uppercase;
    color: #64748b;
}

.dispatch-timeline-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #475569;
    font-size: 0.8rem;
    gap: 6px;
}

/* ── Advisor ─────────────────────────────────────────────────── */
.dispatch-advisor {
    padding: 16px;
    height: 100%;
    overflow-y: auto;
}

.dispatch-advisor-header {
    margin-bottom: 16px;
}

.dispatch-advisor-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dispatch-advisor-card {
    display: flex;
    gap: 12px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
    transition: border-color 0.15s;
}

.dispatch-advisor-card.alert {
    border-color: rgba(239, 68, 68, 0.4);
}

.dispatch-advisor-card--placeholder {
    border-style: dashed;
    border-color: #475569;
    opacity: 0.92;
}

.dispatch-advisor-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.dispatch-advisor-card-icon.overview { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.dispatch-advisor-card-icon.overbook { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.dispatch-advisor-card-icon.backlog  { background: rgba(168, 85, 247, 0.15); color: #c084fc; }
.dispatch-advisor-card-icon.jobs     { background: rgba(14, 165, 233, 0.15); color: #38bdf8; }
.dispatch-advisor-card-icon.billing  { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.dispatch-advisor-card-icon.weather  { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.dispatch-advisor-card-icon.ai       { background: rgba(99, 102, 241, 0.15); color: #818cf8; }

.dispatch-advisor-card-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #f1f5f9;
    margin-bottom: 4px;
}

.dispatch-advisor-stat-row {
    font-size: 0.78rem;
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dispatch-advisor-stat-row.muted { color: #64748b; }

.dispatch-advisor-highlight {
    font-size: 0.82rem;
    font-weight: 600;
    color: #e2e8f0;
}

.dispatch-advisor-muted {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 4px;
}

.dispatch-advisor-list {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
    font-size: 0.75rem;
    color: #94a3b8;
}

.dispatch-advisor-list li {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.dispatch-phase-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    color: #818cf8;
    background: rgba(99, 102, 241, 0.12);
    padding: 3px 10px;
    border-radius: 999px;
    margin: 4px 0;
}

/* CSS layout gates — reliable phone/tablet presentation without DeviceService races */
.dispatch-layout-mobile {
    display: none;
}

.dispatch-layout-desktop {
    display: block;
}

@media (max-width: 768px) {
    .dispatch-layout-mobile {
        display: block;
    }

    .dispatch-layout-desktop {
        display: none !important;
    }

    /* Avoid initializing pointer DnD on hidden desktop board */
    .dispatch-layout-desktop #dispatch-dnd-root {
        pointer-events: none;
    }
}

.dispatch-mobile {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dispatch-mobile-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.dispatch-mobile-stat {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 12px;
    text-align: center;
}

.dispatch-mobile-stat .val {
    display: block;
    font-size: 1.25rem;
    font-weight: 800;
    color: #f1f5f9;
}

.dispatch-mobile-stat .lbl {
    font-size: 0.65rem;
    color: #64748b;
    text-transform: uppercase;
}

.dispatch-mobile-section,
.dispatch-mobile-crew {
    background: #172033;
    border: 1px solid #334155;
    border-radius: 14px;
    overflow: hidden;
}

.dispatch-mobile-section summary,
.dispatch-mobile-crew summary {
    padding: 12px 14px;
    font-weight: 600;
    color: #e2e8f0;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dispatch-mobile-crew-meta {
    margin-left: auto;
    font-size: 0.72rem;
    color: #64748b;
    font-weight: 500;
}

.dispatch-mobile-crew-body {
    padding: 0 12px 12px;
}

.dispatch-mobile-wo {
    display: block;
    padding: 10px;
    background: #1e293b;
    border-radius: 10px;
    margin-bottom: 8px;
    text-decoration: none;
    color: inherit;
}

.dispatch-mobile-wo:hover {
    text-decoration: none;
    color: inherit;
    background: #273449;
}

@media (max-width: 1200px) {
    .dispatch-columns {
        grid-template-columns: 280px 1fr 280px;
    }
}

@media (max-width: 992px) {
    .dispatch-columns {
        grid-template-columns: 1fr;
        overflow: auto;
    }

    .dispatch-col--left,
    .dispatch-col--right {
        max-height: 400px;
        border-right: none;
        border-left: none;
        border-bottom: 1px solid #1e293b;
    }
}

/* ── Phase 2: Interactive dispatch ───────────────────────────── */
.dispatch-board--readonly .dispatch-wo-card--draggable,
.dispatch-board--readonly .dispatch-block--draggable {
    cursor: default;
}

.dispatch-readonly-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    background: rgba(59, 130, 246, 0.1);
    border-bottom: 1px solid rgba(59, 130, 246, 0.25);
    color: #93c5fd;
    font-size: 0.82rem;
}

.dispatch-columns--refreshing {
    opacity: 0.92;
    transition: opacity 0.2s ease;
}

/* Crew capacity header */
.dispatch-crew-capacity-row {
    margin: 8px 0;
}

.dispatch-util-bar--header {
    height: 8px;
    margin-bottom: 4px;
}

.dispatch-util-fill--animated {
    transition: width 0.5s ease, background 0.3s ease;
}

.dispatch-capacity-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
}

.dispatch-capacity-pct.util-orange,
.dispatch-capacity-pct.util-red {
    font-weight: 700;
}

.dispatch-capacity-pct.util-orange { color: #fb923c; }
.dispatch-capacity-pct.util-red    { color: #f87171; }

/* Timeline grid + now line */
.dispatch-timeline-track {
    background-image: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent calc(100% / 48 - 1px),
        rgba(255, 255, 255, 0.025) calc(100% / 48 - 1px),
        rgba(255, 255, 255, 0.025) calc(100% / 48)
    );
    transition: box-shadow 0.2s ease, background-color 0.2s ease;
}

.dispatch-timeline-track.drop-active {
    box-shadow: inset 0 0 0 2px rgba(59, 130, 246, 0.55);
    background-color: rgba(59, 130, 246, 0.06);
}

.dispatch-now-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: #ef4444;
    z-index: 3;
    pointer-events: none;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
}

.dispatch-now-line::before {
    content: "";
    position: absolute;
    left: -4px;
    top: -4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ef4444;
}

/* Blocks */
.dispatch-block-wrap {
    position: absolute;
    left: 0;
    right: 0;
    padding: 0 4px;
    z-index: 1;
    transition: top 0.35s ease, height 0.35s ease;
}

.dispatch-block-wrap .dispatch-block {
    position: relative;
    height: 100%;
    width: 100%;
}

.dispatch-block--draggable {
    cursor: grab;
    touch-action: pan-y;
}

.dispatch-block--draggable:active {
    cursor: grabbing;
}

.dispatch-drag-handle {
    position: absolute;
    top: 2px;
    right: 2px;
    z-index: 2;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.55);
    color: #cbd5e1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    touch-action: none;
}

.dispatch-wo-card .dispatch-drag-handle {
    position: static;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    background: rgba(51, 65, 85, 0.8);
}

.dispatch-block-move-btn {
    position: absolute;
    right: 4px;
    bottom: 4px;
    z-index: 2;
    padding: 0.15rem 0.4rem;
    font-size: 0.65rem;
    line-height: 1.2;
    opacity: 0.92;
}

.dispatch-block-move-label {
    margin-left: 2px;
}

@media (min-width: 1025px) {
    .dispatch-block-move-btn {
        opacity: 0;
    }
    .dispatch-block--hover .dispatch-block-move-btn,
    .dispatch-block:focus-within .dispatch-block-move-btn {
        opacity: 1;
    }
}

.dispatch-pointer-dragging,
.dispatch-pointer-dragging * {
    user-select: none;
    -webkit-user-select: none;
}

.dispatch-pointer-ghost {
    position: fixed;
    z-index: 10050;
    pointer-events: none;
    padding: 6px 10px;
    border-radius: 8px;
    background: #1d4ed8;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.dispatch-mobile-daybar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.25rem 0;
}

.dispatch-mobile-day-btn {
    min-width: 44px;
    min-height: 44px;
}

.dispatch-mobile-day-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    text-align: center;
    color: #e2e8f0;
}

.dispatch-mobile-wo-card {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 0.65rem;
}

.dispatch-mobile-wo--link {
    margin-bottom: 0;
}

.dispatch-mobile-action {
    min-height: 44px;
    width: 100%;
}

.dispatch-readonly-banner--mobile {
    margin: 0;
    border-radius: 10px;
}

.dispatch-mobile-queue {
    padding: 0 12px 12px;
}

.dispatch-wo-card--draggable {
    touch-action: pan-y;
}

.dispatch-wo-card--draggable .dispatch-drag-handle {
    touch-action: none;
}

.dispatch-block--dragging,
.dispatch-wo-card--dragging {
    opacity: 0.55;
    transform: scale(0.98);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.dispatch-block-insert {
    animation: dispatchBlockInsert 0.35s ease;
}

@keyframes dispatchBlockInsert {
    from { opacity: 0; transform: scaleY(0.85); }
    to   { opacity: 1; transform: scaleY(1); }
}

.dispatch-pulse {
    animation: dispatchCrewPulse 0.8s ease;
}

@keyframes dispatchCrewPulse {
    0%, 100% { box-shadow: none; }
    50%      { box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35); }
}

.dispatch-block-hover-card {
    position: absolute;
    left: calc(100% + 8px);
    top: 0;
    min-width: 160px;
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 0.72rem;
    z-index: 10;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
    pointer-events: none;
}

/* Queue cards */
.dispatch-wo-card--draggable {
    cursor: grab;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.dispatch-wo-card--draggable:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.dispatch-wo-card--draggable:active {
    cursor: grabbing;
}

.dispatch-wo-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dispatch-wo-card-head {
    flex: 1;
    min-width: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
}

.dispatch-wo-open {
    color: #64748b;
    padding: 4px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}

.dispatch-wo-open:hover {
    color: #93c5fd;
    background: rgba(59, 130, 246, 0.1);
}

.dispatch-wo-revenue {
    color: #34d399;
    font-weight: 600;
}

/* Modals */
.dispatch-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1040;
    animation: dispatchFadeIn 0.2s ease;
}

.dispatch-popover {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(380px, calc(100vw - 32px));
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 16px;
    z-index: 1050;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
    animation: dispatchPopIn 0.25s ease;
}

.dispatch-popover--wide {
    width: min(420px, calc(100vw - 32px));
}

@keyframes dispatchPopIn {
    from { opacity: 0; transform: translate(-50%, -48%) scale(0.96); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.dispatch-popover-header {
    padding: 16px 18px 8px;
    border-bottom: 1px solid #334155;
}

.dispatch-popover-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    color: #f1f5f9;
}

.dispatch-popover-sub {
    font-size: 0.78rem;
    color: #94a3b8;
    margin: 4px 0 0;
}

.dispatch-popover-body {
    padding: 14px 18px;
}

.dispatch-popover-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 18px 16px;
    border-top: 1px solid #334155;
}

.dispatch-popover-end {
    padding-top: 4px;
}

.dispatch-move-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 12px;
    align-items: center;
}

.dispatch-move-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: 0.04em;
}

.dispatch-move-value {
    font-weight: 700;
    color: #f1f5f9;
    font-size: 0.9rem;
}

.dispatch-move-time {
    font-size: 0.82rem;
    color: #94a3b8;
}

.dispatch-move-arrow {
    color: #64748b;
    font-size: 1.2rem;
}

/* Undo banner */
.dispatch-undo-banner {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    z-index: 1060;
    font-size: 0.88rem;
    color: #f1f5f9;
}

.dispatch-undo-dismiss {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 2px 6px;
}

.dispatch-undo-dismiss:hover {
    color: #e2e8f0;
}

/* Advisor Phase 2 */
.dispatch-advisor-card.info  { border-color: rgba(59, 130, 246, 0.35); }
.dispatch-advisor-card.warn  { border-color: rgba(234, 179, 8, 0.35); }

.dispatch-advisor-card-icon.idle     { background: rgba(100, 116, 139, 0.2); color: #94a3b8; }
.dispatch-advisor-card-icon.capacity { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.dispatch-advisor-card-icon.lowutil  { background: rgba(234, 179, 8, 0.15); color: #facc15; }

.dispatch-advisor-util {
    color: #64748b;
}

.dispatch-advisor-more {
    color: #64748b;
    font-style: italic;
}

/* ── Operations Copilot (Phase 1) ────────────────────────────── */
.dispatch-copilot {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.dispatch-copilot-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 24px 16px;
    color: #94a3b8;
    font-size: 0.85rem;
}

.dispatch-copilot-header {
    padding: 16px 16px 0;
}

.dispatch-copilot-greeting {
    font-size: 1.05rem;
    font-weight: 700;
    color: #f1f5f9;
    margin: 0 0 2px;
    line-height: 1.3;
}

.dispatch-copilot-health {
    margin: 0 16px;
    padding: 14px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 14px;
}

.dispatch-copilot-health-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    margin-bottom: 10px;
    font-weight: 600;
}

.dispatch-copilot-health-row {
    display: flex;
    gap: 14px;
    align-items: center;
}

.dispatch-score-ring {
    position: relative;
    width: 96px;
    height: 96px;
    flex-shrink: 0;
}

.dispatch-score-ring-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.dispatch-score-ring-bg {
    fill: none;
    stroke: #0f172a;
    stroke-width: 10;
}

.dispatch-score-ring-fill {
    fill: none;
    stroke-width: 10;
    stroke-linecap: round;
    stroke-dasharray: 326.73;
    transition: stroke-dashoffset 0.4s ease, stroke 0.3s ease;
}

.dispatch-score-ring-fill.score-green  { stroke: #22c55e; }
.dispatch-score-ring-fill.score-yellow { stroke: #eab308; }
.dispatch-score-ring-fill.score-orange { stroke: #f97316; }
.dispatch-score-ring-fill.score-red    { stroke: #ef4444; }

.dispatch-score-ring-value {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.dispatch-score-number {
    font-size: 1.5rem;
    font-weight: 800;
    color: #f1f5f9;
    line-height: 1;
}

.dispatch-score-of {
    font-size: 0.65rem;
    color: #64748b;
}

.dispatch-score-categories {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.dispatch-score-bar-head {
    display: flex;
    justify-content: space-between;
    font-size: 0.68rem;
    color: #94a3b8;
    margin-bottom: 2px;
}

.dispatch-score-bar-track {
    height: 4px;
    background: #0f172a;
    border-radius: 999px;
    overflow: hidden;
}

.dispatch-score-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.5s ease;
}

.dispatch-score-bar-fill.score-green  { background: #22c55e; }
.dispatch-score-bar-fill.score-yellow { background: #eab308; }
.dispatch-score-bar-fill.score-orange { background: #f97316; }
.dispatch-score-bar-fill.score-red    { background: #ef4444; }

.dispatch-copilot-group {
    padding: 0 16px 4px;
}

.dispatch-copilot-group-title {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    padding-left: 2px;
}

.dispatch-copilot-group-title.critical    { color: #f87171; }
.dispatch-copilot-group-title.warning     { color: #fb923c; }
.dispatch-copilot-group-title.opportunity { color: #4ade80; }
.dispatch-copilot-group-title.info        { color: #93c5fd; }

.dispatch-copilot-rec {
    display: flex;
    gap: 10px;
    padding: 12px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    margin-bottom: 8px;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    animation: dispatchFadeInItem 0.35s ease backwards;
}

.dispatch-copilot-rec:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.dispatch-copilot-rec.rec-critical { border-left: 3px solid #ef4444; }
.dispatch-copilot-rec.rec-warning  { border-left: 3px solid #f97316; }
.dispatch-copilot-rec.rec-opportunity { border-left: 3px solid #22c55e; }
.dispatch-copilot-rec.rec-info     { border-left: 3px solid #3b82f6; }

.dispatch-copilot-rec-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.05);
    color: #cbd5e1;
}

.dispatch-copilot-rec.rec-critical .dispatch-copilot-rec-icon { color: #f87171; background: rgba(239,68,68,0.12); }
.dispatch-copilot-rec.rec-warning .dispatch-copilot-rec-icon  { color: #fb923c; background: rgba(249,115,22,0.12); }
.dispatch-copilot-rec.rec-opportunity .dispatch-copilot-rec-icon { color: #4ade80; background: rgba(34,197,94,0.12); }
.dispatch-copilot-rec.rec-info .dispatch-copilot-rec-icon     { color: #93c5fd; background: rgba(59,130,246,0.12); }

.dispatch-copilot-rec-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #f1f5f9;
    line-height: 1.3;
    margin-bottom: 3px;
}

.dispatch-copilot-rec-desc {
    font-size: 0.72rem;
    color: #94a3b8;
    line-height: 1.35;
    margin-bottom: 6px;
}

.dispatch-copilot-rec-action {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #60a5fa;
    text-decoration: none;
    transition: color 0.15s;
}

.dispatch-copilot-rec-action:hover {
    color: #93c5fd;
    text-decoration: none;
}
