.table-responsive {
    overflow-x: auto;
}

/* Ensure all table cells have a baseline z-index */
table td, table th {
    position: relative;
    z-index: 1;
}

/* Sticky columns for mobile - exclude first header row */
table thead tr:not(:first-child) th:nth-child(1),
table thead tr:not(:first-child) th:nth-child(2),
table thead tr:not(:first-child) th:nth-child(3),
table tbody td:nth-child(1),
table tbody td:nth-child(2),
table tbody td:nth-child(3) {
    position: sticky;
    z-index: 1000;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

table thead tr:not(:first-child) th:nth-child(1),
table tbody td:nth-child(1) {
    left: 0;
}

table thead tr:not(:first-child) th:nth-child(2),
table tbody td:nth-child(2) {
    left: var(--col1-width);
}

table thead tr:not(:first-child) th:nth-child(3),
table tbody td:nth-child(3) {
    left: var(--col1-col2-width);
}

/* Solid backgrounds for even rows (white) */
table.table-striped tbody tr:nth-of-type(even) td:nth-child(1),
table.table-striped tbody tr:nth-of-type(even) td:nth-child(2),
table.table-striped tbody tr:nth-of-type(even) td:nth-child(3) {
    background-color: #ffffff !important;
}

/* Solid backgrounds for odd rows (gray) */
table.table-striped tbody tr:nth-of-type(odd) td:nth-child(1),
table.table-striped tbody tr:nth-of-type(odd) td:nth-child(2),
table.table-striped tbody tr:nth-of-type(odd) td:nth-child(3) {
    background-color: #f2f2f2 !important;
}

/* Header background - WHITE like user requested */
table thead tr:not(:first-child) th:nth-child(1),
table thead tr:not(:first-child) th:nth-child(2),
table thead tr:not(:first-child) th:nth-child(3) {
    background-color: #ffffff !important;
}

/* Remove all borders from sticky columns and use box-shadow instead */
table thead tr:not(:first-child) th:nth-child(1),
table thead tr:not(:first-child) th:nth-child(2),
table tbody td:nth-child(1),
table tbody td:nth-child(2) {
    border: none !important;
    box-shadow: inset 0 -1px 0 #dee2e6, inset -1px 0 0 #dee2e6;
}

/* Column 3 - all borders as box-shadow plus sticky effect */
table thead tr:not(:first-child) th:nth-child(3),
table tbody td:nth-child(3) {
    border: none !important;
    box-shadow: inset 0 -1px 0 #dee2e6, inset -1px 0 0 #dee2e6, 1px 0 5px -2px rgba(0,0,0,0.2);
}

/* First header row with colspan - make it sticky */
table thead tr:first-child th:first-child {
    position: sticky;
    left: 0;
    z-index: 1000;
    background-color: #ffffff !important;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    border: none !important;
    box-shadow: inset 0 1px 0 #dee2e6, inset 0 -1px 0 #dee2e6, 1px 0 5px -2px rgba(0,0,0,0.2);
}
