/**
 * Global dark-mode overrides for page CSS that still hardcodes light hex.
 * Loaded after page styles from base.html. Prefer CSS variables where practical;
 * these selectors cover tables, cards, inputs, and common chrome.
 */

html[data-theme="dark"] .app-container,
html[data-theme="dark"] .main-content {
    background-color: var(--color-bg-primary);
    color: var(--color-text-primary);
}

/* Generic surfaces / cards / panels */
html[data-theme="dark"] .settings-card,
html[data-theme="dark"] .settings-section,
html[data-theme="dark"] .card,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .modal,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .popover,
html[data-theme="dark"] .tooltip-box,
html[data-theme="dark"] .chart-container,
html[data-theme="dark"] .table-container,
html[data-theme="dark"] .results-container,
html[data-theme="dark"] .config-panel,
html[data-theme="dark"] .summary-panel {
    background-color: var(--color-surface) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

/* Tables */
html[data-theme="dark"] table {
    color: var(--color-text-primary);
    border-color: var(--color-border);
}

html[data-theme="dark"] thead,
html[data-theme="dark"] thead tr,
html[data-theme="dark"] th {
    background-color: var(--color-table-header) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] td {
    border-color: var(--color-border) !important;
    color: var(--color-text-primary);
}

html[data-theme="dark"] tbody tr {
    background-color: var(--color-surface);
}

html[data-theme="dark"] tbody tr:hover,
html[data-theme="dark"] tbody tr:nth-child(even):hover {
    background-color: var(--color-table-row-hover) !important;
}

html[data-theme="dark"] tbody tr:nth-child(even) {
    background-color: var(--color-bg-secondary);
}

/* Sticky player columns / group headers common in trader inputs & MM */
html[data-theme="dark"] th.mb-player,
html[data-theme="dark"] td.mb-player,
html[data-theme="dark"] .sticky-col,
html[data-theme="dark"] .player-col {
    background-color: var(--color-surface) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

/* Forms */
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .value-input,
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .pa-qsdm-input {
    background-color: var(--color-input-bg) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-input-border) !important;
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
    color: var(--color-text-secondary) !important;
    opacity: 0.8;
}

html[data-theme="dark"] option {
    background-color: var(--color-surface);
    color: var(--color-text-primary);
}

/* Buttons that were white / light gray */
html[data-theme="dark"] button:not(.trade-switch):not(.sidebar-nav-item):not(.sidebar-bottom-item):not(.sidebar-user):not(.sidebar-collapse-btn):not(.mobile-menu-btn),
html[data-theme="dark"] .btn,
html[data-theme="dark"] .mkt-btn,
html[data-theme="dark"] .event-button,
html[data-theme="dark"] .preset-btn {
    border-color: var(--color-border);
}

html[data-theme="dark"] button.secondary,
html[data-theme="dark"] .btn-secondary,
html[data-theme="dark"] .mkt-btn:not(.primary):not(.danger) {
    background-color: var(--color-bg-tertiary) !important;
    color: var(--color-text-primary) !important;
}

/* Text helpers */
html[data-theme="dark"] .subtle,
html[data-theme="dark"] .muted,
html[data-theme="dark"] .secondary-text,
html[data-theme="dark"] .help-text,
html[data-theme="dark"] .section-title {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] label {
    color: var(--color-text-primary);
}

/* Tabs / pills */
html[data-theme="dark"] .tab,
html[data-theme="dark"] .tabs,
html[data-theme="dark"] .tab-bar,
html[data-theme="dark"] .nav-tabs,
html[data-theme="dark"] .segmented-control {
    background-color: var(--color-bg-secondary);
    border-color: var(--color-border);
    color: var(--color-text-secondary);
}

html[data-theme="dark"] .tab.active,
html[data-theme="dark"] .nav-tabs .active,
html[data-theme="dark"] .segment.active {
    background-color: var(--color-surface-elevated) !important;
    color: var(--color-text-primary) !important;
}

/* Scrollbars (WebKit) */
html[data-theme="dark"] *::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
html[data-theme="dark"] *::-webkit-scrollbar-track {
    background: var(--color-bg-secondary);
}
html[data-theme="dark"] *::-webkit-scrollbar-thumb {
    background: #48484A;
    border-radius: 5px;
}
html[data-theme="dark"] *::-webkit-scrollbar-thumb:hover {
    background: #636366;
}

/* ---------- Page-specific high-traffic surfaces ---------- */

/* Predictions */
html[data-theme="dark"] .predictions-container,
html[data-theme="dark"] .predictions-table-wrapper,
html[data-theme="dark"] .tee-time-slider-container {
    background-color: var(--color-bg-primary);
    color: var(--color-text-primary);
}

/* Market page (many inline styles use light bg — catch wrappers) */
html[data-theme="dark"] .market-page,
html[data-theme="dark"] .market-shell,
html[data-theme="dark"] .mkt-card,
html[data-theme="dark"] .mkt-panel,
html[data-theme="dark"] table.market-table {
    background-color: var(--color-surface) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] table.market-table th,
html[data-theme="dark"] table.market-table td {
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] table.market-table thead th[data-sort-key]:hover {
    background: rgba(255, 255, 255, 0.06) !important;
}

html[data-theme="dark"] .mkt-btn {
    background: var(--color-surface) !important;
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .mkt-btn.primary {
    background: var(--color-primary) !important;
    color: #FFFFFF !important;
}

/* RFQ often uses inline white panels */
html[data-theme="dark"] .rfq-wrap,
html[data-theme="dark"] .rfq-box,
html[data-theme="dark"] .quote-card,
html[data-theme="dark"] details,
html[data-theme="dark"] summary {
    background-color: var(--color-surface);
    color: var(--color-text-primary);
    border-color: var(--color-border);
}

/* Market making dense tables — don't force td color (!important kills inline pos greens/reds) */
html[data-theme="dark"] .mm-table th,
html[data-theme="dark"] .matrix-bulk-head {
    background-color: var(--color-surface) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .mm-table td,
html[data-theme="dark"] .matrix-cell {
    background-color: var(--color-surface) !important;
    border-color: var(--color-border) !important;
}

/* Automated trading */
html[data-theme="dark"] .atc-page,
html[data-theme="dark"] .atc-card {
    background-color: var(--color-bg-primary);
    color: var(--color-text-primary);
}


/* Market making / ATC */
html[data-theme="dark"] .mm-page,
html[data-theme="dark"] .mm-panel,
html[data-theme="dark"] .mm-card,
html[data-theme="dark"] .mm-slider-container,
html[data-theme="dark"] .matrix-config-field,
html[data-theme="dark"] .atc-panel {
    background-color: var(--color-surface) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

/* Trader inputs */
html[data-theme="dark"] #trader-inputs-content,
html[data-theme="dark"] .ti-groups-row,
html[data-theme="dark"] .event-pressure-rating-container,
html[data-theme="dark"] .field-averages-compact,
html[data-theme="dark"] .unsaved-changes-banner {
    background-color: var(--color-bg-secondary) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] #playerAnalysisTable th,
html[data-theme="dark"] #playerAnalysisTable td,
html[data-theme="dark"] #playerAnalysisTable thead tr.mb-grouphdr th,
html[data-theme="dark"] #playerAnalysisTable thead tr.mb-subhdr th,
html[data-theme="dark"] #playerAnalysisTable th.mb-player,
html[data-theme="dark"] #playerAnalysisTable td.mb-player,
html[data-theme="dark"] #playerAnalysisTable thead th.mb-player {
    background: var(--color-table-header) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] #playerAnalysisTable td.mb-player {
    background: var(--color-surface) !important;
}

html[data-theme="dark"] .blend-reset-btn,
html[data-theme="dark"] .cut-input,
html[data-theme="dark"] .playoff-holes-input,
html[data-theme="dark"] input.event-cut-input {
    background: var(--color-input-bg) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .mb-help {
    color: var(--color-text-secondary) !important;
}

/* Pressure tab panel wrapper */
html[data-theme="dark"] #pressure-content,
html[data-theme="dark"] [data-tab-content="pressure"],
html[data-theme="dark"] .pressure-panel {
    background: var(--color-bg-primary) !important;
    color: var(--color-text-primary) !important;
}

/* Live / live odds */
html[data-theme="dark"] .live-container,
html[data-theme="dark"] .live-panel,
html[data-theme="dark"] .odds-table-container {
    background-color: var(--color-bg-primary);
    color: var(--color-text-primary);
}

/* RFQ */
html[data-theme="dark"] .rfq-page,
html[data-theme="dark"] .rfq-card,
html[data-theme="dark"] .rfq-panel {
    background-color: var(--color-surface) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

/* Trade history */
html[data-theme="dark"] .trade-history-page,
html[data-theme="dark"] .th-card,
html[data-theme="dark"] .th-panel {
    background-color: var(--color-surface) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

/* Settings */
html[data-theme="dark"] .settings-container {
    color: var(--color-text-primary);
}

html[data-theme="dark"] .settings-header h1,
html[data-theme="dark"] .settings-section h2,
html[data-theme="dark"] .settings-card h3 {
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .settings-section-description {
    color: var(--color-text-secondary) !important;
}

/* Single player / player history / course inspection / pricing */
html[data-theme="dark"] .single-player-container,
html[data-theme="dark"] .player-history-container,
html[data-theme="dark"] .course-inspection-container,
html[data-theme="dark"] .pricing-container,
html[data-theme="dark"] .derivatives-container {
    background-color: var(--color-bg-primary);
    color: var(--color-text-primary);
}

/* Code / pre blocks if any */
html[data-theme="dark"] pre,
html[data-theme="dark"] code {
    background-color: var(--color-bg-tertiary);
    color: var(--color-text-primary);
}

/* Mobile menu button on dark content */
html[data-theme="dark"] .mobile-menu-btn {
    background: var(--color-surface-elevated);
    color: var(--color-text-primary);
    border-color: var(--color-border);
}

/* Login page (standalone — also uses data-theme) */
html[data-theme="dark"] body.login-page {
    background-color: var(--color-bg-primary);
    color: var(--color-text-primary);
}

html[data-theme="dark"] .login-container {
    background-color: var(--color-surface-elevated) !important;
    color: var(--color-text-primary) !important;
    box-shadow: var(--shadow-md) !important;
    border: 1px solid var(--color-border);
}

html[data-theme="dark"] .login-container input {
    background-color: var(--color-input-bg) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-input-border) !important;
}

html[data-theme="dark"] .login-container label {
    color: var(--color-text-primary);
}

/* ==========================================================================
   Follow-up contrast fixes (reported white / black-on-black surfaces)
   ========================================================================== */

/* --- Market snapshots (.snap-* from market_snapshots.html inline styles) --- */
html[data-theme="dark"] .snap-card,
html[data-theme="dark"] .snap-history-item,
html[data-theme="dark"] .snap-req-item,
html[data-theme="dark"] .snap-empty,
html[data-theme="dark"] .snap-create-row .field input,
html[data-theme="dark"] .snap-create-row .field select,
html[data-theme="dark"] .snap-create-row .field textarea,
html[data-theme="dark"] .snap-action-area .field input,
html[data-theme="dark"] .snap-mode-toggle button:not(.active) {
    background: var(--color-surface) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .snap-card h2,
html[data-theme="dark"] .snap-history-title,
html[data-theme="dark"] .snap-req-title,
html[data-theme="dark"] .snap-history-stat .val {
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .snap-action-area {
    background: var(--color-bg-tertiary) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .snap-history-stat {
    background: var(--color-bg-secondary) !important;
}

html[data-theme="dark"] .snap-req-item.running {
    background: rgba(59, 155, 255, 0.12) !important;
    border-color: rgba(59, 155, 255, 0.35) !important;
}

/* --- Trader inputs: event / skill / SD cards --- */
html[data-theme="dark"] .ti-groups-row,
html[data-theme="dark"] .ti-group,
html[data-theme="dark"] .event-pressure-rating-container,
html[data-theme="dark"] .event-slider-container,
html[data-theme="dark"] .field-averages-compact,
html[data-theme="dark"] .sd-implied-stat {
    background: var(--color-bg-secondary) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .ti-group-title,
html[data-theme="dark"] .ti-group-line,
html[data-theme="dark"] .event-pressure-rating-container label,
html[data-theme="dark"] .event-slider-container label,
html[data-theme="dark"] .event-slider-value {
    color: var(--color-text-primary) !important;
}

/* Event + course title at top of trader inputs */
html[data-theme="dark"] .event-name-header .event-name-value,
html[data-theme="dark"] .event-name-value {
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .event-name-header .course-name-value,
html[data-theme="dark"] .course-name-value {
    color: var(--color-text-secondary) !important;
}

/* Skill card Field Avg / Top 40 numbers (hard-coded #1D1D1F in trader_inputs.css) */
html[data-theme="dark"] .field-averages-line-label,
html[data-theme="dark"] .field-averages-line-stat .fa-key,
html[data-theme="dark"] .sd-implied-stat .fa-key,
html[data-theme="dark"] .sd-scale-delta,
html[data-theme="dark"] .fa-sub {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] .field-averages-line-stat,
html[data-theme="dark"] .field-averages-line-stat span,
html[data-theme="dark"] .sd-implied-stat,
html[data-theme="dark"] .sd-implied-stat span {
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .event-slider {
    background: #5C5C60 !important;
}

/* Pin clusters — real classes are .hole-card / .round-selector-container */
html[data-theme="dark"] .pin-clusters-container,
html[data-theme="dark"] .pin-clusters-header,
html[data-theme="dark"] .pin-clusters-main-content,
html[data-theme="dark"] .pin-clusters-grid,
html[data-theme="dark"] .hole-card,
html[data-theme="dark"] .hole-card-image,
html[data-theme="dark"] .hole-card-content,
html[data-theme="dark"] .pin-cluster-cell,
html[data-theme="dark"] .course-tabs-container,
html[data-theme="dark"] .round-selector-container,
html[data-theme="dark"] .round-selector-btn:not(.active) {
    background: var(--color-surface) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .round-selector-container {
    background: var(--color-bg-secondary) !important;
}

html[data-theme="dark"] .pin-clusters-event-title,
html[data-theme="dark"] .pin-clusters-course-subtitle,
html[data-theme="dark"] .hole-card-title,
html[data-theme="dark"] .hole-card-round-label,
html[data-theme="dark"] .round-selector-label {
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] select.pin-cluster-select,
html[data-theme="dark"] .hole-card-round-select {
    background-color: var(--color-input-bg) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .hole-card-round-select:hover {
    background-color: var(--color-bg-tertiary) !important;
}

/* Course fit — force readable text on darkened surfaces */
html[data-theme="dark"] .course-fit-container,
html[data-theme="dark"] .course-fit-table-container,
html[data-theme="dark"] .player-example-container,
html[data-theme="dark"] .course-fit-history-table-wrapper {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .course-fit-history-table th.history-year-current,
html[data-theme="dark"] .course-fit-history-table td.history-year-current {
    color: var(--color-success) !important;
}

html[data-theme="dark"] .course-fit-container,
html[data-theme="dark"] .course-fit-container *,
html[data-theme="dark"] .course-fit-table,
html[data-theme="dark"] .course-fit-table th,
html[data-theme="dark"] .course-fit-table td,
html[data-theme="dark"] .course-fit-history-title,
html[data-theme="dark"] .course-fit-slider-value,
html[data-theme="dark"] .course-fit-stat-label {
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .course-fit-table thead th,
html[data-theme="dark"] .player-example-table thead th {
    background: var(--color-table-header) !important;
    color: var(--color-text-secondary) !important;
}

/* Course history × footer row (inline #FAFAFA in trader_inputs.html) */
html[data-theme="dark"] #courseFitTable tfoot .course-history-multiplier-row td,
html[data-theme="dark"] .course-history-multiplier-row td {
    background: var(--color-bg-secondary) !important;
    color: var(--color-text-primary) !important;
    border-top-color: var(--color-border) !important;
}

/* Player example Total Effect footer (#F5F5F7 in trader_inputs.css) */
html[data-theme="dark"] .player-example-total-row,
html[data-theme="dark"] .player-example-total-row td {
    background: var(--color-bg-secondary) !important;
    border-top-color: var(--color-border) !important;
}

html[data-theme="dark"] .player-example-total-label {
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .player-example-total-value {
    color: var(--color-success) !important;
}

html[data-theme="dark"] .course-fit-loading p,
html[data-theme="dark"] .course-fit-empty p {
    color: var(--color-text-secondary) !important;
}

/* Weather bulk / scoring apply rows */
html[data-theme="dark"] .weather-bulk-bar,
html[data-theme="dark"] .weather-container,
html[data-theme="dark"] .weather-round-selector-container,
html[data-theme="dark"] .scoring-adjustments-round-control,
html[data-theme="dark"] .scoring-adjustments-summary-panel,
html[data-theme="dark"] .scoring-adjustments-table-container,
html[data-theme="dark"] .scoring-adjustments-container {
    background: var(--color-bg-secondary) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .weather-bulk-apply label,
html[data-theme="dark"] .weather-bulk-count,
html[data-theme="dark"] .scoring-adjustments-round-control-label,
html[data-theme="dark"] .scoring-adjustments-summary-label,
html[data-theme="dark"] .scoring-adjustments-summary-value,
html[data-theme="dark"] .scoring-adjustments-slider-value {
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .weather-bulk-input,
html[data-theme="dark"] .scoring-adjustments-table th,
html[data-theme="dark"] .scoring-adjustments-table td {
    background: var(--color-surface) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

/* Pressure tab (inline styles in trader_inputs.html) */
html[data-theme="dark"] #pressureTable th {
    background: var(--color-table-header) !important;
    color: var(--color-text-secondary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] #pressureTable td {
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
    background: var(--color-surface) !important;
}

html[data-theme="dark"] #pressureTable tbody tr:hover td {
    background: var(--color-table-row-hover) !important;
}

html[data-theme="dark"] #pressureTable tbody tr.pr-flag td {
    background: #3D3419 !important;
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .pa-roll-btn:not(.active) {
    background: var(--color-surface) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .unsaved-changes-banner {
    background: #3D3419 !important;
    color: #FDE68A !important;
    border-color: #92400E !important;
}

/* --- Predictions tee filter --- */
html[data-theme="dark"] .tee-time-filter,
html[data-theme="dark"] .tee-time-filter-container,
html[data-theme="dark"] .tee-time-slider-container {
    background: var(--color-surface) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .tee-time-label,
html[data-theme="dark"] .tee-time-filter * {
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .tee-time-filter button:not(.active),
html[data-theme="dark"] .tee-time-presets button:not(.active) {
    background: var(--color-bg-tertiary) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

/* --- Pricing header + main tabs card --- */
html[data-theme="dark"] .filter-bar,
html[data-theme="dark"] .pricing-section,
html[data-theme="dark"] .main-tabs,
html[data-theme="dark"] .matchups-sub-tabs,
html[data-theme="dark"] .winner-table-container,
html[data-theme="dark"] .top-places-table-container,
html[data-theme="dark"] .matchups-table-container,
html[data-theme="dark"] .search-container .search-input {
    background: var(--color-surface) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .filter-bar *,
html[data-theme="dark"] .main-tab,
html[data-theme="dark"] .sub-tab,
html[data-theme="dark"] .toggle-label,
html[data-theme="dark"] .odds-filter-label,
html[data-theme="dark"] .odds-filter-value {
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .main-tab:hover,
html[data-theme="dark"] .sub-tab:hover {
    color: #4ADE80 !important;
}

html[data-theme="dark"] .main-tab.active,
html[data-theme="dark"] .sub-tab.active {
    color: #4ADE80 !important;
}

html[data-theme="dark"] .round-button:not(.active),
html[data-theme="dark"] .round-leader-button:not(.active),
html[data-theme="dark"] .matchup-type-btn:not(.active) {
    background: var(--color-bg-tertiary) !important;
    color: var(--color-text-secondary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .custom-matchup-section {
    background: var(--color-bg-secondary) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .player-dropdown {
    background-color: var(--color-input-bg) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23A1A1A6' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
}

html[data-theme="dark"] .vs-label,
html[data-theme="dark"] .custom-matchup-type-label {
    color: var(--color-text-secondary) !important;
}

/* --- Manual trading + MM / ATC page chrome --- */
html[data-theme="dark"] .mm-v2-container,
html[data-theme="dark"] .odds-table-container,
html[data-theme="dark"] .matrix-card,
html[data-theme="dark"] .atc-widget,
html[data-theme="dark"] .atc-select,
html[data-theme="dark"] .atc-input,
html[data-theme="dark"] .mm-fills-body,
html[data-theme="dark"] .mm-fills-summary,
html[data-theme="dark"] .mapping-sub-table td,
html[data-theme="dark"] .orders-sub-table td,
html[data-theme="dark"] .ev-breakdown-card,
html[data-theme="dark"] .resting-orders-dropdown {
    background: var(--color-bg-primary) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .atc-check,
html[data-theme="dark"] .atc-help,
html[data-theme="dark"] .atc-control-msg {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] .odds-table thead,
html[data-theme="dark"] .odds-table th,
html[data-theme="dark"] .matrix-table th {
    background: var(--color-surface) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .odds-table td,
html[data-theme="dark"] .matrix-table td {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .odds-table tbody tr:nth-child(even) td,
html[data-theme="dark"] .matrix-table tbody tr.matrix-row:nth-child(even) td,
html[data-theme="dark"] .player-row:nth-child(even) td {
    background: var(--color-bg-secondary) !important;
}

html[data-theme="dark"] .odds-table tbody tr:nth-child(odd) td,
html[data-theme="dark"] .matrix-table tbody tr.matrix-row:nth-child(odd) td {
    background: var(--color-surface) !important;
}

html[data-theme="dark"] .player-row:hover,
html[data-theme="dark"] .player-row:hover td,
html[data-theme="dark"] .odds-table tbody tr:hover td {
    background: var(--color-table-row-hover) !important;
}

/* Manual trading: restore Player / Net Position conditional colours */
html[data-theme="dark"] .net-position-positive,
html[data-theme="dark"] td.net-position-positive {
    color: #4ADE80 !important;
}

html[data-theme="dark"] .net-position-negative,
html[data-theme="dark"] td.net-position-negative {
    color: #F87171 !important;
}

html[data-theme="dark"] .odds-table td[style*="#22C55E"] {
    color: #4ADE80 !important;
}

html[data-theme="dark"] .odds-table td[style*="#EF4444"] {
    color: #F87171 !important;
}

html[data-theme="dark"] .summary-row,
html[data-theme="dark"] .summary-row td,
html[data-theme="dark"] .summary-row:hover,
html[data-theme="dark"] .summary-row:hover td {
    background: var(--color-table-header) !important;
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .atc-title,
html[data-theme="dark"] .atc-hint,
html[data-theme="dark"] .mm-log-msg,
html[data-theme="dark"] .mm-fills-summary b {
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .market-type-dropdown {
    background-color: var(--color-input-bg) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

/* --- Players (single_player) --- */
html[data-theme="dark"] .search-input,
html[data-theme="dark"] .search-results,
html[data-theme="dark"] .event-field-sidebar,
html[data-theme="dark"] .player-detail-card,
html[data-theme="dark"] .player-header,
html[data-theme="dark"] .player-details-container .player-header,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .breakdown-card,
html[data-theme="dark"] .contention-card,
html[data-theme="dark"] .form-card,
html[data-theme="dark"] .chart-container,
html[data-theme="dark"] .rolling-avg-container,
html[data-theme="dark"] .sg-breakdown,
html[data-theme="dark"] .category-card {
    background: var(--color-surface) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .player-header h2,
html[data-theme="dark"] .stat-item,
html[data-theme="dark"] .stat-item *,
html[data-theme="dark"] .chart-section,
html[data-theme="dark"] .chart-section h3,
html[data-theme="dark"] .contention-section,
html[data-theme="dark"] .contention-section h3,
html[data-theme="dark"] .event-history-section,
html[data-theme="dark"] .event-history-section h3,
html[data-theme="dark"] .ai-research-section,
html[data-theme="dark"] .event-history-table .rounds-table,
html[data-theme="dark"] .event-search-input {
    background: var(--color-surface) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .event-field-sidebar {
    background: var(--color-bg-secondary) !important;
}

html[data-theme="dark"] .event-field-title,
html[data-theme="dark"] .event-field-sidebar .event-field-title {
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .sidebar-toggle-btn {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] .sidebar-toggle-btn:hover {
    background: var(--color-bg-tertiary) !important;
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .event-player-btn,
html[data-theme="dark"] .event-player-count,
html[data-theme="dark"] .search-results * {
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .event-player-btn:hover {
    background: var(--color-bg-tertiary) !important;
}

html[data-theme="dark"] .event-player-btn.selected {
    background: #2563EB !important;
    color: #FFFFFF !important;
}

/* Catch remaining white cards on players page */
html[data-theme="dark"] .single-player-content [style*="background: white"],
html[data-theme="dark"] .single-player-content [style*="background:#fff"],
html[data-theme="dark"] .single-player-content [style*="background: #fff"],
html[data-theme="dark"] .single-player-content [style*="background:#FFFFFF"],
html[data-theme="dark"] .single-player-content [style*="background: #FFFFFF"] {
    background: var(--color-surface) !important;
}

/* --- Course inspection Event column --- */
html[data-theme="dark"] .event-name-cell,
html[data-theme="dark"] .ci-round-table tbody tr.event-group-start .event-name-cell {
    background: var(--color-bg-secondary) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .ci-round-table th,
html[data-theme="dark"] .ci-round-table td {
    background: var(--color-surface) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .ci-empty,
html[data-theme="dark"] .ci-main-panel,
html[data-theme="dark"] .si-stat-block:not(.si-diff) {
    background: var(--color-surface) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

/* --- Trade history banner + KPI / chart cards --- */
html[data-theme="dark"] .th-banner,
html[data-theme="dark"] .th-kpi,
html[data-theme="dark"] .th-card,
html[data-theme="dark"] .th-banner select {
    background: var(--color-surface) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .th-banner,
html[data-theme="dark"] .th-banner *,
html[data-theme="dark"] .th-kpi .lbl,
html[data-theme="dark"] .th-kpi .val,
html[data-theme="dark"] .th-kpi .sub,
html[data-theme="dark"] .th-card h3,
html[data-theme="dark"] .th-card .cap {
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .th-card .cap,
html[data-theme="dark"] .th-kpi .lbl,
html[data-theme="dark"] .th-kpi .sub {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] table.th-table tbody tr:hover,
html[data-theme="dark"] .th-trow[data-toggle]:hover,
html[data-theme="dark"] .th-trow.d1,
html[data-theme="dark"] .th-trow.d2 {
    background: var(--color-table-row-hover) !important;
}

/* ==========================================================================
   Contrast pass (matchups / pin / weather / sliders / ATC headers)
   ========================================================================== */

/* Weather: Model vs Trader effect columns + bar values */
html[data-theme="dark"] .weather-table thead {
    background: var(--color-table-header) !important;
}

html[data-theme="dark"] .weather-table th,
html[data-theme="dark"] .weather-table td {
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .weather-table th {
    color: #E8E8ED !important;
    font-weight: 700 !important;
}

html[data-theme="dark"] .weather-table thead th:nth-child(4) {
    color: #93C5FD !important; /* Model — cool */
}

html[data-theme="dark"] .weather-table thead th:nth-child(5) {
    color: #6EE7B7 !important; /* Trader — green accent */
}

html[data-theme="dark"] .weather-main-row:hover {
    background-color: var(--color-table-row-hover) !important;
}

html[data-theme="dark"] .weather-main-row.expanded {
    background-color: #1A332C !important;
}

html[data-theme="dark"] .weather-effect-bar-value,
html[data-theme="dark"] .weather-hole-effect-value,
html[data-theme="dark"] .weather-slider-value {
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .weather-effect-bar-center,
html[data-theme="dark"] .weather-hole-effect-bar-center {
    background: #A1A1A6 !important;
}

/* Trader Inputs sliders — brighter track + thumb ring */
html[data-theme="dark"] .event-slider,
html[data-theme="dark"] .weather-slider,
html[data-theme="dark"] .blend-slider,
html[data-theme="dark"] .course-fit-slider,
html[data-theme="dark"] .player-example-slider,
html[data-theme="dark"] .scoring-adjustments-slider {
    background: #6E6E73 !important;
    height: 6px !important;
}

html[data-theme="dark"] .event-slider::-webkit-slider-thumb,
html[data-theme="dark"] .weather-slider::-webkit-slider-thumb,
html[data-theme="dark"] .blend-slider::-webkit-slider-thumb,
html[data-theme="dark"] .course-fit-slider::-webkit-slider-thumb,
html[data-theme="dark"] .player-example-slider::-webkit-slider-thumb,
html[data-theme="dark"] .scoring-adjustments-slider::-webkit-slider-thumb {
    background: #34D399 !important;
    border: 2px solid #F5F5F7 !important;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45), 0 1px 4px rgba(0, 0, 0, 0.5) !important;
}

html[data-theme="dark"] .event-slider::-moz-range-thumb,
html[data-theme="dark"] .weather-slider::-moz-range-thumb,
html[data-theme="dark"] .blend-slider::-moz-range-thumb,
html[data-theme="dark"] .course-fit-slider::-moz-range-thumb,
html[data-theme="dark"] .player-example-slider::-moz-range-thumb,
html[data-theme="dark"] .scoring-adjustments-slider::-moz-range-thumb {
    background: #34D399 !important;
    border: 2px solid #F5F5F7 !important;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45), 0 1px 4px rgba(0, 0, 0, 0.5) !important;
}

html[data-theme="dark"] .event-slider-value,
html[data-theme="dark"] .blend-slider-value,
html[data-theme="dark"] .course-fit-slider-value,
html[data-theme="dark"] .scoring-adjustments-slider-value {
    color: var(--color-text-primary) !important;
}

/* Automated trading matrix: Win / Top 5 / Top 10 / Top 20 headers */
html[data-theme="dark"] .matrix-mkt-name {
    color: #F5F5F7 !important;
    font-weight: 700 !important;
    font-size: 13px !important;
}

html[data-theme="dark"] .matrix-mkt-th,
html[data-theme="dark"] .matrix-table th.matrix-player-th {
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .matrix-icon-btn,
html[data-theme="dark"] .matrix-cfg-btn {
    background: var(--color-bg-tertiary) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .matrix-icon-btn:hover,
html[data-theme="dark"] .matrix-cfg-btn:hover {
    background: var(--color-table-row-hover) !important;
    color: #FFFFFF !important;
}

html[data-theme="dark"] .matrix-dot-standby {
    background: var(--color-surface) !important;
}

/* Manual trading width / liability / to-win sliders */
html[data-theme="dark"] .mm-slider-input {
    background: var(--color-bg-tertiary) !important;
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .mm-slider-range {
    background: #6E6E73 !important;
    height: 6px !important;
}

html[data-theme="dark"] .mm-slider-range::-webkit-slider-thumb {
    background: #34D399 !important;
    border: 2px solid #F5F5F7 !important;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45) !important;
    width: 12px !important;
    height: 12px !important;
}

html[data-theme="dark"] .mm-slider-range::-moz-range-thumb {
    background: #34D399 !important;
    border: 2px solid #F5F5F7 !important;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45) !important;
    width: 12px !important;
    height: 12px !important;
}

/* ATC Trader log / Fills / System health cards */
html[data-theme="dark"] .matrix-card-title,
html[data-theme="dark"] .matrix-card-head,
html[data-theme="dark"] .mm-log-caret,
html[data-theme="dark"] .matrix-legend,
html[data-theme="dark"] .mm-health-market,
html[data-theme="dark"] .mm-health-legend,
html[data-theme="dark"] .atc-seg-title {
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .matrix-legend,
html[data-theme="dark"] .mm-health-legend,
html[data-theme="dark"] .mm-log-empty,
html[data-theme="dark"] .mm-fills-empty,
html[data-theme="dark"] .mm-fills-muted,
html[data-theme="dark"] .mm-fills-ts,
html[data-theme="dark"] .mm-fills-mkt {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] .atc-seg {
    background: var(--color-bg-tertiary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .atc-seg button {
    background: transparent !important;
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] .atc-seg button:hover {
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .atc-seg button.active {
    background: var(--color-surface-elevated) !important;
    color: #FFFFFF !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35) !important;
}

html[data-theme="dark"] #atc-posting-mode-seg button[data-value="shadow"].active {
    color: #6EE7B7 !important;
}

html[data-theme="dark"] #atc-posting-mode-seg button[data-value="live"].active {
    background: #b02a37 !important;
    color: #FFFFFF !important;
}

html[data-theme="dark"] .mm-log-body,
html[data-theme="dark"] .mm-log-head:hover {
    background: var(--color-bg-secondary) !important;
}

html[data-theme="dark"] .mm-log-msg,
html[data-theme="dark"] .mm-log-lvl {
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .mm-log-ts {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] .mm-log-src {
    color: #6EE7B7 !important;
}

html[data-theme="dark"] .mm-log-line.mm-log-warn .mm-log-lvl,
html[data-theme="dark"] .mm-log-line.mm-log-warn .mm-log-msg {
    color: #FBBF24 !important;
}

html[data-theme="dark"] .mm-log-line.mm-log-err .mm-log-lvl,
html[data-theme="dark"] .mm-log-line.mm-log-err .mm-log-msg {
    color: #F87171 !important;
}

html[data-theme="dark"] .mm-fills-body,
html[data-theme="dark"] .mm-fills-summary,
html[data-theme="dark"] .mm-health-body {
    background: var(--color-bg-secondary) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .mm-fills-summary,
html[data-theme="dark"] .mm-fills-summary b,
html[data-theme="dark"] .mm-fills-player {
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .mm-fills-table th {
    background: var(--color-table-header) !important;
    color: var(--color-text-secondary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .mm-fills-table td {
    background: var(--color-surface) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

/* Per-player shot-feed timeline under a fill row */
html[data-theme="dark"] .mm-shots-row > td {
    background: var(--color-bg-tertiary) !important;
}

html[data-theme="dark"] .mm-shots-head {
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .mm-shots-table-wrap {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .mm-shots-table th {
    background: var(--color-table-header) !important;
    color: var(--color-text-secondary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .mm-shots-table td {
    background: var(--color-surface) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .mm-shots-table tr:hover td {
    background: var(--color-bg-hover) !important;
}

html[data-theme="dark"] .mm-shots-ts,
html[data-theme="dark"] .mm-shots-status,
html[data-theme="dark"] .mm-shots-empty {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] .mm-shots-table tr.mm-shots-fill td {
    background: rgba(251, 191, 36, 0.14) !important;
    color: #FCD34D !important;
}

/* Aggregated fills card (window controls + sortable headers + drill-down) */
html[data-theme="dark"] .mm-agg-window-readout {
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] #mm-agg-table th[data-sort]:hover {
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .mm-agg-drill-row > td {
    background: var(--color-bg-tertiary) !important;
}

html[data-theme="dark"] .atc-health-chip,
html[data-theme="dark"] .atc-health-light {
    background: var(--color-bg-tertiary) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .atc-health-age {
    color: var(--color-text-secondary) !important;
}

/* Matrix body: fair / chips / labels (Win, Top 5, … cells) */
html[data-theme="dark"] .matrix-fair,
html[data-theme="dark"] .matrix-player-name,
html[data-theme="dark"] .matrix-cell-param-label,
html[data-theme="dark"] .matrix-cell-empty,
html[data-theme="dark"] .matrix-cell-effwidth {
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .matrix-chip-buy.matrix-chip-live,
html[data-theme="dark"] .matrix-chip-buy.matrix-chip-shadow {
    color: #6EE7B7 !important;
    background: rgba(52, 211, 153, 0.12) !important;
    border-color: #34D399 !important;
}

html[data-theme="dark"] .matrix-chip-sell.matrix-chip-live,
html[data-theme="dark"] .matrix-chip-sell.matrix-chip-shadow {
    color: #93C5FD !important;
    background: rgba(59, 155, 255, 0.12) !important;
    border-color: #60A5FA !important;
}

html[data-theme="dark"] .matrix-chip.matrix-chip-manual {
    color: #D1D5DB !important;
    background: rgba(209, 213, 219, 0.08) !important;
    border-color: #6B7280 !important;
}

html[data-theme="dark"] .matrix-pos {
    color: #9CA3AF !important;
}

html[data-theme="dark"] .matrix-pos-up,
html[data-theme="dark"] .matrix-pos .matrix-pos-net.matrix-pos-up {
    color: #4ADE80 !important;
}

html[data-theme="dark"] .matrix-pos-down,
html[data-theme="dark"] .matrix-pos .matrix-pos-net.matrix-pos-down {
    color: #F87171 !important;
}

/* Predictions course tab: vs Par / Diff bar values */
html[data-theme="dark"] .diff-bar-value,
html[data-theme="dark"] .sd-vs-expected {
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .diff-bar-center {
    background: #A1A1A6 !important;
}

html[data-theme="dark"] .course-table .course-totals-row,
html[data-theme="dark"] .course-table .course-nine-totals-row {
    background: var(--color-bg-secondary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .course-table .course-totals-row td,
html[data-theme="dark"] .course-table .course-nine-totals-row td,
html[data-theme="dark"] .course-table .sd-value {
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .course-table .course-totals-row .totals-label,
html[data-theme="dark"] .course-table .course-nine-totals-row .totals-label {
    background: var(--color-bg-tertiary) !important;
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .course-table .course-nine-totals-row .totals-value {
    background: #2A2A2C !important;
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .course-table .course-totals-row .totals-value {
    background: #1A332C !important;
    color: #6EE7B7 !important;
}

html[data-theme="dark"] .course-table .course-totals-row .totals-value .diff-bar-value,
html[data-theme="dark"] .course-table .course-nine-totals-row .totals-value .diff-bar-value,
html[data-theme="dark"] .course-table .course-totals-row .totals-value .sd-vs-expected,
html[data-theme="dark"] .course-table .course-nine-totals-row .totals-value .sd-vs-expected {
    color: var(--color-text-primary) !important;
}

/* ATC market Config pop-out */
html[data-theme="dark"] .matrix-config-row > td,
html[data-theme="dark"] .matrix-cell-dropdown-row > td {
    background: var(--color-bg-secondary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .matrix-dropdown-box {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45) !important;
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .matrix-dropdown-head {
    background: var(--color-bg-tertiary) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .matrix-dropdown-section + .matrix-dropdown-section {
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .matrix-config-title,
html[data-theme="dark"] .matrix-config-label,
html[data-theme="dark"] .matrix-config-hint,
html[data-theme="dark"] .matrix-config-sublabel {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] .matrix-config-field,
html[data-theme="dark"] .matrix-bulk-head,
html[data-theme="dark"] .matrix-bulk-field {
    background: transparent !important;
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .matrix-config-input,
html[data-theme="dark"] .matrix-config-num,
html[data-theme="dark"] .atc-slider-value {
    background: var(--color-input-bg) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .matrix-config-apply {
    background: var(--color-bg-tertiary) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .matrix-config-apply:hover {
    background: var(--color-table-row-hover) !important;
}

html[data-theme="dark"] .atc-tabbar {
    border-bottom-color: var(--color-border) !important;
}

html[data-theme="dark"] .atc-tab {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] .atc-tab:hover {
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .atc-tab.active {
    color: var(--color-text-primary) !important;
    border-bottom-color: #34D399 !important;
}

html[data-theme="dark"] .atc-tab-tag {
    background: #3F2D12 !important;
    color: #FCD34D !important;
}

html[data-theme="dark"] .matrix-family-card,
html[data-theme="dark"] .tb-group,
html[data-theme="dark"] .hs-player {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .tb-empty,
html[data-theme="dark"] .tb-group-tee,
html[data-theme="dark"] .tb-name,
html[data-theme="dark"] .tb-fair,
html[data-theme="dark"] .hs-player-name,
html[data-theme="dark"] .hs-holeno {
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .tb-row-head,
html[data-theme="dark"] .tb-cap-left,
html[data-theme="dark"] .tb-mkt,
html[data-theme="dark"] .tb-vol,
html[data-theme="dark"] .tb-muted,
html[data-theme="dark"] .tb-unmapped-note,
html[data-theme="dark"] .hs-dial-label,
html[data-theme="dark"] .hs-row-head,
html[data-theme="dark"] .hs-holepar,
html[data-theme="dark"] .hs-simmean,
html[data-theme="dark"] .hs-cell-sub {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] .tb-group-head,
html[data-theme="dark"] .tb-expand,
html[data-theme="dark"] .tb-config-box,
html[data-theme="dark"] .hs-player-head,
html[data-theme="dark"] .hs-cfg,
html[data-theme="dark"] .hs-expand {
    background: var(--color-bg-secondary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .tb-row,
html[data-theme="dark"] .hs-row,
html[data-theme="dark"] .hs-bucket-head,
html[data-theme="dark"] .hs-cell {
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .tb-row:hover,
html[data-theme="dark"] .hs-cell:hover {
    background: var(--color-table-row-hover) !important;
}

html[data-theme="dark"] .tb-expand .matrix-dropdown-head {
    background: #1A332C !important;
}

html[data-theme="dark"] .matrix-dropdown-close:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .matrix-config-add {
    color: #6EE7B7 !important;
    border-color: #347A5F !important;
}

html[data-theme="dark"] .matrix-config-add:hover {
    background: rgba(52, 211, 153, 0.12) !important;
}

html[data-theme="dark"] .matrix-config-zero {
    color: #FBBF24 !important;
    border-color: #92400E !important;
}

html[data-theme="dark"] .matrix-config-zero:hover {
    background: rgba(251, 191, 36, 0.12) !important;
}

html[data-theme="dark"] .matrix-config-zeroadd {
    color: #93C5FD !important;
    border-color: #1E40AF !important;
}

html[data-theme="dark"] .matrix-config-zeroadd:hover {
    background: rgba(147, 197, 253, 0.12) !important;
}

/* Players event history: SG bar labels + rounds dropdown + selection average */
html[data-theme="dark"] .event-history-table .sg-value,
html[data-theme="dark"] .event-history-table .rounds-table .sg-value,
html[data-theme="dark"] .event-history-table td,
html[data-theme="dark"] .event-history-table .rounds-table td,
html[data-theme="dark"] .event-history-table .rounds-table th {
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .event-history-table .event-dropdown,
html[data-theme="dark"] .event-history-table .rounds-table {
    background: var(--color-bg-secondary) !important;
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .event-history-table .rounds-table th,
html[data-theme="dark"] .event-history-table .rounds-table td {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] #event-average-display-container {
    background-color: var(--color-bg-secondary) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] #event-average-display-container > div {
    color: var(--color-text-primary) !important;
}

/* Players: Performance by Year */
html[data-theme="dark"] .year-aggregation-table thead {
    background: var(--color-table-header) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .year-aggregation-table th,
html[data-theme="dark"] .year-aggregation-table td,
html[data-theme="dark"] .year-aggregation-table td:nth-child(1),
html[data-theme="dark"] .year-aggregation-table .sg-value {
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .year-aggregation-table td.sd-column,
html[data-theme="dark"] .rounds-with-sg {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] .year-aggregation-table tbody tr {
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .year-aggregation-table tbody tr:hover {
    background-color: var(--color-table-row-hover) !important;
}

/* ATC / MM order-book ladder dropdowns */
html[data-theme="dark"] tr.dropdown,
html[data-theme="dark"] .matrix-cell-dropdown-row,
html[data-theme="dark"] .odds-table tr.dropdown > td,
html[data-theme="dark"] .matrix-table tr.dropdown > td,
html[data-theme="dark"] .matrix-cell-dropdown-row > td {
    background: var(--color-bg-secondary) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .matrix-dropdown-box,
html[data-theme="dark"] .matrix-cell-ladder,
html[data-theme="dark"] .matrix-cell-params,
html[data-theme="dark"] .dropdown-tab-panel,
html[data-theme="dark"] .ob-container,
html[data-theme="dark"] .ob-dual-panel {
    background: var(--color-surface) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .ob-table,
html[data-theme="dark"] .ob-table thead th,
html[data-theme="dark"] .ob-table tbody td,
html[data-theme="dark"] .matrix-cell-ladder .ob-table thead th,
html[data-theme="dark"] .matrix-cell-ladder .ob-row td {
    background: var(--color-surface) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .ob-table thead th,
html[data-theme="dark"] .ob-decimal,
html[data-theme="dark"] .ob-total,
html[data-theme="dark"] .ob-updated,
html[data-theme="dark"] .ob-qty-label,
html[data-theme="dark"] .ob-expiry-toggle,
html[data-theme="dark"] .ob-spread-hint,
html[data-theme="dark"] .ob-loading {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] .ob-count,
html[data-theme="dark"] .ob-price,
html[data-theme="dark"] .ob-spread-row td,
html[data-theme="dark"] .ob-spread-text,
html[data-theme="dark"] .ob-spread-form-label {
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .ob-price-ask { color: #F87171 !important; }
html[data-theme="dark"] .ob-price-bid { color: #4ADE80 !important; }

html[data-theme="dark"] .ob-side-btn:not(.active),
html[data-theme="dark"] .ob-cancel-all-btn,
html[data-theme="dark"] .ob-qty-input,
html[data-theme="dark"] .ob-spread-price,
html[data-theme="dark"] .mm-inc-btn {
    background: var(--color-bg-tertiary) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .ob-side-btn:not(.active):hover {
    border-color: #34D399 !important;
    color: #6EE7B7 !important;
}

html[data-theme="dark"] .ob-qty-range {
    accent-color: #34D399 !important;
}

html[data-theme="dark"] .ob-satob-back,
html[data-theme="dark"] .ob-satob-buy,
html[data-theme="dark"] .ob-satob-lay,
html[data-theme="dark"] .ob-satob-sell {
    background: var(--color-bg-tertiary) !important;
}

html[data-theme="dark"] .matrix-cell-ladder .ob-wq-buy {
    color: #6EE7B7 !important;
    background: rgba(52, 211, 153, 0.12) !important;
    border-color: #34D399 !important;
}

html[data-theme="dark"] .matrix-cell-ladder .ob-wq-sell {
    color: #93C5FD !important;
    background: rgba(59, 155, 255, 0.12) !important;
    border-color: #60A5FA !important;
}

html[data-theme="dark"] .ob-qsdm-tag {
    color: #6EE7B7 !important;
    background: rgba(52, 211, 153, 0.18) !important;
}

html[data-theme="dark"] .ob-bf-tag {
    color: #F0BE64 !important;
    background: rgba(217, 169, 74, 0.18) !important;
}

html[data-theme="dark"] .ob-bf-inline {
    color: #F0BE64 !important;
}

html[data-theme="dark"] .ob-qsda-tag {
    color: #93C5FD !important;
    background: rgba(59, 155, 255, 0.18) !important;
}

html[data-theme="dark"] .ob-mine-manual {
    background: var(--color-bg-tertiary) !important;
    color: #D1D5DB !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .matrix-cell-effwidth {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] .matrix-cell-effwidth.eff-scaled {
    color: #FBBF24 !important;
}

/* Live + Predictions: player distribution expand dropdowns */
html[data-theme="dark"] .expand-row,
html[data-theme="dark"] .predictions-table .player-row.expanded {
    background: var(--color-bg-secondary) !important;
}

html[data-theme="dark"] .expand-row td {
    background: var(--color-bg-secondary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .holes-table-container,
html[data-theme="dark"] .player-details-container,
html[data-theme="dark"] .holes-container,
html[data-theme="dark"] .holes-table,
html[data-theme="dark"] .round-table-container {
    background: var(--color-surface) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .holes-title {
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .holes-table thead,
html[data-theme="dark"] .holes-table th {
    background: var(--color-table-header) !important;
    color: var(--color-text-secondary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .holes-table .hole-row td,
html[data-theme="dark"] .holes-table .hole-row td.hole-number,
html[data-theme="dark"] .holes-table .hole-row td.mean-value,
html[data-theme="dark"] .holes-table .hole-row td:first-child {
    background: var(--color-surface) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .holes-table .hole-row:hover,
html[data-theme="dark"] .holes-table .hole-row:hover td {
    background: var(--color-table-row-hover) !important;
}

html[data-theme="dark"] .hole-current,
html[data-theme="dark"] .hole-current td {
    background: #1A2A3A !important;
}

html[data-theme="dark"] .current-hole-section {
    background: var(--color-bg-secondary) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .current-hole-label,
html[data-theme="dark"] .lookup-label {
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .lookup-panel {
    background: #1A2A3A !important;
    border-color: #2A4A6A !important;
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .lie-btn,
html[data-theme="dark"] .shot-btn,
html[data-theme="dark"] .btn-quick-set,
html[data-theme="dark"] .btn-quick-score,
html[data-theme="dark"] .round-tab:not(.active) {
    background: var(--color-bg-tertiary) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .round-tab:hover {
    background: var(--color-table-row-hover) !important;
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .round-tabs {
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .prob-input:hover,
html[data-theme="dark"] .prob-input:focus {
    background: var(--color-bg-tertiary) !important;
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .prob-bar-container {
    background: var(--color-bg-tertiary) !important;
}

html[data-theme="dark"] .prob-value {
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .prob-bar-container.high-prob .prob-value {
    color: #FFFFFF !important;
}

/* Course Inspection — Market Implied panel (+ shared chrome) */
html[data-theme="dark"] .market-stat-container {
    background: var(--color-bg-primary) !important;
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .ci-main-tabs-bar,
html[data-theme="dark"] .ci-tabs-container {
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .ci-main-tab,
html[data-theme="dark"] .ci-tab {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] .ci-main-tab:hover,
html[data-theme="dark"] .ci-tab:hover {
    color: var(--color-text-primary) !important;
    background-color: var(--color-bg-secondary) !important;
}

html[data-theme="dark"] .ci-main-tab.active,
html[data-theme="dark"] .ci-tab.active {
    color: #6EE7B7 !important;
    border-bottom-color: #34D399 !important;
    background: transparent !important;
}

html[data-theme="dark"] .ci-event-name-value {
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .ci-course-name-value,
html[data-theme="dark"] .ci-loading,
html[data-theme="dark"] .ci-empty {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] .ci-table-container {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .chart-selection label {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] .chart-selection select {
    background: var(--color-bg-tertiary) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .chart-selection select:focus {
    background: var(--color-input-bg) !important;
    border-color: #34D399 !important;
}

html[data-theme="dark"] #marketImpliedPanel .chart-container,
html[data-theme="dark"] .market-stat-container .chart-container {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    box-shadow: var(--shadow-sm) !important;
}

html[data-theme="dark"] .stats-table-container {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    box-shadow: var(--shadow-sm) !important;
}

html[data-theme="dark"] .comparison-table thead,
html[data-theme="dark"] .comparison-table th,
html[data-theme="dark"] .comparison-table th:first-child {
    background: var(--color-table-header) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .comparison-table th:hover {
    background: var(--color-table-row-hover) !important;
}

html[data-theme="dark"] .comparison-table td,
html[data-theme="dark"] .comparison-table td:first-child {
    background: var(--color-surface) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .comparison-table tbody tr:hover,
html[data-theme="dark"] .comparison-table tbody tr:hover td,
html[data-theme="dark"] .comparison-table tbody tr:hover td:first-child {
    background: #1A332C !important;
}

html[data-theme="dark"] .sort-arrow {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] .sortable-header .sort-arrow {
    color: #6EE7B7 !important;
}

/* Smart Interpreter on Market Implied */
html[data-theme="dark"] .smart-interpreter {
    background: var(--color-bg-secondary) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .si-label,
html[data-theme="dark"] .si-stat-label,
html[data-theme="dark"] .si-stat-count {
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] .si-axis-label,
html[data-theme="dark"] .si-stat-value,
html[data-theme="dark"] .si-message {
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .si-value,
html[data-theme="dark"] .si-message strong,
html[data-theme="dark"] .si-stat-block.si-diff .si-stat-value {
    color: #6EE7B7 !important;
}

html[data-theme="dark"] .si-stat-block {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .si-stat-block.si-diff {
    background: #1A332C !important;
    border-color: #347A5F !important;
}

html[data-theme="dark"] .si-message {
    background: var(--color-surface) !important;
    border-left-color: #34D399 !important;
}

html[data-theme="dark"] .si-slider {
    accent-color: #34D399 !important;
}

/* Historical panel residual light surfaces */
html[data-theme="dark"] .ci-round-table thead,
html[data-theme="dark"] .ci-hole-table thead {
    background: var(--color-table-header) !important;
}

html[data-theme="dark"] .ci-round-table tbody tr.round-row:hover,
html[data-theme="dark"] .ci-round-table tbody tr.round-row:hover td {
    background: var(--color-table-row-hover) !important;
}

html[data-theme="dark"] .ci-round-table tbody tr.round-row.expanded,
html[data-theme="dark"] .ci-round-table tbody tr.round-row.expanded td {
    background: #1A332C !important;
}

html[data-theme="dark"] .ci-round-table th.sortable:hover,
html[data-theme="dark"] .ci-hole-table th.sortable:hover {
    background: var(--color-table-row-hover) !important;
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .ci-avg-row,
html[data-theme="dark"] .ci-avg-row th {
    background: var(--color-bg-tertiary) !important;
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .ci-hole-table .diff-bar-value {
    color: var(--color-text-primary) !important;
}

/* --- Trader inputs: playoff holes dropdown --- */
html[data-theme="dark"] .playoff-holes-toggle {
    background: var(--color-input-bg) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .playoff-holes-menu {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35) !important;
}

html[data-theme="dark"] .playoff-holes-option {
    color: var(--color-text-primary) !important;
}

/* --- Trader inputs: scoring adjustment reset buttons --- */
html[data-theme="dark"] .scoring-adjustments-reset-btn {
    background: var(--color-bg-tertiary) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .scoring-adjustments-reset-btn:hover {
    background: var(--color-bg-secondary) !important;
    border-color: var(--color-brand) !important;
    color: var(--color-brand) !important;
}

/* --- Pricing matchups sub-tabs (inactive pill background) --- */
html[data-theme="dark"] .sub-tab:not(.active) {
    background: var(--color-bg-tertiary) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] .sub-tab.active {
    background: var(--color-brand) !important;
    border-color: var(--color-brand) !important;
    color: #FFFFFF !important;
}

/* --- Automated trading: conservative quote-risk guard --- */
html[data-theme="dark"] .matrix-guard-wrap {
    background: var(--color-surface) !important;
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] .matrix-guard-ctl {
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .matrix-guard-pill {
    background: var(--color-bg-tertiary) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text-secondary) !important;
}

html[data-theme="dark"] .matrix-guard-pill.conservative {
    color: var(--color-warning) !important;
    background: var(--color-warning-tint) !important;
    border-color: #FCD34D !important;
}

/* --- Players Review: rolling average + contention controls --- */
html[data-theme="dark"] .toggle-button:not(.active),
html[data-theme="dark"] .filter-btn:not(.active),
html[data-theme="dark"] .show-more-btn {
    background: var(--color-bg-tertiary) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text-primary) !important;
}

html[data-theme="dark"] .toggle-button:hover:not(.active),
html[data-theme="dark"] .filter-btn:hover:not(.active),
html[data-theme="dark"] .show-more-btn:hover {
    background: var(--color-bg-secondary) !important;
    border-color: var(--color-brand) !important;
    color: var(--color-brand) !important;
}

html[data-theme="dark"] .toggle-button.active,
html[data-theme="dark"] .filter-btn.active {
    background: var(--color-brand) !important;
    border-color: var(--color-brand) !important;
    color: #FFFFFF !important;
    box-shadow: 0 2px 8px rgba(10, 107, 86, 0.35) !important;
}
