/* ============================================================================
   DISPATCH STYLES (GLOBAL)
   ============================================================================
   These classes MUST be global (not Blazor scoped) because the dispatch board
   (wwwroot/js/dispatchBoard.js via SortableJS) and the dispatch map
   (wwwroot/js/dispatchMap.js via Leaflet divIcons) create DOM elements at
   runtime. Scoped-component CSS injects a per-component attribute selector that
   JS-created nodes never receive, so any styling those nodes rely on has to
   live here.

   Kept visually consistent with the Board/Map pages and the wider app look
   (Bootstrap 5 greys, the #bfdbff / #0b3d91 lane-header blues, soft card
   shadows). Colors mirror the inline styles already in Board.razor / Map.razor.
   ============================================================================ */

/* ============================================================================
   SECTION FIELDSET  (Work Order Intake workflow)
   ----------------------------------------------------------------------------
   The intake page groups its workflow into <fieldset class="dispatch-section">
   blocks. Left unstyled these render with the browser-default near-black legend
   and border. We accent them with the dispatch navy (#1c3d5a) - the same slate
   blue used by the dispatch sub-nav - so the module reads as one system. Navy
   is the field-service/dispatch convention (reliable, calm) and, unlike the
   status palette (yellow/red/cyan/green/orange), never reads as a work order status.
   ============================================================================ */
.dispatch-section {
    border: 1px solid #c7d0da;
    border-top: 3px solid #1c3d5a;
    border-radius: 6px;
    padding: 10px 14px 14px;
    margin-bottom: 16px;
    background: #fff;
}

.dispatch-section > legend {
    width: auto;
    padding: 0 8px;
    margin-bottom: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1c3d5a;
}

/* ============================================================================
   WORK ORDER CARD  (class names REQUIRED by dispatchBoard.js)
   ============================================================================ */
.wo-card {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 6px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-left: 5px solid #6c757d;
    border-radius: 6px;
    padding: 6px 8px 6px 6px;
    min-width: 200px;
    max-width: 240px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
    cursor: pointer;
}

.unassigned-sidebar .wo-card {
    max-width: 100%;
    width: 100%;
    margin-bottom: 8px;
}

.wo-card-handle {
    display: flex;
    align-items: center;
    color: #adb5bd;
    cursor: grab;
    padding: 0 2px;
}

.wo-card-handle:active {
    cursor: grabbing;
}

.wo-card-body {
    min-width: 0;
    flex: 1 1 auto;
}

.wo-card-customer {
    font-weight: 700;
    font-size: .85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wo-card-problem {
    font-size: .78rem;
    color: #495057;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wo-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
    flex-wrap: wrap;
}

.wo-card-time {
    font-size: .68rem;
    color: #6c757d;
}

/* SortableJS visual-state hooks (referenced by dispatchBoard.js SORTABLE_OPTIONS) */
.wo-card-ghost {
    opacity: .4;
}

.wo-card-chosen {
    box-shadow: 0 0 0 2px #0d6efd;
}

.wo-card-flash {
    animation: dispatch-card-flash 1.2s ease-out;
}

@keyframes dispatch-card-flash {
    0% {
        box-shadow: 0 0 0 3px #ffc107;
    }

    100% {
        box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
    }
}

/* ============================================================================
   BOARD DROP TARGETS
   ============================================================================ */
.tech-row {
    min-height: 76px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
    background: #f8f9fa;
}

.unassigned-sidebar {
    min-height: 120px;
    max-height: calc(100vh - 220px);
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 6px 6px;
    background: #f8f9fa;
    padding: 8px;
}

/* ============================================================================
   STATUS COLOR HELPERS
   ============================================================================
   Keyed to the dispatch status codes. Apply as either a background chip
   (.status-*) or a left-border accent (.wo-card.status-*). JS-created cards
   can carry these class names directly.
     PEND  Pending    - yellow
     DISP  Dispatched - red
     TRAV  Traveling  - cyan
     SITE  On Site    - green
     COMP  Completed  - grey
     SUSP  Suspended  - orange
   ============================================================================ */
.status-PEND { background-color: #ffc107; color: #212529; }
.status-DISP { background-color: #dc3545; color: #fff; }
.status-TRAV { background-color: #0dcaf0; color: #212529; }
.status-SITE { background-color: #198754; color: #fff; }
.status-COMP { background-color: #6c757d; color: #fff; }
.status-SUSP { background-color: #fd7e14; color: #fff; }

/* Left-border accent variants for work order cards */
.wo-card.status-PEND { border-left-color: #ffc107; }
.wo-card.status-DISP { border-left-color: #dc3545; }
.wo-card.status-TRAV { border-left-color: #0dcaf0; }
.wo-card.status-SITE { border-left-color: #198754; }
.wo-card.status-COMP { border-left-color: #6c757d; }
.wo-card.status-SUSP { border-left-color: #fd7e14; }

/* Status pill / priority badge shared with the flyout */
.status-pill {
    display: inline-block;
    font-size: .68rem;
    font-weight: 700;
    color: #fff;
    padding: 1px 6px;
    border-radius: 10px;
    letter-spacing: .3px;
}

.priority-badge {
    font-size: .68rem;
    color: #6c757d;
    border: 1px solid #ced4da;
    border-radius: 10px;
    padding: 0 6px;
}

/* Repeat-visit indicator on a board card. */
.callback-badge {
    font-size: .68rem;
    color: #fff;
    background: #b02a37;      /* alert red - callbacks need attention */
    border-radius: 10px;
    padding: 0 6px;
    white-space: nowrap;
}

/* Maintenance-member indicator on a board card. */
.member-badge {
    font-size: .66rem;
    color: #1b6e3c;          /* agreements/billing green */
    border: 1px solid #1b6e3c;
    border-radius: 10px;
    padding: 0 6px;
    margin-left: 6px;
    white-space: nowrap;
}

/* ============================================================================
   INTAKE (online bookings + portal service requests review sidebar)
   ============================================================================ */
.dispatch-intake {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.dispatch-intake-col {
    flex: 1 1 320px;
    min-width: 300px;
    background: #f6f8fa;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    padding: .5rem;
}

.intake-card {
    background: #fff;
    border: 1px solid #e1e4e8;
    border-left: 4px solid #1c3d5a;   /* dispatch navy */
    border-radius: 6px;
    padding: .5rem .6rem;
    margin-bottom: .5rem;
}

/* ============================================================================
   FIELD TOOLS (mobile active-job: photos / checklist / signature / knowledge)
   ============================================================================ */
.dm-field-tools {
    margin-top: .75rem;
    border-top: 1px solid #e1e4e8;
    padding-top: .5rem;
}

.dm-tool-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    margin-bottom: .5rem;
}

.dm-tool-tab {
    flex: 1 1 auto;
    border: 1px solid #ced4da;
    background: #f6f8fa;
    border-radius: 6px;
    padding: .4rem .5rem;
    font-size: .8rem;
    cursor: pointer;
}

.dm-tool-tab.active {
    background: #1c3d5a;      /* dispatch navy */
    color: #fff;
    border-color: #1c3d5a;
}

/* File-picker styled as a button (used by the attachments panel). */
.dm-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    background: #1c3d5a;      /* dispatch navy */
    color: #fff;
    border-radius: 6px;
    padding: .4rem .7rem;
    font-size: .85rem;
    cursor: pointer;
}

.dm-upload-btn.disabled {
    opacity: .6;
    cursor: default;
}

/* ============================================================================
   CAPACITY CALENDAR (/dispatch/capacity)
   ============================================================================ */
.capacity-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: .5rem;
}

@media (max-width: 900px) {
    .capacity-grid { grid-template-columns: repeat(2, 1fr); }
}

.capacity-day {
    border: 1px solid #e1e4e8;
    border-top: 4px solid #adb5bd;
    border-radius: 8px;
    padding: .6rem;
    background: #fff;
}

.capacity-day.ok    { border-top-color: #1b6e3c; }   /* green - room */
.capacity-day.high  { border-top-color: #d9822b; }   /* amber - nearly full */
.capacity-day.full  { border-top-color: #b02a37; }   /* red - at/over */
.capacity-day.none  { border-top-color: #adb5bd; background: #f6f8fa; }
.capacity-day.today { box-shadow: 0 0 0 2px #1c3d5a inset; }

.capacity-day-header { display: flex; justify-content: space-between; align-items: baseline; }
.capacity-dow  { font-weight: 700; color: #1c3d5a; }
.capacity-date { font-size: .78rem; color: #6c757d; }

.capacity-numbers { margin: .3rem 0; }
.capacity-assigned { font-size: 1.5rem; font-weight: 700; }
.capacity-of { color: #6c757d; }

.capacity-bar {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.capacity-bar-fill { height: 100%; background: #1c3d5a; }
.capacity-day.full .capacity-bar-fill { background: #b02a37; }
.capacity-day.high .capacity-bar-fill { background: #d9822b; }
.capacity-day.ok   .capacity-bar-fill { background: #1b6e3c; }

.capacity-meta { font-size: .74rem; color: #6c757d; margin-top: .3rem; }

.capacity-legend { display: flex; flex-wrap: wrap; gap: 1rem; font-size: .8rem; color: #495057; }
.capacity-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: .3rem; vertical-align: middle; }
.capacity-swatch.ok   { background: #1b6e3c; }
.capacity-swatch.high { background: #d9822b; }
.capacity-swatch.full { background: #b02a37; }
.capacity-swatch.none { background: #adb5bd; }

/* ============================================================================
   TIME-WINDOW VIOLATIONS ALERT
   ============================================================================ */
.time-window-alert-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    padding: 8px 12px;
    font-weight: 600;
    color: #856404;
}

.time-window-alert-badge i {
    font-size: 1.2rem;
    color: #d9822b;
    animation: time-window-pulse 1.5s ease-in-out infinite;
}

.time-window-alert-badge .badge-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #d9822b;
    color: #fff;
    font-weight: 700;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 0.75rem;
    min-width: 24px;
}

.time-window-alert-badge .badge-text {
    font-size: 0.85rem;
}

/* Red pulsing animation for cards with < 30 min window */
.wo-window-closing-soon {
    animation: wo-close-pulse 1s ease-in-out infinite;
}

.wo-window-closing-soon .wo-card-timeline-full,
.wo-window-closing-soon .kanban-card-inner {
    border: 2px solid #dc3545;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.2);
}

/* Yellow border highlight for closest-window WO */
.wo-closest-window .wo-card-timeline-full,
.wo-closest-window .kanban-card-inner {
    border: 3px solid #ffc107;
    box-shadow: 0 0 8px rgba(255, 193, 7, 0.5);
}

@keyframes wo-close-pulse {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
    }
    50% {
        opacity: 0.9;
        box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.3);
    }
}

@keyframes time-window-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

/* ============================================================================
   MAP MARKERS  (class names REQUIRED by dispatchMap.js divIcons)
   ============================================================================ */
.dispatch-wo-pin {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dispatch-wo-pin-label {
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

.dispatch-tech-marker {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dispatch-tech-truck {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    background: #0ea5e9;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .4);
}

.dispatch-tech-heading {
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 8px solid #0ea5e9;
}

/* ============================================================================
   UNASSIGNED WORK ORDER SORT BUTTONS
   ============================================================================ */
.unassigned-sort-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    align-items: center;
}

.kanban-sort-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 10px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    border-radius: 0 0 0 0;
    justify-content: flex-start;
}

.sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: #fff;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.sort-btn:hover:not(.active) {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #212529;
}

.sort-btn.active {
    background: #0d6efd;
    color: #fff;
    border-color: #0b5ed7;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.25);
}

.sort-btn i {
    font-size: 0.8rem;
}

/* ============================================================================
   TECHNICIAN CAPACITY INDICATORS
   ============================================================================ */
.tech-noshow-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: #b02a37;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 12px;
    margin-left: 6px;
    white-space: nowrap;
}

.tech-noshow-badge i {
    font-size: 0.6rem;
}

/* Capacity Indicator (Timeline View) */
.tech-capacity-indicator {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin: 6px 0;
    padding: 6px 0;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.tech-capacity-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.capacity-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: #333;
}

/* Capacity Progress Bar */
.tech-capacity-bar {
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
    box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.05);
}

.tech-capacity-fill {
    height: 100%;
    transition: width 0.3s ease, background-color 0.3s ease;
}

/* Color Classes for Capacity Status */
.tech-capacity-bar.capacity-good .tech-capacity-fill {
    background: linear-gradient(90deg, #1b6e3c 0%, #28a745 100%);
    box-shadow: 0 0 4px rgba(27, 110, 60, 0.3);
}

.tech-capacity-bar.capacity-warning .tech-capacity-fill {
    background: linear-gradient(90deg, #d9822b 0%, #fd7e14 100%);
    box-shadow: 0 0 4px rgba(217, 130, 43, 0.3);
}

.tech-capacity-bar.capacity-critical .tech-capacity-fill {
    background: linear-gradient(90deg, #b02a37 0%, #dc3545 100%);
    box-shadow: 0 0 4px rgba(176, 42, 55, 0.3);
}

.tech-shift-time {
    font-size: 0.7rem;
    color: #666;
    display: flex;
    align-items: center;
    gap: 3px;
}

.tech-shift-time i {
    font-size: 0.65rem;
}

/* Capacity Indicator (Kanban View - Compact) */
.tech-capacity-indicator-kanban {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.tech-capacity-bar-small {
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.tech-shift-time-small {
    font-size: 0.65rem;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}

.tech-shift-time-small i {
    font-size: 0.6rem;
}

/* ============================================================================
   SEARCH/FILTER BAR
   ============================================================================
   Global styles for the dispatch board search and filter functionality.
   Complements inline styles in Board.razor for modal and quick filters.
   ============================================================================ */

/* Ensure proper overflow handling for filter containers on smaller screens */
@media (max-width: 768px) {
    .dispatch-filter-bar button {
        flex-shrink: 0;
    }

    .filter-search-section {
        flex-direction: column;
        width: 100%;
    }

    .filter-search-box {
        width: 100%;
    }
}

/* ============================================================================
   DRAG-ASSIST FEATURES
   ============================================================================ */

/* Drop zone highlighting during drag */
.tech-row.drop-zone-active {
    background-color: #cfe2ff !important;
    border: 2px dashed #0d6efd;
    border-radius: 6px;
    box-shadow: inset 0 0 6px rgba(13, 110, 253, 0.2);
}

.tech-column.drop-zone-active {
    background-color: #cfe2ff !important;
    border: 2px dashed #0d6efd;
    box-shadow: inset 0 0 6px rgba(13, 110, 253, 0.2);
}

.kanban-column.drop-zone-active {
    background-color: #cfe2ff !important;
    border: 2px dashed #0d6efd;
    box-shadow: inset 0 0 6px rgba(13, 110, 253, 0.2);
}

/* Capacity tooltip during drag */
.tech-capacity-tooltip {
    position: absolute;
    background: #1c3d5a;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    animation: capacity-tooltip-fade-in 0.2s ease-out;
}

@keyframes capacity-tooltip-fade-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wo-card-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #0d6efd;
}

.wo-card.multi-selected {
    background-color: #e7f1ff;
    border-color: #0d6efd;
    box-shadow: 0 0 0 2px #0d6efd;
}

/* Undo button styles */
.undo-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: #495057;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.undo-button:hover:not(:disabled) {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #212529;
}

.undo-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.undo-button.has-history {
    background: #0d6efd;
    color: #fff;
    border-color: #0b5ed7;
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.25);
}

/* Bulk selection mode indicator */
.bulk-select-mode {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    padding: 8px 12px;
    color: #856404;
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* ============================================================================
   BATCH OPERATIONS PANEL (Multi-Select)
   ============================================================================ */
.batch-operations-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
    background: linear-gradient(135deg, #e7f1ff 0%, #f0f5ff 100%);
    border: 2px solid #0d6efd;
    border-radius: 8px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.15);
}

.batch-operations-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #0c63e4;
    font-size: 0.95rem;
}

.batch-operations-info i {
    font-size: 1.1rem;
    animation: batch-pulse 1.5s ease-in-out infinite;
}

@keyframes batch-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.batch-count {
    font-weight: 600;
}

.batch-operations-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.batch-action-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.batch-action-label {
    font-weight: 500;
    font-size: 0.85rem;
    color: #495057;
    white-space: nowrap;
}

.batch-action-select {
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: #fff;
    color: #212529;
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    min-width: 200px;
}

.batch-action-select:focus {
    outline: none;
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

.batch-action-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.batch-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: #0d6efd;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.batch-action-btn:hover:not(:disabled) {
    background: #0b5ed7;
    box-shadow: 0 2px 6px rgba(13, 110, 253, 0.3);
}

.batch-action-btn:active:not(:disabled) {
    transform: translateY(1px);
}

.batch-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.batch-action-btn i {
    font-size: 0.9rem;
}

.batch-action-btn-secondary {
    background: #6c757d;
    color: #fff;
}

.batch-action-btn-secondary:hover:not(:disabled) {
    background: #5a6268;
    box-shadow: 0 2px 6px rgba(108, 117, 125, 0.3);
}

/* Work order card checkbox - hidden background by default, shown on card hover */
.wo-card-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: transparent;
    border: 2px solid transparent;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    position: static;
    z-index: auto;
}

.kanban-card-inner:hover .wo-card-checkbox,
.wo-timeline-card-container:hover .wo-card-checkbox {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(206, 212, 218, 0.6);
}

.wo-card-checkbox:hover {
    background: #fff;
    border-color: #0d6efd;
    box-shadow: 0 2px 6px rgba(13, 110, 253, 0.25);
}

.wo-card-checkbox input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: #0d6efd;
}

/* Selected work order card highlight */
.wo-card-selected {
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.3) !important;
    border: 2px solid #0d6efd !important;
}

.wo-card-selected .wo-card-checkbox {
    background: #0d6efd;
    border-color: #0d6efd;
}

.wo-card-selected .wo-card-checkbox input[type="checkbox"] {
    accent-color: #fff;
}

/* Drag handle: Thin line at top of card (Trello/Notion pattern) */
.kanban-card-drag-handle {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, rgba(28, 61, 90, 0.4), rgba(28, 61, 90, 0.6), rgba(28, 61, 90, 0.4));
    cursor: grab;
    transition: all 0.2s ease;
    flex-shrink: 0;
    border-radius: 6px 6px 0 0;
    display: block;
    z-index: 5;
}

.kanban-card-drag-handle:hover {
    background: linear-gradient(90deg, rgba(28, 61, 90, 0.7), rgba(28, 61, 90, 0.85), rgba(28, 61, 90, 0.7));
    height: 5px;
}

.kanban-card-drag-handle:active {
    cursor: grabbing;
    background: linear-gradient(90deg, #1c3d5a, #1c3d5a, #1c3d5a);
    height: 6px;
}

.kanban-card-drag-handle i {
    display: none;
}

.wo-timeline-card-container .kanban-card-drag-handle {
    display: none;
}

/* ============================================================================
   KANBAN CARD WRAPPER & ACTION MODAL
   ============================================================================ */
.kanban-card {
    display: flex;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    min-width: 200px;
    max-width: 240px;
}

.kanban-card-inner {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1;
    width: 100%;
    overflow: visible !important;
}

.kanban-card-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 8px 4px 8px;
    min-height: 28px;
    gap: 8px;
}

.kanban-card-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    background: #f0f0f0;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    color: #666;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-left: auto;
}

.kanban-card-action-btn:hover {
    background: #bbdefb !important;
    color: #1c3d5a !important;
    border-color: #64b5f6 !important;
}

.icon-preferred i {
    color: #f59e0b;
}

.icon-map i {
    color: #27ae60;
}

.icon-edit i {
    color: #3498db;
}

.icon-info i {
    color: #0056b3;
}

.icon-tools i {
    color: #dc3545;
}

.kanban-action-modal {
    position: fixed;
    background: #fff;
    border: 2.5px solid #000;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    z-index: 2000;
    width: auto;
    min-width: 0;
    padding: 0;
}

.kanban-action-modal-header {
    display: none;
}

.kanban-action-modal-close {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    color: #111;
    border: 2px solid #000;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0;
    transition: background 0.2s ease;
}

.kanban-action-modal-close:hover {
    background: #f3f4f6;
}

.kanban-action-modal-buttons {
    display: flex;
    flex-direction: row;
    gap: 2px;
    padding: 4px;
    align-items: center;
}

.action-modal-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: #fff;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    color: #333;
    transition: all 0.2s ease;
    text-decoration: none;
    flex-shrink: 0;
}

.action-modal-btn:hover {
    background: #f3f4f6;
}

.action-modal-btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 1px;
}

.action-modal-btn i {
    font-size: 16px;
}

.action-modal-btn span {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Semantic icon colors */
.action-modal-btn[title*="Reassign"] i {
    color: #2563eb;
}

.action-modal-btn[title*="Auto-assign"] i {
    color: #7c3aed;
}

.action-modal-btn[title*="Change work order status"] i {
    color: #f59e0b;
}

.action-modal-btn[title*="Reschedule"] i {
    color: #0891b2;
}

.action-modal-btn[title*="Add quick note"] i {
    color: #8b5cf6;
}

.action-modal-btn[title*="Call"] i {
    color: #059669;
}

.action-modal-btn[title*="Call"]:hover {
    background: #ecfdf5;
}

.action-modal-btn-cancel {
    margin-left: 5px;
    position: relative;
}

.action-modal-btn-cancel i {
    color: #dc2626;
}

.action-modal-btn-cancel::before {
    content: '';
    position: absolute;
    left: -4px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: #000;
}

.action-modal-btn-cancel:hover {
    background: #fef2f2;
    box-shadow: inset 0 0 0 1px #fecaca;
}

/* ============================================================================
   QUICK ACTION MODALS  (Status, Reschedule, Note)
   ============================================================================ */
.dispatch-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.dispatch-modal {
    position: relative;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 3001;
}

.dispatch-modal-lg {
    max-width: 700px;
}

.dispatch-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    background: #fff;
}

.dispatch-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1c3d5a;
}

.dispatch-modal-close {
    background: none;
    border: none;
    color: #6b7280;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.dispatch-modal-close:hover {
    background: #f3f4f6;
    color: #111;
}

.tech-card-icon {
    font-size: 1.2rem !important;
    color: #fff !important;
    background: rgba(255, 255, 255, 0.2) !important;
    cursor: pointer !important;
    border-radius: 4px !important;
}

.tech-card-icon:hover {
    background: rgba(255, 255, 255, 0.35) !important;
    color: #fff !important;
    cursor: pointer !important;
}

.dispatch-modal-body {
    padding: 20px;
}

.dispatch-modal-body p {
    margin: 0 0 12px;
    color: #374151;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #374151;
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea.form-control {
    resize: vertical;
}

.status-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.status-option-btn {
    padding: 8px 12px;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #374151;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.status-option-btn:hover {
    border-color: #2563eb;
    background: #eff6ff;
    color: #1e40af;
}

.status-option-btn.active {
    border-color: #2563eb;
    background: #2563eb;
    color: #fff;
}

.dispatch-modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.btn-primary, .btn-secondary {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary {
    background: #2563eb;
    color: #fff;
    flex: 1;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: #e5e7eb;
    color: #374151;
    flex: 1;
}

.btn-secondary:hover {
    background: #d1d5db;
}

/* ============================================================================
   QUICK-ACTIONS TOOLBAR  (Card hover actions)
   ============================================================================ */
.quick-actions-toolbar {
    position: absolute;
    display: flex;
    gap: 0;
    padding: 0;
    background: #fff;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    transform: scale(0.95);
    z-index: 100;
}

.kanban-card-inner:hover .quick-actions-toolbar,
.wo-timeline-card-container:hover .quick-actions-toolbar {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.2);
}

.quick-actions-toolbar.timeline {
    bottom: -68px;
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    flex-direction: row;
    white-space: nowrap;
}

.wo-timeline-card-container:hover .quick-actions-toolbar.timeline {
    transform: translateX(-50%) scale(1);
}

/* KANBAN: Horizontal toolbar below card on hover */
.quick-actions-toolbar.kanban {
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    flex-direction: row;
    width: auto;
    border-radius: 0 0 6px 6px;
    gap: 0;
}

.kanban-card-inner:hover .quick-actions-toolbar.kanban {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) scale(1);
}

.qa-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 100%;
    height: 56px;
    min-width: auto;
    padding: 0;
    background: #fff;
    border: none;
    border-bottom: 1px solid #e8e8e8;
    color: #495057;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    flex-shrink: 0;
    position: relative;
}

.qa-btn:last-child {
    border-bottom: none;
}

.qa-btn:hover {
    background: #1c3d5a;
    color: #fff;
}

.qa-btn:active {
    background: #152b42;
}

.qa-btn:focus {
    outline: none;
}

.qa-btn i {
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

/* Timeline buttons: icon-only, horizontal row */
.quick-actions-toolbar.timeline .qa-btn {
    width: 48px;
    height: 48px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.quick-actions-toolbar.timeline .qa-btn:not(:last-child) {
    margin-right: 6px;
}

.quick-actions-toolbar.timeline .qa-btn:hover {
    background: #1c3d5a;
    border-color: #1c3d5a;
    transform: none;
}

/* Kanban horizontal toolbar - icon only buttons */
.kanban-card-inner .quick-actions-toolbar.kanban .qa-btn {
    width: 44px;
    height: 44px;
    border-radius: 0;
    font-size: 0;  /* Hide text labels in kanban view */
    border: 1px solid #e0e0e0;
    border-right: none;  /* Remove right border to avoid double lines */
    background: #fff;
}

.kanban-card-inner .quick-actions-toolbar.kanban .qa-btn:last-child {
    border-right: 1px solid #e0e0e0;
}

.kanban-card-inner .quick-actions-toolbar.kanban .qa-btn i {
    font-size: 1.1rem;  /* Icon remains visible */
}

/* Color variants */
.qa-reassign {
    /* Default: white background */
}

.qa-reassign:hover {
    background: #0d6efd;
    border-color: #0d6efd;
}

.qa-auto-assign:hover {
    background: #198754;
    border-color: #198754;
}

.qa-delay:hover {
    background: #ffc107;
    border-color: #ffc107;
    color: #212529;
}

.qa-cancel:hover {
    background: #dc3545;
    border-color: #dc3545;
}

.qa-call {
    text-decoration: none;
}

.qa-call:hover {
    background: #17a2b8;
    border-color: #17a2b8;
}

/* Quick actions dropdown menus */
.qa-dropdown-menu {
    position: absolute;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 200px;
    max-height: 300px;
    overflow-y: auto;
}

.qa-dropdown-item {
    display: block;
    padding: 8px 12px;
    color: #212529;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 0.85rem;
}

.qa-dropdown-item:hover {
    background: #f8f9fa;
    color: #0d6efd;
}

.qa-dropdown-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.qa-dropdown-divider {
    height: 1px;
    background: #dee2e6;
    margin: 4px 0;
}

/* ============================================================================
   CONCURRENCY CONFLICT RESOLUTION MODAL
   ============================================================================
   Design 27.1 - Side-by-side comparison modal for resolving dispatcher conflicts.
   Allows user to see their attempted move vs. current state, with options to
   redo, accept current state, or cancel.
   ============================================================================ */

.dispatch-conflict-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1065;
    animation: conflict-backdrop-fade 0.15s ease-out;
}

@keyframes conflict-backdrop-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.dispatch-conflict-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1070;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    animation: conflict-modal-in 0.2s ease-out;
}

@keyframes conflict-modal-in {
    from {
        opacity: 0;
        transform: translate(-50%, -48%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.dispatch-conflict-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 2px solid #b02a37;
    background: linear-gradient(135deg, #fff5f5 0%, #ffe6e6 100%);
}

.dispatch-conflict-modal-header > div:first-child {
    flex: 1;
}

.dispatch-conflict-modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #b02a37;
}

.dispatch-conflict-modal-title i {
    font-size: 1.5rem;
}

.dispatch-conflict-modal-subtitle {
    margin: 6px 0 0 0;
    font-size: 0.9rem;
    color: #666;
    font-weight: 400;
}

.dispatch-conflict-lock-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #b02a37;
    color: #fff;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.dispatch-conflict-lock-indicator i {
    font-size: 1rem;
    animation: lock-spin 1s linear infinite;
}

@keyframes lock-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.dispatch-conflict-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dispatch-conflict-error {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    color: #856404;
    font-size: 0.9rem;
}

.dispatch-conflict-error i {
    flex-shrink: 0;
    margin-top: 2px;
    font-size: 1rem;
    color: #d9822b;
}

.dispatch-conflict-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 768px) {
    .dispatch-conflict-comparison {
        grid-template-columns: 1fr;
    }
}

.conflict-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 14px;
    background: #f8f9fa;
}

.conflict-column-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    color: #212529;
    padding-bottom: 10px;
    border-bottom: 2px solid #dee2e6;
}

.conflict-your-move .conflict-column-header {
    color: #0d6efd;
}

.conflict-current-state .conflict-column-header {
    color: #198754;
}

.conflict-column-header i {
    font-size: 1.1rem;
}

.conflict-column-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.conflict-wo-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 0.85rem;
}

.conflict-wo-customer {
    font-weight: 700;
    font-size: 0.95rem;
    color: #212529;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conflict-wo-number {
    font-size: 0.8rem;
    color: #6c757d;
    font-weight: 600;
}

.conflict-wo-status {
    display: flex;
    gap: 6px;
}

.conflict-wo-status .status-pill {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    padding: 2px 8px;
    border-radius: 12px;
}

.conflict-wo-address {
    font-size: 0.8rem;
    color: #6c757d;
    line-height: 1.4;
}

.conflict-wo-city {
    font-size: 0.75rem;
    color: #999;
    margin-top: 2px;
}

.conflict-wo-tech,
.conflict-wo-time,
.conflict-wo-problem {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #495057;
}

.conflict-wo-tech i,
.conflict-wo-time i,
.conflict-wo-problem i {
    font-size: 0.85rem;
    color: #6c757d;
    flex-shrink: 0;
}

.conflict-wo-unassigned {
    color: #dc3545;
    font-weight: 600;
}

.dispatch-conflict-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid #dee2e6;
    background: #f8f9fa;
    border-radius: 0 0 12px 12px;
    flex-shrink: 0;
}

.dispatch-conflict-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.dispatch-conflict-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.dispatch-conflict-btn-cancel {
    background: #e9ecef;
    color: #212529;
    border: 1px solid #ced4da;
}

.dispatch-conflict-btn-cancel:hover:not(:disabled) {
    background: #dee2e6;
    border-color: #adb5bd;
}

.dispatch-conflict-btn-accept {
    background: #198754;
    color: #fff;
    border: 1px solid #15753f;
}

.dispatch-conflict-btn-accept:hover:not(:disabled) {
    background: #157347;
    box-shadow: 0 2px 8px rgba(21, 115, 71, 0.3);
}

.dispatch-conflict-btn-redo {
    background: #0d6efd;
    color: #fff;
    border: 1px solid #0b5ed7;
}

.dispatch-conflict-btn-redo:hover:not(:disabled) {
    background: #0b5ed7;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.3);
}

.dispatch-conflict-btn i {
    font-size: 0.9rem;
}

/* ============================================================================
   ADVANCED FILTER MODAL (Dialog & Buttons)
   ============================================================================ */
.filter-modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-start;
    padding: 16px;
    border-top: 1px solid #e0e0e0;
    background: #fafbfc;
}

.filter-modal-btn-apply,
.filter-modal-btn-cancel {
    padding: 8px 18px;
    font-size: 0.95rem;
    font-weight: 600;
    border: 1px solid;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 90px;
}

/* Apply button - PRIMARY (Blue, stands out) */
.filter-modal-btn-apply {
    background: #0d6efd;
    color: #fff;
    border-color: #0b5ed7;
    order: -1;
}

.filter-modal-btn-apply:hover {
    background: #0b5ed7;
    box-shadow: 0 2px 6px rgba(13, 110, 253, 0.3);
}

.filter-modal-btn-apply:active {
    background: #0a58ca;
    box-shadow: 0 1px 4px rgba(13, 110, 253, 0.3);
}

.filter-modal-btn-apply:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
}

/* Cancel button - SECONDARY (Grey) */
.filter-modal-btn-cancel {
    background: #e9ecef;
    color: #212529;
    border-color: #ced4da;
}

.filter-modal-btn-cancel:hover {
    background: #dee2e6;
    border-color: #adb5bd;
}

.filter-modal-btn-cancel:active {
    background: #d3d9e0;
}

.filter-modal-btn-cancel:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}
