/* Dashboard UI - Tradesteady theme (aligned with dashboard.py inline styles) */
.stApp {
    background: linear-gradient(160deg, #0a0e19 0%, #0f1419 35%, #1a1f2e 70%, #0d1117 100%);
    color: #e6edf3;
}

.main {
    background: transparent;
}

.main .block-container {
    padding-top: 1.5rem;
    padding-bottom: 2.5rem;
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
}

.header-title {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, #d4af37 0%, #f0d875 50%, #d4af37 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.5px;
}

.dashboard-section-title {
    font-size: 14px;
    font-weight: 700;
    color: #d4af37;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.25);
}

.metric-container {
    background: linear-gradient(145deg, rgba(26, 48, 9, 0.35) 0%, rgba(15, 28, 6, 0.4) 100%);
    border: 1px solid rgba(212, 175, 55, 0.28);
    border-radius: 14px;
    padding: 18px 16px;
    min-height: 82px;
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.metric-container:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    border-color: rgba(212, 175, 55, 0.45);
}

.metric-label {
    font-size: 10px;
    color: rgba(245, 245, 220, 0.85);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-weight: 600;
}

.metric-value {
    font-size: 22px;
    font-weight: 700;
    color: #d4af37;
}

.info-text {
    text-align: center;
    color: rgba(245, 245, 220, 0.9);
    font-size: 13px;
    padding: 12px 14px;
    background: rgba(26, 48, 9, 0.25);
    border-radius: 10px;
    border: 1px solid rgba(212, 175, 55, 0.18);
}

.timestamp-footer {
    text-align: center;
    color: rgba(212, 175, 55, 0.9);
    font-size: 12px;
    padding: 16px 20px;
    background: rgba(26, 48, 9, 0.2);
    border-radius: 10px;
    border-top: 1px solid rgba(212, 175, 55, 0.2);
}

hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.2), rgba(212, 175, 55, 0.35), transparent);
    margin: 24px 0;
}

.stButton>button {
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.25s ease;
}

.stSelectbox>div>div {
    background: rgba(26, 48, 9, 0.35);
    border: 1px solid rgba(212, 175, 55, 0.35);
    border-radius: 10px;
    color: #f5f5dc;
}

.chart-container {
    background: rgba(26, 48, 9, 0.12);
    border-radius: 14px;
    padding: 20px;
    border: 1px solid rgba(212, 175, 55, 0.2);
}

.iv-rank-high {
    color: #ff6b6b;
}

.iv-rank-medium {
    color: #ffd93d;
}

.iv-rank-low {
    color: #6bcf7f;
}

.stSpinner>div {
    border-color: #d4af37;
}

/* Login form: visible text and placeholder in dark inputs (email/password must be clearly visible) */
.login-page-card input,
.login-page-card .login-input,
#login-email,
#login-password,
[id="login-email"] input,
[id="login-password"] input,
.login-form-box input,
.login-input,
input.login-input,
.Input input,
.dcc.Input input,
input[type="email"],
input[type="password"],
input[type="text"] {
    color: #e6edf3 !important;
    font-size: 16px !important;
    -webkit-text-fill-color: #e6edf3 !important;
    background-color: #0d1117 !important;
}

/* Override browser autofill (yellow/white bg + dark text) so typed text stays visible */
.login-page-card input:-webkit-autofill,
.login-page-card input:-webkit-autofill:hover,
.login-page-card input:-webkit-autofill:focus,
.login-page-card input:-webkit-autofill:active,
#login-email:-webkit-autofill,
#login-password:-webkit-autofill,
input[type="email"]:-webkit-autofill,
input[type="password"]:-webkit-autofill {
    -webkit-text-fill-color: #e6edf3 !important;
    -webkit-box-shadow: 0 0 0 1000px #0d1117 inset !important;
    box-shadow: 0 0 0 1000px #0d1117 inset !important;
    transition: background-color 5000s ease-in-out 0s;
}

#login-email::placeholder,
#login-password::placeholder,
.login-page-card input::placeholder,
.login-input::placeholder,
input.login-input::placeholder,
.Input input::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder,
input[type="text"]::placeholder {
    color: #8b949e !important;
    opacity: 1;
}

#login-email::-webkit-input-placeholder,
#login-password::-webkit-input-placeholder,
.login-input::-webkit-input-placeholder,
input::-webkit-input-placeholder {
    color: #8b949e !important;
}

#login-email::-moz-placeholder,
#login-password::-moz-placeholder,
.login-input::-moz-placeholder,
input::-moz-placeholder {
    color: #8b949e !important;
}

/* Dashboard sidebar: dropdowns and controls - dark background, high-contrast light text */
.Select-control,
.dashboard-sidebar .Select-control,
.Select--single>.Select-control {
    background-color: #0d1117 !important;
    color: #ffffff !important;
    border-color: #30363d !important;
}

.Select-value-label,
.Select-placeholder,
.Select.has-value .Select-value-label,
.Select--single .Select-value-label,
.dashboard-sidebar .Select-value-label,
.Select-control .Select-value span {
    color: #ffffff !important;
    font-weight: 600;
    font-size: 15px !important;
}

.Select-input,
.Select-input>input {
    color: #ffffff !important;
    font-size: 15px !important;
}

.Select-input>input {
    background-color: #0d1117 !important;
    color: #ffffff !important;
}

.Select-menu-outer {
    background-color: #161b22 !important;
    border: 1px solid #30363d !important;
}

.Select-option,
.VirtualizedSelectOption {
    background-color: #161b22 !important;
    color: #e6edf3 !important;
    -webkit-text-fill-color: #e6edf3 !important;
}

.Select-option span,
.VirtualizedSelectOption span,
.Select-menu-outer .Select-option,
.Select-menu-outer .VirtualizedSelectOption {
    color: #e6edf3 !important;
    -webkit-text-fill-color: #e6edf3 !important;
}

.Select-option.is-focused,
.VirtualizedSelectFocusedOption {
    background-color: #21262d !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}

.Select-option.is-selected {
    background-color: rgba(45, 80, 22, 0.7) !important;
    color: #d4af37 !important;
    -webkit-text-fill-color: #d4af37 !important;
}

/* Search input inside dropdown menu - dark theme */
.Select-menu-outer .Select-input>input,
.Select-menu-outer input {
    background-color: #0d1117 !important;
    color: #e6edf3 !important;
    -webkit-text-fill-color: #e6edf3 !important;
}

/* Radio and checklist - visible labels */
.dash-radio-items,
.dash-checklist {
    color: #ffffff !important;
}

.dash-radio-items label,
.dash-checklist label,
.dashboard-sidebar label {
    color: #ffffff !important;
    font-weight: 600;
    font-size: 14px;
}

/* ========== Tradesteady header (top of page, always visible) ========== */
.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background: linear-gradient(135deg, #1a3009 0%, #2d5016 50%, #1a3009 100%);
    border-bottom: 3px solid #d4af37;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
    flex-wrap: wrap;
    gap: 12px;
    position: relative;
    z-index: 100;
}

.dashboard-header-logo {
    height: 48px;
    width: auto;
    object-fit: contain;
    margin-right: 16px;
    vertical-align: middle;
}

.dashboard-header a {
    text-decoration: none;
    transition: color 0.2s ease, opacity 0.2s ease;
}

.dashboard-header a:hover {
    color: #d4af37 !important;
    opacity: 0.95;
}

/* Main app background (Dash wraps content in #react-entry-point + divs) */
#react-entry-point,
#layout-wrap,
._dash-app-content,
._dash-app-content>div {
    background: linear-gradient(160deg, #0a0e19 0%, #0f1419 35%, #1a1f2e 70%, #0d1117 100%) !important;
    color: #e6edf3;
    min-height: 100vh;
}

/* Content wrapper: padding and max-width for desktop */
.dashboard-content-wrap {
    padding: 20px 24px 32px;
    max-width: 1640px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.dashboard-tagline {
    text-align: center;
    color: #d4af37;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.6px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.15);
}

/* Horizontal controls bar: more space for charts, better spacing and width */
.dashboard-controls-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px 28px;
    padding: 18px 24px;
    margin-bottom: 24px;
    background: linear-gradient(180deg, #161b22 0%, #0d1117 100%);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.control-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    min-height: 44px;
    justify-content: flex-end;
}

.control-label {
    color: #e6edf3 !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    white-space: nowrap;
}

.control-dropdown {
    min-width: 100px;
    width: 100px !important;
}

.control-dropdown .Select-control {
    width: 100% !important;
    min-width: 0 !important;
}

/* Expiry dropdown: wide enough for e.g. BTC_20260212 */
.control-dropdown-expiry,
.control-group-expiry .control-dropdown {
    min-width: 200px !important;
    width: 200px !important;
}

.control-radio {
    display: flex !important;
    flex-direction: row !important;
    gap: 14px !important;
}

.control-radio label {
    margin-bottom: 0 !important;
}

.control-divider {
    width: 1px;
    min-width: 1px;
    height: 36px;
    background: rgba(212, 175, 55, 0.25);
    align-self: center;
    margin: 0 4px;
}

.control-group-buttons {
    flex-direction: row !important;
    gap: 10px;
    min-height: auto;
}

.control-group-buttons .btn-primary,
.control-group-buttons .btn-secondary {
    padding: 10px 16px !important;
    white-space: nowrap;
}

.dashboard-main {
    width: 100%;
    min-width: 0;
}

.dashboard-main .metrics-row {
    margin-bottom: 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.dashboard-main .dashboard-section-title {
    font-size: 13px;
    font-weight: 700;
    color: #d4af37;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.25);
}

.dashboard-main .dashboard-section-title:not(:first-child) {
    margin-top: 28px;
}

.dashboard-main .chart-container {
    background: rgba(13, 17, 23, 0.9);
    border-radius: 14px;
    padding: 24px;
    border: 1px solid rgba(212, 175, 55, 0.22);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
    margin-bottom: 28px;
}

.dashboard-main .iv-rv-chart {
    margin-bottom: 0;
}

/* IV vs RV — horizontal row, full text visible */
.iv-rv-controls-row {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 24px;
    margin-bottom: 20px;
}

.iv-rv-controls-row .iv-rv-control-group {
    flex-shrink: 0;
}

.iv-rv-controls-row .iv-rv-dropdown.iv-rv-asset {
    min-width: 110px !important;
    width: 110px !important;
}

.iv-rv-controls-row .iv-rv-dropdown.iv-rv-period {
    min-width: 165px !important;
    width: 165px !important;
}

.iv-rv-controls-row .iv-rv-dropdown.iv-rv-range {
    min-width: 130px !important;
    width: 130px !important;
}

.iv-rv-controls-row .control-dropdown .Select-control {
    width: 100% !important;
    min-width: 0 !important;
}

/* Multi-chart grid: 2 columns desktop, 1 column mobile */
.chart-grid-item {
    width: 48%;
    display: inline-block;
    vertical-align: top;
    margin-bottom: 20px;
    padding: 8px;
    box-sizing: border-box;
}

/* Left control panel (sidebar) - kept for any legacy / IV-RV row */
.dashboard-sidebar {
    background: linear-gradient(180deg, #161b22 0%, #0d1117 100%) !important;
    border: 1px solid #30363d !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35) !important;
}

.dashboard-sidebar label {
    color: #e6edf3 !important;
}

/* ========== Mobile & tablet responsive ========== */

/* --- Tablet (≤ 900px): single-column grid, adjust expiry width --- */
@media (max-width: 900px) {

    .control-group-expiry .control-dropdown,
    .control-dropdown-expiry {
        min-width: 180px !important;
        width: 180px !important;
    }

    .chart-grid-item {
        width: 100%;
        display: block;
    }

    .metrics-row .metric-container {
        flex: 1 1 140px;
    }
}

/* --- Mobile (≤ 768px): compact layout, stacked controls --- */
@media (max-width: 768px) {
    .dashboard-content-wrap {
        padding: 12px 10px 24px;
    }

    /* Header: icon + title stacked tighter, actions smaller */
    .dashboard-header {
        padding: 12px 14px;
        gap: 10px;
    }

    .dashboard-header-logo {
        height: 38px !important;
        margin-right: 10px !important;
    }

    .dashboard-header span[style*="26px"] {
        font-size: 20px !important;
    }

    .dashboard-header span[style*="12px"] {
        font-size: 11px !important;
    }

    .dashboard-header a,
    .dashboard-header span[style*="14px"] {
        font-size: 12px !important;
    }

    /* Controls bar: wrap more aggressively */
    .dashboard-controls-bar {
        padding: 12px 14px;
        gap: 10px 14px;
        margin-bottom: 16px;
    }

    .control-group {
        min-height: 48px;
    }

    .control-label {
        font-size: 11px !important;
    }

    .control-dropdown {
        min-width: 90px !important;
        width: 90px !important;
    }

    .control-group-expiry .control-dropdown,
    .control-dropdown-expiry {
        min-width: 150px !important;
        width: 150px !important;
    }

    .control-group-buttons {
        width: 100%;
        flex-direction: row !important;
        flex-wrap: wrap;
    }

    .control-group-buttons .btn-primary,
    .control-group-buttons .btn-secondary {
        flex: 1 1 auto;
        min-height: 44px;
        font-size: 14px;
    }

    /* Charts */
    .dashboard-main .chart-container {
        padding: 14px 12px 20px;
        margin-bottom: 20px;
    }

    .chart-container .js-plotly-plot {
        min-height: 280px;
    }

    /* Metrics: 2-column grid instead of horizontal scroll */
    .metrics-row {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .metrics-row .metric-container {
        min-width: 0;
        flex: unset;
        padding: 12px 10px !important;
        min-height: 68px !important;
    }

    .metrics-row .metric-value {
        font-size: 18px !important;
    }

    /* IV-RV controls */
    .iv-rv-controls-row {
        gap: 12px;
    }

    .iv-rv-controls-row .iv-rv-dropdown.iv-rv-period {
        min-width: 140px !important;
        width: 140px !important;
    }

    /* Tagline smaller */
    .dashboard-tagline {
        font-size: 13px;
        margin-bottom: 10px;
        padding-bottom: 8px;
    }
}

/* --- Small mobile (≤ 480px): fully stacked column layout --- */
@media (max-width: 480px) {
    .dashboard-content-wrap {
        padding: 10px 8px 20px;
        /* Safe area for notched phones */
        padding-left: max(8px, env(safe-area-inset-left));
        padding-right: max(8px, env(safe-area-inset-right));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }

    .dashboard-tagline {
        font-size: 12px;
        margin-bottom: 8px;
    }

    /* Header: logo hidden on very small screens for space */
    .dashboard-header {
        padding: 10px 12px;
        flex-wrap: wrap !important;
        gap: 8px;
    }

    .dashboard-header-logo {
        height: 32px !important;
    }

    /* Controls: fully column stacked */
    .dashboard-controls-bar {
        flex-direction: column;
        align-items: stretch;
        padding: 10px 12px;
        gap: 12px;
    }

    .control-group {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        min-height: 52px;
        gap: 8px;
        width: 100%;
    }

    .control-group .control-label {
        width: 100%;
        margin-bottom: 0;
        font-size: 11px !important;
    }

    .control-dropdown,
    .control-group-expiry .control-dropdown {
        min-width: 0 !important;
        width: 100% !important;
        flex: 1 1 auto;
    }

    .control-radio {
        width: 100%;
        gap: 18px !important;
    }

    .control-divider {
        height: 1px;
        min-height: 1px;
        width: 100%;
        margin: 2px 0;
    }

    .control-group-buttons {
        flex-direction: column !important;
        width: 100%;
    }

    .control-group-buttons .btn-primary,
    .control-group-buttons .btn-secondary {
        width: 100%;
        min-height: 48px;
        font-size: 15px;
        padding: 12px 16px !important;
    }

    /* IV-RV controls */
    .iv-rv-controls-row {
        flex-direction: column;
        gap: 10px;
    }

    .iv-rv-controls-row .iv-rv-control-group {
        width: 100%;
    }

    .iv-rv-controls-row .iv-rv-dropdown {
        min-width: 0 !important;
        width: 100% !important;
    }

    /* Charts: full height on mobile */
    .dashboard-main .chart-container {
        padding: 10px 8px 24px;
        margin-bottom: 16px;
    }

    .chart-container .js-plotly-plot {
        min-height: 260px;
    }

    .chart-container .modebar {
        margin-top: 4px;
    }

    /* Metrics: 2-column compact */
    .metrics-row {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .metrics-row .metric-container {
        padding: 10px 8px !important;
        min-height: 62px !important;
        border-radius: 10px !important;
    }

    .metrics-row .metric-label {
        font-size: 9px !important;
        letter-spacing: 0.8px !important;
    }

    .metrics-row .metric-value {
        font-size: 15px !important;
    }

    /* Dashboard section title smaller */
    .dashboard-section-title,
    .dashboard-main .dashboard-section-title {
        font-size: 11px !important;
        letter-spacing: 1px !important;
        margin-bottom: 10px;
    }
}

/* ========== All selectable fields (sidebar + main): single professional palette ========== */
.Select-control,
.dashboard-sidebar .Select-control,
.Select--single>.Select-control,
._dash-app-content .Select-control {
    background-color: #0d1117 !important;
    color: #ffffff !important;
    border: 1px solid #30363d !important;
    border-radius: 10px !important;
    min-height: 40px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.Select-control:hover,
.Select-control:focus-within {
    border-color: rgba(212, 175, 55, 0.5) !important;
}

.Select-value-label,
.Select-placeholder,
.Select.has-value .Select-value-label,
.Select--single .Select-value-label,
.dashboard-sidebar .Select-value-label,
.Select-control .Select-value span {
    color: #ffffff !important;
    font-weight: 600;
    font-size: 15px !important;
}

.Select-menu-outer {
    background-color: #161b22 !important;
    border: 1px solid #30363d !important;
    border-radius: 10px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
    z-index: 1000;
}

/* When dropdown menu is portaled to body (outside app), ensure dark theme still applies */
body .Select-menu-outer,
body div.Select-menu-outer {
    background-color: #161b22 !important;
    background: #161b22 !important;
    border: 1px solid #30363d !important;
    border-radius: 10px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
    z-index: 99999 !important;
}

body .Select-menu-outer .Select-option,
body .Select-menu-outer .VirtualizedSelectOption,
body .Select-menu-outer div[class*="option"] {
    background-color: #161b22 !important;
    color: #e6edf3 !important;
    -webkit-text-fill-color: #e6edf3 !important;
}

body .Select-menu-outer .Select-input>input,
body .Select-menu-outer input {
    background-color: #0d1117 !important;
    color: #e6edf3 !important;
    border: 1px solid #30363d !important;
}

body .Select-menu-outer .Select-option.is-focused,
body .Select-menu-outer .VirtualizedSelectFocusedOption {
    background-color: #21262d !important;
    color: #ffffff !important;
}

body .Select-menu-outer .Select-option.is-selected {
    background-color: rgba(45, 80, 22, 0.7) !important;
    color: #d4af37 !important;
}

.Select-option,
.VirtualizedSelectOption {
    background-color: #161b22 !important;
    color: #e6edf3 !important;
    -webkit-text-fill-color: #e6edf3 !important;
    padding: 12px 16px !important;
    font-size: 15px !important;
    font-weight: 500;
    min-height: 40px;
    line-height: 1.4;
}

.Select-option span,
.VirtualizedSelectOption span,
.Select-menu-outer .Select-option,
.Select-menu-outer .VirtualizedSelectOption {
    color: #e6edf3 !important;
    -webkit-text-fill-color: #e6edf3 !important;
}

.Select-option.is-focused,
.VirtualizedSelectFocusedOption {
    background-color: #21262d !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}

.Select-option.is-selected {
    background-color: rgba(45, 80, 22, 0.7) !important;
    color: #d4af37 !important;
    -webkit-text-fill-color: #d4af37 !important;
}

/* RadioItems & Checklist in main content and sidebar */
._dash-app-content .dash-radio-items,
._dash-app-content .dash-checklist,
.dashboard-sidebar .dash-radio-items,
.dashboard-sidebar .dash-checklist {
    color: #e6edf3 !important;
}

._dash-app-content .dash-radio-items label,
._dash-app-content .dash-checklist label,
.dashboard-sidebar .dash-radio-items label,
.dashboard-sidebar .dash-checklist label {
    color: #e6edf3 !important;
    font-weight: 600;
    font-size: 14px;
}

/* Chart containers: premium separation and readability */
.chart-container {
    background: rgba(13, 17, 23, 0.9);
    border-radius: 14px;
    padding: 22px;
    border: 1px solid rgba(212, 175, 55, 0.28);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chart-container.main-charts,
.chart-container.iv-rv-chart {
    border-color: rgba(212, 175, 55, 0.22);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}

/* Plotly: prevent modebar and legend overlapping on mobile */
.chart-container .modebar {
    margin-top: 6px;
    margin-bottom: 4px;
}

.chart-container .gtitle {
    margin-bottom: 4px;
}

@media (max-width: 768px) {
    .chart-container {
        padding: 14px 12px 28px;
    }

    .chart-container .modebar {
        margin-top: 8px;
    }

    .chart-container .js-plotly-plot {
        min-height: 320px;
    }
}

@media (max-width: 480px) {
    .chart-container {
        padding: 12px 10px 32px;
    }

    .chart-container .modebar {
        margin-top: 6px;
    }
}

/* Section titles and controls area */
.dashboard-section-title {
    color: #d4af37 !important;
}

/* IV vs RV controls: ensure dropdowns show full labels and are visible */
.iv-rv-controls-row .Select-control {
    min-width: 100%;
}

.iv-rv-controls-row .Select-value-label,
.iv-rv-controls-row .Select-placeholder {
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
}

/* Buttons: primary (Refresh) vs secondary (Show All Charts) */
button.btn-primary,
#refresh-clicks {
    background: linear-gradient(180deg, #238636 0%, #2ea043 100%) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 8px rgba(35, 134, 54, 0.4) !important;
    transition: transform 0.15s ease, box-shadow 0.2s ease !important;
}

button.btn-primary:hover,
#refresh-clicks:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(35, 134, 54, 0.5) !important;
}

button.btn-secondary,
#toggle-all-charts-btn {
    background: transparent !important;
    color: #d4af37 !important;
    border: 1px solid rgba(212, 175, 55, 0.5) !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease !important;
}

button.btn-secondary:hover,
#toggle-all-charts-btn:hover {
    background: rgba(212, 175, 55, 0.12) !important;
    border-color: rgba(212, 175, 55, 0.7) !important;
    color: #f0d875 !important;
}

/* Fallback for any other buttons */
button:not(.btn-primary):not(.btn-secondary),
.Button,
.dash-button {
    background: linear-gradient(145deg, rgba(45, 80, 22, 0.9), rgba(26, 48, 9, 0.9)) !important;
    color: #d4af37 !important;
    border: 1px solid rgba(212, 175, 55, 0.4) !important;
    border-radius: 10px !important;
    font-weight: 600 !important;
}

button:not(.btn-primary):not(.btn-secondary):hover,
.Button:hover {
    border-color: rgba(212, 175, 55, 0.7) !important;
    color: #f0d875 !important;
}

/* ========== Premium: tagline, sidebar sections, checklist, radio ========== */
.dashboard-tagline {
    font-weight: 600;
    letter-spacing: 0.6px;
}

.sidebar-section-label {
    font-size: 10px !important;
    font-weight: 700 !important;
    color: rgba(212, 175, 55, 0.85) !important;
    text-transform: uppercase !important;
    letter-spacing: 1.5px !important;
}

/* Checklist: visible checkbox, gold when checked (premium) */
.dashboard-checklist,
.dashboard-sidebar .dash-checklist {
    display: flex !important;
    align-items: center !important;
}

.dashboard-checklist label,
.dashboard-sidebar .dash-checklist label {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    cursor: pointer !important;
    color: #e6edf3 !important;
    font-weight: 600 !important;
    font-size: 14px !important;
}

.dashboard-checklist input[type="checkbox"],
.dashboard-sidebar .dash-checklist input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    accent-color: #d4af37 !important;
    cursor: pointer !important;
    border: 2px solid rgba(212, 175, 55, 0.5) !important;
    border-radius: 4px !important;
    background-color: #0d1117 !important;
}

.dashboard-checklist input[type="checkbox"]:checked,
.dashboard-sidebar .dash-checklist input[type="checkbox"]:checked {
    background-color: rgba(212, 175, 55, 0.4) !important;
}

/* RadioItems: clear selected state (premium) */
.dashboard-radio-items,
.dashboard-sidebar .dash-radio-items {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
}

.dashboard-radio-items label,
.dashboard-sidebar .dash-radio-items label {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    cursor: pointer !important;
    color: #e6edf3 !important;
    font-weight: 600 !important;
    font-size: 14px !important;
}

.dashboard-radio-items input,
.dashboard-sidebar .dash-radio-items input {
    accent-color: #d4af37 !important;
    cursor: pointer !important;
    width: 18px !important;
    height: 18px !important;
}

/* Metrics row: premium card spacing */
.metrics-row .metric-container {
    min-width: 120px;
    flex: 1 1 140px;
}

.metrics-row .metric-label {
    font-size: 10px !important;
    letter-spacing: 1.2px !important;
    color: #c9d1d9 !important;
}

.metrics-row .metric-value {
    font-size: 22px !important;
    font-weight: 700 !important;
    color: #d4af37 !important;
}

/* ========== Fullscreen chart support ========== */
.chart-fullscreen-wrap {
    position: relative;
}

.chart-fullscreen-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    top: auto;
    z-index: 50;
    background: rgba(13, 17, 23, 0.82) !important;
    color: #d4af37 !important;
    border: 1px solid rgba(212, 175, 55, 0.45) !important;
    border-radius: 6px !important;
    padding: 5px 11px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    backdrop-filter: blur(6px);
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, opacity 0.18s ease !important;
    opacity: 0;
    white-space: nowrap;
}

/* Show button on hover over the chart wrapper */
.chart-fullscreen-wrap:hover .chart-fullscreen-btn {
    opacity: 1;
}

/* Always show button when fullscreen is active */
.chart-fullscreen-btn--active,
:fullscreen .chart-fullscreen-btn {
    opacity: 1 !important;
    background: rgba(212, 175, 55, 0.18) !important;
    border-color: rgba(212, 175, 55, 0.8) !important;
    color: #f0d875 !important;
}

.chart-fullscreen-btn:hover {
    background: rgba(212, 175, 55, 0.14) !important;
    border-color: rgba(212, 175, 55, 0.75) !important;
    color: #f0d875 !important;
    opacity: 1 !important;
}

/* When the wrapper is in fullscreen: fill the screen, dark bg, chart expands */
.chart-fullscreen-wrap:fullscreen,
.chart-fullscreen-wrap:-webkit-full-screen {
    background: #0d1117 !important;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 24px !important;
    box-sizing: border-box;
}

.chart-fullscreen-wrap:fullscreen .js-plotly-plot,
.chart-fullscreen-wrap:-webkit-full-screen .js-plotly-plot {
    flex: 1;
    height: calc(100vh - 80px) !important;
}

/* In fullscreen, button stays visible at bottom-right */
.chart-fullscreen-wrap:fullscreen .chart-fullscreen-btn,
.chart-fullscreen-wrap:-webkit-full-screen .chart-fullscreen-btn {
    bottom: 16px;
    right: 16px;
    opacity: 1 !important;
}

/* Mobile: always show the button (no hover on touch devices) */
@media (hover: none) {
    .chart-fullscreen-btn {
        opacity: 1;
    }
}