/* Dark theme surface & contrast overrides for cabinet, profile, referrals, lobby and admin */
html[data-bs-theme="dark"],
html[data-bs-theme="dark"] body,
html[data-bs-theme="dark"] .page,
html[data-bs-theme="dark"] .page-wrapper,
html[data-bs-theme="dark"] .page-body,
html[data-bs-theme="dark"] .page-header,
html[data-bs-theme="dark"] .jm-profile-layout,
html[data-bs-theme="dark"] .profile-tabs,
html[data-bs-theme="dark"] footer.footer,
html[data-bs-theme="dark"] .footer-transparent,
html[data-bs-theme="dark"] .meeting-details.page.jm-meeting,
html[data-bs-theme="dark"] .meeting-details .page-wrapper {
  background-color: var(--tblr-body-bg, #111827) !important;
  color: var(--tblr-body-color, #e5e7eb);
}

html[data-bs-theme="dark"] .card,
html[data-bs-theme="dark"] .modal-content,
html[data-bs-theme="dark"] .dropdown-menu {
  background-color: var(--tblr-bg-surface, #1d273b);
  border-color: var(--tblr-border-color, #2e3c51);
  color: var(--tblr-body-color, #e5e7eb);
}

html[data-bs-theme="dark"] .jm-meeting-header {
  background-color: var(--tblr-bg-surface, #1d273b) !important;
}

html[data-bs-theme="dark"] .profile-tabs .list-group-item {
  color: var(--tblr-body-color, #e5e7eb);
}

html[data-bs-theme="dark"] .profile-tabs .list-group-item:hover {
  background-color: rgba(116, 83, 240, 0.16) !important;
  color: #c4b5fd !important;
}

html[data-bs-theme="dark"] .profile-tabs .list-group-item.active {
  background-color: rgba(116, 83, 240, 0.22) !important;
  color: #c4b5fd !important;
}

html[data-bs-theme="dark"] .jm-dashboard-security-mobile {
  background: rgba(92, 79, 224, 0.14);
  border-color: rgba(92, 79, 224, 0.28);
}

html[data-bs-theme="dark"] .jm-dashboard-security-title {
  color: #f1f5f9 !important;
}

html[data-bs-theme="dark"] .jm-dashboard-security-desc {
  color: #94a3b8 !important;
}

html[data-bs-theme="dark"] .jm-empty-pill {
  background: rgba(124, 111, 242, 0.2);
  color: #c4b5fd;
}

html[data-bs-theme="dark"] .jm-trust-badge-item svg {
  color: #a79df4;
}

html[data-bs-theme="dark"] .jm-dashboard-security-icon {
  background: rgba(47, 158, 86, 0.2);
}

/* TomSelect dark mode (invite modal tags & dropdown) */
html[data-bs-theme="dark"] .ts-wrapper .ts-control,
html[data-bs-theme="dark"] .ts-wrapper.single .ts-control,
html[data-bs-theme="dark"] .ts-wrapper.multi .ts-control {
  background-color: var(--tblr-bg-forms, #151e2e) !important;
  border-color: var(--tblr-border-color, #2e3c51) !important;
  color: var(--tblr-body-color, #e5e7eb) !important;
}

html[data-bs-theme="dark"] .ts-wrapper .ts-control > input {
  color: var(--tblr-body-color, #e5e7eb) !important;
}

html[data-bs-theme="dark"] .ts-wrapper.multi .ts-control > div.item {
  background-color: #253147 !important;
  border: 1px solid #3b4b68 !important;
  color: #e5e7eb !important;
  border-radius: 6px;
}

html[data-bs-theme="dark"] .ts-wrapper.multi .ts-control > div.item.active {
  background-color: rgba(116, 83, 240, 0.28) !important;
  border-color: var(--tblr-primary, #7453f0) !important;
  color: #fff !important;
}

html[data-bs-theme="dark"] .ts-wrapper.plugin-remove_button:not(.rtl) .item .remove {
  border-left-color: #3b4b68 !important;
  color: #9ca3af !important;
}

html[data-bs-theme="dark"] .ts-wrapper.plugin-remove_button:not(.rtl) .item .remove:hover {
  background-color: rgba(239, 68, 68, 0.18) !important;
  color: #fca5a5 !important;
}

html[data-bs-theme="dark"] .ts-dropdown {
  background-color: var(--tblr-bg-surface, #1d273b) !important;
  border-color: var(--tblr-border-color, #2e3c51) !important;
  color: var(--tblr-body-color, #e5e7eb) !important;
}

html[data-bs-theme="dark"] .ts-dropdown .option:hover,
html[data-bs-theme="dark"] .ts-dropdown .active {
  background-color: rgba(116, 83, 240, 0.22) !important;
  color: #fff !important;
}

/* Meeting lobby dark mode */
html[data-bs-theme="dark"] .jm-video-card,
html[data-bs-theme="dark"] .jm-meeting-start-details,
html[data-bs-theme="dark"] .jm-connection-check,
html[data-bs-theme="dark"] .jm-safe-connection-card,
html[data-bs-theme="dark"] #jmLobbyBottomCardsLeft #jmTechCheckBtn,
html[data-bs-theme="dark"] #jmLobbyBottomCardsLeft > .jm-safe-connection-card {
  background: var(--tblr-bg-surface, #1d273b) !important;
  border-color: var(--tblr-border-color, #2e3c51) !important;
  color: var(--tblr-body-color, #e5e7eb) !important;
}

html[data-bs-theme="dark"] #jmLobbyBottomCardsLeft #jmTechCheckBtn:hover {
  background: rgba(116, 83, 240, 0.14) !important;
  border-color: var(--tblr-primary, #7453f0) !important;
}

html[data-bs-theme="dark"] .jm-meeting-card-header-title,
html[data-bs-theme="dark"] .jm-meeting-start-heading h2,
html[data-bs-theme="dark"] .jm-meeting-start-item strong,
html[data-bs-theme="dark"] .jm-safe-connection-title,
html[data-bs-theme="dark"] .jm-lobby-tech-check-text strong,
html[data-bs-theme="dark"] .jm-lobby-top-title,
html[data-bs-theme="dark"] .jm-camera-select-label {
  color: var(--tblr-body-color, #e5e7eb) !important;
}

html[data-bs-theme="dark"] .jm-meeting-start-heading p,
html[data-bs-theme="dark"] .jm-meeting-start-item strong[data-label]::before,
html[data-bs-theme="dark"] .jm-safe-connection-sub,
html[data-bs-theme="dark"] .jm-lobby-tech-check-text small,
html[data-bs-theme="dark"] .jm-lobby-top-sub,
html[data-bs-theme="dark"] .jm-lobby-help-link,
html[data-bs-theme="dark"] .jm-lobby-joining-as {
  color: var(--tblr-secondary-color, #9ca3af) !important;
}

html[data-bs-theme="dark"] .jm-meeting-start-item svg,
html[data-bs-theme="dark"] .jm-meeting-id-copy,
html[data-bs-theme="dark"] .jm-camera-settings-gear,
html[data-bs-theme="dark"] .jm-meeting-title-edit {
  color: var(--tblr-secondary-color, #9ca3af) !important;
}

html[data-bs-theme="dark"] .jm-camera-select {
  background-color: var(--tblr-bg-forms, #151e2e) !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6l6 -6'/%3E%3C/svg%3E") !important;
  border-color: var(--tblr-border-color, #2e3c51) !important;
  color: var(--tblr-body-color, #e5e7eb) !important;
}

html[data-bs-theme="dark"] .jm-lobby-secondary-btn,
html[data-bs-theme="dark"] .jm-camera-select-row > .jm-camera-select-label {
  background: var(--tblr-bg-forms, #151e2e) !important;
  border-color: var(--tblr-border-color, #2e3c51) !important;
  color: var(--tblr-body-color, #e5e7eb) !important;
}

html[data-bs-theme="dark"] .jm-lobby-joining-as {
  background: rgba(116, 83, 240, 0.14) !important;
}

/* Pagination dark mode (meeting history, referrals, admin tables) */
html[data-bs-theme="dark"] .pagination {
  --tblr-pagination-bg: var(--tblr-bg-forms, #151e2e);
  --tblr-pagination-color: var(--tblr-body-color, #e5e7eb);
  --tblr-pagination-border-color: var(--tblr-border-color, #2e3c51);
  --tblr-pagination-hover-bg: #253147;
  --tblr-pagination-hover-color: #ffffff;
  --tblr-pagination-hover-border-color: #3b4b68;
  --tblr-pagination-focus-bg: #253147;
  --tblr-pagination-focus-color: #ffffff;
  --tblr-pagination-active-bg: var(--tblr-primary, #7453f0);
  --tblr-pagination-active-border-color: var(--tblr-primary, #7453f0);
  --tblr-pagination-active-color: #ffffff;
  --tblr-pagination-disabled-bg: rgba(21, 30, 46, 0.55);
  --tblr-pagination-disabled-color: #6b7280;
  --tblr-pagination-disabled-border-color: var(--tblr-border-color, #2e3c51);
}

html[data-bs-theme="dark"] .pagination .page-link {
  background-color: var(--tblr-bg-forms, #151e2e);
  border-color: var(--tblr-border-color, #2e3c51);
  color: var(--tblr-body-color, #e5e7eb);
}

html[data-bs-theme="dark"] .pagination .page-link:hover,
html[data-bs-theme="dark"] .pagination .page-link:focus {
  background-color: #253147;
  border-color: #3b4b68;
  color: #ffffff;
}

html[data-bs-theme="dark"] .pagination .page-item.active .page-link {
  background-color: var(--tblr-primary, #7453f0);
  border-color: var(--tblr-primary, #7453f0);
  color: #ffffff;
}

html[data-bs-theme="dark"] .pagination .page-item.disabled .page-link {
  background-color: rgba(21, 30, 46, 0.55);
  border-color: var(--tblr-border-color, #2e3c51);
  color: #6b7280;
}

/* Referrals dark mode (referrals.css loads after head, so use higher specificity) */
html[data-bs-theme="dark"] .jm-ref-page,
html[data-bs-theme="dark"] .jm-ref-wrap {
  --ref-p: #8b7cf6;
  --ref-p-soft: rgba(139, 124, 246, 0.14);
  --ref-t: #e5e7eb;
  --ref-m: #9ca3af;
  --ref-b: #2e3c51;
  color: #e5e7eb;
}

html[data-bs-theme="dark"] .jm-ref-page a.jm-ref-back {
  background: var(--tblr-bg-surface, #1d273b) !important;
  border-color: var(--tblr-border-color, #2e3c51) !important;
  color: var(--tblr-body-color, #e5e7eb) !important;
}

html[data-bs-theme="dark"] .jm-ref-page a.jm-ref-back:hover {
  background: rgba(116, 83, 240, 0.18) !important;
  border-color: var(--tblr-primary, #7453f0) !important;
  color: #c4b5fd !important;
}

html[data-bs-theme="dark"] .jm-ref-page .jm-ref-hero h1,
html[data-bs-theme="dark"] .jm-ref-page .jm-ref-h2,
html[data-bs-theme="dark"] .jm-ref-page .jm-ref-stat-value,
html[data-bs-theme="dark"] .jm-ref-page .jm-ref-step b,
html[data-bs-theme="dark"] .jm-ref-page .jm-ref-balance-head,
html[data-bs-theme="dark"] .jm-ref-page .jm-ref-balance-value,
html[data-bs-theme="dark"] .jm-ref-page .jm-ref-table td,
html[data-bs-theme="dark"] .jm-ref-page .jm-ref-user-name,
html[data-bs-theme="dark"] .jm-ref-page .jm-ref-rules li {
  color: #e5e7eb !important;
}

html[data-bs-theme="dark"] .jm-ref-page .jm-ref-h2-accent,
html[data-bs-theme="dark"] .jm-ref-page .jm-ref-hero-links a,
html[data-bs-theme="dark"] .jm-ref-page .jm-ref-bonus-cell,
html[data-bs-theme="dark"] .jm-ref-page .jm-ref-tab.is-active {
  color: #a597ff !important;
}

html[data-bs-theme="dark"] .jm-ref-page .jm-ref-tab.is-active {
  border-bottom-color: #8b7cf6 !important;
}

html[data-bs-theme="dark"] .jm-ref-page .jm-ref-muted,
html[data-bs-theme="dark"] .jm-ref-page .jm-ref-hero p,
html[data-bs-theme="dark"] .jm-ref-page .jm-ref-stat-label,
html[data-bs-theme="dark"] .jm-ref-page .jm-ref-step small,
html[data-bs-theme="dark"] .jm-ref-page .jm-ref-tab,
html[data-bs-theme="dark"] .jm-ref-page .jm-ref-table th,
html[data-bs-theme="dark"] .jm-ref-page .jm-ref-user-mail,
html[data-bs-theme="dark"] .jm-ref-page .jm-ref-note,
html[data-bs-theme="dark"] .jm-ref-page .jm-ref-empty,
html[data-bs-theme="dark"] .jm-ref-page .jm-ref-reset {
  color: #9ca3af !important;
}

html[data-bs-theme="dark"] .jm-ref-page .jm-ref-card,
html[data-bs-theme="dark"] .jm-ref-page .jm-ref-stat,
html[data-bs-theme="dark"] .jm-ref-page .jm-ref-step,
html[data-bs-theme="dark"] .jm-ref-page .jm-ref-btn-ghost,
html[data-bs-theme="dark"] .jm-ref-page .jm-ref-more {
  background: var(--tblr-bg-surface, #1d273b) !important;
  border-color: var(--tblr-border-color, #2e3c51) !important;
  color: var(--tblr-body-color, #e5e7eb) !important;
}

html[data-bs-theme="dark"] .jm-ref-page .jm-ref-btn-ghost:hover {
  background: rgba(116, 83, 240, 0.16) !important;
  color: #c4b5fd !important;
}

html[data-bs-theme="dark"] .jm-ref-page .jm-ref-steps-card {
  background: linear-gradient(180deg, rgba(116, 83, 240, 0.16), var(--tblr-bg-surface, #1d273b)) !important;
}

html[data-bs-theme="dark"] .jm-ref-page .jm-ref-balance {
  background: linear-gradient(180deg, rgba(116, 83, 240, 0.22), var(--tblr-bg-surface, #1d273b)) !important;
}

html[data-bs-theme="dark"] .jm-ref-page .jm-ref-promo {
  background: linear-gradient(180deg, rgba(116, 83, 240, 0.16), var(--tblr-bg-surface, #1d273b)) !important;
}

html[data-bs-theme="dark"] .jm-ref-page .jm-ref-input {
  background: var(--tblr-bg-forms, #151e2e) !important;
  border-color: var(--tblr-border-color, #2e3c51) !important;
  color: var(--tblr-body-color, #e5e7eb) !important;
}

html[data-bs-theme="dark"] .jm-ref-page .jm-ref-details-row td {
  background: var(--tblr-bg-forms, #151e2e) !important;
  color: #cbd5e1 !important;
}

html[data-bs-theme="dark"] .jm-ref-page .jm-ref-pending {
  color: #fbbf24 !important;
}

html[data-bs-theme="dark"] .jm-ref-page .jm-ref-badge-green {
  background: rgba(34, 197, 94, 0.16) !important;
  color: #4ade80 !important;
}

html[data-bs-theme="dark"] .jm-ref-page .jm-ref-badge-orange {
  background: rgba(245, 158, 11, 0.16) !important;
  color: #fbbf24 !important;
}

html[data-bs-theme="dark"] .jm-ref-page .jm-ref-badge-blue {
  background: rgba(96, 165, 250, 0.16) !important;
  color: #93c5fd !important;
}

html[data-bs-theme="dark"] .jm-ref-page .jm-ref-badge-gray {
  background: rgba(148, 163, 184, 0.16) !important;
  color: #cbd5e1 !important;
}

html[data-bs-theme="dark"] .jm-ref-page .jm-ref-badge-red {
  background: rgba(239, 68, 68, 0.18) !important;
  color: #fca5a5 !important;
}

/* Tech Check modal dark mode (injected <style> in jm-tech-check.js) */
html[data-bs-theme="dark"] .jm-tc-overlay {
  background: rgba(8, 12, 22, 0.72);
}

html[data-bs-theme="dark"] .jm-tc-modal {
  background: var(--tblr-bg-surface, #1d273b);
  border: 1px solid var(--tblr-border-color, #2e3c51);
  color: var(--tblr-body-color, #e5e7eb);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

html[data-bs-theme="dark"] .jm-tc-close,
html[data-bs-theme="dark"] .jm-tc-sub,
html[data-bs-theme="dark"] .jm-tc-text,
html[data-bs-theme="dark"] .jm-tc-subtext {
  color: #9ca3af;
}

html[data-bs-theme="dark"] .jm-tc-close:hover {
  color: #ffffff;
}

html[data-bs-theme="dark"] .jm-tc-row {
  border-top-color: var(--tblr-border-color, #2e3c51);
}

html[data-bs-theme="dark"] .jm-tc-bar {
  background: #253147;
}

html[data-bs-theme="dark"] .jm-tc-mini,
html[data-bs-theme="dark"] .jm-tc-done {
  border-color: #8b7cf6;
  color: #c4b5fd;
  background: rgba(116, 83, 240, 0.12);
}

html[data-bs-theme="dark"] .jm-tc-mini:hover:not([disabled]),
html[data-bs-theme="dark"] .jm-tc-done:hover {
  background: rgba(116, 83, 240, 0.22);
  color: #ffffff;
}

html[data-bs-theme="dark"] .jm-tc-subtext.ok {
  color: #4ade80;
}

html[data-bs-theme="dark"] .jm-tc-subtext.warn {
  color: #fbbf24;
}

html[data-bs-theme="dark"] .jm-tc-subtext.bad {
  color: #fca5a5;
}

/* Support modal dark mode (injected <style> in jm-support-form.js) */
html[data-bs-theme="dark"] .jm-sp-overlay {
  background: rgba(8, 12, 22, 0.72);
}

html[data-bs-theme="dark"] .jm-sp-modal {
  background: var(--tblr-bg-surface, #1d273b);
  border: 1px solid var(--tblr-border-color, #2e3c51);
  color: var(--tblr-body-color, #e5e7eb);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

html[data-bs-theme="dark"] .jm-sp-close,
html[data-bs-theme="dark"] .jm-sp-sub,
html[data-bs-theme="dark"] .jm-sp-hint,
html[data-bs-theme="dark"] .jm-sp-alt,
html[data-bs-theme="dark"] .jm-sp-ok p {
  color: #9ca3af;
}

html[data-bs-theme="dark"] .jm-sp-close:hover {
  color: #ffffff;
}

html[data-bs-theme="dark"] .jm-sp-input,
html[data-bs-theme="dark"] .jm-sp-textarea,
html[data-bs-theme="dark"] .jm-sp-from {
  background: var(--tblr-bg-forms, #151e2e);
  border: 1px solid var(--tblr-border-color, #2e3c51);
  color: var(--tblr-body-color, #e5e7eb);
}

html[data-bs-theme="dark"] .jm-sp-input::placeholder,
html[data-bs-theme="dark"] .jm-sp-textarea::placeholder {
  color: #6b7280;
}

html[data-bs-theme="dark"] .jm-sp-link {
  color: #a597ff;
}

html[data-bs-theme="dark"] .jm-sp-cancel {
  border-color: #8b7cf6;
  color: #c4b5fd;
  background: rgba(116, 83, 240, 0.12);
}

html[data-bs-theme="dark"] .jm-sp-cancel:hover {
  background: rgba(116, 83, 240, 0.22);
  color: #ffffff;
}

html[data-bs-theme="dark"] #cover-spin {
  background-color: rgba(15, 23, 42, 0.72);
}

html[data-bs-theme="dark"] .jm-filter-chip {
  background: var(--tblr-bg-surface, #1d273b);
  border-color: var(--tblr-border-color, #2e3c51);
  color: var(--tblr-body-color, #e5e7eb);
}

html[data-bs-theme="dark"] .jm-filter-chip.is-active,
html[data-bs-theme="dark"] .jm-filter-chip.active {
  background: var(--tblr-primary, #7453f0);
  border-color: var(--tblr-primary, #7453f0);
  color: #ffffff;
  font-weight: 600;
}
html[data-bs-theme="dark"] .jm-filter-chip:hover {
  background: rgba(116, 83, 240, 0.2);
  border-color: var(--tblr-primary, #7453f0);
  color: #ffffff;
}

html[data-bs-theme="dark"] .jm-e2ee-lobby-banner {
  background: rgba(22, 163, 74, 0.14);
  border-color: rgba(34, 197, 94, 0.35);
  color: #bbf7d0;
}

html[data-bs-theme="dark"] .jm-agenda-chip {
  background: rgba(116, 83, 240, 0.22);
  border-color: rgba(139, 124, 246, 0.45);
  color: #e5e7eb;
}

html[data-bs-theme="dark"] .jm-modal-adv {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--tblr-border-color, #2e3c51);
}

html[data-bs-theme="dark"] .jm-modal-adv-toggle:hover {
  background: rgba(124, 111, 242, 0.1);
}

html[data-bs-theme="dark"] .jm-modal-adv-chevron {
  color: #a79df4;
}

html[data-bs-theme="dark"] .jm-modal-adv-body {
  background: var(--tblr-bg-surface, #1d273b);
  border-top-color: var(--tblr-border-color, #2e3c51);
}

html[data-bs-theme="dark"] .jm-tfa-icon-wrap {
  background: rgba(124, 111, 242, 0.2);
  color: #a79df4;
}

html[data-bs-theme="dark"] .jm-tfa-card {
  box-shadow: 0 20px 52px rgba(0, 0, 0, 0.35);
}

