.theme-toggle {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(113, 130, 152, .22);
  border-radius: 12px;
  color: #18243b;
  background: rgba(255, 255, 255, .72);
  box-shadow: 0 8px 22px rgba(14, 31, 55, .08);
  cursor: pointer;
  transition: transform .2s ease, background .2s ease, color .2s ease;
}

.theme-toggle:hover { transform: translateY(-2px); }
.theme-toggle span { font-size: 19px; line-height: 1; }
.theme-toggle-floating { position: fixed; z-index: 1000; top: 18px; right: 18px; }
section[id] { scroll-margin-top: 90px; }

html[data-theme="dark"] {
  --navy: #eef4ff;
  --ink: #edf5ff;
  --ink-soft: #d8e2f0;
  --text: #edf3ff;
  --muted: #a9b8ca;
  --bg: #07101d;
  --paper: #08151d;
  --surface: #101b2a;
  --surface-2: #152235;
  --white: #101b2a;
  --line: #28394d;
  --cream: #0d151d;
  --mint: #12352f;
  --shadow: 0 24px 70px rgba(0, 0, 0, .34);
  color-scheme: dark;
}

html[data-theme="dark"] body {
  color: #edf4ff;
  background: #07101d;
}

html[data-theme="dark"] .theme-toggle {
  color: #ffe36a;
  border-color: rgba(157, 178, 205, .24);
  background: rgba(20, 32, 49, .9);
}

html[data-theme="dark"] .site-header {
  color: #eef4ff;
  border-color: rgba(116, 143, 174, .23);
  background: rgba(7, 16, 29, .9);
}

html[data-theme="dark"] :is(.nav a, .site-header nav a) { color: #e3edf9; }
html[data-theme="dark"] :is(.nav a.active, .site-header nav a.active) { color: #fff; }
html[data-theme="dark"] .store-mini { color: #fff; background: #18283d; }
html[data-theme="dark"] .btn-dark { color: #101113; background: #ffc400; }
html[data-theme="dark"] .nexrent-card .product-title h3 { color: #f4c84c; }
html[data-theme="dark"] .nexbudget-card .product-title h3 { color: #5fd2aa; }

html[data-theme="dark"] :is(.brand small, .hero-copy > p, .section-heading p, .product-content > p, .solution-cards p, .about-copy > p, .footer-grid p, .story-copy p, .feature-card p, .family-copy p, .legal-card p, .legal-card li, .toc a) {
  color: #a9b8ca;
}

html[data-theme="dark"] :is(.trust-row, .hero-trust) { color: #a9b8ca; }

html[data-theme="dark"] :is(.menu-toggle, .btn-outline, .eyebrow, .trust span) {
  color: #edf4ff;
  border-color: #31445c;
  background: #111d2c;
}

html[data-theme="dark"] :is(.menu-toggle span, .site-header .menu-toggle span) { background: #edf4ff; }

html[data-theme="dark"] :is(.nav.open, .site-header nav.open) {
  color: #edf4ff;
  border-color: #2a3a4f;
  background: #0e1928;
}

html[data-theme="dark"] :is(.hero, .about) {
  background:
    radial-gradient(circle at 82% 15%, rgba(76, 96, 246, .2), transparent 30%),
    linear-gradient(160deg, #0c1727, #07101d);
}

html[data-theme="dark"] :is(.solutions, .core-features, .detail-features) { background: #08121f; }
html[data-theme="dark"] :is(.pro-section, .plan-section) { background: #0a1522; }

html[data-theme="dark"] :is(.benefit-bar, .product-card, .solution-cards article, .feature-grid article, .feature-card, .plan-card, .story-card, .emoney-story-card, .toc, .legal-card) {
  color: #edf4ff;
  border-color: #28394d;
  background: #101b2a;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .22);
}

html[data-theme="dark"] :is(.product-card, .booking-card, .feature-wide) {
  background: linear-gradient(135deg, #111e2e, #0c1725);
}

html[data-theme="dark"] :is(footer, .footer, .legal-page) { background: #07101d; }
html[data-theme="dark"] footer { border-color: #28394d; }

html[data-theme="dark"] .memory-note {
  border-color: #24405a;
  background: #0b1b2b;
}

html[data-theme="dark"] .emoney-feature-stories {
  background:
    radial-gradient(circle at 8% 5%, rgba(40, 137, 255, .14), transparent 25%),
    radial-gradient(circle at 92% 90%, rgba(129, 75, 247, .14), transparent 28%),
    linear-gradient(180deg, #08131f, #0a1827);
}

html[data-theme="dark"] .emoney-story-copy p { color: #a9bad0; }

html[data-theme="dark"] .nexbudget-product-scene {
  background:
    radial-gradient(circle at 72% 18%, rgba(95, 226, 160, .2), transparent 28%),
    linear-gradient(145deg, #0c201c, #0a171d);
}

html[data-theme="dark"] .emoney-product-scene {
  background:
    radial-gradient(circle at 72% 18%, rgba(78, 141, 255, .22), transparent 30%),
    linear-gradient(145deg, #0b1727, #08131e);
}

html[data-theme="dark"] .feature-stories {
  background: linear-gradient(180deg, #081710, #0b1c17);
}

html[data-theme="dark"] .detail-features { background: #08140f; }
html[data-theme="dark"] .plan-section { background: #0a1813; }

html[data-theme="dark"] :is(.calendar-window, .stat-grid span, .category, .donut::after) {
  color: #edf4ff;
  background: #132238;
}

html[data-theme="dark"] :is(.phone-screen, .receipt, .receipt-demo) { color: #13202e; }
html[data-theme="dark"] :is(.scan-chip, .emoney-tap-status, .budget-family-pill, .budget-insight-pill, .hero-poster-badge) { color: #142136; }

html[data-theme="dark"] :is(.data-grid article, .notice) {
  border-color: #2b4050;
  background: #10241f;
}

html[data-theme="dark"] :is(.field input, .field select, .field textarea) {
  color: #edf4ff;
  border-color: #34485c;
  background: #0b1724;
}

html[data-theme="dark"] .legal-page .site-header { background: rgba(7, 16, 29, .92); }
html[data-theme="dark"] .legal-page :is(.legal-shell, .policy-card, .legal-card, .toc-card) {
  color: #edf4ff;
  border-color: #28394d;
  background: #101b2a;
}

html[data-theme="dark"] [style*="background:#fff"],
html[data-theme="dark"] [style*="background: #fff"] {
  color: #edf4ff !important;
  background: #101b2a !important;
}

@media (max-width: 820px) {
  .theme-toggle { width: 38px; height: 38px; border-radius: 11px; }
  html[data-theme="dark"] :is(.nav.open, .site-header nav.open) { box-shadow: 0 20px 50px rgba(0, 0, 0, .4); }
}
