@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #16161f;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #2a2a3a;
    --accent-blue: #60a5fa;
    --accent-green: #34d399;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary) !important;
    color: var(--text-primary);
    margin: 0;
    padding: 0;
}

.sidebar {
    background: linear-gradient(180deg, #0a0a12 0%, #14141f 100%);
    min-height: 100vh;
    height: 100vh;
    padding: 1rem;
    position: fixed;
    width: 250px;
    left: 0;
    top: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-status-bottom {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    text-align: center;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0 1rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 1rem;
}

/* FinGNN Logo */
.gnn-logo {
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    color: white;
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.1);
}

.gnn-logo-sm {
    width: 36px;
    height: 36px;
    font-size: 11px;
    border-radius: 8px;
}

.gnn-logo-md {
    width: 48px;
    height: 48px;
    font-size: 14px;
    border-radius: 10px;
}

.gnn-logo-lg {
    width: 64px;
    height: 64px;
    font-size: 18px;
    border-radius: 12px;
}

.sidebar-brand-logo {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #3b82f6, #10b981);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-brand-text {
    color: #f1f5f9;
    font-weight: 600;
    font-size: 0.9375rem;
}

.sidebar-brand-text-only {
    color: #f1f5f9;
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Umbrella brand for multi-project site */
.umbrella-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 0.25rem 0;
}

.umbrella-brand-main {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.5px;
    color: #f1f5f9;
}

.umbrella-brand-domain {
    font-weight: 500;
    color: #64748b;
}

.umbrella-brand-sub {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-top: 2px;
}

.nav-link {
    display: block;
    padding: 0.75rem 1rem;
    color: #cbd5e1 !important;
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 0.25rem;
    transition: all 0.15s ease;
    font-weight: 500;
}

.nav-link:hover {
    background: rgba(255,255,255,0.04);
    color: #f1f5f9 !important;
}

.nav-link.active {
    background: rgba(59,130,246,0.12);
    color: #60a5fa !important;
    border: 1px solid rgba(59,130,246,0.25);
}

/* Project section headers for multi-project sidebar */
.project-section {
    margin-bottom: 0.25rem;
}

.project-section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.25rem;
}

/* Collapsible section toggle */
.project-section-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0;
    cursor: pointer;
    border: none;
    background: none;
    transition: background 0.15s ease;
    border-radius: 6px;
}

.project-section-toggle:hover {
    background: rgba(255,255,255,0.04);
}

.project-section-chevron {
    color: #64748b;
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

/* Rotate chevron when section is open — uses Bootstrap .show on dbc.Collapse */
.project-section:has(.collapse.show) .project-section-chevron {
    transform: rotate(180deg);
}

.project-section .collapse,
.project-section .collapsing {
    transition: height 0.2s ease;
}

.project-badge {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    background: rgba(100, 116, 139, 0.15);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

/* Core Platform — blue #3b82f6 */
.project-badge.quantengine { color: #3b82f6; background: rgba(59, 130, 246, 0.15); border: 1px solid rgba(59, 130, 246, 0.3); font-weight: 600; }
.project-badge.fingnn { color: #3b82f6; background: rgba(59, 130, 246, 0.15); }
.project-badge.finnews { color: #3b82f6; background: rgba(59, 130, 246, 0.15); }

/* Causal Inference — purple #8b5cf6 */
.project-badge.finmech { color: #8b5cf6; background: rgba(139, 92, 246, 0.15); }
.project-badge.causalrl { color: #8b5cf6; background: rgba(139, 92, 246, 0.15); }
.project-badge.finesg { color: #8b5cf6; background: rgba(139, 92, 246, 0.15); }

/* Market Modeling — green #22c55e */
.project-badge.finworld { color: #22c55e; background: rgba(34, 197, 94, 0.15); }
.project-badge.finsim { color: #22c55e; background: rgba(34, 197, 94, 0.15); }
.project-badge.finregime { color: #22c55e; background: rgba(34, 197, 94, 0.15); }
.project-badge.diffaugment { color: #22c55e; background: rgba(34, 197, 94, 0.15); }

/* Robustness & Safety — red #ef4444 */
.project-badge.conformalrl { color: #ef4444; background: rgba(239, 68, 68, 0.15); }
.project-badge.finattack { color: #ef4444; background: rgba(239, 68, 68, 0.15); }

/* Scalable AI — cyan #06b6d4 */
.project-badge.finfoundation { color: #06b6d4; background: rgba(6, 182, 212, 0.15); }
.project-badge.finfed { color: #06b6d4; background: rgba(6, 182, 212, 0.15); }
.project-badge.finmeta { color: #06b6d4; background: rgba(6, 182, 212, 0.15); }
.project-badge.finneuro { color: #06b6d4; background: rgba(6, 182, 212, 0.15); }

/* Theme category headers */
.theme-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.45rem 0.75rem;
    margin-top: 0.6rem;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s;
}
.theme-header:hover { background: rgba(255, 255, 255, 0.04); }
.theme-header-label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
}
.theme-header-chevron {
    font-size: 0.55rem;
    color: #475569;
    transition: transform 0.3s;
}
.theme-group { margin-bottom: 0.15rem; }
.theme-group .project-section { padding-left: 0.5rem; }

/* Theme accent colors */
.theme-header.core .theme-header-label { color: #3b82f6; }
.theme-header.causal .theme-header-label { color: #8b5cf6; }
.theme-header.modeling .theme-header-label { color: #22c55e; }
.theme-header.robustness .theme-header-label { color: #ef4444; }
.theme-header.scalable .theme-header-label { color: #06b6d4; }

/* Inline status badges for project cards */
.status-badge-inline {
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge-inline.status-active {
    color: #10b981;
    background: rgba(16, 185, 129, 0.15);
}

.status-badge-inline.status-research {
    color: #a78bfa;
    background: rgba(167, 139, 250, 0.15);
}

.status-badge-inline.status-new {
    color: #14b8a6;
    background: rgba(20, 184, 166, 0.15);
}

.status-badge-inline.status-coming {
    color: #64748b;
    background: rgba(100, 116, 139, 0.15);
}

.status-badge-inline.status-beta {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.15);
}

.status-badge-inline.status-publication {
    color: #ec4899;
    background: rgba(236, 72, 153, 0.15);
}

/* Compact expandable project cards */
.project-card-compact {
    background: #1e293b;
    border: 1px solid #2a2a3a;
    border-radius: 12px;
    padding: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    height: 140px;
}

.project-card-compact:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    border-color: var(--card-accent, #3b82f6);
    height: auto;
    min-height: 200px;
    z-index: 10;
}

.project-card-compact .card-preview {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
    margin-top: 0;
}

.project-card-compact:hover .card-preview {
    max-height: 200px;
    opacity: 1;
    margin-top: 0.75rem;
}

.project-card-compact .card-stats {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.project-card-compact .stat-item {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
}

.project-card-compact .stat-value {
    font-size: 1rem;
    font-weight: 700;
}

.project-card-compact .stat-label {
    font-size: 0.7rem;
    color: #64748b;
}

.project-card-compact.fingnn { --card-accent: #60a5fa; }
.project-card-compact.finmech { --card-accent: #a78bfa; }
.project-card-compact.finnews { --card-accent: #f59e0b; }
.project-card-compact.conformalrl { --card-accent: #14b8a6; }
.project-card-compact.diffaugment { --card-accent: #f43f5e; }
.project-card-compact.finfed { --card-accent: #22c55e; }  /* forest green */
.project-card-compact.finworld { --card-accent: #6366f1; }  /* indigo */
.project-card-compact.finfoundation { --card-accent: #64748b; }  /* slate */
.project-card-compact.causalrl { --card-accent: #f97316; }  /* orange */
.project-card-compact.finesg { --card-accent: #10b981; }  /* emerald */
.project-card-compact.finneuro { --card-accent: #ec4899; }  /* pink */
.project-card-compact.finattack { --card-accent: #ef4444; }  /* red */
.project-card-compact.finmeta { --card-accent: #06b6d4; }  /* cyan */
.project-card-compact.finsim { --card-accent: #8b5cf6; }  /* violet */
.project-card-compact.finregime { --card-accent: #eab308; }  /* yellow */

.project-card-compact .expand-hint {
    position: absolute;
    bottom: 0.5rem;
    right: 0.75rem;
    font-size: 0.65rem;
    color: #475569;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.project-card-compact:hover .expand-hint {
    opacity: 0;
}

.project-section .nav-link {
    padding-left: 1.25rem;
    font-size: 0.875rem;
}

.section-divider {
    border-color: rgba(255,255,255,0.08);
    margin: 0.75rem 0;
}

.main-content {
    margin-left: 270px;
    padding: 1.5rem 2rem;
    min-height: 100vh;
}

.main-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e1e2e 50%, #2a2a3f 100%);
    padding: 2rem 2.5rem;
    border-radius: 16px;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    width: 100%;
}

.header-content > div:nth-child(2) {
    flex: 1;
}

.header-settings {
    margin-left: auto;
}

.header-settings-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #94a3b8;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.header-settings-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    border-color: rgba(255, 255, 255, 0.3);
}

@media (max-width: 768px) {
    .header-settings {
        display: none;
    }
}

.header-logo {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #3b82f6 0%, #10b981 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-title {
    color: #ffffff;
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
}

.header-subtitle {
    color: #94a3b8;
    font-size: 0.875rem;
    margin: 0.25rem 0 0 0;
}

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    padding: 0.375rem 0.875rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 1rem;
}

.live-dot {
    width: 8px;
    height: 8px;
    background: #34d399;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Page layout classes for Phase 10/12 module pages */
.page-container {
    padding: 1.5rem;
}

.page-header {
    margin-bottom: 1.5rem;
}

.page-header .page-title {
    color: #e2e8f0;
    margin-bottom: 0.5rem;
}

.page-header .page-description {
    color: #94a3b8;
    margin-bottom: 0;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.chart-container {
    background: var(--bg-card, #1e1e2e);
    border: 1px solid var(--border-color, #2a2a3a);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.chart-container h3 {
    color: #e2e8f0;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    text-align: center;
    min-height: 120px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.metric-label {
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.metric-value {
    color: var(--text-primary);
    font-size: 1.625rem;
    font-weight: 700;
}

.metric-delta {
    font-size: 0.875rem;
    font-weight: 600;
}

.metric-delta.positive { color: #34d399; }
.metric-delta.negative { color: #f87171; }

.card {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 12px !important;
    color: var(--text-primary) !important;
}

.card-header {
    background: var(--bg-secondary) !important;
    border-bottom: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    font-weight: 600;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
}

.table {
    color: var(--text-secondary) !important;
}

.table thead th {
    background: var(--bg-secondary) !important;
    color: var(--text-muted) !important;
    border-color: var(--border-color) !important;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.table td {
    border-color: var(--border-color) !important;
    background: var(--bg-card) !important;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-connected {
    background: rgba(16,185,129,0.12);
    color: #34d399;
}

.status-disconnected {
    background: rgba(239,68,68,0.12);
    color: #f87171;
}

/* Dark dropdown styling for news filters */
.dash-dropdown-dark .Select-control {
    background-color: #16161f !important;
    border-color: #2a2a3a !important;
}
.dash-dropdown-dark .Select-menu-outer {
    background-color: #16161f !important;
    border-color: #2a2a3a !important;
}
.dash-dropdown-dark .Select-option {
    background-color: #16161f !important;
    color: #e2e8f0 !important;
}
.dash-dropdown-dark .Select-option:hover {
    background-color: #2a2a3a !important;
}
.dash-dropdown-dark .Select-value-label {
    color: #e2e8f0 !important;
}
.dash-dropdown-dark .Select-placeholder {
    color: #64748b !important;
}

.footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.8125rem;
    border-top: 1px solid var(--border-color);
    margin-top: 3rem;
}

/* Dropdown styling */
.Select-control {
    background: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

.Select-menu-outer {
    background: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

/* Disable Dash default loading overlays - we use skeleton loading instead */
.dash-loading-spinner,
._dash-loading,
._dash-loading-callback {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Loading Skeleton */
@keyframes skeleton-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton {
    background: linear-gradient(90deg, #1e1e2e 25%, #2a2a3a 50%, #1e1e2e 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 4px;
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-card {
    height: 120px;
    border-radius: 8px;
}

.skeleton-chart {
    height: 300px;
    border-radius: 8px;
}

/* Auto-refresh controls */
.header-controls {
    background: rgba(255,255,255,0.03);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.06);
}

.refresh-slider .rc-slider-track {
    background: #3b82f6 !important;
}

.refresh-slider .rc-slider-handle {
    border-color: #3b82f6 !important;
    background: #3b82f6 !important;
}

.refresh-slider .rc-slider-rail {
    background: #2a2a3a !important;
}

.auto-refresh-switch .form-check-input:checked {
    background-color: #3b82f6 !important;
    border-color: #3b82f6 !important;
}

/* Pulse animation for live indicator */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* DataTable styling */
.dash-table-container {
    border-radius: 8px;
    overflow: hidden;
}

.dash-spreadsheet-container .dash-spreadsheet-inner th {
    background: #1e1e2e !important;
}

.dash-filter--case {
    color: #e2e8f0 !important;
}

/* DataTable filter row — Dash 4.0 compatible */
/* Force filter row to display horizontally (fixes vertical stacking) */
.dash-spreadsheet .dash-filter {
    display: table-row !important;
    visibility: visible !important;
}

/* Filter cells — use flex layout so Aa toggle + input sit side by side */
.dash-spreadsheet .dash-filter > th,
.dash-spreadsheet .dash-filter > td,
.dash-spreadsheet .dash-filter .dash-cell {
    display: flex !important;
    align-items: center !important;
    gap: 2px !important;
    background-color: #252532 !important;
    padding: 4px 6px !important;
    border-bottom: 1px solid #3b3b4f !important;
}

/* Filter text input — takes remaining space (exclude Aa toggle via :not) */
.dash-spreadsheet .dash-filter input:not([class*="dash-filter--case"]),
.dash-filter input:not([class*="dash-filter--case"]) {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 40px !important;
    min-height: 26px !important;
    box-sizing: border-box !important;
    background-color: #1e1e2e !important;
    color: #e2e8f0 !important;
    border: 1px solid #3b3b4f !important;
    border-radius: 4px !important;
    padding: 3px 6px !important;
    font-size: 0.8rem !important;
    font-family: inherit !important;
}

/* Case-sensitivity toggle (Aa button) — inactive (case-insensitive) state */
input[class*="dash-filter--case"] {
    flex: 0 0 20px !important;
    width: 20px !important;
    min-width: 20px !important;
    max-width: 20px !important;
    height: 20px !important;
    min-height: 20px !important;
    max-height: 20px !important;
    padding: 0 !important;
    font-size: 0.55rem !important;
    line-height: 20px !important;
    text-align: center !important;
    border: 1px solid #475569 !important;
    border-radius: 2px !important;
    background-color: #1e1e2e !important;
    color: #94a3b8 !important;
    cursor: pointer !important;
    margin: 0 !important;
    display: block !important;
    order: 1 !important;
}

/* Active (case-sensitive) state — highlighted to show it is ON */
input.dash-filter--case--sensitive {
    border-color: #3b82f6 !important;
    background-color: rgba(59, 130, 246, 0.15) !important;
    color: #93c5fd !important;
}

input[class*="dash-filter--case"]:hover {
    border-color: #60a5fa !important;
    background-color: rgba(96, 165, 250, 0.15) !important;
    color: #e2e8f0 !important;
}

.dash-spreadsheet .dash-filter input::placeholder,
.dash-filter input::placeholder {
    color: #94a3b8 !important;
    font-style: italic !important;
    opacity: 1 !important;
}

.dash-spreadsheet .dash-filter input:focus,
.dash-filter input:focus {
    border-color: #60a5fa !important;
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2) !important;
}

/* Prevent Bootstrap from overriding DataTable layout */
.dash-spreadsheet-container table {
    table-layout: fixed !important;
}

.dash-spreadsheet-container .dash-spreadsheet-inner tr {
    display: table-row !important;
}

.dash-spreadsheet-container .dash-spreadsheet-inner td,
.dash-spreadsheet-container .dash-spreadsheet-inner th {
    display: table-cell !important;
}

/* Sortable header — sort icon spacing */
.dash-header.sortable {
    cursor: pointer;
}

.dash-header.sortable:hover {
    background-color: rgba(96, 165, 250, 0.1) !important;
}

/* Add gap between sort arrows and header text */
.dash-spreadsheet .dash-header .sort,
.dash-spreadsheet .column-header--sort,
.dash-header .column-header-sort-icon,
.dash-spreadsheet-inner .dash-header span[class*="sort"] {
    margin-right: 6px !important;
}

/* Also handle sort icon after text */
.dash-spreadsheet .dash-header .sort-icon,
.dash-spreadsheet .dash-header svg {
    margin-left: 6px !important;
}

/* Button group styling */
.btn-group .btn-outline-primary {
    border-color: #3b82f6;
    color: #3b82f6;
}

.btn-group .btn-outline-primary.active,
.btn-group .btn-outline-primary:hover {
    background-color: #3b82f6;
    color: white;
}

/* Export button */
.btn-primary {
    background-color: #3b82f6;
    border-color: #3b82f6;
}

.btn-primary:hover {
    background-color: #2563eb;
    border-color: #2563eb;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 50%, #1e1b4b 100%);
    border-radius: 16px;
    padding: 3rem 2rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%233b82f6' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 50%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: #94a3b8;
    margin-bottom: 1.5rem;
}

.hero-stats {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

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

.hero-stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #60a5fa;
}

.hero-stat-label {
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Feature Cards */
.feature-card {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.9) 100%);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    height: 100%;
    transition: transform 0.2s, border-color 0.2s;
}

.feature-card:hover {
    transform: translateY(-4px);
    border-color: rgba(59, 130, 246, 0.5);
}

.feature-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.feature-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.feature-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #e2e8f0;
    margin: 0;
}

.feature-desc {
    font-size: 0.875rem;
    color: #94a3b8;
    line-height: 1.5;
}

/* Tool Cards Container - Single row on desktop */
.trading-tools-row {
    display: flex;
    flex-direction: row;
    gap: 1rem;
}

@media (max-width: 991px) {
    .trading-tools-row {
        flex-direction: column;
    }
}

.tool-card {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    transition: all 0.2s;
    flex: 1;
}

.tool-card:hover {
    background: rgba(30, 41, 59, 0.7);
    border-color: rgba(59, 130, 246, 0.3);
}

.tool-card .feature-title {
    font-size: 0.95rem;
    margin-bottom: 0;
}

.tool-card .feature-desc {
    font-size: 0.8rem;
}

/* Tech Stack Badges */
.tech-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 20px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: #94a3b8;
    margin: 0.25rem;
}

.tech-badge-icon {
    color: #60a5fa;
}

/* Version History Modal */
.version-tag {
    display: inline-block;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 600;
    font-size: 1rem;
}

.version-item {
    padding: 0.5rem 0;
}

/* Performance Chart Card */
.perf-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 1.5rem;
}

/* Animated gradient border */
@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.gradient-border {
    position: relative;
}

.gradient-border::before {
    content: "";
    position: absolute;
    inset: -2px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6, #f59e0b, #3b82f6);
    background-size: 300% 100%;
    border-radius: 14px;
    z-index: -1;
    animation: gradient-shift 3s ease infinite;
}

/* Live ticker with auto-scroll */
.live-ticker {
    display: flex;
    padding: 0.75rem 1rem;
    background: linear-gradient(90deg, rgba(30, 30, 46, 0.8), rgba(30, 30, 46, 0.4));
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
    border: 1px solid rgba(96, 165, 250, 0.2);
    position: relative;
}

.live-ticker::before,
.live-ticker::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40px;
    z-index: 2;
    pointer-events: none;
}

.live-ticker::before {
    left: 0;
    background: linear-gradient(90deg, rgba(30, 30, 46, 1), transparent);
}

.live-ticker::after {
    right: 0;
    background: linear-gradient(90deg, transparent, rgba(30, 30, 46, 1));
}

.ticker-track {
    display: flex;
    gap: 1.5rem;
    animation: ticker-scroll 25s linear infinite;
    padding-right: 1.5rem;
}

.ticker-track:hover {
    animation-play-state: paused;
}

@keyframes ticker-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.ticker-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.ticker-symbol {
    font-weight: 600;
    color: #e2e8f0;
}

.ticker-price {
    color: #94a3b8;
}

.ticker-change {
    font-size: 0.875rem;
    padding: 2px 6px;
    border-radius: 4px;
}

.ticker-up {
    color: #10b981;
    background: rgba(16, 185, 129, 0.15);
}

.ticker-down {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

@keyframes ticker-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.ticker-live {
    animation: ticker-pulse 1s ease-in-out infinite;
}

/* Layout presets */
.layout-compact .card {
    margin-bottom: 0.5rem !important;
}

.layout-compact h2 {
    font-size: 1.25rem !important;
}

.layout-compact h4 {
    font-size: 1rem !important;
}

.layout-compact .hero-section {
    padding: 1.5rem !important;
}

.layout-analysis .card {
    margin-bottom: 1.5rem !important;
}

.layout-analysis .js-plotly-plot {
    height: 400px !important;
}

.layout-trading .hero-section {
    display: none !important;
}

.layout-trading .live-ticker {
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Theme Toggle */
.theme-toggle {
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background 0.2s;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

body.theme-light {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #1e293b;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --border-color: #e2e8f0;
}

body.theme-light .main-content {
    background: var(--bg-main);
    color: var(--text-primary);
}

body.theme-light .card {
    background: var(--bg-card);
    border-color: var(--border-color);
}

body.theme-light h2, body.theme-light h3, body.theme-light h4 {
    color: var(--text-primary);
}

body.theme-light p, body.theme-light span {
    color: var(--text-primary);
}

/* Light mode DataTable */
body.theme-light .dash-spreadsheet-container .dash-spreadsheet-inner td,
body.theme-light .dash-spreadsheet-container .dash-spreadsheet-inner th {
    background-color: #ffffff !important;
    color: #0f172a !important;
    border-color: #e2e8f0 !important;
}

body.theme-light .dash-spreadsheet-container .dash-spreadsheet-inner th {
    background-color: #f1f5f9 !important;
}

body.theme-light .dash-filter input {
    background-color: #f8fafc !important;
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
}

/* Light mode alerts */
body.theme-light .alert {
    color: #0f172a !important;
}

body.theme-light .alert-info {
    background-color: #e0f2fe !important;
    border-color: #7dd3fc !important;
    color: #0c4a6e !important;
}

body.theme-light .alert-warning {
    background-color: #fef3c7 !important;
    border-color: #fcd34d !important;
    color: #78350f !important;
}

body.theme-light .alert-danger {
    background-color: #fee2e2 !important;
    border-color: #fca5a5 !important;
    color: #7f1d1d !important;
}

/* Light mode feature cards */
body.theme-light .feature-card {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
}

body.theme-light .feature-title {
    color: #0f172a !important;
}

body.theme-light .feature-desc {
    color: #475569 !important;
}

/* Light mode hero and stats */
body.theme-light .hero-stat-value,
body.theme-light .hero-stat-label {
    color: #0f172a !important;
}

body.theme-light .hero-subtitle {
    color: #475569 !important;
}

/* Light mode alerts panel */
body.theme-light .alerts-panel {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
}

body.theme-light .alerts-panel h6 {
    color: #0f172a !important;
}

body.theme-light .alert-item {
    color: #0f172a !important;
}

body.theme-light .alert-item.warning {
    background: rgba(245, 158, 11, 0.15) !important;
}

body.theme-light .alert-item.info {
    background: rgba(59, 130, 246, 0.15) !important;
}

/* Mobile menu button (hidden by default, shown on mobile - top right corner) */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1001;
    background: #1e1e2e;
    border: 1px solid #3b82f6;
    color: #60a5fa;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 1.25rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.mobile-menu-btn:hover {
    background: #2a2a3a;
    border-color: #60a5fa;
}

/* Preferences button */
.preferences-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.75rem 1rem;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #94a3b8;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.preferences-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #e2e8f0;
    border-color: rgba(255, 255, 255, 0.2);
}

/* Preferences panel sections */
.prefs-section {
    padding: 1rem;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

/* Keyboard shortcut styling */
.shortcut-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

kbd {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    font-family: monospace;
    background: #1e1e2e;
    border: 1px solid #3a3a4a;
    border-radius: 4px;
    color: #60a5fa;
}

/* Accessibility focus styles */
:focus-visible {
    outline: 2px solid #60a5fa;
    outline-offset: 2px;
}

.nav-link:focus-visible,
.btn:focus-visible,
button:focus-visible {
    outline: 2px solid #60a5fa;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.2);
}

/* Skip to main content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #3b82f6;
    color: white;
    padding: 0.5rem 1rem;
    z-index: 9999;
    text-decoration: none;
    font-weight: 500;
}

.skip-link:focus {
    top: 0;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus trap for modals */
[role="dialog"]:focus {
    outline: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card {
        border-width: 2px;
    }
    .btn {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}


/* Tablet Responsive (768px - 991px) */
@media (max-width: 991px) and (min-width: 768px) {
    /* Feature cards - 2 per row on tablet */
    .g-3 > .col-4 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    /* Model architecture - 2 per row */
    .perf-card .col-4 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    /* Explore buttons - 2 per row */
    .g-3 > .col-3 {
        flex: 0 0 50%;
        max-width: 50%;
        margin-bottom: 0.5rem;
    }

    /* Backtest metrics - 3 per row */
    .perf-card .col-2 {
        flex: 0 0 33.333%;
        max-width: 33.333%;
        text-align: center;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        transition: left 0.3s ease;
        z-index: 1000;
    }

    .sidebar.open {
        left: 0;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 0.75rem !important;
        padding-top: 4rem !important;  /* Space for menu button */
    }

    .mobile-menu-btn {
        display: block !important;
        position: fixed;
        top: 1rem;
        right: 1rem;  /* Move to top-right */
        left: auto !important;
        z-index: 1001;
    }

    .hero-section {
        padding: 1.5rem !important;
    }

    .hero-stats {
        flex-wrap: wrap;
        justify-content: center;
    }

    .hero-stat {
        width: 50%;
        margin-bottom: 1rem;
        text-align: center;
    }

    .hero-title {
        font-size: 2rem !important;
        text-align: center;
    }

    .hero-subtitle {
        text-align: center;
    }

    /* Feature cards - 2 per row on mobile */
    .g-3 > .col-4 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .feature-card {
        margin-bottom: 1rem;
        padding: 1rem;
    }

    .feature-icon {
        font-size: 1.1rem !important;
        width: 36px;
        height: 36px;
        min-width: 36px;
    }

    .feature-header {
        gap: 0.5rem;
    }

    /* Model architecture - 2 per row */
    .perf-card .col-4 {
        flex: 0 0 50%;
        max-width: 50%;
        margin-bottom: 1rem;
    }

    /* Explore buttons - 2 per row, centered */
    .g-3 > .col-3 {
        flex: 0 0 50%;
        max-width: 50%;
        margin-bottom: 0.5rem;
    }

    .g-3 > .col-3 .btn {
        width: 100%;
    }

    /* Backtest metrics - 2 per row, centered */
    .perf-card .row {
        justify-content: center;
    }

    .perf-card .col-2 {
        flex: 0 0 50%;
        max-width: 50%;
        margin-bottom: 0.75rem;
        text-align: center;
    }

    .live-ticker {
        display: none;
    }

    /* Tech badges - centered and wrapped */
    .tech-badge {
        font-size: 0.75rem;
        padding: 0.4rem 0.75rem;
    }

    /* Header adjustments */
    .header {
        padding: 0.75rem !important;
    }

    .header-settings {
        display: none;
    }

    /* Mobile header */
    .mobile-header {
        display: flex !important;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 60px;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border-color);
        z-index: 998;
        padding: 0 1rem;
        align-items: center;
        justify-content: space-between;
    }

    .content-wrapper {
        margin-top: 70px;
    }

    /* Sidebar overlay */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .sidebar-overlay.active {
        display: block;
    }

    /* Adjust sidebar class name */
    .sidebar.mobile-open {
        left: 0;
    }

    /* Scrollable tables */
    .dash-spreadsheet-container {
        overflow-x: auto;
    }

    /* Smaller chart heights */
    .js-plotly-plot {
        min-height: 250px;
    }

    /* Stack time filters */
    .time-range-filters {
        flex-wrap: wrap;
        gap: 0.375rem;
    }

    .time-filter-btn {
        flex: 1 1 30%;
        min-width: calc(33.333% - 0.5rem);
        text-align: center;
    }
}

@media (max-width: 576px) {
    /* Extra small screens - 1 card per row for features */
    .g-3 > .col-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Model architecture - still 2 per row */
    .perf-card .col-4 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    /* Explore buttons - 1 per row on very small screens */
    .g-3 > .col-3 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .hero-stat {
        width: 50%;
    }

    .sidebar-brand-text {
        display: none;
    }

    h2 {
        font-size: 1.5rem;
    }

    .hero-title {
        font-size: 1.75rem !important;
    }

    /* Trading tools - stack vertically */
    .trading-tools-row {
        flex-direction: column;
    }
}

/* Print Styles for PDF Export */
@media print {
    .sidebar, .header, .live-ticker, .auto-refresh-switch,
    .refresh-slider, .toast-container, .mobile-menu-btn {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }

    body {
        background: white !important;
        color: black !important;
    }

    .card {
        break-inside: avoid;
        border: 1px solid #ccc !important;
        background: white !important;
    }

    .hero-section {
        background: #f0f0f0 !important;
        color: black !important;
    }

    h1, h2, h3, h4, h5, h6 {
        color: black !important;
    }

    .js-plotly-plot {
        break-inside: avoid;
    }

    @page {
        margin: 1cm;
        size: A4 portrait;
    }
}

/* PDF Export Button */
.pdf-export-btn {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.pdf-export-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* Excel Export Button */
.excel-export-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    cursor: pointer;
}

/* Onboarding Tour - Visibility controlled via inline styles */
.tour-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9998;
}

.tour-tooltip {
    position: fixed;
    background: #1e1e2e;
    border: 2px solid #3b82f6;
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 350px;
    z-index: 10001;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.tour-progress {
    display: flex;
    gap: 4px;
    margin-top: 1rem;
}

.tour-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #475569;
}

.tour-dot.active {
    background: #3b82f6;
}

/* Alerts Panel */
.alerts-panel {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    width: 300px;
    max-height: 400px;
    overflow-y: auto;
    background: #1e1e2e;
    border: 1px solid #2a2a3a;
    border-radius: 12px;
    padding: 1rem;
    z-index: 100;
}

.alert-item {
    padding: 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid #ef4444;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.alert-item.warning {
    background: rgba(245, 158, 11, 0.1);
    border-left-color: #f59e0b;
}

.alert-item.info {
    background: rgba(59, 130, 246, 0.1);
    border-left-color: #3b82f6;
}

/* Desktop: hide mobile elements */
@media (min-width: 769px) {
    .mobile-header {
        display: none !important;
    }

    .sidebar-overlay {
        display: none !important;
    }
}

/* ============================================
   TIME RANGE FILTER BUTTONS
   ============================================ */
.time-range-filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.time-filter-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid #2a2a3a;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.15s ease;
}

.time-filter-btn:hover {
    border-color: #3b82f6;
    color: #60a5fa;
}

.time-filter-btn.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: #3b82f6;
    color: #60a5fa;
}

body.theme-light .time-filter-btn {
    border-color: #e2e8f0;
    color: #64748b;
}

body.theme-light .time-filter-btn:hover,
body.theme-light .time-filter-btn.active {
    border-color: #3b82f6;
    color: #3b82f6;
}

/* ============================================
   EXPORT BUTTONS
   ============================================ */
.export-buttons {
    display: inline-flex;
    gap: 0.5rem;
    margin-left: 1rem;
    vertical-align: middle;
}

.export-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 8px;
    border: 1px solid #2a2a3a;
    cursor: pointer;
    transition: all 0.15s ease;
}

.export-btn.csv {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border-color: rgba(34, 197, 94, 0.3);
}

.export-btn.csv:hover {
    background: rgba(34, 197, 94, 0.2);
    border-color: #22c55e;
    transform: translateY(-1px);
}

.export-btn.pdf {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

.export-btn.pdf:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    transform: translateY(-1px);
}

/* ============================================
   HERO METRICS DASHBOARD
   ============================================ */
.hero-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.hero-metric-card {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 12px;
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
}

.hero-metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--metric-accent, #3b82f6);
}

.hero-metric-card.positive { --metric-accent: #22c55e; }
.hero-metric-card.negative { --metric-accent: #ef4444; }
.hero-metric-card.neutral { --metric-accent: #60a5fa; }

.hero-metric-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.hero-metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #f1f5f9;
    line-height: 1.2;
}

.hero-metric-change {
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.hero-metric-change.positive { color: #22c55e; }
.hero-metric-change.negative { color: #ef4444; }

/* Strategy comparison table */
.comparison-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.comparison-table th,
.comparison-table td {
    padding: 0.875rem 1rem;
    text-align: right;
    border-bottom: 1px solid #2a2a3a;
}

.comparison-table th:first-child,
.comparison-table td:first-child {
    text-align: left;
    position: sticky;
    left: 0;
    background: var(--bg-card);
    z-index: 1;
}

.comparison-table th {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.comparison-table tr:hover {
    background: rgba(59, 130, 246, 0.05);
}

.comparison-table .best-value {
    color: #22c55e;
    font-weight: 600;
}

.comparison-table .strategy-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.strategy-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* ============================================
   DRILL-DOWN CHART NAVIGATION
   ============================================ */
.clickable-chart {
    cursor: pointer;
}

.clickable-chart .js-plotly-plot:hover {
    opacity: 0.95;
}

.drill-down-hint {
    font-size: 0.7rem;
    color: #64748b;
    text-align: center;
    margin-top: 0.5rem;
    opacity: 0.7;
}

.drill-down-hint::before {
    content: '👆 ';
}

/* Breadcrumb navigation */
.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.breadcrumb-item {
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.15s ease;
}

.breadcrumb-item:hover {
    color: #60a5fa;
}

.breadcrumb-separator {
    color: #475569;
}

.breadcrumb-current {
    color: #f1f5f9;
    font-weight: 500;
}

/* ============================================
   ENHANCED ONBOARDING TOUR
   ============================================ */
.tour-spotlight {
    position: fixed;
    border-radius: 8px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.75);
    z-index: 9999;
    transition: all 0.3s ease;
    border: 2px solid #60a5fa;
}

.tour-tooltip.visible {
    opacity: 1;
    transform: scale(1);
}

.tour-step-counter {
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 0.5rem;
}

.tour-progress {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1rem;
}

.tour-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #475569;
    transition: all 0.2s ease;
    cursor: pointer;
}

.tour-dot:hover {
    transform: scale(1.2);
}

.tour-dot.active {
    background: #3b82f6;
    width: 10px;
    height: 10px;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
}

.tour-dot.completed {
    background: #22c55e;
}

.tour-btn-group {
    display: flex;
    gap: 0.5rem;
}

@keyframes tour-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); }
}

.tour-highlight-pulse {
    animation: tour-pulse 2s ease-in-out infinite;
}

/* ============================================
   DARK MODE DROPDOWN — COMPREHENSIVE OVERRIDES
   Applies globally to all dcc.Dropdown components
   ============================================ */

/* Dropdown control (the visible box) */
.Select-control {
    background-color: #1e1e2e !important;
    border: 1px solid #3b3b4f !important;
    border-radius: 6px !important;
    color: #e2e8f0 !important;
    min-height: 36px !important;
}

.Select-control:hover {
    border-color: #60a5fa !important;
    box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.25) !important;
}

.Select.is-open > .Select-control {
    border-color: #60a5fa !important;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    background-color: #1e1e2e !important;
}

/* Single-select: the currently selected value label */
.Select-value-label {
    color: #e2e8f0 !important;
}

/* Single-select value container */
.Select--single > .Select-control .Select-value {
    color: #e2e8f0 !important;
    line-height: 34px !important;
}

/* Placeholder text */
.Select-placeholder,
.Select--single > .Select-control .Select-placeholder {
    color: #64748b !important;
    line-height: 34px !important;
}

/* Arrow indicator */
.Select-arrow-zone {
    color: #64748b !important;
}

.Select-arrow {
    border-color: #64748b transparent transparent !important;
}

.Select.is-open .Select-arrow {
    border-color: transparent transparent #60a5fa !important;
}

/* Search input inside the dropdown control */
.Select-input > input {
    background-color: transparent !important;
    color: #e2e8f0 !important;
    caret-color: #e2e8f0 !important;
    padding: 0 !important;
    font-family: inherit !important;
}

/* Multi-select: tag for each selected item */
.Select-multi-value-wrapper .Select-value {
    background-color: rgba(59, 130, 246, 0.2) !important;
    border: 1px solid rgba(59, 130, 246, 0.4) !important;
    color: #93c5fd !important;
    border-radius: 4px !important;
}

.Select-multi-value-wrapper .Select-value-label {
    color: #93c5fd !important;
}

.Select-multi-value-wrapper .Select-value-icon {
    border-right: 1px solid rgba(59, 130, 246, 0.4) !important;
    color: #93c5fd !important;
    padding: 1px 5px !important;
}

.Select-multi-value-wrapper .Select-value-icon:hover {
    background-color: rgba(239, 68, 68, 0.2) !important;
    color: #f87171 !important;
}

/* Dropdown menu (the open list) */
.Select-menu-outer {
    background-color: #252532 !important;
    border: 1px solid #3b3b4f !important;
    border-top: none !important;
    border-bottom-left-radius: 6px !important;
    border-bottom-right-radius: 6px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5) !important;
    z-index: 9999 !important;
}

.Select-menu {
    background-color: #252532 !important;
    max-height: 260px !important;
}

/* Individual option in the dropdown list */
.Select-option {
    background-color: #252532 !important;
    color: #cbd5e1 !important;
    padding: 8px 12px !important;
    font-size: 0.875rem !important;
    cursor: pointer !important;
    transition: background-color 0.1s ease !important;
}

/* Hovered option */
.Select-option.is-focused {
    background-color: rgba(59, 130, 246, 0.2) !important;
    color: #e2e8f0 !important;
}

/* Currently selected option (shown in open list) */
.Select-option.is-selected {
    background-color: rgba(59, 130, 246, 0.35) !important;
    color: #93c5fd !important;
    font-weight: 500 !important;
}

/* Hovered AND selected */
.Select-option.is-selected.is-focused {
    background-color: rgba(59, 130, 246, 0.45) !important;
    color: #bfdbfe !important;
}

/* Disabled option */
.Select-option.is-disabled {
    color: #475569 !important;
    cursor: not-allowed !important;
}

/* "No results found" text */
.Select-noresults {
    background-color: #252532 !important;
    color: #64748b !important;
    padding: 8px 12px !important;
}

/* Clear (×) button */
.Select-clear-zone {
    color: #64748b !important;
}

.Select-clear-zone:hover {
    color: #f87171 !important;
}

/* Existing .dash-dropdown-dark helper class — extend with missing states */
.dash-dropdown-dark .Select-value-label {
    color: #e2e8f0 !important;
}

.dash-dropdown-dark .Select--single > .Select-control .Select-value {
    color: #e2e8f0 !important;
}

.dash-dropdown-dark .Select-option.is-focused {
    background-color: rgba(59, 130, 246, 0.2) !important;
    color: #e2e8f0 !important;
}

.dash-dropdown-dark .Select-option.is-selected {
    background-color: rgba(59, 130, 246, 0.35) !important;
    color: #93c5fd !important;
    font-weight: 500 !important;
}

.dash-dropdown-dark .Select-input > input {
    background-color: transparent !important;
    color: #e2e8f0 !important;
}

.dash-dropdown-dark .Select-noresults {
    background-color: #16161f !important;
    color: #64748b !important;
}

/* ============================================
   DROPDOWN LEGIBILITY — UNIVERSAL HIGH-SPECIFICITY OVERRIDES
   Ensures selected value text is always visible on dark backgrounds,
   regardless of wrapper class or page. These rules have higher
   specificity than the generic .Select-* rules above to catch any
   dropdowns that may be rendered inside specific layout containers.
   ============================================ */

/* Force all .Select-value text to be visible —
   covers cases where a parent container's color inheritance overrides */
body .Select-value-label,
body .Select--single > .Select-control .Select-value,
body .Select--single > .Select-control .Select-value .Select-value-label {
    color: #e2e8f0 !important;
}

/* Ensure the .dash-dropdown-dark variant is fully specified —
   add the missing single-value container rule */
.dash-dropdown-dark .Select--single > .Select-control .Select-value {
    color: #e2e8f0 !important;
    line-height: 34px !important;
}

.dash-dropdown-dark .Select--single > .Select-control .Select-value .Select-value-label {
    color: #e2e8f0 !important;
}

/* Circuit analysis page — explicit overrides by component ID
   (these IDs are defined in dash_app.py create_circuits_page) */
#circuit-target-ticker .Select-value-label,
#circuit-target-ticker .Select--single > .Select-control .Select-value,
#circuit-layer .Select-value-label,
#circuit-layer .Select--single > .Select-control .Select-value,
#patch-source-ticker .Select-value-label,
#patch-source-ticker .Select--single > .Select-control .Select-value,
#patch-target-ticker .Select-value-label,
#patch-target-ticker .Select--single > .Select-control .Select-value,
#patch-corruption-type .Select-value-label,
#patch-corruption-type .Select--single > .Select-control .Select-value {
    color: #e2e8f0 !important;
}

/* Catch any dropdown inside a dbc.Card or dbc.Col that may inherit
   a different foreground color from Bootstrap's card styles */
.card .Select-value-label,
.card .Select--single > .Select-control .Select-value,
.card-body .Select-value-label,
.card-body .Select--single > .Select-control .Select-value {
    color: #e2e8f0 !important;
}

/* Also cover the older react-select v1 pattern where the value text
   lives directly inside .Select-value (not .Select-value-label) */
body .Select--single > .Select-control .Select-value {
    color: #e2e8f0 !important;
}

/* Multi-value selected tags: ensure icon and label are legible */
body .Select-multi-value-wrapper .Select-value .Select-value-label {
    color: #93c5fd !important;
}

/* Prevent any global color: inherit from making text disappear
   inside modal or sidebar contexts */
.modal .Select-value-label,
.modal .Select--single > .Select-control .Select-value,
.sidebar .Select-value-label,
.sidebar .Select--single > .Select-control .Select-value {
    color: #e2e8f0 !important;
}

/* ============================================
   DASH 4.0 DROPDOWN — NEW CLASS NAMES
   Dash 4.0 (dcc 4.0) replaced React-Select v1
   classes (Select-*) with dash-dropdown-* classes.
   These rules override the new component styling.
   ============================================ */

/* Dropdown wrapper */
.dash-dropdown {
    font-family: inherit !important;
}

/* The trigger/control box (closed state) */
.dash-dropdown .dash-dropdown-trigger {
    background-color: #1e1e2e !important;
    border: 1px solid #3b3b4f !important;
    border-radius: 6px !important;
    min-height: 36px !important;
    cursor: pointer !important;
}

.dash-dropdown .dash-dropdown-trigger:hover {
    border-color: #60a5fa !important;
}

/* Selected value text — THE KEY FIX */
.dash-dropdown .dash-dropdown-value {
    color: #e2e8f0 !important;
    font-size: 0.875rem !important;
}

/* Selected value items (multi-select tags) */
.dash-dropdown .dash-dropdown-value-item {
    background-color: rgba(59, 130, 246, 0.2) !important;
    color: #93c5fd !important;
    border: 1px solid rgba(59, 130, 246, 0.3) !important;
    border-radius: 4px !important;
}

/* Placeholder text */
.dash-dropdown .dash-dropdown-value.dash-dropdown-placeholder,
.dash-dropdown .dash-dropdown-placeholder {
    color: #64748b !important;
}

/* Trigger icon (chevron) */
.dash-dropdown .dash-dropdown-trigger-icon {
    color: #64748b !important;
}

.dash-dropdown .dash-dropdown-trigger-icon:hover {
    color: #e2e8f0 !important;
}

/* Search input inside dropdown */
.dash-dropdown .dash-dropdown-search {
    background-color: transparent !important;
    color: #e2e8f0 !important;
    caret-color: #60a5fa !important;
    border: none !important;
}

/* Search icon */
.dash-dropdown .dash-dropdown-search-icon {
    color: #64748b !important;
}

/* Options menu (open state) */
.dash-dropdown .dash-dropdown-content {
    background-color: #252532 !important;
    border: 1px solid #3b3b4f !important;
    border-top: none !important;
    border-radius: 0 0 6px 6px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
    z-index: 9999 !important;
}

/* Options container */
.dash-dropdown .dash-dropdown-options {
    background-color: #252532 !important;
}

/* Individual option */
.dash-dropdown .dash-dropdown-option {
    background-color: #252532 !important;
    color: #cbd5e1 !important;
    padding: 8px 12px !important;
    cursor: pointer !important;
    transition: background-color 0.15s !important;
}

/* Hovered option */
.dash-dropdown .dash-dropdown-option:hover,
.dash-dropdown .dash-dropdown-option[data-focused="true"] {
    background-color: rgba(59, 130, 246, 0.2) !important;
    color: #e2e8f0 !important;
}

/* Selected option in the list */
.dash-dropdown .dash-dropdown-option[data-selected="true"] {
    background-color: rgba(59, 130, 246, 0.35) !important;
    color: #93c5fd !important;
    font-weight: 600 !important;
}

/* Selected + hovered */
.dash-dropdown .dash-dropdown-option[data-selected="true"]:hover {
    background-color: rgba(59, 130, 246, 0.45) !important;
}

/* Clear button */
.dash-dropdown .dash-dropdown-clear {
    color: #64748b !important;
}

.dash-dropdown .dash-dropdown-clear:hover {
    color: #ef4444 !important;
}

/* Value count badge (multi-select) */
.dash-dropdown .dash-dropdown-value-count {
    background-color: rgba(59, 130, 246, 0.25) !important;
    color: #93c5fd !important;
    border-radius: 4px !important;
}

/* Action buttons row */
.dash-dropdown .dash-dropdown-actions {
    background-color: #1e1e2e !important;
    border-top: 1px solid #3b3b4f !important;
}

.dash-dropdown .dash-dropdown-action-button {
    color: #60a5fa !important;
}

.dash-dropdown .dash-dropdown-action-button:hover {
    background-color: rgba(59, 130, 246, 0.15) !important;
}

/* Grid container for search */
.dash-dropdown .dash-dropdown-grid-container {
    background-color: #1e1e2e !important;
}

/* Dark class variant — same rules with higher specificity */
.dash-dropdown-dark.dash-dropdown .dash-dropdown-trigger {
    background-color: #16161f !important;
    border-color: #2a2a3a !important;
}

.dash-dropdown-dark.dash-dropdown .dash-dropdown-value {
    color: #e2e8f0 !important;
}

.dash-dropdown-dark.dash-dropdown .dash-dropdown-content {
    background-color: #16161f !important;
}

.dash-dropdown-dark.dash-dropdown .dash-dropdown-option {
    background-color: #16161f !important;
    color: #e2e8f0 !important;
}

.dash-dropdown-dark.dash-dropdown .dash-dropdown-option:hover {
    background-color: #2a2a3a !important;
}
