/* MLB Series Betting Dashboard - Styles */

:root {
    --brand-navy: #183765;
    --brand-blue: #28508b;
    --brand-blue-soft: #edf3fb;
    --surface: #ffffff;
    --surface-muted: #f7f9fc;
    --surface-tint: #fbfcfe;
    --border-soft: #d8e0ec;
    --text-main: #24324a;
    --text-muted: #66758a;
    --shadow-soft: 0 10px 30px rgba(16, 42, 84, 0.08);
    --shadow-card: 0 6px 18px rgba(15, 35, 70, 0.08);
    --radius-md: 10px;
    --radius-lg: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(40, 80, 139, 0.06), transparent 28%),
        linear-gradient(180deg, #f4f7fb 0%, #eef2f7 100%);
    color: var(--text-main);
    line-height: 1.6;
}

.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 18px;
}

.auth-card h2 {
    color: #1e3c72;
    margin-bottom: 6px;
}

.auth-message {
    font-size: 0.95rem;
    margin-bottom: 12px;
    color: #555;
}

.auth-message.error {
    color: #b42318;
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.auth-tab {
    border: 1px solid #d0d7e2;
    background: #f7f9fc;
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    font-weight: 600;
}

.auth-tab.active {
    background: #1e3c72;
    border-color: #1e3c72;
    color: #ffffff;
}

.auth-form .form-group {
    margin-bottom: 10px;
}

.auth-submit {
    width: 100%;
    margin-top: 4px;
}

.auth-link-btn {
    margin-top: 10px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--brand-blue);
    font-weight: 600;
    cursor: pointer;
}

.auth-link-btn:hover {
    text-decoration: underline;
}

.auth-footer {
    margin-top: 12px;
    font-size: 0.78rem;
    color: #667;
    text-align: center;
}

.bootstrap-auth-card {
    border-radius: 22px;
    border: 1px solid rgba(31, 66, 118, 0.08);
    box-shadow: 0 24px 50px rgba(22, 37, 67, 0.16);
    padding: 0;
}

.bootstrap-auth-card .card-body {
    padding: 26px 26px 18px !important;
}

.bootstrap-auth-form .form-control {
    min-height: 48px;
    border-radius: 12px;
}

.bootstrap-auth-form .auth-submit {
    min-height: 46px;
    border-radius: 12px;
    font-weight: 700;
}

.settings-section {
    margin-bottom: 14px;
    padding: 16px 18px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: linear-gradient(180deg, var(--surface-tint) 0%, var(--surface) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.settings-message {
    margin-bottom: 10px;
    color: #445;
}

.settings-message.error {
    color: #b42318;
}

.settings-message.success {
    color: #117a37;
}

.settings-admin-list {
    display: grid;
    gap: 8px;
}

.settings-admin-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 8px;
    align-items: center;
    padding: 8px;
    border: 1px solid #e1e6ef;
    border-radius: 6px;
    background: #fff;
}

.settings-admin-meta {
    font-size: 0.92em;
    color: #234;
}

.settings-admin-meta small {
    color: #667;
}

.settings-admin-actions {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}

.settings-modal-content {
    max-width: 860px;
}

.settings-shell {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.settings-tabs {
    display: grid;
    gap: 8px;
    padding: 6px;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: linear-gradient(180deg, #f8fbff 0%, #f2f6fb 100%);
}

.settings-tab {
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.96em;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.18s ease, color 0.18s ease;
}

.settings-tab:hover {
    background: rgba(40, 80, 139, 0.08);
    color: var(--brand-navy);
}

.settings-tab.active {
    background: linear-gradient(180deg, #214983 0%, #1b3d70 100%);
    color: #fff;
    box-shadow: 0 8px 18px rgba(27, 61, 112, 0.18);
}

.settings-panels {
    min-width: 0;
}

.settings-panel {
    display: none;
}

.settings-panel.active {
    display: block;
}

.bootstrap-settings-tabs {
    gap: 10px;
}

.bootstrap-form-card {
    border-radius: 16px;
    padding: 20px 22px;
}

.bootstrap-admin-section {
    border-radius: 16px;
}

.bootstrap-form-row {
    align-items: stretch;
}

.bootstrap-modal-form .form-control,
.bootstrap-modal-form .form-select,
.bootstrap-form-row .form-control,
.bootstrap-form-row .form-select {
    min-height: 46px;
    border-radius: 12px;
}

.bootstrap-switch {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: rgba(244, 248, 253, 0.8);
}

.bootstrap-switch .form-check-input {
    width: 3rem;
    height: 1.65rem;
    margin: 0;
    cursor: pointer;
    border-color: #9bb1cf;
    box-shadow: none;
}

.bootstrap-switch .form-check-input:checked {
    background-color: #28508b;
    border-color: #28508b;
}

.bootstrap-switch .form-check-label {
    margin: 0;
    color: var(--text-main);
    font-weight: 600;
    cursor: pointer;
}

.bootstrap-theme-switch {
    background: linear-gradient(180deg, rgba(236, 244, 255, 0.92) 0%, rgba(246, 249, 255, 0.92) 100%);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 18px 16px 28px;
}

/* Header */
.header {
    background: linear-gradient(135deg, #1b3b69 0%, #244a82 58%, #2a5695 100%);
    color: white;
    padding: 22px 24px 18px;
    border-radius: var(--radius-lg);
    margin-bottom: 18px;
    box-shadow: 0 18px 36px rgba(17, 41, 79, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 16px;
}

.header h1 {
    font-size: 2.05em;
    margin: 0;
    letter-spacing: -0.03em;
    line-height: 1;
}

.header-top-right {
    display: flex;
    gap: 12px;
    align-items: center;
}

.header-icon-row {
    display: flex;
    gap: 10px;
    margin-bottom: 0;
}

.today-date {
    font-size: 0.98em;
    font-weight: 600;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.welcome-user {
    font-size: 0.95em;
    font-weight: 600;
    padding: 9px 14px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    color: #ffffff;
    white-space: nowrap;
}

.btn-bankroll {
    background-color: #ffc107;
    color: #333;
    font-weight: 600;
}

.btn-bankroll:hover {
    background-color: #ffb300;
}

.header-bottom {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 18px;
}

.header-stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: stretch;
    flex: 1;
}

.stat-item-action {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.stat-item-action .btn-bankroll {
    margin-bottom: 2px;
}

.header-user-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    align-self: flex-end;
}

.header-icon-btn {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
}

.header-icon-btn:hover {
    background: rgba(255, 255, 255, 0.22);
}

.header-icon-glyph {
    font-size: 1.1rem;
    line-height: 1;
}

.header-icon-dot {
    position: absolute;
    top: 6px;
    right: 7px;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #dc3545;
    border: 2px solid #1f457f;
}

.hidden {
    display: none !important;
}

.stat-item {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 112px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.header-stats .stat-label {
    font-size: 0.76em;
    opacity: 1;
    color: rgba(239, 246, 255, 0.78);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
}

.header-stats .stat-value {
    font-size: 1.55em;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.1;
}

.stat-item-action {
    min-width: auto;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    padding: 6px;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: var(--shadow-soft);
    overflow-x: auto;
}

.nav-tab {
    padding: 9px 15px;
    background: none;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.98em;
    color: var(--text-muted);
    transition: all 0.22s ease;
    white-space: nowrap;
}

.nav-tab:hover {
    color: var(--brand-navy);
    background-color: rgba(40, 80, 139, 0.08);
}

.nav-tab.active {
    color: var(--brand-navy);
    font-weight: 600;
    background: linear-gradient(180deg, #ffffff 0%, #f0f5fc 100%);
    box-shadow: inset 0 0 0 1px rgba(40, 80, 139, 0.14);
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.tab-content h2 {
    color: #1e3c72;
    margin-bottom: 12px;
    font-size: 1.55em;
}

.tab-content h3 {
    color: #2a5298;
    margin-bottom: 10px;
    font-size: 1.12em;
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.overview-block {
    margin-bottom: 14px;
}

.overview-delimited {
    border-top: 2px solid #e3e8f3;
    padding-top: 10px;
    background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
    border-radius: 8px;
    padding-left: 8px;
    padding-right: 8px;
    padding-bottom: 1px;
}

.overview-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.season-insights-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 6px;
}

.season-insights-grid .metric-card {
    padding: 10px;
}

.season-insights-grid .metric-card h3 {
    font-size: 0.74em;
    margin-bottom: 6px;
}

.season-insights-grid .metric-value {
    font-size: 1.25em;
}

.metric-card {
    background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-card);
}

.metric-card h3 {
    font-size: 0.82em;
    color: #666;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-size: 1.65em;
    font-weight: bold;
    color: #1e3c72;
}

/* Sections */
.section {
    background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-card);
    margin-bottom: 12px;
}

/* Consistent section delimiter treatment across tabs */
.tab-content > .section {
    border-top: 2px solid #e3e8f3;
    background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
}

@media (max-width: 1200px) {
    .season-insights-grid {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }
}

@media (max-width: 900px) {
    .overview-two-col {
        grid-template-columns: 1fr;
    }

    .overview-delimited {
        padding-left: 8px;
        padding-right: 8px;
    }
}

/* Today's Games */
.todays-games-summary {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.todays-games-summary p {
    margin: 5px 0;
    font-size: 1.1em;
}

.betting-status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
    margin-left: 10px;
}

.betting-status-badge.can-bet-both {
    background-color: #d4edda;
    color: #155724;
}

.betting-status-badge.can-bet-one {
    background-color: #fff3cd;
    color: #856404;
}

.betting-status-badge.cannot-bet {
    background-color: #f8d7da;
    color: #721c24;
}

.team-selection-note {
    font-size: 0.9em;
    color: #666;
    margin-top: 5px;
    font-style: italic;
}

/* Filters */
.filters {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.bettor-insights-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(240px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.insight-rows {
    margin-top: 8px;
    font-size: 0.9em;
    color: #2d3748;
    line-height: 1.45;
}

.insight-rows strong {
    color: #1e3c72;
}

@media (max-width: 980px) {
    .bettor-insights-grid {
        grid-template-columns: 1fr;
    }

    .season-insights-grid {
        grid-template-columns: 1fr;
    }

    .settings-shell {
        grid-template-columns: 1fr;
    }

    .settings-tabs {
        grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
        display: grid;
    }

    .settings-tab {
        text-align: center;
    }
}

body.dark-mode {
    background:
        radial-gradient(circle at top left, rgba(78, 122, 191, 0.08), transparent 28%),
        linear-gradient(180deg, #0f1723 0%, #121c2b 100%);
    color: #dbe6f4;
}

body.dark-mode .auth-card,
body.dark-mode .metric-card,
body.dark-mode .section,
body.dark-mode .stat-card,
body.dark-mode .ledger-container,
body.dark-mode .settings-section,
body.dark-mode .modal-content,
body.dark-mode .todays-games-summary,
body.dark-mode .series-card,
body.dark-mode .game-card,
body.dark-mode .stats-card,
body.dark-mode .stats-display,
body.dark-mode .h2h-stats-grid,
body.dark-mode .h2h-series-history,
body.dark-mode .ledger-summary,
body.dark-mode .activity-item,
body.dark-mode .notifications-list .notification-item,
body.dark-mode .filters input,
body.dark-mode .filters select,
body.dark-mode .form-group input,
body.dark-mode .form-group select,
body.dark-mode .form-group textarea,
body.dark-mode .settings-tabs,
body.dark-mode .rankings-table,
body.dark-mode .series-market-insights,
body.dark-mode .series-value-range {
    background: #182334;
    color: #dbe6f4;
    border-color: #314055;
}

body.dark-mode .tab-content h2,
body.dark-mode .tab-content h3,
body.dark-mode .stats-card h4,
body.dark-mode .stats-reference-card h3,
body.dark-mode .h2h-series-history h4,
body.dark-mode .series-teams,
body.dark-mode .team-name,
body.dark-mode .team-name-small,
body.dark-mode .market-insights-title,
body.dark-mode .value-range-title,
body.dark-mode .metric-value,
body.dark-mode .stat-value,
body.dark-mode .settings-section h3,
body.dark-mode .auth-card h2,
body.dark-mode .series-performance-matrix tbody th,
body.dark-mode .h2h-stat-cell,
body.dark-mode .notifications-list .notification-title {
    color: #f1f6ff;
}

body.dark-mode .settings-message,
body.dark-mode .stat-label,
body.dark-mode .metric-card h3,
body.dark-mode .series-info,
body.dark-mode .game-count,
body.dark-mode .series-value-range,
body.dark-mode .market-insight-line,
body.dark-mode .insight-rows,
body.dark-mode .transaction-date,
body.dark-mode .empty-state,
body.dark-mode .form-group label,
body.dark-mode .filters span,
body.dark-mode .h2h-stat-label,
body.dark-mode .settings-admin-meta,
body.dark-mode .metric-subtext,
body.dark-mode .auth-message {
    color: #9fb0c8;
}

body.dark-mode .nav-tabs {
    background: rgba(24, 35, 52, 0.9);
    border-color: #314055;
}

body.dark-mode .nav-tab {
    color: #9fb0c8;
}

body.dark-mode .nav-tab:hover {
    color: #f1f6ff;
    background: rgba(78, 122, 191, 0.14);
}

body.dark-mode .nav-tab.active,
body.dark-mode .settings-tab.active {
    background: linear-gradient(180deg, #355f9e 0%, #284c7f 100%);
    color: #ffffff;
}

body.dark-mode .settings-tab {
    color: #b8c8dc;
}

body.dark-mode .settings-tab:hover {
    background: rgba(78, 122, 191, 0.16);
    color: #ffffff;
}

body.dark-mode .ledger-table th,
body.dark-mode .rankings-table thead,
body.dark-mode .ledger-table thead {
    background: #233d65;
}

body.dark-mode .ledger-table td,
body.dark-mode .rankings-table td,
body.dark-mode .splits-table td,
body.dark-mode .splits-table th {
    border-color: #314055;
}

body.dark-mode .ledger-table tbody tr:hover,
body.dark-mode .rankings-table tbody tr:hover,
body.dark-mode .splits-table tr:hover {
    background: #202d41;
}

body.dark-mode .overview-delimited {
    border-top-color: #314055;
    background: linear-gradient(180deg, #182334 0%, #162131 100%);
}

body.dark-mode .season-insights-grid .metric-card h3,
body.dark-mode .metric-card h3,
body.dark-mode .ledger-stat .label {
    color: #aabbd0;
}

body.dark-mode .insight-rows strong,
body.dark-mode .transaction-type {
    color: #f1f6ff;
}

body.dark-mode .stats-season-section h3 {
    color: #f1f6ff;
    border-bottom-color: #4a71ac;
}

body.dark-mode .single-team-board-subtext {
    color: #a9bbd0;
}

body.dark-mode .stat-line {
    border-bottom-color: #314055;
}

body.dark-mode .stat-line.highlight {
    background-color: #314a6d;
    color: #f1f6ff;
}

body.dark-mode .stat-line.highlight .stat-label,
body.dark-mode .stat-line.highlight .stat-value {
    color: #f1f6ff;
}

body.dark-mode .stats-card,
body.dark-mode .stats-reference-card {
    background: linear-gradient(180deg, #182334 0%, #162131 100%);
    border-color: #314055;
    box-shadow: none;
}

body.dark-mode .stats-card h4 {
    color: #f1f6ff;
}

body.dark-mode .stat-value {
    color: #f1f6ff;
}

body.dark-mode .rankings-table tbody tr:nth-child(-n+3) {
    background-color: transparent;
}

body.dark-mode .rankings-table tbody tr:nth-child(-n+3):hover {
    background-color: #202d41;
}

body.dark-mode .series-performance-matrix tbody th {
    background: #202d41;
}

body.dark-mode .ledger-bankroll-row {
    background-color: #2b3950 !important;
}

body.dark-mode .ledger-bankroll-row:hover {
    background-color: #34445e !important;
}

body.dark-mode .ledger-bankroll-row td {
    color: #dbe6f4;
}

body.dark-mode .ledger-bankroll-row strong,
body.dark-mode .ledger-bankroll-row em {
    color: #f1f6ff;
}

body.dark-mode .close {
    color: #b5c6da;
}

body.dark-mode .close:hover {
    color: #ffffff;
}

body.dark-mode .btn-secondary {
    background-color: #54657d;
}

body.dark-mode .btn-secondary:hover {
    background-color: #60748d;
}

body.dark-mode .bootstrap-auth-card {
    border-color: #314055;
    box-shadow: 0 22px 46px rgba(5, 11, 21, 0.42);
}

body.dark-mode .bootstrap-auth-form .form-control,
body.dark-mode .bootstrap-modal-form .form-control,
body.dark-mode .bootstrap-modal-form .form-select,
body.dark-mode .bootstrap-form-row .form-control,
body.dark-mode .bootstrap-form-row .form-select {
    background-color: #1b283b;
    border-color: #35506f;
    color: #e4edf9;
}

body.dark-mode .bootstrap-auth-form .form-control::placeholder,
body.dark-mode .bootstrap-modal-form .form-control::placeholder,
body.dark-mode .bootstrap-form-row .form-control::placeholder {
    color: #8194ad;
}

body.dark-mode .bootstrap-switch {
    background: rgba(24, 35, 52, 0.95);
    border-color: #314055;
}

body.dark-mode .bootstrap-switch .form-check-label {
    color: #f1f6ff;
}

body.dark-mode .bootstrap-switch .form-check-input {
    background-color: #233349;
    border-color: #4a678d;
}

body.dark-mode .bootstrap-switch .form-check-input:checked {
    background-color: #4c79ba;
    border-color: #4c79ba;
}

body.dark-mode #bankrollModal .bankroll-current {
    border-color: #314055;
    box-shadow: none;
}

body.dark-mode .bootstrap-ledger-table {
    --bs-table-color: #dbe6f4;
    --bs-table-hover-color: #f1f6ff;
    --bs-table-hover-bg: rgba(68, 99, 146, 0.18);
}

body.dark-mode .bootstrap-ledger-table > :not(caption) > * > * {
    border-bottom-color: #314055;
}

body.dark-mode .today-date,
body.dark-mode .welcome-user,
body.dark-mode .header-icon-btn {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.16);
}

body.dark-mode .header {
    background: linear-gradient(135deg, #14233a 0%, #19304e 54%, #24456f 100%);
    box-shadow: 0 20px 38px rgba(3, 8, 17, 0.34);
    border-color: rgba(118, 156, 208, 0.1);
}

body.dark-mode .stat-item {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(120, 153, 201, 0.1);
}

body.dark-mode .header-stats .stat-label {
    color: rgba(219, 230, 244, 0.72);
}

body.dark-mode .series-teams,
body.dark-mode .series-score {
    color: #f1f6ff;
}

body.dark-mode .confidence-container {
    background: linear-gradient(180deg, #1b2739 0%, #1a2636 100%);
    border-color: #32455e;
    box-shadow: none;
}

body.dark-mode .confidence-label {
    color: #c2d0e1;
}

.filters input,
.filters select {
    padding: 10px 14px;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    font-size: 0.96em;
    background: rgba(255, 255, 255, 0.94);
    color: var(--text-main);
}

.filters input {
    flex: 1;
    min-width: 200px;
}

.filters select {
    min-width: 180px;
}

.filters span {
    display: flex;
    align-items: center;
    color: #666;
    font-weight: 500;
}

/* Series List */
.series-list {
    display: grid;
    gap: 15px;
}

.series-card {
    background: white;
    padding: 18px;
    border-radius: 16px;
    border-left: 4px solid #1e3c72;
    box-shadow: 0 12px 28px rgba(15, 34, 61, 0.08);
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.series-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 30px rgba(15, 34, 61, 0.12);
}

.series-card.eligible {
    border-left-color: #28a745;
}

.series-card.active {
    border-left-color: #ffc107;
}

.series-card.closed {
    border-left-color: #dc3545;
    opacity: 0.7;
}

.series-header {
    display: block;
    margin-bottom: 12px;
}

.series-teams {
    font-size: 1.38em;
    font-weight: 700;
    color: #1a2840;
    line-height: 1.22;
    letter-spacing: -0.02em;
}

.series-badge {
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 0.72em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    line-height: 1.1;
    white-space: nowrap;
}

.series-badge.eligible {
    background-color: #d4edda;
    color: #155724;
}

.series-badge.active {
    background-color: #fff3cd;
    color: #856404;
}

.series-badge.closed {
    background-color: #f8d7da;
    color: #721c24;
}

.series-badge.completed {
    background-color: #d1ecf1;
    color: #0c5460;
}

/* ==================== BET PLACED + CHASE ACTIVE BADGES ==================== */

/* Allows multiple badges to sit neatly in the series header (right side) */
.series-badges {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* Keep existing .series-badge sizing; these are additional variants */
.series-badge.bet-placed {
    background-color: #f1f5f9;   /* light slate */
    color: #0f172a;              /* deep slate text */
    border: 1px solid #cbd5e1;
}

.series-badge.bet-placed::before {
    content: "🧾 ";
}

/* CHASE ACTIVE: louder + pulsing ring so it pops */
.series-badge.chase-active {
    background-color: #fff1f2;   /* light red/pink */
    color: #7f1d1d;              /* deep red text */
    border: 1px solid #fecaca;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.18);
    animation: chasePulse 1.6s ease-in-out infinite;
}

.series-badge.chase-active::before {
    content: "🚨 ";
}

@keyframes chasePulse {
    0%   { box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.18); }
    50%  { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0.10); }
    100% { box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.18); }
}

.series-market-insights{
  margin: 8px 0 0 0;
  padding: 10px 10px;
  background: #f7f9fc;
  border-left: 3px solid #cbd5e1;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.25;
  color: #334155;
}

.market-insights-title{
  font-weight: 700;
  margin-bottom: 8px;
  color: #0f172a;
}

.series-value-range{
  margin: 0 0 8px 0;
  padding: 8px 10px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}

/* Right-side badge stack in series header */
.series-badges {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* BET PLACED badge */
.series-badge.bet-placed {
  background: #c0392b;           /* strong red */
  color: #fff;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.15);
}

/* CHASE ACTIVE badge (purple) */
.series-badge.chase-active {
  background: #6f42c1;           /* purple */
  color: #fff;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 0 0 3px rgba(111, 66, 193, 0.16);
}

/* Optional: subtle pulse for CHASE ACTIVE */
.series-badge.chase-active {
  animation: chasePulse 1.6s ease-in-out infinite;
}
@keyframes chasePulse {
  0%   { transform: scale(1);   opacity: 1; }
  50%  { transform: scale(1.03); opacity: 0.9; }
  100% { transform: scale(1);   opacity: 1; }
}

.value-range-title{
  font-weight: 700;
  margin-bottom: 6px;
  color: #0f172a;
}

.market-insight-line{
  margin: 3px 0;
}

.series-badge.bet-won {
  background: #1f9d55;
  color: #fff;
  border: 1px solid rgba(0,0,0,0.08);
}

.series-badge.swept {
  background: #6c757d;
  color: #fff;
  border: 1px solid rgba(0,0,0,0.08);
}

.series-badge.both-teams-won {
  background: #0d6efd;
  color: #fff;
  border: 1px solid rgba(0,0,0,0.08);
}

.series-badge.both-one-won {
  background: #fd7e14;
  color: #fff;
  border: 1px solid rgba(0,0,0,0.08);
}

.series-activity-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.series-activity-label-cards {
  margin-bottom: 12px;
}

.series-activity-table td small {
  color: #667;
}

/* Button variants */
.btn-warning {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    color: #000;
    border: none;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3);
}

/* Game count indicator */
.game-count {
    font-size: 0.85em;
    color: #666;
    margin-left: 8px;
}

.series-info {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 14px;
    margin-bottom: 14px;
    color: #607089;
    font-size: 0.92em;
    line-height: 1.45;
}

.series-score {
    font-size: 1.18em;
    font-weight: 700;
    margin: 0 0 14px;
    color: #20314d;
    line-height: 1.25;
}

.series-value-range{
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    background: #f6f7f9;
    font-size: 0.9em;
    color: #333;
}

.series-value-range div{
    display: flex;
    gap: 6px;
    line-height: 1.25;
}

.series-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
    padding-top: 16px;
    align-items: stretch;
}

/* Games List */
.games-list {
    display: grid;
    gap: 15px;
}

.game-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.game-teams {
    font-size: 1.1em;
    font-weight: 600;
}

.game-score {
    display: flex;
    gap: 20px;
    align-items: center;
    margin: 15px 0;
}

.team-score {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.team-name {
    font-weight: 600;
    margin-bottom: 5px;
}

.score-value {
    font-size: 2em;
    font-weight: bold;
    color: #1e3c72;
}

/* Buttons */
.btn {
    padding: 10px 18px;
    border: none;
    border-radius: 10px;
    font-size: 0.97em;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(16, 34, 64, 0.08);
}

.btn-primary {
    background: linear-gradient(180deg, #214983 0%, #1b3d70 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(180deg, #28518e 0%, #214983 100%);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #6f7d92;
    color: white;
}

.btn-secondary:hover {
    background-color: #5f6d82;
    transform: translateY(-1px);
}

.btn-success {
    background-color: #28a745;
    color: white;
}

.btn-success:hover {
    background-color: #218838;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 24, 45, 0.5);
    animation: fadeIn 0.3s;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: linear-gradient(180deg, #ffffff 0%, #fafcff 100%);
    padding: 28px;
    border-radius: 18px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideIn 0.3s;
    border: 1px solid rgba(196, 208, 223, 0.9);
    box-shadow: 0 26px 56px rgba(17, 41, 79, 0.22);
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
}

.close:hover {
    color: #333;
}

.modal h2 {
    margin-bottom: 18px;
    color: var(--brand-navy);
    letter-spacing: -0.02em;
}

.modal-body {
    margin-top: 20px;
}

.notifications-modal-meta {
    margin-bottom: 12px;
    color: #666;
    font-size: 0.9em;
}

.notifications-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.notifications-list .notification-item {
    background: #f8f9fb;
    border: 1px solid #dfe5ee;
    border-left: 4px solid #17a2b8;
    border-radius: 8px;
    padding: 10px 12px;
}

.notifications-list .notification-item.chase-active {
    border-left-color: #ff7b00;
}

.notifications-list .notification-item.chase-deposit {
    border-left-color: #ffc107;
}

.notifications-list .notification-item.read {
    opacity: 0.72;
}

.notifications-list .notification-title {
    font-size: 0.9em;
    font-weight: 700;
    color: #1e3c72;
    margin-bottom: 4px;
}

.notifications-list .notification-message {
    font-size: 0.9em;
    color: #444;
    line-height: 1.4;
}

.notification-item-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.notification-pill {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #2d3748;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.8em;
    font-weight: 600;
    cursor: pointer;
}

.notification-pill:hover {
    background: #f2f5fa;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #49566b;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    font-size: 0.97em;
    font-family: inherit;
    background: #fff;
    color: var(--text-main);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #6a8fc6;
    box-shadow: 0 0 0 4px rgba(40, 80, 139, 0.12);
}

.score-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.calculation-preview {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin: 20px 0;
    border-left: 4px solid #1e3c72;
}

.calculation-preview h4 {
    margin-bottom: 10px;
    color: #1e3c72;
}

.calculation-preview p {
    margin: 5px 0;
}

.series-info-box,
.game-info-box {
    background-color: #e3f2fd;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    border-left: 4px solid #1e3c72;
}

.series-info-box h3,
.game-info-box h3 {
    margin: 0 0 10px 0;
    color: #1e3c72;
    font-size: 1.1em;
}

.series-info-box p,
.game-info-box p {
    margin: 5px 0;
    color: #333;
}

.game-info-highlight {
    background-color: #fff3cd;
    padding: 10px;
    border-radius: 4px;
    margin-top: 10px;
    font-weight: 600;
    color: #856404;
}

.bankroll-current {
    text-align: center;
    padding: 20px;
    background-color: #e3f2fd;
    border-radius: 8px;
    margin-bottom: 20px;
}

.bankroll-current h3 {
    margin: 0 0 10px 0;
    color: #1e3c72;
}

.bankroll-amount {
    font-size: 2.5em;
    font-weight: bold;
    color: #1e3c72;
    margin: 0;
}

#bankrollModal .modal-content {
    border-radius: 22px;
}

#bankrollModal .bankroll-current {
    border: 1px solid rgba(30, 60, 114, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.bankroll-history {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e9ecef;
}

.bankroll-history h3 {
    margin-bottom: 15px;
    color: #1e3c72;
}

.bankroll-transaction {
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 5px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bankroll-transaction.deposit {
    border-left: 3px solid #28a745;
}

.bankroll-transaction.withdrawal {
    border-left: 3px solid #dc3545;
}

.transaction-info {
    flex: 1;
}

.transaction-type {
    font-weight: 600;
    text-transform: capitalize;
}

.transaction-date {
    font-size: 0.9em;
    color: #666;
}

.transaction-amount {
    font-size: 1.2em;
    font-weight: bold;
}

.transaction-amount.deposit {
    color: #28a745;
}

.transaction-amount.withdrawal {
    color: #dc3545;
}

body.dark-mode .bankroll-history {
    border-top-color: #314055;
}

body.dark-mode .bankroll-history h3 {
    color: #f1f6ff;
}

body.dark-mode .bankroll-transaction {
    background-color: #223247;
    border: 1px solid #314055;
}

body.dark-mode .transaction-type {
    color: #f1f6ff;
}

body.dark-mode .transaction-date {
    color: #b8c8dc;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* Activity List */
.activity-list {
    display: grid;
    gap: 8px;
}

.activity-item {
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 5px;
    border-left: 3px solid #1e3c72;
}

.compact-activity-list {
    max-height: 270px;
    overflow-y: auto;
    padding-right: 4px;
}

.activity-item.won {
    border-left-color: #28a745;
}

.activity-item.lost {
    border-left-color: #dc3545;
}

.activity-date {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
}

.activity-details {
    font-weight: 600;
}

.activity-result {
    margin-top: 5px;
    font-size: 0.9em;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #999;
    font-style: italic;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-top {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .header-top-right {
        width: 100%;
        justify-content: space-between;
    }

    .header-bottom {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .header-stats {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .header-user-actions {
        justify-content: space-between;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .series-header {
        margin-bottom: 10px;
    }

    .series-info {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .score-inputs {
        grid-template-columns: 1fr;
    }

    .filters {
        flex-direction: column;
    }

    .filters input {
        width: 100%;
    }

    .series-grid .series-actions {
        flex-wrap: wrap;
    }

    .series-grid .series-actions .btn {
        min-width: 100%;
    }
}

/* Utility Classes */
.text-success {
    color: #28a745;
}

.text-danger {
    color: #dc3545;
}

.text-warning {
    color: #ffc107;
}

.text-muted {
    color: #6c757d;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-20 {
    margin-bottom: 20px;
}

.mt-10 {
    margin-top: 10px;
}

.mt-20 {
    margin-top: 20px;
}

/* Ledger Styles */
.ledger-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ledger-stat {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ledger-stat .label {
    font-size: 0.9em;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ledger-stat .value {
    font-size: 1.5em;
    font-weight: bold;
    color: #1e3c72;
}

.ledger-container {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-card);
    overflow-x: auto;
}

.bootstrap-table-shell {
    overflow: hidden;
}

.ledger-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
}

.ledger-table thead {
    background: linear-gradient(180deg, #20467e 0%, #1a3969 100%);
    color: white;
}

.ledger-table th {
    padding: 13px 10px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
    font-size: 0.87em;
    letter-spacing: 0.02em;
}

.ledger-table td {
    padding: 11px 10px;
    border-bottom: 1px solid #e7edf5;
}

.ledger-table tbody tr:hover {
    background-color: #f8f9fa;
}

.table-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 14px;
    padding: 12px 4px 0;
}

.table-pagination-summary,
.table-pagination-status {
    color: #5f6f86;
    font-size: 0.92rem;
}

.table-pagination-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ledger-table tbody tr:last-child td {
    border-bottom: none;
}

.ledger-table .empty-state {
    text-align: center;
    padding: 40px;
    color: #999;
}

.bootstrap-ledger-table {
    margin-bottom: 0;
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-main);
    --bs-table-striped-color: var(--text-main);
    --bs-table-hover-color: var(--text-main);
    --bs-table-hover-bg: rgba(28, 58, 104, 0.035);
}

.bootstrap-ledger-table > :not(caption) > * > * {
    border-bottom-color: #e7edf5;
}

.bootstrap-ledger-table thead th {
    border-bottom: none;
}

.ledger-bankroll-row {
    background-color: #fff9e6 !important;
    font-weight: 600;
}

.ledger-bankroll-row:hover {
    background-color: #fff3cd !important;
}

.ledger-result {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.85em;
}

.ledger-result.won {
    background-color: #d4edda;
    color: #155724;
}

.ledger-result.lost {
    background-color: #f8d7da;
    color: #721c24;
}

.ledger-result.pending {
    background-color: #fff3cd;
    color: #856404;
}

.ledger-result.abandoned {
    background-color: #d6d8db;
    color: #383d41;
}

/* EARLY PAYOUT badge */
.ledger-result.early_payout {
  background: #e6d6ff;   /* light mauve */
  color: #4b2a7a;        /* darker purple text */
  border: 1px solid #cbb3ff;
}

.ledger-result.voided {
    background-color: #e2e8f0;
    color: #334155;
}

.btn-enter-score {
    padding: 4px 10px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.btn-enter-score:hover {
    background-color: #218838;
}

.btn-enter-score:active {
    background-color: #1e7e34;
}

.ledger-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ledger-icon-btn {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d0d7e2;
    border-radius: 6px;
    background: #ffffff;
    color: #1e3c72;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.ledger-icon-btn:hover {
    background: #eef4ff;
    border-color: #9fb4da;
}

.ledger-icon-btn-cashout {
    color: #0f766e;
    border-color: #9dd7d0;
}

.ledger-icon-btn-cashout:hover {
    background: #e8fbf8;
    border-color: #74c6bc;
}

.ledger-icon-btn-early {
    color: #b42318;
    border-color: #f2b8b5;
}

.ledger-icon-btn-early:hover {
    background: #fff0ef;
    border-color: #ea8e89;
}

.ledger-modal-note {
    margin: 14px 0 0;
    padding: 12px 14px;
    border-radius: 10px;
    background: #f6f8fb;
    color: #44546b;
    font-size: 0.95rem;
}

.ledger-icon-btn-danger {
    color: #b42318;
}

.ledger-icon-btn-danger:hover {
    background: #fff1f0;
    border-color: #f0b3ad;
}

.balance-positive {
    color: #28a745;
    font-weight: 600;
}

.balance-negative {
    color: #dc3545;
    font-weight: 600;
}

@media (max-width: 768px) {
    .ledger-table {
        font-size: 0.85em;
    }
    
    .ledger-table th,
    .ledger-table td {
        padding: 8px 5px;
    }
}
/* ==================== STATS DASHBOARD STYLES (ADD TO END OF styles.css) ==================== */

/* Stats View Selector */
.stats-view-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

.stats-view-selector .btn {
    flex: 1;
}

/* Stats Views */
.stats-view {
    display: none;
}

.stats-view.active {
    display: block;
    animation: fadeIn 0.3s;
}

/* Stats Controls */
.stats-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    align-items: center;
    flex-wrap: wrap;
}

.stats-controls select {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
    min-width: 200px;
}

/* Stats Display Container */
.stats-display {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Stats Season Section */
.stats-season-section {
    margin-bottom: 40px;
}

.stats-season-section h3 {
    color: #1e3c72;
    margin-bottom: 20px;
    font-size: 1.5em;
    padding-bottom: 10px;
    border-bottom: 3px solid #1e3c72;
}

.single-team-board {
    display: grid;
    gap: 18px;
}

.single-team-board-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.single-team-board-header h3 {
    margin: 0;
    padding: 0;
    border: none;
    font-size: 1.8rem;
    letter-spacing: -0.03em;
}

.single-team-board-subtext {
    color: #6c7b92;
    font-size: 0.94rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
    margin-top: 0;
}

.stats-card {
    background: linear-gradient(180deg, #fbfdff 0%, #f5f8fc 100%);
    padding: 20px 20px 18px;
    border-radius: 18px;
    border: 1px solid #dce6f2;
    border-left: 4px solid #1e3c72;
    box-shadow: 0 14px 26px rgba(16, 34, 61, 0.06);
}

.stats-card h4 {
    color: #24467a;
    margin: 0 0 14px 0;
    font-size: 1.08em;
    letter-spacing: -0.01em;
}

.stats-card-overview {
    background: linear-gradient(180deg, #f9fbff 0%, #eef4fb 100%);
}

.stat-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid #e6edf6;
}

.stat-line:last-child {
    border-bottom: none;
}

.stat-line.highlight {
    background-color: #fff3cd;
    margin: 0 -10px;
    padding: 8px 10px;
    border-radius: 4px;
}

.stat-label {
    font-weight: 600;
    color: #6b7b91;
}

.stat-value {
    font-weight: bold;
    color: #1e3c72;
    font-size: 1.18em;
    letter-spacing: -0.01em;
    text-align: right;
}

.stat-line.positive .stat-value {
    color: #28a745;
}

.stat-line.negative .stat-value {
    color: #dc3545;
}

.stats-reference-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
    margin-top: 2px;
}

.stats-reference-card {
    padding: 16px;
    border-radius: 18px;
    border: 1px solid #dce6f2;
    box-shadow: 0 12px 22px rgba(16, 34, 61, 0.05);
}

.stats-reference-card h3 {
    margin: 0 0 12px 0;
    color: #1e3c72;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.stats-reference-card .rankings-table {
    font-size: 0.9rem;
}

.stats-reference-card .rankings-table th,
.stats-reference-card .rankings-table td {
    padding: 8px 10px;
}

.stats-reference-card .rankings-table tbody tr:nth-child(-n+3),
.stats-reference-card .rankings-table tbody tr:nth-child(-n+3):hover {
    background-color: transparent;
}

.game-count-matrix thead th,
.game-count-matrix tbody th,
.game-count-matrix td {
    text-align: center;
}

.game-count-matrix tbody tr,
.game-count-matrix tbody tr:nth-child(-n+3),
.game-count-matrix tbody tr:hover,
.game-count-matrix tbody tr:nth-child(-n+3):hover {
    background-color: transparent !important;
}

.compact-empty-state {
    padding: 20px 12px;
    font-size: 0.92rem;
}

/* Head-to-Head Comparison */
.h2h-comparison {
    max-width: 1000px;
    margin: 0 auto;
}

.h2h-header {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    border-radius: 10px;
}

.h2h-team {
    font-size: 1.5em;
    font-weight: bold;
}

.h2h-matchup-board {
    justify-content: space-between;
    gap: 18px;
    padding: 22px 24px;
    border-radius: 18px;
    box-shadow: 0 16px 28px rgba(22, 43, 76, 0.14);
}

.h2h-team-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.h2h-team-record-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.14);
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1;
}

.h2h-team-subtext {
    color: rgba(239, 246, 255, 0.78);
    font-size: 0.92rem;
    font-weight: 600;
}

.h2h-vs {
    font-size: 2em;
    font-weight: bold;
    opacity: 0.7;
}

.h2h-series-history {
    background: #e3f2fd;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.h2h-series-history h4 {
    margin: 0 0 10px 0;
    color: #1e3c72;
}

.h2h-stats-grid {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.h2h-modern-grid {
    display: grid;
    gap: 18px;
}

.h2h-metric-section {
    background: linear-gradient(180deg, #fbfdff 0%, #f5f8fc 100%);
    border: 1px solid #dce6f2;
    border-radius: 18px;
    padding: 16px 18px;
    box-shadow: 0 12px 22px rgba(15, 33, 60, 0.06);
}

.h2h-metric-section h4 {
    margin: 0 0 12px 0;
    color: #24467a;
    font-size: 1rem;
    letter-spacing: -0.01em;
}

.h2h-metric-board {
    display: grid;
}

.h2h-metric-row {
    display: grid;
    grid-template-columns: 1fr minmax(130px, auto) 1fr;
    gap: 16px;
    align-items: center;
    padding: 12px 0;
    border-top: 1px solid #e6edf6;
}

.h2h-metric-row:first-child {
    border-top: none;
    padding-top: 0;
}

.h2h-metric-row:last-child {
    padding-bottom: 0;
}

.h2h-metric-row.emphasize .h2h-metric-value {
    font-size: 1.5rem;
}

.h2h-metric-label {
    text-align: center;
    color: #7a8ba2;
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.h2h-metric-value {
    font-size: 1.18rem;
    font-weight: 700;
    color: #1f3350;
    text-align: center;
}

.h2h-metric-value.advantage {
    color: #1b7a49;
}

.h2h-stat-row {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
    align-items: center;
}

.h2h-stat-row:last-child {
    border-bottom: none;
}

.h2h-stat-row.highlight {
    background-color: #fff3cd;
}

.h2h-stat-cell {
    font-size: 1.2em;
    font-weight: bold;
    text-align: center;
    color: #1e3c72;
}

.h2h-stat-cell.advantage {
    color: #28a745;
}

.h2h-stat-label {
    font-weight: 600;
    color: #666;
    text-align: center;
}

/* Rankings Table */
.rankings-board,
.standings-board-header {
    margin-bottom: 18px;
}

.rankings-board-header,
.standings-board-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.rankings-board-kicker {
    display: inline-flex;
    align-self: flex-start;
    padding: 4px 10px;
    border-radius: 999px;
    background: #edf4ff;
    color: #2b5590;
    font-size: 0.73rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.rankings-board-header h3,
.standings-board-header h3 {
    margin: 0;
    color: #1e3c72;
    font-size: 1.65rem;
    letter-spacing: -0.02em;
}

.rankings-board-subtext {
    color: #6c7b92;
    font-size: 0.92rem;
}

.rankings-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 16px 28px rgba(16, 34, 61, 0.08);
    border: 1px solid #dde6f2;
}

.rankings-table thead {
    background: linear-gradient(180deg, #1f426f 0%, #1a365d 100%);
    color: white;
}

.rankings-table th {
    padding: 13px 15px;
    text-align: left;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.rankings-table td {
    padding: 13px 15px;
    border-bottom: 1px solid #e8eef6;
    color: #304156;
}

.rankings-table tbody tr:hover {
    background-color: #f6f9fc;
}

.rankings-rank-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    padding: 5px 10px;
    border-radius: 999px;
    background: #edf3fb;
    color: #254777;
    font-weight: 700;
    font-size: 0.84rem;
}

.rankings-team-cell {
    font-weight: 700;
    color: #1c2f4b;
    font-size: 1rem;
}

.rankings-record-cell,
.rankings-swept-cell {
    color: #5c6f87;
    font-weight: 600;
}

.rankings-metric-cell {
    color: #17375e;
    font-weight: 700;
    font-size: 1rem;
}

.series-performance-table th,
.series-performance-table td {
    text-align: center;
}

.series-performance-matrix {
    margin-top: 0;
    font-size: 0.88rem;
    box-shadow: none;
    border: 1px solid #dbe3ef;
}

.series-performance-matrix th,
.series-performance-matrix td {
    padding: 8px 10px;
    line-height: 1.2;
}

.series-performance-matrix thead th {
    padding: 9px 10px;
    font-size: 0.84rem;
    letter-spacing: 0.02em;
}

.series-performance-matrix tbody th {
    text-align: left;
    color: #2a5298;
    font-weight: 600;
    background: #f8f9fa;
    white-space: nowrap;
    width: 90px;
}

.series-performance-table tbody tr:nth-child(-n+3),
.series-performance-table tbody tr:nth-child(-n+3):hover {
    background-color: transparent;
}

.series-performance-matrix tbody td {
    font-variant-numeric: tabular-nums;
}

.series-performance-sweep-cell {
    background: #9fd3aa;
    color: #12492d;
    font-weight: 700;
}

.series-performance-positive-cell {
    background: #dcefe0;
    color: #1c5b38;
    font-weight: 700;
}

.series-performance-warn-cell {
    background: #f6e3a1;
    color: #6a5200;
    font-weight: 700;
}

.series-performance-caution-cell {
    background: #efc28f;
    color: #74420f;
    font-weight: 700;
}

.series-performance-loss-cell {
    background: #efc1c1;
    color: #7a1f1f;
    font-weight: 700;
}

@media (max-width: 980px) {
    .stats-reference-grid {
        grid-template-columns: 1fr;
    }

    .h2h-game-count-wrap {
        grid-template-columns: 1fr;
    }
}

.h2h-series-performance-wrap {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.h2h-game-count-wrap {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 18px;
}

/* Head-to-Head Modal (Large) */
.modal-large .modal-content {
    max-width: 900px;
}

.h2h-modal-content {
    padding: 20px 0;
}

.h2h-team-header {
    text-align: center;
}

.h2h-team-header h3 {
    margin: 0;
    color: white; /* Fixed for visibility on dark background */
}

.team-record {
    font-size: 1.2em;
    color: #666;
    margin-top: 5px;
}

.h2h-vs-large {
    font-size: 3em;
    font-weight: bold;
    color: #ccc;
}

.h2h-matchup-history {
    background: #e3f2fd;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.h2h-matchup-history h4 {
    margin: 0 0 15px 0;
    color: #1e3c72;
}

.matchup-summary {
    display: flex;
    gap: 30px;
    justify-content: center;
}

.matchup-stat {
    text-align: center;
}

.matchup-label {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
}

.matchup-value {
    font-size: 2em;
    font-weight: bold;
    color: #1e3c72;
}

.h2h-comparison-grid {
    display: grid;
    gap: 20px;
}

.comparison-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
}

.comparison-section h4 {
    margin: 0 0 15px 0;
    color: #2a5298;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
}

.comparison-table tr {
    border-bottom: 1px solid #dee2e6;
}

.comparison-table tr:last-child {
    border-bottom: none;
}

.comparison-table td {
    padding: 10px;
    text-align: center;
}

.comparison-table td:first-child,
.comparison-table td:last-child {
    font-weight: bold;
    color: #1e3c72;
    width: 30%;
}

.comparison-table td:nth-child(2) {
    font-weight: 600;
    color: #666;
    width: 40%;
}

.comparison-table td.advantage {
    color: #28a745;
}

/* Loading States */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

/* Responsive Design for Stats */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-controls {
        flex-direction: column;
    }
    
    .stats-controls select {
        width: 100%;
    }
    
    .h2h-header {
        flex-direction: column;
        gap: 10px;
    }

    .h2h-matchup-board {
        padding: 18px;
    }

    .h2h-metric-row {
        grid-template-columns: 1fr;
        gap: 8px;
        text-align: center;
    }
    
    .h2h-stat-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .h2h-stat-label {
        order: -1;
        font-size: 0.9em;
    }
    
    .matchup-summary {
        flex-direction: column;
        gap: 15px;
    }
    
    .stats-view-selector {
        flex-direction: column;
    }
}

/* Utility Classes for Stats */
.positive {
    color: #28a745;
}

.negative {
    color: #dc3545;
}

.neutral {
    color: #6c757d;
}
/* ==================== CONFIDENCE SCORE STYLES (ADD TO styles.css) ==================== */

/* Confidence Badge */
.confidence-badge {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 8px;
    min-width: 60px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-weight: 600;
}

.confidence-badge:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.confidence-badge.confidence-high {
    background-color: #d4edda;
    border: 2px solid #28a745;
    color: #155724;
}

.confidence-badge.confidence-medium {
    background-color: #fff3cd;
    border: 2px solid #ffc107;
    color: #856404;
}

.confidence-badge.confidence-low {
    background-color: #f8d7da;
    border: 2px solid #dc3545;
    color: #721c24;
}

.confidence-score {
    font-size: 1.5em;
    font-weight: bold;
    line-height: 1;
}

.confidence-badge { cursor: pointer; }
.confidence-hint {
  font-size: 11px;
  opacity: 0.75;
  margin-top: 4px;
}

.confidence-rating {
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.confidence-loading {
    color: #999;
    font-style: italic;
}

.confidence-error {
    color: #dc3545;
    font-size: 0.85em;
}

/* Confidence Container on Series Cards */
.confidence-container {
    margin: 14px 0 0;
    padding: 12px 14px;
    background: linear-gradient(180deg, #fbfdff 0%, #f4f8fc 100%);
    border-radius: 14px;
    border: 1px solid #dce6f2;
    border-left: 4px solid #2d5a94;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.confidence-label {
    font-size: 0.94em;
    color: #566982;
    margin-bottom: 10px;
    font-weight: 700;
}

.confidence-comparison {
    display: flex;
    gap: 16px;
    justify-content: space-between;
}

.confidence-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

/* Confidence Modal */
#confidenceModal {
    z-index: 1001;
}

#confidenceModal .modal-content {
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
}

.confidence-modal-header {
    text-align: center;
    padding-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 20px;
}

.confidence-modal-header h2 {
    margin: 0 0 10px 0;
    color: #1e3c72;
}

.confidence-rating-large {
    font-size: 1.5em;
    font-weight: bold;
    padding: 10px 20px;
    border-radius: 8px;
    display: inline-block;
    margin: 10px 0;
}

.confidence-rating-large.confidence-high {
    background-color: #d4edda;
    color: #155724;
}

.confidence-rating-large.confidence-medium {
    background-color: #fff3cd;
    color: #856404;
}

.confidence-rating-large.confidence-low {
    background-color: #f8d7da;
    color: #721c24;
}

/* Confidence Team Info */
.confidence-team-info {
    background-color: #e3f2fd;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.confidence-team-info p {
    margin: 5px 0;
}

/* Breakdown Section */
.confidence-breakdown-section {
    margin-bottom: 25px;
}

.confidence-breakdown-section h3 {
    color: #1e3c72;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.breakdown-grid {
    display: grid;
    gap: 15px;
}

/* Compact layout: 2–3 columns depending on modal width */
.breakdown-grid-compact {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}

/* Tighten component cards a bit */
.breakdown-grid-compact .breakdown-item {
    padding: 12px;
}

.breakdown-grid-compact .breakdown-label {
    margin-bottom: 6px;
    font-size: 0.95em;
}

.breakdown-grid-compact .breakdown-details {
    gap: 6px;
    font-size: 0.85em;
}

.breakdown-item {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    border-left: 4px solid #1e3c72;
}

.breakdown-label {
    font-weight: 600;
    color: #1e3c72;
    margin-bottom: 8px;
    font-size: 1em;
}

.breakdown-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    font-size: 0.9em;
}

.breakdown-value {
    font-weight: bold;
    color: #333;
}

.breakdown-score {
    color: #666;
}

.breakdown-weight {
    color: #666;
    font-style: italic;
}

.breakdown-contribution {
    font-weight: 600;
    color: #28a745;
}

/* Factors Section */
.confidence-factors-section {
    margin-bottom: 25px;
}

body.dark-mode .confidence-modal-header {
    border-bottom-color: #314055;
}

body.dark-mode .confidence-modal-header h2,
body.dark-mode .confidence-breakdown-section h3,
body.dark-mode .confidence-factors-section h3,
body.dark-mode .confidence-final-score h3 {
    color: #f1f6ff;
}

body.dark-mode .confidence-team-info {
    background-color: #223247;
    border: 1px solid #314055;
    color: #dbe6f4;
}

body.dark-mode .confidence-team-info p {
    color: #dbe6f4;
}

body.dark-mode .confidence-team-info strong {
    color: #f1f6ff;
}

body.dark-mode .factors-list li {
    background: #223247;
    border-color: #314055;
    color: #dbe6f4;
}

body.dark-mode .breakdown-item {
    background-color: #223247;
    border-left-color: #4a71ac;
}

body.dark-mode .breakdown-label,
body.dark-mode .breakdown-value {
    color: #f1f6ff;
}

body.dark-mode .breakdown-score,
body.dark-mode .breakdown-weight,
body.dark-mode .final-score-explanation {
    color: #b8c8dc;
}

body.dark-mode .breakdown-contribution {
    color: #7dd3a2;
}

.confidence-factors-section h3 {
    color: #1e3c72;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.factors-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.factors-list li {
    padding: 10px;
    margin-bottom: 8px;
    background-color: #f8f9fa;
    border-radius: 5px;
    border-left: 3px solid #28a745;
}

.factors-list li:before {
    content: "✓ ";
    color: #28a745;
    font-weight: bold;
    margin-right: 6px;
}

/* Final Score Display */
.confidence-final-score {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #e3f2fd 0%, #f8f9fa 100%);
    border-radius: 8px;
    margin-top: 20px;
}

.confidence-final-score h3 {
    margin: 0 0 15px 0;
    color: #1e3c72;
}

.final-score-display {
    font-size: 3em;
    font-weight: bold;
    padding: 20px;
    border-radius: 10px;
    display: inline-block;
    margin: 10px 0;
}

.final-score-display.confidence-high {
    background-color: #d4edda;
    color: #155724;
}

.final-score-display.confidence-medium {
    background-color: #fff3cd;
    color: #856404;
}

.final-score-display.confidence-low {
    background-color: #f8d7da;
    color: #721c24;
}

.final-score-explanation {
    color: #666;
    font-size: 0.9em;
    margin-top: 15px;
    line-height: 1.6;
}

/* Confidence-Ranked Series List */
.series-card.confidence-ranked {
    position: relative;
    padding-left: 60px;
}

.confidence-rank {
    position: absolute;
    left: 15px;
    top: 20px;
    font-size: 2em;
    font-weight: bold;
    color: #1e3c72;
    opacity: 0.3;
}

.series-card.confidence-ranked.confidence-high {
    border-left-width: 6px;
    border-left-color: #28a745;
}

.series-card.confidence-ranked.confidence-medium {
    border-left-width: 6px;
    border-left-color: #ffc107;
}

.series-card.confidence-ranked.confidence-low {
    border-left-width: 6px;
    border-left-color: #dc3545;
}

.best-bet-info {
    font-size: 1.1em;
    margin: 10px 0;
    padding: 10px;
    background-color: #e3f2fd;
    border-radius: 5px;
}

.confidence-factors-preview {
    margin: 10px 0;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 5px;
    font-size: 0.9em;
}

.factor-item {
    margin: 3px 0;
    color: #666;
}

/* Confidence Filter Controls */
.confidence-filter-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.confidence-filter-controls label {
    font-weight: 600;
    color: #333;
}

.confidence-filter-controls input,
.confidence-filter-controls select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.confidence-filter-controls button {
    margin-left: auto;
}

/* Responsive Design */
@media (max-width: 768px) {
    .confidence-comparison {
        flex-direction: column;
        gap: 10px;
    }
    
    .breakdown-details {
        grid-template-columns: 1fr;
    }
    
    .series-card.confidence-ranked {
        padding-left: 20px;
    }
    
    .confidence-rank {
        font-size: 1.5em;
        left: 5px;
        top: 10px;
    }
}

/* Confidence Score Legend */
.confidence-legend {
    display: flex;
    gap: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-badge {
    width: 40px;
    height: 40px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2em;
}

.legend-badge.confidence-high {
    background-color: #d4edda;
    color: #155724;
}

.legend-badge.confidence-medium {
    background-color: #fff3cd;
    color: #856404;
}

.legend-badge.confidence-low {
    background-color: #f8d7da;
    color: #721c24;
}

.legend-text {
    font-size: 0.9em;
    color: #666;
}

.legend-text strong {
    display: block;
    color: #333;
}

/* ==================== NEW FEATURE STYLES ==================== */

/* Metric Card Subtext */
.metric-subtext {
    font-size: 0.85em;
    color: #666;
    margin-top: 8px;
    font-weight: normal;
}

/* Series Grid Layout for Bettor Dashboard */
.series-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
}

.series-grid .series-card {
    margin-bottom: 0;
}

/* Compact series cards for grid */
.series-grid .series-card {
    padding: 18px;
    min-height: 100%;
}

.series-grid .series-header {
    margin-bottom: 12px;
}

.series-badge-row {
    margin-bottom: 14px;
    overflow: hidden;
}

.series-grid .series-teams {
    font-size: 1.28em;
    min-width: 0;
    line-height: 1.24;
}

.series-grid .series-info {
    font-size: 0.9em;
    margin-bottom: 14px;
}

.series-grid .series-actions {
    display: flex;
    gap: 10px;
    flex-wrap: nowrap;
}

.series-grid .series-actions .btn {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    font-size: 0.92em;
    font-weight: 700;
    border-radius: 12px;
    min-height: 44px;
}

.todays-games-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.todays-games-grid .series-card {
    padding: 18px;
}

.todays-games-grid .series-info {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

@media (max-width: 1200px) {
    .todays-games-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .todays-games-grid {
        grid-template-columns: 1fr;
    }

    .todays-games-grid .series-info {
        grid-template-columns: 1fr;
        gap: 6px;
    }
}

/* H2H Button Styling */
.btn-h2h {
    background-color: #17a2b8;
}

.btn-h2h:hover {
    background-color: #138496;
}

/* Responsive grid */
@media (max-width: 1200px) {
    .series-grid {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    }
}

@media (max-width: 768px) {
    .series-grid {
        grid-template-columns: 1fr;
    }
}

/* ==================== GAME TYPE BADGES ==================== */

.game-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.game-type-badge.division {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #28a745;
}

.game-type-badge.league {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
}

.game-type-badge.interleague {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #17a2b8;
}

/* For series header with game type */
.series-grid .series-badges {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: center;
    gap: 4px;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
}

.series-grid .series-badge,
.series-grid .game-type-badge {
    flex: 0 0 auto;
    max-width: 100%;
}

.series-grid .series-badge {
    padding: 3px 7px;
    font-size: 0.66em;
    letter-spacing: 0.02em;
    line-height: 1;
}

.series-grid .game-type-badge {
    padding: 3px 7px;
    font-size: 0.66em;
    letter-spacing: 0.02em;
    line-height: 1;
}

/* ==================== STANDINGS STYLES ==================== */

.standings-league {
    margin-bottom: 50px;
}

.standings-league-title {
    color: #1e3c72;
    font-size: 1.95em;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #244b84;
    text-align: left;
    letter-spacing: -0.03em;
}

.standings-division {
    margin-bottom: 28px;
    padding: 16px;
    border-radius: 18px;
    background: linear-gradient(180deg, #fbfdff 0%, #f5f8fc 100%);
    border: 1px solid #dde6f2;
    box-shadow: 0 14px 26px rgba(16, 34, 61, 0.06);
}

.standings-division-title-row {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.standings-division-title {
    color: #213f6d;
    font-size: 1.28em;
    margin: 0;
    padding: 0;
    background: transparent;
    border-left: none;
    border-radius: 0;
    letter-spacing: -0.02em;
}

.standings-table-wrapper {
    overflow-x: auto;
    margin-bottom: 0;
    box-shadow: none;
    border-radius: 16px;
    border: 1px solid #dbe5f1;
    background: #fff;
}

.standings-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 0.88em;
}

.standings-table thead {
    background: linear-gradient(180deg, #1f426f 0%, #1a365d 100%);
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.standings-table th {
    padding: 11px 8px;
    text-align: center;
    font-weight: 700;
    white-space: nowrap;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.76rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.standings-table th:first-child {
    text-align: left;
    min-width: 150px;
}

.standings-table td {
    padding: 11px 8px;
    text-align: center;
    border-bottom: 1px solid #e8eef6;
    border-right: 1px solid #f5f7fb;
    color: #5b6d84;
}

.standings-table td:first-child {
    text-align: left;
    font-weight: 600;
    color: #1e3c72;
}

.standings-table tbody tr:hover {
    background-color: #f6f9fc;
}

.standings-table .standings-playoff-spot,
.standings-table .standings-playoff-spot:hover {
    background-color: transparent;
}

/* Highlight key columns */
.standings-table td:nth-child(2),
.standings-table td:nth-child(3),
.standings-table td:nth-child(4) {
    font-weight: 600;
}

.standings-team-cell {
    font-weight: 700;
    color: #1c2f4b !important;
}

.standings-core-cell {
    color: #1d3558;
    font-weight: 700 !important;
}

.standings-pct-cell {
    font-size: 0.95rem;
}

.standings-diff-cell {
    color: #365a8c;
    font-weight: 700;
}

body.dark-mode .standings-league-title {
    color: #f1f6ff;
    border-bottom-color: #4a71ac;
}

body.dark-mode .standings-division-title {
    color: #f1f6ff;
}

body.dark-mode .rankings-board-kicker {
    background: rgba(78, 122, 191, 0.14);
    color: #cfe0f8;
}

body.dark-mode .rankings-board-header h3,
body.dark-mode .standings-board-header h3 {
    color: #f1f6ff;
}

body.dark-mode .rankings-board-subtext {
    color: #a9bbd0;
}

body.dark-mode .rankings-table {
    background: #182334;
    border-color: #314055;
    box-shadow: none;
}

body.dark-mode .rankings-rank-chip {
    background: #24354c;
    color: #d7e6fb;
}

body.dark-mode .rankings-team-cell,
body.dark-mode .standings-team-cell {
    color: #f1f6ff !important;
}

body.dark-mode .rankings-record-cell,
body.dark-mode .rankings-swept-cell,
body.dark-mode .standings-table td {
    color: #c0d0e3;
}

body.dark-mode .rankings-metric-cell,
body.dark-mode .standings-core-cell,
body.dark-mode .standings-diff-cell {
    color: #f1f6ff;
}

body.dark-mode .standings-division {
    background: linear-gradient(180deg, #182334 0%, #162131 100%);
    border-color: #314055;
    box-shadow: none;
}

body.dark-mode .standings-table-wrapper {
    background: #182334;
    border: 1px solid #314055;
    box-shadow: none;
}

body.dark-mode .standings-table {
    background: #182334;
    color: #dbe6f4;
}

body.dark-mode .standings-table td {
    color: #dbe6f4;
    border-bottom-color: #314055;
    border-right-color: #223247;
}

body.dark-mode .standings-table td:first-child {
    color: #f1f6ff;
}

body.dark-mode .standings-table tbody tr:hover {
    background-color: #202d41;
}

body.dark-mode .rankings-table tbody tr:hover {
    background-color: #202d41;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .standings-table {
        font-size: 0.75em;
    }
    
    .standings-table th,
    .standings-table td {
        padding: 6px 4px;
    }
    
    .standings-league-title {
        font-size: 1.5em;
    }
    
    .standings-division-title {
        font-size: 1.2em;
    }

    .standings-division-title-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Historical Matchup Section */
.head-to-head-historical {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h3 {
    margin: 0;
    color: #2c3e50;
}

.export-link {
    color: #1f4a8a;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.export-link:hover {
    color: #16396a;
    text-decoration: underline;
}

.btn-refresh {
    background: #3498db;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.btn-refresh:hover {
    background: #2980b9;
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 40px;
    color: #7f8c8d;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Summary Stats */
.historical-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: #7f8c8d;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    display: block;
    font-size: 28px;
    font-weight: bold;
    color: #2c3e50;
}

/* Series Win Rates */
.series-win-rates {
    margin-bottom: 25px;
}

.series-win-rates h4 {
    margin-bottom: 5px;
    color: #2c3e50;
}

.explainer {
    font-size: 13px;
    color: #7f8c8d;
    margin-bottom: 15px;
    font-style: italic;
}

.team-rate-container {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
}

.team-rate-row {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 15px;
    align-items: center;
    margin-bottom: 12px;
}

.team-rate-row:last-child {
    margin-bottom: 0;
}

.team-name {
    font-weight: 600;
    color: #2c3e50;
}

.rate-bar-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rate-bar {
    flex: 1;
    height: 24px;
    background: #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.rate-fill {
    height: 100%;
    border-radius: 12px;
    transition: width 0.5s ease;
    width: 0;
}

.team1-fill {
    background: linear-gradient(90deg, #3498db, #2980b9);
}

.team2-fill {
    background: linear-gradient(90deg, #e74c3c, #c0392b);
}

.rate-value {
    min-width: 50px;
    font-weight: 600;
    color: #2c3e50;
    text-align: right;
}

/* Overall Records */
.overall-records {
    margin-bottom: 25px;
}

.overall-records h4 {
    margin-bottom: 12px;
    color: #2c3e50;
}

.records-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.team-record {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.team-name-small {
    font-weight: 500;
    color: #2c3e50;
}

.record {
    font-weight: 700;
    color: #3498db;
    font-size: 16px;
}

/* Home/Away Splits */
.home-away-splits {
    margin-bottom: 25px;
}

.home-away-splits h4 {
    margin-bottom: 12px;
    color: #2c3e50;
}

.splits-table {
    width: 100%;
    border-collapse: collapse;
    background: #f8f9fa;
    border-radius: 6px;
    overflow: hidden;
}

.splits-table th {
    background: #34495e;
    color: white;
    padding: 10px;
    text-align: left;
    font-weight: 600;
}

.splits-table td {
    padding: 10px;
    border-top: 1px solid #e0e0e0;
    color: #2c3e50;
}

.splits-table tr:hover {
    background: #ecf0f1;
}

/* Recent Games */
.recent-games h4 {
    margin-bottom: 12px;
    color: #2c3e50;
}

#recent-games-list {
    max-height: 200px;
    overflow-y: auto;
}

.recent-game-item {
    background: #f8f9fa;
    padding: 10px 12px;
    margin-bottom: 8px;
    border-radius: 4px;
    border-left: 3px solid #3498db;
    font-size: 13px;
}

.recent-game-date {
    color: #7f8c8d;
    font-size: 11px;
    margin-bottom: 4px;
}

.recent-game-score {
    color: #2c3e50;
}

.winner-badge {
    background: #2ecc71;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    margin-left: 8px;
}

/* Messages */
.no-data-message,
.error-message {
    text-align: center;
    padding: 40px;
    color: #7f8c8d;
    font-style: italic;
}

.error-message {
    color: #e74c3c;
}

/* Historical data in modal */
.h2h-historical-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin: 20px 0;
}

.h2h-historical-section h4 {
    margin-top: 0;
    margin-bottom: 12px;
    color: #2c3e50;
}

.historical-modal-stats {
    font-size: 14px;
}

.hist-summary {
    display: flex;
    justify-content: space-around;
    margin-bottom: 15px;
    padding: 10px;
    background: white;
    border-radius: 4px;
}

.hist-series-rates {
    margin: 15px 0;
}

.hist-rate-row {
    display: grid;
    grid-template-columns: 150px 1fr 60px;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.hist-team-name {
    font-weight: 600;
    color: #2c3e50;
    font-size: 13px;
}

.hist-bar-container {
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
}

.hist-bar {
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease;
}

.hist-pct {
    font-weight: 600;
    color: #2c3e50;
    text-align: right;
}

.hist-records {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
    padding: 10px;
    background: white;
    border-radius: 4px;
    font-size: 13px;
}

.loading-small, .error-small, .no-data {
    text-align: center;
    color: #7f8c8d;
    font-style: italic;
    padding: 10px;
    font-size: 13px;
}

.error-small {
    color: #e74c3c;
}

.data-entry-calendar {
  margin-top: 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 10px;
}

.calendar-month-label {
  font-weight: 700;
  font-size: 1.05rem;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 6px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.calendar-cell {
  border: 1px solid #eef2f7;
  border-radius: 8px;
  padding: 8px;
  min-height: 86px;
  cursor: pointer;
  background: #fafafa;
}

.calendar-cell.empty {
  border: none;
  background: transparent;
  cursor: default;
}

.calendar-cell.today {
  outline: 2px solid #1e3c72;
  background: #f0f6ff;
}

.calendar-day-num {
  font-weight: 800;
  margin-bottom: 6px;
}

.calendar-metrics {
  font-size: 0.82rem;
  line-height: 1.25rem;
}

.calendar-metrics.muted {
  color: #9ca3af;
}

.calendar-metrics .metric.won { color: #15803d; }
.calendar-metrics .metric.lost { color: #b91c1c; }

.calendar-metrics .metric.scores a {
  color: #1e3c72;
  text-decoration: underline;
  font-weight: 600;
}

.calendar-options {
  margin-top: 8px;
  margin-bottom: 8px;
  color: #374151;
  font-size: 0.9rem;
}

body.dark-mode .data-entry-calendar {
  background: #182334;
  border-color: #314055;
  box-shadow: none;
}

body.dark-mode .calendar-header,
body.dark-mode .calendar-month-label {
  color: #f1f6ff;
}

body.dark-mode .calendar-weekdays {
  color: #c8d6ea;
}

body.dark-mode .calendar-cell {
  background: #202d41;
  border-color: #314055;
}

body.dark-mode .calendar-cell.empty {
  background: transparent;
}

body.dark-mode .calendar-cell.today {
  background: #263a5a;
  outline-color: #4a71ac;
}

body.dark-mode .calendar-day-num {
  color: #f1f6ff;
}

body.dark-mode .calendar-metrics {
  color: #dbe6f4;
}

body.dark-mode .calendar-metrics.muted {
  color: #9fb2ca;
}

body.dark-mode .calendar-metrics .metric.profit,
body.dark-mode .calendar-metrics .metric.scores {
  color: #dbe6f4;
}

body.dark-mode .calendar-metrics .metric.won {
  color: #7dd3a2;
}

body.dark-mode .calendar-metrics .metric.lost {
  color: #f09a9a;
}

body.dark-mode .calendar-metrics .metric.scores a {
  color: #9fc0ff;
}

body.dark-mode .calendar-options {
  color: #c8d6ea;
}

body.dark-mode .series-info-box,
body.dark-mode .game-info-box,
body.dark-mode .bankroll-current,
body.dark-mode .h2h-matchup-history,
body.dark-mode .comparison-section,
body.dark-mode .historical-summary .stat-card,
body.dark-mode .team-rate-container {
  background: #223247;
  color: #dbe6f4;
  border-color: #314055;
}

body.dark-mode .series-info-box h3,
body.dark-mode .game-info-box h3,
body.dark-mode .calculation-preview h4,
body.dark-mode .h2h-matchup-history h4,
body.dark-mode .comparison-section h4,
body.dark-mode .matchup-value,
body.dark-mode .comparison-table td:first-child,
body.dark-mode .comparison-table td:last-child {
  color: #f1f6ff;
}

body.dark-mode .series-info-box p,
body.dark-mode .game-info-box p,
body.dark-mode .bankroll-current h3,
body.dark-mode .team-record,
body.dark-mode .matchup-label,
body.dark-mode .comparison-table td:nth-child(2),
body.dark-mode .small-muted {
  color: #b8c8dc;
}

body.dark-mode .game-info-highlight {
  background: #3e3420;
  color: #f6d98b;
}

body.dark-mode .calculation-preview {
  background: #223247;
  border-left-color: #4a71ac;
}

body.dark-mode .h2h-vs-large {
  color: #c8d6ea;
}

body.dark-mode .comparison-table tr {
  border-bottom-color: #314055;
}

body.dark-mode .comparison-table td.advantage {
  color: #7dd3a2;
}

body.dark-mode .h2h-header {
  background: linear-gradient(180deg, #2b4f88 0%, #244674 100%);
  border: 1px solid #3b5d93;
  border-radius: 14px;
  padding: 20px;
}

body.dark-mode .h2h-team-record-chip {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.12);
}

body.dark-mode .h2h-team-subtext {
  color: rgba(228, 237, 249, 0.76);
}

body.dark-mode .h2h-modern-grid .h2h-metric-section {
  background: linear-gradient(180deg, #182334 0%, #162131 100%);
  border-color: #314055;
  box-shadow: none;
}

body.dark-mode .h2h-modern-grid .h2h-metric-section h4,
body.dark-mode .h2h-metric-value {
  color: #f1f6ff;
}

body.dark-mode .h2h-metric-label {
  color: #9fb0c8;
}

body.dark-mode .h2h-metric-row {
  border-top-color: #314055;
}

body.dark-mode .h2h-metric-value.advantage {
  color: #7dd3a2;
}

/* Bankroll Analysis: header spacing */
#bankroll-analysis > h2 {
    padding-left: 20px;
    margin-top: 6px;
    margin-bottom: 14px;
}

.series-value-range{
  margin: 10px 0 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f3f5f7;
  border: 1px solid rgba(0,0,0,0.06);
  font-size: 0.92em;
}

.series-value-range div{
  display: flex;
  justify-content: space-between;
  gap: 10px;
  line-height: 1.25;
}

.series-value-range strong{
  font-weight: 700;
}

.series-value-range div + div{
  margin-top: 4px;
}

.game-type-badge{
  margin-left: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.h2h-hist-card{
  background:#fff;
  border:1px solid rgba(0,0,0,0.06);
  border-radius:12px;
  padding:14px;
}

.h2h-hist-top{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap:10px;
  margin-bottom:12px;
}

.h2h-hist-stat{
  background:#f6f7f9;
  border:1px solid rgba(0,0,0,0.05);
  border-radius:10px;
  padding:10px;
  text-align:center;
}

.h2h-hist-stat-num{
  font-weight:800;
  font-size:1.05em;
  margin-bottom:2px;
}

.h2h-hist-stat-label{
  opacity:0.75;
  font-size:0.85em;
}

.h2h-hist-bars{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin-bottom:10px;
}

.h2h-hist-bar-row{
  display:grid;
  grid-template-columns: 140px 1fr 60px;
  gap:10px;
  align-items:center;
}

.h2h-hist-team{
  font-weight:700;
  font-size:0.9em;
  opacity:0.9;
}

.h2h-hist-bar-track{
  height:14px;
  background:#e9ecef;
  border-radius:999px;
  overflow:hidden;
}

.h2h-hist-bar-fill{
  height:100%;
  border-radius:999px;
}

.h2h-hist-bar-fill.team1{ background:#2f80ed; }
.h2h-hist-bar-fill.team2{ background:#eb5757; }

.h2h-hist-pct{
  text-align:right;
  font-weight:700;
  font-size:0.9em;
  opacity:0.9;
}

.h2h-hist-records{
  display:flex;
  justify-content:space-between;
  gap:12px;
  font-size:0.9em;
  opacity:0.9;
  border-top:1px solid rgba(0,0,0,0.06);
  padding-top:10px;
}

body.dark-mode .h2h-hist-card{
  background:#223247;
  border-color:#314055;
  color:#dbe6f4;
}

body.dark-mode .h2h-hist-stat{
  background:#26364d;
  border-color:#314055;
  color:#dbe6f4;
}

body.dark-mode .h2h-hist-stat-num,
body.dark-mode .h2h-hist-team,
body.dark-mode .h2h-hist-pct,
body.dark-mode .h2h-hist-records strong{
  color:#f1f6ff;
}

body.dark-mode .h2h-hist-stat-label,
body.dark-mode .h2h-hist-records{
  color:#b8c8dc;
  opacity:1;
}

body.dark-mode .h2h-hist-bar-track{
  background:#314055;
}

body.dark-mode .h2h-hist-records{
  border-top-color:#314055;
}

/* optional: make the badge colors match the vibe you already have */
.game-type-badge.interleague{ background: #e6f7ff; color: #0b6b8f; border: 1px solid #bfe9ff; }
.game-type-badge.league{ background: #fff3cd; color: #7a5a00; border: 1px solid #ffe69c; }
.game-type-badge.division{ background: #e7f6ea; color: #1f6b2b; border: 1px solid #cdeed3; }

/* Risk borders */
/* Risk borders (bold + noticeable) */
.metric-card.risk-green  { border: 4px solid #2ecc71 !important; box-shadow: 0 0 0 2px rgba(46, 204, 113, 0.18) !important; }
.metric-card.risk-yellow { border: 4px solid #f1c40f !important; box-shadow: 0 0 0 2px rgba(241, 196, 15, 0.20) !important; }
.metric-card.risk-red    { border: 4px solid #e74c3c !important; box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.20) !important; }
.metric-card.risk-none   { border: 1px solid #e6e6e6 !important; box-shadow: none !important; }

.team-confidence-chart-wrap {
  height: 240px;
}

#teamConfidenceChart {
  display: block;
  width: 100% !important;
  height: 240px !important;
}

.team-confidence-chart-wrap {
  min-height: 240px;
}

#teamConfidenceChart,
.h2h-hist-apex-chart {
  width: 100%;
}

.h2h-hist-apex-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(220px, 1fr);
  gap: 16px;
  margin-top: 14px;
  margin-bottom: 14px;
  align-items: stretch;
}

.h2h-hist-apex-chart {
  min-height: 220px;
}

.h2h-hist-apex-chart-small {
  min-height: 180px;
}

.h2h-hist-apex-wrap-single {
  grid-template-columns: 1fr;
}

.h2h-hist-apex-wrap-single .h2h-hist-apex-chart {
  min-height: 250px;
}

.apexcharts-tooltip {
  border-radius: 10px !important;
  border: 1px solid #d8e0ec !important;
  box-shadow: 0 10px 24px rgba(16, 42, 84, 0.14) !important;
}

.apexcharts-xaxistooltip,
.apexcharts-yaxistooltip {
  border-radius: 8px !important;
}

.apexcharts-legend-text {
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, sans-serif !important;
}

body.dark-mode .apexcharts-tooltip,
body.dark-mode .apexcharts-xaxistooltip,
body.dark-mode .apexcharts-yaxistooltip {
  background: #223247 !important;
  color: #f1f6ff !important;
  border-color: #314055 !important;
}

body.dark-mode .apexcharts-gridline {
  stroke: #314055 !important;
}

body.dark-mode .apexcharts-text tspan {
  fill: #dbe6f4 !important;
}

@media (max-width: 860px) {
  .h2h-hist-apex-wrap {
    grid-template-columns: 1fr;
  }
}

.filter-or {
  color: #6b7280;
  font-weight: 600;
  align-self: center;
}

.bettor-stats-summary-grid,
.bettor-team-analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.bettor-stats-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.bettor-stats-calendar-nav {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.bettor-stats-calendar .calendar-cell {
  min-height: 110px;
}

.bettor-stats-calendar-cell {
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.bettor-stats-calendar-cell:hover {
  background: #f3f7ff;
  border-color: #c9d8f0;
}

.bettor-stats-day-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.bettor-day-card {
  padding: 18px;
}

.bettor-day-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.bettor-day-series-id {
  font-size: 0.82rem;
  color: #6b7280;
  font-weight: 600;
}

.bettor-day-card h4 {
  margin-bottom: 10px;
  color: #1e3c72;
}

.bettor-day-card-lines {
  display: grid;
  gap: 6px;
  color: #334155;
}

.bettor-team-card {
  padding: 20px;
}

.bettor-team-card h3 {
  margin-bottom: 14px;
}

.bettor-team-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
}

.bettor-team-metrics div,
.bettor-team-submetrics div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.bettor-team-metrics span {
  color: #64748b;
  font-size: 0.88rem;
}

.bettor-team-metrics strong,
.bettor-team-submetrics strong {
  color: #1f2937;
}

.bettor-team-submetrics {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
  display: grid;
  gap: 8px;
  font-size: 0.92rem;
  color: #475569;
}

.series-badge.result-won,
.series-badge.result-early_payout {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.series-badge.result-lost,
.series-badge.result-abandoned {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.series-badge.result-voided {
  background: #e2e8f0;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.mano-a-mano-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.mano-a-mano-competitor {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 14px;
  background:
    radial-gradient(circle at top, rgba(226, 74, 63, 0.12), transparent 46%),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.mano-a-mano-side-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #64748b;
  margin-bottom: 12px;
  font-weight: 700;
}

.mano-a-mano-username {
  font-size: 1.65rem;
  font-weight: 800;
  color: #17325f;
  margin-bottom: 12px;
}

.mano-a-mano-record-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.mano-a-mano-stat-pill {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #d9e5f5;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(255, 255, 255, 0.9);
}

.mano-a-mano-stat-pill span {
  font-size: 0.8rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.mano-a-mano-stat-pill strong {
  font-size: 1.3rem;
  color: #17325f;
}

.mano-a-mano-stat-pill.mano-win {
  box-shadow: inset 0 0 0 1px rgba(22, 163, 74, 0.12);
}

.mano-a-mano-stat-pill.mano-loss {
  box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.12);
}

.mano-a-mano-main-metric {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
}

.mano-a-mano-main-value {
  font-size: 2.25rem;
  line-height: 1;
  font-weight: 900;
  color: #e24a3f;
}

.mano-a-mano-main-label,
.mano-a-mano-subline {
  color: #5f6f86;
}

.mano-a-mano-subline {
  font-size: 0.95rem;
}

.mano-a-mano-prize-card {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(226, 74, 63, 0.22);
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.78), transparent 44%),
    linear-gradient(180deg, #1e3c72 0%, #2d5fb5 42%, #d7f3ff 42%, #effbff 100%);
  padding: 16px 14px 14px;
  box-shadow: 0 20px 42px rgba(26, 63, 120, 0.18);
  text-align: center;
}

.mano-a-mano-prize-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #c12d1e;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 10px;
}

.mano-a-mano-prize-art {
  margin: 0 auto 10px;
  max-width: 100%;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mano-a-mano-prize-image {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  filter: drop-shadow(0 12px 16px rgba(12, 32, 72, 0.18));
}

.mano-a-mano-prize-image-fallback {
  display: none;
  width: 100%;
  padding: 18px;
  border-radius: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.55);
  color: rgba(255, 255, 255, 0.92);
  font-weight: 700;
  background: rgba(16, 37, 74, 0.26);
}

.mano-a-mano-prize-art.image-missing .mano-a-mano-prize-image-fallback {
  display: block;
}

.mano-a-mano-prize-copy {
  margin-top: 4px;
  padding: 12px 14px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.44);
}

.mano-a-mano-prize-name {
  font-size: 1.2rem;
  font-weight: 900;
  color: #17325f;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-shadow: none;
}

.mano-a-mano-prize-deadline {
  margin-top: 6px;
  color: #4b607f;
  font-size: 0.92rem;
}

.mano-a-mano-chart {
  min-height: 320px;
}

.mano-a-mano-leader-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(226, 74, 63, 0.1);
  color: #c12d1e;
  font-weight: 700;
  white-space: nowrap;
}

body.dark-mode .filter-or,
body.dark-mode .bettor-day-series-id,
body.dark-mode .bettor-team-metrics span,
body.dark-mode .bettor-team-submetrics,
body.dark-mode .mano-a-mano-stat-pill span,
body.dark-mode .mano-a-mano-main-label,
body.dark-mode .mano-a-mano-subline,
body.dark-mode .table-pagination-summary,
body.dark-mode .table-pagination-status {
  color: #b8c8dc;
}

body.dark-mode .bettor-stats-calendar-cell:hover {
  background: #263a5a;
  border-color: #4a71ac;
}

body.dark-mode .bettor-day-card h4,
body.dark-mode .bettor-team-card h3,
body.dark-mode .bettor-team-metrics strong,
body.dark-mode .bettor-team-submetrics strong,
body.dark-mode .mano-a-mano-stat-pill strong,
body.dark-mode .mano-a-mano-username,
body.dark-mode .mano-a-mano-day-user {
  color: #f1f6ff;
}

body.dark-mode .bettor-day-card-lines {
  color: #dbe6f4;
}

body.dark-mode .bettor-team-submetrics {
  border-top-color: #314055;
}

body.dark-mode .series-badge.result-won,
body.dark-mode .series-badge.result-early_payout {
  background: #1f5b33;
  color: #dcfce7;
  border-color: #2d7a45;
}

body.dark-mode .series-badge.result-lost,
body.dark-mode .series-badge.result-abandoned {
  background: #6f2525;
  color: #fee2e2;
  border-color: #a63e3e;
}

body.dark-mode .series-badge.result-voided {
  background: #314055;
  color: #dbe6f4;
  border-color: #4a5c75;
}

body.dark-mode .mano-a-mano-competitor {
  background:
    radial-gradient(circle at top, rgba(226, 74, 63, 0.18), transparent 46%),
    linear-gradient(180deg, #1b2b42 0%, #132033 100%);
}

body.dark-mode .mano-a-mano-stat-pill {
  background: rgba(14, 25, 42, 0.72);
  border-color: #314055;
}

body.dark-mode .mano-a-mano-leader-badge {
  background: rgba(226, 74, 63, 0.2);
  color: #ffd5d0;
}

body.dark-mode .mano-a-mano-prize-copy {
  background: rgba(10, 22, 38, 0.72);
  box-shadow: inset 0 0 0 1px rgba(188, 206, 233, 0.16);
}

body.dark-mode .mano-a-mano-prize-name {
  color: #f5f9ff;
}

body.dark-mode .mano-a-mano-prize-deadline {
  color: #d5e2f6;
}

body.dark-mode .mano-a-mano-day-row {
  background: rgba(8, 17, 29, 0.42);
  border-color: #314055;
}

@media (max-width: 768px) {
  .bettor-stats-section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .bettor-team-metrics {
    grid-template-columns: 1fr;
  }

  .mano-a-mano-stage,
  .mano-a-mano-record-row {
    grid-template-columns: 1fr;
  }

  .mano-a-mano-main-metric {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .mano-a-mano-main-value {
    font-size: 2.15rem;
  }

  .mano-a-mano-calendar .calendar-cell {
    min-height: 126px;
  }
}

/* ============================================================
   DESIGN SYSTEM UPGRADE v2 — Applied over existing styles
   - Inter font (loaded via HTML head)
   - Expanded design tokens
   - Sticky header
   - Metric card hover + accent left-border
   - Nav tab pill active state
   - Modernised ledger result badges
   - Standardised filter input heights
   - Text utility upgrades
   ============================================================ */

/* --- Expanded design tokens --- */
:root {
    --font-sans: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;

    /* Accent colours */
    --accent-green: #16a34a;
    --accent-green-bg: #dcfce7;
    --accent-green-border: #86efac;
    --accent-red: #dc2626;
    --accent-red-bg: #fee2e2;
    --accent-red-border: #fca5a5;
    --accent-amber: #d97706;
    --accent-amber-bg: #fef3c7;
    --accent-amber-border: #fcd34d;
    --accent-purple: #7c3aed;
    --accent-purple-bg: #ede9fe;
    --accent-purple-border: #c4b5fd;
    --accent-slate: #475569;
    --accent-slate-bg: #f1f5f9;
    --accent-slate-border: #cbd5e1;

    /* Spacing tokens */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 14px;
    --space-lg: 20px;
    --space-xl: 32px;

    /* Shadow levels */
    --shadow-xs: 0 1px 3px rgba(15, 34, 70, 0.06), 0 1px 2px rgba(15, 34, 70, 0.04);
    --shadow-sm: 0 4px 10px rgba(15, 34, 70, 0.08), 0 1px 4px rgba(15, 34, 70, 0.04);
    --shadow-md: 0 10px 28px rgba(15, 34, 70, 0.10), 0 4px 10px rgba(15, 34, 70, 0.06);

    /* Card border radius */
    --radius-card: 14px;
    --radius-chip: 20px;
}

/* --- Font upgrade --- */
body {
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.01em;
}

/* --- Sticky header --- */
.container > .header {
    position: sticky;
    top: 0;
    z-index: 200;
}

/* --- Metric card polish --- */
.metric-card {
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-sm);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    min-height: 82px;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.metric-card h3 {
    font-size: 0.72em;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.metric-value {
    font-size: 1.85em;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.metric-subtext {
    font-size: 0.8em;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.4;
}

/* Positive / negative accent borders on metric cards */
.metric-value.text-success ~ .metric-card-accent,
.metric-card.accent-positive {
    border-left: 3px solid var(--accent-green);
}

.metric-card.accent-negative {
    border-left: 3px solid var(--accent-red);
}

/* --- Cleaner text utilities --- */
.text-success {
    color: var(--accent-green) !important;
}

.text-danger {
    color: var(--accent-red) !important;
}

.text-warning {
    color: var(--accent-amber) !important;
}

/* --- Nav tab pill active state enhancement --- */
.nav-tab.active {
    background: linear-gradient(180deg, var(--brand-blue) 0%, var(--brand-navy) 100%) !important;
    color: #ffffff !important;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(24, 55, 101, 0.22);
}

.nav-tabs {
    background: #ffffff;
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-xs);
}

/* --- Modernised ledger result badges --- */
.ledger-result {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-chip);
    font-size: 0.76em;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    border: 1px solid transparent;
}

.ledger-result.won {
    background: var(--accent-green-bg);
    color: var(--accent-green);
    border-color: var(--accent-green-border);
}

.ledger-result.lost {
    background: var(--accent-red-bg);
    color: var(--accent-red);
    border-color: var(--accent-red-border);
}

.ledger-result.pending {
    background: var(--accent-amber-bg);
    color: var(--accent-amber);
    border-color: var(--accent-amber-border);
}

.ledger-result.early_payout {
    background: var(--accent-purple-bg);
    color: var(--accent-purple);
    border-color: var(--accent-purple-border);
}

.ledger-result.voided,
.ledger-result.abandoned {
    background: var(--accent-slate-bg);
    color: var(--accent-slate);
    border-color: var(--accent-slate-border);
}

/* --- Dark mode badge overrides --- */
body.dark-mode .ledger-result.won {
    background: rgba(22, 163, 74, 0.18);
    color: #6ee7a3;
    border-color: rgba(22, 163, 74, 0.35);
}

body.dark-mode .ledger-result.lost {
    background: rgba(220, 38, 38, 0.18);
    color: #fca5a5;
    border-color: rgba(220, 38, 38, 0.35);
}

body.dark-mode .ledger-result.pending {
    background: rgba(217, 119, 6, 0.18);
    color: #fcd34d;
    border-color: rgba(217, 119, 6, 0.35);
}

body.dark-mode .ledger-result.early_payout {
    background: rgba(124, 58, 237, 0.18);
    color: #c4b5fd;
    border-color: rgba(124, 58, 237, 0.35);
}

body.dark-mode .ledger-result.voided,
body.dark-mode .ledger-result.abandoned {
    background: rgba(71, 85, 105, 0.22);
    color: #94a3b8;
    border-color: rgba(71, 85, 105, 0.35);
}

/* --- Standardised filter input heights --- */
.filters input,
.filters select {
    height: 40px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 0.92em;
    border: 1.5px solid var(--border-soft);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.filters input:focus,
.filters select:focus {
    outline: none;
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 3px rgba(40, 80, 139, 0.10);
}

/* --- Ledger table zebra striping --- */
.ledger-table tbody tr:nth-child(even),
.bootstrap-ledger-table tbody tr:nth-child(even) {
    background-color: rgba(241, 245, 249, 0.5);
}

body.dark-mode .ledger-table tbody tr:nth-child(even),
body.dark-mode .bootstrap-ledger-table tbody tr:nth-child(even) {
    background-color: rgba(32, 45, 65, 0.4);
}

/* --- Right-align numeric ledger columns --- */
.ledger-table td:nth-child(n+6),
.ledger-table th:nth-child(n+6) {
    text-align: right;
}

/* --- Section header utility --- */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 12px;
}

/* --- Series Activity summary grid uses same card sizing as metrics-grid --- */
.series-activity-summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

/* --- Tab h2 / h3 typography tightening --- */
.tab-content h2 {
    font-size: 1.45em;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--brand-navy);
}

.tab-content h3 {
    font-size: 1.05em;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: #2a5298;
}

/* --- Bettor Stats summary grid — allow more cards across --- */
.bettor-stats-summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

