* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* ── Botello Brand Palette ── */
    --primary: #05214B;
    --primary-light: #0a3d8a;
    --primary-dark: #020d1f;
    --accent: #36b480;
    --accent-light: #48ca94;
    --accent-dark: #2a8d64;

    /* ── Semantic Colors ── */
    --success: #36b480;
    --warning: #f59e0b;
    --danger: #e11d48;
    --info: #3b82f6;
    --hold: #ea580c;

    /* ── Surfaces ── */
    --bg: #f0fdf4;
    --surface: #ffffff;
    --sidebar-bg: #05214B;
    --sidebar-w: 260px;
    --topbar-h: 70px;

    /* ── Typography ── */
    --text: #0f172a;
    --text-light: #475569;
    --border: #cbd5e1;

    /* ── Elevation ── */
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* ── Shape ── */
    --radius: 8px;
    --radius-sm: 4px;
    --radius-lg: 12px;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 15px;
    overflow-x: hidden;
}

/* Login Screen Styles */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
    padding: 2rem;
}

.login-box {
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius-lg);
    padding: 3rem;
    max-width: 460px;
    width: 100%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255,255,255,0.1);
    animation: slideUp 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -2px;
    background: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-logo span {
    color: var(--accent);
}

.login-logo p {
    color: var(--text-light);
    margin-top: 0.5rem;
    font-size: 0.95rem;
}

.tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border);
}

.tab-btn {
    flex: 1;
    padding: 1rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-light);
    transition: all 0.3s;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--accent);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.form-group {
    margin-bottom: 1.1rem;
}

.form-label {
    display: block;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.35rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-light);
}

.form-input {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    transition: all 0.15s;
    background: var(--surface);
    color: var(--text);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 71, 42, 0.08);
}

.btn {
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-light);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.btn-secondary {
    background: #f1f5f9;
    color: #1e3a5f;
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.user-type-selector {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.user-type-card {
    padding: 1.5rem;
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.user-type-card:hover {
    border-color: var(--primary-light);
    background: rgba(26, 71, 42, 0.03);
}

.user-type-card.selected {
    border-color: var(--accent);
    background: rgba(255, 107, 53, 0.05);
}

.user-type-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.user-type-label {
    font-weight: 600;
    color: var(--primary);
}

.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* ── App shell with sidebar layout ── */
.app-container {
    display: none;
}
.app-container.active {
    display: flex;
    min-height: 100vh;
}

/* ═══════════════════════════════════
   SIDEBAR
═══════════════════════════════════ */
.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 200;
    overflow: hidden;
    transition: width 0.25s ease;
}
/* Nav area scrolls; footer stays pinned */
.sidebar .nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    scrollbar-width: none; /* Firefox */
}
.sidebar .nav::-webkit-scrollbar { display: none; } /* Chrome/Safari */
.sidebar-logo {
    padding: 1.4rem 1.4rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex-shrink: 0;
}
.sidebar-logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent) 0%, #3b82f6 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(16,185,129,0.3);
}
.sidebar-logo-text {
    font-size: 1.2rem;
    font-weight: 800;
    color: white;
    letter-spacing: -0.5px;
}
.sidebar-logo-text span { color: var(--accent); letter-spacing: -0.5px; }

.sidebar-section-label {
    padding: 1.2rem 1.2rem 0.3rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.28);
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0.4rem 0.75rem;
    flex: 1;
}
.nav-btn {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    background: none;
    border: none;
    color: rgba(255,255,255,0.58);
    padding: 0.65rem 0.85rem;
    border-radius: 9px;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    font-size: 0.88rem;
    transition: all 0.15s;
    text-align: left;
    width: 100%;
    white-space: nowrap;
}
.nav-btn .nav-icon {
    font-size: 1.05rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}
.nav-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #f8fafc;
    transform: translateX(2px);
}
.nav-btn.active {
    background: var(--accent);
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}
.nav-btn.active .nav-icon { filter: none; }

.sidebar-prefs {
    padding: 0.5rem 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.07);
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
}
.sidebar-pref-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    padding: 0.5rem 0.85rem;
    border-radius: 9px;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    font-size: 0.8rem;
    transition: all 0.15s;
    text-align: left;
    width: 100%;
    white-space: nowrap;
}
.sidebar-pref-btn:hover {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.85);
}

.sidebar-footer {
    padding: 1rem 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 0.75rem;
    border-radius: 9px;
    background: rgba(255,255,255,0.05);
}
.sidebar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; overflow: hidden; }
.sidebar-user-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-role {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.sidebar-logout {
    background: none;
    border: none;
    color: rgba(255,255,255,0.35);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
    transition: color 0.15s;
    flex-shrink: 0;
}
.sidebar-logout:hover { color: #ef4444; }

/* ═══════════════════════════════════
   MAIN AREA
═══════════════════════════════════ */
.main-area {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
}

/* ── Top bar ── */
.header {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 1.75rem;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary);
    flex: 1;
    min-width: 0;
}
.topbar-search-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-size: 0.82rem;
    color: var(--text-light);
    transition: border-color 0.15s;
}
.topbar-search-btn:hover { border-color: var(--primary); }
.topbar-search-btn kbd {
    background: white;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 0.7rem;
    font-family: 'DM Mono', monospace;
    color: var(--text-light);
}
.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.user-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text);
}
.user-role {
    background: #e8f4ec;
    color: var(--primary);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}
.logout-btn {
    background: var(--bg);
    border: 1.5px solid var(--border);
    color: var(--text-light);
    padding: 0.4rem 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    font-size: 0.82rem;
    transition: all 0.15s;
}
.logout-btn:hover {
    border-color: #dc2626;
    color: #dc2626;
}

.container {
    flex: 1;
    padding: 1.75rem;
    max-width: 1600px;
    width: 100%;
}

.view {
    display: none;
    animation: fadeIn 0.2s ease-in;
}

.view.active {
    display: block;
    animation: fadeIn 0.18s ease;
}

.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1.5px solid var(--border);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.2px;
}

.table-container {
    overflow-x: auto;
    margin-top: 1.25rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

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

.data-table thead {
    background: var(--bg);
}

.data-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #475569;
    white-space: nowrap;
    border-bottom: 2px solid var(--border);
    background: #f1f5f9;
}

.data-table td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    color: #334155;
}

.data-table tbody tr {
    transition: background 0.15s;
}

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

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

.status-badge {
    padding: 0.28rem 0.7rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
    white-space: nowrap;
}

/* ── Interactive status button ── */
.status-btn {
    padding: 0.28rem 0.65rem 0.28rem 0.7rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
    border: none;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s, box-shadow 0.15s;
    font-family: 'Outfit', sans-serif;
    position: relative;
}
.status-btn:hover {
    opacity: 0.85;
    transform: scale(1.04);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.status-btn:active { transform: scale(0.97); }
.status-btn::after {
    content: '▾';
    font-size: 0.7rem;
    opacity: 0.6;
}

/* ── Status dropdown popup ── */
.status-dropdown {
    position: fixed;
    z-index: 9000;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid var(--border);
    padding: 0.4rem;
    min-width: 170px;
    display: none;
    animation: statusDropIn 0.12s ease;
}
.status-dropdown.open { display: block; }

@keyframes statusDropIn {
    from { opacity: 0; transform: translateY(-6px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.status-dropdown-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-light);
    padding: 0.3rem 0.6rem 0.4rem;
}

.status-option {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.1s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: 'Outfit', sans-serif;
    font-size: 0.83rem;
    font-weight: 500;
    color: var(--text);
}
.status-option:hover { background: var(--bg); }
.status-option.current { font-weight: 700; }
.status-option .status-dot-sm {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}
.status-option .status-check {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--primary);
}

.status-open { background: #eff6ff; color: #2563eb; }
.status-scheduled { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.status-on-route { background: #faf5ff; color: #7c3aed; border-color: #ddd6fe; }
.status-delivered { background: #f0fdf4; color: #16a34a; }
.status-completed { background: #ecfdf5; color: #059669; border-color: #a7f3d0; }
.status-cancelled { background: #fef2f2; color: #dc2626; }

.action-btn {
    padding: 0.35rem 0.7rem;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.15s;
    margin-right: 0.35rem;
}

.action-btn.edit {
    background: #eff6ff;
    color: #2563eb;
}

.action-btn.edit:hover {
    background: #dbeafe;
}

.action-btn.delete {
    background: #fef2f2;
    color: #dc2626;
}

.action-btn.delete:hover {
    background: #fee2e2;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.form-select,
.form-textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    transition: all 0.15s;
    background: var(--surface);
    color: var(--text);
}

.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 71, 42, 0.08);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.checkbox-group {
    display: flex;
    gap: 1.5rem;
    padding: 0.5rem 0;
    flex-wrap: wrap;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"],
.checkbox-label input[type="radio"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--surface);
    border-radius: 16px;
    max-width: 800px;
    width: 95%;
    max-height: 92vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 24px 64px rgba(0,0,0,0.18);
    box-sizing: border-box;
}

.modal-header {
    padding: 1.4rem 1.6rem;
    border-bottom: 1.5px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 5;
}

.modal-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary);
}

.modal-close {
    background: var(--bg);
    border: 1.5px solid var(--border);
    font-size: 1rem;
    cursor: pointer;
    color: var(--text-light);
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.modal-close:hover {
    background: #fee2e2;
    border-color: #fecaca;
    color: #dc2626;
}

.modal-body {
    padding: 1.5rem 1.6rem;
}

.modal-footer {
    padding: 1.1rem 1.6rem;
    border-top: 1.5px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.65rem;
    background: var(--bg);
    border-radius: 0 0 16px 16px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--surface);
    padding: 1.2rem 1.4rem;
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    text-align: left;
    position: relative;
    transition: transform 0.15s, box-shadow 0.15s;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-value {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--primary);
    font-family: 'DM Mono', monospace;
    line-height: 1;
    margin-bottom: 0.35rem;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 500;
}

.filter-bar {
    background: var(--surface);
    padding: 1.1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    border: 1px solid var(--border);
}

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

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-light);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.25;
}

.empty-state-text {
    font-size: 1rem;
    font-weight: 500;
}

.packet-section {
    margin-bottom: 2rem;
}

.packet-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
    color: white;
    padding: 2rem;
    border-radius: 12px 12px 0 0;
    text-align: center;
}

.packet-header h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.packet-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    background: var(--surface);
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.packet-info-item {
    display: flex;
    flex-direction: column;
}

.packet-info-label {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 500;
}

.packet-info-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
    margin-top: 0.25rem;
}

.stop-group {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 8px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.stop-header {
    background: var(--accent);
    color: white;
    padding: 1rem 1.5rem;
    font-weight: 600;
    font-size: 1.1rem;
}

.stop-items {
    padding: 1rem;
}

.stop-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    display: grid;
    grid-template-columns: 1fr 1fr 2fr auto;
    gap: 1rem;
    align-items: center;
}

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

.print-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--accent);
    color: white;
    padding: 1rem 2rem;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    box-shadow: 0 4px 20px rgba(255, 107, 53, 0.4);
    transition: all 0.2s;
    z-index: 50;
}

.print-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(255, 107, 53, 0.5);
}

@media print {
    body * {
        visibility: hidden;
    }
    .print-area, .print-area * {
        visibility: visible;
    }
    .print-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
    .header, .nav, .filter-bar, .btn, .action-btn, .print-btn {
        display: none !important;
    }
}

@media (max-width: 768px) {
    :root { --sidebar-w: 0px; }

    #sidebarToggleBtn { display: inline-flex !important; }
    #sidebarOverlay { display: block !important; }
    #sidebarOverlay.active { opacity: 1; pointer-events: all; }
    #sidebarOverlay:not(.active) { opacity: 0; pointer-events: none; }

    .sidebar {
        position: fixed;
        left: 0; top: 0; bottom: 0;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 100;
        width: 260px !important;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.25);
    }
    .main-area {
        margin-left: 0;
        width: 100%;
    }
    .container {
        padding: 0.75rem;
    }
    .header {
        padding: 0.6rem 0.75rem;
        gap: 0.4rem;
    }
    .card {
        border-radius: 10px;
        padding: 0.85rem;
        margin-bottom: 0.75rem;
    }
    .card-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    /* Tables scroll horizontally */
    .data-table { font-size: 0.78rem; }
    .table-wrap, .data-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    /* Board scrolls horizontally */
    #dispatchBoard, #pourDispatchBoard {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.5rem;
    }
    .board-col { min-width: 240px; }
    /* Stats grid single column */
    #statsGrid { grid-template-columns: 1fr 1fr !important; }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    .stop-item {
        grid-template-columns: 1fr;
    }
    .user-type-selector {
        grid-template-columns: 1fr 1fr;
    }
    /* Topbar compact */
    .topbar-search-btn kbd { display: none; }
    #headerClock { display: none !important; }
    #langToggleBtn, #darkToggleBtn { display: none; }
    .topbar-search-btn { padding: 0.4rem 0.5rem; }
    .topbar-search-btn .search-btn-text { display: none; }

    /* Modal full-screen on mobile */
    .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        min-height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        margin: 0;
        overflow-x: hidden;
    }
    .modal {
        padding: 0;
        align-items: flex-start;
    }
    .modal-body {
        padding: 0.85rem;
    }
    .modal-header {
        padding: 0.85rem 1rem;
        position: sticky;
        top: 0;
        z-index: 10;
        background: var(--surface);
    }
    .modal-footer {
        padding: 0.75rem 0.85rem;
        position: sticky;
        bottom: 0;
        background: var(--surface);
        border-top: 1px solid var(--border);
    }
    /* Line items container no overflow */
    #lineItemsContainer {
        overflow-x: hidden;
    }
}




@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position:  200% 0; }
}

/* ── Custom Confirm Dialog ── */
#confirmDialog {
    position: fixed; inset: 0; z-index: 10000;
    display: none; align-items: center; justify-content: center;
    background: rgba(15,23,42,0.55); backdrop-filter: blur(3px);
}
#confirmDialog.open { display: flex; }
.confirm-box {
    background: white; border-radius: 16px; padding: 1.75rem 2rem;
    max-width: 380px; width: 94%; box-shadow: 0 24px 64px rgba(0,0,0,0.25);
    text-align: center; animation: confirmPop 0.22s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes confirmPop { from { opacity:0; transform:scale(0.88); } to { opacity:1; transform:scale(1); } }
.confirm-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.confirm-title { font-size: 1.05rem; font-weight: 700; color: var(--primary); margin-bottom: 0.4rem; }
.confirm-msg { font-size: 0.88rem; color: var(--text-light); margin-bottom: 1.5rem; line-height: 1.5; }
.confirm-btns { display: flex; gap: 0.6rem; justify-content: center; }
.confirm-cancel { flex: 1; padding: 0.65rem; border: 1.5px solid var(--border); background: var(--bg); color: var(--text); border-radius: 9px; cursor: pointer; font-weight: 600; font-size: 0.88rem; font-family: 'Outfit', sans-serif; transition: all 0.15s; }
.confirm-cancel:hover { border-color: #64748b; }
.confirm-ok { flex: 1; padding: 0.65rem; border: none; background: #dc2626; color: white; border-radius: 9px; cursor: pointer; font-weight: 700; font-size: 0.88rem; font-family: 'Outfit', sans-serif; transition: all 0.15s; }
.confirm-ok:hover { background: #b91c1c; }
.confirm-ok.confirm-ok-safe { background: #2563eb; }
.confirm-ok.confirm-ok-safe:hover { background: #1d4ed8; }


/* ── Accessibility ── */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}
.btn:focus-visible, .nav-btn:focus-visible {
    outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
/* ── Skip to main content link (screen readers) ── */
.skip-link {
    position: absolute; top: -40px; left: 0;
    background: var(--accent); color: white;
    padding: 8px 16px; border-radius: 0 0 8px 0;
    font-weight: 700; text-decoration: none;
    transition: top 0.2s;
    z-index: 9999;
}
.skip-link:focus { top: 0; }

/* ── Touch improvements for mobile drag ── */
.dispatch-card { touch-action: none; }
.driver-lane   { touch-action: pan-y; }

/* ── Bulk selection ── */
.bulk-checkbox {
    width: 16px; height: 16px; cursor: pointer;
    accent-color: var(--accent);
}
.bulk-action-bar {
    display: none; align-items: center; gap: 0.75rem;
    background: var(--primary); color: white;
    padding: 0.65rem 1.25rem; border-radius: var(--radius);
    margin-bottom: 0.75rem; font-size: 0.88rem; font-weight: 600;
    animation: slideDown 0.2s ease;
}
.bulk-action-bar.visible { display: flex; }
.bulk-action-btn {
    background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3);
    color: white; border-radius: 7px; padding: 0.35rem 0.75rem;
    cursor: pointer; font-size: 0.8rem; font-weight: 600;
    font-family: 'Outfit', sans-serif; transition: background 0.15s;
}
.bulk-action-btn:hover { background: rgba(255,255,255,0.28); }
.bulk-action-btn.danger { background: rgba(220,38,38,0.5); border-color: rgba(220,38,38,0.7); }
.bulk-action-btn.danger:hover { background: rgba(220,38,38,0.75); }

/* ── Sortable table headers ── */
th.sortable {
    cursor: pointer; user-select: none;
    white-space: nowrap; position: relative;
}
th.sortable::after {
    content: ' ↕';
    font-size: 0.65em; opacity: 0.4;
}
th.sortable.sort-asc::after  { content: ' ↑'; opacity: 1; color: var(--accent); }
th.sortable.sort-desc::after { content: ' ↓'; opacity: 1; color: var(--accent); }
th.sortable:hover { background: #e8edf5; }

/* ── Calendar / Schedule view ── */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 1rem;
}
.cal-day-header {
    text-align: center; font-size: 0.7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-light);
    padding: 6px 0;
}
.cal-day {
    min-height: 90px; border: 1px solid var(--border); border-radius: 8px;
    padding: 6px; background: var(--surface); cursor: pointer;
    transition: border-color 0.15s;
}
.cal-day:hover { border-color: var(--accent); }
.cal-day.today { border-color: var(--accent); background: #f0fdf9; }
.cal-day.other-month { background: var(--bg); opacity: 0.55; }
.cal-day-num {
    font-size: 0.78rem; font-weight: 700; color: var(--text-light);
    margin-bottom: 4px;
}
.cal-day.today .cal-day-num { color: var(--accent); }
.cal-event {
    font-size: 0.65rem; padding: 2px 5px; border-radius: 4px;
    margin-bottom: 2px; font-weight: 600; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
    cursor: pointer; transition: opacity 0.15s;
}
.cal-event:hover { opacity: 0.8; }
.cal-nav { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.cal-nav h3 { flex: 1; text-align: center; margin: 0; }
.cal-nav-btn {
    background: var(--bg); border: 1.5px solid var(--border);
    border-radius: 8px; padding: 6px 12px; cursor: pointer;
    font-size: 0.9rem; transition: all 0.15s;
}
.cal-nav-btn:hover { border-color: var(--primary); }

/* ── Analytics Charts ── */
.analytics-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.25rem; margin-bottom: 1.5rem;
}
.analytics-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.25rem;
}
.analytics-card-title { font-weight: 700; font-size: 0.85rem; color: var(--text-light); margin-bottom: 1rem; text-transform: uppercase; letter-spacing: 0.05em; }
.mini-bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin-bottom: 2px; }
.mini-bar-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.bar-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 6px; font-size: 0.8rem; }
.bar-label { min-width: 90px; color: var(--text-light); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-val { min-width: 28px; text-align: right; font-weight: 700; font-family: 'DM Mono', monospace; font-size: 0.78rem; }

/* ── Print: work order individual ── */
@media print {
    .no-print { display: none !important; }
    .print-only { display: block !important; }
}
.print-only { display: none; }

/* ── Import CSV feedback ── */
.import-progress {
    background: #f0fdf4; border: 1.5px solid #86efac; border-radius: 8px;
    padding: 0.65rem 1rem; font-size: 0.85rem; color: #15803d;
    font-weight: 600; display: none; margin-top: 0.5rem;
}
.import-progress.visible { display: block; animation: fadeIn 0.2s; }

/* ── Toast Notification System ── */
#toastContainer {
    position: fixed; top: 70px; right: 1.5rem; z-index: 9999;
    display: flex; flex-direction: column; gap: 0.5rem; pointer-events: none;
}
.toast {
    background: white; border-radius: 10px; padding: 0.7rem 1rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.13), 0 0 0 1px rgba(0,0,0,0.05);
    font-size: 0.85rem; font-weight: 500; color: var(--text);
    display: flex; align-items: center; gap: 0.6rem;
    min-width: 240px; max-width: 380px; pointer-events: all;
    animation: toastIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-left: 4px solid var(--accent);
}
.toast.toast-success { border-left-color: #16a34a; }
.toast.toast-error   { border-left-color: #dc2626; }
.toast.toast-info    { border-left-color: #2563eb; }
.toast.toast-warning { border-left-color: #f59e0b; }
.toast-out { animation: toastOut 0.2s ease forwards; }
@keyframes toastIn  { from { opacity:0; transform:translateX(30px) scale(0.95); } to { opacity:1; transform:translateX(0) scale(1); } }
@keyframes toastOut { to   { opacity:0; transform:scale(0.9); max-height:0; margin:0; padding:0; } }

/* ── Connection Status Banner ── */
#connectionBanner {
    position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%);
    padding: 0.55rem 1.25rem; border-radius: 30px; font-size: 0.82rem;
    font-weight: 600; z-index: 9999; display: none; align-items: center;
    gap: 0.5rem; box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    animation: slideUpBanner 0.3s ease;
    white-space: nowrap;
}
#connectionBanner.offline { background:#dc2626; color:white; display:flex; }
#connectionBanner.syncing { background:#f59e0b; color:white; display:flex; }
#connectionBanner.back-online { background:#16a34a; color:white; display:flex; animation:fadeOutBanner 0.4s ease 2.5s forwards; }
@keyframes slideUpBanner  { from { transform:translateX(-50%) translateY(20px); opacity:0; } to { transform:translateX(-50%) translateY(0); opacity:1; } }
@keyframes fadeOutBanner  { to { opacity:0; pointer-events:none; } }

/* ===================== NOTIFICATION STYLES ===================== */
.notif-bell-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.notif-bell {
    background: none;
    border: none;
    color: var(--text-light);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    position: relative;
}
.notif-bell:hover { background: var(--bg); color: var(--primary); }
.notif-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--accent);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    display: none;
}
.notif-badge.visible { display: flex; }

.notif-panel {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 380px;
    max-height: 80vh;
    background: var(--surface);
    border-radius: 14px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    border: 1px solid var(--border);
    z-index: 999;
    display: none;
    overflow-y: auto;
    overflow-x: hidden;
}
.notif-panel.open { display: block; animation: fadeIn 0.2s; }
.notif-panel-header {
    padding: 1rem 1.2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
    color: white;
}
.notif-panel-header h4 { font-size: 1rem; font-weight: 600; }
.notif-mark-all {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    font-size: 0.8rem;
    font-family: 'Outfit', sans-serif;
    padding: 0;
}
.notif-mark-all:hover { color: white; }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item {
    padding: 1rem 1.2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 0.75rem;
    cursor: pointer;
    transition: background 0.15s;
}
.notif-item:hover { background: rgba(26,71,42,0.04); }
.notif-item.unread { background: rgba(255,107,53,0.05); border-left: 3px solid var(--accent); }
.notif-icon { font-size: 1.3rem; flex-shrink: 0; margin-top: 2px; }
.notif-body { flex: 1; }
.notif-title { font-weight: 600; font-size: 0.88rem; color: var(--text); }
.notif-msg { font-size: 0.82rem; color: var(--text-light); margin-top: 2px; }
.notif-time { font-size: 0.75rem; color: var(--text-light); margin-top: 4px; font-family: 'DM Mono', monospace; }
.notif-empty { text-align: center; padding: 2rem; color: var(--text-light); font-size: 0.9rem; }

/* ── Inline driver assignment dropdown ── */
.driver-cell {
    position: relative;
    min-width: 130px;
}
.driver-assign-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: none;
    border: 1.5px dashed var(--border);
    border-radius: 7px;
    padding: 0.28rem 0.6rem;
    font-family: 'Outfit', sans-serif;
    font-size: 0.8rem;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.driver-assign-btn.assigned {
    border-style: solid;
    border-color: #d1fae5;
    background: #f0fdf4;
    color: var(--primary);
    font-weight: 500;
}
.driver-assign-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #f0fdf4;
}
.driver-assign-btn::after { content: ' ▾'; font-size: 0.65rem; opacity: 0.5; }

.driver-dropdown {
    position: fixed;
    z-index: 9100;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.16), 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid var(--border);
    padding: 0.4rem;
    min-width: 190px;
    display: none;
    animation: statusDropIn 0.12s ease;
}
.driver-dropdown.open { display: block; }
.driver-dropdown-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-light);
    padding: 0.3rem 0.6rem 0.4rem;
}
.driver-option {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: 'Outfit', sans-serif;
    font-size: 0.83rem;
    color: var(--text);
    transition: background 0.1s;
}
.driver-option:hover { background: var(--bg); }
.driver-option.current { font-weight: 700; color: var(--primary); }
.driver-option .driver-check { margin-left: auto; font-size: 0.75rem; color: var(--primary); }
.driver-option .driver-avatar-sm {
    width: 22px; height: 22px;
    border-radius: 6px;
    background: var(--primary);
    color: white;
    font-size: 0.62rem;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.driver-option.unassign { color: #dc2626; }
.driver-option.unassign:hover { background: #fef2f2; }

/* ── Google Maps container ── */
#googleMap {
    height: 460px;
    border-radius: 12px;
    border: 2px solid var(--border);
    overflow: hidden;
    margin-bottom: 1rem;
    position: relative;
    z-index: 0;
}
.gmap-key-notice {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: #f8fafc;
    color: var(--text-light);
    font-size: 0.9rem;
    gap: 0.75rem;
    text-align: center;
    padding: 2rem;
}
.gmap-key-notice strong { color: var(--text); font-size: 1rem; }
.gmap-key-input { 
    display: flex; gap: 0.5rem; margin-top: 0.5rem; width: 100%; max-width: 480px;
}
.gmap-key-input input {
    flex: 1; padding: 0.55rem 0.8rem; border: 1.5px solid var(--border);
    border-radius: 8px; font-family: 'Outfit', sans-serif; font-size: 0.85rem;
}
.gmap-key-input button {
    padding: 0.55rem 1rem; background: var(--primary); color: white;
    border: none; border-radius: 8px; cursor: pointer; font-weight: 600;
    font-family: 'Outfit', sans-serif;
}
#gps-view .map-frame {
    background: #e8f0e8;
    border-radius: 12px;
    border: 2px solid var(--border);
    overflow: hidden;
    position: relative;
    height: 420px;
    margin-bottom: 1.5rem;
}

/* ── Map search / filter overlay ── */
.map-search-overlay {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 340px;
    pointer-events: none;
}
.map-search-overlay > * { pointer-events: all; }

.map-search-box {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.96);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.16);
    border: 1px solid rgba(255,255,255,0.9);
    overflow: hidden;
}
.map-search-box input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 9px 12px;
    outline: none;
    font-size: 0.83rem;
    font-family: 'Outfit', sans-serif;
    color: var(--primary);
}
.map-search-box button {
    padding: 0 12px;
    height: 38px;
    border: none;
    background: var(--accent);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.map-search-box button:hover { background: var(--accent-dark); }

.map-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.map-chip {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(6px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    color: #475569;
    border: 1px solid rgba(255,255,255,0.8);
    transition: all 0.15s;
    user-select: none;
}
.map-chip input[type="checkbox"] { display: none; }
.map-chip.active { background: var(--primary); color: white; }
.map-chip:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0,0,0,0.15); }

.map-route-btn {
    padding: 7px 14px;
    border-radius: 8px;
    border: none;
    background: rgba(255,255,255,0.94);
    backdrop-filter: blur(6px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    font-size: 0.78rem;
    font-weight: 700;
    color: #475569;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    transition: all 0.15s;
    width: fit-content;
}
.map-route-btn:hover { background: var(--primary); color: white; }
.map-route-btn.active { background: #dc2626; color: white; box-shadow: 0 0 0 3px rgba(220,38,38,0.2); }
.map-svg-wrap {
    width: 100%;
    height: 100%;
    position: relative;
}
.driver-tracker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.2rem;
    margin-top: 1.5rem;
}
.driver-tracker-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1.2rem;
    transition: all 0.2s;
    cursor: pointer;
}
.driver-tracker-card:hover { border-color: var(--primary-light); transform: translateY(-2px); box-shadow: 0 4px 16px var(--shadow); }
.driver-tracker-card.selected { border-color: var(--accent); background: rgba(255,107,53,0.04); }
.dtc-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.dtc-avatar {
    width: 42px; height: 42px; border-radius: 50%;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
    color: white; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1.1rem; flex-shrink: 0;
}
.dtc-name { font-weight: 600; color: var(--primary); }
.dtc-status { font-size: 0.8rem; color: var(--text-light); display: flex; align-items: center; gap: 0.4rem; margin-top: 2px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-dot.active { background: #22c55e; animation: pulse-dot 1.5s infinite; }
.status-dot.idle { background: var(--warning); }
.status-dot.offline { background: #9ca3af; }
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.8); }
}
.dtc-info { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; font-size: 0.82rem; }
.dtc-info-item label { color: var(--text-light); display: block; font-size: 0.75rem; }
.dtc-info-item span { font-weight: 600; color: var(--text); }
.map-driver-dot {
    position: absolute;
    width: 18px; height: 18px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transform: translate(-50%, -50%);
    cursor: pointer;
    transition: all 0.8s ease;
}
.map-driver-dot.active { background: #22c55e; animation: gps-pulse 2s infinite; }
.map-driver-dot.idle { background: var(--warning); }
.map-driver-dot.offline { background: #9ca3af; }
@keyframes gps-pulse {
    0% { box-shadow: 0 0 0 0 rgba(34,197,94,0.5); }
    70% { box-shadow: 0 0 0 10px rgba(34,197,94,0); }
    100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}
.map-tooltip {
    position: absolute;
    background: var(--primary);
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    transform: translate(-50%, -140%);
    display: none;
}
.map-driver-dot:hover + .map-tooltip { display: block; }
.map-road {
    position: absolute;
    background: white;
    opacity: 0.6;
}
.gps-legend { display: flex; gap: 1.5rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }
.gps-legend-item { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; color: var(--text-light); }

/* ===================== REQUESTOR STYLES ===================== */
.my-requests-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.request-status-track {
    display: flex;
    align-items: center;
    gap: 0;
    margin: 0.75rem 0 0.5rem;
}
.rst-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}
.rst-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: var(--border);
    z-index: 0;
}
.rst-step.done:not(:last-child)::after { background: var(--success); }
.rst-dot {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--border);
    border: 2px solid var(--border);
    z-index: 1;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem; color: white;
}
.rst-step.done .rst-dot { background: var(--success); border-color: var(--success); }
.rst-step.current .rst-dot { background: var(--accent); border-color: var(--accent); animation: pulse-dot 1.5s infinite; }
.rst-label { font-size: 0.65rem; color: var(--text-light); margin-top: 4px; text-align: center; white-space: nowrap; }
.rst-step.done .rst-label, .rst-step.current .rst-label { color: var(--primary); font-weight: 600; }

.requestor-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1.2rem 1.4rem;
    margin-bottom: 1rem;
    transition: all 0.2s;
}
.requestor-card:hover { border-color: var(--primary-light); box-shadow: 0 3px 12px var(--shadow); }
.rc-top { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 0.5rem; }
.rc-job { font-weight: 700; font-size: 1.1rem; color: var(--primary); }
.rc-item { font-size: 0.9rem; color: var(--text-light); margin-top: 2px; }
.rc-meta { display: flex; gap: 1rem; margin-top: 0.75rem; flex-wrap: wrap; }
.rc-meta span { font-size: 0.82rem; color: var(--text-light); background: var(--bg); padding: 3px 8px; border-radius: 20px; border: 1px solid var(--border); }
/* ===================== LINE ITEMS ===================== */
/* ── Line Item Row: fully responsive grid ── */
/* ─────────────────────────────────────────────
   PRO DISPATCHER — Inline Item Table
───────────────────────────────────────────── */
.items-table-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: visible;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.items-table-head {
    display: grid;
    grid-template-columns: 26px 1fr 100px 90px 58px 80px;
    gap: 0;
    background: #f1f5f9;
    border-bottom: 2px solid #e2e8f0;
    padding: 0 8px;
}

.items-table-head > div {
    font-size: 0.62rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 10px 6px;
    white-space: nowrap;
    overflow: hidden;
}

.line-item-row {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--border);
    background: var(--surface);
    transition: background 0.12s, border-left 0.12s;
    border-left: 3px solid transparent;
}

/* Row 1: primary fields — always visible, grid-aligned with header */
.li-primary-row {
    display: grid;
    grid-template-columns: 26px 1fr 100px 90px 58px 80px;
    align-items: center;
    min-height: 48px;
    padding: 4px 8px;
}
.li-primary-row .li-desc-wrap { min-width: 0; }

/* Row 2: dispatcher-only fields */
.li-dispatcher-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 4px 8px 6px;
    border-top: 1px dashed var(--border);
}
.li-dispatcher-row .li-cell { min-width: 100px; }
.li-dispatcher-row .li-cell:last-child { flex: 1; }

/* Hide dispatcher row for foreman and supervisor (all screen sizes) */
body.role-foreman .li-dispatcher-row,
body.role-supervisor .li-dispatcher-row { display: none; }

.line-item-row:first-child { border-top: none; }
.line-item-row:hover { background: #f8fafc; border-left-color: #cbd5e1; }
.line-item-row.li-focused { background: #f0fdf9; border-left-color: var(--accent); }

/* Alternating row tint */
.line-item-row:nth-child(even) { background: #fafbfc; }
.line-item-row:nth-child(even):hover { background: #f1f5f9; }

/* Cell shared styles */
.li-cell {
    padding: 0 4px;
    min-width: 0;
}
.li-cell input,
.li-cell select {
    width: 100%;
    box-sizing: border-box;
    font-size: 0.82rem;
    padding: 6px 7px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--text);
    font-family: 'Outfit', sans-serif;
    transition: all 0.12s;
    min-width: 0;
}
.li-cell input:hover,
.li-cell select:hover {
    border-color: var(--border);
    background: white;
}
.li-cell input:focus,
.li-cell select:focus {
    border-color: var(--accent);
    background: white;
    outline: none;
    box-shadow: 0 0 0 3px rgba(16,185,129,0.08);
}

/* Row number */
.li-row-num {
    font-size: 0.65rem;
    font-weight: 700;
    font-family: 'DM Mono', monospace;
    color: #94a3b8;
    text-align: center;
    user-select: none;
}

/* Qty cell — with +/- stepper buttons */
.li-cell-qty {
    padding: 0 4px;
}
.li-qty-wrap {
    display: flex;
    align-items: center;
    gap: 2px;
}
.li-qty-btn {
    width: 20px;
    height: 28px;
    flex-shrink: 0;
    border: 1px solid var(--border);
    background: #f1f5f9;
    color: #475569;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.1s;
    padding: 0;
    line-height: 1;
    user-select: none;
}
.li-qty-btn:hover { background: var(--accent); color: white; border-color: var(--accent); }
.li-qty-btn:active { transform: scale(0.9); }
.li-cell-qty input {
    text-align: center;
    font-weight: 700;
    font-family: 'DM Mono', monospace;
    padding: 6px 2px;
    min-width: 0;
    -moz-appearance: textfield;
}
.li-cell-qty input::-webkit-outer-spin-button,
.li-cell-qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Description cell */
.li-desc-wrap {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 4px 5px;
    min-width: 0;
}
.li-desc-wrap select,
.li-desc-wrap input {
    width: 100%;
    box-sizing: border-box;
    font-size: 0.8rem;
    padding: 5px 7px;
    border: 1px solid transparent;
    border-radius: 5px;
    background: transparent;
    color: var(--text);
    font-family: 'Outfit', sans-serif;
    transition: all 0.12s;
}
.li-desc-wrap select:hover,
.li-desc-wrap input:hover { border-color: var(--border); background: white; }
.li-desc-wrap select:focus,
.li-desc-wrap input:focus { border-color: var(--accent); background: white; outline: none; box-shadow: 0 0 0 3px rgba(16,185,129,0.08); }

/* File cell */
.li-file-cell { padding: 0 5px; }
.li-file-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 30px;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.68rem;
    font-weight: 700;
    color: #64748b;
    background: #f8fafc;
    transition: all 0.15s;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.li-file-label:hover { border-color: var(--accent); color: var(--accent-dark); background: #ecfdf5; }
.li-file-label.has-file { border-color: var(--accent); color: var(--accent-dark); background: #ecfdf5; }

/* Actions cell */
.li-actions-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 0 3px;
}
.li-btn-action {
    height: 28px;
    border: 1px solid;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.68rem;
    font-weight: 700;
    font-family: 'DM Mono', monospace;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.12s;
    flex-shrink: 0;
    padding: 0 6px;
    white-space: nowrap;
    letter-spacing: 0.03em;
}
.li-btn-dup  { background: #f8fafc; color: #475569; border-color: var(--border); }
.li-btn-dup:hover  { background: #eff6ff; color: #1d4ed8; border-color: #93c5fd; }
.li-btn-del  { background: #fff8f8; color: #be123c; border-color: #fecdd3; }
.li-btn-del:hover  { background: #ffe4e6; border-color: #fda4af; }

/* Items section header */
.items-section-header {
    margin: 1.5rem 0 0;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.items-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-light);
}
.items-section-actions {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

/* Add Item footer */
.items-table-footer {
    background: #f8fafc;
    border-top: 1px solid var(--border);
    padding: 7px 12px;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.items-add-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--accent-dark);
    padding: 0;
    font-family: 'Outfit', sans-serif;
    letter-spacing: 0.01em;
}
.items-add-btn:hover { color: var(--accent); text-decoration: underline; }
.li-qty-preset {
    height: 22px;
    padding: 0 7px;
    border: 1px solid var(--border);
    background: #f8fafc;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: 'DM Mono', monospace;
    color: #475569;
    cursor: pointer;
    transition: all 0.1s;
}
.li-qty-preset:hover { background: var(--accent); color: white; border-color: var(--accent); }

/* ── Autocomplete typeahead ── */
.li-autocomplete-wrap { position: relative; }
.li-autocomplete-list {
    position: fixed;
    min-width: 300px;
    max-width: 420px;
    background: var(--surface);
    border: 1.5px solid var(--accent);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15,23,42,0.12);
    z-index: 99999;
    max-height: 260px;
    overflow-y: auto;
    display: none;
}
.li-autocomplete-list.open { display: block; }
.li-ac-item {
    padding: 7px 11px;
    cursor: pointer;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.1s;
}
.li-ac-item:last-child { border-bottom: none; }
.li-ac-item:hover, .li-ac-item.ac-focused { background: #f0fdf9; }
.li-ac-cat { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 1px 6px; border-radius: 4px; flex-shrink: 0; }
.li-ac-cat.cat-mat  { background: #dbeafe; color: #1e40af; }
.li-ac-cat.cat-eq   { background: #ede9fe; color: #5b21b6; }
.li-ac-cat.cat-tool { background: #d1fae5; color: #065f46; }
.li-ac-name { flex: 1; font-weight: 500; color: var(--text); }
.li-ac-unit { font-size: 0.72rem; color: var(--text-light); font-family: 'DM Mono', monospace; }
.li-ac-match { background: #fef3c7; border-radius: 2px; }

/* ── Item Source selector (Yard Driver vs Store) ── */
.li-source-sel {
    width: 100%;
    font-size: 0.74rem;
    padding: 4px 6px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: border-color 0.15s;
}
.li-source-sel:focus { outline: none; border-color: var(--accent); }
.li-source-sel.src-yard { border-color: #10b981; background: #f0fdf4; color: #065f46; }
.li-source-sel.src-store { border-color: #f59e0b; background: #fffbeb; color: #92400e; }

/* ── Board: store deliveries panel ── */
.store-deliveries-panel {
    background: #fffbeb;
    border: 1.5px solid #fde68a;
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}
.store-deliveries-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    cursor: pointer;
}
.store-deliveries-panel-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #92400e;
}
.store-del-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: white;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 0.45rem 0.75rem;
    margin-bottom: 0.4rem;
    font-size: 0.8rem;
}
.store-del-job { font-weight: 700; color: var(--text); flex-shrink: 0; }
.store-del-item-name { flex: 1; color: var(--text); }
.store-del-badge { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; background: #fef3c7; color: #92400e; padding: 1px 6px; border-radius: 4px; }

/* ── New request modal: type-chooser replaces tabs ── */
.req-type-chooser {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding: 0.25rem;
    background: #f1f5f9;
    border-radius: 10px;
}
.req-type-btn {
    flex: 1;
    padding: 0.65rem 0.75rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.18s;
    color: var(--text-light);
    text-align: center;
}
.req-type-btn:hover { background: white; color: var(--text); }
.req-type-btn.active { background: white; color: var(--text); box-shadow: 0 2px 8px rgba(15,23,42,0.1); }
.req-type-btn.active.btn-mat  { color: #1e40af; }
.req-type-btn.active.btn-eq   { color: #5b21b6; }

/* Master list quick-pick buttons injected below item field */
.master-quick-section {
    margin-top: 0.5rem;
    padding: 0.6rem 0.75rem;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    display: none;
}
.master-quick-section.open { display: block; }
.master-quick-label { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-light); margin-bottom: 0.4rem; }
.master-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.master-chip {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all 0.13s;
    background: white;
    border-color: var(--border);
    color: var(--text);
}
.master-chip:hover { border-color: var(--accent); color: var(--accent-dark); background: #f0fdf9; }

/* Responsive collapse */
@media (max-width: 900px) {
    .items-table-head { display: none; }
}

@media (max-width: 640px) {
    .li-primary-row {
        grid-template-columns: 26px 1fr 90px 80px;
        gap: 4px;
        padding: 8px;
    }
    .li-primary-row .li-desc-wrap { grid-column: 2 / -1; }
    .li-file-cell { display: none; }
}

@media (max-width: 480px) {
    .li-primary-row {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 10px;
    }
    .li-dispatcher-row { flex-direction: column; }
    .li-file-cell { display: none; }
}
    .li-xl, .li-span4 { grid-column: 1 / -1; }


/* ===================== WORK ORDER CARDS ===================== */
.wo-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1.4rem;
    margin-bottom: 1.2rem;
    transition: box-shadow 0.2s;
}
.wo-card:hover { box-shadow: 0 4px 16px var(--shadow); }
.wo-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.wo-card-id { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.wo-badge {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 700;
    font-family: 'DM Mono', monospace;
}
.wo-area {
    background: var(--bg);
    color: var(--text-light);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    border: 1px solid var(--border);
}
.wo-meta { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 0.82rem; color: var(--text-light); margin-bottom: 0.5rem; }
.wo-items-table { overflow-x: auto; }
.category-badge {
    background: #ede9fe; color: #5b21b6;
    padding: 2px 7px; border-radius: 10px;
    font-size: 0.75rem; font-weight: 600;
}

/* ── Mechanic board specific CSS tweaks ── */
.action-btn.complete { background: #d1fae5; color: #065f46; }
.action-btn.complete:hover { background: #a7f3d0; }
/* ===================== SETTINGS ===================== */
/* ═══════════════════════════════
   SETTINGS — tabbed layout
═══════════════════════════════ */
.settings-shell {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1.5rem;
    align-items: start;
}
.settings-nav {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem;
    position: sticky;
    top: calc(var(--topbar-h) + 1rem);
}
.settings-nav-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    background: none;
    border: none;
    padding: 0.58rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-size: 0.83rem;
    font-weight: 500;
    color: var(--text-light);
    text-align: left;
    transition: all 0.15s;
}
.settings-nav-item:hover { background: var(--bg); color: var(--text); }
.settings-nav-item.active { background: #ecfdf5; color: var(--accent-dark); font-weight: 700; border-left: 3px solid var(--accent); }
.settings-nav-divider { height: 1px; background: var(--border); margin: 0.35rem 0.75rem; }
.settings-nav-label {
    font-size: 0.62rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1px; color: var(--text-light); padding: 0.5rem 0.75rem 0.2rem;
}

/* ── Settings mobile nav select (hidden on desktop) ── */
.settings-mobile-select {
    display: none;
    width: 100%;
    padding: 0.65rem 0.85rem;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    cursor: pointer;
    appearance: auto;
}

/* ── Settings Overview Dashboard ── */
.settings-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 1.5rem;
}
.settings-stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 0.75rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}
.settings-stat:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--accent); }
.settings-stat-value { font-size: 1.75rem; font-weight: 800; color: var(--primary); font-family: 'DM Mono', monospace; line-height: 1; }
.settings-stat-label { font-size: 0.7rem; color: var(--text-light); margin-top: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }

/* ── Pour Waitlist Panel ── */
.waitlist-panel {
    background: #fff7ed;
    border: 2px solid #fed7aa;
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    margin-bottom: 1.25rem;
}
.waitlist-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}
.waitlist-panel-title {
    font-weight: 800;
    font-size: 0.88rem;
    color: #c2410c;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.waitlist-item {
    background: var(--surface);
    border: 1px solid #fed7aa;
    border-radius: 9px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.6rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
}
.waitlist-item:last-child { margin-bottom: 0; }
.waitlist-item-info { flex: 1; min-width: 0; }
.waitlist-item-project { font-weight: 700; font-size: 0.88rem; color: var(--primary); }
.waitlist-item-request { font-size: 0.8rem; color: #78350f; margin-top: 2px; }
.waitlist-item-time { font-size: 0.7rem; color: var(--text-light); margin-top: 3px; font-family: 'DM Mono', monospace; }
.waitlist-item-timer { font-size: 0.72rem; font-weight: 700; color: #92400e; margin-top: 4px; }
.waitlist-item-timer.overdue { color: #dc2626; animation: blink 1.5s infinite; }
.waitlist-item-actions { display: flex; gap: 0.4rem; flex-shrink: 0; }
.waitlist-empty { text-align: center; color: var(--text-light); font-size: 0.82rem; padding: 1rem 0; }

/* ── Automation Controls ── */
.auto-control-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}
.auto-control-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    box-shadow: var(--shadow-sm);
}
.auto-control-card.enabled { border-left: 3px solid var(--accent); }
.auto-control-card.disabled { border-left: 3px solid var(--border); opacity: 0.8; }
.auto-control-info { flex: 1; }
.auto-control-label { font-weight: 700; font-size: 0.88rem; color: var(--text); }
.auto-control-desc { font-size: 0.78rem; color: var(--text-light); margin-top: 3px; line-height: 1.4; }
.settings-panels { min-width: 0; }
.settings-panel { display: none; animation: fadeIn 0.15s ease; }
.settings-panel.active { display: block; }
.settings-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.4rem;
    margin-bottom: 1rem;
}
.settings-section:last-child { margin-bottom: 0; }
.settings-section-title {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1.5px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.settings-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.settings-save-bar {
    display: flex; justify-content: flex-end; gap: 0.65rem;
    padding-top: 1rem; border-top: 1.5px solid var(--border); margin-top: 1rem;
}
.settings-toggle-list { display: flex; flex-direction: column; gap: 0.55rem; }
.settings-toggle {
    display: flex; justify-content: space-between; align-items: center;
    gap: 1rem; padding: 0.65rem 0.85rem;
    background: var(--bg); border-radius: 9px;
    border: 1.5px solid var(--border); cursor: pointer; transition: border-color 0.15s;
}
.settings-toggle:hover { border-color: var(--primary); }
.st-label { font-weight: 600; font-size: 0.85rem; }
.st-desc { font-size: 0.75rem; color: var(--text-light); margin-top: 2px; }
.toggle-switch {
    width: 40px; height: 22px; min-width: 40px;
    background: #d1d5db; border-radius: 11px;
    position: relative; cursor: pointer; transition: background 0.2s;
}
.toggle-switch::after {
    content: ''; position: absolute;
    width: 16px; height: 16px; background: white;
    border-radius: 50%; top: 3px; left: 3px;
    transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch.on { background: var(--primary); }
.toggle-switch.on::after { transform: translateX(18px); }
.tag-list { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 0.75rem; min-height: 28px; }
.tag-item {
    display: inline-flex; align-items: center; gap: 0.35rem;
    background: #e8f4ec; border: 1.5px solid #c6e0cc;
    border-radius: 20px; padding: 3px 10px 3px 8px;
    font-size: 0.8rem; font-weight: 500; color: var(--primary);
    cursor: default; transition: opacity 0.15s, border-color 0.15s;
    user-select: none;
}
.tag-item.dragging { opacity: 0.4; border-style: dashed; }
.tag-item.drag-over { border-color: var(--accent); background: #d1fae5; }
.tag-drag-handle {
    cursor: grab; color: #9ca3af; display: inline-flex; align-items: center;
    padding-right: 2px;
}
.tag-drag-handle:active { cursor: grabbing; }
.tag-remove {
    background: none; border: none; color: #7aaa88;
    cursor: pointer; font-size: 0.7rem; line-height: 1; padding: 0; transition: color 0.1s;
}
.tag-remove:hover { color: var(--danger); }
.add-row { display: flex; gap: 0.5rem; align-items: center; }
.add-row .form-input { flex: 1; }
.data-actions { display: flex; flex-direction: column; gap: 0.6rem; }
.data-actions .btn { justify-content: flex-start; gap: 0.6rem; }
.sys-info {
    margin-top: 1rem; padding: 0.85rem 1rem;
    background: var(--bg); border-radius: 8px;
    font-size: 0.8rem; color: var(--text-light); line-height: 1.8;
}
.sys-info strong { color: var(--text); }

/* ── File upload button ── */
.file-upload-btn {
    display: inline-block;
    padding: 6px 12px;
    background: var(--bg);
    border: 1.5px dashed var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--text-light);
    transition: all .15s;
    white-space: nowrap;
    overflow: hidden;
    max-width: 200px;
    text-overflow: ellipsis;
}
.file-upload-btn:hover { border-color: var(--primary); color: var(--primary); background: #f0f7f3; }
.file-preview { margin-top: 2px; }
.li-file-field { min-width: 160px; }

/* ── Line item row - span helpers ── */
.li-xl    { grid-column: span 2; }
.li-span4 { grid-column: 1 / -1; }  /* always full width regardless of col count */
/* NOTE: base grid (repeat(4,1fr)) and responsive overrides are defined above */

/* ── Equipment status colors ── */
.eq-status-available { color: #065f46; background: #d1fae5; }
.eq-status-deployed  { color: #1e40af; background: #dbeafe; }
.eq-status-maintenance { color: #92400e; background: #fef3c7; }
.eq-status-retired   { color: #6b7280; background: #f3f4f6; }

/* ── category-badge (from WO section, reused) ── */
.category-badge {
    background: #ede9fe; color: #5b21b6;
    padding: 2px 7px; border-radius: 10px;
    font-size: 0.75rem; font-weight: 600;
}

/* ── Stat card improvements ── */
.stat-card { cursor: default; position: relative; transition: transform 0.15s, box-shadow 0.15s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px var(--shadow); }
.stat-icon { font-size: 1.6rem; margin-bottom: 0.4rem; }
.stat-urgent { border-color: #dc2626 !important; animation: pulseCard 2s infinite; }
.stat-urgent .stat-value { color: #dc2626; }
.stat-urgent-dot {
    position: absolute; top: 10px; right: 10px;
    width: 10px; height: 10px;
    background: #dc2626; border-radius: 50%;
    animation: blink 1s infinite;
}
@keyframes pulseCard { 0%,100% { box-shadow: 0 2px 8px rgba(220,38,38,0.2); } 50% { box-shadow: 0 4px 18px rgba(220,38,38,0.4); } }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

/* ── Today panel ── */
.today-panel {
    background: var(--surface);
    border-radius: 12px;
    border: 2px solid var(--border);
    padding: 1.25rem;
    position: sticky;
    top: 1rem;
    max-height: 70vh;
    overflow-y: auto;
}
.today-section { margin-bottom: 1.25rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--border); }
.today-section:last-child { border-bottom: none; margin-bottom: 0; }
.today-title { font-weight: 700; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-light); margin-bottom: 0.5rem; }
.today-empty { color: var(--text-light); font-style: italic; font-size: 0.85rem; }
.today-item { display: flex; gap: 0.5rem; align-items: center; padding: 0.35rem 0; font-size: 0.83rem; flex-wrap: wrap; border-bottom: 1px dashed var(--border); }
.today-item:last-child { border-bottom: none; }
.today-job { font-weight: 700; color: var(--primary); white-space: nowrap; }
.today-driver { color: var(--text-light); margin-left: auto; font-size: 0.78rem; }
.overdue-item { background: #fff7f7; border-radius: 4px; padding: 4px 6px; }

/* ── Responsive dashboard layout ── */
@media (max-width: 900px) { #dashboardLayout { grid-template-columns: 1fr !important; } }

/* ── WO card enhancements ── */
.wo-card-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.75rem; }

/* ── Attachment indicator in table ── */
.attach-icon { font-size: 0.85rem; vertical-align: middle; }

/* ── User form card ── */
#addUserFormCard { animation: slideDown 0.2s ease; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* ── Quick action buttons in rows ── */
.action-btn.complete { background: #d1fae5; color: #065f46; }
.action-btn.complete:hover { background: #a7f3d0; }

/* ── Status dot for GPS ── */
.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.status-dot.active { background: #22c55e; }
.status-dot.idle { background: #f59e0b; }
.status-dot.offline { background: #6b7280; }

/* ── Global search overlay ── */
#globalSearchOverlay {
    position: fixed; inset: 0; z-index: 3000;
    background: rgba(0,0,0,0.55); display: none;
    align-items: flex-start; justify-content: center;
    padding-top: 10vh;
}
#globalSearchBox {
    background: var(--surface); border-radius: 16px;
    width: min(600px, 94vw); box-shadow: 0 24px 64px rgba(0,0,0,0.35);
    overflow: hidden;
}
#globalSearchInput {
    width: 100%; border: none; outline: none; padding: 1.1rem 1.4rem;
    font-family: 'Outfit', sans-serif; font-size: 1.05rem; color: var(--text);
    background: transparent; border-bottom: 2px solid var(--border);
}
#globalSearchResults { padding: 0.5rem 0; max-height: 380px; overflow-y: auto; }
.gsr-item {
    display: flex; align-items: flex-start; gap: 0.9rem;
    padding: 0.7rem 1.2rem; cursor: pointer; transition: background 0.15s;
}
.gsr-item:hover { background: var(--bg); }
.gsr-type { font-size: 1.1rem; flex-shrink: 0; margin-top: 2px; }
.gsr-title { font-weight: 600; font-size: 0.92rem; color: var(--text); }
.gsr-sub { font-size: 0.78rem; color: var(--text-light); margin-top: 2px; }
.gsr-shortcut { padding: 0.5rem 1.2rem; font-size: 0.75rem; color: var(--text-light); border-top: 1px solid var(--border); display: flex; justify-content: space-between; }
/* ── Role badge colors (scoped to .user-role spans only, NOT body) ── */
.user-role.role-admin        { background:#fef3c7;color:#92400e; }
.user-role.role-dispatcher   { background:#dbeafe;color:#1e40af; }
.user-role.role-dispatcher_concrete { background:#e0f2fe;color:#0369a1; }
.user-role.role-dispatcher_materials { background:#dbeafe;color:#1e40af; }
.user-role.role-driver       { background:#d1fae5;color:#065f46; }
.user-role.role-foreman      { background:#ede9fe;color:#5b21b6; }
.user-role.role-supervisor   { background:#fef9c3;color:#854d0e; }
.user-role.role-mechanic     { background:#fee2e2;color:#991b1b; }
.user-role.role-yard         { background:#fce7f3;color:#9d174d; }
.user-role.role-accounting   { background:#f0fdf4;color:#166534; }

/* ═══════════════════════════════════════
   PRIORITY SYSTEM
═══════════════════════════════════════ */
.priority-badge {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 2px 8px; border-radius: 12px;
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.3px;
    white-space: nowrap;
}
.priority-low     { background:#f1f5f9; color:#64748b; }
.priority-normal  { background:#dbeafe; color:#1e40af; }
.priority-high    { background:#fff7ed; color:#c2410c; border:1px solid #fed7aa; }
.priority-emergency { background:#fef2f2; color:#991b1b; border:1px solid #fecaca; animation: urgentPulse 2s infinite; }
@keyframes urgentPulse {
    0%,100% { box-shadow: 0 0 0 0 rgba(220,38,38,0); }
    50%      { box-shadow: 0 0 0 4px rgba(220,38,38,0.15); }
}
tr.priority-emergency-row { background: #fff5f5 !important; }
tr.priority-high-row      { background: #fffbf0 !important; }

/* ═══════════════════════════════════════
   KANBAN DISPATCH BOARD
═══════════════════════════════════════ */
#board-view .board-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1.25rem; flex-wrap: wrap; gap: 0.75rem;
}
.board-wrap {
    display: grid;
    grid-template-columns: repeat(5, minmax(260px, 1fr));
    gap: 0.9rem;
    overflow-x: auto;
    padding-bottom: 1rem;
}
.board-col {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-height: 300px;
    display: flex; flex-direction: column;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.board-col.drag-over {
    border-color: var(--accent);
    background: #ecfdf5;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}
.board-col-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.7rem 0.9rem;
    border-bottom: 1.5px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
}
.board-col-title {
    font-size: 0.75rem; font-weight: 800;
    text-transform: uppercase; letter-spacing: 0.8px;
}
.board-col-count {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; padding: 1px 7px;
    font-size: 0.72rem; font-weight: 700; color: var(--text-light);
}
.board-col-body { padding: 0.6rem; flex: 1; display: flex; flex-direction: column; gap: 0.55rem; }

/* Board grouping headers */
.board-group-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.28rem 0.55rem; margin: 0.45rem 0 0.15rem;
    background: var(--surface); border-radius: 6px;
    font-size: 0.71rem; font-weight: 700; color: var(--text-light);
    cursor: pointer; user-select: none;
    border-left: 3px solid var(--border); letter-spacing: 0.02em;
    transition: background 0.15s;
}
.board-group-header:first-child { margin-top: 0; }
.board-group-header:hover { background: var(--border); color: var(--text); }
.board-group-count {
    background: var(--border); border-radius: 10px;
    padding: 1px 7px; font-size: 0.68rem; font-weight: 700; color: var(--text-light);
}
.board-group-cards { display: flex; flex-direction: column; gap: 0.55rem; margin-bottom: 0.25rem; }
/* Date-level header (outer) */
.board-group-date {
    font-size: 0.73rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
    padding: 0.38rem 0.55rem; margin-top: 0.7rem; border-left-width: 4px;
    background: var(--surface-raised, #f1f5f9);
}
.board-group-date:first-child { margin-top: 0; }
/* Job-level header (inner, indented) */
.board-group-job {
    font-size: 0.69rem; font-weight: 700; letter-spacing: 0.01em;
    padding: 0.22rem 0.5rem 0.22rem 1rem; margin-top: 0.25rem; border-left-width: 3px;
}
/* Container for job sub-groups inside a date group */
.board-group-date-body { display: flex; flex-direction: column; gap: 0; padding-left: 0.3rem; }

/* Batch card item list */
.batch-items-list { display: flex; flex-direction: column; gap: 2px; margin: 0.35rem 0 0.4rem; }
.batch-item-row { display: flex; align-items: center; gap: 5px; font-size: 0.76rem; min-width: 0; }
.batch-item-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.batch-item-desc { flex: 1; min-width: 0; font-weight: 500; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.batch-item-qty { font-size: 0.72rem; color: var(--text-light); white-space: nowrap; font-family: 'DM Mono', monospace; }
.batch-item-vendor { font-size: 0.7rem; color: var(--text-light); background: var(--border); border-radius: 4px; padding: 0 5px; white-space: nowrap; }
.batch-item-more { font-size: 0.72rem; color: var(--text-light); font-style: italic; margin-top: 1px; }
.batch-card { cursor: pointer; }
.batch-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.12); transform: translateY(-1px); transition: all 0.15s; }

/* column accent colors — match pour board color scheme */
.bcol-open    .board-col-header { background: #fff7ed; } .bcol-open    .board-col-title { color: #c2410c; }
.bcol-open    { border-top: 3px solid #f97316; }
.bcol-scheduled .board-col-header { background: #fefce8; } .bcol-scheduled .board-col-title { color: #a16207; }
.bcol-scheduled { border-top: 3px solid #eab308; }
.bcol-onroute  .board-col-header { background: #faf5ff; } .bcol-onroute  .board-col-title { color: #7e22ce; }
.bcol-onroute  { border-top: 3px solid #a855f7; }
.bcol-delivered .board-col-header { background: #f0fdf4; } .bcol-delivered .board-col-title { color: #15803d; }
.bcol-delivered { border-top: 3px solid #22c55e; }
.bcol-completed .board-col-header { background: #f0fdf4; } .bcol-completed .board-col-title { color: #15803d; }
.bcol-completed { border-top: 3px solid #22c55e; }
.bcol-cancelled .board-col-header { background: #fef2f2; } .bcol-cancelled .board-col-title { color: #dc2626; }
.bcol-cancelled { border-top: 3px solid #ef4444; }
.bcol-waitlist  .board-col-header { background: #eff6ff; } .bcol-waitlist  .board-col-title { color: #1d4ed8; }
.bcol-waitlist  { border-top: 3px solid #3b82f6; }
.bcol-waitlist  .board-col-count { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }

/* Pour Board new column colors (Change #3) */
.bcol-pour-open      .board-col-header { background: #fff7ed; } .bcol-pour-open      .board-col-title { color: #c2410c; }
.bcol-pour-open      { border-top: 3px solid #f97316; }
.bcol-pour-waitlist   .board-col-header { background: #dbeafe; } .bcol-pour-waitlist   .board-col-title { color: #1d4ed8; }
.bcol-pour-waitlist   { border-top: 3px solid #3b82f6; }
.bcol-pour-scheduled  .board-col-header { background: #fefce8; } .bcol-pour-scheduled  .board-col-title { color: #a16207; }
.bcol-pour-scheduled  { border-top: 3px solid #eab308; }
.bcol-pour-delivered  .board-col-header { background: #f0fdf4; } .bcol-pour-delivered  .board-col-title { color: #15803d; }
.bcol-pour-delivered  { border-top: 3px solid #22c55e; }
.bcol-pour-cancelled  .board-col-header { background: #fef2f2; } .bcol-pour-cancelled  .board-col-title { color: #dc2626; }
.bcol-pour-cancelled  { border-top: 3px solid #ef4444; }

/* Provider popover */
.provider-popover { animation: fadeIn 0.15s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* Waitlist hold card styling */
.waitlist-card { background: #eff6ff !important; border: 1.5px solid #3b82f6 !important; }
.waitlist-timer { font-size: 0.7rem; font-weight: 600; color: #1e40af; display:flex; align-items:center; gap:4px; }
.waitlist-timer.overdue { color: #dc2626; font-weight: 800; animation: blink 1.5s infinite; }
@keyframes blink { 0%,100%{opacity:1;} 50%{opacity:0.35;} }

/* Waitlist pulse ring */
.waitlist-pulse {
    animation: pulse-orange 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes pulse-orange {
    0%   { box-shadow: 0 0 0 0 rgba(234, 88, 12, 0.4); }
    70%  { box-shadow: 0 0 0 10px rgba(234, 88, 12, 0); }
    100% { box-shadow: 0 0 0 0 rgba(234, 88, 12, 0); }
}

/* Progress bar active-warning (hold state) */
.track-dot.active-warning {
    background: #ea580c !important;
    border-color: #ea580c !important;
    color: white !important;
    animation: pulse-orange 2s infinite;
}

.dispatch-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.7rem 0.8rem;
    cursor: grab;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}
.dispatch-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--accent);
}
.dispatch-card.dragging { opacity: 0.5; cursor: grabbing; }
.dispatch-card.priority-emergency-card { border-left: 4px solid #dc2626 !important; }
.dispatch-card.priority-high-card      { border-left: 4px solid #f97316 !important; }
.dispatch-card.priority-normal-card    { border-left: 2px solid #3b82f6; }
.dispatch-card.priority-low-card       { border-left: 2px solid #94a3b8; }

.card-job { font-size: 0.72rem; font-weight: 700; color: var(--text-light); margin-bottom: 2px; font-family: 'DM Mono', monospace; }
.card-item { font-size: 0.85rem; font-weight: 700; color: var(--text); margin-bottom: 4px; line-height: 1.25; }
.card-meta { font-size: 0.75rem; color: var(--text-light); display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.card-tag { background: var(--bg); border-radius: 6px; padding: 1px 6px; font-size: 0.7rem; }
.card-footer { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-top: 4px; }
.card-driver-btn {
    flex: 1; background: none; border: 1.5px dashed var(--border);
    border-radius: 6px; padding: 3px 7px; font-size: 0.72rem;
    color: var(--text-light); cursor: pointer; font-family: 'Outfit', sans-serif;
    text-align: left; transition: all 0.15s; white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis; max-width: 120px;
}
.card-driver-btn.assigned { background: #f0fdf4; border-color: #86efac; color: var(--primary); font-weight: 600; border-style: solid; }
.card-driver-btn:hover { border-color: var(--primary); }
.card-overdue { font-size: 0.68rem; font-weight: 700; color: #dc2626; }

/* empty col placeholder */
.board-empty { color: var(--text-light); font-size: 0.8rem; text-align: center; padding: 1.5rem 0.5rem; opacity: 0.6; }

/* ═══════════════════════════════════════
   DARK MODE
═══════════════════════════════════════ */
body.dark-mode {
    --bg: #0f1612;
    --surface: #1a2420;
    --border: #2d3d35;
    --text: #e2ebe5;
    --text-light: #7a9585;
    --primary: #93c5fd;
    --primary-light: #bfdbfe;
    --shadow-sm: 0 1px 4px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
    --sidebar-bg: #0a100d;
}
body.dark-mode .header     { background: #131f19; border-color: #2d3d35; }
body.dark-mode .card       { background: #1a2420; border-color: #2d3d35; }
body.dark-mode .data-table thead tr { background: #1e2e26; }
body.dark-mode .data-table tbody tr:hover { background: #1e2834; }
body.dark-mode .form-input,
body.dark-mode .form-select,
body.dark-mode .form-textarea { background: #0f1612; border-color: #2d3d35; color: var(--text); }
body.dark-mode .modal-content { background: #1a2420; }
body.dark-mode .modal-header  { background: #131f19; border-color: #2d3d35; }
body.dark-mode .dispatch-card { background: #1a2420; border-color: #2d3d35; }
body.dark-mode .board-col     { background: #111b16; }
body.dark-mode .board-col.drag-over { background: #162219; }
body.dark-mode .dispatch-card:hover { border-color: var(--primary); }
body.dark-mode .settings-section { background: #1a2420; }
body.dark-mode .settings-nav { background: #1a2420; }
body.dark-mode .status-dropdown,
body.dark-mode .driver-dropdown { background: #1a2420; border-color: #2d3d35; }
body.dark-mode .driver-option:hover,
body.dark-mode .status-option:hover { background: #0f1612; }

/* Pour details yellow section — readable in dark mode */
body.dark-mode .pour-details-box {
    background: #1e2d1a !important;
    border-color: #4d7c50 !important;
}
body.dark-mode .pour-details-box .checkbox-label,
body.dark-mode .pour-details-box .form-label {
    color: var(--text);
}
body.dark-mode .pour-details-box h4 {
    color: #a3d9a5 !important;
}
body.dark-mode .pour-modal-header {
    background: linear-gradient(135deg, #1a2d1a 0%, #1e3320 100%) !important;
    border-color: #4d7c50 !important;
}
body.dark-mode .pour-modal-header .modal-title {
    color: #a3d9a5 !important;
}

/* Mix library job# rows in dark mode */
body.dark-mode .mix-job-row td {
    background: #0c2a3a !important;
    color: #7dd3fc !important;
    border-left-color: #0ea5e9 !important;
    border-bottom-color: #1e3a4a !important;
}

.dark-toggle {
    background: none; border: none; cursor: pointer;
    font-size: 1.1rem; padding: 4px 8px; border-radius: 8px;
    transition: background 0.15s; color: var(--text-light);
}
.dark-toggle:hover { background: var(--bg); }

/* ════════════════════════════════════════════════════════
   DARK MODE — COMPREHENSIVE INLINE COLOR OVERRIDES
   Fixes hardcoded light hex colors in JS-rendered HTML
════════════════════════════════════════════════════════ */

/* Ensure text is readable in all card types */
body.dark-mode .request-card,
body.dark-mode .dispatch-card { color: var(--text); }

/* ── Board dispatch cards: status background tinting ── */
body.dark-mode .dispatch-card[style*="background:#fff7ed"] { background: #2a1200 !important; }
body.dark-mode .dispatch-card[style*="background:#fefce8"] { background: #1c1500 !important; }
body.dark-mode .dispatch-card[style*="background:#faf5ff"] { background: #180e2c !important; }
body.dark-mode .dispatch-card[style*="background:#f0fdf4"] { background: #081a0e !important; }
body.dark-mode .dispatch-card[style*="background:#fef2f2"] { background: #1f0808 !important; }

/* ── Badge/pill spans inside cards — light bg → dark bg ── */
/* Orange (OPEN / warning) */
body.dark-mode .request-card span[style*="background:#fff7ed"],
body.dark-mode .request-card span[style*="background:#fef3c7"],
body.dark-mode .request-card span[style*="background:#fff7ed"] { background: #2a1200 !important; color: #fb923c !important; }
/* Blue (info / waitlist) */
body.dark-mode .request-card span[style*="background:#eff6ff"],
body.dark-mode .request-card span[style*="background:#dbeafe"],
body.dark-mode .request-card span[style*="background:#e0f2fe"],
body.dark-mode .request-card span[style*="background:#f0f9ff"] { background: #0c1828 !important; color: #93c5fd !important; }
/* Green (success / delivered) */
body.dark-mode .request-card span[style*="background:#f0fdf4"],
body.dark-mode .request-card span[style*="background:#dcfce7"],
body.dark-mode .request-card span[style*="background:#d1fae5"] { background: #081a0e !important; color: #86efac !important; }
/* Yellow (scheduled / pour type) */
body.dark-mode .request-card span[style*="background:#fefce8"],
body.dark-mode .request-card span[style*="background:#fef3c7"] { background: #1c1500 !important; color: #fde047 !important; }
/* Purple (on route / pump) */
body.dark-mode .request-card span[style*="background:#faf5ff"],
body.dark-mode .request-card span[style*="background:#f5f3ff"],
body.dark-mode .request-card span[style*="background:#ede9fe"] { background: #180e2c !important; color: #c4b5fd !important; }
/* Red (cancelled / warning) */
body.dark-mode .request-card span[style*="background:#fee2e2"],
body.dark-mode .request-card span[style*="background:#fef2f2"],
body.dark-mode .request-card span[style*="background:#fca5a5"] { background: #220808 !important; color: #fca5a5 !important; }
/* Grey (default/misc) */
body.dark-mode .request-card span[style*="background:#f3f4f6"],
body.dark-mode .request-card span[style*="background:#f8fafc"],
body.dark-mode .request-card span[style*="background:var(--bg)"] { background: #1e2e26 !important; color: var(--text) !important; }

/* ── Alert/notice divs inside cards ── */
/* Dispatcher notes (blue) */
body.dark-mode .request-card div[style*="background:#eff6ff"] { background: #0c1828 !important; border-color: #3b82f6 !important; color: #93c5fd !important; }
body.dark-mode .request-card div[style*="background:#dbeafe"] { background: #0c1828 !important; color: #93c5fd !important; }
/* Date-change alert (red) */
body.dark-mode .request-card div[style*="background:#fef2f2"] { background: #1f0808 !important; border-color: #ef4444 !important; }
/* Certification warning (red) */
body.dark-mode .request-card div[style*="background:#fef2f2;border:1px solid #fca5a5"] { background: #1f0808 !important; border-color: #dc2626 !important; color: #fca5a5 !important; }
/* Grout primer warning (yellow) */
body.dark-mode .request-card div[style*="background:#fef3c7"] { background: #1c1500 !important; border-color: #eab308 !important; color: #fde047 !important; }
/* Receipt confirmed (green) */
body.dark-mode .request-card div[style*="background:#f0fdf4;border:1px solid #86efac"] { background: #081a0e !important; color: #86efac !important; }
/* Pump section (purple) */
body.dark-mode .request-card div[style*="background:#f5f3ff"] { background: #180e2c !important; color: #c4b5fd !important; }

/* ── "Call dispatcher" locked notice ── */
body.dark-mode div[style*="background:#fef2f2;border:1px solid #fca5a5;border-radius:8px"] {
    background: #1f0808 !important; border-color: #dc2626 !important; color: #fca5a5 !important;
}

/* ── Supervisor/foreman view: general label colors ── */
body.dark-mode .request-card [style*="color:#0369a1"] { color: #7dd3fc !important; }
body.dark-mode .request-card [style*="color:#15803d"] { color: #86efac !important; }
body.dark-mode .request-card [style*="color:#c2410c"] { color: #fb923c !important; }
body.dark-mode .request-card [style*="color:#92400e"] { color: #fbbf24 !important; }
body.dark-mode .request-card [style*="color:#1e40af"] { color: #93c5fd !important; }
body.dark-mode .request-card [style*="color:#6d28d9"] { color: #c4b5fd !important; }
body.dark-mode .request-card [style*="color:#7c3aed"] { color: #c4b5fd !important; }
body.dark-mode .request-card [style*="color:#991b1b"] { color: #fca5a5 !important; }
body.dark-mode .request-card [style*="color:#854d0e"] { color: #fde047 !important; }

/* ── Data table rows with hardcoded backgrounds ── */
body.dark-mode .data-table tbody tr[style*="background:#f0fdf4"] { background: #081a0e !important; }
body.dark-mode .data-table tbody tr[style*="background:#fef2f2"] { background: #1f0808 !important; }
body.dark-mode .data-table tbody tr[style*="background:#fefce8"] { background: #1c1500 !important; }
body.dark-mode .data-table tbody tr[style*="background:#eff6ff"] { background: #0c1828 !important; }
body.dark-mode .data-table td[style*="color:#15803d"] { color: #86efac !important; }
body.dark-mode .data-table td[style*="color:#991b1b"] { color: #fca5a5 !important; }
body.dark-mode .data-table td[style*="color:#92400e"] { color: #fbbf24 !important; }
body.dark-mode .data-table td[style*="color:#1e40af"] { color: #93c5fd !important; }

/* ── Dashboard stat cards ── */
body.dark-mode .stat-card { background: #1a2420 !important; border-color: #2d3d35 !important; }

/* ── Driver route cards ── */
body.dark-mode .driver-route-card { background: #1a2420 !important; border-color: #2d3d35 !important; }
body.dark-mode .drc-header { background: #131f19 !important; }

/* ── Nav tabs / filter pills with hardcoded active backgrounds ── */
body.dark-mode .nav-btn:not(.active) { color: var(--text) !important; }

/* ── Modal / settings light-colored sections ── */
body.dark-mode .settings-tab-content [style*="background:#f8fafc"],
body.dark-mode .settings-tab-content [style*="background:#f3f4f6"],
body.dark-mode .settings-tab-content [style*="background:#f9fafb"] { background: #131f19 !important; color: var(--text) !important; }

/* ── Info/warning boxes in modals ── */
body.dark-mode .modal-body [style*="background:#eff6ff"] { background: #0c1828 !important; color: #93c5fd !important; }
body.dark-mode .modal-body [style*="background:#fef3c7"] { background: #1c1500 !important; color: #fde047 !important; }
body.dark-mode .modal-body [style*="background:#f0fdf4"] { background: #081a0e !important; color: #86efac !important; }
body.dark-mode .modal-body [style*="background:#fef2f2"] { background: #1f0808 !important; color: #fca5a5 !important; }
body.dark-mode .modal-body [style*="background:#fee2e2"] { background: #1f0808 !important; color: #fca5a5 !important; }

/* ── Pour board calendar cells ── */
body.dark-mode .cal-pour-pill[style*="background:#"] { filter: brightness(0.7) saturate(1.2); }

/* ── Empty state icons ── */
body.dark-mode .empty-state-text { color: var(--text-light); }

/* ════════════════════════════════════════════════════════
   DARK MODE — POUR BOARD CARD INNER ELEMENTS
════════════════════════════════════════════════════════ */
body.dark-mode .board-card { color: var(--text); }

/* Job # color */
body.dark-mode .board-card [style*="color:#1e40af"] { color: #93c5fd !important; }
body.dark-mode .board-card [style*="color:#0369a1"] { color: #7dd3fc !important; }

/* Pour type badge (yellow) */
body.dark-mode .board-card span[style*="background:#fef3c7"] { background: #1c1500 !important; color: #fde047 !important; }

/* Order # badge (green) */
body.dark-mode .board-card div[style*="background:#f0fdf4"] { background: #081a0e !important; color: #86efac !important; }

/* Provider color */
body.dark-mode .board-card [style*="color:#7c3aed"] { color: #c4b5fd !important; }
body.dark-mode .board-card [style*="color:#065f46"] { color: #86efac !important; }

/* Dispatcher notes (blue) */
body.dark-mode .board-card div[style*="background:#eff6ff"] { background: #0c1828 !important; border-color: #3b82f6 !important; color: #93c5fd !important; }

/* Pump info box (purple) */
body.dark-mode .board-card div[style*="background:#f5f3ff"] { background: #180e2c !important; border-color: #8b5cf6 !important; color: #c4b5fd !important; }
body.dark-mode .board-card div[style*="background:#f5f3ff"] [style*="color:#6d28d9"] { color: #c4b5fd !important; }

/* Pump confirmed (yellow) */
body.dark-mode .board-card div[style*="background:#fefce8;border:2px solid #eab308"] { background: #1c1500 !important; border-color: #eab308 !important; color: #fde047 !important; }
body.dark-mode .board-card div[style*="background:#fefce8;border:2px solid #eab308"] [style*="color:#a16207"] { color: #fde047 !important; }

/* Pump not confirmed (blue) */
body.dark-mode .board-card div[style*="background:#eff6ff;border:2px solid #3b82f6"] { background: #0c1828 !important; border-color: #3b82f6 !important; }
body.dark-mode .board-card div[style*="background:#eff6ff;border:2px solid #3b82f6"] [style*="color:#1d4ed8"] { color: #93c5fd !important; }

/* Pump cancelled (red) */
body.dark-mode .board-card div[style*="background:#fef2f2"] { background: #1f0808 !important; border-color: #ef4444 !important; color: #fca5a5 !important; }

/* Pump not cancelled (yellow/amber) */
body.dark-mode .board-card div[style*="background:#fefce8;border:2px solid #eab308"] [style*="color:#92400e"] { color: #fde047 !important; }

/* Certification / grout primer warnings */
body.dark-mode .board-card div[style*="background:#fef2f2;border:1px solid #fca5a5"] { background: #1f0808 !important; border-color: #dc2626 !important; color: #fca5a5 !important; }
body.dark-mode .board-card div[style*="background:#fef3c7;border:1px solid #fde68a"] { background: #1c1500 !important; border-color: #eab308 !important; color: #fde047 !important; }

/* Notes box */
body.dark-mode .board-card div[style*="background:#f8fafc"] { background: #131f19 !important; border-color: var(--border) !important; color: var(--text) !important; }

/* Date changed badge */
body.dark-mode .board-card span[style*="background:#fef2f2;color:#dc2626"] { background: #1f0808 !important; color: #fca5a5 !important; }

/* Mix approved/pending badges */
body.dark-mode .board-card span[style*="background:#f0fdf4"] { background: #081a0e !important; color: #86efac !important; }
body.dark-mode .board-card span[style*="background:#fff7ed"] { background: #2a1200 !important; color: #fb923c !important; }

/* ── Address book card body text ── */
body.dark-mode #jobSitesList .data-table td { color: var(--text); }
body.dark-mode #jobSitesList [style*="color:#1d4ed8"] { color: #93c5fd !important; }
body.dark-mode #jobSitesList a[style*="color:#1d4ed8"] { color: #93c5fd !important; }

/* ════════════════════════════════════════════════════════
   DARK MODE — BOARD COLUMN HEADERS (dispatch + pour board)
════════════════════════════════════════════════════════ */
/* Materials board column headers */
body.dark-mode .bcol-open      .board-col-header { background: #2a1200 !important; }
body.dark-mode .bcol-open      .board-col-title  { color: #fb923c !important; }
body.dark-mode .bcol-scheduled .board-col-header { background: #1c1500 !important; }
body.dark-mode .bcol-scheduled .board-col-title  { color: #fde047 !important; }
body.dark-mode .bcol-onroute   .board-col-header { background: #180e2c !important; }
body.dark-mode .bcol-onroute   .board-col-title  { color: #c4b5fd !important; }
body.dark-mode .bcol-delivered .board-col-header { background: #081a0e !important; }
body.dark-mode .bcol-delivered .board-col-title  { color: #86efac !important; }
body.dark-mode .bcol-completed .board-col-header { background: #081a0e !important; }
body.dark-mode .bcol-completed .board-col-title  { color: #86efac !important; }
body.dark-mode .bcol-cancelled .board-col-header { background: #1f0808 !important; }
body.dark-mode .bcol-cancelled .board-col-title  { color: #fca5a5 !important; }
body.dark-mode .bcol-waitlist  .board-col-header { background: #0c1828 !important; }
body.dark-mode .bcol-waitlist  .board-col-title  { color: #93c5fd !important; }
body.dark-mode .bcol-waitlist  .board-col-count  { background: #0c1828 !important; color: #93c5fd !important; border-color: #1d4ed8 !important; }
/* Pour board column headers */
body.dark-mode .bcol-pour-open      .board-col-header { background: #2a1200 !important; }
body.dark-mode .bcol-pour-open      .board-col-title  { color: #fb923c !important; }
body.dark-mode .bcol-pour-waitlist  .board-col-header { background: #0c1828 !important; }
body.dark-mode .bcol-pour-waitlist  .board-col-title  { color: #93c5fd !important; }
body.dark-mode .bcol-pour-scheduled .board-col-header { background: #1c1500 !important; }
body.dark-mode .bcol-pour-scheduled .board-col-title  { color: #fde047 !important; }
body.dark-mode .bcol-pour-delivered .board-col-header { background: #081a0e !important; }
body.dark-mode .bcol-pour-delivered .board-col-title  { color: #86efac !important; }
body.dark-mode .bcol-pour-cancelled .board-col-header { background: #1f0808 !important; }
body.dark-mode .bcol-pour-cancelled .board-col-title  { color: #fca5a5 !important; }
/* Waitlist card dark override */
body.dark-mode .board-card.waitlist-card { background: #0c1828 !important; border-color: #3b82f6 !important; }
body.dark-mode .waitlist-timer           { color: #93c5fd !important; }
body.dark-mode .waitlist-timer.overdue   { color: #fca5a5 !important; }

/* ════════════════════════════════════════════════════════
   DARK MODE — REQUESTS TABLE ROW BACKGROUNDS
════════════════════════════════════════════════════════ */
body.dark-mode #requestsTableBody tr[style*="background:#fff7ed"] { background: #2a1200 !important; }
body.dark-mode #requestsTableBody tr[style*="background:#eff6ff"] { background: #0c1828 !important; }
body.dark-mode #requestsTableBody tr[style*="background:#fefce8"] { background: #1c1500 !important; }
body.dark-mode #requestsTableBody tr[style*="background:#faf5ff"] { background: #180e2c !important; }
body.dark-mode #requestsTableBody tr[style*="background:#f0fdf4"] { background: #081a0e !important; }
body.dark-mode #requestsTableBody tr[style*="background:#fef2f2"] { background: #1f0808 !important; }
/* Type badges inside request table rows */
body.dark-mode #requestsTableBody span[style*="background:#ede9fe"] { background: #180e2c !important; color: #c4b5fd !important; }
body.dark-mode #requestsTableBody span[style*="background:#fce7f3"] { background: #220820 !important; color: #f0abfc !important; }
body.dark-mode #requestsTableBody span[style*="background:#fef3c7"] { background: #1c1500 !important; color: #fde047 !important; }
body.dark-mode #requestsTableBody span[style*="background:#dbeafe"] { background: #0c1828 !important; color: #93c5fd !important; }
body.dark-mode #requestsTableBody { color: var(--text); }

/* ── Mobile Board Improvements ── */
@media (max-width: 768px) {
    .board-wrap {
        grid-template-columns: repeat(5, minmax(230px, 1fr)) !important;
        gap: 0.6rem !important;
    }
    .dispatch-card { padding: 0.55rem 0.65rem; }
    .card-item { font-size: 0.8rem; }
    .card-meta { font-size: 0.7rem; }
    .driver-lane { flex-wrap: wrap; }
    .lane-cards { min-height: 28px; }
    /* Revert to single-line truncation on mobile — cards too narrow for 2-line wrap */
    .batch-item-desc { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -webkit-line-clamp: unset; }
}

/* ── Sticky column headers on board ── */
.board-col-header {
    position: sticky !important;
    top: 0;
    z-index: 5;
    border-radius: var(--radius) var(--radius) 0 0;
}

/* ── Card hover quick-actions ── */
.dispatch-card .card-actions-hover {
    display: none;
    position: absolute;
    top: 6px;
    right: 6px;
    gap: 4px;
}
.dispatch-card:hover .card-actions-hover { display: flex; }
.card-action-mini {
    width: 24px; height: 24px; border-radius: 5px;
    background: rgba(255,255,255,0.9); border: 1px solid var(--border);
    cursor: pointer; font-size: 0.75rem; display: flex;
    align-items: center; justify-content: center;
    transition: all 0.15s;
}
.card-action-mini:hover { background: var(--primary); color: white; border-color: var(--primary); }

/* ── Board empty column placeholder ── */
.board-empty {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; height: 80px;
    border: 2px dashed var(--border); border-radius: 8px;
    color: var(--text-light); font-size: 0.75rem; margin: 4px;
    opacity: 0.5; transition: all 0.2s;
}
.board-col.drag-over .board-empty {
    border-color: var(--accent); opacity: 1; color: var(--accent-dark);
    background: rgba(16,185,129,0.04);
}

/* ═══════════════════════════════════════
   DRIVER MOBILE MODE
═══════════════════════════════════════ */
.mobile-driver-view { display: none; }
@media (max-width: 768px) {
    .mobile-driver-view.driver-active { display: block; }
    body.driver-mobile .sidebar { display: none; }
    body.driver-mobile .main-area { margin-left: 0; }
    body.driver-mobile .header { padding: 0 1rem; }
}
.driver-mobile-header {
    background: var(--sidebar-bg);
    color: white;
    padding: 1rem 1.25rem;
    border-radius: var(--radius) var(--radius) 0 0;
    display: flex; align-items: center; justify-content: space-between;
}
.driver-mobile-header h3 { margin: 0; font-size: 1rem; }
.driver-route-card {
    background: white;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 0.85rem;
    box-shadow: var(--shadow-sm);
}
.drc-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
.drc-num { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: white; font-size: 0.8rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.drc-body { padding: 0.85rem 1rem; }
.drc-field { display: flex; gap: 0.5rem; margin-bottom: 0.4rem; font-size: 0.85rem; }
.drc-label { color: var(--text-light); min-width: 70px; font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.drc-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; padding: 0.75rem 1rem; border-top: 1px solid var(--border); background: var(--bg); }
.drc-btn { padding: 0.55rem; border: none; border-radius: 8px; font-family: 'Outfit',sans-serif; font-weight: 700; font-size: 0.82rem; cursor: pointer; transition: all 0.15s; }
.drc-btn-route  { background: #2563eb; color: white; }
.drc-btn-arrive { background: #f59e0b; color: white; }
.drc-btn-deliver { background: #16a34a; color: white; grid-column: 1/-1; font-size: 0.9rem; padding: 0.75rem; }
.drc-btn:hover { filter: brightness(1.08); }

/* ═══════════════════════════════════════
   DRIVER LANES
═══════════════════════════════════════ */
.driver-lane {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 0.6rem 0.85rem;
    min-height: 62px;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.driver-lane.drag-over {
    border-color: var(--primary);
    background: #edf7f0;
    box-shadow: 0 0 0 3px rgba(34,107,64,0.12);
}
.lane-avatar {
    width: 36px; height: 36px; min-width: 36px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 800; color: white;
    margin-top: 2px;
}
.lane-info { min-width: 90px; }
.lane-name { font-size: 0.82rem; font-weight: 700; color: var(--text); }
.lane-load { font-size: 0.7rem; color: var(--text-light); margin-top: 1px; }
.lane-cards {
    display: flex; flex-wrap: wrap; gap: 0.4rem;
    flex: 1; align-items: flex-start; align-content: flex-start; min-height: 36px;
}
.lane-empty { font-size: 0.75rem; color: var(--text-light); opacity: 0.5; align-self: center; }
.lane-card {
    display: inline-flex; align-items: center; gap: 5px;
    background: #f0fdf4; border: 1.5px solid #86efac;
    border-radius: 8px; padding: 3px 8px 3px 10px;
    font-size: 0.75rem; font-weight: 600; color: var(--primary);
    max-width: 190px;
}
.lane-card.p-emergency { background:#fff5f5; border-color:#fca5a5; color:#dc2626; }
.lane-card.p-high      { background:#fff7ed; border-color:#fdba74; color:#c2410c; }
.lane-card-x {
    background: none; border: none; cursor: pointer; padding: 0;
    color: #86efac; font-size: 0.72rem; line-height: 1; transition: color 0.1s;
}
.lane-card-x:hover { color: #dc2626; }

/* ═══════════════════════════════════════
   DAILY REPORT
═══════════════════════════════════════ */
.report-kpi-grid {
    display: grid; grid-template-columns: repeat(auto-fit,minmax(110px,1fr)); gap: 0.75rem; margin-bottom: 1.25rem;
}
.report-kpi {
    background: var(--bg); border: 1.5px solid var(--border); border-radius: 10px;
    padding: 0.9rem 0.75rem; text-align: center;
}
.report-kpi-val { font-size: 1.8rem; font-weight: 800; color: var(--primary); font-family:'DM Mono',monospace; line-height: 1; }
.report-kpi-label { font-size: 0.7rem; color: var(--text-light); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.report-section { margin-bottom: 1.1rem; }
.report-section-title { font-size: 0.8rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-light); margin-bottom: 0.45rem; }
.report-row { display:flex; justify-content:space-between; align-items:center; padding:0.35rem 0; font-size:0.82rem; border-bottom:1px solid var(--border); }
.report-row:last-child { border-bottom:none; }
.report-bar-wrap { height:6px; background:var(--border); border-radius:3px; flex:1; margin:0 0.75rem; max-width:120px; }
.report-bar { height:100%; background:var(--primary); border-radius:3px; transition:width 0.4s; }

/* ═══════════════════════════════════════
   AUTO-DISPATCH PREVIEW
═══════════════════════════════════════ */
.ad-assignment {
    display:flex; align-items:center; gap:0.75rem;
    padding:0.65rem 0.75rem; background:var(--bg);
    border-radius:9px; border:1.5px solid var(--border); margin-bottom:0.5rem;
}
.ad-assignment .lane-avatar { width:30px; height:30px; min-width:30px; font-size:0.68rem; }
.ad-job-label { font-size:0.82rem; font-weight:600; color:var(--text); }
.ad-job-meta  { font-size:0.72rem; color:var(--text-light); }
.ad-arrow { color:var(--primary); font-size:1rem; }

/* requestor tracking timeline */
.track-timeline { display:flex; flex-direction:column; gap:0; }
.track-step {
    display:flex; gap:0.85rem; align-items:flex-start;
    padding-bottom:1rem; position:relative;
}
.track-step:not(:last-child)::before {
    content:''; position:absolute; left:14px; top:28px;
    width:2px; bottom:0; background:var(--border);
}
.track-dot {
    width:28px; height:28px; min-width:28px; border-radius:50%;
    display:flex; align-items:center; justify-content:center;
    font-size:0.8rem; border:2px solid var(--border); background:var(--surface); z-index:1;
}
.track-dot.done  { background:var(--primary); border-color:var(--primary); color:white; }
.track-dot.active{ background:#fff7ed; border-color:#f97316; color:#c2410c; animation: urgentPulse 2s infinite; }
.track-label { font-size:0.85rem; font-weight:600; color:var(--text); margin-top:4px; }
.track-meta  { font-size:0.75rem; color:var(--text-light); }

/* ═══════════════════════════════════════════════════════
   POUR VIEW TABS & CALENDAR
═══════════════════════════════════════════════════════ */
.pour-view-tab { background:var(--surface);border:none;padding:6px 14px;font-family:'Outfit',sans-serif;font-size:0.78rem;font-weight:600;color:var(--text);cursor:pointer;transition:all 0.15s; }
.pour-view-tab:hover { background:var(--bg);color:var(--text); }
.pour-view-tab.active { background:#2563eb;color:white; }

/* Month grid */
.pc-grid-hdr { display:grid;grid-template-columns:repeat(7,1fr);gap:2px;margin-bottom:2px; }
.pc-hdr { text-align:center;font-size:0.7rem;font-weight:700;text-transform:uppercase;letter-spacing:0.06em;color:var(--text-light);padding:6px 0; }
.pc-grid { display:grid;grid-template-columns:repeat(7,1fr);gap:3px; }
.pc-cell { min-height:90px;border:1px solid var(--border);border-radius:8px;padding:5px;background:var(--surface);cursor:pointer;transition:border-color 0.15s;overflow:hidden; }
.pc-cell:hover { border-color:var(--accent);box-shadow:0 2px 8px rgba(0,0,0,0.06); }
.pc-cell.pc-today { border-color:var(--accent);border-width:2px;background:#f0fdf9; }
.pc-cell.pc-other { background:var(--bg);opacity:0.4;cursor:default;pointer-events:none; }
.pc-num { font-size:0.78rem;font-weight:700;color:var(--text-light);display:flex;align-items:center;gap:4px;margin-bottom:3px; }
.pc-cell.pc-today .pc-num { color:var(--accent);font-weight:800; }
.pc-badge { font-size:0.6rem;background:var(--accent);color:white;border-radius:8px;padding:0 5px;font-weight:700; }

/* Pour calendar events */
.pc-evt { font-size:0.65rem;padding:2px 5px;border-radius:4px;margin-bottom:2px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:pointer;border-left:3px solid;transition:opacity 0.1s; }
.pc-evt:hover { opacity:0.75; }
.pc-evt-lg { font-size:0.8rem;padding:6px 8px;border-radius:6px;margin-bottom:3px;font-weight:500;cursor:pointer;border-left:3px solid;white-space:normal;transition:opacity 0.1s; }
.pc-evt-lg:hover { opacity:0.75; }
.pce-open { background:#eff6ff;color:#2563eb;border-color:#2563eb; }
.pce-sched { background:#fffbeb;color:#b45309;border-color:#f59e0b; }
.pce-route { background:#faf5ff;color:#7c3aed;border-color:#7c3aed; }
.pce-done { background:#f0fdf4;color:#16a34a;border-color:#16a34a; }
.pce-hold { background:#fff7ed;color:#c2410c;border-color:#ea580c; }

/* Week grid */
.pc-week { display:grid;grid-template-columns:56px repeat(7,1fr);border:1px solid var(--border);border-radius:8px;overflow:hidden; }
.pc-wh { font-size:0.7rem;font-weight:700;text-transform:uppercase;color:var(--text-light);padding:7px 4px;text-align:center;border-bottom:1px solid var(--border);background:var(--bg); }
.pc-wh-today { background:#f0fdf9;color:var(--accent); }
.pc-wt { font-size:0.65rem;color:var(--text-light);font-family:'DM Mono',monospace;padding:3px 4px;text-align:right;border-right:1px solid var(--border);border-bottom:1px solid #f1f5f9;min-height:42px;display:flex;align-items:flex-start;justify-content:flex-end; }
.pc-wc { border-right:1px solid #f1f5f9;border-bottom:1px solid #f1f5f9;min-height:42px;padding:2px;cursor:pointer; }
.pc-wc:hover { background:#f8fafc; }
.pc-wc-today { background:rgba(16,185,129,0.03); }

/* Day view */
.pc-day-summary { display:flex;gap:1.25rem;padding:0.7rem 1rem;background:var(--bg);border-radius:8px;margin-bottom:0.5rem;font-size:0.85rem;border:1px solid var(--border);flex-wrap:wrap; }
.pc-day-wrap { border:1px solid var(--border);border-radius:8px;overflow:hidden; }
.pc-ds { display:flex;border-bottom:1px solid #f1f5f9;min-height:52px; }
.pc-ds:hover { background:#f8fafc; }
.pc-dt { width:70px;font-size:0.72rem;color:var(--text-light);font-family:'DM Mono',monospace;padding:7px;border-right:1px solid var(--border);flex-shrink:0; }
.pc-de { flex:1;padding:4px 8px;display:flex;flex-direction:column;gap:3px; }

/* Pour day modal cards */
.pdm-card { background:var(--surface);border:1.5px solid var(--border);border-radius:10px;padding:0.85rem 1rem;margin-bottom:0.65rem;cursor:pointer;transition:all 0.15s; }
.pdm-card:hover { border-color:var(--accent);box-shadow:0 4px 12px rgba(0,0,0,0.08);transform:translateY(-1px); }

/* ═══════════════════════════════════════════════════════
   MOBILE IMPROVEMENTS
═══════════════════════════════════════════════════════ */

/* Prevent iOS auto-zoom on input focus */
input, select, textarea { font-size: 16px !important; }

/* Login screen — mobile centering */
@media (max-width: 520px) {
    .login-container { padding: 1rem; }
    .login-box { padding: 1.75rem 1.5rem; }
    .login-logo img { max-width: 220px; }
}

/* Safe area for notched phones */
@supports(padding: env(safe-area-inset-top)) {
    body { padding-top:env(safe-area-inset-top);padding-bottom:env(safe-area-inset-bottom); }
}

/* Mobile card tables */
@media (max-width: 768px) {
    /* Tables become stacked cards */
    .data-table thead { display:none; }
    .data-table, .data-table tbody, .data-table tr, .data-table td { display:block;width:100%; }
    .data-table tr { background:var(--surface);border:1px solid var(--border);border-radius:10px;margin-bottom:0.75rem;padding:0.5rem;box-shadow:0 1px 4px rgba(0,0,0,0.04); }
    .data-table td { text-align:right;padding:6px 8px;border:none;position:relative;display:flex;justify-content:space-between;align-items:center;min-height:36px;border-bottom:1px solid #f1f5f9; }
    .data-table td:last-child { border-bottom:none; }
    .data-table td::before { content:attr(data-label);font-weight:700;color:var(--text-light);text-transform:uppercase;font-size:0.65rem;text-align:left;flex-shrink:0;margin-right:0.5rem; }
    .data-table td .action-btn { width:auto;min-height:36px; }

    /* Compact card cell — overrides the flex row layout above */
    .data-table td.mobile-compact-card {
        display: block !important;
        text-align: left !important;
        min-height: 0 !important;
        padding: 0.75rem 0.85rem !important;
        border-bottom: none !important;
        align-items: initial !important;
        justify-content: initial !important;
    }
    .data-table td.mobile-compact-card::before { display:none !important; }
    .data-table tr:has(.mobile-compact-card) { padding:0; }

    /* Touch targets */
    button, select, input, .tab-btn, .nav-btn { min-height:44px; }
    .btn { min-height:44px;padding:0.6rem 1rem; }
    .data-table td.mobile-compact-card .action-btn,
    .data-table td.mobile-compact-card button { min-height:38px; }

    /* Pour calendar responsive */
    .pc-cell { min-height:60px;padding:3px; }
    .pc-num { font-size:0.7rem; }
    .pc-evt { font-size:0.58rem;padding:1px 3px; }
    .pc-week { grid-template-columns:40px repeat(7,1fr); }
    .pc-wt { font-size:0.58rem;padding:2px; }
    .pc-wh { font-size:0.6rem;padding:4px 2px; }

    /* Board toolbar wraps better */
    .board-toolbar { flex-direction:column;align-items:stretch;gap:0.5rem; }
    .board-toolbar > div { flex-wrap:wrap; }

    /* Modal improvements — anchored to bottom, no left overflow */
    .modal { align-items: flex-end !important; padding: 0 !important; }
    .modal-content {
        width: 100vw !important;
        max-width: 100vw !important;
        border-radius: 16px 16px 0 0 !important;
        max-height: 92vh;
        margin: 0 !important;
        left: 0 !important;
        position: relative !important;
        box-sizing: border-box;
    }
    .modal-body { padding:1rem; overflow-x:hidden; }
    .modal-footer { flex-wrap:wrap; }
    .modal-footer .btn { flex:1;min-width:100px; }

    /* Line item grids inside modals stack on mobile */
    .line-item-row, [style*="grid-template-columns"][style*="1fr 1fr"] { grid-template-columns: 1fr !important; }

    /* GPS: map search stays below sidebar and header */
    .map-search-overlay { z-index: 10 !important; }
    .sidebar { z-index: 600 !important; }
    .header { position:sticky;top:0;z-index:200; }

    /* GPS: stack Driver Status + Saved Pinpoints vertically */
    #gpsBottomLayout { grid-template-columns: 1fr !important; }

    /* Settings: stack nav + panel instead of side-by-side */
    .settings-shell { grid-template-columns: 1fr !important; }
    .settings-nav { display:none !important; }
    .settings-mobile-select { display:block !important; }
    .settings-nav-label { display:none !important; }
    .settings-nav-divider { display:none !important; }

    /* Settings inner form rows: stack on mobile */
    .settings-row { grid-template-columns: 1fr !important; }

    /* Settings toggle: prevent right cutoff */
    .settings-toggle { flex-wrap:nowrap; gap:0.5rem; padding:0.6rem 0.75rem; }
    .toggle-switch { flex-shrink:0; }
    .auto-control-card { flex-wrap:wrap; }

    /* Tabs/pills that overflow — scroll horizontally */
    .tab-bar, .card-tabs, [role="tablist"], .pour-view-tabs,
    .inv-tab-bar, .yard-tabs { overflow-x:auto !important; flex-wrap:nowrap !important; -webkit-overflow-scrolling:touch; }

    /* Card header wraps instead of overflowing */
    .card-header { flex-wrap:wrap; gap:0.5rem; }
    .card-header h2, .card-header .card-title { min-width:0; }

    /* Tools individual units — the inner table stacks as cards */
    .data-table tr td table { display:block; width:100%; }
    .data-table tr td table thead { display:none; }
    .data-table tr td table tbody { display:block; }
    .data-table tr td table tr { display:flex; flex-wrap:wrap; gap:4px; padding:0.35rem 0; border-bottom:1px solid var(--border); }
    .data-table tr td table td { display:inline-flex !important; width:auto !important; min-height:0 !important; border:none !important; padding:2px 4px !important; }
    .data-table tr td table td::before { display:none !important; }

    /* Prevent any inner fixed-width element from causing overflow */
    .card, .container, .view { max-width:100vw; }
    .modal-body table, .modal-body form { max-width:100%; overflow-x:auto; }

    /* Requests filter pill group — scroll on mobile instead of clipping */
    #reqTypeFilterGroup { overflow-x:auto !important; overflow-y:visible !important; -webkit-overflow-scrolling:touch; border-radius:8px; }
    #reqTypeFilterGroup button:first-child { border-radius:6px 0 0 6px; }
    #reqTypeFilterGroup button:last-child { border-radius:0 6px 6px 0; }
}

@media (max-width: 480px) {
    .pc-grid { grid-template-columns:repeat(7,1fr);gap:1px; }
    .pc-cell { min-height:50px;border-radius:4px; }
    .pc-evt { display:none; }
    .pc-badge { display:inline-flex; }

    .pour-view-tab { padding:4px 8px;font-size:0.7rem; }
    .cal-nav-btn { padding:4px 8px;font-size:0.8rem; }
}

/* ═══════════════════════════════════════════════════════
   DARK MODE IMPROVEMENTS
═══════════════════════════════════════════════════════ */
body.dark-mode {
    --bg: #0f172a;
    --surface: #1e293b;
    --border: #334155;
    --text: #f8fafc;
    --text-light: #94a3b8;
    --sidebar-bg: #020617;
}
body.dark-mode .login-box { background:rgba(30,41,59,0.97);border-color:rgba(255,255,255,0.08); }
body.dark-mode .login-logo p { color:#94a3b8; }
body.dark-mode .form-input, body.dark-mode .form-select, body.dark-mode .form-textarea { background:#1e293b;color:#f8fafc;border-color:#334155; }
body.dark-mode .form-input:focus, body.dark-mode .form-select:focus { border-color:var(--accent);box-shadow:0 0 0 3px rgba(16,185,129,0.15); }
body.dark-mode .tab-btn { color:#94a3b8;background:transparent; }
body.dark-mode .tab-btn.active { color:var(--accent);border-bottom-color:var(--accent); }
body.dark-mode .user-type-card { border-color:#334155;background:#1e293b; }
body.dark-mode .user-type-card:hover { border-color:#475569;background:#263548; }
body.dark-mode .user-type-card.selected { border-color:var(--accent);background:rgba(16,185,129,0.1); }
body.dark-mode .user-type-label { color:#e2e8f0; }
body.dark-mode .alert-error { background:#450a0a;color:#fca5a5;border-color:#7f1d1d; }
body.dark-mode .alert-success { background:#052e16;color:#86efac;border-color:#166534; }
body.dark-mode .alert-info { background:#172554;color:#93c5fd;border-color:#1e40af; }
body.dark-mode .status-btn { border:1px solid rgba(255,255,255,0.1); }
body.dark-mode .data-table th { background:#0f172a;color:#94a3b8; }
body.dark-mode .data-table td { color:#cbd5e1;border-color:#1e293b; }
body.dark-mode .data-table tr:hover { background:#263548; }
body.dark-mode .stat-card { background:#1e293b;border-color:#334155; }
body.dark-mode .stat-value { color:#f8fafc; }
body.dark-mode .filter-bar { background:#1e293b;border-color:#334155; }
body.dark-mode .modal-content { background:#1e293b; }
body.dark-mode .modal-header { background:#0f172a;border-color:#334155; }
body.dark-mode .modal-footer { background:#0f172a;border-color:#334155; }
body.dark-mode .notif-panel { background:#1e293b;border-color:#334155; }
body.dark-mode .notif-item:hover { background:rgba(255,255,255,0.04); }
body.dark-mode .notif-item.unread { background:rgba(16,185,129,0.08); }
body.dark-mode .toast { background:#1e293b;color:#f8fafc;box-shadow:0 4px 20px rgba(0,0,0,0.4); }
body.dark-mode .pc-cell { border-color:#3d5a3a; }
body.dark-mode .pc-cell.pc-today { border-color:var(--accent); }
body.dark-mode .pc-cell.pc-other { background:#0f172a; }
body.dark-mode .pc-week { border-color:#334155; }
body.dark-mode .pc-wh { background:#0f172a;border-color:#334155; }
body.dark-mode .pc-wc { border-color:#1e293b; }
body.dark-mode .pc-day-wrap { border-color:#334155; }
body.dark-mode .pc-ds { border-color:#1e293b; }
body.dark-mode .pc-dt { border-color:#334155; }
body.dark-mode .pdm-card:hover { border-color:var(--accent); }
body.dark-mode .board-col { background:#0f172a;border-color:#334155; }
body.dark-mode .board-col-header { border-color:#334155; }

/* ═══════════════════════════════════════════════════════════
   POUR CALENDAR STYLES
═══════════════════════════════════════════════════════════ */
.pour-view-tab {
    background: var(--surface); border: none; padding: 6px 14px;
    font-family: 'Outfit', sans-serif; font-size: 0.78rem; font-weight: 600;
    color: var(--text); cursor: pointer; transition: all 0.15s;
}
.pour-view-tab:hover { background: var(--bg); color: var(--text); }
.pour-view-tab.active { background: #2563eb; color: white; }
body.dark-mode .pour-view-tab { background: #1e293b; color: #f1f5f9; }
body.dark-mode .pour-view-tab.active { background: #3b82f6; color: white; }

/* Locked/read-only select — removes dropdown arrow and grays out */
.locked-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: var(--bg) !important;
    color: var(--text-light) !important;
    pointer-events: none;
    cursor: default;
    opacity: 1 !important;
    border-color: var(--border) !important;
}

.pc-month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.pc-day {
    min-height: 90px; border: 1px solid var(--border); border-radius: 8px;
    padding: 6px; background: var(--surface); cursor: pointer; transition: border-color 0.15s;
}
.pc-day:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.pc-day.today { border-color: var(--accent); border-width: 2px; background: #f0fdf9; }
.pc-day.other-month { background: var(--bg); opacity: 0.4; pointer-events: none; }
.pc-day-num { font-size: 0.78rem; font-weight: 700; color: var(--text-light); margin-bottom: 4px; }
.pc-day.today .pc-day-num { color: var(--accent); font-weight: 800; }

.pc-ev {
    font-size: 0.65rem; padding: 2px 6px; border-radius: 5px; margin-bottom: 2px;
    font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    cursor: pointer; transition: opacity 0.15s; border-left: 3px solid;
}
.pc-ev:hover { opacity: 0.75; }
.pc-ev-open { background: #fff7ed; color: #c2410c; border-color: #f97316; }
.pc-ev-sched { background: #fefce8; color: #a16207; border-color: #eab308; }
.pc-ev-route { background: #faf5ff; color: #7e22ce; border-color: #a855f7; }
.pc-ev-done { background: #f0fdf4; color: #15803d; border-color: #22c55e; }
.pc-ev-hold { background: #eff6ff; color: #1d4ed8; border-color: #3b82f6; }

.pc-week-grid { display: grid; grid-template-columns: 60px repeat(7, 1fr); gap: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.pc-week-hdr { background: var(--bg); font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-light); padding: 8px 4px; text-align: center; border-bottom: 1px solid var(--border); }
.pc-week-hdr.today-hdr { background: #f0fdf9; color: var(--accent); }
.pc-time-label { font-size: 0.65rem; color: var(--text-light); font-family: 'DM Mono', monospace; padding: 4px 4px; text-align: right; border-right: 1px solid var(--border); border-bottom: 1px solid #f1f5f9; min-height: 48px; }
.pc-week-cell { border-right: 1px solid #f1f5f9; border-bottom: 1px solid #f1f5f9; min-height: 48px; padding: 2px; cursor: pointer; }
.pc-week-cell:hover { background: #f8fafc; }
.pc-week-cell.today-col { background: rgba(16,185,129,0.03); }

/* ═══════════════════════════════════════════════════════════
   MOBILE IMPROVEMENTS — Card-based tables, touch targets
═══════════════════════════════════════════════════════════ */

/* Prevent iOS auto-zoom on input focus */
@media (max-width: 768px) {
    input, select, textarea { font-size: 16px !important; }
}

/* Card-based table view on mobile */
@media (max-width: 900px) {
    .data-table thead { display: none; }
    .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
    .data-table tr {
        margin-bottom: 12px; border: 1px solid var(--border); border-radius: 10px;
        background: var(--surface); padding: 8px; box-shadow: var(--shadow-sm);
    }
    .data-table td {
        text-align: right; padding: 6px 10px !important; border: none;
        position: relative; display: flex; justify-content: space-between; align-items: center;
        min-height: 36px; border-bottom: 1px solid #f1f5f9;
    }
    .data-table td:last-child { border-bottom: none; }
    .data-table td::before {
        content: attr(data-label);
        font-weight: 700; color: var(--text-light); text-transform: uppercase;
        font-size: 0.65rem; letter-spacing: 0.03em; text-align: left;
    }
    .data-table td .action-btn, .data-table td button { min-height: 36px; }

    /* Touch targets */
    button, select, .tab-btn, .nav-btn { min-height: 44px; }

    /* Pour calendar mobile */
    .pc-month-grid { gap: 2px; }
    .pc-day { min-height: 60px; padding: 4px; }
    .pc-day-num { font-size: 0.7rem; }
    .pc-ev { font-size: 0.58rem; padding: 1px 4px; }
    .pc-week-grid { grid-template-columns: 45px repeat(7, 1fr); }
    .pc-week-hdr { font-size: 0.6rem; padding: 4px 2px; }
    .pc-time-label { font-size: 0.58rem; padding: 2px; }

    /* Modals full width on mobile */
    .modal-content { width: 100% !important; max-width: 100% !important; border-radius: 12px 12px 0 0; margin-top: auto; }
    .modal { align-items: flex-end; }

    /* Board horizontal scroll with momentum */
    .board-wrap { -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
    .board-col { scroll-snap-align: start; min-width: 200px; }
}

/* Safe area for notch/home bar phones */
@supports (padding: env(safe-area-inset-bottom)) {
    body { padding-bottom: env(safe-area-inset-bottom); }
    .sidebar { padding-top: env(safe-area-inset-top); }
    .modal-footer { padding-bottom: calc(0.75rem + env(safe-area-inset-bottom)); }
}

/* ═══════════════════════════════════════════════════════════
   DARK MODE IMPROVEMENTS
═══════════════════════════════════════════════════════════ */
body.dark-mode {
    --bg: #0f172a;
    --surface: #1e293b;
    --border: #334155;
    --text: #f1f5f9;
    --text-light: #94a3b8;
    --primary: #93c5fd;
    --primary-light: #bfdbfe;
    --sidebar-bg: #020617;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.4);
}
body.dark-mode .login-box { background: #1e293b; border-color: #334155; }
body.dark-mode .login-logo h1 { -webkit-text-fill-color: #34d399; }
body.dark-mode .tab-btn { color: #cbd5e1; background: #1e293b; }
body.dark-mode .tab-btn.active { background: var(--accent); color: white; }
body.dark-mode .form-input, body.dark-mode .form-select, body.dark-mode .form-textarea {
    background: #0f172a; color: #f1f5f9; border-color: #475569;
}
body.dark-mode .form-input:focus, body.dark-mode .form-select:focus {
    border-color: var(--accent); box-shadow: 0 0 0 3px rgba(16,185,129,0.15);
}
body.dark-mode .card { background: #1e293b; border-color: #334155; }
body.dark-mode .stat-card { background: #1e293b; border-color: #334155; }
body.dark-mode .stat-value { color: #f1f5f9; }
body.dark-mode .data-table th { background: #0f172a; color: #94a3b8; border-color: #334155; }
body.dark-mode .data-table td { color: #cbd5e1; border-color: #1e293b; }
body.dark-mode .data-table tbody tr:hover { background: #0f172a; }
body.dark-mode .status-btn:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
body.dark-mode .dispatch-card { background: #1e293b; border-color: #334155; }
body.dark-mode .dispatch-card:hover { border-color: var(--accent); }
body.dark-mode .board-col { background: #0f172a; border-color: #334155; }
body.dark-mode .board-col.drag-over { background: #162b1e; border-color: var(--accent); }
body.dark-mode .board-col-header { border-color: #334155; }
body.dark-mode .board-empty { color: #475569; }
body.dark-mode .filter-bar { background: #1e293b; border-color: #334155; }
body.dark-mode .modal-content { background: #1e293b; }
body.dark-mode .modal-header { background: #0f172a; border-color: #334155; }
body.dark-mode .modal-footer { background: #0f172a; border-color: #334155; }
body.dark-mode .alert-error { background: #450a0a; color: #fca5a5; border-color: #7f1d1d; }
body.dark-mode .alert-success { background: #052e16; color: #86efac; border-color: #14532d; }
body.dark-mode .alert-info { background: #0c1f3d; color: #93c5fd; border-color: #1e3a5f; }
body.dark-mode .pc-day { background: #1e293b; border-color: #334155; }
body.dark-mode .pc-day.today { background: #0f2922; border-color: var(--accent); }
body.dark-mode .pc-day:hover { border-color: var(--accent); }
body.dark-mode .pc-week-grid { border-color: #334155; }
body.dark-mode .pc-week-hdr { background: #0f172a; color: #94a3b8; border-color: #334155; }
body.dark-mode .pc-week-cell { border-color: #1e293b; }
body.dark-mode .pc-week-cell:hover { background: #162b1e; }
body.dark-mode .pc-time-label { border-color: #334155; color: #64748b; }
body.dark-mode .notif-panel { background: #1e293b; border-color: #334155; }
body.dark-mode .notif-item { border-color: #334155; }
body.dark-mode .notif-item:hover { background: rgba(16,185,129,0.05); }
body.dark-mode .toast { background: #1e293b; color: #f1f5f9; border-color: #334155; }
body.dark-mode .header { background: #1e293b; border-color: #334155; }
body.dark-mode .sidebar { background: #020617; border-right: 1px solid #1e293b; }
body.dark-mode .user-type-card { border-color: #334155; }
body.dark-mode .user-type-card:hover { border-color: var(--accent); background: rgba(16,185,129,0.05); }

/* ── Dark mode: secondary buttons & filter buttons ─────────── */
body.dark-mode .btn-secondary {
    background: #334155;
    color: #e2e8f0;
    border: 1px solid #475569;
}
body.dark-mode .btn-secondary:hover {
    background: #475569;
    color: #f8fafc;
}
body.dark-mode .req-type-filter-btn {
    background: #1e293b !important;
    color: #cbd5e1 !important;
    border-color: #475569 !important;
}
body.dark-mode .req-type-filter-btn.active,
body.dark-mode .req-type-filter-btn[style*="background:var(--primary)"],
body.dark-mode .req-type-filter-btn[style*="background: var(--primary)"] {
    background: var(--primary) !important;
    color: white !important;
}

/* ═══════════════════════════════════════════════════════════
   PROFESSIONAL SELECT DROPDOWNS — replaces dark bubble style
   ═══════════════════════════════════════════════════════════ */
select, .form-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23555' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 10px;
    padding-right: 32px !important;
    cursor: pointer;
}
select option, .form-select option {
    background: var(--surface);
    color: var(--text);
    padding: 8px 12px;
    font-size: 0.9rem;
}
select optgroup {
    background: var(--bg);
    color: var(--text-light);
    font-weight: 700;
    font-style: normal;
    padding: 4px 0;
}
/* Dark mode dropdown options */
body.dark-mode select option,
body.dark-mode .form-select option {
    background: #1e293b;
    color: #f8fafc;
}
body.dark-mode select optgroup {
    background: #0f172a;
    color: #94a3b8;
}
/* Mobile touch-friendly selects */
@media (max-width: 768px) {
    select, .form-select {
        font-size: 16px !important; /* prevents iOS zoom */
        min-height: 44px;
    }
}

/* Pour modal: ensure job# and phase dropdowns are full width and readable on mobile */
#pourJobNumber, #pourAreaPhase, #pourType {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}
@media (max-width: 640px) {
  #pourJobNumber, #pourAreaPhase, #pourType {
    font-size: 0.95rem;
    padding: 10px 8px;
    min-height: 44px;
  }
  /* Stack 2-col grids in pour modal to single column on mobile */
  #pourRequestModal .form-grid,
  #pourRequestModal .form-row-2 {
    grid-template-columns: 1fr !important;
    display: block;
  }
  #pourRequestModal .form-group {
    margin-bottom: 0.75rem;
  }
}

/* FIX 7 — Mobile notifications panel should not be cut off */
@media (max-width: 640px) {
  .notif-panel,
  #notifPanel,
  .notifications-panel,
  #notificationsPanel,
  .notification-dropdown {
    position: fixed !important;
    top: 56px !important;
    left: 4px !important;
    right: 4px !important;
    width: auto !important;
    max-width: calc(100vw - 8px) !important;
    max-height: calc(100dvh - 70px) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    z-index: 9999 !important;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25) !important;
  }
}


/* ── RESPONSIVE: History panel — full-width on mobile ── */
@media (max-width: 640px) {
  #requestHistoryPanel {
    left: 0.5rem !important;
    right: 0.5rem !important;
    bottom: 0.5rem !important;
    min-width: 0 !important;
    max-width: calc(100vw - 1rem) !important;
    max-height: 55vh !important;
    font-size: 0.8rem;
  }
}

/* ── RESPONSIVE: Store delivery panel cards — wrap on mobile ── */
@media (max-width: 640px) {
  .store-del-item {
    flex-wrap: wrap !important;
    gap: 0.4rem !important;
  }
  .store-del-item button {
    flex: 1 1 auto !important;
    min-width: 80px;
  }
}

/* ── RESPONSIVE: Requests table — hide non-critical columns on mobile ── */
@media (max-width: 640px) {
  .requests-table th:nth-child(3),
  .requests-table td:nth-child(3),
  .requests-table th:nth-child(7),
  .requests-table td:nth-child(7) {
    display: none;
  }
}

/* ── RESPONSIVE: Pour calendar — compact on mobile ── */
@media (max-width: 480px) {
  .pc-month-grid {
    font-size: 0.65rem;
  }
  .pc-day-num {
    font-size: 0.7rem;
  }
  .pc-ev {
    font-size: 0.55rem !important;
    padding: 1px 3px !important;
  }
  .pc-week-grid {
    font-size: 0.65rem;
    overflow-x: auto;
  }
}

/* ── RESPONSIVE: Myrequests cards — prevent overflow on small phones ── */
@media (max-width: 480px) {
  .request-card {
    padding: 0.75rem !important;
  }
  .request-card .card-meta {
    flex-wrap: wrap;
  }
}

/* ── RESPONSIVE: Board sort toolbar — wrap buttons on tablet ── */
@media (max-width: 768px) {
  #boardToolbar, .board-toolbar {
    flex-wrap: wrap !important;
    gap: 0.4rem !important;
  }
}

/* ── Mechanic ticket tab buttons ── */
.mech-tab-btn {
  padding: 5px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-family: Outfit, sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.15s;
}
.mech-tab-btn:hover { background: var(--bg); }
.mech-tab-active {
  background: var(--primary) !important;
  color: #fff !important;
  border-color: var(--primary) !important;
}

/* ── Equipment Maintenance Log Checklist ── */
.maint-checklist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
    gap: 3px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px;
}
.maint-check-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 8px;
    border-radius: 6px;
    background: white;
}
.maint-check-row:hover { background: #f8fafc; }
.maint-check-label { font-size: 0.81rem; font-weight: 500; color: var(--text); flex: 1; min-width: 0; }
.maint-check-btns { display: flex; gap: 2px; flex-shrink: 0; }
.mchk-btn {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    background: white;
    color: var(--text-light);
    transition: all 0.12s;
    white-space: nowrap;
}
.mchk-btn:hover { border-color: var(--primary); color: var(--primary); }
.mchk-active-ok   { background: #f0fdf4 !important; color: #15803d !important; border-color: #86efac !important; }
.mchk-active-attn { background: #fef3c7 !important; color: #92400e !important; border-color: #fde68a !important; }
.mchk-active-na   { background: #f1f5f9 !important; color: #64748b !important; border-color: #cbd5e1 !important; }
@media (max-width: 600px) {
    .maint-checklist-grid { grid-template-columns: 1fr; }
}

/* ── Repair History tab buttons ── */
.rh-tab-btn {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 0.5rem 1rem;
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}
.rh-tab-btn:hover { color: var(--primary); }
.rh-tab-active { color: var(--primary) !important; border-bottom-color: var(--primary) !important; }

/* Mix library notes tooltip */
.mix-note-td { cursor: help; }
#mixNoteTooltip {
    display: none;
    position: fixed;
    background: #1e293b;
    color: #fff;
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 0.78rem;
    line-height: 1.5;
    max-width: 300px;
    z-index: 9999;
    box-shadow: 0 4px 14px rgba(0,0,0,0.35);
    pointer-events: none;
    white-space: pre-wrap;
    word-break: break-word;
}
