/*
 * Таблицы (ТЗ §156): на телефоне горизонтальный скролл и залипающая
 * первая колонка. Шрифт не уменьшаем — читаемость важнее ширины.
 */

.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-card);
    border-radius: var(--radius-card);
    background: var(--bg-card);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--fs-small);
}

.table th,
.table td {
    padding: 12px var(--space-4);
    text-align: left;
    white-space: nowrap;
}

.table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--bg-soft);
    color: var(--text-secondary);
    font-size: var(--fs-micro);
    font-weight: var(--fw-bold);
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--border);
}

.table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background var(--t-fast) var(--ease);
}

.table tbody tr:last-child {
    border-bottom: 0;
}

.table tbody tr:hover {
    background: var(--bg-soft);
}

.table td {
    color: var(--text-primary);
    font-weight: var(--fw-semibold);
}

.table th.table__num,
.table td.table__num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.table td.table__muted {
    color: var(--text-secondary);
    font-weight: var(--fw-regular);
}

/* Ссылка-сортировка в заголовке */

.table__sort {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: inherit;
    font: inherit;
    text-transform: inherit;
    letter-spacing: inherit;
    border: 0;
    background: none;
    cursor: pointer;
}

.table__sort:hover {
    color: var(--primary);
}

/* Залипающая первая колонка на узких экранах */

@media (max-width: 768px) {
    .table--sticky th:first-child,
    .table--sticky td:first-child {
        position: sticky;
        left: 0;
        z-index: 2;
        background: var(--bg-card);
        box-shadow: 1px 0 0 var(--border);
    }

    .table--sticky thead th:first-child {
        z-index: 3;
        background: var(--bg-soft);
    }

    .table--sticky tbody tr:hover td:first-child {
        background: var(--bg-soft);
    }
}
