/* ==========================================================================
   TEXFLOW ERP — Data tables
   ========================================================================== */

.table-wrap {
    width: 100%;
    overflow-x: auto;
    scrollbar-width: thin;
}

table.table {
    width: 100%;
    min-width: 720px;
    font-size: 13px;
}
table.table.compact { min-width: 560px; font-size: 12.5px; }
table.table.auto    { min-width: 0; }

table.table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--surface-alt);
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
table.table thead th.num { text-align: right; }
table.table thead th .sort-ind { color: var(--muted-2); font-size: 9px; margin-left: 3px; }

table.table tbody td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text-2);
}
table.table tbody tr:last-child td { border-bottom: 0; }
table.table tbody tr:hover td { background: var(--surface-alt); }

table.table tbody td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.table td .t-main { font-weight: 600; color: var(--text); }
table.table td .t-sub  { font-size: 11px; color: var(--muted); margin-top: 1px; }
table.table td a.t-main:hover { color: var(--blue); }

table.table tfoot td {
    padding: 10px 14px;
    background: var(--surface-alt);
    font-weight: 700;
    border-top: 1px solid var(--border-strong);
    font-variant-numeric: tabular-nums;
}
table.table tfoot td.num { text-align: right; }

table.table .cell-flex { display: flex; align-items: center; gap: 10px; }
table.table .col-tight { width: 1%; white-space: nowrap; }
table.table .row-check { width: 34px; }

table.table tr.is-critical td { background: rgba(220, 38, 38, .035); }
table.table tr.is-warn td     { background: rgba(217, 119, 6, .04); }
table.table tr.is-hero td     { background: rgba(37, 99, 235, .045); }
table.table tr.is-hero:hover td { background: rgba(37, 99, 235, .075); }

/* zebra option for long dense reports */
table.table.zebra tbody tr:nth-child(even) td { background: #FCFDFE; }
table.table.zebra tbody tr:hover td { background: var(--surface-alt); }

/* grouped section rows inside a table */
table.table tr.group-row td {
    background: var(--surface-sunken);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 7px 14px;
}

/* mini table inside cards */
table.mini { width: 100%; font-size: 12.5px; }
table.mini th {
    text-align: left;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--muted);
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}
table.mini td {
    padding: 8px;
    border-bottom: 1px solid var(--border);
    color: var(--text-2);
}
table.mini tbody tr:last-child td { border-bottom: 0; }
table.mini th.num, table.mini td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------- Table toolbar */

.toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--r-md) var(--r-md) 0 0;
}
.toolbar .tb-spacer { flex: 1; }
.toolbar .tb-count { font-size: 12px; color: var(--muted); }

.filter-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.filter-tabs a {
    padding: 5px 11px;
    border-radius: var(--r-pill);
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    background: var(--surface-sunken);
}
.filter-tabs a:hover { background: #E2E8F0; color: var(--text); }
.filter-tabs a.is-on { background: var(--navy); color: #fff; }

/* ------------------------------------------------------------- Pagination */

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 11px 16px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--muted);
    background: var(--surface);
    border-radius: 0 0 var(--r-md) var(--r-md);
}
.pager { display: flex; gap: 4px; }
.pager a, .pager span {
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: var(--r);
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    background: var(--surface);
}
.pager a:hover { border-color: var(--border-strong); color: var(--text); background: var(--surface-alt); }
.pager .is-on { background: var(--navy); border-color: var(--navy); color: #fff; }
.pager .is-off { opacity: .45; }
