/* Theme-only overrides: no dashboard layout, features, or data changes. */
:root[data-bs-theme="dark"] {
  color-scheme: dark;
  --primary: #8ab8ff;
  --primary-dark: #b7d3ff;
  --secondary: #5cddb0;
  --secondary-dark: #73e8c2;
  --bg: #0b1423;
  --card: #152237;
  --text: #edf3fc;
  --muted: #afbed2;
  --border: #2d3e56;
  --shadow: 0 8px 24px rgba(0,0,0,.18);
  --shadow-hover: 0 12px 32px rgba(0,0,0,.28);
  --bs-body-color: #edf3fc;
  --bs-body-color-rgb: 237,243,252;
  --bs-body-bg: #0b1423;
  --bs-body-bg-rgb: 11,20,35;
  --bs-secondary-color: #afbed2;
  --bs-secondary-color-rgb: 175,190,210;
  --bs-secondary-bg: #1b2b41;
  --bs-tertiary-bg: #101c2e;
  --bs-border-color: #2d3e56;
  --bs-link-color: #8ab8ff;
  --bs-link-color-rgb: 138,184,255;
  --bs-link-hover-color: #b7d3ff;
}
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 44px; height: 44px; padding: 0; border: 1px solid var(--border, #e2e8f0); border-radius: 12px; background: var(--card, #fff); color: var(--text, #15243b); cursor: pointer; }
.theme-toggle:hover { border-color: var(--primary, #3b82f6); color: var(--primary, #3b82f6); }
.theme-toggle:focus-visible, .nav-mobile-login:focus-visible { outline: 3px solid var(--primary, #3b82f6); outline-offset: 3px; }
.theme-icon-sun { display: none; }
[data-bs-theme="dark"] .theme-icon-moon { display: none; }
[data-bs-theme="dark"] .theme-icon-sun { display: block; }
.nav-guest-mobile-actions { gap: .25rem; }
.nav-mobile-login { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .5rem; color: var(--text, #15243b); font-weight: 700; font-size: .8rem; }
@media (max-width: 575.98px) {
  .footer-app .container { padding-inline: 1rem; }
}
@media (max-width: 360px) {
  .navbar-app-guest .brand-text { font-size: .93rem; }
  .nav-guest-mobile-actions { gap: .1rem; }
  .nav-guest-mobile-actions .navbar-toggler { padding-inline: .3rem; }
  .navbar-app-guest .navbar-brand { margin-right: .2rem; }
  .navbar-app-auth .brand-text { font-size: .85rem; }
  .navbar-mobile-tools .nav-mobile-coins { padding-inline: .3rem !important; }
}
[data-bs-theme="dark"] :is(.navbar-app, .footer-app, .mobile-bottom-nav, .card-app, .panel-card, .stat-card, .modal-content, .dropdown-menu, .list-group-item, .notification-nudge) { background: var(--card); color: var(--text); border-color: var(--border); }
[data-bs-theme="dark"] .navbar-app.is-scrolled { background: rgba(21,34,55,.96); }
[data-bs-theme="dark"] :is(.text-dark, .text-body, .link-dark) { color: var(--text) !important; }
[data-bs-theme="dark"] :is(.text-muted, .text-secondary, .text-body-secondary) { color: var(--muted) !important; }
[data-bs-theme="dark"] .text-primary { color: #8ab8ff !important; }
[data-bs-theme="dark"] .text-success { color: #73dfbd !important; }
[data-bs-theme="dark"] .text-danger { color: #ffa8ad !important; }
[data-bs-theme="dark"] .text-info { color: #79ddf3 !important; }
[data-bs-theme="dark"] .text-indigo { color: #b4b5ff !important; }
[data-bs-theme="dark"] :is(.bg-white, .bg-light) { background-color: var(--card) !important; }
/* QR codes retain a white, high-contrast quiet zone for reliable scanning. */
[data-bs-theme="dark"] .companion-qr-box { background: #fff !important; color: #334155; }
[data-bs-theme="dark"] .companion-qr-box .text-muted { color: #52647b !important; }
[data-bs-theme="dark"] .border { border-color: var(--border) !important; }
[data-bs-theme="dark"] :is(.form-control, .form-select, .input-group-text) { background-color: #101c2e; color: var(--text); border-color: #425672; }
[data-bs-theme="dark"] .form-control::placeholder { color: #91a4be; }
[data-bs-theme="dark"] :is(.form-control, .form-select):focus { background-color: #101c2e; color: var(--text); border-color: var(--primary); box-shadow: 0 0 0 .2rem rgba(138,184,255,.18); }
[data-bs-theme="dark"] :is(.form-control, .form-select):disabled { background-color: #253248; color: var(--muted); }
[data-bs-theme="dark"] .form-check-input { background-color: #101c2e; border-color: #6c829f; }
[data-bs-theme="dark"] .form-check-input:checked { background-color: #2563eb; border-color: #8ab8ff; }
[data-bs-theme="dark"] .btn-primary { --bs-btn-color: #fff; --bs-btn-bg: #2563eb; --bs-btn-border-color: #377bf7; --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #1d4ed8; --bs-btn-hover-border-color: #8ab8ff; background: #2563eb; color: #fff; border-color: #377bf7; }
[data-bs-theme="dark"] .btn-success { background: #0c775a; border-color: #279a7a; color: #fff; }
[data-bs-theme="dark"] .btn-outline-primary { color: #a3c8ff; border-color: #5d91df; background: transparent; }
[data-bs-theme="dark"] .btn-outline-primary:hover { background: #2563eb; color: #fff; }
[data-bs-theme="dark"] :is(.btn-outline-secondary, .btn-outline-dark) { color: var(--text); border-color: #7186a2; background: transparent; }
[data-bs-theme="dark"] :is(.btn-outline-secondary, .btn-outline-dark):hover { background: #344864; color: #fff; }
[data-bs-theme="dark"] .btn-outline-success { color: #73dfbd; border-color: #40af8b; }
[data-bs-theme="dark"] .btn-outline-success:hover { background: #0c775a; color: #fff; }
[data-bs-theme="dark"] .btn-light { color: #15243b; background: #edf3fc; border-color: #edf3fc; }
[data-bs-theme="dark"] .dropdown-item { color: var(--text); }
[data-bs-theme="dark"] .dropdown-item:is(:hover, :focus, .active) { background: #273b58; color: #fff; }
[data-bs-theme="dark"] .dropdown-divider { border-color: var(--border); }
[data-bs-theme="dark"] .accordion-button { background: var(--card); color: var(--text); }
[data-bs-theme="dark"] .accordion-button:not(.collapsed) { background: #1e3452; color: #b7d3ff; }
[data-bs-theme="dark"] .table { --bs-table-color: var(--text); --bs-table-bg: var(--card); --bs-table-border-color: var(--border); --bs-table-striped-bg: #192a42; --bs-table-striped-color: var(--text); --bs-table-hover-bg: #263b58; --bs-table-hover-color: var(--text); color: var(--text); }
[data-bs-theme="dark"] :is(.hero, .hero-redesign) { background: radial-gradient(ellipse at 80% 10%, rgba(59,130,246,.1), transparent 65%), var(--bg); }
[data-bs-theme="dark"] :is(.hero-headline, .hero-prop-item, .section-title) { color: var(--text); }
[data-bs-theme="dark"] :is(.hero-subtext, .section-sub) { color: var(--muted); }
[data-bs-theme="dark"] :is(.stats-strip, .completed-showcase, .completed-app-banner, .app-card-tag, .ac-detail, .ac-detail-inner) { background: #101c2e; border-color: var(--border); }
[data-bs-theme="dark"] :is(.stat-caption, .completed-days-badge, .app-card-developer, .app-card-spots, .app-card-tag, .app-card-tag i, .app-card-timing, .app-card-pause-note) { color: var(--muted); }
[data-bs-theme="dark"] :is(.hero-badge-pill, .completed-status-badge) { color: #8be7c9; background: rgba(16,185,129,.14); border-color: #2d705f; }
[data-bs-theme="dark"] :is(.app-card-title, .app-card-title a) { color: var(--text); }
[data-bs-theme="dark"] :is(.app-card-splash-link, .app-card-icon, .completed-app-icon-wrap) { background: #0b1423; border-color: var(--border); }
[data-bs-theme="dark"] :is(.app-card-footer, .app-card-heading, .ac-card-foot) { border-color: var(--border); }
[data-bs-theme="dark"] .sidebar-admin a { color: var(--muted); }
[data-bs-theme="dark"] .sidebar-admin a:is(:hover, .active) { color: var(--primary); background: #1e3452; }
/* Preserve dashboard geometry; only adapt existing surfaces and text. */
[data-bs-theme="dark"] :is(.dashboard-rank-card, .dashboard-wallet, .dashboard-quick-action, .dashboard-notification-row, .dashboard-my-app-row, .dashboard-stat-grid > div, .dashboard-chart-card, .dashboard-more-card, .dashboard-upcoming, .dashboard-per-device-group, .dashboard-modal-section-muted, .dashboard-detail-modal .modal-footer, .ac-card, .ac-card-hero, .ac-tile, .ac-table, .ac-row-detail, .ac-cmd, .ac-facts, .chat-panel, .chat-box) { background: var(--card); color: var(--text); border-color: var(--border); }
[data-bs-theme="dark"] .dashboard-orbit-node { --node-color-dark: #c5daff; background: linear-gradient(145deg, #253b54, var(--card) 78%); box-shadow: 0 10px 24px rgba(0,0,0,.2), inset 0 0 0 5px rgba(255,255,255,.03); }
[data-bs-theme="dark"] .dashboard-orbit-main { border-color: #23483f; }
[data-bs-theme="dark"] :is(.dashboard-quick-icon, .dashboard-round-link, .dashboard-mini-ring::after) { background: #23354c; color: var(--primary); }
[data-bs-theme="dark"] :is(.dashboard-wallet small, .dashboard-wallet-icon, .dashboard-wallet-arrow) { color: #ffdc83; }
[data-bs-theme="dark"] .dashboard-wallet-icon { background: #483b22; }
[data-bs-theme="dark"] :is(.dashboard-compact-alert, .dashboard-modal-section-warm, .dashboard-modal-section-success, .dashboard-new-app-card, .generator-tip) { background: #1d2f3e; color: var(--text); border-color: #42605d; }
[data-bs-theme="dark"] :is(.dashboard-compact-alert small, .dashboard-compact-alert > i, .dashboard-new-app-card strong, .dashboard-new-app-card small, .dashboard-mini-ring span) { color: #d5e7fc; }
[data-bs-theme="dark"] .dashboard-detail-modal .modal-header { background: #1b2d45; }
[data-bs-theme="dark"] .dashboard-detail-modal :is(.modal-title, .dashboard-modal-kicker) { color: #b7d3ff; }
[data-bs-theme="dark"] :is(.dashboard-modal-help, .dashboard-notification-row.is-action) { background: #2c293c; color: var(--muted); }
[data-bs-theme="dark"] :is(.dashboard-my-app-row:hover, .dashboard-notification-row:hover) { background: #243b59; }
[data-bs-theme="dark"] :is(.dashboard-quick-action, .dashboard-more-card, .dashboard-task-row, .dashboard-my-app-row, .dashboard-modal-section, .dashboard-ledger-list > div, .dashboard-more-links, .dashboard-per-device-header, .dashboard-upcoming) { border-color: var(--border); }
[data-bs-theme="dark"] .dashboard-upcoming-badge { color: #c7d2fe; background: rgba(129,140,248,.2); }
[data-bs-theme="dark"] .dashboard-upcoming-row.is-next .dashboard-upcoming-copy strong { color: #c7d2fe; }
[data-bs-theme="dark"] .dashboard-upcoming-unit { background: rgba(148,163,184,.14); }
[data-bs-theme="dark"] .dashboard-upcoming-count.is-ready::before { color: #86efac; background: rgba(34,197,94,.2); }
[data-bs-theme="dark"] :is(.ac-inset, .ac-row, .ac-attention, .ac-disclosure, .live-chat-panel, .live-chat-avail, .live-chat-messages, .live-chat-compose, .onboarding-card, .post-platform-card) { background: var(--card); color: var(--text); border-color: var(--border); }
[data-bs-theme="dark"] :is(.ac-inset-title, .ac-layout-reset, .live-chat-empty) { color: var(--muted); }
[data-bs-theme="dark"] :is(.ac-status-green, .ac-status-blue, .ac-status-amber, .ac-status-slate) { background: #23364b; color: #d5e7fc; }
[data-bs-theme="dark"] :is(.ac-card-title, .ac-tile-value, .ac-fact-value, .ac-app-name, .ac-table th, .ac-table td) { color: var(--text); }
[data-bs-theme="dark"] :is(.ac-card-sub, .ac-tile-label, .ac-fact-label, .ac-muted) { color: var(--muted); }
[data-bs-theme="dark"] :is(.ac-table th, .ac-table tr:hover, .ac-row-detail, .ac-primary-idle) { background: #1a2c44; }
[data-bs-theme="dark"] :is(.ac-tile.ac-tile-amber, .ac-tile.ac-tile-red) { background: #342b30; border-color: #88615a; }
[data-bs-theme="dark"] :is(.ac-tile.ac-tile-amber .ac-tile-value, .ac-tile.ac-tile-red .ac-tile-value) { color: #ffcdab; }
/* Admin System Settings: app.css paints the cards #fff / #F8FAFC and gives each accent a
   white-ended header gradient, so they must be re-surfaced for dark. The accent rules are
   more specific than a plain .settings-section-head override, so each accent needs its own. */
[data-bs-theme="dark"] .settings-section { background: var(--card); }
[data-bs-theme="dark"] .settings-toggles { background: #101c2e; }
[data-bs-theme="dark"] .settings-section-head { background: linear-gradient(180deg, rgba(27, 43, 65, .95), rgba(21, 34, 55, .45)); }
[data-bs-theme="dark"] .settings-section.accent-sky .settings-section-head { background: linear-gradient(135deg, rgba(14, 165, 233, .24), rgba(21, 34, 55, .92)); }
[data-bs-theme="dark"] .settings-section.accent-amber .settings-section-head { background: linear-gradient(135deg, rgba(245, 158, 11, .24), rgba(21, 34, 55, .92)); }
[data-bs-theme="dark"] .settings-section.accent-emerald .settings-section-head { background: linear-gradient(135deg, rgba(16, 185, 129, .24), rgba(21, 34, 55, .92)); }
[data-bs-theme="dark"] .settings-section.accent-rose .settings-section-head { background: linear-gradient(135deg, rgba(244, 63, 94, .22), rgba(21, 34, 55, .92)); }
[data-bs-theme="dark"] .settings-section.accent-slate .settings-section-head { background: linear-gradient(135deg, rgba(100, 116, 139, .26), rgba(21, 34, 55, .92)); }
[data-bs-theme="dark"] .settings-section.accent-blue .settings-section-head { background: linear-gradient(135deg, rgba(59, 130, 246, .24), rgba(21, 34, 55, .92)); }
[data-bs-theme="dark"] .settings-section.accent-teal .settings-section-head { background: linear-gradient(135deg, rgba(20, 184, 166, .24), rgba(21, 34, 55, .92)); }
[data-bs-theme="dark"] .settings-section.accent-danger .settings-section-head { background: linear-gradient(135deg, rgba(239, 68, 68, .22), rgba(21, 34, 55, .92)); }

/* App page components (promo panel, switch rows, campaign actions) hard-code white
   and pastel surfaces in app.css. Re-surface them here so dark mode does not show
   light boxes with light text. */
[data-bs-theme="dark"] .promo-codes-panel { background: #221d14; border-color: rgba(245, 158, 11, .4); }
[data-bs-theme="dark"] .promo-codes-progress .progress { background: rgba(255, 255, 255, .12); }
[data-bs-theme="dark"] .promo-share-block { background: #1a2639; border-color: rgba(245, 158, 11, .55); color: var(--text); }
[data-bs-theme="dark"] .promo-share-result { background: #12332c; border-color: rgba(16, 185, 129, .45); color: var(--text); }
[data-bs-theme="dark"] .promo-share-error { background: #3a1f26; border-color: #7a3a44; color: #ffb3ba; }
[data-bs-theme="dark"] .promo-step { background: rgba(255, 255, 255, .045); border-color: rgba(148, 163, 184, .22); }
[data-bs-theme="dark"] .promo-step-icon { background: rgba(245, 158, 11, .22); color: #fcd34d; }
[data-bs-theme="dark"] .promo-step-icon.is-sky { background: rgba(14, 165, 233, .22); color: #7dd3fc; }
[data-bs-theme="dark"] .promo-step-icon.is-rose { background: rgba(244, 63, 94, .22); color: #fda4af; }
[data-bs-theme="dark"] .promo-step-icon.is-amber { background: rgba(245, 158, 11, .22); color: #fcd34d; }
[data-bs-theme="dark"] .promo-chip { background: rgba(148, 163, 184, .16); border-color: rgba(148, 163, 184, .28); color: var(--text); }
[data-bs-theme="dark"] .promo-chip-amber { background: rgba(245, 158, 11, .2); border-color: rgba(245, 158, 11, .45); color: #ffdc83; }
[data-bs-theme="dark"] .promo-chip-ok { background: rgba(16, 185, 129, .2); border-color: rgba(16, 185, 129, .4); color: #73dfbd; }
[data-bs-theme="dark"] .promo-chip-danger { background: rgba(239, 68, 68, .2); border-color: rgba(239, 68, 68, .45); color: #ffb3ba; }
[data-bs-theme="dark"] .promo-fix-row { background: rgba(255, 255, 255, .05); border-color: rgba(148, 163, 184, .22); }
[data-bs-theme="dark"] .ac-switch-row { background: #101c2e; border-color: var(--border); color: var(--text); }
[data-bs-theme="dark"] .ac-switch-row.is-on { background: #12332c; border-color: #2f6f5e; }
[data-bs-theme="dark"] .ac-switch-row.ac-switch-warning.is-on { background: #3a2f18; border-color: #7a5a22; }
[data-bs-theme="dark"] .ac-switch-label { color: var(--text); }
[data-bs-theme="dark"] .ac-switch-desc,
[data-bs-theme="dark"] .ac-switch-state { color: var(--muted); }
[data-bs-theme="dark"] .ac-switch-state.is-on { color: #73dfbd; }
[data-bs-theme="dark"] .ac-switch-cost { background: #3a2f18; color: #ffdc83; }
[data-bs-theme="dark"] .ac-switch-blocked { color: #ffd28a; }
[data-bs-theme="dark"] .ac-switch .ac-switch-input { background-color: #475569; border-color: #475569; }
[data-bs-theme="dark"] .ac-switch .ac-switch-input:checked { background-color: #16a34a; border-color: #16a34a; }
[data-bs-theme="dark"] .ac-switch-warning .ac-switch-input:checked { background-color: #d97706; border-color: #d97706; }
[data-bs-theme="dark"] .owner-action-edit,
[data-bs-theme="dark"] .owner-action-bump { background: #1b3555; border-color: #2f5a8f; color: #b7d3ff; }
[data-bs-theme="dark"] .owner-action-complete,
[data-bs-theme="dark"] .owner-action-resume { background: #12332c; border-color: #2f6f5e; color: #8ff0cd; }
[data-bs-theme="dark"] .owner-action-pause,
[data-bs-theme="dark"] .owner-action-share { background: #3a2f18; border-color: #6b5423; color: #ffdc83; }
[data-bs-theme="dark"] .owner-action-cancel { background: #3a1f26; border-color: #7a3a44; color: #ffb3ba; }
[data-bs-theme="dark"] .owner-action-status { background: #1b2b41; border-color: var(--border); color: var(--muted); }
[data-bs-theme="dark"] .owner-action-modal .owner-action-cost { background: #101c2e; border-color: var(--border); }
[data-bs-theme="dark"] .owner-action-modal .owner-action-cost-label { color: var(--muted); }
[data-bs-theme="dark"] .ac-manage-foot { border-top-color: var(--border); }
[data-bs-theme="dark"] .ac-manage-foot-label,
[data-bs-theme="dark"] .ac-manage-foot-note { color: var(--muted); }
[data-bs-theme="dark"] .ac-attention-row { background: #1d2f3e; color: var(--text); border-color: var(--border); }
[data-bs-theme="dark"] .ac-attention-warn { background: #3a2f18; border-color: #7a5a22; }
[data-bs-theme="dark"] .ac-attention-icon { background: #101c2e; color: #ffd28a; }
[data-bs-theme="dark"] .ac-attention-copy p { color: var(--muted); }
[data-bs-theme="dark"] .ac-empty { background: #101c2e; color: var(--text); }
[data-bs-theme="dark"] .ac-empty-good { background: #12332c; color: #8ff0cd; }
[data-bs-theme="dark"] .ac-disclosure > summary { color: var(--text); }
[data-bs-theme="dark"] .ac-primary-idle { color: #73dfbd; }
[data-bs-theme="dark"] .ac-cmd-meta,
[data-bs-theme="dark"] .ac-tile-sub { color: var(--muted); }
[data-bs-theme="dark"] .ac-dial-num { color: var(--text); }
[data-bs-theme="dark"] .ac-dial-of,
[data-bs-theme="dark"] .ac-dial-caption span { color: var(--muted); }
[data-bs-theme="dark"] .ac-dial-caption strong { color: var(--text); }
[data-bs-theme="dark"] .ac-dial-track { stroke: #2d3e56; }
[data-bs-theme="dark"] .ac-queue-row { background: var(--card); border-color: var(--border); }
[data-bs-theme="dark"] .ac-queue-icon { background: #1b2b41; color: var(--muted); }
[data-bs-theme="dark"] .ac-queue-copy p { color: var(--muted); }
[data-bs-theme="dark"] .ac-queue-link { background: #1b3555; color: #b7d3ff; }
[data-bs-theme="dark"] .ac-queue-link:hover { background: #24456b; }
[data-bs-theme="dark"] .ac-pulse-badge { background: #3a2f18; border-color: #6b5423; color: #ffdc83; }
[data-bs-theme="dark"] .ac-chip { background: #101c2e; border-color: var(--border); color: var(--text); }
[data-bs-theme="dark"] .ac-chip span { color: var(--muted); }
[data-bs-theme="dark"] .ac-chip:hover { background: #1b2b41; border-color: #3b5b86; }
[data-bs-theme="dark"] .ac-table-search input { background: #101c2e; border-color: var(--border); color: var(--text); }
[data-bs-theme="dark"] .ac-table tbody td { border-bottom-color: var(--border); }
[data-bs-theme="dark"] .ac-detail-value { color: var(--text); }
[data-bs-theme="dark"] .ac-detail-days summary { color: var(--muted); }
[data-bs-theme="dark"] .ac-pager button { background: #101c2e; border-color: var(--border); color: var(--text); }
[data-bs-theme="dark"] .ac-pager button:hover:not(:disabled) { background: #1b2b41; }
[data-bs-theme="dark"] .ac-chip-state { background: #1b2b41; color: var(--muted); }
[data-bs-theme="dark"] .ac-chip-state-green { background: #12332c; color: #8ff0cd; }
[data-bs-theme="dark"] .ac-chip-state-amber { background: #3a2f18; color: #ffdc83; }
[data-bs-theme="dark"] .ac-flag-red { background: #3a1f26; color: #ffb3ba; }
[data-bs-theme="dark"] .ac-flag-green { background: #12332c; color: #8ff0cd; }
[data-bs-theme="dark"] .ac-expand:hover { background: #1b2b41; color: var(--text); }
