html, body { background: var(--bg-page); color: var(--text-primary); }

/* ─── Page shell ─────────────────────────────────────────── */
.teams-page {
    max-width: 1300px;
    margin: 0 auto;
    padding: 24px 20px 48px;
}

.teams-page__title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 16px;
}

/* ─── Stats bar ───────────────────────────────────────────── */
.teams-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.teams-stats__item--hint {
    color: var(--text-muted);
    font-size: 12px;
}

/* ─── Filters ─────────────────────────────────────────────── */
.teams-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    background: var(--bg-card);
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid var(--border-light);
}

.teams-filters__input {
    background: var(--bg-page);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: 4px;
    width: 220px;
    font-size: 13px;
    outline: none;
}

.teams-filters__input:focus { border-color: var(--color-accent); }

.teams-filters__btn {
    background: var(--color-indigo);
    color: #fff;
    border: none;
    padding: 7px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: opacity 0.15s;
}

.teams-filters__btn:hover { opacity: 0.85; }

.teams-filters__reset {
    color: var(--text-muted);
    font-size: 13px;
    text-decoration: none;
    padding: 7px 4px;
}

.teams-filters__reset:hover { color: var(--text-secondary); }

/* ─── Table wrapper ───────────────────────────────────────── */
.teams-table-wrap {
    border-radius: 8px;
    border: 1px solid var(--border-light);
    margin-bottom: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ─── Table ───────────────────────────────────────────────── */
.teams-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 960px;
}

/* Header */
.teams-table thead th {
    background: var(--bg-card);
    color: var(--text-muted);
    font-weight: 600;
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
    vertical-align: bottom;
}

/* Column widths */
.col-num       { width: 44px; }
.col-team      { min-width: 190px; }
.col-skill     { width: 160px; }
.col-lb        { width: 140px; }
.col-games     { width: 115px; }
.col-winrate   { width: 72px; }
.col-last-match{ width: 110px; }
.col-league    { min-width: 150px; }

.col-hint {
    display: block;
    font-size: 10px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    opacity: 0.65;
    margin-top: 2px;
}

/* Sort links */
.teams-table__sort {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s;
}

.teams-table__sort:hover,
.teams-table__sort.active { color: var(--text-primary); }

/* Body cells */
.teams-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(55, 65, 81, 0.4);
    vertical-align: middle;
}

.teams-table tbody tr:last-child td { border-bottom: none; }
.teams-table tbody tr:hover { background: rgba(31, 45, 64, 0.6); }

/* ─── Cell: row number ────────────────────────────────────── */
.cell-num {
    color: var(--text-muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

/* ─── Cell: team name + logo ──────────────────────────────── */
.team-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.team-cell__logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 3px;
    flex-shrink: 0;
}

.team-cell__placeholder {
    width: 24px;
    height: 24px;
    background: rgba(99, 102, 241, 0.18);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: var(--color-indigo);
    flex-shrink: 0;
}

.team-cell__name {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* ─── Rating cells (skill + lb) ───────────────────────────── */
.rating-cell {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

/* Rank badge */
.rating-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.rating-badge--skill {
    background: rgba(167, 139, 250, 0.15);
    color: #a78bfa;
}

.rating-badge--lb {
    background: rgba(251, 191, 36, 0.12);
    color: #fbbf24;
}

/* Rating value */
.rating-val {
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
}

.rating-val--high { color: #34d399; }
.rating-val--neg  { color: #f87171; }
.rating-val--lb   { color: var(--text-muted); }

.rating-sub {
    font-size: 11px;
    color: var(--text-muted);
}

/* ─── Cell: games ─────────────────────────────────────────── */
.cell-games {
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    white-space: nowrap;
}

.games-wins {
    color: var(--text-muted);
    font-size: 12px;
    margin-left: 2px;
}

/* ─── Cell: win rate ──────────────────────────────────────── */
.cell-winrate {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    white-space: nowrap;
}

.cell-winrate.wr-hot  { color: #34d399; }
.cell-winrate.wr-ok   { color: var(--text-secondary); }
.cell-winrate.wr-cold { color: #f87171; }

/* ─── Cell: date ──────────────────────────────────────────── */
.cell-date {
    color: var(--text-muted);
    white-space: nowrap;
    font-size: 12px;
}

/* ─── Cell: league ────────────────────────────────────────── */
.cell-league {
    color: var(--text-secondary);
    font-size: 12px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ─── Misc ────────────────────────────────────────────────── */
.cell-null  { color: var(--text-muted); }

.cell-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

/* ─── Pagination ──────────────────────────────────────────── */
.teams-pagination {
    display: flex;
    justify-content: center;
}

.teams-pagination .pagination {
    gap: 4px;
    flex-wrap: wrap;
}

/* ─── Mobile ──────────────────────────────────────────────── */
@media (max-width: 700px) {
    .teams-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .teams-filters__input { width: 100%; }
    .teams-filters__btn   { width: 100%; }
}
