@media screen {
  html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0b1220;
    --panel: rgba(17, 24, 39, 0.94);
    --card: #141c2b;
    --border: rgba(148, 163, 184, 0.2);
    --text: #e8eef8;
    --muted: #94a3b8;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
    --primary-color: #60a5fa;
    --primary-dark: #93c5fd;
    --primary-light: #bfdbfe;
    --secondary-color: #94a3b8;
    --bg-color: #0b1220;
    --card-bg: #141c2b;
    --text-primary: #e8eef8;
    --text-secondary: #94a3b8;
    --border-color: #243044;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28);
    --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.32);
    --shadow-lg: 0 24px 50px rgba(0, 0, 0, 0.4);
    --chatbot-surface: #141c2b;
    --chatbot-border: #243044;
    --chatbot-shadow: 0 24px 54px rgba(0, 0, 0, 0.28);
    --chatbot-shadow-soft: 0 14px 30px rgba(0, 0, 0, 0.22);
  }

  html[data-theme="dark"] body:not(:has(.wrap)) {
    background:
      radial-gradient(900px 420px at 100% -8%, rgba(37, 99, 235, 0.16), transparent 55%),
      #0b1220 !important;
    color: #e8eef8;
  }

  html[data-theme="dark"] body:has(.wrap) {
    color: #e8eef8;
  }

  html[data-theme="dark"] :is(
    .header,
    .card,
    .panel,
    .sheet,
    .navbar,
    .nav,
    .top,
    .footer,
    .shell-menu,
    .admin-menu-toggle,
    .modal,
    .notifications-panel,
    .mq-dialog,
    .mobile-menu,
    .mobile-menu-panel,
    .bottom-navbar,
    .members-panel,
    .members-stat,
    .members-filters,
    .members-more-menu,
    .members-bulk,
    .member-row,
    .member-head,
    .member-browse,
    .member-find-field,
    .member-pick-row,
    .picker-menu,
    .picker-item,
    .ledger-row,
    .ledger-head,
    .user-panel,
    .user-row,
    .comm-panel,
    .comm-row,
    .comm-toolbar,
    .comm-channels,
    .dash-head,
    .dash-card,
    .dash-kpi,
    .rpt-bar,
    .rpt-sheet,
    .rpt-pick,
    .rpt-card,
    .rpt-kpi,
    .fs-bar,
    .fs-sheet,
    .doc-bar,
    .doc-actions,
    .mv-hero,
    .mv-panel,
    .mv-stat,
    .mf-panel,
    .mf-head,
    .mf-balance,
    .modules-hero-card,
    .modules-metric-card,
    .modules-offer-card,
    .modules-section-card,
    .modules-side-card,
    .modules-table-wrap,
    .bulk-upload-panel,
    .bulk-upload-side,
    .bulk-upload-guide,
    .bulk-upload-form-card,
    .bulk-upload-stat,
    .bulk-upload-dropzone,
    .loan-months-setup,
    .loan-month-grid,
    .feature-card,
    .features,
    .pricing-card,
    .testimonial-card,
    .testimonials,
    .faq-item,
    .about-stat,
    .visual-card,
    .contact-card,
    .contact-form,
    .dashboard-preview,
    .product,
    .tile,
    .mini,
    .callout,
    .workspace-metric,
    .workspace-bar,
    .story,
    .why-item,
    .kpi,
    .preview-inner,
    .mock-inner,
    .home-shot,
    .install-container,
    .login-page,
    .zk-appbar,
    .zk-live,
    .zk-panel-pop,
    .zk-records-sheet,
    .zk-offline-page,
    .zk-ai-panel,
    .zk-pwa-tip,
    .chatbot-hero-card,
    .chatbot-side-card,
    .chatbot-panel,
    .chatbot-alert-card,
    .chatbot-main,
    .chatbot-thread-item,
    .chatbot-thread-toggle,
    .chatbot-bubble,
    .chatbot-form,
    .chatbot-history-dialog,
    .chatbot-history-head,
    .chatbot-composer,
    .access-option,
    .access-tools,
    .ocr-panel,
    .recur-box,
    .ratio,
    .side-link,
    .sheet-foot,
    .cover-brand
  ) {
    background: #141c2b !important;
    color: #e8eef8;
    border-color: #243044 !important;
  }

  html[data-theme="dark"] :is(
    .table th,
    .table tbody tr:hover,
    thead th,
    tfoot td,
    .dash-pill,
    .rpt-stat,
    .rpt-presets a,
    .fs-tabs a,
    .fs-presets a,
    .members-search,
    .mv-upload,
    .mv-photo,
    .user-chips,
    .user-meta,
    .user-roles,
    .user-pill,
    .kind-pill,
    .settings-pill,
    .comm-meta,
    .ledger-select,
    .zk-event:hover,
    .zk-launch-all:hover,
    .zk-launch-app:hover,
    .mobile-menu-link:hover,
    .zk-ai-feed,
    .zk-ai-msg.assistant,
    .zk-ai-msg .zk-facts div,
    .zk-records-search,
    .zk-records-tabs,
    .chatbot-input-shell,
    .chatbot-pill,
    .bulk-upload-column
  ) {
    background: #1e293b !important;
    color: #e8eef8;
    border-color: #334155 !important;
  }

  html[data-theme="dark"] :is(
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]):not([type="submit"]):not([type="button"]),
    select,
    textarea,
    .form-control,
    .launcher-control
  ) {
    background: #0f172a !important;
    color: #e8eef8 !important;
    border-color: #334155 !important;
  }

  html[data-theme="dark"] ::placeholder {
    color: #94a3b8;
  }

  html[data-theme="dark"] :is(.btn, .btn-outline, .zk-pwa-btn, .zk-theme-btn, .member-icon-btn) {
    background: #0f172a !important;
    color: #e8eef8 !important;
    border-color: #334155 !important;
  }

  html[data-theme="dark"] :is(.btn-primary, .btn.primary, a.btn.primary, .btn.btn-primary, .launcher-settings-save) {
    background: linear-gradient(180deg, #3b82f6, #1d4ed8) !important;
    color: #fff !important;
    border-color: transparent !important;
  }

  html[data-theme="dark"] :is(.btn-success, .btn.btn-success) {
    background: #059669 !important;
    color: #fff !important;
    border-color: transparent !important;
  }

  html[data-theme="dark"] :is(.btn-danger, .btn.btn-danger) {
    background: #e11d48 !important;
    color: #fff !important;
    border-color: transparent !important;
  }

  html[data-theme="dark"] :is(.btn-warning) {
    background: #d97706 !important;
    color: #fff !important;
    border-color: transparent !important;
  }

  html[data-theme="dark"] .btn-light {
    background: #e8eef8 !important;
    color: #0f172a !important;
  }

  html[data-theme="dark"] :is(a, .nav-links a, .nav a) {
    color: inherit;
  }

  html[data-theme="dark"] :is(.main-content a, .card a, .table a, .member-row a) {
    color: #93c5fd;
  }

  html[data-theme="dark"] :is(.product p, .mini p, .kpi .l, .lead, .subtitle, .nav-links, .section-head p, .zk-profile-meta, .zk-ticker-slide span, .zk-launch-hint) {
    color: #94a3b8 !important;
  }

  html[data-theme="dark"] :is(.table, .table td, .table th) {
    color: inherit;
    border-color: #243044 !important;
  }

  html[data-theme="dark"] .table {
    background: transparent !important;
  }

  html[data-theme="dark"] :is(.alert-success, .badge-success, .mv-note.is-ok, .act-card.is-ok) {
    background: #064e3b !important;
    color: #a7f3d0 !important;
    border-color: #047857 !important;
  }

  html[data-theme="dark"] :is(.alert-error, .alert-danger, .badge-danger, .act-card.is-blocked) {
    background: #4c0519 !important;
    color: #fecdd3 !important;
    border-color: #e11d48 !important;
  }

  html[data-theme="dark"] :is(.alert-warning, .badge-warning, .mv-note.is-wait, .watch-item.warning) {
    background: #451a03 !important;
    color: #fde68a !important;
    border-color: #d97706 !important;
  }

  html[data-theme="dark"] :is(.alert-info, .badge-info, .watch-item.danger) {
    background: #082f49 !important;
    color: #bae6fd !important;
    border-color: #0284c7 !important;
  }

  html[data-theme="dark"] .zk-ai-msg.user,
  html[data-theme="dark"] .zk-ai-form button[type="submit"],
  html[data-theme="dark"] .zk-listen,
  html[data-theme="dark"] .zk-ai-head {
    color: #fff !important;
  }

  html[data-theme="dark"] .zk-ai-options button,
  html[data-theme="dark"] .zk-ai-chips button {
    background: #1e3a8a !important;
    color: #dbeafe !important;
    border-color: #1d4ed8 !important;
  }

  html[data-theme="dark"] .zk-appbar .zk-theme-btn,
  html[data-theme="dark"] .zk-appbar-menu,
  html[data-theme="dark"] .zk-icon-btn,
  html[data-theme="dark"] .zk-launch-btn {
    background: transparent !important;
    color: #e5e7eb !important;
    border-color: transparent !important;
  }

  html[data-theme="dark"] .zk-appbar .zk-theme-btn,
  html[data-theme="dark"] .zk-appbar-menu {
    background: rgba(15, 23, 42, 0.72) !important;
    border-color: rgba(148, 163, 184, 0.16) !important;
  }

  html[data-theme="dark"] .sidebar,
  html[data-theme="dark"] .sidebar .nav-item,
  html[data-theme="dark"] .sidebar a {
    color: #e2e8f0;
  }

  html[data-theme="dark"] .sidebar .nav-item.active,
  html[data-theme="dark"] .sidebar .nav-item:hover {
    color: #fff;
  }

  html[data-theme="dark"] :is(
    .user-roles a,
    .user-chips a,
    .comm-channels a,
    .comm-toolbar,
    .access-tools button,
    .access-option,
    .loan-month-grid label,
    .rpt-presets a,
    .fs-presets a,
    .fs-tabs a,
    .fs-tabs button,
    .members-filters button,
    .members-filters a,
    .dash-head,
    .header h1,
    .card h1,
    .card h2,
    .card h3,
    .mv-facts dd,
    .mv-id strong
  ) {
    background-color: #1e293b;
    color: #e8eef8;
    border-color: #334155;
  }

  html[data-theme="dark"] :is(.user-roles a, .user-chips a, .comm-channels a, .access-tools button, .loan-month-grid label, .rpt-presets a, .fs-presets a, .fs-tabs a, .fs-tabs button) {
    background-color: #1e293b !important;
  }

  html[data-theme="dark"] :is(.user-roles a.is-on, .user-chips a.is-on, .comm-channels a.is-on, .rpt-presets a.is-on, .fs-tabs a.is-on, .members-stat.is-active) {
    background-color: #1d4ed8 !important;
    color: #fff !important;
    border-color: #60a5fa !important;
  }

  html[data-theme="dark"] :is(.header h1, .card h1, .card h2, .card h3, .dash-head h2, .mv-facts dd, .mv-id strong) {
    background: transparent !important;
    color: #e8eef8 !important;
  }

  html[data-theme="dark"] :is(code, pre, .mono) {
    background: #0f172a !important;
    color: #e8eef8 !important;
  }

  html[data-theme="dark"] :is(
    .chatbot-main-head,
    .chatbot-feed,
    .chatbot-history-body,
    .zk-ai-form,
    .zk-ai-chips
  ) {
    background: #0f172a !important;
    color: #e8eef8 !important;
  }

  html[data-theme="dark"] :is(
    .chatbot-main-title,
    .chatbot-bubble,
    .chatbot-bubble-text,
    .chatbot-bubble-text p,
    .chatbot-thread-title,
    .chatbot-composer-label,
    .chatbot-option,
    .chatbot-option-label,
    .chatbot-chip,
    .chatbot-modal-toggle,
    .chatbot-thread-new,
    .chatbot-history-close,
    .chatbot-sidebar h2,
    .chatbot-sidebar h3,
    .chatbot-sidebar strong,
    .chatbot-alert-card,
    .zk-ai-msg.assistant,
    .zk-ai-msg.assistant p,
    .zk-ai-msg .zk-answer,
    .zk-ai-msg .zk-facts,
    .zk-ai-msg .zk-facts span,
    .zk-ai-msg .zk-facts strong
  ) {
    color: #e8eef8 !important;
  }

  html[data-theme="dark"] :is(
    .chatbot-bubble-meta,
    .chatbot-thread-meta,
    .chatbot-option-meta,
    .chatbot-side-item p,
    .chatbot-note,
    .chatbot-copy,
    .chatbot-main-note,
    .chatbot-kicker
  ) {
    color: #94a3b8 !important;
  }

  html[data-theme="dark"] :is(
    .chatbot-option,
    .chatbot-chip,
    .chatbot-modal-toggle,
    .chatbot-thread-new,
    .chatbot-history-close,
    .chatbot-status,
    .chatbot-icon,
    .chatbot-side-icon,
    .chatbot-chip-icon,
    .chatbot-avatar,
    .chatbot-bubble-text .zk-facts div,
    .zk-ai-msg .zk-facts div
  ) {
    background: #1e293b !important;
    color: #e8eef8 !important;
    border-color: #334155 !important;
  }

  html[data-theme="dark"] .chatbot-message.user .chatbot-bubble,
  html[data-theme="dark"] .zk-ai-msg.user {
    background: #1d4ed8 !important;
    color: #fff !important;
  }

  html[data-theme="dark"] .chatbot-message.user :is(.chatbot-bubble-text, .chatbot-bubble-text p, .chatbot-bubble-meta) {
    color: #fff !important;
  }

  html[data-theme="dark"] .chatbot-status.warn {
    background: #451a03 !important;
    color: #fde68a !important;
    border-color: #d97706 !important;
  }

  html[data-theme="dark"] :is(.chatbot-textarea, .zk-ai-form input) {
    caret-color: #e8eef8;
  }

  html[data-theme="dark"] .zk-ai-head,
  html[data-theme="dark"] .zk-ai-head strong,
  html[data-theme="dark"] .zk-ai-head span,
  html[data-theme="dark"] .zk-ai-head a,
  html[data-theme="dark"] .zk-ai-head button,
  html[data-theme="dark"] .zk-ai-launcher,
  html[data-theme="dark"] .zk-listen,
  html[data-theme="dark"] .zk-listen-caption,
  html[data-theme="dark"] .chatbot-main .zk-listen,
  html[data-theme="dark"] .chatbot-main .zk-listen-caption {
    color: #fff !important;
  }

  html[data-theme="dark"] .zk-ai-head {
    background:
      radial-gradient(circle at top right, rgba(16, 185, 129, 0.22), transparent 42%),
      linear-gradient(135deg, #1d4ed8, #0f766e) !important;
  }

  html[data-theme="dark"] .zk-ai-head a,
  html[data-theme="dark"] .zk-ai-head button {
    background: rgba(255, 255, 255, 0.14) !important;
  }

  html[data-theme="dark"] .zk-ai-launcher {
    background: linear-gradient(145deg, #2563eb, #0f766e) !important;
  }

  html[data-theme="dark"] :is(
    .settings-hero-card,
    .settings-panel,
    .settings-shortcut,
    .settings-block,
    .modules-hero-card,
    .modules-side-card,
    .modules-section-card,
    .modules-offer-card,
    .modules-table-wrap
  ) {
    background: #141c2b !important;
    color: #e8eef8 !important;
    border-color: #243044 !important;
    box-shadow: none;
  }

  html[data-theme="dark"] :is(
    .settings-note,
    .settings-pill,
    .settings-hero-icon,
    .settings-section-icon,
    .settings-shortcut-icon,
    .settings-section-head,
    .modules-metric-card,
    .modules-tip,
    .modules-pill,
    .modules-price-box,
    .modules-offer-chip,
    .modules-offer-icon
  ) {
    background: #1e293b !important;
    color: #e8eef8 !important;
    border-color: #334155 !important;
  }

  html[data-theme="dark"] :is(
    .settings-hero-card h2,
    .settings-panel .card-title,
    .settings-shortcut .card-title,
    .settings-section-head h3,
    .settings-note strong,
    .modules-title,
    .modules-section-head h3,
    .modules-side-card h3,
    .modules-metric-value,
    .modules-offer-name,
    .modules-price-main,
    .modules-tip strong,
    .settings-table-wrap .table td,
    .modules-table-wrap .table td
  ) {
    color: #e8eef8 !important;
  }

  html[data-theme="dark"] :is(
    .settings-copy,
    .settings-section-head p,
    .settings-kicker,
    .modules-kicker,
    .modules-copy,
    .modules-metric-label,
    .modules-metric-note,
    .modules-offer-desc,
    .modules-price-main span,
    .modules-price-sub,
    .modules-tip span,
    .modules-empty,
    .modules-side-card p
  ) {
    color: #94a3b8 !important;
  }

  html[data-theme="dark"] .modules-status-badge.is-active {
    background: #064e3b !important;
    color: #a7f3d0 !important;
  }

  html[data-theme="dark"] .modules-status-badge.is-cancelled {
    background: #4c0519 !important;
    color: #fecdd3 !important;
  }

  html[data-theme="dark"] .modules-status-badge.is-inactive {
    background: #451a03 !important;
    color: #fde68a !important;
  }

  html[data-theme="dark"] :is(
    .settings-hero-icon,
    .settings-section-icon,
    .settings-shortcut-icon,
    .modules-offer-icon
  ) {
    background: #1e3a5f !important;
    color: #93c5fd !important;
    border-color: #1d4ed8 !important;
  }
}

html[data-theme="dark"] .zk-theme-btn .zk-theme-moon,
html[data-theme="light"] .zk-theme-btn .zk-theme-sun {
  display: none;
}

html[data-theme="dark"] .zk-theme-btn .zk-theme-sun,
html[data-theme="light"] .zk-theme-btn .zk-theme-moon {
  display: block;
}

.zk-theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.zk-theme-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.zk-appbar .zk-theme-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #fff;
}
