/* ========== COLOR THEMES — Spectral (default) & Daylight ========== */

html.theme-spectral {
  color-scheme: dark;
  --theme-bg: #0c1018;
  --theme-text: #e4e6ec;
  --theme-text-muted: #a8b0be;
  --theme-text-dim: #7a8494;
  --theme-text-faint: #8a929e;
  --theme-text-subtle: #5c6470;
  --theme-nature-bg: #0c1424;
  --theme-overlay: rgba(8, 14, 28, 0.78);
  --theme-overlay-classic: rgba(8, 14, 28, 0.78);
  --theme-overlay-immersive: rgba(8, 14, 28, 0.54);
  --theme-header-bg: rgba(8, 14, 32, 0.92);
  --theme-header-bg-immersive: rgba(8, 14, 32, 0.72);
  --theme-surface: rgba(14, 22, 44, 0.94);
  --theme-card: var(--theme-surface);
  --theme-card-alt: rgba(18, 26, 50, 0.88);
  --theme-card-immersive: rgba(14, 22, 44, 0.74);
  --theme-card-immersive-log: rgba(14, 22, 44, 0.74);
  --theme-etf-card: var(--theme-surface);
  --theme-etf-card-immersive: var(--theme-card-immersive);
  --theme-row-green-bg: rgba(0, 191, 165, 0.12);
  --theme-row-gold-bg: rgba(245, 200, 66, 0.10);
  --theme-border: rgba(232, 200, 120, 0.16);
  --theme-border-gold: rgba(232, 200, 120, 0.32);
  --theme-border-subtle: rgba(46, 58, 90, 0.38);
  --theme-border-row: rgba(46, 58, 90, 0.26);
  --theme-input-bg: rgba(12, 16, 28, 0.85);
  --theme-input-text: #e4e6ec;
  --theme-input-border: #343f58;
  --theme-select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23e0c878' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  --theme-table-head-bg: rgb(18, 26, 48);
  --theme-table-head-text: #dcc878;
  --theme-table-row-even: rgba(12, 20, 40, 0.50);
  --theme-table-row-odd: rgba(16, 24, 48, 0.50);
  --theme-table-row-even-immersive: rgba(12, 20, 40, 0.46);
  --theme-table-row-odd-immersive: rgba(16, 24, 48, 0.44);
  --theme-stat-bg: rgba(255, 255, 255, 0.025);
  --theme-stat-text: #d8dce4;
  --theme-stat-divider: rgba(255, 255, 255, 0.04);
  --theme-sort-btn-bg: rgba(255, 255, 255, 0.03);
  --theme-sort-btn-border: rgba(255, 255, 255, 0.08);
  --theme-sort-btn-text: #a8b0be;
  --theme-modal-bg: rgba(8, 14, 32, 0.96);
  --theme-help-bg: var(--theme-surface);
  --theme-action-btn-bg: var(--theme-surface);
  --theme-pay-sched-day-bg: rgba(255, 255, 255, 0.03);
  --theme-pay-sched-day-border: rgba(46, 58, 90, 0.32);
  --theme-pay-sched-day-today-bg: rgba(0, 191, 165, 0.08);
  --theme-pay-sched-day-today-border: rgba(77, 184, 168, 0.24);
  --theme-pay-sched-day-soon-bg: rgba(245, 200, 66, 0.06);
  --theme-pay-sched-day-soon-border: rgba(232, 200, 120, 0.20);
  --theme-goal-bar-track: rgba(255, 255, 255, 0.06);
  --theme-goal-stat-bg: rgba(255, 255, 255, 0.03);
  --theme-goal-stat-border: rgba(232, 200, 120, 0.22);
  --theme-hero-panel: rgba(10, 16, 34, 0.98);
  --theme-hero-band: #0c1424;
  --theme-page-head-bg: #101828;
  --theme-on-accent: #0c1018;
  --theme-toolbar-btn-color: var(--theme-accent-gold);
  --theme-toolbar-btn-bg: color-mix(in srgb, var(--theme-accent-gold) 12%, transparent);
  --theme-toolbar-btn-border: color-mix(in srgb, var(--theme-accent-gold) 28%, transparent);
  --theme-toolbar-btn-bg-hover: color-mix(in srgb, var(--theme-accent-gold) 20%, transparent);
  --theme-toolbar-btn-border-hover: color-mix(in srgb, var(--theme-accent-gold) 40%, transparent);
  --theme-accent-gold: #dcc878;
  --theme-accent-teal: #5ec4b6;
  --theme-accent-green: #6ecf96;
  --theme-accent-red: #e07080;
  --theme-brand-text: #e8eaef;
  --theme-brand-sub: #a8b0be;
  --theme-footer-muted: #7a8494;
  --theme-footer-bg: rgba(10, 16, 34, 0.97);
  --theme-footer-border: rgba(232, 200, 120, 0.10);
  --theme-footer-shadow: 0 -8px 32px rgba(0, 0, 0, 0.40);
  --theme-footer-link: #a8b0be;
  --theme-footer-photo: rgba(255, 255, 255, 0.22);
  --theme-shadow: none;
  --navy-bg: var(--theme-bg);
  --navy-card: #161c30;
  --navy-card-alt: #1c243c;
  --navy-border: #343f58;
  --gold: var(--theme-accent-gold);
  --teal: var(--theme-accent-teal);
  --white: var(--theme-text);
  --red: var(--theme-accent-red);
  --green: var(--theme-accent-green);
  --glass-bg: rgba(14, 22, 44, 0.88);
  --glass-card: rgba(14, 22, 44, 0.85);
  --glass-card-alt: var(--theme-card-alt);
  --glass-border: rgba(232, 200, 120, 0.18);
  --glass-table: rgba(10, 16, 34, 0.82);
  --glass-header: var(--theme-header-bg);
  --glass-modal: var(--theme-modal-bg);
}

/* Spectral + glass pane — softer dividers and less wallpaper bleed */
html.theme-spectral.wallpaper-layout-immersive {
  --theme-immersive-row-divider: rgba(232, 200, 120, 0.28);
  --theme-immersive-row-divider-shadow: rgba(0, 0, 0, 0.22);
  --theme-immersive-row-base: rgba(0, 0, 0, 0.16);
  --theme-immersive-row-alt: rgba(0, 0, 0, 0.22);
  --theme-immersive-row-hover: rgba(0, 0, 0, 0.28);
  --theme-immersive-chip-bg: rgba(8, 14, 30, 0.82);
  --theme-immersive-chip-border: rgba(232, 200, 120, 0.22);
}

html.theme-spectral.wallpaper-layout-immersive .card,
html.theme-spectral.wallpaper-layout-immersive .log-holdings.card,
html.theme-spectral.wallpaper-layout-immersive .etf-totals-bar,
html.theme-spectral.wallpaper-layout-immersive .etf-totals-card,
html.theme-spectral.wallpaper-layout-immersive .refresh-progress-panel,
html.theme-spectral.wallpaper-layout-immersive .summary-card {
  backdrop-filter: blur(18px) saturate(0.88);
  -webkit-backdrop-filter: blur(18px) saturate(0.88);
}

html.theme-daylight {
  color-scheme: light;
  /* Soft blue-gray base — avoids near-white glare */
  --theme-bg: #c8d0dc;
  --theme-text: #1e293b;
  --theme-text-muted: #5c6b7f;
  --theme-text-dim: #4a5568;
  --theme-text-faint: #5c6b7f;
  --theme-text-subtle: #7b8798;
  --theme-nature-bg: #b8c2d0;
  --theme-overlay: rgba(200, 208, 220, 0.82);
  --theme-overlay-classic: rgba(200, 208, 220, 0.82);
  --theme-overlay-immersive: rgba(196, 204, 216, 0.68);
  --theme-header-bg: rgba(210, 218, 228, 0.94);
  --theme-header-bg-immersive: rgba(205, 214, 225, 0.56);
  --theme-surface: rgba(224, 230, 238, 0.97);
  --theme-card: var(--theme-surface);
  --theme-card-alt: rgba(216, 224, 234, 0.98);
  --theme-card-immersive: rgba(214, 222, 232, 0.56);
  --theme-card-immersive-log: rgba(214, 222, 232, 0.56);
  --theme-etf-card: var(--theme-surface);
  --theme-etf-card-immersive: var(--theme-card-immersive);
  --theme-row-green-bg: rgba(21, 128, 61, 0.10);
  --theme-row-gold-bg: rgba(154, 114, 9, 0.10);
  --theme-border: rgba(15, 23, 42, 0.14);
  --theme-border-gold: rgba(184, 134, 11, 0.32);
  --theme-border-subtle: rgba(15, 23, 42, 0.14);
  --theme-border-row: rgba(15, 23, 42, 0.10);
  --theme-input-bg: #dce3ec;
  --theme-input-text: #1e293b;
  --theme-input-border: #a8b4c4;
  --theme-select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231e293b' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  --theme-table-head-bg: #b8c4d4;
  --theme-table-head-text: #9a7209;
  --theme-table-row-even: rgba(208, 216, 228, 0.92);
  --theme-table-row-odd: rgba(218, 226, 236, 0.95);
  --theme-table-row-even-immersive: rgba(206, 214, 226, 0.52);
  --theme-table-row-odd-immersive: rgba(214, 222, 232, 0.50);
  --theme-stat-bg: rgba(15, 23, 42, 0.06);
  --theme-stat-text: #3d4a5c;
  --theme-stat-divider: rgba(15, 23, 42, 0.10);
  --theme-sort-btn-bg: rgba(214, 222, 232, 0.95);
  --theme-sort-btn-border: rgba(15, 23, 42, 0.14);
  --theme-sort-btn-text: #5c6b7f;
  --theme-modal-bg: rgba(214, 222, 232, 0.98);
  --theme-help-bg: var(--theme-surface);
  --theme-action-btn-bg: var(--theme-surface);
  --theme-pay-sched-day-bg: rgba(15, 23, 42, 0.06);
  --theme-pay-sched-day-border: rgba(15, 23, 42, 0.14);
  --theme-pay-sched-day-today-bg: rgba(0, 110, 92, 0.10);
  --theme-pay-sched-day-today-border: rgba(0, 110, 92, 0.28);
  --theme-pay-sched-day-soon-bg: rgba(154, 114, 9, 0.10);
  --theme-pay-sched-day-soon-border: rgba(184, 134, 11, 0.28);
  --theme-goal-bar-track: rgba(15, 23, 42, 0.10);
  --theme-goal-stat-bg: rgba(15, 23, 42, 0.05);
  --theme-goal-stat-border: rgba(15, 23, 42, 0.10);
  --theme-hero-panel: rgba(210, 218, 228, 0.98);
  --theme-hero-band: #b8c2d0;
  --theme-page-head-bg: #dce4ee;
  --theme-on-accent: #1e293b;
  --theme-toolbar-btn-color: var(--theme-accent-gold);
  --theme-toolbar-btn-bg: color-mix(in srgb, var(--theme-accent-gold) 12%, transparent);
  --theme-toolbar-btn-border: color-mix(in srgb, var(--theme-accent-gold) 32%, transparent);
  --theme-toolbar-btn-bg-hover: color-mix(in srgb, var(--theme-accent-gold) 20%, transparent);
  --theme-toolbar-btn-border-hover: color-mix(in srgb, var(--theme-accent-gold) 45%, transparent);
  --theme-accent-gold: #9a7209;
  --theme-accent-teal: #006e5c;
  --theme-accent-green: #15803d;
  --theme-accent-red: #dc2626;
  --theme-brand-text: #1e293b;
  --theme-brand-sub: #5c6b7f;
  --theme-footer-muted: #5c6b7f;
  --theme-footer-bg: rgba(188, 198, 212, 0.98);
  --theme-footer-border: rgba(15, 23, 42, 0.14);
  --theme-footer-shadow: 0 -4px 20px rgba(15, 23, 42, 0.08);
  --theme-footer-link: #5c6b7f;
  --theme-footer-photo: rgba(30, 41, 59, 0.45);
  --theme-shadow: 0 1px 4px rgba(15, 23, 42, 0.10);
  --navy-bg: var(--theme-bg);
  --navy-card: #dce3ec;
  --navy-card-alt: #d4dce8;
  --navy-border: #a8b4c4;
  --gold: var(--theme-accent-gold);
  --teal: var(--theme-accent-teal);
  --white: var(--theme-text);
  --red: var(--theme-accent-red);
  --green: var(--theme-accent-green);
  --glass-bg: rgba(214, 222, 232, 0.94);
  --glass-card: rgba(220, 228, 238, 0.96);
  --glass-card-alt: var(--theme-card-alt);
  --glass-border: rgba(15, 23, 42, 0.12);
  --glass-table: rgba(216, 224, 234, 0.96);
  --glass-header: var(--theme-header-bg);
  --glass-modal: var(--theme-modal-bg);
}

/* --- Ember: warm charcoal + copper (evening dark) --- */
html.theme-ember {
  color-scheme: dark;
  --theme-bg: #12100e;
  --theme-text: #f2ebe4;
  --theme-text-muted: #a89888;
  --theme-text-dim: #8a7868;
  --theme-text-faint: #9a8878;
  --theme-text-subtle: #6a5a4a;
  --theme-nature-bg: #1a1510;
  --theme-overlay: rgba(18, 12, 8, 0.74);
  --theme-overlay-classic: rgba(18, 12, 8, 0.74);
  --theme-overlay-immersive: rgba(22, 14, 10, 0.42);
  --theme-header-bg: rgba(22, 16, 12, 0.92);
  --theme-header-bg-immersive: rgba(26, 18, 14, 0.56);
  --theme-surface: rgba(32, 24, 18, 0.94);
  --theme-card: var(--theme-surface);
  --theme-card-alt: rgba(38, 28, 22, 0.88);
  --theme-card-immersive: rgba(38, 28, 20, 0.56);
  --theme-card-immersive-log: rgba(34, 26, 18, 0.56);
  --theme-etf-card: var(--theme-surface);
  --theme-etf-card-immersive: var(--theme-card-immersive);
  --theme-row-green-bg: rgba(125, 206, 130, 0.14);
  --theme-row-gold-bg: rgba(232, 147, 74, 0.14);
  --theme-border: rgba(232, 147, 74, 0.14);
  --theme-border-gold: rgba(232, 147, 74, 0.28);
  --theme-border-subtle: rgba(120, 90, 70, 0.45);
  --theme-border-row: rgba(90, 70, 55, 0.35);
  --theme-input-bg: rgba(22, 16, 12, 0.85);
  --theme-input-text: #f2ebe4;
  --theme-input-border: #4a3828;
  --theme-select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23e8934a' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  --theme-table-head-bg: rgb(42, 30, 22);
  --theme-table-head-text: #e8934a;
  --theme-table-row-even: rgba(28, 20, 14, 0.58);
  --theme-table-row-odd: rgba(34, 26, 18, 0.55);
  --theme-table-row-even-immersive: rgba(30, 22, 16, 0.52);
  --theme-table-row-odd-immersive: rgba(36, 28, 20, 0.50);
  --theme-stat-bg: rgba(255, 220, 180, 0.04);
  --theme-stat-text: #e8dcd0;
  --theme-stat-divider: rgba(255, 220, 180, 0.06);
  --theme-sort-btn-bg: rgba(255, 220, 180, 0.05);
  --theme-sort-btn-border: rgba(255, 220, 180, 0.12);
  --theme-sort-btn-text: #a89888;
  --theme-modal-bg: rgba(22, 16, 12, 0.97);
  --theme-help-bg: var(--theme-surface);
  --theme-action-btn-bg: var(--theme-surface);
  --theme-pay-sched-day-bg: rgba(255, 220, 180, 0.06);
  --theme-pay-sched-day-border: rgba(120, 90, 70, 0.35);
  --theme-pay-sched-day-today-bg: rgba(107, 201, 184, 0.12);
  --theme-pay-sched-day-today-border: rgba(107, 201, 184, 0.32);
  --theme-pay-sched-day-soon-bg: rgba(232, 147, 74, 0.10);
  --theme-pay-sched-day-soon-border: rgba(232, 147, 74, 0.28);
  --theme-hero-panel: rgba(20, 14, 10, 0.98);
  --theme-hero-band: #1a1510;
  --theme-page-head-bg: #1c140e;
  --theme-on-accent: #12100e;
  --theme-toolbar-btn-color: var(--theme-accent-gold);
  --theme-toolbar-btn-bg: color-mix(in srgb, var(--theme-accent-gold) 15%, transparent);
  --theme-toolbar-btn-border: color-mix(in srgb, var(--theme-accent-gold) 35%, transparent);
  --theme-toolbar-btn-bg-hover: color-mix(in srgb, var(--theme-accent-gold) 25%, transparent);
  --theme-toolbar-btn-border-hover: color-mix(in srgb, var(--theme-accent-gold) 50%, transparent);
  --theme-accent-gold: #e8934a;
  --theme-accent-teal: #6bc9b8;
  --theme-accent-green: #7dce82;
  --theme-accent-red: #e86a5a;
  --theme-brand-text: #f2ebe4;
  --theme-brand-sub: #a89888;
  --theme-footer-muted: #8a7868;
  --theme-footer-bg: rgba(22, 16, 12, 0.98);
  --theme-footer-border: rgba(232, 147, 74, 0.16);
  --theme-footer-shadow: 0 -8px 28px rgba(0, 0, 0, 0.50);
  --theme-footer-link: #a89888;
  --theme-footer-photo: rgba(242, 235, 228, 0.28);
  --theme-shadow: none;
  --navy-bg: var(--theme-bg);
  --navy-card: #201810;
  --navy-card-alt: #281e16;
  --navy-border: #4a3828;
  --gold: var(--theme-accent-gold);
  --teal: var(--theme-accent-teal);
  --white: var(--theme-text);
  --red: var(--theme-accent-red);
  --green: var(--theme-accent-green);
  --glass-bg: rgba(32, 24, 18, 0.88);
  --glass-card: rgba(32, 24, 18, 0.85);
  --glass-card-alt: var(--theme-card-alt);
  --glass-border: rgba(232, 147, 74, 0.18);
  --glass-table: rgba(22, 16, 12, 0.82);
  --glass-header: var(--theme-header-bg);
  --glass-modal: var(--theme-modal-bg);
}

/* --- Canopy: forest green + moss (nature dark) --- */
html.theme-canopy {
  color-scheme: dark;
  --theme-canopy-green: #5db88a;
  --theme-bg: #0a120e;
  --theme-text: #e8f0ea;
  --theme-text-muted: #8fa898;
  --theme-text-dim: #6a8070;
  --theme-text-faint: #7a9080;
  --theme-text-subtle: #4a6050;
  --theme-nature-bg: #0c1610;
  --theme-overlay: rgba(8, 20, 14, 0.74);
  --theme-overlay-classic: rgba(8, 20, 14, 0.74);
  --theme-overlay-immersive: rgba(10, 24, 16, 0.40);
  --theme-header-bg: rgba(10, 22, 16, 0.92);
  --theme-header-bg-immersive: rgba(12, 26, 18, 0.56);
  --theme-surface: rgba(14, 28, 22, 0.94);
  --theme-card: var(--theme-surface);
  --theme-card-alt: var(--theme-surface);
  --theme-card-immersive: rgba(14, 28, 22, 0.56);
  --theme-card-immersive-log: rgba(14, 28, 22, 0.56);
  --theme-etf-card: var(--theme-surface);
  --theme-etf-card-immersive: var(--theme-card-immersive);
  --theme-row-green-bg: var(--theme-surface);
  --theme-row-gold-bg: var(--theme-surface);
  --theme-border: rgba(93, 184, 138, 0.14);
  --theme-border-gold: rgba(93, 184, 138, 0.25);
  --theme-border-subtle: rgba(60, 100, 80, 0.45);
  --theme-border-row: rgba(50, 80, 65, 0.35);
  --theme-input-bg: rgba(10, 20, 14, 0.85);
  --theme-input-text: #e8f0ea;
  --theme-input-border: #2a4a38;
  --theme-select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235db88a' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  --theme-table-head-bg: rgb(18, 36, 28);
  --theme-table-head-text: var(--theme-canopy-green);
  --theme-table-row-even: rgba(12, 24, 18, 0.58);
  --theme-table-row-odd: rgba(16, 30, 22, 0.55);
  --theme-table-row-even-immersive: rgba(14, 28, 20, 0.52);
  --theme-table-row-odd-immersive: rgba(18, 32, 24, 0.50);
  --theme-stat-bg: transparent;
  --theme-stat-text: var(--theme-canopy-green);
  --theme-stat-divider: rgba(160, 220, 180, 0.06);
  --theme-sort-btn-bg: transparent;
  --theme-sort-btn-border: rgba(160, 220, 180, 0.10);
  --theme-sort-btn-text: var(--theme-canopy-green);
  --theme-modal-bg: rgba(10, 22, 16, 0.97);
  --theme-help-bg: var(--theme-surface);
  --theme-action-btn-bg: var(--theme-surface);
  --theme-pay-sched-day-bg: rgba(93, 184, 138, 0.08);
  --theme-pay-sched-day-border: rgba(93, 184, 138, 0.20);
  --theme-pay-sched-day-today-bg: rgba(93, 184, 138, 0.18);
  --theme-pay-sched-day-today-border: rgba(93, 184, 138, 0.40);
  --theme-pay-sched-day-soon-bg: rgba(201, 180, 88, 0.12);
  --theme-pay-sched-day-soon-border: rgba(201, 180, 88, 0.32);
  --theme-hero-panel: rgba(10, 20, 14, 0.98);
  --theme-hero-band: #0c1610;
  --theme-page-head-bg: #0e1c16;
  --theme-on-accent: #0a120e;
  --theme-toolbar-btn-color: var(--theme-accent-gold);
  --theme-toolbar-btn-bg: color-mix(in srgb, var(--theme-accent-gold) 15%, transparent);
  --theme-toolbar-btn-border: color-mix(in srgb, var(--theme-accent-gold) 35%, transparent);
  --theme-toolbar-btn-bg-hover: color-mix(in srgb, var(--theme-accent-gold) 25%, transparent);
  --theme-toolbar-btn-border-hover: color-mix(in srgb, var(--theme-accent-gold) 50%, transparent);
  --theme-section-label: var(--theme-canopy-green);
  --theme-section-title: var(--theme-canopy-green);
  --theme-accent-gold: var(--theme-canopy-green);
  --theme-accent-teal: var(--theme-canopy-green);
  --theme-accent-green: var(--theme-canopy-green);
  --theme-accent-red: #e07060;
  --theme-brand-text: #e8f0ea;
  --theme-brand-sub: #8fa898;
  --theme-footer-muted: #6a8070;
  --theme-footer-bg: rgba(10, 22, 16, 0.98);
  --theme-footer-border: rgba(93, 184, 138, 0.16);
  --theme-footer-shadow: 0 -8px 28px rgba(0, 0, 0, 0.48);
  --theme-footer-link: #8fa898;
  --theme-footer-photo: rgba(232, 240, 234, 0.28);
  --theme-shadow: none;
  --navy-bg: var(--theme-bg);
  --navy-card: #0e1c16;
  --navy-card-alt: #122820;
  --navy-border: #2a4a38;
  --gold: var(--theme-accent-gold);
  --teal: var(--theme-accent-teal);
  --white: var(--theme-text);
  --red: var(--theme-accent-red);
  --green: var(--theme-accent-green);
  --glass-bg: rgba(14, 28, 22, 0.88);
  --glass-card: rgba(14, 28, 22, 0.85);
  --glass-card-alt: var(--theme-card-alt);
  --glass-border: rgba(93, 184, 138, 0.16);
  --glass-table: rgba(10, 22, 16, 0.82);
  --glass-header: var(--theme-header-bg);
  --glass-modal: var(--theme-modal-bg);
}

/* ========== ALL THEMES: nature wallpaper base layer ========== */
html.theme-spectral #nature-bg,
html.theme-daylight #nature-bg,
html.theme-ember #nature-bg,
html.theme-canopy #nature-bg {
  background: var(--theme-nature-bg);
}

/* --- Daylight component overrides (non-layout) --- */
html.theme-daylight body {
  background: var(--theme-bg);
  color: var(--theme-text);
}

html.theme-daylight .card {
  border-color: var(--theme-border) !important;
  box-shadow: var(--theme-shadow);
}

html.theme-daylight .etf-card,
html.theme-ember .etf-card,
html.theme-canopy .etf-card {
  border-color: transparent;
}

html.wallpaper-layout-immersive .log-holdings-list .etf-card,
html.wallpaper-layout-immersive .log-holdings-list .etf-card.green-row,
html.wallpaper-layout-immersive .log-holdings-list .etf-card.gold-row {
  background: transparent !important;
  border: none !important;
  border-bottom: 1px solid var(--theme-immersive-row-divider) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

html.wallpaper-layout-immersive .dash-risk-list .risk-card {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

html.wallpaper-layout-immersive .pay-sched-day-immersive {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Immersive row dividers — tune per color theme */
html.theme-daylight.wallpaper-layout-immersive {
  --theme-immersive-row-divider: rgba(15, 23, 42, 0.22);
  --theme-immersive-row-divider-shadow: rgba(15, 23, 42, 0.08);
  --theme-immersive-row-base: rgba(255, 255, 255, 0.45);
  --theme-immersive-row-alt: rgba(255, 255, 255, 0.62);
  --theme-immersive-row-hover: rgba(15, 23, 42, 0.08);
  --theme-immersive-chip-bg: rgba(255, 255, 255, 0.92);
  --theme-immersive-chip-border: rgba(15, 23, 42, 0.16);
}

html.theme-ember.wallpaper-layout-immersive {
  --theme-immersive-row-divider: rgba(232, 147, 74, 0.42);
  --theme-immersive-row-divider-shadow: rgba(0, 0, 0, 0.45);
  --theme-immersive-row-base: rgba(0, 0, 0, 0.14);
  --theme-immersive-row-alt: rgba(0, 0, 0, 0.24);
  --theme-immersive-chip-bg: rgba(20, 10, 5, 0.72);
  --theme-immersive-chip-border: rgba(232, 147, 74, 0.3);
}

html.theme-canopy.wallpaper-layout-immersive {
  --theme-immersive-row-divider: rgba(93, 184, 138, 0.4);
  --theme-immersive-row-divider-shadow: rgba(0, 0, 0, 0.45);
  --theme-immersive-row-base: rgba(0, 0, 0, 0.14);
  --theme-immersive-row-alt: rgba(0, 0, 0, 0.24);
  --theme-immersive-chip-bg: rgba(5, 20, 12, 0.72);
  --theme-immersive-chip-border: rgba(93, 184, 138, 0.28);
}

html.theme-daylight .etf-ticker,
html.theme-daylight .risk-card-ticker,
html.theme-daylight .dh-ticker-cell,
html.theme-daylight .dash-kpi-val.gold,
html.theme-daylight .log-kpi-val.gold,
html.theme-daylight .etf-stat-val.gold,
html.theme-daylight .etf-stat-val.highlight,
html.theme-ember .etf-ticker,
html.theme-ember .risk-card-ticker,
html.theme-ember .dh-ticker-cell,
html.theme-ember .dash-kpi-val.gold,
html.theme-ember .log-kpi-val.gold,
html.theme-ember .etf-stat-val.gold,
html.theme-ember .etf-stat-val.highlight,
html.theme-canopy .etf-ticker,
html.theme-canopy .risk-card-ticker,
html.theme-canopy .dh-ticker-cell,
html.theme-canopy .dash-kpi-val.gold,
html.theme-canopy .log-kpi-val.gold,
html.theme-canopy .etf-stat-val.gold,
html.theme-canopy .etf-stat-val.highlight {
  color: var(--theme-accent-gold);
}

html.theme-daylight .etf-fullname,
html.theme-daylight .etf-income-lbl,
html.theme-daylight .etf-stat-lbl,
html.theme-daylight .etf-sort-bar-label,
html.theme-daylight .dash-kpi-lbl,
html.theme-daylight .log-kpi-lbl,
html.theme-daylight .growth-kpi-lbl,
html.theme-ember .etf-fullname,
html.theme-ember .etf-income-lbl,
html.theme-ember .etf-stat-lbl,
html.theme-ember .etf-sort-bar-label,
html.theme-ember .dash-kpi-lbl,
html.theme-ember .log-kpi-lbl,
html.theme-ember .growth-kpi-lbl,
html.theme-canopy .etf-fullname,
html.theme-canopy .etf-income-lbl,
html.theme-canopy .etf-stat-lbl,
html.theme-canopy .etf-sort-bar-label,
html.theme-canopy .dash-kpi-lbl,
html.theme-canopy .log-kpi-lbl,
html.theme-canopy .growth-kpi-lbl {
  color: var(--theme-text-dim);
}

html.theme-daylight .etf-stat-val,
html.theme-ember .etf-stat-val,
html.theme-canopy .etf-stat-val {
  color: var(--theme-stat-text);
}

html.theme-daylight .etf-stat,
html.theme-ember .etf-stat,
html.theme-canopy .etf-stat {
  background: var(--theme-stat-bg);
}

html.theme-daylight .etf-card-stats,
html.theme-ember .etf-card-stats,
html.theme-canopy .etf-card-stats {
  border-top-color: var(--theme-stat-divider);
}

html.theme-daylight .etf-income-weekly .etf-income-val,
html.theme-daylight .dash-kpi-val.teal,
html.theme-daylight .log-kpi-val.teal,
html.theme-daylight .growth-kpi-val.teal,
html.theme-daylight .etf-stat-val.teal,
html.theme-daylight .dh-paid-cell,
html.theme-ember .etf-income-weekly .etf-income-val,
html.theme-ember .dash-kpi-val.teal,
html.theme-ember .log-kpi-val.teal,
html.theme-ember .growth-kpi-val.teal,
html.theme-ember .etf-stat-val.teal,
html.theme-ember .dh-paid-cell,
html.theme-canopy .etf-income-weekly .etf-income-val,
html.theme-canopy .dash-kpi-val.teal,
html.theme-canopy .log-kpi-val.teal,
html.theme-canopy .growth-kpi-val.teal,
html.theme-canopy .etf-stat-val.teal,
html.theme-canopy .dh-paid-cell {
  color: var(--theme-accent-teal);
}

html.theme-daylight .etf-income-annual .etf-income-val,
html.theme-daylight .dash-kpi-val.green,
html.theme-daylight .log-kpi-val.green,
html.theme-daylight .etf-stat-val.green,
html.theme-ember .etf-income-annual .etf-income-val,
html.theme-ember .dash-kpi-val.green,
html.theme-ember .log-kpi-val.green,
html.theme-ember .etf-stat-val.green,
html.theme-canopy .etf-income-annual .etf-income-val,
html.theme-canopy .dash-kpi-val.green,
html.theme-canopy .log-kpi-val.green,
html.theme-canopy .etf-stat-val.green {
  color: var(--theme-accent-green);
}

html.theme-daylight .etf-stat-val.red,
html.theme-daylight .dash-kpi-val.red,
html.theme-daylight .log-kpi-val.red,
html.theme-ember .etf-stat-val.red,
html.theme-ember .dash-kpi-val.red,
html.theme-ember .log-kpi-val.red,
html.theme-canopy .etf-stat-val.red,
html.theme-canopy .dash-kpi-val.red,
html.theme-canopy .log-kpi-val.red {
  color: var(--theme-accent-red);
}

html.theme-daylight th,
html.theme-ember th,
html.theme-canopy th {
  background: var(--theme-table-head-bg);
  color: var(--theme-table-head-text);
  border-bottom-color: var(--theme-border-gold);
}

html.theme-daylight td,
html.theme-ember td,
html.theme-canopy td {
  border-bottom-color: var(--theme-border-row);
  color: var(--theme-text);
}

html.theme-daylight tbody tr:nth-child(even),
html.theme-ember tbody tr:nth-child(even),
html.theme-canopy tbody tr:nth-child(even) {
  background: var(--theme-table-row-even);
}

html.theme-daylight tbody tr:nth-child(odd),
html.theme-ember tbody tr:nth-child(odd),
html.theme-canopy tbody tr:nth-child(odd) {
  background: var(--theme-table-row-odd);
}

html.theme-daylight .modal-input,
html.theme-daylight .modal-select,
html.theme-daylight .mp-input,
html.theme-daylight .mp-select,
html.theme-daylight .edit-input,
html.theme-daylight .dh-input {
  background: var(--theme-input-bg);
  border-color: var(--theme-input-border);
  color: var(--theme-input-text);
}

html.theme-daylight .header-account-select {
  background-color: var(--theme-toolbar-btn-bg);
  border-color: var(--theme-toolbar-btn-border);
  color: var(--theme-toolbar-btn-color);
}

html.theme-daylight .header-account-select:hover,
html.theme-daylight .header-account-select:focus {
  background-color: var(--theme-toolbar-btn-bg-hover);
  border-color: var(--theme-toolbar-btn-border-hover);
  color: var(--theme-toolbar-btn-color);
}

html.theme-daylight .modal-input:focus,
html.theme-daylight .modal-select:focus,
html.theme-daylight .mp-input:focus,
html.theme-daylight .mp-select:focus {
  border-color: var(--theme-accent-gold);
}

html.theme-daylight .modal-label,
html.theme-daylight .text-gray-600 {
  color: var(--theme-text-dim) !important;
}

html.theme-daylight .text-gray-400,
html.theme-daylight .text-gray-500 {
  color: var(--theme-text-muted) !important;
}

html.theme-daylight .dash-goal-label.purple,
html.theme-daylight .dash-goal-stat-val.purple,
html.theme-daylight .dash-goal-stat-val.purple-light {
  color: #6d28d9;
}

html.theme-daylight .sort-btn {
  background: var(--theme-sort-btn-bg);
  border-color: var(--theme-sort-btn-border);
  color: var(--theme-sort-btn-text);
}

html.theme-daylight .sort-btn:hover,
html.theme-daylight .sort-btn.sort-asc,
html.theme-daylight .sort-btn.sort-desc {
  border-color: var(--theme-accent-gold);
  color: var(--theme-accent-gold);
}

html.theme-daylight .tab-btn {
  color: var(--theme-text-muted);
}

html.theme-daylight .tab-btn.active {
  background: var(--theme-accent-gold);
  color: var(--theme-on-accent);
}

html.theme-daylight .app-brand-name {
  color: var(--theme-brand-text);
}

html.theme-daylight .app-brand-sub,
html.theme-daylight .site-footer-disclaimer,
html.theme-daylight .site-footer-copy,
html.theme-daylight .site-footer-photo {
  color: var(--theme-footer-muted);
}

html.theme-daylight .log-help,
html.theme-daylight .dash-help,
html.theme-daylight .growth-help {
  color: var(--theme-text-muted);
  background: var(--theme-help-bg);
  border-color: var(--theme-border);
}

html.theme-daylight .modal-box,
html.theme-daylight .legal-modal-box {
  background: var(--theme-modal-bg) !important;
  border-color: var(--theme-border) !important;
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.12);
}

html.theme-daylight .legal-prose .legal-section p {
  color: var(--theme-text);
}

html.theme-daylight .settings-data-panel {
  background: rgba(208, 216, 228, 0.88);
  border-color: rgba(0, 110, 92, 0.22);
}

html.theme-daylight .settings-data-panel-list {
  color: var(--theme-text-muted);
}

html.theme-daylight .mp-backup-row {
  background: rgba(210, 218, 228, 0.92);
  border-color: var(--theme-border);
}

html.theme-daylight .mp-backup-note {
  color: var(--theme-text-muted);
}

html.theme-daylight .section-card-head-label {
  color: var(--theme-accent-gold);
}

html.theme-daylight .text-gold-400 {
  color: var(--theme-accent-gold) !important;
}

html.theme-daylight .text-teal-400 {
  color: var(--theme-accent-teal) !important;
}

html.theme-daylight .text-white {
  color: var(--theme-text) !important;
}

html.theme-daylight .manage-modal-inner,
html.theme-daylight .manage-panel {
  background: var(--theme-modal-bg);
}

html.theme-daylight .manage-modal-header {
  border-bottom-color: var(--theme-border);
}

html.theme-daylight .dh-empty-cell {
  color: var(--theme-text-subtle);
}

html.theme-daylight .dh-table td {
  border-bottom-color: var(--theme-border-row);
}

html.theme-daylight .section-tip-btn {
  color: var(--theme-text-muted);
}

html.theme-daylight .section-tip-btn:hover {
  color: var(--theme-accent-teal);
}

/* --- Ember & Canopy: body + component surfaces (layout handled in theme.css) --- */
html.theme-ember body,
html.theme-canopy body {
  background: var(--theme-bg);
  color: var(--theme-text);
}

html.theme-ember .risk-card,
html.theme-canopy .risk-card {
  background: var(--theme-etf-card);
  border-color: var(--theme-border-subtle);
}

html.theme-ember .modal-input,
html.theme-ember .modal-select,
html.theme-ember .mp-input,
html.theme-ember .mp-select,
html.theme-ember .edit-input,
html.theme-ember .dh-input,
html.theme-canopy .modal-input,
html.theme-canopy .modal-select,
html.theme-canopy .mp-input,
html.theme-canopy .mp-select,
html.theme-canopy .edit-input,
html.theme-canopy .dh-input {
  background: var(--theme-input-bg);
  border-color: var(--theme-input-border);
  color: var(--theme-input-text);
}

html.theme-ember .header-account-select,
html.theme-canopy .header-account-select {
  background-color: var(--theme-toolbar-btn-bg);
  border-color: var(--theme-toolbar-btn-border);
  color: var(--theme-toolbar-btn-color);
}

html.theme-ember .header-account-select:hover,
html.theme-ember .header-account-select:focus,
html.theme-canopy .header-account-select:hover,
html.theme-canopy .header-account-select:focus {
  background-color: var(--theme-toolbar-btn-bg-hover);
  border-color: var(--theme-toolbar-btn-border-hover);
  color: var(--theme-toolbar-btn-color);
}

html.theme-ember .modal-input:focus,
html.theme-ember .modal-select:focus,
html.theme-ember .mp-input:focus,
html.theme-ember .mp-select:focus,
html.theme-canopy .modal-input:focus,
html.theme-canopy .modal-select:focus,
html.theme-canopy .mp-input:focus,
html.theme-canopy .mp-select:focus {
  border-color: var(--theme-accent-gold);
}

html.theme-ember .sort-btn,
html.theme-canopy .sort-btn {
  background: var(--theme-sort-btn-bg);
  border-color: var(--theme-sort-btn-border);
  color: var(--theme-sort-btn-text);
}

html.theme-ember .sort-btn:hover,
html.theme-ember .sort-btn.sort-asc,
html.theme-ember .sort-btn.sort-desc,
html.theme-canopy .sort-btn:hover,
html.theme-canopy .sort-btn.sort-asc,
html.theme-canopy .sort-btn.sort-desc {
  border-color: var(--theme-accent-gold);
  color: var(--theme-accent-gold);
}

html.theme-ember .tab-btn,
html.theme-canopy .tab-btn {
  color: var(--theme-text-muted);
}

html.theme-ember .tab-btn.active,
html.theme-canopy .tab-btn.active {
  background: var(--theme-accent-gold);
  color: var(--theme-on-accent);
}

html.theme-ember .app-brand-name,
html.theme-canopy .app-brand-name {
  color: var(--theme-brand-text);
}

html.theme-ember .app-brand-sub,
html.theme-ember .site-footer-disclaimer,
html.theme-ember .site-footer-copy,
html.theme-ember .site-footer-photo,
html.theme-canopy .app-brand-sub,
html.theme-canopy .site-footer-disclaimer,
html.theme-canopy .site-footer-copy,
html.theme-canopy .site-footer-photo {
  color: var(--theme-footer-muted);
}

html.theme-ember .log-help,
html.theme-ember .dash-help,
html.theme-ember .growth-help,
html.theme-canopy .log-help,
html.theme-canopy .dash-help,
html.theme-canopy .growth-help {
  color: var(--theme-text-muted);
  background: var(--theme-help-bg);
  border-color: var(--theme-border);
}

html.theme-ember .modal-box,
html.theme-ember .legal-modal-box,
html.theme-canopy .modal-box,
html.theme-canopy .legal-modal-box {
  background: var(--theme-modal-bg) !important;
  border-color: var(--theme-border) !important;
}

html.theme-ember .legal-prose .legal-section p,
html.theme-canopy .legal-prose .legal-section p {
  color: var(--theme-text);
}

html.theme-ember .manage-modal-inner,
html.theme-ember .manage-panel,
html.theme-canopy .manage-modal-inner,
html.theme-canopy .manage-panel {
  background: var(--theme-modal-bg);
}

html.theme-ember .section-card-head-label,
html.theme-canopy .section-card-head-label {
  color: var(--theme-section-label, var(--theme-accent-gold));
}

html.theme-canopy .log-holdings-title,
html.theme-canopy .growth-holdings-title,
html.theme-canopy .dash-section-title {
  color: var(--theme-section-title, var(--theme-accent-gold));
}

html.theme-ember .text-gold-400,
html.theme-canopy .text-gold-400 {
  color: var(--theme-accent-gold) !important;
}

html.theme-ember .text-teal-400,
html.theme-canopy .text-teal-400 {
  color: var(--theme-accent-teal) !important;
}

html.theme-ember .text-gray-500,
html.theme-canopy .text-gray-500 {
  color: var(--theme-text-muted) !important;
}

html.theme-ember .refresh-progress-panel,
html.theme-canopy .refresh-progress-panel {
  background: var(--theme-card);
  border-color: var(--theme-border-gold);
}

html.theme-ember .refresh-ticker-row.success .refresh-ticker-status,
html.theme-ember .refresh-ticker-row.success .refresh-ticker-symbol,
html.theme-canopy .refresh-ticker-row.success .refresh-ticker-status,
html.theme-canopy .refresh-ticker-row.success .refresh-ticker-symbol {
  color: var(--theme-accent-teal);
}

html.theme-ember .settings-data-panel,
html.theme-canopy .settings-data-panel {
  background: var(--theme-card-alt);
  border-color: var(--theme-border);
}

html.theme-ember .mp-backup-row,
html.theme-canopy .mp-backup-row {
  background: var(--theme-card-alt);
  border-color: var(--theme-border);
}

html.theme-ember .section-tip-btn,
html.theme-canopy .section-tip-btn {
  color: var(--theme-text-muted);
}

html.theme-ember .section-tip-btn:hover,
html.theme-canopy .section-tip-btn:hover {
  color: var(--theme-accent-teal);
}

/* Canopy — one green for dashboard / risk meter text */
html.theme-canopy .dash-section-title,
html.theme-canopy .risk-card-ticker,
html.theme-canopy .risk-chip-lbl {
  color: var(--theme-canopy-green);
}

/* Canopy — one green for all log KPI / holding value semantics */
html.theme-canopy .log-kpi-val,
html.theme-canopy .log-kpi-val.teal,
html.theme-canopy .log-kpi-val.gold,
html.theme-canopy .log-kpi-val.green,
html.theme-canopy .etf-income-weekly .etf-income-val,
html.theme-canopy .etf-income-annual .etf-income-val,
html.theme-canopy .etf-stat-val,
html.theme-canopy .etf-stat-val.teal,
html.theme-canopy .etf-stat-val.gold,
html.theme-canopy .etf-stat-val.green,
html.theme-canopy .etf-stat-val.highlight {
  color: var(--theme-canopy-green);
}

/* Canopy — force one green on erosion badges (JS sets per-tier colors) */
html.theme-canopy .erosion-A,
html.theme-canopy .erosion-Bp,
html.theme-canopy .erosion-B {
  --erosion-color: var(--theme-canopy-green) !important;
  color: var(--theme-canopy-green) !important;
  border-color: rgba(93, 184, 138, 0.35) !important;
  background: rgba(93, 184, 138, 0.12) !important;
}

html.theme-canopy .etf-exdiv-badge-green {
  color: var(--theme-canopy-green);
  border-color: rgba(93, 184, 138, 0.35);
  background: rgba(93, 184, 138, 0.12);
}

html.theme-canopy .risk-card.risk-border-low {
  border-left-color: var(--theme-canopy-green);
}

html.theme-canopy .risk-low {
  background: rgba(93, 184, 138, 0.2);
  color: var(--theme-canopy-green);
}
