/* The same saved team palette powers the banner and the complete profile.
   Background/text are a contrast-checked pair; accent is readable on white.
   Keep result colours (wins/losses, warnings) and opponent identity independent. */
:is(#player-profile, #team-profile, #coach-profile).profile-refresh {
    --profile-accent-background: var(--card-background, #192b43);
    --profile-accent-ink: var(--card-text, #fff);
    --profile-accent-edge: var(--card-edge, #192b43);
    --profile-accent: var(--card-accent, #192b43);
    --profile-tint: color-mix(in srgb, var(--profile-accent) 9%, white);
    --profile-accent-line: color-mix(in srgb, var(--profile-accent) 30%, white);
}
/* Legacy controls consume these aliases inside the content, including tabs
   fetched later. Banner tokens and team-coloured opponent elements stay intact. */
:is(#player-profile, #team-profile, #coach-profile).profile-refresh > .tab-content {
    --primary-color: var(--profile-accent);
    --player-primary-color: var(--profile-accent);
    --team-primary: var(--profile-accent);
    --brand-blue: var(--profile-accent);
    --primary-accent: var(--profile-tint);
    --secondary-color: var(--profile-accent);
}
:is(#player-profile, #team-profile, #coach-profile).profile-refresh .tab-content :is(.card-icon, .game-log-title > i) {
    background: var(--profile-accent-background);
    color: var(--profile-accent-ink);
    box-shadow: inset 3px 0 0 var(--profile-accent-edge);
}
:is(#player-profile, #team-profile, #coach-profile).profile-refresh .tab-content :is(
    .profile-filter-apply, .stat-filter-apply, .profile-tab-retry,
    .profile-filter-badge, .stat-filter-badge, .split-filter.active,
    .filter-select.active, .split-table h4, .stats-info-btn:hover,
    .season-option.current, .season-option:hover,
    .profile-pagination-btn.active, .profile-pagination-btn[aria-current=page],
    .pagination-btn.active, .pagination-btn[aria-current=page]
) {
    background: var(--profile-accent-background) !important;
    color: var(--profile-accent-ink) !important;
    border-color: var(--profile-accent-edge) !important;
    box-shadow: none;
}
:is(#player-profile, #team-profile, #coach-profile).profile-refresh .tab-content :is(
    .profile-text-action, .timeline-match-centre-link, .profile-filter-clear,
    .stat-filter-clear, .stat-guide-hover-btn, .trend-select-button, .accolade-badge
) {
    background: #fff;
    color: var(--profile-accent);
    border-color: var(--profile-accent-line);
}
:is(#player-profile, #team-profile, #coach-profile).profile-refresh .tab-content :is(
    .profile-text-action, .timeline-match-centre-link, .profile-filter-clear,
    .stat-filter-clear, .stat-guide-hover-btn, .trend-select-button, .accolade-badge
):hover {
    background: var(--profile-tint);
    color: var(--profile-accent);
    border-color: var(--profile-accent);
}
:is(#player-profile, #team-profile, #coach-profile).profile-refresh .tab-content :is(
    .player-info-accolade-link, .player-search-prompt-link, .stat-filter-title i,
    .profile-filter-title i, .trend-select-count, .timeline-filter-count
) { color: var(--profile-accent); text-decoration-color: currentColor; }
:is(#player-profile, #team-profile, #coach-profile).profile-refresh .tab-content :is(
    .player-info-accolade-link, .player-search-prompt-link
):is(:hover, :focus-visible) { color: var(--profile-accent); text-decoration-color: currentColor; }
:is(#player-profile, #team-profile, #coach-profile).profile-refresh .tab-content :is(
    .timeline-event-category, .timeline-event-badge, .timeline-chip,
    .profile-pagination-btn:not(.active):not([aria-current]):hover
) { color: var(--profile-accent); background: var(--profile-tint); }
:is(#player-profile, #team-profile, #coach-profile).profile-refresh .tab-content .timeline-event::before { background: var(--profile-accent-edge); }
#player-profile.profile-refresh .profile-table-sticky :is(#recentGamesTable, #gameLogTable).unified-stats-table tr.player-game-latest > td:first-child {
    box-shadow: inset 3px 0 0 var(--profile-accent-edge), -1px 0 0 var(--profile-line), 1px 0 0 var(--profile-line) !important;
}

/* Switch tracks retain their existing geometry and click/keyboard handlers. */
:is(#player-profile, #team-profile, #coach-profile).profile-refresh .tab-content .toggle-switch.active::before {
    background: var(--profile-accent-background);
    box-shadow: inset 0 0 0 1px var(--profile-accent-line);
}
#player-profile.profile-refresh :is(#statistics, #trends) .toggle-switch.active::before,
#team-profile.profile-refresh :is(#team-leaders-toggle, #forAgainstToggle).active::before {
    background: var(--profile-accent-background);
    box-shadow: inset 0 0 0 1px var(--profile-accent-line);
}
#team-profile.profile-refresh :is(#team-leaders-toggle, #forAgainstToggle).active .toggle-slider { background: var(--profile-accent-ink); }
#coach-profile.profile-refresh .tab-content .toggle-switch.active,
:is(#player-profile, #team-profile, #coach-profile).profile-refresh .tab-content .switch.active {
    background: var(--profile-accent-background) !important;
}
:is(#player-profile, #team-profile, #coach-profile).profile-refresh .tab-content :is(.toggle-switch, .switch).active :is(.toggle-slider, .switch-slider) {
    background: var(--profile-accent-ink);
}

/* Match filtered columns to the saved pair, including sticky cells and hover.
   Extra table specificity overrides the shared table's legacy per-page rules. */
:is(#player-profile, #team-profile, #coach-profile).profile-refresh .tab-content :is(#gameLogTable, .unified-stats-table) :is(
    th.profile-filtered, th.profile-stat-filtered, th.stat-highlight-header, th.highlighted-header,
    td.profile-stat-filtered, td.stat-highlight, td.highlighted-cell
) {
    background: var(--profile-accent-background) !important;
    color: var(--profile-accent-ink) !important;
}
:is(#player-profile, #team-profile, #coach-profile).profile-refresh .tab-content :is(#gameLogTable, .unified-stats-table) :is(
    th.profile-filtered, th.profile-stat-filtered, th.stat-highlight-header, th.highlighted-header,
    td.profile-stat-filtered, td.stat-highlight, td.highlighted-cell
) :is(a, i, strong, span) { color: inherit !important; }
:is(#player-profile, #team-profile, #coach-profile).profile-refresh .tab-content :is(
    button, a, input, select, summary
):focus-visible { outline-color: var(--profile-accent) !important; }
:is(#player-profile, #team-profile, #coach-profile).profile-refresh .tab-content input:is([type=checkbox], [type=radio]) { accent-color: var(--profile-accent); }
