/* Container styling */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 5px 20px;
    margin-top: 2rem;
}

/* Table styling */
#rosterTable {
    border-collapse: collapse; /* Ensure borders do not double up */
    width: 100%; /* Use full width */
    border: 1px solid #dee2e6; /* Set a uniform border color for the table */
}

#rosterTable th, #rosterTable td {
    border: 1px solid #dee2e6; /* Ensure table cells have the same border color */
    padding: 8px;
    text-align: left;
}


.table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
}

/* Prevent wrapping for specific columns (e.g., Mobile column) */
.table td:nth-child(4), .table th:nth-child(4) {
    white-space: nowrap;
}

/* Prevent line breaks in the mobile number column */
#rosterTable td:nth-child(4) {
    white-space: nowrap;
}

/* Header styling */
#rosterTable thead {
    background-color: #343a40;
    color: #ffffff;
}

/* Row hover effect */
#rosterTable tbody tr:hover {
    background-color: #f5f5f5; /* Optional: Light hover effect for better visibility */
}

#rosterTable td:nth-child(3) {
    white-space: nowrap; /* Prevent line breaks in the driver name column */
}

#rosterTable td:nth-child(1) {
    white-space: nowrap; /* Prevent line breaks in the day column */
}

#rosterTable td:nth-child(5) {
    white-space: nowrap; /* Prevent line breaks in the book on column */
}

#rosterTable td:nth-child(6) {
    white-space: nowrap; /* Prevent line breaks in the book off column */
}

.table th:nth-child(8), .table td:nth-child(8) {
    white-space: normal; /* Allow wrapping */
    word-wrap: break-word; /* Handle word breaking for older browsers */
    overflow-wrap: anywhere; /* Handle breaking for long text on modern browsers */
}

html {
    overflow-y: scroll;
} /* Always show vertical scrollbar */

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

/* Custom class for RDW (orange background) */
.rdw {
    background-color: #ffae44 !important; /* Orange color */
}

/* Custom class for Rest Day */
.rest-day {
    background-color: #ff8282 !important; /* Light red/pink color */
}

/* Custom class for Annual Leave */
.annual-leave {
    background-color: #fff34f !important; /* Light yellow color */
}

/* Custom class for Rest Shift */
.rest-shift {
    background-color: #ffc2c7 !important; /* Light red/pink color */
}

/* Custom class for RDNA */
.rdna {
    background-color: #ff8282 !important; /* Light red/pink color */
}

/* Custom class for Off Roster */
.off-roster {
    background-color: #c5c5c5 !important; /* Light blue color */
}

.form-select-sm {
    height: 31px;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.form-check {
    margin-bottom: 0.5rem;
    padding-top: 4px;
}

.form-label {
    font-size: 0.9rem;
    margin-bottom: 0.2rem;
}

.form-check-label {
    font-size: 0.9rem;
}

.gap-4 {
    gap: 1.5rem !important;
}

.custom-alert {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1050;
}

.alert-fade {
    opacity: 0;
    transition: opacity 0.5s linear;
}

.alert-fade.show {
    opacity: 1;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1049;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.overlay.show {
    opacity: 1;
}

.alert {
    position: relative;
    width: 100%;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    border: none;
    opacity: 0;
    transition: all 0.3s ease;
}

.alert.show {
    opacity: 1;
}

.alert-success {
    background: #63cf7d;
    color: white;
    font-size: 1.2rem;
    font-weight: 500;
}

.btn-close {
    filter: brightness(0) invert(1);
}

.dimmed-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.dimmed-overlay.show {
    opacity: 1;
    visibility: visible;
}

.custom-alert-box {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1050;
    width: 90%;
    max-width: 400px;
    pointer-events: none;
}

.custom-alert-box .alert {
    margin: 0;
    padding: 20px;
    text-align: center;
    background: #28a745;
    color: white;
    font-size: 1.2rem;
    font-weight: 500;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    pointer-events: auto;
}

.custom-alert-box .alert.show {
    opacity: 1;
    transform: translateY(0);
}

.custom-alert-box .btn-close {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    filter: brightness(0) invert(1);
}

#totalHours {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 10px;
    font-size: 1.1rem;
    color: #343a40;
    width: 100%;
    margin-top: 10px;
}

#hoursSum {
    color: #28a745;
    margin-left: 5px;
    /* Match width of hours column for alignment */
    width: 2.5rem;
    text-align: center;
    /* Add right margin to align with table column */
    margin-right: calc(50%);
}

.duration-column {
    width: 2.5rem !important;
    min-width: 2.5rem !important;
    max-width: 2.5rem !important;
    white-space: nowrap;
    text-align: center;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .custom-alert-box {
        width: 95%;
        margin: 0 10px;
    }

    #totalHours {
        font-size: 1rem;
        padding: 5px;
    }

    .duration-column {
        width: auto !important;
        min-width: auto !important;
    }

    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .dimmed-overlay {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .custom-alert-box {
        width: 98%;
    }

    #totalHours {
        flex-direction: column;
        align-items: flex-end;
    }

    #hoursSum {
        margin-top: 5px;
    }
}

.changed-content {
    color: #dc3545;
    font-weight: bold;
    position: relative;
}

/* Updated styles for changes between provisional and final */
.time-content.changed-from-provisional,
.duty-content.changed-from-provisional,
.changed-from-provisional {
    color: #dc3545 !important;
    font-weight: bold !important;
    position: relative !important;
}

.change-icon-table-wrap {
    position: relative;
    padding-right: 0;
}

.row-change-portal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 0;
    pointer-events: none;
    z-index: 2200;
}

.row-change-info-button {
    position: absolute;
    width: 2rem;
    height: 2rem;
    border: 1px solid rgba(8, 145, 178, 0.22);
    border-radius: 999px;
    background: #ecfeff;
    color: #0f766e;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 6px 18px rgba(15, 118, 110, 0.14);
    pointer-events: auto;
}

.row-change-info-button:hover,
.row-change-info-button:focus-visible {
    background: #ccfbf1;
    border-color: rgba(13, 148, 136, 0.4);
    color: #115e59;
    outline: none;
}

.rd-body.change-modal-touch .row-change-portal {
    display: none !important;
}

.rd-body.change-modal-touch td.changed-from-provisional {
    cursor: pointer;
}

.rd-body.change-modal-touch td.changed-from-provisional:active {
    filter: brightness(0.96);
}

.change-details-intro {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 14px;
    background: #f5fbff;
    border: 1px solid rgba(14, 116, 144, 0.12);
    color: #164e63;
}

.change-details-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 5.25rem;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    background: #cffafe;
    color: #155e75;
    font-size: 0.8rem;
    font-weight: 800;
    white-space: nowrap;
}

.change-detail-card + .change-detail-card {
    margin-top: 1rem;
}

.change-detail-card {
    padding: 1rem;
    border: 1px solid #dbe7f0;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.change-detail-title {
    margin: 0 0 0.75rem;
    font-size: 0.96rem;
    font-weight: 800;
    color: #0f172a;
}

.change-detail-block {
    padding: 0.85rem 0.95rem;
    border-radius: 12px;
}

.change-detail-block--original {
    background: #f8fafc;
    border: 1px solid #dbe7f0;
}

.change-detail-block--changed {
    background: #fff5f5;
    border: 1px solid rgba(220, 53, 69, 0.16);
}

.change-detail-label {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 0.4rem;
}

.change-detail-value {
    font-size: 0.92rem;
    line-height: 1.5;
    color: #0f172a;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.change-detail-arrow {
    text-align: center;
    font-size: 1.15rem;
    color: #94a3b8;
    margin: 0.4rem 0;
}

.duty-content {
    position: relative;
}

.duty-content .btn-info {
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
    background-color: #17a2b8;
    border-color: #17a2b8;
    color: white;
}

.duty-content .btn-info:hover {
    background-color: #138496;
    border-color: #117a8b;
    color: white;
}

.content-wrapper {
    position: relative;
}

@media (max-width: 768px) {
    .change-icon-table-wrap {
        padding-right: 0;
    }

    .row-change-info-button {
        width: 1.8rem;
        height: 1.8rem;
        font-size: 0.95rem;
    }

    .change-details-intro {
        flex-direction: column;
    }

    .change-details-badge {
        min-width: 0;
    }
}

.cell-ref {
    width: 6rem !important;
    min-width: 5rem !important;
    max-width: 5rem !important;
    text-align: center;
    font-family: monospace;
    font-size: 7pt;
    padding: 0.5rem !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media screen and (max-width: 768px) {
    .cell-ref {
        width: 4.5rem !important;
        min-width: 2rem !important;
        max-width: 2rem !important;
        font-size: 7pt;
        padding: 0.25rem !important;
    }
}

@media screen and (max-width: 480px) {
    .cell-ref {
        width: 3.5rem !important;
        min-width: 1rem !important;
        max-width: 1rem !important;
        font-size: 7pt;
        padding: 0.2rem !important;
    }
}

.hide-ref .cell-ref {
    display: none;
}

.hide-ref table tr th:last-child,
.hide-ref table tr td:last-child {
    display: none;
}

.week-box {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: 100%;
}

.week-box h3 {
    color: #2c3e50;
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 20px;
    text-align: center;
}

/* Button group within week box */
.week-box-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-roster {
    flex: 1;
    min-width: 140px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
    text-align: center;
    margin: 5px 0;
}

.btn-roster:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.button-container {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.btn-roster {
    min-width: 180px;
    padding: 12px 24px;
    font-size: 16px;
}

@media (max-width: 768px) {
    .button-container {
        flex-direction: column;
    }
    
    .btn-roster {
        width: 100%;
        margin-bottom: 10px;
    }
}

@media (max-width: 768px) {
    .week-box .btn-roster {
        width: 100%;
        margin: 5px 0;
    }
    .week-box .d-flex {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .week-box {
        padding: 20px;
        margin: 15px 0;
    }

    .week-box .d-flex {
        flex-direction: column;
        gap: 15px;
    }

    .btn-roster {
        width: 100%;
        min-width: unset;
    }
}

/* Grid layout for week boxes */
.weeks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

@media (max-width: 768px) {
    .weeks-grid {
        grid-template-columns: 1fr;
    }
    
    .week-box-buttons {
        flex-direction: column;
    }

    .btn-roster {
        width: 100%;
    }
}

.weeks-container {
    padding: 20px;
}

.weeks-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-top: 0.8rem;
}

.card-body {
    padding: 0.8rem;
}

.card-title {
    font-size: 1.4rem;
    margin-bottom: 1rem;
}

.btn-lg {
    padding: 0.5rem 1.5rem;
    font-size: 1rem;
}

.gap-3 {
    gap: 1rem !important;
}

.d-flex.flex-column.justify-content-center {
    gap: 0.25rem;
}

/* Upload form styling */
#uploadForm {
    max-width: 600px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#uploadForm h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

#uploadForm .form-control {
    max-width: 100%;
}

#uploadForm .btn {
    width: 200px;
    margin: 0 auto;
    display: block;
}

/* Add modal styles */
#documentContent {
    max-height: 80vh;
    overflow-y: auto;
    padding: 20px;
    font-size: 14px;
}

#documentContent table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

#documentContent td, 
#documentContent th {
    border: 1px solid #dee2e6;
    padding: 8px;
}

#documentModal .modal-dialog {
    max-width: 90%;
    margin: 1.75rem auto;
}

.btn-info {
    background-color: #17a2b8;
    border-color: #17a2b8;
    color: white;
}

.btn-info:hover {
    background-color: #138496;
    border-color: #117a8b;
    color: white;
}

.word-document {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    padding: 20px;
    background: white;
    overflow-x: auto;
}

.word-document table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    min-width: max-content;
}

.word-document table td,
.word-document table th {
    border: 1px solid #ddd;
    padding: 8px;
    white-space: nowrap;
    font-size: 14px;
}

/* Modal styling */
#documentModal .modal-dialog {
    max-width: 90%;
    margin: 1.75rem auto;
}

#documentModal .modal-content {
    max-height: 90vh;
    overflow-y: auto;
    background-color: white;
    padding: 20px;
}

.spinner-border {
    margin: 2rem auto;
    display: block;
}

/* Timing button spacing */
.view-timing {
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.btn-info {
    background-color: #17a2b8;
    border-color: #17a2b8;
    color: white;
}

.btn-info:hover {
    background-color: #138496;
    border-color: #117a8b;
    color: white;
}

/* Per-driver table blocks — shown when no filters are active */
#driverTablesContainer {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.driver-table-block {
    width: 100%;
    margin-bottom: 0;
    border-radius: 12px;
    overflow: visible;
    background: #ffffff;
    border: 1px solid #e0e4eb;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.driver-table-heading {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    flex-wrap: wrap;
    position: sticky;
    top: 56px;
    z-index: 15;
    background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
    color: #ffffff;
    font-weight: 700;
    padding: 0.8rem 1rem;
    font-size: 0.98rem;
    letter-spacing: 0.02em;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.driver-table-heading-name {
    display: inline-block;
}

.driver-table-heading-mobile {
    display: inline-flex;
    align-items: center;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.10);
    color: rgba(255,255,255,0.92);
    font-size: 0.84rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.driver-table-heading-location {
    background: rgba(96, 165, 250, 0.18);
    color: #dbeafe;
}

.driver-table-heading-phone {
    background: rgba(255,255,255,0.10);
    color: rgba(255,255,255,0.92);
}

.driver-sub-table {
    margin-bottom: 0 !important;
    border-radius: 0 !important;
    width: 100% !important;
    min-width: 100%;
    table-layout: auto !important;
}

.driver-sub-table th,
.driver-sub-table td {
    border: 1px solid #dee2e6;
    padding: 0.35rem 0.5rem;
    text-align: left;
    vertical-align: top;
    line-height: 1.2;
    font-size: 0.84rem;
}

.driver-sub-table th {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

/* Hide duplicated driver-name column in per-driver view */
.driver-sub-table th:nth-child(3),
.driver-sub-table td:nth-child(3) {
    display: none;
}

.driver-sub-table th:nth-child(1),
.driver-sub-table td:nth-child(1) { width: 88px; }

.driver-sub-table th:nth-child(2),
.driver-sub-table td:nth-child(2) { width: 92px; }

.driver-sub-table th:nth-child(4),
.driver-sub-table td:nth-child(4) { width: 112px; }

.driver-sub-table th:nth-child(5),
.driver-sub-table td:nth-child(5),
.driver-sub-table th:nth-child(6),
.driver-sub-table td:nth-child(6),
.driver-sub-table th:nth-child(7),
.driver-sub-table td:nth-child(7) {
    width: 66px;
    text-align: center;
}

.driver-sub-table td.duration-column,
#driverTablesContainer .driver-sub-table td:nth-child(7),
#driverTablesContainer .driver-sub-table th:nth-child(7) {
    width: 66px !important;
    min-width: 66px !important;
    max-width: 66px !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    white-space: nowrap !important;
    text-align: center !important;
    font-variant-numeric: tabular-nums;
}

.driver-sub-table th:nth-child(9),
.driver-sub-table td:nth-child(9) {
    width: 86px;
    text-align: center;
}

.driver-sub-table td:nth-child(1),
.driver-sub-table td:nth-child(5),
.driver-sub-table td:nth-child(6),
.driver-sub-table th:nth-child(4),
.driver-sub-table td:nth-child(4) {
    white-space: nowrap;
}

.driver-sub-table td:nth-child(8),
.driver-sub-table th:nth-child(8) {
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.driver-sub-table tbody tr:hover {
    background-color: #f5f5f5;
}

.driver-sub-table .duty-content {
    line-height: 1.22;
}

#rosterTable th:nth-child(7),
#rosterTable td:nth-child(7) {
    text-align: center !important;
}

#rosterTable td.duration-column,
.driver-sub-table td.duration-column,
.driver-sub-table th.duration-column {
    text-align: center !important;
}

.table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
}

/* Admin Dashboard Table Containers */
.users-table-container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto 2rem auto;
    padding: 0 20px;
    overflow-x: visible;
}

.roster-table-container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 20px;
    overflow-x: visible;
}

/* Admin Table Column Widths */
.users-table-container th:nth-child(1), 
.users-table-container td:nth-child(1) { width: 15%; } /* Username */

.users-table-container th:nth-child(2), 
.users-table-container td:nth-child(2) { 
    width: 20%; 
    word-break: break-all;
    word-wrap: break-word;
    overflow-wrap: break-word;
} /* Email */

.users-table-container th:nth-child(3), 
.users-table-container td:nth-child(3) { width: 10%; } /* Status */

.users-table-container th:nth-child(4), 
.users-table-container td:nth-child(4),
.users-table-container th:nth-child(5), 
.users-table-container td:nth-child(5) { 
    width: 15%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
} /* Registration Date & Last Login */

.users-table-container th:last-child, 
.users-table-container td:last-child { width: 25%; } /* Actions */

.roster-table-container th:nth-child(1),
.roster-table-container td:nth-child(1) { width: 25%; } /* File Name */

.roster-table-container th:nth-child(2),
.roster-table-container td:nth-child(2) { width: 15%; } /* Size */

.roster-table-container th:nth-child(3),
.roster-table-container td:nth-child(3) { width: 20%; } /* Last Modified */

.roster-table-container th:last-child,
.roster-table-container td:last-child { width: 40%; } /* Actions */

/* Admin Dashboard Table Containers */
.users-table-container {
    width: 95%;
    max-width: 1400px;
    margin: 0 auto 2rem auto;
    padding: 0 20px;
}

.roster-table-container {
    width: 95%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

@media (max-width: 768px) {
    .users-table-container,
    .roster-table-container {
        width: 95% !important;
        margin: 0 auto !important;
        padding: 0 15px;
    }
}

/* Mobile Responsive Table Styles - Single Definition */
@media (max-width: 768px) {
    .container {
        width: 100%;
        max-width: none;
        padding: 15px;
    }

    td, th {
        display: block;
        width: 100% !important;
        box-sizing: border-box;
        padding: 10px 15px !important;
    }
    
    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    tr {
        margin-bottom: 20px;
        border: 1px solid #dee2e6;
        border-radius: 4px;
        background: #fff;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }
    
    td {
        border: none !important;
        border-bottom: 1px solid #eee !important;
        position: relative;
        padding-left: 45% !important;
        text-align: left !important;
        min-height: 45px;
    }
    
    td:before {
        content: attr(data-label);
        position: absolute;
        left: 15px;
        width: 40%;
        padding-right: 10px;
        font-weight: 600;
        color: #555;
    }
    
    td:last-child {
        border-bottom: none !important;
    }
}

/* Fix for mobile display issues */
@media (max-width: 768px) {
    .container-fluid {
        padding: 0 !important;
        margin: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    .table-container {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
        margin: 0 !important;
        padding: 0 5px !important;
    }

    #rosterTable {
        table-layout: fixed !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        border-collapse: collapse !important;
    }

    #rosterTable td,
    #rosterTable th {
        max-width: 100% !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
}

/* Keep per-driver roster tables as real tables on smaller screens.
   This overrides the older global mobile card-table rules above. */
@media (max-width: 768px) {
    #driverTablesContainer .driver-sub-table {
        display: table !important;
        width: 100% !important;
        table-layout: auto !important;
    }

    #driverTablesContainer .driver-sub-table thead {
        display: table-header-group !important;
    }

    #driverTablesContainer .driver-sub-table tbody {
        display: table-row-group !important;
    }

    #driverTablesContainer .driver-sub-table tr {
        display: table-row !important;
        margin-bottom: 0 !important;
        border: none !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    #driverTablesContainer .driver-sub-table th,
    #driverTablesContainer .driver-sub-table td {
        display: table-cell !important;
        width: auto !important;
        box-sizing: border-box;
        padding: 0.35rem 0.5rem !important;
        position: static !important;
        min-height: 0 !important;
    }

    #driverTablesContainer .driver-sub-table td {
        border-bottom: 1px solid #dee2e6 !important;
        padding-left: 0.5rem !important;
        text-align: left !important;
    }

    #driverTablesContainer .driver-sub-table td::before {
        content: none !important;
        display: none !important;
    }

    #driverTablesContainer .driver-sub-table th.duration-column,
    #driverTablesContainer .driver-sub-table td.duration-column,
    #driverTablesContainer .driver-sub-table th:nth-child(7),
    #driverTablesContainer .driver-sub-table td:nth-child(7) {
        width: 66px !important;
        min-width: 66px !important;
        max-width: 66px !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        text-align: center !important;
    }
}

/* Admin Dashboard Table Styles */
.users-table-container,
.roster-table-container {
    width: 95%;
    max-width: 1400px;
    margin: 0 auto 2rem auto;
    padding: 0;
}

/* Add styles for table headers alignment */
.users-table-container h3,
.roster-table-container h3 {
    width: 95%;
    max-width: 1400px;
    margin: 2rem auto 1rem;
    padding: 0 20px;
}

.users-table-container .table,
.roster-table-container .table {
    width: 100%;
    margin: 0;
    table-layout: fixed;
}

.users-table-container th,
.roster-table-container th {
    text-align: left;
    padding: 12px 15px;
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.users-table-container td,
.roster-table-container td {
    padding: 12px 15px;
    vertical-align: middle;
}

/* Column widths for Users table */
.users-table-container th:nth-child(1) { width: 15%; } /* Username */
.users-table-container th:nth-child(2) { width: 25%; } /* Email */
.users-table-container th:nth-child(3) { width: 10%; } /* Status */
.users-table-container th:nth-child(4) { width: 15%; } /* Registration */
.users-table-container th:nth-child(5) { width: 15%; } /* Last Login */
.users-table-container th:nth-child(6) { width: 20%; } /* Actions */

/* Column widths for Roster files table */
.roster-table-container th:nth-child(1) { width: 25%; } /* File Name */
.roster-table-container th:nth-child(2) { width: 15%; } /* Size */
.roster-table-container th:nth-child(3) { width: 20%; } /* Last Modified */
.roster-table-container th:nth-child(4) { width: 40%; } /* Actions */

/* Admin Dashboard Layout */
.admin-content {
    width: 95%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.admin-content > h2 {
    margin-bottom: 2rem;
}

.back-button {
    display: inline-block;
    padding: 10px 20px;
    background-color: #666;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    margin-bottom: 1.5rem;
}

.back-button:hover {
    background-color: #555;
    color: white;
    text-decoration: none;
}

.users-table-container,
.roster-table-container {
    width: 100%;
    margin: 0 auto 2rem auto;
    padding: 0;
}

.users-table-container h3,
.roster-table-container h3 {
    margin-bottom: 1rem;
}

/* Center action buttons in roster table */
.roster-table-container td[data-label="Actions"] .d-flex {
    justify-content: center !important;
    text-align: center !important;
    flex-wrap: wrap;
}

.roster-table-container .action-cell {
    text-align: center;
}

.roster-table-container .action-cell .btn {
    min-width: 120px;
    margin: 0.25rem;
}

/* Mobile responsive styles for action buttons */
@media (max-width: 768px) {
    .roster-table-container td[data-label="Actions"] {
        padding: 1rem !important;
    }

    .roster-table-container td[data-label="Actions"] .d-flex {
        flex-direction: column;
        gap: 0.5rem !important;
    }
    
    .roster-table-container .action-cell .btn {
        width: 100%;
        min-width: unset;
        margin: 0.25rem 0;
    }

    .roster-table-container td[data-label="Actions"]::before {
        display: none;
    }
}

.roster-table-container .action-cell .btn {
    min-width: 120px;
}

@media (max-width: 768px) {
    .roster-table-container .action-cell .d-flex {
        flex-direction: column;
        align-items: center;
    }
    
    .roster-table-container .action-cell .btn {
        width: 100%;
        margin: 0.25rem 0;
    }
}

/* Fixed column width controls - replace existing column width styles */
#rosterTable {
    table-layout: fixed !important;
    width: 100% !important;
}

/* Base column widths */
#rosterTable th:nth-child(1),
#rosterTable td:nth-child(1) { width: 90px !important; }  /* Day */

#rosterTable th:nth-child(2),
#rosterTable td:nth-child(2) { width: 90px !important; }  /* Date */

#rosterTable th:nth-child(3),
#rosterTable td:nth-child(3) { width: 150px !important; } /* Driver's Name */

#rosterTable th:nth-child(4),
#rosterTable td:nth-child(4) { width: 120px !important; } /* Mobile */

#rosterTable th:nth-child(5),
#rosterTable td:nth-child(5) { width: 50px !important; }  /* On */

#rosterTable th:nth-child(6),
#rosterTable td:nth-child(6) { width: 50px !important; }  /* Off */

#rosterTable th:nth-child(7),
#rosterTable td:nth-child(7) { width: 50px !important; }  /* Hours */

#rosterTable th:nth-child(8),
#rosterTable td:nth-child(8) { 
    width: auto !important;
    min-width: 200px !important;
} /* Duty Content */

#rosterTable th:nth-child(9),
#rosterTable td:nth-child(9) { 
    width: 90px !important;
    min-width: 90px !important;
    max-width: 90px !important;
    text-align: center;
} /* Ref Column */

/* Hide mobile styles */

/* ====================================================
   ADMIN DASHBOARD LIVE-SAFE THEME OVERRIDES
   Scope: admin_dashboard.php only (.admin-dashboard-page)
   ==================================================== */

.admin-dashboard-page {
    background: #f0f2f5;
    min-height: 100vh;
}

.admin-dashboard-page .container-fluid {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem 1rem 2.5rem;
}

.admin-dashboard-page .admin-content {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
}

.admin-dashboard-page .back-button {
    background: #1a1a2e;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 9px;
    padding: 8px 14px;
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.2;
}

.admin-dashboard-page .back-button:hover {
    background: #111122;
}

.admin-dashboard-page .admin-content > h2 {
    color: #1a1a2e;
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.admin-dashboard-page .admin-content > .d-flex {
    background: #1a1a2e;
    color: #d6dbe3;
    border-radius: 12px;
    padding: 0.9rem 1rem;
    margin-bottom: 1.1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.admin-dashboard-page .admin-content > .d-flex p {
    margin: 0;
    font-size: 0.92rem;
}

.admin-dashboard-page .admin-content > .d-flex .btn-danger.btn-sm {
    border-radius: 7px;
}

.admin-dashboard-page .users-table-container,
.admin-dashboard-page .roster-table-container {
    background: #ffffff;
    border: 1px solid #e1e5eb;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 1rem;
    margin-bottom: 1rem;
    overflow: hidden;
}

.admin-dashboard-page .users-table-container h3,
.admin-dashboard-page .roster-table-container h3 {
    color: #1a1a2e;
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 0.8rem;
    padding: 0;
}

.admin-dashboard-page .users-table-container .table,
.admin-dashboard-page .roster-table-container .table {
    margin: 0;
    table-layout: auto;
}

.admin-dashboard-page .users-table-container th,
.admin-dashboard-page .roster-table-container th {
    background: #f7f8fb;
    color: #3b4350;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom-width: 1px;
}

.admin-dashboard-page .users-table-container td,
.admin-dashboard-page .roster-table-container td {
    font-size: 0.9rem;
    vertical-align: middle;
    word-break: break-word;
}

.admin-dashboard-page .status-select {
    max-width: 170px;
    min-width: 110px;
}

.admin-dashboard-page .action-cell .d-flex {
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem !important;
}

.admin-dashboard-page .action-cell .btn {
    border-radius: 8px;
}

.admin-dashboard-page .delete-reason-textarea {
    resize: vertical;
    min-height: 95px;
}

.admin-dashboard-page .alert {
    border-radius: 10px;
    font-size: 0.9rem;
}

/* Mobile first fixes for live dashboard */
@media (max-width: 768px) {
    .admin-dashboard-page .container-fluid {
        margin-top: 1rem !important;
        padding: 0.65rem 0.55rem 1.5rem;
    }

    .admin-dashboard-page .admin-content > h2 {
        font-size: 1.35rem;
        margin-bottom: 0.75rem;
    }

    .admin-dashboard-page .admin-content > .d-flex {
        display: block !important;
        padding: 0.8rem;
    }

    .admin-dashboard-page .admin-content > .d-flex > div {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-top: 0.6rem;
    }

    .admin-dashboard-page .admin-content > .d-flex > div .btn {
        flex: 1;
        min-width: 130px;
    }

    .admin-dashboard-page .users-table-container,
    .admin-dashboard-page .roster-table-container {
        padding: 0.75rem;
        border-radius: 10px;
    }

    .admin-dashboard-page .roster-files-scroll-pane {
        max-height: none;
        overflow: visible;
        border: none;
        border-radius: 0;
        background: transparent;
        padding: 0;
        width: 100%;
        max-width: 100%;
    }

    .admin-dashboard-page .roster-files-scroll-pane .admin-roster-table {
        min-width: 0;
        width: 100%;
        max-width: 100%;
        table-layout: fixed;
    }

    .admin-dashboard-page .users-table-container thead,
    .admin-dashboard-page .roster-table-container thead {
        display: none;
    }

    .admin-dashboard-page .users-table-container table,
    .admin-dashboard-page .roster-table-container table,
    .admin-dashboard-page .users-table-container tbody,
    .admin-dashboard-page .roster-table-container tbody,
    .admin-dashboard-page .users-table-container tr,
    .admin-dashboard-page .roster-table-container tr {
        display: block;
        width: 100%;
    }

    .admin-dashboard-page .users-table-container tr,
    .admin-dashboard-page .roster-table-container tr {
        border: 1px solid #e5e8ef;
        border-radius: 10px;
        margin-bottom: 0.7rem;
        padding: 0.55rem 0.65rem;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
        background: #fff;
    }

    .admin-dashboard-page .users-table-container td,
    .admin-dashboard-page .roster-table-container td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 0.6rem;
        border: none !important;
        border-bottom: 1px solid #f0f2f5 !important;
        padding: 0.45rem 0 !important;
        min-height: 0;
    }

    .admin-dashboard-page .users-table-container td:last-child,
    .admin-dashboard-page .roster-table-container td:last-child {
        border-bottom: none !important;
        padding-bottom: 0 !important;
    }

    .admin-dashboard-page .users-table-container td::before,
    .admin-dashboard-page .roster-table-container td::before {
        content: attr(data-label);
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: #6f7785;
        font-weight: 700;
        min-width: 94px;
        flex-shrink: 0;
        padding-top: 2px;
    }

    .admin-dashboard-page .status-select,
    .admin-dashboard-page .action-cell .btn,
    .admin-dashboard-page .action-cell form {
        width: 100%;
        max-width: 100%;
    }

    .admin-dashboard-page .action-cell .d-flex {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }
}

@media (max-width: 420px) {
    .admin-dashboard-page .admin-content > .d-flex > div .btn {
        min-width: 100%;
    }
}

/* Desktop resize guard: keep email column readable before mobile breakpoint */
@media (min-width: 769px) {
    .admin-dashboard-page .users-table-container {
        overflow-x: auto;
    }

    .admin-dashboard-page .users-table-container .table {
        min-width: 980px;
        table-layout: auto;
    }

    .admin-dashboard-page .users-table-container th:nth-child(2),
    .admin-dashboard-page .users-table-container td:nth-child(2) {
        min-width: 230px;
        width: 26%;
    }

    .admin-dashboard-page .users-table-container td:nth-child(2) {
        word-break: normal !important;
        overflow-wrap: anywhere;
        white-space: normal;
    }
}

/* Neutralize legacy global mobile table rules on admin page */
@media (max-width: 768px) {
    .admin-dashboard-page .users-table-container td,
    .admin-dashboard-page .roster-table-container td,
    .admin-dashboard-page .admin-roster-table td {
        position: static !important;
        padding-left: 0 !important;
        white-space: normal !important;
        line-height: 1.35;
    }

    .admin-dashboard-page .users-table-container td::before,
    .admin-dashboard-page .roster-table-container td::before,
    .admin-dashboard-page .admin-roster-table td::before {
        position: static !important;
        left: auto !important;
        width: auto !important;
        padding-right: 0 !important;
        margin-right: 0.5rem;
        text-align: left !important;
    }
}

/* --- Admin follow-up enhancements (3,4,5) --- */
.admin-dashboard-page .admin-status-toast {
    position: relative;
    padding-right: 1rem;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.admin-dashboard-page .admin-status-toast.admin-status-toast--hide {
    opacity: 0;
    transform: translateY(-6px);
}

.admin-dashboard-page .admin-action-stack {
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem !important;
}

.admin-dashboard-page .admin-action-stack .btn,
.admin-dashboard-page .admin-action-stack .form-select {
    border-radius: 8px;
}

/* Visual hierarchy: downloads first, partial deletes second, delete all last */
.admin-dashboard-page .admin-roster-actions .btn-primary { order: 10; }
.admin-dashboard-page .admin-roster-actions .btn-secondary { order: 20; }
.admin-dashboard-page .admin-roster-actions .btn-warning { order: 30; }
.admin-dashboard-page .admin-roster-actions .btn-danger { order: 99; }

.admin-dashboard-page .admin-roster-actions form:last-child {
    order: 100;
}

/* Keep roster table desktop behavior unchanged */
.admin-dashboard-page .admin-roster-table {
    table-layout: auto;
}

/* Current admin dashboard markup compatibility */
.admin-dashboard-page .roster-files-scroll-pane {
    max-height: 540px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #e4e9f0;
    border-radius: 12px;
    background: linear-gradient(180deg, #fbfcfe 0%, #f6f8fb 100%);
    padding: 0.2rem;
}

.admin-dashboard-page .roster-files-scroll-pane .admin-roster-table {
    min-width: 720px;
}

.admin-dashboard-page .file-actions-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.admin-dashboard-page .file-actions-inline .btn {
    border-radius: 8px;
}

.admin-dashboard-page .file-type-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 999px;
    border: 1px solid #cfd7e3;
    background: #eef2f7;
    color: #4a586d;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.04em;
    flex-shrink: 0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.admin-dashboard-page .file-type-indicator.is-present {
    background: #dff3e6;
    border-color: #9fd0b2;
    color: #17663d;
}

.admin-dashboard-page .file-type-indicator.is-missing {
    background: #f4f5f7;
    border-style: dashed;
    color: #8a96a8;
}

.admin-dashboard-page .file-actions-modal-dialog {
    max-width: 420px;
}

.admin-dashboard-page .exclusions-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.admin-dashboard-page .exclusions-panel-note {
    color: #6d7788;
    font-size: 0.88rem;
    max-width: 440px;
}

.admin-dashboard-page .exclusions-subsection-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #5e697b;
    margin-bottom: 0.75rem;
}

.admin-dashboard-page .exclusions-driver-controls {
    display: grid;
    grid-template-columns: minmax(200px, 240px) minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: end;
}

.admin-dashboard-page .exclusions-control-block {
    min-width: 0;
}

.admin-dashboard-page .exclusions-control-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: #5e697b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.admin-dashboard-page .driver-picker-button,
.admin-dashboard-page .exclusions-submit-button {
    min-height: 38px;
    border-radius: 8px;
}

.admin-dashboard-page .exclusions-driver-list {
    border-radius: 12px;
    overflow: hidden;
}

.admin-dashboard-page .exclusions-driver-item {
    gap: 0.85rem;
}

.admin-dashboard-page .exclusions-driver-name {
    font-weight: 700;
    color: #1a1a2e;
}

.admin-dashboard-page .exclusions-driver-reason {
    display: block;
    margin-top: 0.2rem;
}

.admin-dashboard-page .driver-picker-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    max-height: 360px;
    overflow-y: auto;
}

.admin-dashboard-page .driver-picker-option {
    width: 100%;
    text-align: left;
    border: 1px solid #d8e0ea;
    border-radius: 10px;
    background: #f8fafc;
    color: #1a1a2e;
    padding: 0.7rem 0.85rem;
    font-size: 0.92rem;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.admin-dashboard-page .driver-picker-option:hover,
.admin-dashboard-page .driver-picker-option:focus {
    background: #eef4ff;
    border-color: #b7c9f5;
    outline: none;
    transform: translateY(-1px);
}

.admin-dashboard-page {
    scrollbar-width: thin;
    scrollbar-color: #b7c2d1 #eef2f7;
}

.admin-dashboard-page .roster-files-scroll-pane,
.admin-dashboard-page .driver-picker-list,
.admin-dashboard-page .users-table-container,
.admin-dashboard-page .roster-table-container {
    scrollbar-width: thin;
    scrollbar-color: #aab7c8 #eef2f7;
}

.admin-dashboard-page::-webkit-scrollbar,
.admin-dashboard-page .roster-files-scroll-pane::-webkit-scrollbar,
.admin-dashboard-page .driver-picker-list::-webkit-scrollbar,
.admin-dashboard-page .users-table-container::-webkit-scrollbar,
.admin-dashboard-page .roster-table-container::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.admin-dashboard-page::-webkit-scrollbar-track,
.admin-dashboard-page .roster-files-scroll-pane::-webkit-scrollbar-track,
.admin-dashboard-page .driver-picker-list::-webkit-scrollbar-track,
.admin-dashboard-page .users-table-container::-webkit-scrollbar-track,
.admin-dashboard-page .roster-table-container::-webkit-scrollbar-track {
    background: linear-gradient(180deg, #f4f7fb 0%, #ebf0f6 100%);
    border-radius: 999px;
}

.admin-dashboard-page::-webkit-scrollbar-thumb,
.admin-dashboard-page .roster-files-scroll-pane::-webkit-scrollbar-thumb,
.admin-dashboard-page .driver-picker-list::-webkit-scrollbar-thumb,
.admin-dashboard-page .users-table-container::-webkit-scrollbar-thumb,
.admin-dashboard-page .roster-table-container::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #c4cfdb 0%, #9eacbf 100%);
    border-radius: 999px;
    border: 2px solid #eef2f7;
}

.admin-dashboard-page::-webkit-scrollbar-thumb:hover,
.admin-dashboard-page .roster-files-scroll-pane::-webkit-scrollbar-thumb:hover,
.admin-dashboard-page .driver-picker-list::-webkit-scrollbar-thumb:hover,
.admin-dashboard-page .users-table-container::-webkit-scrollbar-thumb:hover,
.admin-dashboard-page .roster-table-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #b5c2d1 0%, #8697af 100%);
}

.admin-dashboard-page .admin-section-toggle {
    display: none;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border: 0;
    border-bottom: 1px solid #e5e8ef;
    background: transparent;
    color: #1a1a2e;
    font-size: 0.98rem;
    font-weight: 700;
    text-align: left;
}

.admin-dashboard-page .admin-section-chevron {
    font-size: 0.85rem;
    transition: transform 0.18s ease;
}

.admin-dashboard-page .admin-collapsible-section:not(.is-collapsed) .admin-section-chevron {
    transform: rotate(180deg);
}

/* Mobile-only roster card layout */
@media (max-width: 768px) {
    .admin-dashboard-page,
    .admin-dashboard-page .container-fluid,
    .admin-dashboard-page .admin-content,
    .admin-dashboard-page .admin-collapsible-section,
    .admin-dashboard-page .admin-section-body,
    .admin-dashboard-page .roster-table-container,
    .admin-dashboard-page .roster-files-scroll-pane {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    .admin-dashboard-page .admin-section-toggle {
        display: flex;
    }

    .admin-dashboard-page .admin-collapsible-section.is-collapsed .admin-section-body {
        display: none;
    }

    .admin-dashboard-page .admin-collapsible-section .admin-section-body {
        padding-top: 0.9rem;
    }

    .admin-dashboard-page .admin-collapsible-section .admin-section-body > h3:first-child {
        display: none;
    }

    .admin-dashboard-page .admin-roster-table thead {
        display: none;
    }

    .admin-dashboard-page .admin-roster-table,
    .admin-dashboard-page .admin-roster-table tbody,
    .admin-dashboard-page .admin-roster-table tr,
    .admin-dashboard-page .admin-roster-table td {
        display: block;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .admin-dashboard-page .admin-roster-table tr {
        border: 1px solid #e5e8ef;
        border-left: 4px solid #1a1a2e;
        border-radius: 10px;
        margin-bottom: 0.75rem;
        margin-right: 0.2rem;
        padding: 0.6rem 0.75rem;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
        background: #fff;
        width: calc(100% - 0.2rem);
        overflow: visible;
    }

    .admin-dashboard-page .admin-roster-table td {
        border: none !important;
        border-bottom: 1px solid #f0f2f5 !important;
        padding: 0.45rem 0 !important;
        display: block;
        width: 100%;
        min-width: 0;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .admin-dashboard-page .admin-roster-table td:last-child {
        border-bottom: none !important;
        padding-bottom: 0 !important;
    }

    .admin-dashboard-page .admin-roster-table td::before {
        content: attr(data-label);
        display: block;
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: #6f7785;
        font-weight: 700;
        min-width: 0;
        padding-top: 0;
        margin-bottom: 0.22rem;
    }

    .admin-dashboard-page .admin-roster-actions {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .admin-dashboard-page .admin-roster-actions .btn,
    .admin-dashboard-page .admin-roster-actions form,
    .admin-dashboard-page .admin-roster-actions form .btn {
        width: 100%;
        max-width: 100%;
    }

    .admin-dashboard-page .file-actions-inline {
        width: 100%;
        justify-content: flex-start;
        align-items: center;
        flex-wrap: wrap;
    }

    .admin-dashboard-page .file-actions-inline .btn {
        width: auto;
        max-width: 100%;
        white-space: normal;
        flex: 0 1 auto;
        min-width: 0;
        padding: 0.35rem 0.75rem;
    }

    .admin-dashboard-page .admin-roster-table td[data-label="Actions"].action-cell {
        min-width: 0;
    }

    .admin-dashboard-page .admin-roster-table td[data-label="Actions"] .file-actions-inline,
    .admin-dashboard-page .admin-roster-table td[data-label="Actions"] .file-type-indicator {
        flex-shrink: 1;
    }

    .admin-dashboard-page .exclusions-panel-header {
        margin-bottom: 0.85rem;
    }

    .admin-dashboard-page .exclusions-driver-controls {
        grid-template-columns: 1fr;
    }

    .admin-dashboard-page .exclusions-control-block--action .btn,
    .admin-dashboard-page .driver-picker-button {
        width: 100%;
    }

    .admin-dashboard-page .exclusions-driver-item {
        align-items: flex-start !important;
        flex-direction: column;
    }
}
.hide-mobile #rosterTable th:nth-child(4),
.hide-mobile #rosterTable td:nth-child(4) {
    display: none !important;
    width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Ensure other columns maintain width when mobile is hidden */
.hide-mobile #rosterTable {
    table-layout: fixed !important;
}

/* Ensure widths are maintained on resize */
@media (max-width: 768px) {
    #rosterTable th:nth-child(5),
    #rosterTable td:nth-child(5),
    #rosterTable th:nth-child(6),
    #rosterTable td:nth-child(6) {
        min-width: 50px !important;
        width: 5% !important;
        max-width: 5% !important;
    }
}

/* Fix for mobile table width with highlighted changes */
@media (max-width: 768px) {
    .table-container {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important; /* Prevent horizontal scroll */
    }

    .container-fluid {
        padding-left: 5px !important;
        padding-right: 5px !important;
        width: 100% !important;
        overflow-x: hidden !important;
    }

    #rosterTable {
        width: 100% !important;
        margin: 0 !important;
    }

    /* Ensure duty content column fills remaining space */
    #rosterTable th:nth-child(8),
    #rosterTable td:nth-child(8) {
        width: auto !important;
        min-width: unset !important;
    }

    /* Tighten up column widths */
    #rosterTable th,
    #rosterTable td {
        padding: 8px 4px !important;
    }

    /* Remove any right margin causing overflow */
    .table-responsive {
        margin-right: 0 !important;
        overflow-x: hidden !important;
    }
}

/* ====================================================
   INDEX PAGE  (ix- prefix — scoped to index.php only)
   ==================================================== */

.ix-body {
    background: #f0f2f5;
    min-height: 100vh;
}

/* --- Sticky header nav --- */
.ix-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #1a1a2e;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.ix-header-inner {
    max-width: 860px;
    margin: 0 auto;
    padding: 0.65rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ix-header-welcome {
    color: #b0bcc9;
    font-size: 0.88rem;
}
.ix-header-welcome strong { color: #ffffff; }

.ix-header-actions {
    display: flex;
    gap: 0.45rem;
    align-items: center;
}

/* Dark mode toggle button (sits in header, styled to match) */
.ix-dark-toggle {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #b0bcc9;
    border-radius: 7px;
    padding: 3px 8px;
    font-size: 1rem;
    cursor: pointer;
    line-height: 1.4;
    transition: background 0.15s, color 0.15s;
}
.ix-dark-toggle:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

/* --- Page wrapper --- */
.ix-main {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 1.25rem 3rem;
}

/* --- Hero section --- */
.ix-hero {
    text-align: center;
    padding: 2.2rem 1rem 1.5rem;
}

.ix-logo {
    max-height: 68px;
    width: auto;
    margin-bottom: 1.2rem;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.ix-title {
    font-size: 1.85rem;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 0.3rem;
}

.ix-subtitle {
    font-size: 0.98rem;
    color: #555;
    margin-bottom: 0.15rem;
}

.ix-note {
    font-size: 0.78rem;
    color: #999;
    margin-bottom: 0;
}
.ix-feature-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: -0.15rem 0 1.1rem;
}
.ix-feature-button {
    border-radius: 999px !important;
    padding: 0.5rem 1rem !important;
    font-weight: 700 !important;
    border-width: 1.5px !important;
    background: #ffffff;
    box-shadow: 0 6px 16px rgba(17, 24, 39, 0.06);
    transition: transform 0.14s ease, box-shadow 0.16s ease, background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.ix-feature-button:hover,
.ix-feature-button:focus {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(17, 24, 39, 0.1);
}

.ix-feature-actions .ix-feature-button.btn-outline-info {
    border-color: #0ea5e9;
    color: #0369a1;
    background: linear-gradient(180deg, #f7fdff 0%, #ebf9ff 100%);
}

.ix-feature-actions .ix-feature-button.btn-outline-info:hover,
.ix-feature-actions .ix-feature-button.btn-outline-info:focus {
    border-color: #0284c7;
    color: #075985;
    background: linear-gradient(180deg, #e8f8ff 0%, #d8f1ff 100%);
}

.ix-feature-actions .ix-feature-button.btn-outline-warning {
    border-color: #f59e0b;
    color: #b45309;
    background: linear-gradient(180deg, #fffaf0 0%, #fff2d8 100%);
}

.ix-feature-actions .ix-feature-button.btn-outline-warning:hover,
.ix-feature-actions .ix-feature-button.btn-outline-warning:focus {
    border-color: #d97706;
    color: #92400e;
    background: linear-gradient(180deg, #fff2da 0%, #ffe7bf 100%);
}

/* --- Auth card layout (login/signup) --- */
.ix-auth-shell {
    max-width: 520px;
    margin: 0 auto;
}

.ix-auth-card {
    background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
    border: 1px solid #dde3ec;
    border-radius: 18px;
    padding: 1.5rem 1.5rem 1.25rem;
    box-shadow: 0 18px 36px rgba(19, 28, 45, 0.08), 0 2px 8px rgba(19, 28, 45, 0.05);
}

.ix-auth-card form {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.ix-auth-card .form-label {
    font-size: 0.84rem;
    font-weight: 700;
    color: #334155;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.4rem;
}

.ix-auth-card .form-control {
    min-height: 46px;
    border-radius: 12px;
    border: 1px solid #ccd6e3;
    background: #f8fafc;
    color: #18212f;
    padding: 0.75rem 0.95rem;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.ix-auth-card .form-control::placeholder {
    color: #94a3b8;
}

.ix-auth-card .form-control:focus {
    background: #ffffff;
    border-color: #5f7fb5;
    box-shadow: 0 0 0 3px rgba(95, 127, 181, 0.18);
}

.ix-auth-actions {
    margin-top: 0.35rem;
    margin-bottom: 0.9rem;
}

.ix-auth-actions .btn {
    min-height: 46px;
    border-radius: 12px;
    font-weight: 700;
}

.ix-auth-links {
    color: #607086;
    font-size: 0.9rem;
}

.ix-auth-links a {
    color: #2f5ca8;
    font-weight: 600;
    text-decoration: none;
}

.ix-auth-links a:hover,
.ix-auth-links a:focus {
    color: #21457e;
    text-decoration: underline;
}

/* --- Upload result toasts --- */
.ix-toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.1rem;
    border-radius: 10px;
    margin: 0.5rem 0 1rem;
    font-size: 0.88rem;
}
.ix-toast--success {
    background: #d4edda;
    border: 1px solid #a3d9ab;
    color: #1e5e27;
}
.ix-toast--error {
    background: #fde8e8;
    border: 1px solid #f5a5a5;
    color: #8b1e1e;
}
.ix-toast-icon  { font-size: 1.1rem; flex-shrink: 0; }
.ix-toast-body  { flex: 1; }
.ix-toast-close {
    background: none; border: none; cursor: pointer;
    font-size: 1rem; opacity: 0.55; padding: 0; line-height: 1;
}
.ix-toast-close:hover { opacity: 1; }

/* --- Upload trigger button --- */
.ix-upload-trigger {
    text-align: center;
    margin: 0.25rem 0 0.6rem;
}

/* --- Upload panel box --- */
.ix-upload-box {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 1.5rem 2rem;
    margin: 0 0 1.5rem;
    box-shadow: 0 1px 5px rgba(0,0,0,0.07);
}

.ix-upload-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 0.4rem;
}

.ix-upload-note {
    font-size: 0.82rem;
    color: #666;
    margin-bottom: 1rem;
}

.ix-upload-note code {
    background: #f0f2f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.78rem;
}

/* Override overly-broad #uploadForm .btn { width:200px } just for submit */
.ix-upload-box #uploadSubmitBtn {
    width: auto !important;
    display: inline-block;
    margin: 0;
}

/* --- Filename parse preview --- */
.ix-parse-preview {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin: 0.4rem 0 1rem;
    font-size: 0.82rem;
}
.ix-parse-label {
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.ix-parse-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.8rem;
}
.ix-chip--week        { background: #e8edf8; color: #2c4a8a; }
.ix-chip--fy          { background: #f0e8f8; color: #5c2c8a; }
.ix-chip--final       { background: #d4edda; color: #1e5e27; }
.ix-chip--provisional { background: #fff3d6; color: #7a5500; }
.ix-chip--error       { background: #fde8e8; color: #8b1e1e; }

/* --- Controls / filter bar --- */
.ix-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 1.25rem 0 0.75rem;
    flex-wrap: wrap;
}
.ix-controls-count {
    font-size: 0.84rem;
    color: #666;
    font-weight: 500;
}
.ix-controls-right {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.ix-filter-select {
    min-width: 170px;
    font-size: 0.85rem !important;
    height: 32px;
    border-radius: 6px !important;
}
.ix-search {
    width: 140px;
    font-size: 0.85rem !important;
    height: 32px;
    border-radius: 6px !important;
}
.ix-older-toggle {
    height: 32px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
}

/* --- Roster cards --- */
.ix-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e0e4eb;
    border-left: 5px solid #ccc;
    padding: 1.1rem 1.4rem;
    margin-bottom: 0.85rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    transition: box-shadow 0.15s ease, transform 0.12s ease;
}
.ix-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.11);
    transform: translateY(-2px);
}
.ix-card--current {
    border-color: #9fce9a;
    background: linear-gradient(180deg, #ffffff 0%, #f1fbef 100%);
    box-shadow: 0 0 0 1px rgba(54, 128, 56, 0.18), 0 10px 26px rgba(49, 102, 43, 0.1);
}
.ix-card--current:hover {
    box-shadow: 0 0 0 1px rgba(54, 128, 56, 0.24), 0 14px 30px rgba(49, 102, 43, 0.14);
}
.ix-card--final       { border-left-color: #28a745; }
.ix-card--provisional { border-left-color: #007bff; }
.ix-card--pending     { border-left-color: #6c757d; }

.ix-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}
.ix-card-week-info {
    display: flex;
    align-items: baseline;
    gap: 0.55rem;
}
.ix-card-week-num {
    font-size: 1.35rem;
    font-weight: 700;
    color: #1a1a2e;
}
.ix-card-fy {
    font-size: 0.76rem;
    color: #999;
    font-weight: 500;
}
.ix-card-date {
    font-size: 0.84rem;
    color: #555;
    margin-bottom: 0.85rem;
}

.ix-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}
.ix-badge--final       { background: #d4edda; color: #1a6b2a; }
.ix-badge--provisional { background: #ddeeff; color: #0a4d9e; }
.ix-badge--pending     { background: #ebebeb; color: #555; }
.ix-badge--current {
    background: #daf2d4;
    color: #256b2e;
    border: 1px solid rgba(37, 107, 46, 0.24);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.32);
}

.ix-card-actions {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
}
.ix-card-actions .btn {
    font-size: 0.88rem;
    padding: 0.35rem 1.1rem;
    border-radius: 8px;
}
.ix-older-actions {
    display: flex;
    justify-content: center;
    margin-top: 0.3rem;
}

/* --- Empty state --- */
.ix-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #777;
}
.ix-empty-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    opacity: 0.55;
    display: block;
}
.ix-empty h4 {
    color: #444;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}
.ix-empty p {
    font-size: 0.88rem;
    max-width: 420px;
    margin: 0 auto 0.65rem;
}
.ix-debug {
    display: inline-block;
    margin-top: 0.5rem;
    background: #fff3cd;
    border: 1px solid #ffecb5;
    border-radius: 6px;
    padding: 0.4rem 0.85rem;
    font-size: 0.78rem;
    color: #856404;
}

/* --- Page footer --- */
.ix-footer {
    text-align: center;
    font-size: 0.76rem;
    color: #aaa;
    margin-top: 2.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

/* --- Mobile responsive --- */
@media (max-width: 576px) {
    .ix-header-inner { padding: 0.5rem 1rem; }
    .ix-header-actions { flex-wrap: wrap; justify-content: flex-end; }
    .ix-upload-box   { padding: 1.2rem 1rem; }
    .ix-auth-card    { padding: 1.2rem 1rem 1rem; border-radius: 14px; }
    .ix-card         { padding: 0.9rem 1rem; }
    .ix-feature-actions { justify-content: stretch; }
    .ix-feature-button { width: 100%; text-align: center; }
    .ix-card-actions { flex-direction: column; }
    .ix-card-actions .btn { width: 100%; text-align: center; }
    .ix-controls     { flex-direction: column; align-items: flex-start; }
    .ix-controls-right { width: 100%; }
    .ix-filter-select,
    .ix-search       { flex: 1; width: auto; min-width: unset; }
    .ix-card-header  { flex-direction: column; align-items: flex-start; gap: 0.35rem; }
}

/* --- Dark mode overrides (ix-dark class set on body) --- */
.ix-body.ix-dark {
    background: #0d0f18;
}
.ix-body.ix-dark .ix-title      { color: #e0e6f8; }
.ix-body.ix-dark .ix-subtitle   { color: #8ea0b8; }
.ix-body.ix-dark .ix-note       { color: #566070; }

.ix-body.ix-dark .ix-upload-box,
.ix-body.ix-dark #uploadForm {
    background: #161925;
    border-color: #2a2d42;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.4);
}
.ix-body.ix-dark .modal-content {
    background-color: #161925;
    border-color: #2a2d42;
    color: #d0d8e8;
}
.ix-body.ix-dark .modal-header {
    border-bottom-color: #2a2d42;
}
.ix-body.ix-dark .modal-footer {
    border-top-color: #2a2d42;
}
.ix-body.ix-dark .modal-content label,
.ix-body.ix-dark .modal-content .form-check-label {
    color: #b0bec8;
}
.ix-body.ix-dark .modal-content .form-control,
.ix-body.ix-dark .modal-content .form-select,
.ix-body.ix-dark .modal-content textarea {
    background-color: #1e2136;
    border-color: #363a58;
    color: #dbe4f5;
}
.ix-body.ix-dark .modal-content .form-control::placeholder,
.ix-body.ix-dark .modal-content textarea::placeholder {
    color: #7f90aa;
}
.ix-body.ix-dark .modal-content .form-control:focus,
.ix-body.ix-dark .modal-content .form-select:focus,
.ix-body.ix-dark .modal-content textarea:focus {
    background-color: #242848;
    border-color: #6178a7;
    color: #eef3ff;
    box-shadow: 0 0 0 3px rgba(97, 120, 167, 0.24);
}
.ix-body.ix-dark .modal-content .form-control[type="file"] {
    padding: 0;
    overflow: hidden;
}
.ix-body.ix-dark .modal-content .form-control[type="file"]::file-selector-button {
    color: #eef3ff;
    background: #2a3350;
    border: none;
    border-right: 1px solid #445171;
    padding: 0.72rem 1rem;
    margin-right: 0.9rem;
}
.ix-body.ix-dark .modal-content .form-control[type="file"]::-webkit-file-upload-button {
    color: #eef3ff;
    background: #2a3350;
    border: none;
    border-right: 1px solid #445171;
    padding: 0.72rem 1rem;
    margin-right: 0.9rem;
}
.ix-body.ix-dark .modal-content .form-control[type="file"]:hover::file-selector-button,
.ix-body.ix-dark .modal-content .form-control[type="file"]:focus::file-selector-button {
    background: #324064;
}
.ix-body.ix-dark .modal-content .form-check-input {
    background-color: #1e2136;
    border-color: #53617d;
}
.ix-body.ix-dark .modal-content .form-check-input:checked {
    background-color: #2e7cf6;
    border-color: #2e7cf6;
}
.ix-body.ix-dark .modal-content .btn-close {
    filter: invert(1);
}
.ix-body.ix-dark .ix-upload-title { color: #e0e6f8; }
.ix-body.ix-dark .ix-upload-note  { color: #8ea0b8; }
.ix-body.ix-dark .ix-upload-note code {
    background: #1e2136;
    color: #b0c0d8;
}
.ix-body.ix-dark .ix-auth-card {
    background: linear-gradient(180deg, #161925 0%, #121520 100%);
    border-color: #2a2d42;
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.22);
}
.ix-body.ix-dark .ix-auth-card .form-label {
    color: #b7c4d8;
}
.ix-body.ix-dark .ix-auth-card .form-check-label {
    color: #c8d4e6;
}
.ix-body.ix-dark .ix-auth-card .form-check-input {
    background-color: #1e2136;
    border-color: #53617d;
}
.ix-body.ix-dark .ix-auth-card .form-check-input:focus {
    border-color: #6178a7;
    box-shadow: 0 0 0 3px rgba(97, 120, 167, 0.22);
}
.ix-body.ix-dark .ix-auth-card .form-check-input:checked {
    background-color: #2e7cf6;
    border-color: #2e7cf6;
}
.ix-body.ix-dark .ix-auth-card .form-control {
    background-color: #1e2136;
    border-color: #363a58;
    color: #dbe4f5;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.28);
}
.ix-body.ix-dark .ix-auth-card .form-control::placeholder {
    color: #7485a0;
}
.ix-body.ix-dark .ix-auth-card .form-control:focus {
    background-color: #242848;
    border-color: #6178a7;
    color: #eef3ff;
    box-shadow: 0 0 0 3px rgba(97, 120, 167, 0.26);
}
.ix-body.ix-dark .ix-auth-card .form-control:-webkit-autofill,
.ix-body.ix-dark .ix-auth-card .form-control:-webkit-autofill:hover,
.ix-body.ix-dark .ix-auth-card .form-control:-webkit-autofill:focus,
.ix-body.ix-dark .ix-auth-card .form-control:-webkit-autofill:active {
    -webkit-text-fill-color: #eef3ff;
    caret-color: #eef3ff;
    border: 1px solid #363a58;
    box-shadow: 0 0 0 1000px #1e2136 inset, 0 0 0 3px rgba(97, 120, 167, 0);
    transition: background-color 9999s ease-in-out 0s;
}
.ix-body.ix-dark .ix-auth-links {
    color: #91a0b8;
}
.ix-body.ix-dark .ix-auth-links a {
    color: #94b7ff;
}
.ix-body.ix-dark .ix-auth-links a:hover,
.ix-body.ix-dark .ix-auth-links a:focus {
    color: #bfd2ff;
}
.ix-body.ix-dark .ix-upload-box .form-control,
.ix-body.ix-dark .ix-upload-box .form-select,
.ix-body.ix-dark .ix-upload-box input[type="file"] {
    background-color: #1e2136;
    border-color: #353858;
    color: #d0d8e8;
}
.ix-body.ix-dark .ix-upload-box label { color: #b0bec8; }

.ix-body.ix-dark .ix-controls-count { color: #8ea0b8; }
.ix-body.ix-dark .ix-filter-select,
.ix-body.ix-dark .ix-search {
    background-color: #161925 !important;
    border-color: #363a58 !important;
    color: #d0d8e8 !important;
}
.ix-body.ix-dark .ix-older-toggle {
    border-color: #3a4361;
    color: #d0d8e8;
    background: #161925;
}
.ix-body.ix-dark .ix-older-toggle:hover {
    background: #20253a;
    color: #eef4ff;
}

.ix-body.ix-dark .ix-card {
    background: #161925;
    border-color: #292d44;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
.ix-body.ix-dark .ix-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}
.ix-body.ix-dark .ix-card--current {
    background: linear-gradient(180deg, #18211f 0%, #141b19 100%);
    border-color: rgba(95, 151, 106, 0.45);
    box-shadow: 0 0 0 1px rgba(95, 151, 106, 0.24), 0 10px 24px rgba(0, 0, 0, 0.42);
}
.ix-body.ix-dark .ix-card--current:hover {
    box-shadow: 0 0 0 1px rgba(120, 184, 132, 0.28), 0 14px 28px rgba(0, 0, 0, 0.48);
}
.ix-body.ix-dark .ix-card-week-num { color: #d8e2f8; }
.ix-body.ix-dark .ix-card-fy       { color: #5c6e88; }
.ix-body.ix-dark .ix-card-date     { color: #7e92aa; }
.ix-body.ix-dark .ix-feature-button {
    border-color: #3f6fb5;
    color: #9fc5ff;
    background: #161925;
}
.ix-body.ix-dark .ix-feature-button:hover {
    background: rgba(31, 111, 235, 0.16);
    color: #dcebff;
}

.ix-body.ix-dark .ix-badge--final       { background: rgba(40,167,69,0.2);   color: #52d47a; }
.ix-body.ix-dark .ix-badge--provisional { background: rgba(0,123,255,0.2);   color: #5bb8ff; }
.ix-body.ix-dark .ix-badge--pending     { background: rgba(108,117,125,0.2); color: #9aaabb; }
.ix-body.ix-dark .ix-badge--current {
    background: rgba(82, 155, 91, 0.16);
    color: #93dea0;
    border-color: rgba(115, 190, 126, 0.2);
}

.ix-body.ix-dark .ix-toast--success {
    background: rgba(40, 167, 69, 0.18);
    border-color: rgba(40, 167, 69, 0.35);
    color: #5ee08a;
}
.ix-body.ix-dark .ix-toast--error {
    background: rgba(220, 53, 69, 0.18);
    border-color: rgba(220, 53, 69, 0.35);
    color: #ff8a9a;
}

.ix-body.ix-dark .ix-chip--week        { background: rgba(44,74,138,0.35);  color: #7faaf0; }
.ix-body.ix-dark .ix-chip--fy          { background: rgba(92,44,138,0.35);  color: #b888f0; }
.ix-body.ix-dark .ix-chip--final       { background: rgba(40,167,69,0.2);   color: #52d47a; }
.ix-body.ix-dark .ix-chip--provisional { background: rgba(122,85,0,0.3);    color: #d4a83a; }
.ix-body.ix-dark .ix-chip--error       { background: rgba(139,30,30,0.3);   color: #ff8080; }

.ix-body.ix-dark .ix-empty      { color: #5c6e88; }
.ix-body.ix-dark .ix-empty h4   { color: #9aaabb; }
.ix-body.ix-dark .ix-debug {
    background: rgba(133, 100, 4, 0.22);
    border-color: rgba(133, 100, 4, 0.38);
    color: #c8a32e;
}
.ix-body.ix-dark .ix-footer {
    color: #3a4558;
    border-top-color: #252840;
}

/* ====================================================
   ADMIN DASHBOARD  (ad- prefix — scoped to admin_dashboard.php only)
   ==================================================== */

.ad-body {
    background: #f0f2f5;
    min-height: 100vh;
}

/* --- Sticky header --- */
.ad-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #1a1a2e;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.ad-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.65rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.ad-header-brand {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.ad-header-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
}

.ad-header-welcome {
    font-size: 0.78rem;
    color: #b0bcc9;
}

.ad-header-welcome strong { color: #ffffff; }

.ad-header-actions {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* --- Main wrapper --- */
.ad-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.25rem 1.25rem 3rem;
}

/* --- Toast messages --- */
.ad-toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    font-size: 0.88rem;
}

.ad-toast--success { background: #d4edda; border: 1px solid #a3d9ab; color: #1e5e27; }
.ad-toast--error   { background: #fde8e8; border: 1px solid #f5a5a5; color: #8b1e1e; }
.ad-toast-icon  { font-size: 1.1rem; flex-shrink: 0; }
.ad-toast-body  { flex: 1; }
.ad-toast-close {
    background: none; border: none; cursor: pointer;
    font-size: 1rem; opacity: 0.55; padding: 0; line-height: 1;
}
.ad-toast-close:hover { opacity: 1; }

/* --- Stats strip --- */
.ad-stats {
    display: flex;
    gap: 0.85rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.ad-stat {
    background: #fff;
    border: 1px solid #e0e4eb;
    border-radius: 10px;
    padding: 0.75rem 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.ad-stat-num {
    font-size: 1.6rem;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1.1;
}

.ad-stat-label {
    font-size: 0.72rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.2rem;
}

.ad-stat--approved .ad-stat-num { color: #1a6b2a; }
.ad-stat--pending  .ad-stat-num { color: #7a5500; }
.ad-stat--denied   .ad-stat-num { color: #8b1e1e; }

/* --- Sections --- */
.ad-section {
    background: #fff;
    border: 1px solid #e0e4eb;
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.ad-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.ad-section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
}

.ad-count {
    font-size: 0.8rem;
    color: #888;
    background: #f0f2f5;
    padding: 2px 10px;
    border-radius: 20px;
}

/* --- Search input --- */
.ad-search {
    font-size: 0.85rem;
    height: 32px;
    border-radius: 6px;
    width: 220px;
    border: 1px solid #ced4da;
    padding: 0 0.65rem;
    outline: none;
}

.ad-search:focus { border-color: #1a1a2e; box-shadow: 0 0 0 2px rgba(26,26,46,0.12); }

/* --- Users table --- */
.ad-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
}

.ad-user-table .table td,
.ad-user-table .table th,
.ad-user-table td,
.ad-user-table th {
    vertical-align: middle;
    word-break: break-word;
}

.ad-select { min-width: 100px; }

.ad-action-group {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    flex-wrap: wrap;
}

/* --- Roster file cards --- */
.ad-file-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 0.85rem;
}

.ad-file-card {
    border: 1px solid #e0e4eb;
    border-left: 4px solid #ccc;
    border-radius: 10px;
    padding: 0.9rem 1.1rem;
    background: #fafbfc;
    transition: box-shadow 0.15s ease;
}

.ad-file-card:hover { box-shadow: 0 3px 12px rgba(0,0,0,0.1); }
.ad-file-card--excel { border-left-color: #1d6f42; }
.ad-file-card--json  { border-left-color: #007bff; }

.ad-file-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.ad-file-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: #1a1a2e;
    word-break: break-word;
    flex: 1;
}

.ad-file-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 20px;
    flex-shrink: 0;
}

.ad-file-badge--excel { background: #d4edda; color: #1a6b2a; }
.ad-file-badge--json  { background: #ddeeff; color: #0a4d9e; }

.ad-file-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.78rem;
    color: #888;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

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

.ad-file-actions .btn { font-size: 0.8rem; padding: 0.25rem 0.7rem; }

/* --- Empty state (roster files) --- */
.ad-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: #888;
    grid-column: 1 / -1;
}

.ad-empty-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

/* --- Mobile responsive --- */
@media (max-width: 767px) {
    .ad-header-inner   { padding: 0.6rem 1rem; flex-wrap: wrap; }
    .ad-main           { padding: 1rem 0.75rem 2rem; }
    .ad-section        { padding: 1rem; border-radius: 10px; }
    .ad-section-header { flex-direction: column; align-items: flex-start; }
    .ad-search         { width: 100%; }
    .ad-stats          { gap: 0.5rem; }
    .ad-stat           { flex: 1; min-width: 60px; padding: 0.6rem 0.5rem; }
    .ad-stat-num       { font-size: 1.3rem; }

    /* Stacked card layout for users table on mobile */
    .ad-user-table          { display: block; }
    .ad-user-table thead    { display: none; }
    .ad-user-table tbody    { display: block; }
    .ad-user-table tbody tr {
        display: block;
        border: 1px solid #e0e4eb;
        border-radius: 10px;
        margin-bottom: 0.85rem;
        padding: 0.6rem 0.85rem;
        background: #fff;
        box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    }
    .ad-user-table td {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        border: none;
        border-bottom: 1px solid #f0f2f5;
        padding: 0.35rem 0;
        font-size: 0.85rem;
        gap: 0.5rem;
    }
    .ad-user-table td:last-child { border-bottom: none; }
    .ad-user-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #777;
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        min-width: 80px;
        flex-shrink: 0;
        padding-top: 3px;
    }

    .ad-action-group            { flex-direction: column; width: 100%; }
    .ad-action-group .btn,
    .ad-action-group .form-select { width: 100%; }
    .ad-file-list               { grid-template-columns: 1fr; }
    .ad-file-actions .btn       { flex: 1; min-width: 70px; text-align: center; }
}

@media (max-width: 400px) {
    .ad-header-actions .btn { font-size: 0.75rem; padding: 0.25rem 0.5rem; }
}

/* ====================================================
   ADMIN DASHBOARD DARK MODE
   Scope: .admin-dashboard-page.ix-dark
   ==================================================== */

.admin-dashboard-page.ix-dark {
    background: #0d0f18;
}

.admin-dashboard-page.ix-dark .admin-content > h2 {
    color: #e0e6f8;
}

/* Table section cards */
.admin-dashboard-page.ix-dark .users-table-container,
.admin-dashboard-page.ix-dark .roster-table-container {
    background: #161925;
    border-color: #2a2d42;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.admin-dashboard-page.ix-dark .roster-files-scroll-pane {
    background: linear-gradient(180deg, #1a1f2d 0%, #161b28 100%);
    border-color: #2a2d42;
}

.admin-dashboard-page.ix-dark .users-table-container h3,
.admin-dashboard-page.ix-dark .roster-table-container h3 {
    color: #d0d8f0;
}

.admin-dashboard-page.ix-dark .admin-section-toggle {
    color: #e4ebfb;
    background: linear-gradient(180deg, rgba(34, 40, 58, 0.92) 0%, rgba(26, 31, 45, 0.92) 100%);
    border-bottom-color: #2f3650;
}

.admin-dashboard-page.ix-dark .admin-section-chevron {
    color: #8fa0bb;
}

/* Table text & borders */
.admin-dashboard-page.ix-dark .users-table-container .table,
.admin-dashboard-page.ix-dark .roster-table-container .table,
.admin-dashboard-page.ix-dark .admin-roster-table {
    color: #c8d0e0;
    border-color: #2a2d42;
}

/* Table headers — override Bootstrap .table-light */
.admin-dashboard-page.ix-dark .users-table-container th,
.admin-dashboard-page.ix-dark .roster-table-container th,
.admin-dashboard-page.ix-dark .admin-roster-table th,
.admin-dashboard-page.ix-dark .table-light,
.admin-dashboard-page.ix-dark .table-light > tr > th,
.admin-dashboard-page.ix-dark .table-light > thead > tr > th {
    background-color: #1e2136 !important;
    color: #8a98b8 !important;
    border-color: #2a2d42 !important;
}

/* Table cells & row borders */
.admin-dashboard-page.ix-dark .users-table-container td,
.admin-dashboard-page.ix-dark .roster-table-container td,
.admin-dashboard-page.ix-dark .admin-roster-table td,
.admin-dashboard-page.ix-dark .table-bordered > :not(caption) > * > * {
    border-color: #2a2d42;
    background-color: #161925;
}

/* Select dropdowns */
.admin-dashboard-page.ix-dark .status-select,
.admin-dashboard-page.ix-dark .form-select {
    background-color: #1e2136;
    border-color: #363a58;
    color: #c8d0e0;
}

/* Dropdown menus (actions on users + roster rows) */
.admin-dashboard-page.ix-dark .dropdown-menu {
    background-color: #1e2136;
    border-color: #363a58;
}
.admin-dashboard-page.ix-dark .dropdown-item {
    color: #c8d0e0;
}
.admin-dashboard-page.ix-dark .dropdown-item:hover,
.admin-dashboard-page.ix-dark .dropdown-item:focus {
    background-color: #2a2d42;
    color: #e0e6f8;
}
.admin-dashboard-page.ix-dark .dropdown-item.text-warning { color: #f0c060 !important; }
.admin-dashboard-page.ix-dark .dropdown-item.text-danger  { color: #ff8a9a !important; }
.admin-dashboard-page.ix-dark .dropdown-divider           { border-color: #363a58; }

/* Status alert toasts */
.admin-dashboard-page.ix-dark .alert-success {
    background-color: rgba(40, 167, 69, 0.18);
    border-color: rgba(40, 167, 69, 0.35);
    color: #5ee08a;
}
.admin-dashboard-page.ix-dark .alert-danger {
    background-color: rgba(220, 53, 69, 0.18);
    border-color: rgba(220, 53, 69, 0.35);
    color: #ff8a9a;
}

/* Modal dialogs */
.admin-dashboard-page.ix-dark .modal-content {
    background-color: #161925;
    border-color: #2a2d42;
    color: #c8d0e0;
}
.admin-dashboard-page.ix-dark .modal-header {
    border-bottom-color: #2a2d42;
}
.admin-dashboard-page.ix-dark .modal-footer {
    border-top-color: #2a2d42;
}
.admin-dashboard-page.ix-dark .modal-title { color: #e0e6f8; }
.admin-dashboard-page.ix-dark .modal-content label { color: #b0bec8; }
.admin-dashboard-page.ix-dark .modal-content .form-control,
.admin-dashboard-page.ix-dark .modal-content .form-select,
.admin-dashboard-page.ix-dark .modal-content textarea {
    background-color: #1e2136;
    border-color: #363a58;
    color: #c8d0e0;
}
.admin-dashboard-page.ix-dark .modal-content .form-control:focus,
.admin-dashboard-page.ix-dark .modal-content .form-select:focus,
.admin-dashboard-page.ix-dark .modal-content textarea:focus {
    background-color: #242848;
    border-color: #5566aa;
    color: #e0e6f8;
    box-shadow: 0 0 0 2px rgba(85, 102, 170, 0.25);
}
.admin-dashboard-page.ix-dark .modal-content .form-text { color: #7a8aa8; }
.admin-dashboard-page.ix-dark .btn-close {
    filter: invert(1);
}

.admin-dashboard-page.ix-dark .file-type-indicator {
    background: #20263a;
    border-color: #3a4460;
    color: #9fb0c9;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.admin-dashboard-page.ix-dark .file-type-indicator.is-present {
    background: rgba(48, 122, 84, 0.22);
    border-color: rgba(107, 188, 146, 0.45);
    color: #8fe0af;
}

.admin-dashboard-page.ix-dark .file-type-indicator.is-missing {
    background: #1b2132;
    border-color: #3a4460;
    color: #7f8ca3;
}

.admin-dashboard-page.ix-dark .exclusions-panel-note,
.admin-dashboard-page.ix-dark .exclusions-control-label,
.admin-dashboard-page.ix-dark .exclusions-subsection-title,
.admin-dashboard-page.ix-dark .driver-picker-empty,
.admin-dashboard-page.ix-dark .text-muted {
    color: #8fa0bb !important;
}

.admin-dashboard-page.ix-dark .exclusions-driver-list {
    border: 1px solid #2a2d42;
}

.admin-dashboard-page.ix-dark .exclusions-driver-item,
.admin-dashboard-page.ix-dark .list-group-item.exclusions-driver-item {
    background: #1b1f2d;
    border-color: #2a2d42;
    color: #c8d0e0;
}

.admin-dashboard-page.ix-dark .exclusions-driver-name {
    color: #eef3ff;
}

.admin-dashboard-page.ix-dark .driver-picker-option {
    background: #1b2132;
    border-color: #33405d;
    color: #d7deee;
}

.admin-dashboard-page.ix-dark .driver-picker-option:hover,
.admin-dashboard-page.ix-dark .driver-picker-option:focus {
    background: #232b40;
    border-color: #4c618b;
}

.admin-dashboard-page.ix-dark .driver-picker-button,
.admin-dashboard-page.ix-dark .driver-picker-button.btn-outline-secondary,
.admin-dashboard-page.ix-dark .btn-outline-secondary {
    background: transparent;
    border-color: #47516c;
    color: #d4dced;
}

.admin-dashboard-page.ix-dark .driver-picker-button:hover,
.admin-dashboard-page.ix-dark .driver-picker-button:focus,
.admin-dashboard-page.ix-dark .btn-outline-secondary:hover,
.admin-dashboard-page.ix-dark .btn-outline-secondary:focus {
    background: #252d42;
    border-color: #6178a7;
    color: #eef3ff;
}

.admin-dashboard-page.ix-dark .exclusions-driver-form .form-control,
.admin-dashboard-page.ix-dark #driverReasonInput {
    background-color: #1e2136;
    border-color: #363a58;
    color: #dbe4f5;
}

.admin-dashboard-page.ix-dark .exclusions-driver-form .form-control::placeholder,
.admin-dashboard-page.ix-dark #driverReasonInput::placeholder {
    color: #7f90aa;
}

.admin-dashboard-page.ix-dark .exclusions-driver-form .form-control:focus,
.admin-dashboard-page.ix-dark #driverReasonInput:focus {
    background-color: #242848;
    border-color: #6178a7;
    color: #eef3ff;
    box-shadow: 0 0 0 2px rgba(97, 120, 167, 0.24);
}

.admin-dashboard-page.ix-dark .form-control:-webkit-autofill,
.admin-dashboard-page.ix-dark .form-control:-webkit-autofill:hover,
.admin-dashboard-page.ix-dark .form-control:-webkit-autofill:focus,
.admin-dashboard-page.ix-dark .form-control:-webkit-autofill:active,
.admin-dashboard-page.ix-dark .form-select:-webkit-autofill,
.admin-dashboard-page.ix-dark .form-select:-webkit-autofill:hover,
.admin-dashboard-page.ix-dark .form-select:-webkit-autofill:focus,
.admin-dashboard-page.ix-dark .form-select:-webkit-autofill:active,
.admin-dashboard-page.ix-dark textarea:-webkit-autofill,
.admin-dashboard-page.ix-dark textarea:-webkit-autofill:hover,
.admin-dashboard-page.ix-dark textarea:-webkit-autofill:focus,
.admin-dashboard-page.ix-dark textarea:-webkit-autofill:active {
    -webkit-text-fill-color: #eef3ff;
    caret-color: #eef3ff;
    border: 1px solid #363a58;
    box-shadow: 0 0 0 1000px #1e2136 inset, 0 0 0 2px rgba(97, 120, 167, 0);
    transition: background-color 9999s ease-in-out 0s;
}

.admin-dashboard-page.ix-dark {
    scrollbar-color: #53617d #151a28;
}

.admin-dashboard-page.ix-dark .roster-files-scroll-pane,
.admin-dashboard-page.ix-dark .driver-picker-list,
.admin-dashboard-page.ix-dark .users-table-container,
.admin-dashboard-page.ix-dark .roster-table-container {
    scrollbar-color: #5a6988 #151a28;
}

.admin-dashboard-page.ix-dark::-webkit-scrollbar-track,
.admin-dashboard-page.ix-dark .roster-files-scroll-pane::-webkit-scrollbar-track,
.admin-dashboard-page.ix-dark .driver-picker-list::-webkit-scrollbar-track,
.admin-dashboard-page.ix-dark .users-table-container::-webkit-scrollbar-track,
.admin-dashboard-page.ix-dark .roster-table-container::-webkit-scrollbar-track {
    background: linear-gradient(180deg, #151a28 0%, #1b2132 100%);
}

.admin-dashboard-page.ix-dark::-webkit-scrollbar-thumb,
.admin-dashboard-page.ix-dark .roster-files-scroll-pane::-webkit-scrollbar-thumb,
.admin-dashboard-page.ix-dark .driver-picker-list::-webkit-scrollbar-thumb,
.admin-dashboard-page.ix-dark .users-table-container::-webkit-scrollbar-thumb,
.admin-dashboard-page.ix-dark .roster-table-container::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #647492 0%, #45526b 100%);
    border-color: #1b2132;
}

.admin-dashboard-page.ix-dark::-webkit-scrollbar-thumb:hover,
.admin-dashboard-page.ix-dark .roster-files-scroll-pane::-webkit-scrollbar-thumb:hover,
.admin-dashboard-page.ix-dark .driver-picker-list::-webkit-scrollbar-thumb:hover,
.admin-dashboard-page.ix-dark .users-table-container::-webkit-scrollbar-thumb:hover,
.admin-dashboard-page.ix-dark .roster-table-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #7386a7 0%, #52627d 100%);
}

/* Mobile card rows in dark mode */
@media (max-width: 768px) {
    .admin-dashboard-page.ix-dark .users-table-container tr,
    .admin-dashboard-page.ix-dark .roster-table-container tr,
    .admin-dashboard-page.ix-dark .admin-roster-table tr {
        background: #161925 !important;
        border-color: #2a2d42 !important;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35) !important;
    }
    .admin-dashboard-page.ix-dark .users-table-container td,
    .admin-dashboard-page.ix-dark .roster-table-container td,
    .admin-dashboard-page.ix-dark .admin-roster-table td {
        border-bottom-color: #252840 !important;
    }
    .admin-dashboard-page.ix-dark .users-table-container td::before,
    .admin-dashboard-page.ix-dark .roster-table-container td::before,
    .admin-dashboard-page.ix-dark .admin-roster-table td::before {
        color: #5c6e88;
    }
}

/* ====================================================
   ROSTER DISPLAY PAGE  (rd- prefix — roster_display.php)
   ==================================================== */

.rd-body {
    background: #f0f2f5;
    min-height: 100vh;
}

/* Sticky header — same visual as ix-header */
.rd-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #1a1a2e;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.rd-header-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0.65rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.rd-header-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

.rd-header-logo {
    height: 32px;
    width: auto;
}

.rd-header-appname {
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
}

.rd-header-actions {
    display: flex;
    gap: 0.45rem;
    align-items: center;
    flex-shrink: 0;
}

/* Main content wrapper */
.rd-main {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.25rem 1.5rem 3rem;
}

/* Top row: hide the redundant h2 title (now shown in the sticky header) */
.rd-top-row {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    margin-bottom: 0.75rem;
    flex-wrap: nowrap;
    gap: 1rem;
}

.rd-top-meta {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    min-height: 100%;
}

.rd-week-title {
    display: block !important;
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1.15;
    padding-top: 0.2rem;
}

/* Driver header pill (shown when a driver is filtered) */
.rd-top-meta .driver-header {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    font-size: 0.98rem !important;
    font-weight: 700;
    color: #1a1a2e;
    padding: 0.36rem 0.7rem;
    background: #e8edf8;
    border-radius: 10px;
    margin-bottom: 0 !important;
    width: auto;
    max-width: 100%;
}

.rd-top-meta.driver-filter-active {
    padding-bottom: 0.1rem;
}

/* Filters + downloads card */
.filters-downloads-container {
    background: #ffffff;
    border: 1px solid #e0e4eb;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* Controls bar (checkboxes, sort, edit roster) */
.rd-controls {
    background: #ffffff;
    border: 1px solid #e0e4eb !important;
    border-radius: 12px !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* Table card wrapper */
.rd-table-card {
    background: #ffffff;
    border: 1px solid #e0e4eb;
    border-radius: 14px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    overflow-x: auto;
    padding: 0.5rem;
}

/* ====================================================
   ROSTER DISPLAY DARK MODE  (.rd-body.ix-dark)
   ==================================================== */

.rd-body.ix-dark { background: #0d0f18; }

/* Filters card */
.rd-body.ix-dark .filters-downloads-container {
    background: #161925;
    border-color: #2a2d42;
    box-shadow: 0 1px 5px rgba(0,0,0,0.4);
}
.rd-body.ix-dark .filters-downloads-container label,
.rd-body.ix-dark .filters-downloads-container .form-label { color: #b0bcc9; }
.rd-body.ix-dark .filters-downloads-container .form-select {
    background-color: #1e2136;
    border-color: #363a58;
    color: #c8d0e0;
}

/* Controls bar */
.rd-body.ix-dark .rd-controls {
    background-color: #161925 !important;
    border-color: #2a2d42 !important;
    border-radius: 12px !important;
}
.rd-body.ix-dark .rd-controls .form-check-label { color: #c8d0e0; }
.rd-body.ix-dark .rd-controls .form-check-input { border-color: #5566aa; }
.rd-body.ix-dark .rd-controls #sortIndicator    { color: #b0bcc9; }

/* Buttons inherit Bootstrap dark-mode-friendly colours so no override needed */

/* Table card */
.rd-body.ix-dark .rd-table-card {
    background: #161925;
    border-color: #2a2d42;
}

/* Table head */
.rd-body.ix-dark #rosterTable { color: #c8d0e0; }
.rd-body.ix-dark .driver-sub-table { color: #e1e7f5; }
.rd-body.ix-dark .table-dark,
.rd-body.ix-dark .table-dark > thead > tr > th {
    background-color: #1a1a2e !important;
    color: #e0e6f8 !important;
    border-color: #363a58 !important;
}

/* All cells */
.rd-body.ix-dark #rosterTable td,
.rd-body.ix-dark #rosterTable th,
.rd-body.ix-dark .driver-sub-table td,
.rd-body.ix-dark .driver-sub-table th {
    border-color: #2a2d42 !important;
    color: #eef3ff !important;
}

.rd-body.ix-dark #rosterTable td[contenteditable="true"],
.rd-body.ix-dark .driver-sub-table td[contenteditable="true"] {
    background-color: #fff3cd !important;
    color: #1f2937 !important;
}

.rd-body.ix-dark #rosterTable td[contenteditable="true"]:focus,
.rd-body.ix-dark .driver-sub-table td[contenteditable="true"]:focus {
    outline: 2px solid #f59e0b;
    outline-offset: -2px;
}

.rd-body.ix-dark .driver-sub-table td {
    border-color: #2a2d42 !important;
    color: #d8dfef !important;
}

/* Default row background */
.rd-body.ix-dark #rosterTable tbody tr { background-color: #161925 !important; }
.rd-body.ix-dark .driver-sub-table tbody tr { background-color: #161925 !important; }

.rd-body.ix-dark .driver-sub-table tbody tr:hover {
    background-color: #1d2233 !important;
}

/* Preserve row highlight colours in dark mode */
.rd-body.ix-dark #rosterTable tr.rdw          { background-color: rgba(255, 174, 68, 0.18) !important; color: #eef3ff !important; }
.rd-body.ix-dark #rosterTable tr.rest-day     { background-color: rgba(255, 130, 130, 0.16) !important; color: #eef3ff !important; }
.rd-body.ix-dark #rosterTable tr.annual-leave { background-color: rgba(255, 243, 79, 0.14) !important; color: #eef3ff !important; }
.rd-body.ix-dark #rosterTable tr.rest-shift   { background-color: rgba(255, 194, 199, 0.16) !important; color: #eef3ff !important; }
.rd-body.ix-dark #rosterTable tr.rdna         { background-color: rgba(255, 130, 130, 0.16) !important; color: #eef3ff !important; }
.rd-body.ix-dark #rosterTable tr.off-roster   { background-color: rgba(197, 197, 197, 0.14) !important; color: #eef3ff !important; }
.rd-body.ix-dark #rosterTable tr.rdw:hover          { background-color: rgba(255, 174, 68, 0.18) !important; }
.rd-body.ix-dark #rosterTable tr.rest-day:hover     { background-color: rgba(255, 130, 130, 0.16) !important; }
.rd-body.ix-dark #rosterTable tr.annual-leave:hover { background-color: rgba(255, 243, 79, 0.14) !important; }
.rd-body.ix-dark #rosterTable tr.rest-shift:hover   { background-color: rgba(255, 194, 199, 0.16) !important; }
.rd-body.ix-dark #rosterTable tr.rdna:hover         { background-color: rgba(255, 130, 130, 0.16) !important; }
.rd-body.ix-dark #rosterTable tr.off-roster:hover   { background-color: rgba(197, 197, 197, 0.14) !important; }
.rd-body.ix-dark #rosterTable tr.missing-entry {
    background-color: rgba(255, 193, 7, 0.10) !important;
    color: #e5c16d !important;
}
.rd-body.ix-dark .driver-sub-table tr.rdw          { background-color: rgba(255, 174, 68, 0.18) !important; color: #eef3ff !important; }
.rd-body.ix-dark .driver-sub-table tr.rest-day     { background-color: rgba(255, 130, 130, 0.16) !important; color: #eef3ff !important; }
.rd-body.ix-dark .driver-sub-table tr.annual-leave { background-color: rgba(255, 243, 79, 0.14) !important; color: #eef3ff !important; }
.rd-body.ix-dark .driver-sub-table tr.rest-shift   { background-color: rgba(255, 194, 199, 0.16) !important; color: #eef3ff !important; }
.rd-body.ix-dark .driver-sub-table tr.rdna         { background-color: rgba(255, 130, 130, 0.16) !important; color: #eef3ff !important; }
.rd-body.ix-dark .driver-sub-table tr.off-roster   { background-color: rgba(197, 197, 197, 0.14) !important; color: #eef3ff !important; }
.rd-body.ix-dark .driver-sub-table tr.rdw:hover          { background-color: rgba(255, 174, 68, 0.18) !important; }
.rd-body.ix-dark .driver-sub-table tr.rest-day:hover     { background-color: rgba(255, 130, 130, 0.16) !important; }
.rd-body.ix-dark .driver-sub-table tr.annual-leave:hover { background-color: rgba(255, 243, 79, 0.14) !important; }
.rd-body.ix-dark .driver-sub-table tr.rest-shift:hover   { background-color: rgba(255, 194, 199, 0.16) !important; }
.rd-body.ix-dark .driver-sub-table tr.rdna:hover         { background-color: rgba(255, 130, 130, 0.16) !important; }
.rd-body.ix-dark .driver-sub-table tr.off-roster:hover   { background-color: rgba(197, 197, 197, 0.14) !important; }
.rd-body.ix-dark .driver-sub-table tr.missing-entry {
    background-color: rgba(255, 193, 7, 0.10) !important;
    color: #e5c16d !important;
}

.rd-body.ix-dark #rosterTable tr.rdw td,
.rd-body.ix-dark #rosterTable tr.rest-day td,
.rd-body.ix-dark #rosterTable tr.annual-leave td,
.rd-body.ix-dark #rosterTable tr.rest-shift td,
.rd-body.ix-dark #rosterTable tr.rdna td,
.rd-body.ix-dark #rosterTable tr.off-roster td,
.rd-body.ix-dark .driver-sub-table tr.rdw td,
.rd-body.ix-dark .driver-sub-table tr.rest-day td,
.rd-body.ix-dark .driver-sub-table tr.annual-leave td,
.rd-body.ix-dark .driver-sub-table tr.rest-shift td,
.rd-body.ix-dark .driver-sub-table tr.rdna td,
.rd-body.ix-dark .driver-sub-table tr.off-roster td {
    color: #eef3ff !important;
}

/* Changed-from-provisional cells */
.rd-body.ix-dark #rosterTable td.changed-from-provisional,
.rd-body.ix-dark .driver-sub-table td.changed-from-provisional,
.rd-body.ix-dark #rosterTable td.time-content.changed-from-provisional,
.rd-body.ix-dark #rosterTable td.duty-content.changed-from-provisional,
.rd-body.ix-dark .driver-sub-table td.time-content.changed-from-provisional,
.rd-body.ix-dark .driver-sub-table td.duty-content.changed-from-provisional {
    background-color: transparent !important;
    color: #dc3545 !important;
    font-weight: bold !important;
}

.rd-body.ix-dark .row-change-info-button {
    background: #0f2d33;
    border-color: rgba(103, 232, 249, 0.2);
    color: #99f6e4;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}

.rd-body.ix-dark .row-change-info-button:hover,
.rd-body.ix-dark .row-change-info-button:focus-visible {
    background: #13424a;
    border-color: rgba(103, 232, 249, 0.42);
    color: #ccfbf1;
}

.rd-body.ix-dark .change-details-intro {
    background: #12202d;
    border-color: rgba(103, 232, 249, 0.12);
    color: #c5f8ff;
}

.rd-body.ix-dark .change-details-badge {
    background: #083344;
    color: #a5f3fc;
}

.rd-body.ix-dark .change-detail-card {
    background: #161925;
    border-color: #2a2d42;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.rd-body.ix-dark .change-detail-title,
.rd-body.ix-dark .change-detail-value {
    color: #eef3ff;
}

.rd-body.ix-dark .change-detail-label,
.rd-body.ix-dark .change-detail-arrow {
    color: #94a3b8;
}

.rd-body.ix-dark .change-detail-block--original {
    background: #111827;
    border-color: #334155;
}

.rd-body.ix-dark .change-detail-block--changed {
    background: rgba(127, 29, 45, 0.22);
    border-color: rgba(251, 113, 133, 0.22);
}

/* Roster edit state must override row/cell highlight logic */
.rd-body #rosterTable td[contenteditable="true"],
.rd-body .driver-sub-table td[contenteditable="true"] {
    background-color: #efe3bf !important;
    color: #2f2617 !important;
    box-shadow: inset 0 0 0 1px rgba(146, 104, 32, 0.28);
}

.rd-body #rosterTable td[contenteditable="true"]:focus,
.rd-body .driver-sub-table td[contenteditable="true"]:focus {
    outline: 2px solid rgba(146, 104, 32, 0.45);
    outline-offset: -2px;
}

.rd-body.ix-dark #rosterTable td[contenteditable="true"],
.rd-body.ix-dark .driver-sub-table td[contenteditable="true"] {
    background-color: #564629 !important;
    color: #f7f0dd !important;
    box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.26);
}

.rd-body.ix-dark #rosterTable td[contenteditable="true"]:focus,
.rd-body.ix-dark .driver-sub-table td[contenteditable="true"]:focus {
    outline-color: rgba(245, 158, 11, 0.44);
}

/* Per-driver table blocks — dark mode */
.rd-body.ix-dark .driver-table-block {
    background: #161925;
    border-color: #2a2d42;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.rd-body.ix-dark .driver-table-heading {
    background: linear-gradient(135deg, #1e2136 0%, #2d3748 100%);
    color: #e2e8f0;
    border-bottom-color: #2a2d42;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}

.rd-body.ix-dark .driver-table-heading-mobile {
    background: rgba(255,255,255,0.08);
    color: #f1f5ff;
}

.rd-body.ix-dark .driver-table-heading-location {
    background: rgba(96, 165, 250, 0.16);
    color: #bfdbfe;
}

.rd-body.ix-dark .driver-table-heading-phone {
    background: rgba(255,255,255,0.08);
    color: #f1f5ff;
}

/* Driver header pill */
.rd-body.ix-dark .rd-top-row .driver-header {
    background: #1a1a2e;
    color: #e0e6f8;
}

.rd-body.ix-dark .rd-week-title {
    color: #e0e6f8;
}

.rd-body.ix-dark .rd-top-meta .driver-header {
    background: #1a1a2e;
    color: #e0e6f8;
}

.rd-body.ix-dark .rd-header-week {
    color: #d5deef;
}

/* Modal */
.rd-body.ix-dark .modal-content   { background-color: #161925; border-color: #2a2d42; color: #c8d0e0; }
.rd-body.ix-dark .modal-header    { border-bottom-color: #2a2d42; }
.rd-body.ix-dark .modal-title     { color: #e0e6f8; }
.rd-body.ix-dark #documentContent { color: #c8d0e0; }

/* Mobile responsive */
@media (max-width: 767px) {
    .rd-header-inner  { padding: 0.6rem 1rem; flex-wrap: wrap; }
    .rd-main          { padding: 0.85rem 0.75rem 2rem; }
    .rd-top-row       { flex-direction: column; align-items: stretch; }
    .rd-top-meta      { gap: 0.3rem; justify-content: flex-start; }
    .rd-week-title    { font-size: 1.15rem; padding-top: 0; }
    .rd-top-meta .driver-header { max-width: 100%; }
    .filters-downloads-container { width: 100%; }
    .download-buttons { padding-top: 0 !important; flex-direction: row; flex-wrap: wrap; }
}
