/* The page (or its open dialog/fullscreen view) owns vertical scrolling. */
[data-table-scroll] {
    max-width: 100%;
    min-width: 0;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}

[data-table-scroll]::-webkit-scrollbar { display: none; }

.erp-table-track {
    position: sticky;
    top: var(--erp-track-top, 0px);
    translate: 0 var(--erp-track-shift, 0px);
    z-index: 8;
    height: 22px;
    overflow-x: auto;
    overflow-y: hidden;
    background: #f5f7fa;
    overscroll-behavior-x: contain;
}

.erp-table-track[hidden] { display: none; }
.erp-table-track > span { display: block; height: 1px; }
.erp-table-track:focus-visible { outline: 2px solid #2563eb; outline-offset: -2px; }
.erp-table-track::-webkit-scrollbar { height: 14px; }
.erp-table-track::-webkit-scrollbar-track { background: #e2e8f0; }
.erp-table-track::-webkit-scrollbar-thumb {
    background: #64748b;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
}

@media screen {
    [data-table-scroll] > table { border-collapse: separate; border-spacing: 0; }
    [data-table-scroll] > table > thead > tr > th {
        position: sticky;
        top: 0;
        translate: 0 var(--erp-head-shift, 0px);
        z-index: 4;
        background-color: #1e3a5f;
    }
    [data-table-scroll] > table > tfoot > tr > td {
        position: sticky;
        bottom: 0;
        translate: 0 var(--erp-foot-shift, 0px);
        z-index: 3;
    }
    [data-table-scroll] > .sg-table > thead > tr > th:nth-child(-n+3) { z-index: 6; }
    #salary-grid:fullscreen { overflow-x: hidden; overflow-y: auto; }
}

@media print {
    .erp-table-track { display: none; }
    [data-table-scroll] { overflow: visible; }
    [data-table-scroll] :is(thead th, tfoot td) { position: static; translate: none; }
}

@media screen and (min-width:701px) {
    [data-table-scroll] :is(th, td).employee-frozen {
        position:sticky; inset-inline-start:0; min-width:140px;
        text-align:left; box-shadow:2px 0 3px #1e3a5f18;
    }
    [data-table-scroll] th.employee-frozen { z-index:6; }
    [data-table-scroll] td.employee-frozen { z-index:2; background:#fff; }
    [data-table-scroll] tr:nth-child(even) td.employee-frozen { background:#f5f7fa; }
    [data-table-scroll] tr:hover td.employee-frozen { background:#eff6ff; }
    .employees-table { min-width:760px; }
    .employees-table .employee-frozen { width:clamp(170px,25vw,250px); max-width:250px; }
    .employee-review-table :is(th, td):first-child {
        position:sticky; inset-inline-start:0; min-width:64px; max-width:64px;
    }
    .employee-review-table :is(th, td):nth-child(2) {
        position:sticky; inset-inline-start:64px; min-width:140px;
    }
    .employee-review-table :is(th, td):nth-child(-n+2) { box-sizing:border-box; }
    .employee-review-table td:nth-child(-n+2) { z-index:2; background:#fff; }
    .employee-review-table tbody tr:nth-child(even) td:nth-child(-n+2) { background:#f5f7fa; }
    .employee-review-table th:nth-child(-n+2) { z-index:6; }
}
