/**
 * BullzEye View – Dark mode (user preference).
 * On-brand: deep blue-black base, vibrant blue accent (#0ea5e9), green/red for data.
 * Only applies when html.theme-dark is set.
 */
html.theme-dark {
    color-scheme: dark;
}

/* Logo: JPG has white bg – multiply hides it so no white block; PNG (class .logo-dark-invert) gets inverted to show light on dark. */
html.theme-dark .sidebar-logo img,
html.theme-dark .logo-link img,
html.theme-dark .logo img,
html.theme-dark .logo-section img,
html.theme-dark .legal-header .logo img {
    mix-blend-mode: multiply;
}
/* PNG logo with transparent background: show as-is in dark mode (no invert). */
html.theme-dark .sidebar-logo img.logo-dark-invert,
html.theme-dark .logo-link img.logo-dark-invert,
html.theme-dark .logo img.logo-dark-invert,
html.theme-dark .logo-section img.logo-dark-invert,
html.theme-dark .legal-header .logo img.logo-dark-invert,
html.theme-dark .story-card-logo.logo-dark-invert {
    mix-blend-mode: unset;
    filter: none;
}
/* Logo container (join, forgot password, etc.) – no white box in dark mode */
html.theme-dark .logo {
    background: transparent !important;
    box-shadow: none !important;
}

html.theme-dark,
html.theme-dark body {
    background: #0f172a !important;
    color: #f1f5f9 !important;
}

/* Sidebar */
html.theme-dark .sidebar {
    background: #1e293b !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.3) !important;
}
html.theme-dark .sidebar-search-input {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}
html.theme-dark .sidebar-search-input::placeholder {
    color: #64748b;
}
html.theme-dark .sidebar-search-input:focus {
    border-color: #0ea5e9 !important;
    background: #0f172a !important;
    box-shadow: 0 0 0 3px rgba(14,165,233,0.25) !important;
}
html.theme-dark .sidebar-search-icon {
    color: #94a3b8 !important;
}
html.theme-dark .sidebar-search-results {
    background: #1e293b !important;
    border-color: #334155 !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4) !important;
}
html.theme-dark .sidebar-search-result-item {
    border-bottom-color: #334155 !important;
}
html.theme-dark .sidebar-search-result-item:hover {
    background: #334155 !important;
}
html.theme-dark .sidebar-search-result-symbol {
    color: #38bdf8 !important;
}
html.theme-dark .sidebar-search-result-name {
    color: #e2e8f0 !important;
}
html.theme-dark .sidebar-section-title {
    color: #38bdf8 !important;
}
html.theme-dark .sidebar-link {
    color: #e2e8f0 !important;
}
html.theme-dark .sidebar-link:hover {
    color: #38bdf8 !important;
}
html.theme-dark .sidebar-link.active {
    color: #38bdf8 !important;
}
html.theme-dark .sidebar-hamburger {
    background: #334155 !important;
}
html.theme-dark .sidebar-hamburger:hover {
    background: #475569 !important;
}
html.theme-dark .sidebar-hamburger span {
    background: #f1f5f9 !important;
}
html.theme-dark .sidebar-nav .sidebar-section {
    border-top-color: #334155 !important;
}
/* Bullets (sidebar-link-icon): pages that set background #014373 need override so bullets show in dark mode */
html.theme-dark .sidebar-link-icon {
    background: currentColor !important;
    opacity: 0.9;
}

/* Main content areas */
html.theme-dark .main-layout {
    display: flex !important;
}
html.theme-dark .main-content,
html.theme-dark .main-content-sidebar {
    color: #f1f5f9 !important;
}
html.theme-dark .main-content h1,
html.theme-dark .main-content h2,
html.theme-dark .main-content h3,
html.theme-dark .main-content-sidebar h1,
html.theme-dark .main-content-sidebar h2,
html.theme-dark .main-content-sidebar h3 {
    color: #f1f5f9 !important;
}

/* Cards and panels */
html.theme-dark .card,
html.theme-dark .watchlist-panel,
html.theme-dark .sector-card,
html.theme-dark .feed-card,
html.theme-dark .home-ticker-card,
html.theme-dark [class*="card"],
html.theme-dark .danger-zone {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}
html.theme-dark .card h2,
html.theme-dark .card h3 {
    color: #38bdf8 !important;
    border-bottom-color: #334155 !important;
}
html.theme-dark .form-group label {
    color: #94a3b8 !important;
}
html.theme-dark .form-group select,
html.theme-dark .form-group input[type="text"],
html.theme-dark select,
html.theme-dark input[type="text"],
html.theme-dark input[type="email"],
html.theme-dark input[type="password"] {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}
html.theme-dark .form-group select:focus,
html.theme-dark input:focus {
    border-color: #0ea5e9 !important;
    outline: none;
}

/* Buttons – primary accent */
html.theme-dark .btn {
    background: #0ea5e9 !important;
    color: #fff !important;
}
html.theme-dark .btn:hover {
    background: #38bdf8 !important;
}
html.theme-dark .btn-danger {
    background: #dc2626 !important;
}
html.theme-dark .btn-danger:hover {
    background: #ef4444 !important;
}

/* Messages */
html.theme-dark .msg.success {
    background: rgba(34,197,94,0.2) !important;
    color: #86efac !important;
}
html.theme-dark .msg.err {
    background: rgba(239,68,68,0.2) !important;
    color: #fca5a5 !important;
}

/* Footer */
html.theme-dark .global-footer {
    background: #0f172a !important;
    border-top-color: #334155 !important;
    color: #94a3b8 !important;
}
html.theme-dark .global-footer a {
    color: #38bdf8 !important;
}
html.theme-dark .global-footer .footer-disclaimer {
    color: #64748b !important;
}
html.theme-dark .global-footer .footer-copyright {
    color: #94a3b8 !important;
}

/* Links */
html.theme-dark a {
    color: #38bdf8 !important;
}
html.theme-dark a:hover {
    color: #7dd3fc !important;
}

/* Home page specifics */
html.theme-dark .home-dashboard,
html.theme-dark .home-left,
html.theme-dark .home-right {
    background: transparent !important;
}
html.theme-dark .home-ticker-section {
    background: transparent !important;
}
html.theme-dark .home-ticker-section .feed-title,
html.theme-dark .home-ticker-section .ticker-row,
html.theme-dark .home-ticker-section [class*="ticker"] {
    color: #e2e8f0 !important;
}
html.theme-dark .earnings-card {
    background: #1e293b !important;
    border-color: #334155 !important;
}
html.theme-dark .earnings-card h3 {
    color: #38bdf8 !important;
}
html.theme-dark .feed-title,
html.theme-dark .feed-section-title {
    color: #f1f5f9 !important;
}
html.theme-dark .home-ticker-section {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    border-radius: 8px !important;
    padding: 16px !important;
}
html.theme-dark .home-ticker-section .feed-title,
html.theme-dark .home-ticker-section .ticker-row,
html.theme-dark .home-ticker-section [class*="ticker"] {
    color: #e2e8f0 !important;
}
html.theme-dark .home-ticker-card-name,
html.theme-dark .home-ticker-card-price {
    color: #f1f5f9 !important;
}
html.theme-dark .home-ticker-card-pct.up {
    color: #22c55e !important;
}
html.theme-dark .home-ticker-card-pct.down {
    color: #ef4444 !important;
}
html.theme-dark .watchlist-controls label,
html.theme-dark .sector-header-grid,
html.theme-dark .sector-change-display {
    color: #e2e8f0 !important;
}
html.theme-dark .sector-loading,
html.theme-dark .feed-loading {
    color: #94a3b8 !important;
}
html.theme-dark .stock-cell.positive-light,
html.theme-dark .stock-cell.positive-medium,
html.theme-dark .stock-cell.positive-strong {
    color: #fff !important;
}
html.theme-dark .stock-cell.negative-light,
html.theme-dark .stock-cell.negative-medium,
html.theme-dark .stock-cell.negative-strong {
    color: #fff !important;
}
html.theme-dark .stock-symbol-grid,
html.theme-dark .stock-change-grid {
    color: inherit;
}
html.theme-dark .home-macro-tab-btn {
    background: #334155 !important;
    border-color: #475569 !important;
    color: #94a3b8 !important;
}
html.theme-dark .home-macro-tab-btn:hover {
    background: #475569 !important;
    color: #e2e8f0 !important;
}
html.theme-dark .home-macro-tab-btn.active {
    background: #1e293b !important;
    color: #38bdf8 !important;
    border-color: #334155 !important;
}
html.theme-dark .feed-empty,
html.theme-dark .feed-add-watchlist {
    color: #94a3b8 !important;
}
/* Home: feed items, upcoming (earnings), equity chips – dark background and consistent text */
html.theme-dark .feed-item {
    background: #1e293b !important;
    border-color: #334155 !important;
    border-left-color: #0ea5e9 !important;
    color: #e2e8f0 !important;
}
html.theme-dark .feed-item.feed-news { border-left-color: #059669 !important; }
html.theme-dark .feed-item.feed-brief { border-left-color: #0ea5e9 !important; }
html.theme-dark .feed-item-meta,
html.theme-dark .feed-item-type {
    color: #94a3b8 !important;
}
html.theme-dark .feed-item-body,
html.theme-dark .feed-item-body a {
    color: #f1f5f9 !important;
}
html.theme-dark .feed-item-body a:hover {
    text-decoration: underline;
}
html.theme-dark .feed-item-symbol,
html.theme-dark .feed-item-symbol a {
    color: #38bdf8 !important;
}
html.theme-dark .feed-item-time {
    color: #64748b !important;
}
html.theme-dark .feed-item-action {
    color: #38bdf8 !important;
}
html.theme-dark .feed-item-why {
    color: #94a3b8 !important;
}
html.theme-dark .earnings-list,
html.theme-dark .earnings-card {
    background: #1e293b !important;
    border-color: #334155 !important;
}
html.theme-dark .earnings-item {
    background: #334155 !important;
    border-radius: 6px !important;
    color: #e2e8f0 !important;
}
html.theme-dark .earnings-item-symbol,
html.theme-dark .earnings-item-symbol a {
    color: #38bdf8 !important;
}
html.theme-dark .earnings-item-date {
    color: #94a3b8 !important;
}
html.theme-dark .home-sector-item {
    background: #334155 !important;
    border-color: #475569 !important;
    color: #e2e8f0 !important;
}
html.theme-dark .home-sector-item.up {
    color: #4ade80 !important;
}
html.theme-dark .home-sector-item.down {
    color: #f87171 !important;
}
html.theme-dark .feed-filter-select,
html.theme-dark .feed-list + select,
html.theme-dark select[id="feedFilterSelect"] {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}
/* Watchlist grid green/red cells use .stock-cell.positive-* / .negative-* – white text set above */

/* Sector page – prevent last column cut off in dark mode (grid-wrap scrolls; no min-width to avoid layout shift) */
html.theme-dark body.sector-page .sector-card .sector-grid-wrap {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
}
html.theme-dark .sector-grid-wrap,
html.theme-dark .sector-grid {
    background: transparent !important;
}

/* Stockview – keep critical overrides scoped */
/* Top section: header, symbol-info, 52-week range – dark background */
html.theme-dark .container,
html.theme-dark .container > header,
html.theme-dark .header-bottom-row,
html.theme-dark .symbol-info {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}
html.theme-dark .header-range,
html.theme-dark .header-range-label,
html.theme-dark .header-range-values {
    background: transparent !important;
    color: #94a3b8 !important;
}
/* 52-week range spectrum bar: keep gradient visible in dark mode */
html.theme-dark .header-range-bar {
    background: linear-gradient(to right, #dc2626, #ea580c, #16a34a) !important;
    border: 1px solid #475569 !important;
    box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.2);
}
html.theme-dark .header-current-price-label {
    background: #334155 !important;
    color: #f1f5f9 !important;
    border: 1px solid #475569;
}
html.theme-dark .header-price-indicator {
    background: #38bdf8 !important;
}
html.theme-dark .header-price-indicator::after {
    border-top-color: #38bdf8 !important;
}
html.theme-dark .data-freshness,
html.theme-dark .header-range-values span {
    color: #94a3b8 !important;
}
/* Fundamentals Overview & BullzEye Analysis sections */
html.theme-dark .analysis-box {
    background: #1e293b !important;
    border-left-color: #0ea5e9 !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}
html.theme-dark .analysis-box .analysis-box-heading {
    color: #38bdf8 !important;
}
html.theme-dark .analysis-box .analysis-box-body {
    color: #cbd5e1 !important;
}
/* Fundamentals overview / valuation chips: dark backgrounds and readable text */
html.theme-dark .analysis-box .term-tip[style*="background: #f1f5f9"],
html.theme-dark .analysis-box .term-tip[style*="background:#f1f5f9"] {
    background: #334155 !important;
    color: #e2e8f0 !important;
}
html.theme-dark .analysis-box .term-tip[style*="background: #ecfdf5"],
html.theme-dark .analysis-box .term-tip[style*="background:#ecfdf5"] {
    background: #064e3b !important;
    color: #6ee7b7 !important;
}
html.theme-dark .analysis-box .term-tip[style*="color: #64748b"] {
    color: #94a3b8 !important;
}
html.theme-dark .analysis-box .term-tip[style*="color: #475569"],
html.theme-dark .analysis-box .term-tip[style*="color: #555"] {
    color: #cbd5e1 !important;
}
/* DCF / intrinsic value box (Valuation tab and Overview) */
html.theme-dark .analysis-box-body[style*="background: #E8F4F8"],
html.theme-dark .analysis-box-body[style*="background:#E8F4F8"],
html.theme-dark p.analysis-box-body[style*="E8F4F8"] {
    background: #0f172a !important;
    color: #e2e8f0 !important;
    border-left-color: #0ea5e9 !important;
}
/* Sub-headings (Liquidity & Enterprise, etc.) */
html.theme-dark .metric-group-title {
    color: #38bdf8 !important;
    border-bottom-color: #334155 !important;
}
html.theme-dark .symbol,
html.theme-dark .symbol-info .symbol {
    color: #38bdf8 !important;
}
html.theme-dark .price,
html.theme-dark .symbol-info .price {
    color: #f1f5f9 !important;
}
html.theme-dark .change.positive {
    color: #22c55e !important;
    background: rgba(34,197,94,0.2) !important;
}
html.theme-dark .change.negative {
    color: #ef4444 !important;
    background: rgba(239,68,68,0.2) !important;
}
html.theme-dark .tabs {
    background: #1e293b !important;
    border-bottom-color: #334155 !important;
}
html.theme-dark .tab-button {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #94a3b8 !important;
}
html.theme-dark .tab-button:hover,
html.theme-dark .tab-button.active {
    color: #38bdf8 !important;
    border-color: #0ea5e9 !important;
}
html.theme-dark .tab-content {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}
/* Stockview: chart area, overview tab, key stats, about, cards – dark background and readable text */
html.theme-dark .chart-section {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    border-radius: 8px !important;
    padding: 16px !important;
}
html.theme-dark .chart-controls-wrapper {
    background: transparent !important;
    border-color: #334155 !important;
}
html.theme-dark .timeframe-btn {
    background: #334155 !important;
    border-color: #475569 !important;
    color: #94a3b8 !important;
}
html.theme-dark .timeframe-btn:hover,
html.theme-dark .timeframe-btn.active {
    background: #475569 !important;
    color: #38bdf8 !important;
    border-color: #334155 !important;
}
html.theme-dark .key-stats-card,
html.theme-dark .about-card {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    color: #e2e8f0 !important;
}
html.theme-dark .key-stats-card h3,
html.theme-dark .about-card h3,
html.theme-dark .community-snippet h3 {
    color: #38bdf8 !important;
}
html.theme-dark .key-stats-card .stat-label,
html.theme-dark .about-card .stat-label {
    color: #94a3b8 !important;
}
html.theme-dark .about-card .about-text,
html.theme-dark .about-card .about-meta,
html.theme-dark .about-card .about-meta-item {
    color: #cbd5e1 !important;
}
html.theme-dark .about-card .about-meta-item a,
html.theme-dark .about-card a[style*="color: #014373"] {
    color: #38bdf8 !important;
}
html.theme-dark .about-card span[style*="color: #666"] {
    color: #94a3b8 !important;
}
html.theme-dark .key-stats-card .stat-value {
    color: #f1f5f9 !important;
}
html.theme-dark .market-analysis-card {
    background: #1e293b !important;
    border-left-color: #0ea5e9 !important;
    color: #e2e8f0 !important;
}
html.theme-dark .valuation-summary-badge span {
    padding: 3px 10px;
    border-radius: 6px;
}
html.theme-dark .valuation-summary-badge span[style*="background: #fef2f2"] {
    background: rgba(185, 28, 28, 0.25) !important;
    color: #fca5a5 !important;
}
html.theme-dark .valuation-summary-badge span[style*="background: #ecfdf5"] {
    background: rgba(22, 163, 74, 0.25) !important;
    color: #86efac !important;
}
html.theme-dark .valuation-summary-badge span[style*="background: #f1f5f9"] {
    background: #334155 !important;
    color: #cbd5e1 !important;
}
html.theme-dark .market-analysis-card .analysis-box-body,
html.theme-dark .market-analysis-card p {
    color: #cbd5e1 !important;
}
/* Rev / Profit and other inline #555 text in fundamentals overview */
html.theme-dark .market-analysis-card span[style*="color: #555"],
html.theme-dark .analysis-box span[style*="color: #555"] {
    color: #cbd5e1 !important;
}
html.theme-dark #communitySnippet,
html.theme-dark .community-snippet,
html.theme-dark .community-feed {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}
html.theme-dark .community-snippet a,
html.theme-dark .community-snippet a[style*="color: #014373"] {
    color: #38bdf8 !important;
}
html.theme-dark .community-snippet #communitySnippetFeed,
html.theme-dark .community-snippet p {
    color: #cbd5e1 !important;
}
/* Individual post cards in Latest from community snippet (above footer) */
html.theme-dark .community-snippet-post,
html.theme-dark #communitySnippetFeed .community-snippet-post,
html.theme-dark .community-snippet .community-snippet-post {
    margin-bottom: 10px;
    padding: 10px;
    background: #334155 !important;
    border: 1px solid #475569 !important;
    border-color: #475569 !important;
    border-radius: 6px;
    color: #e2e8f0 !important;
}
html.theme-dark .community-snippet-post > div:first-child,
html.theme-dark #communitySnippetFeed .community-snippet-post > div:first-child {
    font-size: 12px;
    color: #94a3b8 !important;
}
html.theme-dark .community-snippet-post > div:last-child,
html.theme-dark #communitySnippetFeed .community-snippet-post > div:last-child {
    font-size: 13px;
    margin-top: 4px;
    color: #cbd5e1 !important;
}
html.theme-dark .community-msg {
    background: #334155 !important;
    border-color: #475569 !important;
    color: #e2e8f0 !important;
}
html.theme-dark .tab-content h3,
html.theme-dark .tab-content [style*="color: #014373"] {
    color: #38bdf8 !important;
}
html.theme-dark .tab-content p[style*="color:#666"],
html.theme-dark .tab-content p[style*="color: #666"] {
    color: #94a3b8 !important;
}
html.theme-dark #tradingSessionLegend,
html.theme-dark #indicatorPanel {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}
html.theme-dark #indicatorLabel,
html.theme-dark .analysis-box-body {
    color: #94a3b8 !important;
}
/* Valuation page – chart card (bubble chart container) */
html.theme-dark .chart-card {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    color: #e2e8f0 !important;
}
html.theme-dark .chart-legend-note {
    color: #94a3b8 !important;
}
html.theme-dark .zoom-btn {
    background: #334155 !important;
    border-color: #475569 !important;
    color: #e2e8f0 !important;
}
html.theme-dark .zoom-btn:hover {
    background: #475569 !important;
    color: #38bdf8 !important;
}
html.theme-dark table,
html.theme-dark .data-table {
    background: #1e293b !important;
    border-color: #334155 !important;
}
html.theme-dark th,
html.theme-dark td {
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}
html.theme-dark th {
    background: #0f172a !important;
    color: #94a3b8 !important;
}
html.theme-dark tr:hover td {
    background: #334155 !important;
}

/* Stockview – chart, overview tab, key stats, about, cards */
html.theme-dark .chart-section,
html.theme-dark .chart-card {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    border-radius: 8px;
}
html.theme-dark .chart-controls-wrapper,
html.theme-dark .chart-controls {
    background: transparent !important;
    color: #e2e8f0 !important;
}
html.theme-dark .chart-legend-note,
html.theme-dark .zoom-label {
    color: #94a3b8 !important;
}
html.theme-dark .key-stats-card,
html.theme-dark .about-card {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    color: #e2e8f0 !important;
}
html.theme-dark .key-stats-card h3,
html.theme-dark .about-card h3,
html.theme-dark .market-analysis-card h3,
html.theme-dark [class*="snippet"] h3,
html.theme-dark [class*="community"] h3 {
    color: #f1f5f9 !important;
}
html.theme-dark .market-analysis-card {
    background: #1e293b !important;
    border-left-color: #0ea5e9 !important;
    color: #e2e8f0 !important;
}
html.theme-dark .community-snippet,
html.theme-dark .community-feed,
html.theme-dark #communitySnippet {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}
html.theme-dark #communityFeed {
    background: #1e293b !important;
    border-color: #334155 !important;
}
html.theme-dark .stockview-overview p[style*="color:#666"],
html.theme-dark .main-content p[style*="color:#666"],
html.theme-dark .main-content p[style*="color: #666"] {
    color: #cbd5e1 !important;
}

/* News and community sections – dark cards */
html.theme-dark .news-list,
html.theme-dark .news-item,
html.theme-dark .news-item-inner,
html.theme-dark .news-strip,
html.theme-dark .news-strip-item {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}
html.theme-dark .news-strip-headline,
html.theme-dark .news-headline {
    color: #f1f5f9 !important;
}
html.theme-dark .news-strip-meta,
html.theme-dark .news-summary,
html.theme-dark .news-source {
    color: #94a3b8 !important;
}
html.theme-dark .news-item:hover,
html.theme-dark .news-strip-item:hover {
    background: #334155 !important;
}

/* Price target consensus spectrum bar – visible in dark mode */
html.theme-dark .pt-consensus-bar,
html.theme-dark .header-range-bar.pt-consensus-bar {
    background: linear-gradient(to right, #dc2626, #ea580c, #16a34a) !important;
    border: 1px solid #475569 !important;
}
html.theme-dark .pt-consensus-pin-label {
    background: #334155 !important;
    color: #e2e8f0 !important;
    border: 1px solid #475569;
}
html.theme-dark .pt-consensus-connector {
    border-left-color: #94a3b8 !important;
}

/* Ratings & Grades – snapshot and summary chips (white → dark) */
html.theme-dark .tab-content div[style*="background: #f5f5f5"],
html.theme-dark .tab-content div[style*="background:#f5f5f5"],
html.theme-dark .tab-content div[style*="background: #e3f2fd"] {
    background: #334155 !important;
    color: #e2e8f0 !important;
    border-color: #475569 !important;
}
html.theme-dark .tab-content div[style*="background: #e8f5e9"] {
    background: #064e3b !important;
    color: #6ee7b7 !important;
    border-color: #047857 !important;
}
html.theme-dark .tab-content div[style*="background: #ffebee"] {
    background: #7f1d1d !important;
    color: #fca5a5 !important;
    border-color: #991b1b !important;
}
html.theme-dark .tab-content div[style*="background: linear-gradient(135deg, #014373"] {
    background: linear-gradient(135deg, #0c4a6e 0%, #0369a1 100%) !important;
    color: #f1f5f9 !important;
}

/* Ratings & Grades at a Glance, Institutional summary – dark card */
html.theme-dark .sentiment-snapshot {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    color: #e2e8f0 !important;
}
html.theme-dark .sentiment-snapshot h3,
html.theme-dark .sentiment-snapshot h4 {
    color: #38bdf8 !important;
}
html.theme-dark .sentiment-snapshot p {
    color: #cbd5e1 !important;
}
html.theme-dark .tab-content table thead tr[style*="background"],
html.theme-dark .tab-content thead th {
    background: #0f172a !important;
    color: #94a3b8 !important;
    border-color: #334155 !important;
}

/* Valuation / Fundamentals */
html.theme-dark .main-content p,
html.theme-dark .main-content-sidebar p {
    color: #e2e8f0 !important;
}
html.theme-dark .main-content p[style*="color:#666"],
html.theme-dark .main-content-sidebar p[style*="color:#666"] {
    color: #94a3b8 !important;
}

/* Theme toggle in sidebar */
html.theme-dark .theme-toggle-wrap {
    border-top: 1px solid #334155;
}
html.theme-dark .theme-toggle-btn {
    background: #334155 !important;
    color: #94a3b8 !important;
    border: 1px solid #475569 !important;
}
html.theme-dark .theme-toggle-btn:hover {
    background: #475569 !important;
    color: #38bdf8 !important;
}
html.theme-dark .theme-toggle-btn.active {
    background: rgba(14,165,233,0.2) !important;
    color: #38bdf8 !important;
    border-color: #0ea5e9 !important;
}

/* Index / login page – top nav dark so logo (inverted) shows on dark background */
html.theme-dark .site-header {
    background: #1e293b !important;
    box-shadow: 0 1px 0 rgba(255,255,255,.06) !important;
}
html.theme-dark .header-inner {
    border-color: transparent;
}
html.theme-dark .nav-panel {
    background: #1e293b !important;
    border-top-color: #334155 !important;
}
html.theme-dark .nav-links a {
    color: #e2e8f0 !important;
}
html.theme-dark .nav-links a:hover {
    background: #334155 !important;
}
html.theme-dark .nav-links a.nav-cta,
html.theme-dark .nav-cta {
    background: #014373 !important;
    color: #fff !important;
}
html.theme-dark .nav-links a.nav-cta:hover,
html.theme-dark .nav-cta:hover {
    background: #003366 !important;
    color: #fff !important;
}
html.theme-dark .nav-search input {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}
html.theme-dark .nav-search input::placeholder {
    color: #64748b !important;
}
html.theme-dark .nav-search input:focus {
    border-color: #0ea5e9 !important;
    background: #0f172a !important;
}
html.theme-dark .nav-toggle {
    background: #334155 !important;
    border-color: #475569 !important;
}
html.theme-dark .nav-toggle:hover {
    background: #475569 !important;
    border-color: #334155 !important;
}
html.theme-dark .nav-toggle-icon span {
    background: #f1f5f9 !important;
}
html.theme-dark .landing-wrap,
html.theme-dark .login-form-wrap,
html.theme-dark .signin-card {
    background: #1e293b !important;
    border-color: #334155 !important;
}
html.theme-dark .hero h1 {
    color: #f1f5f9 !important;
}
html.theme-dark .hero h1 .accent {
    color: #f87171 !important;
}
html.theme-dark .hero-sub {
    color: #cbd5e1 !important;
}
html.theme-dark .hero-feed-glimpse {
    background: #1e293b !important;
    border-color: #334155 !important;
}
html.theme-dark .hero-feed-label {
    color: #38bdf8 !important;
}
html.theme-dark .hero-feed-card,
html.theme-dark .hero-feed-card p,
html.theme-dark .hero-feed-card strong {
    color: #e2e8f0 !important;
}
html.theme-dark .hero-feed-type {
    color: #94a3b8 !important;
}
html.theme-dark .hero-feed-card {
    border-bottom-color: #334155 !important;
}
html.theme-dark .section h2,
html.theme-dark .how-card h3,
html.theme-dark .how-card p {
    color: #e2e8f0 !important;
}
html.theme-dark .how-card {
    background: #1e293b !important;
    border-color: #334155 !important;
}
html.theme-dark .section-sub {
    color: #94a3b8 !important;
}
html.theme-dark .login-form-wrap input,
html.theme-dark .signin-card input {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}
html.theme-dark .login-form-wrap label,
html.theme-dark .signin-card label {
    color: #94a3b8 !important;
}
/* Index: login card (Sign in, labels, forgot link) and Explore the platform section */
html.theme-dark .login-card {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    color: #e2e8f0 !important;
}
html.theme-dark .login-card h3 {
    color: #f1f5f9 !important;
}
html.theme-dark .login-card label {
    color: #cbd5e1 !important;
}
html.theme-dark .login-card input[type="text"],
html.theme-dark .login-card input[type="password"] {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}
html.theme-dark .login-card .forgot a {
    color: #38bdf8 !important;
}
html.theme-dark .login-err {
    color: #fca5a5 !important;
}
html.theme-dark #platform-tools .section h2 {
    color: #f1f5f9 !important;
}
html.theme-dark #platform-tools .tool-card,
html.theme-dark #platform-tools .tools-grid .tool-card {
    background: #1e293b !important;
    border-color: #334155 !important;
}
html.theme-dark #platform-tools .tool-card-body h3,
html.theme-dark #platform-tools .tool-card-body p,
html.theme-dark #platform-tools .tool-card-cta {
    color: #e2e8f0 !important;
}

/* Index landing – transparency and final CTA sections (dark background and text) */
html.theme-dark .transparency {
    background: #1e293b !important;
    color: #e2e8f0 !important;
}
html.theme-dark .transparency p {
    color: #cbd5e1 !important;
}
html.theme-dark .transparency-links a {
    color: #38bdf8 !important;
}
html.theme-dark .transparency-links a:hover {
    color: #7dd3fc !important;
}
html.theme-dark .final-cta {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%) !important;
    color: #e2e8f0 !important;
}
html.theme-dark .final-cta h2 {
    color: #f1f5f9 !important;
}
html.theme-dark .final-cta p {
    color: #94a3b8 !important;
}
html.theme-dark .final-cta .btn-primary {
    background: #0ea5e9 !important;
    color: #fff !important;
}
html.theme-dark .final-cta .btn-primary:hover {
    background: #38bdf8 !important;
    color: #fff !important;
}
html.theme-dark footer.site-footer {
    background: #0f172a !important;
    border-top-color: #334155 !important;
    color: #94a3b8 !important;
}
html.theme-dark footer.site-footer .footer-inner {
    color: #94a3b8 !important;
}
html.theme-dark footer.site-footer a {
    color: #38bdf8 !important;
}
html.theme-dark footer.site-footer a:hover {
    color: #7dd3fc !important;
}
html.theme-dark .signed-in {
    color: #94a3b8 !important;
}
html.theme-dark .signed-in a {
    color: #38bdf8 !important;
}

/* Settings page */
html.theme-dark body {
    background: #0f172a !important;
}
html.theme-dark .main-content-sidebar p[style*="color:#666"] {
    color: #94a3b8 !important;
}
/* Index landing – hero and animated feed (readable in dark mode) */
html.theme-dark .hero h1 {
    color: #f1f5f9 !important;
}
html.theme-dark .hero h1 .accent {
    color: #f87171 !important;
}
html.theme-dark .hero-sub {
    color: #cbd5e1 !important;
}
html.theme-dark .hero-feed-glimpse {
    background: #1e293b !important;
    border-color: #334155 !important;
}
html.theme-dark .hero-feed-label {
    color: #38bdf8 !important;
}
html.theme-dark .hero-feed-card,
html.theme-dark .hero-feed-card p,
html.theme-dark .hero-feed-card strong {
    color: #e2e8f0 !important;
    border-bottom-color: #334155 !important;
}
html.theme-dark .hero-feed-type {
    color: #94a3b8 !important;
}
html.theme-dark .hero-search-wrap input {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}
html.theme-dark .hero-secondary {
    color: #38bdf8 !important;
}
html.theme-dark .hero-trust {
    color: #94a3b8 !important;
}
html.theme-dark .section h2 {
    color: #f1f5f9 !important;
}
html.theme-dark .section-sub {
    color: #94a3b8 !important;
}
html.theme-dark .how-card {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}
html.theme-dark .how-card h3,
html.theme-dark .how-card p {
    color: #e2e8f0 !important;
}
html.theme-dark .spectrum-wrap {
    background: #1e293b !important;
    border-color: #334155 !important;
}
html.theme-dark .spectrum-title {
    color: #38bdf8 !important;
}
html.theme-dark .spectrum-desc,
html.theme-dark .spectrum-perf,
html.theme-dark .spectrum-factors {
    color: #cbd5e1 !important;
}
html.theme-dark .spectrum-labels {
    color: #94a3b8 !important;
}

/* Etfs, notifications, messages, connections – generic content */
html.theme-dark .content-area,
html.theme-dark .page-content {
    background: transparent !important;
    color: #e2e8f0 !important;
}

/* ETF page – top section, controls, table and symbol/name readability */
html.theme-dark .page-header,
html.theme-dark .controls {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    color: #f1f5f9 !important;
}
html.theme-dark .controls {
    border-radius: 8px;
    padding: 16px;
}
html.theme-dark .page-title {
    color: #f1f5f9 !important;
}
html.theme-dark .page-sub {
    color: #94a3b8 !important;
}
html.theme-dark .controls .control-group label,
html.theme-dark .control-group label {
    color: #e2e8f0 !important;
}
html.theme-dark .controls select,
html.theme-dark .control-group select {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}
html.theme-dark .slider-labels {
    color: #94a3b8 !important;
}
html.theme-dark .time-option,
html.theme-dark .time-horizon-options {
    color: #e2e8f0 !important;
}
html.theme-dark .time-option:hover {
    background: #334155 !important;
    color: #38bdf8 !important;
}
html.theme-dark .time-option.active {
    color: #38bdf8 !important;
    font-weight: 600;
}
html.theme-dark .time-horizon-slider {
    background: #334155 !important;
}
html.theme-dark .time-horizon-slider::-webkit-slider-thumb {
    background: #1e293b !important;
    border-color: #38bdf8 !important;
}
html.theme-dark .time-horizon-slider::-moz-range-thumb {
    background: #1e293b !important;
    border-color: #38bdf8 !important;
}
/* Top controls bar (fundamentals, valuation, sector) – dark background */
html.theme-dark .controls {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    color: #f1f5f9 !important;
}
html.theme-dark .time-option {
    color: #94a3b8 !important;
}
html.theme-dark .time-option:hover {
    background: #334155 !important;
    color: #38bdf8 !important;
}
html.theme-dark .time-option.active {
    color: #38bdf8 !important;
    font-weight: 600;
}
html.theme-dark .stocks-table {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
}
html.theme-dark .stocks-table thead {
    background: #0f172a !important;
    color: #e2e8f0 !important;
}
html.theme-dark .stocks-table tbody tr:hover {
    background: #334155 !important;
}
html.theme-dark .stocks-table .stock-symbol {
    color: #38bdf8 !important;
    font-weight: 600;
}
html.theme-dark .stocks-table .stock-name {
    color: #cbd5e1 !important;
}
html.theme-dark .stocks-table td {
    color: #e2e8f0 !important;
}
html.theme-dark .etf-loading {
    color: #94a3b8 !important;
}

/* Messages page */
html.theme-dark .room-list,
html.theme-dark .chat-panel {
    background: #1e293b !important;
    border-color: #334155 !important;
}
html.theme-dark .chat-messages {
    background: #0f172a !important;
}
html.theme-dark .chat-msg .body {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    color: #e2e8f0 !important;
}
html.theme-dark .chat-msg .body a {
    color: #38bdf8 !important;
}
html.theme-dark .chat-msg.mine .body {
    background: #334155 !important;
    color: #e2e8f0 !important;
}
html.theme-dark .chat-msg .who,
html.theme-dark .chat-msg .time {
    color: #94a3b8 !important;
}
html.theme-dark .chat-msg.bot .who {
    color: #fbbf24 !important;
}
html.theme-dark .chat-compose {
    background: #1e293b !important;
    border-top-color: #334155 !important;
}
html.theme-dark .chat-compose input {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}
html.theme-dark .chat-compose input::placeholder {
    color: #64748b;
}
html.theme-dark .chat-stock-card {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}
html.theme-dark .chat-stock-card .sym {
    color: #38bdf8 !important;
}
html.theme-dark .chat-stock-card .view-link {
    color: #38bdf8 !important;
}
html.theme-dark .empty-chat {
    color: #94a3b8 !important;
}
html.theme-dark .chat-welcome-card {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
    border-color: #334155 !important;
}
html.theme-dark .chat-welcome-card h3 {
    color: #38bdf8 !important;
}
html.theme-dark .chat-welcome-card p {
    color: #cbd5e1 !important;
}
html.theme-dark .room-list h3 {
    background: #0ea5e9 !important;
    color: #fff !important;
}
html.theme-dark .room-item {
    border-bottom-color: #334155 !important;
}
html.theme-dark .room-item:hover {
    background: #334155 !important;
}
html.theme-dark .room-item.active {
    background: rgba(14,165,233,0.2) !important;
}
html.theme-dark .chat-header {
    border-bottom-color: #334155 !important;
    color: #38bdf8 !important;
}
/* Chat message bubbles and compose – dark background, readable text */
html.theme-dark .chat-messages {
    background: #0f172a !important;
}
html.theme-dark .chat-msg .body {
    background: #1e293b !important;
    color: #e2e8f0 !important;
    border: 1px solid #334155 !important;
}
html.theme-dark .chat-msg.mine .body {
    background: #334155 !important;
    color: #e2e8f0 !important;
    border-color: #475569 !important;
}
html.theme-dark .chat-msg .body a {
    color: #38bdf8 !important;
}
html.theme-dark .chat-msg .who {
    color: #94a3b8 !important;
}
html.theme-dark .chat-msg.bot .who {
    color: #fbbf24 !important;
}
html.theme-dark .chat-msg .time {
    color: #64748b !important;
}
html.theme-dark .chat-compose {
    background: #1e293b !important;
    border-top-color: #334155 !important;
}
html.theme-dark .chat-compose input {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}
html.theme-dark .chat-compose input::placeholder {
    color: #64748b;
}
html.theme-dark .chat-stock-card {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}
html.theme-dark .chat-stock-card .sym {
    color: #38bdf8 !important;
}
html.theme-dark .chat-stock-card .view-link {
    color: #38bdf8 !important;
}
html.theme-dark .chat-stock-wl-btn {
    background: #334155 !important;
    border-color: #475569 !important;
    color: #38bdf8 !important;
}
html.theme-dark .chat-welcome-card {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
    border-color: #334155 !important;
}
html.theme-dark .chat-welcome-card h3 {
    color: #38bdf8 !important;
}
html.theme-dark .chat-welcome-card p {
    color: #cbd5e1 !important;
}
html.theme-dark .empty-chat {
    color: #94a3b8 !important;
}
html.theme-dark .notif.unread {
    background: #334155 !important;
}
html.theme-dark .notif strong,
html.theme-dark .notif .body {
    color: #e2e8f0 !important;
}
html.theme-dark .notif .time {
    color: #94a3b8 !important;
}

/* Economy War Room */
html.theme-dark .warroom-header h1,
html.theme-dark .section-title {
    color: #38bdf8 !important;
}
html.theme-dark .warroom-header p {
    color: #94a3b8 !important;
}
/* FX card: pair labels (USD/CAD, CAD/USD) and rate values must be clearly visible in dark mode */
html.theme-dark .fx-pair {
    color: #f1f5f9 !important;
}
html.theme-dark .insight-card {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
    border: 1px solid #334155 !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3) !important;
}
html.theme-dark .metric-card {
    background: #1e293b !important;
    border-color: #334155 !important;
}
html.theme-dark .metric-card .label {
    color: #94a3b8 !important;
}
html.theme-dark .metric-card .value {
    color: #f1f5f9 !important;
}
html.theme-dark .metric-card .spark-wrap,
html.theme-dark .metric-card .spark-svg {
    color: #38bdf8 !important;
}
/* FX: pair labels and rate values clearly visible on dark background */
html.theme-dark .fx-card {
    background: #1e293b !important;
    border-color: #334155 !important;
}
html.theme-dark .fx-card h3,
html.theme-dark .fx-card .fx-card-title {
    color: #38bdf8 !important;
}
html.theme-dark .fx-pair {
    color: #f1f5f9 !important;
}
html.theme-dark .fx-rate {
    color: #7dd3fc !important;
}
html.theme-dark .compare-card {
    background: #1e293b !important;
    border-color: #334155 !important;
}
html.theme-dark .compare-card h3 {
    color: #38bdf8 !important;
}
html.theme-dark .compare-table .val {
    color: #f1f5f9 !important;
}

/* Connections page */
html.theme-dark .main-content-sidebar li {
    border-bottom-color: #334155 !important;
}
html.theme-dark .main-content-sidebar .un {
    color: #38bdf8 !important;
}
html.theme-dark .main-content-sidebar .empty {
    color: #94a3b8 !important;
}

/* Notifications page */
html.theme-dark .notif {
    border-bottom-color: #334155 !important;
}
html.theme-dark .empty {
    color: #94a3b8 !important;
}

/* Blog / Discover page – dark mode */
html.theme-dark .discover-hero h1 {
    color: #f1f5f9 !important;
}
html.theme-dark .discover-hero p {
    color: #cbd5e1 !important;
}
html.theme-dark .article-card {
    background: #1e293b !important;
    border-color: #334155 !important;
}
html.theme-dark .article-card:hover {
    border-color: #0ea5e9 !important;
    box-shadow: 0 4px 16px rgba(14,165,233,0.15) !important;
}
html.theme-dark .article-card-cat {
    color: #38bdf8 !important;
}
html.theme-dark .article-card-date,
html.theme-dark .article-card-read {
    color: #94a3b8 !important;
}
html.theme-dark .article-card-title {
    color: #f1f5f9 !important;
}
html.theme-dark .article-card-excerpt {
    color: #cbd5e1 !important;
}
html.theme-dark .blog-footer {
    background: #0f172a !important;
    border-top-color: #334155 !important;
    color: #94a3b8 !important;
}
html.theme-dark .blog-footer a {
    color: #38bdf8 !important;
}
html.theme-dark .blog-footer .footer-copyright {
    color: #94a3b8 !important;
}

/* Blog article page – article body in dark mode (match main site font and MMM-style cards) */
/* Override CSS variables so any rule using var(--text-*) in blog-styles resolves to light text (fixes mobile/blog_content) */
html.theme-dark .article-wrapper {
    --text-primary: #f8fafc;
    --text-secondary: #f1f5f9;
    --text-muted: #cbd5e1;
    --surface-0: #0f172a;
    --surface-1: #1e293b;
    --surface-2: #334155;
    --border: #334155;
    /* Brand colors visible on dark (blog_content zone-labels etc.) */
    --brand-primary: #38bdf8;
    --brand-green: #4ade80;
    --brand-amber: #fbbf24;
    --brand-accent: #f87171;
}
/* Override inline color in blog_content so dark mode always wins (incl. mobile) */
html.theme-dark .article-wrapper p[style*="color"],
html.theme-dark .article-wrapper [style*="color"].zone-label {
    color: #f1f5f9 !important;
}
html.theme-dark .article-wrapper .zone-label {
    color: #cbd5e1 !important;
}
/* Base and body text: high contrast so text never blends or looks like "holes" */
html.theme-dark .article-wrapper {
    color: #f1f5f9 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}
html.theme-dark .article-wrapper h1,
html.theme-dark .article-wrapper h2,
html.theme-dark .article-wrapper h3 {
    color: #f8fafc !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}
html.theme-dark .article-wrapper p,
html.theme-dark .article-wrapper li {
    color: #f1f5f9 !important;
}
html.theme-dark .article-wrapper strong {
    color: #f8fafc !important;
}
html.theme-dark .article-wrapper em {
    color: #e2e8f0 !important;
}
html.theme-dark .article-wrapper a {
    color: #7dd3fc !important;
}
html.theme-dark .article-wrapper a:hover {
    color: #bae6fd !important;
}
html.theme-dark .article-wrapper .article-meta,
html.theme-dark .article-wrapper .article-date,
html.theme-dark .article-wrapper .article-read-time {
    color: #94a3b8 !important;
}
html.theme-dark .article-wrapper .article-category {
    color: #38bdf8 !important;
}
html.theme-dark .article-wrapper .article-title {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    color: #f8fafc !important;
}
html.theme-dark .article-wrapper .article-subtitle {
    color: #f1f5f9 !important;
    border-left-color: #0ea5e9 !important;
}
html.theme-dark .article-wrapper .callout {
    background: #1e293b !important;
    border-color: #334155 !important;
}
html.theme-dark .article-wrapper .callout p {
    color: #f1f5f9 !important;
}
/* Callout labels – high contrast so "Why this matters" etc. are readable */
html.theme-dark .article-wrapper .callout-label,
html.theme-dark .article-wrapper .callout-label.accent {
    color: #7dd3fc !important;
}
html.theme-dark .article-wrapper .callout-label.green {
    color: #4ade80 !important;
}
html.theme-dark .article-wrapper .callout-label.amber {
    color: #fbbf24 !important;
}
html.theme-dark .article-wrapper .inline-cta {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
    border-color: #334155 !important;
}
html.theme-dark .article-wrapper .inline-cta h3 {
    color: #f1f5f9 !important;
}
html.theme-dark .article-wrapper .inline-cta p,
html.theme-dark .article-wrapper .cta-sub {
    color: #f1f5f9 !important;
}
html.theme-dark .article-wrapper .comparison-table th,
html.theme-dark .article-wrapper .comparison-table td {
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}
html.theme-dark .article-wrapper .comparison-table th {
    background: #0f172a !important;
}
/* MMM-style cards: slightly lighter panel (#2A303F), subtle border */
html.theme-dark .article-wrapper .feed-card,
html.theme-dark .article-wrapper .signal-example,
html.theme-dark .article-wrapper .bubble-illustration {
    background: #2a303f !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
    border-radius: 12px !important;
}
html.theme-dark .article-wrapper .signal-header,
html.theme-dark .article-wrapper .signal-ticker {
    color: #f1f5f9 !important;
}
/* Signal example inner text (confidence line) – ensure readable */
html.theme-dark .article-wrapper .signal-example p {
    color: #e2e8f0 !important;
}
html.theme-dark .article-wrapper .signal-badge.buy {
    background: rgba(34,197,94,0.2) !important;
    color: #4ade80 !important;
    border-color: rgba(34,197,94,0.4) !important;
}
html.theme-dark .article-wrapper .factor-item {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}
html.theme-dark .article-wrapper .factor-group-title.support {
    color: #4ade80 !important;
}
html.theme-dark .article-wrapper .factor-group-title.pressure {
    color: #f87171 !important;
}
/* Feed cards in articles (e.g. personalized feed article) */
html.theme-dark .article-wrapper .feed-card .feed-type {
    color: #7dd3fc !important;
}
html.theme-dark .article-wrapper .feed-card .feed-text {
    color: #f1f5f9 !important;
}
html.theme-dark .article-wrapper .feed-card .feed-text strong {
    color: #f8fafc !important;
}
html.theme-dark .article-wrapper .feed-card .feed-text em {
    color: #e2e8f0 !important;
}

/* Bubble illustration and heatmap labels in articles */
html.theme-dark .article-wrapper .bubble-x-label,
html.theme-dark .article-wrapper .bubble-y-label,
html.theme-dark .article-wrapper .zone-label {
    color: #cbd5e1 !important;
}
html.theme-dark .article-wrapper .hm-flat {
    color: #e2e8f0 !important;
}
html.theme-dark .article-wrapper .heatmap-label {
    color: #e2e8f0 !important;
}
html.theme-dark .article-wrapper .signal-badge.sell {
    background: rgba(248,113,113,0.2) !important;
    color: #f87171 !important;
    border-color: rgba(248,113,113,0.4) !important;
}
html.theme-dark .article-wrapper .signal-badge.hold {
    background: rgba(251,191,36,0.2) !important;
    color: #fbbf24 !important;
    border-color: rgba(251,191,36,0.4) !important;
}
/* Heatmap demo in blog_content (sector-rotation etc.) – text readable on dark */
html.theme-dark .article-wrapper .heatmap-demo .heatmap-cell {
    color: #f1f5f9 !important;
}
html.theme-dark .article-wrapper .heatmap-label {
    color: rgba(255,255,255,0.9) !important;
}

/* Blog nav – live search dropdown (dark) */
html.theme-dark .nav-search .search-res {
    position: absolute !important;
    left: 0;
    right: 0;
    top: 100%;
    margin-top: 6px;
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    border-radius: 10px !important;
    box-shadow: 0 8px 24px rgba(0,0,0,.4) !important;
    max-height: 280px;
    overflow-y: auto;
    z-index: 50;
    display: none;
}
html.theme-dark .nav-search .search-res.show {
    display: block !important;
}
html.theme-dark .nav-search .search-res .item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #334155 !important;
    color: #e2e8f0 !important;
}
html.theme-dark .nav-search .search-res .item:hover {
    background: #334155 !important;
}
html.theme-dark .nav-search .search-res .sym {
    font-weight: 600;
    color: #38bdf8 !important;
}
html.theme-dark .nav-search .search-res .name {
    color: #94a3b8 !important;
}

/* Blog (Discover + article pages) – ensure dark mode text/background on mobile (same as desktop) */
@media (max-width: 768px) {
    html.theme-dark body {
        background: #0f172a !important;
        color: #f1f5f9 !important;
    }
    /* Blog header and mobile nav panel – dark so text is readable */
    html.theme-dark .site-header {
        background: #1e293b !important;
    }
    html.theme-dark .nav-panel {
        background: #1e293b !important;
        border-top: 1px solid #334155 !important;
    }
    html.theme-dark .nav-panel a {
        color: #e2e8f0 !important;
    }
    html.theme-dark .nav-panel a:hover {
        color: #38bdf8 !important;
    }
    html.theme-dark .nav-panel .nav-search input {
        background: #0f172a !important;
        border-color: #334155 !important;
        color: #f1f5f9 !important;
    }
    html.theme-dark .nav-panel .nav-search input::placeholder {
        color: #64748b !important;
    }
    html.theme-dark .nav-toggle-icon span {
        background: #f1f5f9 !important;
    }
    /* Discover index – hero and cards */
    html.theme-dark .discover-hero h1 {
        color: #f1f5f9 !important;
    }
    html.theme-dark .discover-hero p {
        color: #cbd5e1 !important;
    }
    html.theme-dark .article-card {
        background: #1e293b !important;
        border-color: #334155 !important;
    }
    html.theme-dark .article-card-cat {
        color: #38bdf8 !important;
    }
    html.theme-dark .article-card-date,
    html.theme-dark .article-card-read {
        color: #94a3b8 !important;
    }
    html.theme-dark .article-card-title {
        color: #f1f5f9 !important;
    }
    html.theme-dark .article-card-excerpt {
        color: #cbd5e1 !important;
    }
    html.theme-dark .blog-footer {
        background: #0f172a !important;
        border-top-color: #334155 !important;
        color: #94a3b8 !important;
    }
    html.theme-dark .blog-footer a {
        color: #38bdf8 !important;
    }
    /* Blog article page – article body (text over background), incl. blog_content */
    html.theme-dark .article-wrapper {
        --text-primary: #f8fafc;
        --text-secondary: #f1f5f9;
        --text-muted: #cbd5e1;
        --brand-primary: #38bdf8;
        --brand-green: #4ade80;
        --brand-amber: #fbbf24;
        --brand-accent: #f87171;
        color: #f1f5f9 !important;
    }
    html.theme-dark .article-wrapper p[style*="color"],
    html.theme-dark .article-wrapper [style*="color"].zone-label {
        color: #f1f5f9 !important;
    }
    html.theme-dark .article-wrapper .zone-label {
        color: #cbd5e1 !important;
    }
    html.theme-dark .article-wrapper h1,
    html.theme-dark .article-wrapper h2,
    html.theme-dark .article-wrapper h3 {
        color: #f8fafc !important;
    }
    html.theme-dark .article-wrapper p,
    html.theme-dark .article-wrapper li {
        color: #f1f5f9 !important;
    }
    html.theme-dark .article-wrapper strong {
        color: #f8fafc !important;
    }
    html.theme-dark .article-wrapper em {
        color: #e2e8f0 !important;
    }
    html.theme-dark .article-wrapper a {
        color: #7dd3fc !important;
    }
    html.theme-dark .article-wrapper .article-meta,
    html.theme-dark .article-wrapper .article-date,
    html.theme-dark .article-wrapper .article-read-time {
        color: #94a3b8 !important;
    }
    html.theme-dark .article-wrapper .article-category {
        color: #38bdf8 !important;
    }
    html.theme-dark .article-wrapper .article-title {
        color: #f8fafc !important;
    }
    html.theme-dark .article-wrapper .article-subtitle {
        color: #f1f5f9 !important;
        border-left-color: #0ea5e9 !important;
    }
    html.theme-dark .article-wrapper .callout {
        background: #1e293b !important;
        border-color: #334155 !important;
    }
    html.theme-dark .article-wrapper .callout p {
        color: #f1f5f9 !important;
    }
    html.theme-dark .article-wrapper .callout-label,
    html.theme-dark .article-wrapper .callout-label.accent {
        color: #7dd3fc !important;
    }
    html.theme-dark .article-wrapper .callout-label.green {
        color: #4ade80 !important;
    }
    html.theme-dark .article-wrapper .callout-label.amber {
        color: #fbbf24 !important;
    }
    html.theme-dark .article-wrapper .inline-cta {
        background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
        border-color: #334155 !important;
    }
    html.theme-dark .article-wrapper .inline-cta h3,
    html.theme-dark .article-wrapper .inline-cta p,
    html.theme-dark .article-wrapper .cta-sub {
        color: #f1f5f9 !important;
    }
    html.theme-dark .article-wrapper .comparison-table th,
    html.theme-dark .article-wrapper .comparison-table td {
        border-color: #334155 !important;
        color: #f1f5f9 !important;
    }
    html.theme-dark .article-wrapper .comparison-table th {
        background: #0f172a !important;
    }
    html.theme-dark .article-wrapper .feed-card,
    html.theme-dark .article-wrapper .signal-example,
    html.theme-dark .article-wrapper .bubble-illustration {
        background: #2a303f !important;
        border: 1px solid rgba(255,255,255,0.08) !important;
    }
    html.theme-dark .article-wrapper .signal-header,
    html.theme-dark .article-wrapper .signal-ticker,
    html.theme-dark .article-wrapper .signal-example p {
        color: #f1f5f9 !important;
    }
    html.theme-dark .article-wrapper .signal-badge.buy {
        background: rgba(34,197,94,0.2) !important;
        color: #4ade80 !important;
    }
    html.theme-dark .article-wrapper .signal-badge.sell {
        background: rgba(248,113,113,0.2) !important;
        color: #f87171 !important;
    }
    html.theme-dark .article-wrapper .signal-badge.hold {
        background: rgba(251,191,36,0.2) !important;
        color: #fbbf24 !important;
    }
    html.theme-dark .article-wrapper .factor-item {
        background: #1e293b !important;
        border-color: #334155 !important;
        color: #f1f5f9 !important;
    }
    html.theme-dark .article-wrapper .factor-group-title.support {
        color: #4ade80 !important;
    }
    html.theme-dark .article-wrapper .factor-group-title.pressure {
        color: #f87171 !important;
    }
    html.theme-dark .article-wrapper .feed-card .feed-type {
        color: #7dd3fc !important;
    }
    html.theme-dark .article-wrapper .feed-card .feed-text,
    html.theme-dark .article-wrapper .feed-card .feed-text strong,
    html.theme-dark .article-wrapper .feed-card .feed-text em {
        color: #f1f5f9 !important;
    }
    html.theme-dark .article-wrapper .bubble-x-label,
    html.theme-dark .article-wrapper .bubble-y-label,
    html.theme-dark .article-wrapper .zone-label,
    html.theme-dark .article-wrapper .hm-flat,
    html.theme-dark .article-wrapper .heatmap-label {
        color: #e2e8f0 !important;
    }
    html.theme-dark .article-wrapper .heatmap-demo .heatmap-cell {
        color: #f1f5f9 !important;
    }
    html.theme-dark .article-wrapper .heatmap-demo .heatmap-label {
        color: rgba(255,255,255,0.9) !important;
    }
}
