/* White Label eKYC — global dark mode
   Activated by <html class="dark"> (Tailwind darkMode: 'class').
   Remaps common light utilities so existing pages/popups pick up dark theme
   without editing every template. */

html.dark {
  color-scheme: dark;
}

html.dark body {
  background-color: #0b1220 !important;
  color: #e5e7eb !important;
}

/* ---------- Tailwind gray / white remaps ---------- */
html.dark .bg-white { background-color: #111827 !important; }
html.dark .bg-gray-25,
html.dark .bg-gray-50 { background-color: #0b1220 !important; }
html.dark .bg-gray-100 { background-color: #1f2937 !important; }
html.dark .bg-slate-50,
html.dark .bg-slate-100 { background-color: #1f2937 !important; }
html.dark .bg-gray-50\/70,
html.dark .bg-gray-50\/80 { background-color: rgba(17, 24, 39, 0.85) !important; }
html.dark .bg-white\/95 { background-color: rgba(17, 24, 39, 0.95) !important; }

html.dark .border-gray-100,
html.dark .border-gray-200,
html.dark .border-gray-300,
html.dark .border-slate-100,
html.dark .border-slate-200 { border-color: #374151 !important; }

html.dark .text-gray-900,
html.dark .text-gray-800,
html.dark .text-slate-900,
html.dark .text-slate-800,
html.dark .text-brand-text { color: #f3f4f6 !important; }
html.dark .text-gray-700,
html.dark .text-gray-600,
html.dark .text-slate-700,
html.dark .text-slate-600 { color: #d1d5db !important; }
html.dark .text-gray-500,
html.dark .text-gray-400,
html.dark .text-slate-500,
html.dark .text-slate-400 { color: #9ca3af !important; }
html.dark .text-gray-300 { color: #6b7280 !important; }
html.dark .text-blue-600,
html.dark .text-blue-500,
html.dark a.text-blue-600 { color: #93c5fd !important; }

/* Bootstrap / legacy file inputs */
html.dark .form-control,
html.dark .form-control-lg,
html.dark .docs-file-input,
html.dark input[type="file"].form-control,
html.dark input[type="file"].docs-file-input {
  background-color: #0f172a !important;
  border: 1px solid #374151 !important;
  color: #e5e7eb !important;
  border-radius: 0.5rem;
}
html.dark .form-control:disabled,
html.dark .form-control:read-only {
  background-color: #1f2937 !important;
  color: #9ca3af !important;
}
html.dark input[type="file"]::file-selector-button,
html.dark input[type="file"]::-webkit-file-upload-button {
  background: #1f2937 !important;
  color: #e5e7eb !important;
  border: 1px solid #4b5563 !important;
  border-radius: 0.375rem;
  padding: 0.35rem 0.75rem;
  margin-right: 0.75rem;
  cursor: pointer;
}

/* Required / incomplete: cue on controls only. Labels keep normal text-gray-800 look. */
html.dark label.error_form_value,
html.dark h2.error_form_value,
html.dark p.error_form_value,
html.dark .text-gray-800.error_form_value,
html.dark .text-gray-900.error_form_value,
html.dark #iForm label.error_form_value,
html.dark #iForm h2.error_form_value,
html.dark #iForm p.error_form_value {
  background-color: transparent !important;
  border: none !important;
  padding: 0 !important;
  color: #f3f4f6 !important; /* same as text-gray-800 in dark mode */
}
html.dark input.error_form_value:not([type="radio"]):not([type="checkbox"]),
html.dark textarea.error_form_value,
html.dark select.error_form_value {
  background-color: #0f172a !important;
  border-color: #f87171 !important;
  color: #e5e7eb !important;
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.45);
}
html.dark input.error_form_value[type="radio"],
html.dark input.error_form_value[type="checkbox"] {
  background-color: transparent !important;
  outline: 2px solid #f87171;
  outline-offset: 2px;
}

html.dark .hover\:bg-gray-50:hover,
html.dark .hover\:bg-gray-50\/70:hover,
html.dark .hover\:bg-gray-50\/80:hover,
html.dark .hover\:bg-gray-100:hover,
html.dark .hover\:bg-gray-100\/80:hover,
html.dark .dark\:hover\:bg-gray-800\/80:hover,
html.dark .dark\:hover\:bg-gray-800:hover {
  background-color: #1f2937 !important; /* gray-800 — readable with light text */
}
html.dark .hover\:bg-white:hover { background-color: #1f2937 !important; }

/* Choice chips + finance tabs (CKA, Net Worth/Cash Flow, risk profile, etc.) */
html.dark .choice-chip,
html.dark .tab-btn-idle,
html.dark #cashflow_tab.tab-btn-idle,
html.dark #networth_tab.tab-btn-idle {
  background: #1f2937 !important;
  border-color: #4b5563 !important;
  color: #e5e7eb !important;
}
html.dark .choice-chip .cka_options {
  color: #e5e7eb !important;
}
html.dark .choice-chip:has(:checked) {
  background: color-mix(in srgb, var(--brand-main, #465fff) 22%, #111827) !important;
  border-color: color-mix(in srgb, var(--brand-main, #465fff) 55%, #374151) !important;
  color: #f3f4f6 !important;
}
html.dark .tab-btn-active,
html.dark #cashflow_tab.tab-btn-active,
html.dark #networth_tab.tab-btn-active {
  background: var(--brand-main, #465fff) !important;
  border-color: var(--brand-main, #465fff) !important;
  color: var(--brand-text-on-main, #fff) !important;
}
html.dark #iForm .money-field,
html.dark #regular_amount_table .money-field,
html.dark #single_amount_table .money-field {
  background: #0f172a !important;
  border-color: #4b5563 !important;
  box-shadow: none !important;
}
html.dark #iForm .money-field .dollar_sign,
html.dark #regular_amount_table .money-field span,
html.dark #single_amount_table .money-field span {
  color: #9ca3af !important;
}
html.dark #iForm .money-field .input-col,
html.dark #iForm .money-field input {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: #e5e7eb !important;
}
html.dark #iForm .money-field:has(.error_form_value) {
  border-color: #f87171 !important;
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.45) !important;
}
html.dark .choice-chip:has(:checked) .cka_options {
  color: #f3f4f6 !important;
}
html.dark .choice-chip input[type="checkbox"],
html.dark .choice-chip input[type="radio"],
html.dark #iForm .choice-chip input.input-col[type="checkbox"],
html.dark #iForm .choice-chip input.input-col[type="radio"] {
  border-color: #9ca3af !important;
  background: #111827 !important;
}
html.dark #iForm .choice-chip input.input-col[type="checkbox"]:checked,
html.dark #iForm .choice-chip input.input-col[type="radio"]:checked {
  border-color: var(--brand-main, #465fff) !important;
  background-color: var(--brand-main, #465fff) !important;
}

/* Existing policies — wl-field avoids bg-white remap blending into cards */
html.dark #existing_policies_box .wl-field,
html.dark #existing_policies_box .input-col.wl-field:not([type="radio"]):not([type="checkbox"]),
html.dark #existing_policies_box select.wl-field,
html.dark #existing_policies_box textarea.wl-field {
  background-color: #1f2937 !important;
  border: 1px solid #9ca3af !important;
  color: #f9fafb !important;
  box-shadow: none;
}
html.dark #existing_policies_box .wl-field:focus {
  border-color: var(--brand-main, #465fff) !important;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-main, #465fff) 40%, transparent) !important;
}

/* Existing policies — funding type chips (CASH / CPF / SRS) */
html.dark .funding-chip {
  background: #1f2937 !important;
  border-color: #4b5563 !important;
  color: #e5e7eb !important;
}
html.dark .funding-chip:has(:checked) {
  background: color-mix(in srgb, var(--brand-main, #465fff) 22%, #111827) !important;
  border-color: color-mix(in srgb, var(--brand-main, #465fff) 55%, #374151) !important;
  color: #f3f4f6 !important;
}
html.dark #iForm .funding-chip input[type="checkbox"] {
  border-color: #9ca3af !important;
  background: #111827 !important;
  accent-color: var(--brand-main, #465fff);
}
html.dark #iForm .funding-chip input[type="checkbox"]:checked {
  border-color: var(--brand-main, #465fff) !important;
  background-color: var(--brand-main, #465fff) !important;
}

/* Diagrams with baked-in dark text (e.g. risk_reward.svg) — keep light canvas */
html.dark .risk-chart-panel {
  background-color: #f3f4f6 !important;
  border: 1px solid #d1d5db;
}

/* FNA priority tabs — inactive only (active keeps brand fill).
   Exclude BOR drag chips (#priorities_div / .bor-dropped-priority) — those stay brand. */
html.dark .fna_tabs:not(.fna_tabs_active):not(.fna_tabs_mobile),
html.dark #iForm .fna_tabs:not(.fna_tabs_active):not(.fna_tabs_mobile) {
  background: #1f2937 !important;
  border-color: #4b5563 !important;
  color: #e5e7eb !important;
}
html.dark .fna_tabs:not(.fna_tabs_active):not(.fna_tabs_mobile) p,
html.dark .fna_tabs:not(.fna_tabs_active):not(.fna_tabs_mobile) span,
html.dark .fna_tabs:not(.fna_tabs_active):not(.fna_tabs_mobile) i,
html.dark #iForm .fna_tabs:not(.fna_tabs_active):not(.fna_tabs_mobile) p,
html.dark #iForm .fna_tabs:not(.fna_tabs_active):not(.fna_tabs_mobile) span,
html.dark #iForm .fna_tabs:not(.fna_tabs_active):not(.fna_tabs_mobile) i {
  color: #e5e7eb !important;
}
html.dark .fna_tabs_label,
html.dark #iForm .fna_tabs_label {
  color: #9ca3af !important;
}
html.dark .fna_tab_education:not(.fna_tabs_active),
html.dark #iForm .fna_tab_education:not(.fna_tabs_active) {
  background: #1f2937 !important;
  border-color: #6d28d9 !important;
  color: #ddd6fe !important;
}

/* BOR page surfaces */
html.dark #bor_page .bor-content-card {
  background-color: #111827 !important;
  border-color: #374151 !important;
}
html.dark #bor_table .bor_left_column,
html.dark #bor_page #bor_table .bor_left_column {
  background: #1f2937 !important;
  border-color: #374151 !important;
  color: #e5e7eb !important;
}
html.dark #bor_table .bor_left_column label,
html.dark #bor_table .bor_left_column .label-text-middle-left,
html.dark #bor_table .label-text-middle-left,
html.dark #bor_page #bor_table .bor_left_column label,
html.dark #bor_page #bor_table .label-text-middle-left {
  color: #e5e7eb !important;
}
html.dark #bor_table .bor_left_column p,
html.dark #bor_table .bor_left_column span,
html.dark #bor_table .bor_left_column small {
  color: #9ca3af !important;
}
html.dark #priorities_div .bor-priority-pool {
  background: #0f172a !important;
  border-color: #374151 !important;
}
html.dark #priorities_div .fna_tabs.fna_tabs_mobile,
html.dark #bor_page .bor-drop-area .bor-dropped-priority {
  background: var(--brand-main, #465fff) !important;
  border-color: var(--brand-main, #465fff) !important;
  color: var(--brand-text-on-main, #fff) !important;
}

/* Priorities page — pool cards + HIGH/MEDIUM/LOW drop table */
html.dark #priorities_div.priorities_div,
html.dark .selected_priorities_table {
  color: #e5e7eb;
}
html.dark .priority_type_column {
  background-color: #1f2937 !important;
  border-color: #4b5563 !important;
}
html.dark .priority_cardv2 {
  background-color: #1f2937 !important;
  border-color: #4b5563 !important;
  color: #e5e7eb !important;
  box-shadow: none;
}
html.dark .priority_cardv2::before {
  background-image: radial-gradient(circle, #9ca3af 1.15px, transparent 1.25px);
}
html.dark .priority_cardv2:hover {
  border-color: var(--brand-main, #465fff) !important;
}
html.dark .priority_cardv2.floating {
  background-color: #111827 !important;
  border-color: var(--brand-main, #465fff) !important;
}
html.dark .selected_priorities {
  background-color: color-mix(in srgb, var(--brand-main, #465fff) 22%, #111827) !important;
  border-color: color-mix(in srgb, var(--brand-main, #465fff) 55%, #374151) !important;
  color: #f3f4f6 !important;
}
html.dark .droppable {
  background-color: #0f172a !important;
  border-color: #4b5563 !important;
}
html.dark .droppable:hover,
html.dark .droppable.drag-over {
  border-color: var(--brand-main, #465fff) !important;
  background-color: color-mix(in srgb, var(--brand-main, #465fff) 14%, #0f172a) !important;
}
html.dark .selected_priorities_table th,
html.dark .selected_priorities_table td {
  color: #e5e7eb;
}
html.dark .selected_priorities_table th {
  color: #d1d5db !important;
}
html.dark #bor_page .bor-drop-area {
  background: #0f172a !important;
  border-color: #4b5563 !important;
}
html.dark #bor_page .bor-tab-btn-idle {
  background: #1f2937 !important;
  border-color: #4b5563 !important;
  color: #e5e7eb !important;
}
html.dark #bor_page .bor-tab-btn-active,
html.dark #bor_page #add_bor.bor-add-btn {
  background: color-mix(in srgb, var(--brand-main, #465fff) 22%, #111827) !important;
  border-color: color-mix(in srgb, var(--brand-main, #465fff) 45%, #374151) !important;
  color: #f3f4f6 !important;
}
html.dark #bor_page .bor-compared-item,
html.dark #bor_page .bor-ph-item {
  background: #1f2937 !important;
  border-color: #374151 !important;
  color: #e5e7eb !important;
}
html.dark #bor_page .bor-txn-option {
  background: #1f2937 !important;
  border-color: #4b5563 !important;
  color: #e5e7eb !important;
}
html.dark #bor_page .bor-txn-option:has(:checked) {
  background: color-mix(in srgb, var(--brand-main, #465fff) 22%, #111827) !important;
  border-color: color-mix(in srgb, var(--brand-main, #465fff) 45%, #374151) !important;
  color: #f3f4f6 !important;
}

/* Products page — tabs + priority drop zones */
html.dark #products_page .bor-content-card {
  background-color: #111827 !important;
  border-color: #374151 !important;
}
html.dark #products_page .products-tab-btn:not(.tab_active) {
  background: #1f2937 !important;
  border-color: #4b5563 !important;
  color: #e5e7eb !important;
}
html.dark #products_page .products-tab-btn.tab_active {
  background: color-mix(in srgb, var(--brand-main, #465fff) 22%, #111827) !important;
  border-color: color-mix(in srgb, var(--brand-main, #465fff) 45%, #374151) !important;
  color: #f3f4f6 !important;
}
html.dark #products_page .parent.droppable,
html.dark #prod_table_life .parent.droppable,
html.dark #prod_table_cis .parent.droppable {
  background: #0f172a !important;
  border-color: #4b5563 !important;
}
html.dark #prod_table_life .fna_tabs,
html.dark #prod_table_cis .fna_tabs,
html.dark #products_page .parent.droppable .fna_tabs {
  background: color-mix(in srgb, var(--brand-main, #465fff) 22%, #111827) !important;
  color: #f3f4f6 !important;
}
html.dark #products_page .bor_left_column,
html.dark #prod_table_life .bor_left_column,
html.dark #prod_table_cis .bor_left_column {
  background: transparent !important;
  border: 0 !important;
  color: #e5e7eb !important;
}
html.dark #prod_table_life td.life-bor-col .label-text-middle-left {
  color: #ffffff !important;
}

/* Accredited Investor page */
html.dark #ai_page {
  color: #f3f4f6;
}
html.dark #ai_page .rounded-2xl.border.border-gray-200.bg-white,
html.dark #ai_page .overflow-hidden.rounded-2xl.border.border-gray-200.bg-white {
  background-color: #111827 !important;
  border-color: #374151 !important;
}
html.dark #ai_page h1,
html.dark #ai_page h2,
html.dark #ai_page .text-gray-800 {
  color: #f3f4f6 !important;
}
html.dark #ai_page p,
html.dark #ai_page .text-gray-700,
html.dark #ai_page label,
html.dark #ai_page li {
  color: #e5e7eb !important;
}
html.dark #ai_page .text-gray-500 {
  color: #9ca3af !important;
}
html.dark #ai_page .ai-criteria-row,
html.dark #ai_page .ai-decl-item {
  background: #0f172a !important;
  border-color: #374151 !important;
}
html.dark #ai_page .ai-answer-col {
  background: #1f2937 !important;
  border-color: #4b5563 !important;
}
html.dark #ai_page .choice-chip {
  background: #1f2937 !important;
  border-color: #4b5563 !important;
  color: #e5e7eb !important;
}
html.dark #ai_page .choice-chip:has(:checked) {
  background: color-mix(in srgb, var(--brand-main, #465fff) 22%, #111827) !important;
  border-color: color-mix(in srgb, var(--brand-main, #465fff) 45%, #374151) !important;
  color: #f3f4f6 !important;
}
html.dark #ai_page .input-col:not([type="radio"]):not([type="checkbox"]) {
  background: #0f172a !important;
  border-color: #374151 !important;
  color: #e5e7eb !important;
}
html.dark #ai_page .border-amber-200.bg-amber-50 {
  background-color: rgba(120, 53, 15, 0.45) !important;
  border-color: rgba(251, 191, 36, 0.55) !important;
}
html.dark #ai_page .border-amber-200.bg-amber-50 h3,
html.dark #ai_page .border-amber-200.bg-amber-50 p,
html.dark #ai_page .border-amber-200.bg-amber-50 .text-amber-900,
html.dark .text-amber-900 {
  color: #fde68a !important;
}

/* Documents page */
html.dark #docs_page {
  color: #f3f4f6;
}
html.dark #docs_page .rounded-2xl.border.border-gray-200.bg-white {
  background-color: #111827 !important;
  border-color: #374151 !important;
}
html.dark #docs_page .docs-section-title {
  background: #1f2937 !important;
  border-color: #4b5563 !important;
  color: #f3f4f6 !important;
}
html.dark #docs_page .docs-table {
  background: #0f172a !important;
  border-color: #374151 !important;
}
html.dark #docs_page .docs-table th {
  background: #1f2937 !important;
  color: #f3f4f6 !important;
  border-color: #374151 !important;
}
html.dark #docs_page .docs-table td {
  background: #0f172a !important;
  color: #e5e7eb !important;
  border-color: #374151 !important;
}
html.dark #docs_page .docs-table tbody tr:hover,
html.dark #docs_page .docs-table tbody tr:hover > td {
  background-color: #0f172a !important;
}
html.dark #docs_page .input-col:not([type="radio"]):not([type="checkbox"]):not([type="file"]),
html.dark #docs_page select.input-col {
  background-color: #0f172a !important;
  border-color: #374151 !important;
  color: #e5e7eb !important;
}
html.dark #docs_page .docs-file-input,
html.dark #docs_page input[type="file"],
html.dark #docs_page .form-control {
  background-color: #0f172a !important;
  border: 1px solid #374151 !important;
  color: #e5e7eb !important;
  border-radius: 0.5rem;
}
html.dark #docs_page input[type="file"]::file-selector-button,
html.dark #docs_page input[type="file"]::-webkit-file-upload-button {
  background: #1f2937 !important;
  color: #e5e7eb !important;
  border: 1px solid #4b5563 !important;
  border-radius: 0.375rem;
  padding: 0.35rem 0.75rem;
  margin-right: 0.75rem;
  cursor: pointer;
}

/* Checklist page */
html.dark #checklist_page {
  color: #f3f4f6;
}
html.dark #checklist_page .rounded-2xl.border.border-gray-200.bg-white {
  background-color: #111827 !important;
  border-color: #374151 !important;
}
html.dark #checklist_page .checklist-table {
  background: #0f172a !important;
  border-color: #374151 !important;
}
html.dark #checklist_page .checklist-table th,
html.dark #checklist_page .checklist-table td {
  color: #e5e7eb !important;
  border-color: #374151 !important;
}
html.dark #checklist_page .checklist-table tbody tr:hover,
html.dark #checklist_page .checklist-table tbody tr:hover > td {
  background-color: transparent !important;
}
html.dark #checklist_page .td_header_text {
  background: #1f2937 !important;
  color: #f3f4f6 !important;
}
html.dark #checklist_page .td_category_text {
  background: #111827 !important;
  color: #d1d5db !important;
}

/* Client Declaration page */
html.dark #client_declaration_page {
  color: #f3f4f6;
}
html.dark #client_declaration_page .rounded-2xl.border.border-gray-200.bg-white {
  background-color: #111827 !important;
  border-color: #374151 !important;
}
html.dark #client_declaration_page .bg-slate-50,
html.dark #client_declaration_page .bg-gray-50,
html.dark #client_declaration_page .fna_wrapper {
  background-color: #1f2937 !important;
  border-color: #374151 !important;
}
html.dark #client_declaration_page h1,
html.dark #client_declaration_page .text-gray-800,
html.dark #client_declaration_page .text-slate-800 {
  color: #f3f4f6 !important;
}
html.dark #client_declaration_page p,
html.dark #client_declaration_page .text-gray-700,
html.dark #client_declaration_page label {
  color: #e5e7eb !important;
}
html.dark #client_declaration_page a,
html.dark #client_declaration_page .text-blue-600 {
  color: #93c5fd !important;
}
html.dark #client_declaration_page .choice-chip {
  background: #1f2937 !important;
  border-color: #4b5563 !important;
  color: #e5e7eb !important;
}
html.dark #client_declaration_page .choice-chip:has(:checked) {
  background: color-mix(in srgb, var(--brand-main, #465fff) 22%, #111827) !important;
  border-color: color-mix(in srgb, var(--brand-main, #465fff) 45%, #374151) !important;
  color: #f3f4f6 !important;
}
html.dark #client_declaration_page .cd-sign-pad {
  background:
    linear-gradient(#0f172a, #0f172a) padding-box,
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 27px,
      rgba(148, 163, 184, 0.12) 28px
    ) !important;
  background-color: #0f172a !important;
}
html.dark #client_declaration_page .cd-sign-pad img:not(.is-empty) {
  filter: none !important;
  -webkit-filter: none !important;
}
html.dark #client_declaration_page .input-col:not([type="radio"]):not([type="checkbox"]) {
  background: #0f172a !important;
  border-color: #374151 !important;
  color: #e5e7eb !important;
}

/* Rep Declaration page */
html.dark #rep_declaration_page {
  color: #f3f4f6;
}
html.dark #rep_declaration_page .rounded-2xl.border.border-gray-200.bg-white {
  background-color: #111827 !important;
  border-color: #374151 !important;
}
html.dark #rep_declaration_page .bg-slate-50,
html.dark #rep_declaration_page .bg-gray-50,
html.dark #rep_declaration_page #join_detail_table,
html.dark #rep_declaration_page .fna_wrapper {
  background-color: #1f2937 !important;
  border-color: #374151 !important;
}
html.dark #rep_declaration_page h1,
html.dark #rep_declaration_page .text-gray-800,
html.dark #rep_declaration_page .text-slate-800 {
  color: #f3f4f6 !important;
}
html.dark #rep_declaration_page p,
html.dark #rep_declaration_page .text-gray-700,
html.dark #rep_declaration_page label {
  color: #e5e7eb !important;
}
html.dark #rep_declaration_page .choice-chip {
  background: #1f2937 !important;
  border-color: #4b5563 !important;
  color: #e5e7eb !important;
}
html.dark #rep_declaration_page .choice-chip:has(:checked) {
  background: color-mix(in srgb, var(--brand-main, #465fff) 22%, #111827) !important;
  border-color: color-mix(in srgb, var(--brand-main, #465fff) 45%, #374151) !important;
  color: #f3f4f6 !important;
}
html.dark #rep_declaration_page .rep-sign-pad {
  background: #0f172a !important;
  background-color: #0f172a !important;
}
html.dark #rep_declaration_page .rep-sign-pad img:not(.is-empty),
html.dark #rep_declaration_page #adviser_signature_png,
html.dark #rep_declaration_page #wm2_signature_png {
  filter: none !important;
  -webkit-filter: none !important;
}
html.dark #rep_declaration_page .input-col:not([type="radio"]):not([type="checkbox"]),
html.dark #rep_declaration_page select.input-col {
  background-color: #0f172a !important;
  border-color: #374151 !important;
  color: #e5e7eb !important;
}
html.dark #rep_declaration_page .warning_text {
  color: #fbbf24 !important;
}

/* Trusted Individual page */
html.dark #ti_page {
  color: #f3f4f6;
}
html.dark #ti_page .rounded-2xl.border.border-gray-200.bg-white,
html.dark #ti_page #ti_table_content,
html.dark #ti_page #ti_table_ti_details,
html.dark #ti_page #ti_reasons_section {
  background-color: #111827 !important;
  border-color: #374151 !important;
}
html.dark #ti_page h1,
html.dark #ti_page h2,
html.dark #ti_page .text-gray-800 {
  color: #f3f4f6 !important;
}
html.dark #ti_page p,
html.dark #ti_page .text-gray-700,
html.dark #ti_page label {
  color: #e5e7eb !important;
}
html.dark #ti_page .criteria-table {
  border-color: #374151 !important;
  background: #0f172a !important;
}
html.dark #ti_page .criteria-table th {
  background: #1f2937 !important;
  color: #f3f4f6 !important;
  border-color: #374151 !important;
}
html.dark #ti_page .criteria-table td {
  background: #0f172a !important;
  color: #e5e7eb !important;
  border-color: #374151 !important;
}
html.dark #ti_page .criteria-table tbody tr:hover,
html.dark #ti_page .criteria-table tbody tr:hover > td {
  background-color: #0f172a !important;
}
html.dark #ti_page .choice-chip {
  background: #1f2937 !important;
  border-color: #4b5563 !important;
  color: #e5e7eb !important;
}
html.dark #ti_page .choice-chip:has(:checked) {
  background: color-mix(in srgb, var(--brand-main, #465fff) 22%, #111827) !important;
  border-color: color-mix(in srgb, var(--brand-main, #465fff) 45%, #374151) !important;
  color: #f3f4f6 !important;
}
html.dark #ti_page .ti-sign-card {
  background: #0f172a !important;
  border-color: #374151 !important;
}
html.dark #ti_page .ti-sign-card-title {
  background: color-mix(in srgb, var(--brand-main, #465fff) 22%, #111827) !important;
  border-bottom-color: #374151 !important;
  color: #f3f4f6 !important;
}
html.dark #ti_page .ti-sign-pad,
html.dark #ti_page #ti_signature_pad_td {
  background: #0f172a !important;
  background-color: #0f172a !important;
}
html.dark #ti_page .ti-sign-pad img:not(.is-empty),
html.dark #ti_page #signature_png:not(.is-empty) {
  filter: none !important;
}
html.dark #ti_page .ti-sign-btn {
  background: #1f2937 !important;
  border-color: #4b5563 !important;
  color: #e5e7eb !important;
}
html.dark #ti_page .ti-sign-meta {
  background: #1f2937 !important;
  border-top-color: #374151 !important;
  color: #d1d5db !important;
}
html.dark #ti_page .ti-sign-meta strong {
  color: #f3f4f6 !important;
}
html.dark #ti_page .input-col:not([type="radio"]):not([type="checkbox"]) {
  background: #0f172a !important;
  border-color: #374151 !important;
  color: #e5e7eb !important;
}

/* Beneficial Owner page */
html.dark #bo_page {
  color: #f3f4f6;
}
html.dark #bo_page .rounded-2xl.border.border-gray-200.bg-white,
html.dark #bo_page .overflow-hidden.rounded-2xl.border.border-gray-200.bg-white {
  background-color: #111827 !important;
  border-color: #374151 !important;
}
html.dark #bo_page h1,
html.dark #bo_page h2,
html.dark #bo_page .text-gray-800 {
  color: #f3f4f6 !important;
}
html.dark #bo_page p,
html.dark #bo_page .text-gray-700,
html.dark #bo_page label,
html.dark #bo_page span {
  color: #e5e7eb !important;
}
html.dark #bo_page .text-gray-500 {
  color: #9ca3af !important;
}
html.dark #bo_page .bo-applicant-panel {
  background: #0f172a !important;
  border-color: #374151 !important;
}
html.dark #bo_page .choice-chip {
  background: #1f2937 !important;
  border-color: #4b5563 !important;
  color: #e5e7eb !important;
}
html.dark #bo_page .choice-chip:has(:checked) {
  background: color-mix(in srgb, var(--brand-main, #465fff) 22%, #111827) !important;
  border-color: color-mix(in srgb, var(--brand-main, #465fff) 45%, #374151) !important;
  color: #f3f4f6 !important;
}
html.dark #bo_page .ShowHideBar {
  background: #1f2937 !important;
  border-color: #4b5563 !important;
  color: #e5e7eb !important;
}
html.dark #bo_page .ShowHideToggle {
  color: #93c5fd !important;
}
html.dark #bo_page .input-col:not([type="radio"]):not([type="checkbox"]) {
  background: #0f172a !important;
  border-color: #374151 !important;
  color: #e5e7eb !important;
}

/* PEP page */
html.dark #pep_page {
  color: #f3f4f6;
}
html.dark #pep_page .rounded-2xl.border.border-gray-200.bg-white,
html.dark #pep_page #pep_info_table,
html.dark #pep_page #pep_details_table {
  background-color: #111827 !important;
  border-color: #374151 !important;
}
html.dark #pep_page h1,
html.dark #pep_page h2,
html.dark #pep_page .text-gray-800 {
  color: #f3f4f6 !important;
}
html.dark #pep_page p,
html.dark #pep_page .text-gray-700,
html.dark #pep_page label,
html.dark #pep_page span {
  color: #e5e7eb !important;
}
html.dark #pep_page .text-gray-400,
html.dark #pep_page .pep-question-card p.text-xs {
  color: #9ca3af !important;
}
html.dark #pep_page .tab-btn-idle {
  background: #1f2937 !important;
  border-color: #4b5563 !important;
  color: #e5e7eb !important;
}
html.dark #pep_page .tab-btn-active {
  background: color-mix(in srgb, var(--brand-main, #465fff) 22%, #111827) !important;
  border-color: color-mix(in srgb, var(--brand-main, #465fff) 45%, #374151) !important;
  color: #f3f4f6 !important;
}
html.dark #pep_page .choice-chip,
html.dark #pep_page .source-of-fund-item {
  background: #1f2937 !important;
  border-color: #4b5563 !important;
  color: #e5e7eb !important;
}
html.dark #pep_page .choice-chip:has(:checked),
html.dark #pep_page .source-of-fund-item:has(:checked) {
  background: color-mix(in srgb, var(--brand-main, #465fff) 22%, #111827) !important;
  border-color: color-mix(in srgb, var(--brand-main, #465fff) 45%, #374151) !important;
  color: #f3f4f6 !important;
}
html.dark #pep_page .pep-question-card {
  background: #0f172a !important;
  border-color: #374151 !important;
}
html.dark #pep_page .input-col:not([type="radio"]):not([type="checkbox"]) {
  background: #0f172a !important;
  border-color: #374151 !important;
  color: #e5e7eb !important;
}

/* Recommendation page */
html.dark #recommendation_page {
  color: #f3f4f6;
}
html.dark #recommendation_page .rounded-2xl.border.border-gray-200.bg-white,
html.dark #recommendation_page .overflow-hidden.rounded-2xl.border.border-gray-200.bg-white {
  background-color: #111827 !important;
  border-color: #374151 !important;
}
html.dark #recommendation_page h1,
html.dark #recommendation_page .text-gray-800 {
  color: #f3f4f6 !important;
}
html.dark #recommendation_page #bor_wrapper_recommendation {
  background-color: #0f172a !important;
  border-color: #374151 !important;
}
html.dark #recommendation_page .recommendation-tab-btn:not(.tab_active),
html.dark #recommendation_page .recommendation-tab-btn.tab_inactive,
html.dark #recommendation_page .rec-product-tab-btn:not(.is-active) {
  background: #1f2937 !important;
  border-color: #4b5563 !important;
  color: #e5e7eb !important;
}
html.dark #recommendation_page .recommendation-tab-btn.tab_active,
html.dark #recommendation_page .rec-product-tab-btn.is-active {
  background: color-mix(in srgb, var(--brand-main, #465fff) 22%, #111827) !important;
  border-color: color-mix(in srgb, var(--brand-main, #465fff) 45%, #374151) !important;
  color: #f3f4f6 !important;
}
html.dark #recommendation_page .bor_left_column,
html.dark #recommendation_page .label-text-middle-left,
html.dark #recommendation_page label,
html.dark #recommendation_page td,
html.dark #recommendation_page th,
html.dark #recommendation_page .tr_title td {
  color: #f3f4f6 !important;
}
html.dark #recommendation_page .parent.droppable {
  background-color: #0f172a !important;
  border-color: #4b5563 !important;
}
html.dark #recommendation_page .fna_tabs {
  background: color-mix(in srgb, var(--brand-main, #465fff) 22%, #111827) !important;
  color: #f3f4f6 !important;
}
html.dark #recommendation_page .input-col:not([type="radio"]):not([type="checkbox"]):not([type="button"]):not([type="submit"]),
html.dark #recommendation_page select,
html.dark #recommendation_page textarea {
  background-color: #0f172a !important;
  border-color: #374151 !important;
  color: #e5e7eb !important;
}

/* Tailwind option chips (personal / co-applicant Title, Gender, etc.) */
html.dark label.inline-flex.border.border-gray-200.bg-white {
  background-color: #1f2937 !important;
  border-color: #4b5563 !important;
  color: #e5e7eb !important;
}
html.dark label.inline-flex.has-\[\:checked\]\:bg-brand-light:has(:checked) {
  background-color: color-mix(in srgb, var(--brand-main, #465fff) 22%, #111827) !important;
  border-color: color-mix(in srgb, var(--brand-main, #465fff) 55%, #374151) !important;
  color: #f3f4f6 !important;
}

/* Table row / divider contrast */
html.dark .divide-gray-100 > :not([hidden]) ~ :not([hidden]),
html.dark .divide-y.divide-gray-100 > * + * {
  border-color: #374151 !important;
}
html.dark table:not(#prod_table_cis):not(#prod_table_life):not(#bor_table) tbody tr:hover,
html.dark table:not(#prod_table_cis):not(#prod_table_life):not(#bor_table) tbody tr:hover > td,
html.dark table:not(#prod_table_cis):not(#prod_table_life):not(#bor_table) tbody tr:hover > th {
  background-color: #1f2937 !important;
}
html.dark #products_page #prod_table_cis tbody tr:hover,
html.dark #products_page #prod_table_cis tbody tr:hover > td,
html.dark #products_page #prod_table_cis tbody tr:hover > th,
html.dark #products_page #prod_table_cis table tbody tr:hover,
html.dark #products_page #prod_table_cis table tbody tr:hover > td,
html.dark #products_page #prod_table_life tbody tr:hover,
html.dark #products_page #prod_table_life tbody tr:hover > td {
  background-color: transparent !important;
}

html.dark .bg-brand-light { background-color: color-mix(in srgb, var(--brand-main, #465fff) 22%, #111827) !important; }
html.dark .bg-amber-50 { background-color: rgba(120, 53, 15, 0.35) !important; }
html.dark .text-amber-700,
html.dark .text-amber-800,
html.dark .text-amber-900 { color: #fbbf24 !important; }
html.dark .border-amber-200,
html.dark .border-amber-300 { border-color: rgba(251, 191, 36, 0.35) !important; }
html.dark .ring-amber-200\/80 { --tw-ring-color: rgba(251, 191, 36, 0.35) !important; }

/* Soft status / pill badge colors (Pending, Rejected, Draft, Active, …) */
html.dark .bg-blue-50 { background-color: rgba(59, 130, 246, 0.22) !important; }
html.dark .text-blue-700,
html.dark .text-blue-800 { color: #93c5fd !important; }
html.dark .border-blue-100,
html.dark .border-blue-200 { border-color: rgba(59, 130, 246, 0.35) !important; }

html.dark .bg-red-50 { background-color: rgba(239, 68, 68, 0.22) !important; }
html.dark .text-red-700,
html.dark .text-red-800 { color: #fca5a5 !important; }
html.dark .border-red-100,
html.dark .border-red-200 { border-color: rgba(239, 68, 68, 0.35) !important; }
html.dark .hover\:bg-red-50:hover { background-color: rgba(239, 68, 68, 0.28) !important; }
html.dark .hover\:text-red-600:hover,
html.dark .hover\:text-red-500:hover { color: #f87171 !important; }

html.dark .bg-emerald-50 { background-color: rgba(16, 185, 129, 0.22) !important; }
html.dark .text-emerald-700,
html.dark .text-emerald-800 { color: #6ee7b7 !important; }
html.dark .border-emerald-100,
html.dark .border-emerald-200,
html.dark .border-emerald-300 { border-color: rgba(16, 185, 129, 0.35) !important; }
html.dark .hover\:bg-emerald-100:hover { background-color: rgba(16, 185, 129, 0.32) !important; }

html.dark .bg-green-50 { background-color: rgba(34, 197, 94, 0.22) !important; }
html.dark .text-green-700,
html.dark .text-green-800 { color: #86efac !important; }

html.dark .bg-orange-50 { background-color: rgba(249, 115, 22, 0.22) !important; }
html.dark .text-orange-700,
html.dark .text-orange-800 { color: #fdba74 !important; }

html.dark .bg-yellow-50 { background-color: rgba(234, 179, 8, 0.22) !important; }
html.dark .text-yellow-700,
html.dark .text-yellow-800 { color: #fde047 !important; }

html.dark .bg-purple-50 { background-color: rgba(168, 85, 247, 0.22) !important; }
html.dark .text-purple-700,
html.dark .text-purple-800 { color: #d8b4fe !important; }

html.dark .bg-rose-50 { background-color: rgba(244, 63, 94, 0.22) !important; }
html.dark .text-rose-700 { color: #fda4af !important; }

html.dark .bg-sky-50 { background-color: rgba(14, 165, 233, 0.22) !important; }
html.dark .text-sky-700 { color: #7dd3fc !important; }

html.dark .bg-cyan-50 { background-color: rgba(6, 182, 212, 0.22) !important; }
html.dark .text-cyan-700 { color: #67e8f9 !important; }

html.dark .bg-indigo-50 { background-color: rgba(99, 102, 241, 0.22) !important; }
html.dark .text-indigo-700 { color: #a5b4fc !important; }

html.dark .hover\:bg-amber-50:hover { background-color: rgba(120, 53, 15, 0.45) !important; }
html.dark .hover\:bg-amber-100:hover { background-color: rgba(120, 53, 15, 0.55) !important; }

html.dark .shadow-theme,
html.dark .shadow-theme-md,
html.dark .shadow-theme-xs {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.35) !important;
}

/* ---------- Form controls ---------- */
html.dark input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="reset"]),
html.dark textarea:not(.select2-search__field) {
  background-color: #0f172a !important;
  border-color: #374151 !important;
  color: #e5e7eb !important;
}
/* Native selects: dark field + light chevron (replace light-mode white-box arrows) */
html.dark select {
  background-color: #0f172a !important;
  border-color: #374151 !important;
  color: #e5e7eb !important;
  color-scheme: dark;
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.75rem center !important;
  background-size: 1rem !important;
  padding-right: 2.25rem !important;
}
/* Inputs nested in money-field chrome stay borderless/transparent */
html.dark .money-field input,
html.dark .money-field .input-col {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: #e5e7eb !important;
}

/* Brand primary buttons + icons stay white on brand fill */
html.dark .bg-brand-main,
html.dark button.bg-brand-main,
html.dark a.bg-brand-main {
  color: #ffffff !important;
}
html.dark .bg-brand-main i,
html.dark .bg-brand-main .fa-solid,
html.dark .bg-brand-main .fas,
html.dark .bg-brand-main .fa,
html.dark button.bg-brand-main i,
html.dark a.bg-brand-main i {
  color: #ffffff !important;
}

/* Primary action buttons (e.g. Create) — keep a clear dark-blue fill */
html.dark #create_new_form input[type="submit"],
html.dark #create_new_form_form input[type="submit"] {
  background-color: #1e3a8a !important; /* blue-900 */
  border: 1px solid #60a5fa !important; /* blue-400 */
  color: #ffffff !important;
}
html.dark #create_new_form input[type="submit"]:hover,
html.dark #create_new_form_form input[type="submit"]:hover {
  background-color: #1e40af !important; /* blue-800 */
}
html.dark input::placeholder,
html.dark textarea::placeholder {
  color: #6b7280 !important;
}
html.dark option {
  background-color: #111827;
  color: #e5e7eb;
}

/* ---------- Tables ---------- */
html.dark table,
html.dark th,
html.dark td {
  border-color: #374151 !important;
  color: #e5e7eb;
}
html.dark thead th,
html.dark .td_header,
html.dark .td_header td,
html.dark .table > thead,
html.dark .supervisor-approval-panel thead th,
html.dark .supervisor-approval-panel th[colspan] {
  background: #1f2937 !important;
  color: #d1d5db !important;
  border-color: #374151 !important;
}
html.dark .table,
html.dark .table-bordered,
html.dark .table-bordered > :not(caption) > *,
html.dark .table-bordered > :not(caption) > * > * {
  border-color: #374151 !important;
  color: #e5e7eb;
  --bs-table-bg: #1f2937 !important;
  --bs-table-color: #e5e7eb !important;
  --bs-table-border-color: #374151 !important;
  --bs-table-striped-bg: #111827 !important;
  --bs-table-hover-bg: #374151 !important;
  --bs-table-accent-bg: transparent !important;
  --bs-table-bg-type: transparent !important;
  --bs-table-bg-state: transparent !important;
}
html.dark .table > :not(caption) > * > *,
html.dark .table-bordered > :not(caption) > * > * {
  background-color: #1f2937 !important;
  color: #e5e7eb !important;
  border-color: #374151 !important;
  box-shadow: none !important;
}
html.dark .table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: rgba(31, 41, 55, 0.45) !important;
  color: #e5e7eb;
}
html.dark .supervisor-approval-panel th,
html.dark .supervisor-approval-panel td,
html.dark .followup-approval-panel th,
html.dark .followup-approval-panel td {
  border-bottom-color: #374151 !important;
}
html.dark .followup-approval-panel thead th,
html.dark .followup-approval-panel th[colspan] {
  background: #1f2937 !important;
  color: #d1d5db !important;
  border-color: #374151 !important;
}
html.dark .followup-approval-panel,
html.dark #open_tab_attachment,
html.dark #open_tab_products,
html.dark #open_tab,
html.dark #pdf_view,
html.dark #pdf_view_pages {
  background-color: #111827 !important;
  border-color: #374151 !important;
  color: #e5e7eb !important;
}
html.dark .followup-approval-panel a,
html.dark .followup-approval-panel .global-pointer {
  color: #93c5fd !important;
}

/* Legacy checklist / panel header bars (#24397b, #d0d0d0) */
html.dark [style*="background-color: #24397b"],
html.dark [style*="background-color:#24397b"],
html.dark [style*="background-color: #24397B"],
html.dark [style*="background-color:#24397B"] {
  background-color: color-mix(in srgb, var(--brand-main, #465fff) 55%, #0b1220) !important;
  color: #fff !important;
}
html.dark [style*="background-color: #d0d0d0"],
html.dark [style*="background-color:#d0d0d0"],
html.dark [style*="background-color: #D0D0D0"] {
  background-color: #1f2937 !important;
  color: #d1d5db !important;
}

/* ---------- Layout shell ---------- */
html.dark header.sticky,
html.dark #sidebar {
  background-color: #111827 !important;
  border-color: #1f2937 !important;
}
html.dark #sidebarBackdrop {
  background-color: rgba(0, 0, 0, 0.65) !important;
}

/* ---------- Approval / nav active ---------- */
html.dark .approval-nav-btn.is-active {
  background: color-mix(in srgb, var(--brand-main, #465fff) 22%, #111827) !important;
  border-color: color-mix(in srgb, var(--brand-main, #465fff) 40%, #374151) !important;
}
html.dark .approval-nav-btn .approval-nav-icon {
  background: #1f2937 !important;
  color: #9ca3af !important;
}
html.dark .approval-nav-btn.is-active .approval-nav-icon {
  background: color-mix(in srgb, var(--brand-main, #465fff) 25%, #111827) !important;
  color: var(--brand-main, #465fff) !important;
}
html.dark .sa-pdf-shell #controls,
html.dark #controls,
html.dark #controls.pdf-toolbar,
html.dark #controls_kyc {
  background: #111827 !important;
  background-color: #111827 !important;
  border-bottom-color: #374151 !important;
  color: #e5e7eb !important;
}
html.dark .sa-pdf-shell #controls .btn,
html.dark .sa-pdf-shell #controls button,
html.dark .sa-pdf-shell #controls .pdf-toolbar-btn,
html.dark #controls .btn,
html.dark #controls button,
html.dark #controls .pdf-toolbar-btn,
html.dark #controls_kyc .btn,
html.dark #controls_kyc button {
  background: #1f2937 !important;
  background-color: #1f2937 !important;
  border-color: #374151 !important;
  color: #e5e7eb !important;
  box-shadow: none !important;
}
html.dark #controls .pdf-toolbar-btn:hover,
html.dark #controls_kyc .btn:hover {
  background: #374151 !important;
  border-color: #4b5563 !important;
  color: #f3f4f6 !important;
}
html.dark #controls #page_number_input,
html.dark #controls input[type="number"] {
  background: #0f172a !important;
  border-color: #374151 !important;
  color: #e5e7eb !important;
}
html.dark .sa-pdf-shell #pdf_view_container,
html.dark .sa-pdf-shell #pdf_view_container_kyc,
html.dark #pdf_view_container,
html.dark #pdf_view_container_kyc {
  background-color: #0b1220 !important;
  border-color: #374151 !important;
}

/* ---------- Popups / modals / floating panels ---------- */
html.dark .center-float-div,
html.dark .ui-draggable,
html.dark [id$="_div"].center-float-div,
html.dark #popup_message_dialog,
html.dark #signature-wrapper,
html.dark #create_new_form,
html.dark #download_partial_pdf_div,
html.dark #push_follow_up > .relative,
html.dark .modal-content,
html.dark .modal-dialog .modal-content,
html.dark #import_client_update_div,
html.dark #refresh_modal > div,
html.dark [class*="center-float"] {
  background-color: #111827 !important;
  border-color: #374151 !important;
  color: #e5e7eb !important;
}

/* Partial PDF download modal */
html.dark #download_partial_pdf_div {
  background: #111827 !important;
  background-color: #111827 !important;
  border: 1px solid #374151 !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.55) !important;
  color: #e5e7eb !important;
}
html.dark #download_partial_pdf_div .table,
html.dark #download_partial_pdf_div .table-bordered,
html.dark #download_partial_pdf_div table,
html.dark #download_partial_pdf_div tr,
html.dark #download_partial_pdf_div th,
html.dark #download_partial_pdf_div td {
  background: #1f2937 !important;
  background-color: #1f2937 !important;
  border-color: #374151 !important;
  color: #e5e7eb !important;
  --bs-table-bg: #1f2937 !important;
  --bs-table-color: #e5e7eb !important;
  --bs-table-border-color: #374151 !important;
  --bs-table-striped-bg: #111827 !important;
  --bs-table-hover-bg: #374151 !important;
}
html.dark #download_partial_pdf_div td i,
html.dark #download_partial_pdf_div .fa-file,
html.dark #download_partial_pdf_div .global-pointer:not(.fa-close) {
  color: #93c5fd !important;
}
html.dark #download_partial_pdf_div .fa-close {
  color: #f87171 !important;
}

/* KYC attachments modal (#files_processing_attachment) */
html.dark #files_processing_attachment .rounded-2xl.border.bg-white,
html.dark #files_processing_attachment > div > div.relative {
  background-color: #111827 !important;
  border-color: #374151 !important;
  color: #e5e7eb !important;
}
html.dark #files_processing_attachment #kyc_attachments_body,
html.dark #files_processing_attachment .max-h-\[80vh\] {
  background-color: transparent !important;
  color: #e5e7eb !important;
}
html.dark #files_processing_attachment table,
html.dark #files_processing_attachment .table,
html.dark #files_processing_attachment .table-bordered,
html.dark #files_processing_attachment tr,
html.dark #files_processing_attachment th,
html.dark #files_processing_attachment td {
  background: #1f2937 !important;
  background-color: #1f2937 !important;
  border-color: #374151 !important;
  color: #e5e7eb !important;
  --bs-table-bg: #1f2937 !important;
  --bs-table-color: #e5e7eb !important;
  --bs-table-border-color: #374151 !important;
  --bs-table-striped-bg: #111827 !important;
  --bs-table-accent-bg: transparent !important;
  --bs-table-bg-type: transparent !important;
  --bs-table-bg-state: transparent !important;
  box-shadow: none !important;
}
html.dark #files_processing_attachment .table > :not(caption) > * > * {
  background-color: #1f2937 !important;
  color: #e5e7eb !important;
  border-color: #374151 !important;
  box-shadow: none !important;
  --bs-table-bg: #1f2937 !important;
  --bs-table-accent-bg: transparent !important;
}
html.dark #files_processing_attachment thead th {
  background: #0f172a !important;
  color: #d1d5db !important;
}
html.dark #files_processing_attachment a,
html.dark #files_processing_attachment a.padding-right-10 {
  color: #93c5fd !important;
}
html.dark #files_processing_attachment a:hover {
  color: #bfdbfe !important;
}
html.dark #files_processing_attachment hr {
  border-color: #374151 !important;
  opacity: 1;
}
html.dark #files_processing_attachment #form_pdf label,
html.dark #files_processing_attachment #form_pdf .form-signed-row {
  color: #e5e7eb !important;
}
html.dark #files_processing_attachment #form_pdf .form-control,
html.dark #files_processing_attachment #form_pdf select,
html.dark #files_processing_attachment #form_pdf #filename,
html.dark #files_processing_attachment select#filename {
  background-color: #0f172a !important;
  border: 1px solid #374151 !important;
  color: #e5e7eb !important;
  color-scheme: dark;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.65rem center !important;
  background-size: 1rem !important;
}
html.dark #files_processing_attachment #form_pdf #filename option,
html.dark #files_processing_attachment select#filename option,
html.dark #files_processing_attachment #form_pdf .form-control option {
  background-color: #111827 !important;
  color: #e5e7eb !important;
}
html.dark #files_processing_attachment #form_pdf .btn-primary {
  background: color-mix(in srgb, var(--brand-main, #465fff) 22%, #111827) !important;
  border-color: color-mix(in srgb, var(--brand-main, #465fff) 45%, #374151) !important;
  color: #f3f4f6 !important;
}

/* Signature pad modal */
html.dark #signature-wrapper {
  background: #111827 !important;
  background-color: #111827 !important;
  border-color: #374151 !important;
  color: #e5e7eb !important;
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.55),
    0 0 0 100vmax rgba(0, 0, 0, 0.55) !important;
}
html.dark #signature-wrapper > label,
html.dark #signature-wrapper label {
  color: #f3f4f6 !important;
}
/* Capture pad stays white so black ink remains visible while signing */
html.dark #signature-container,
html.dark #signature,
html.dark #signature canvas,
html.dark #signature-container canvas {
  background-color: #ffffff !important;
  background: #ffffff !important;
  border-color: #facc15 !important;
  color: #000000 !important;
}
html.dark #signature-wrapper button,
html.dark #signature-wrapper button.input-col,
html.dark #signature-wrapper #cancel-button,
html.dark #signature-wrapper #clear-signature {
  background: #1f2937 !important;
  background-color: #1f2937 !important;
  border-color: #4b5563 !important;
  color: #e5e7eb !important;
}
html.dark #signature-wrapper #save-signature {
  background: color-mix(in srgb, var(--brand-main, #465fff) 22%, #111827) !important;
  background-color: color-mix(in srgb, var(--brand-main, #465fff) 22%, #111827) !important;
  border-color: color-mix(in srgb, var(--brand-main, #465fff) 45%, #374151) !important;
  color: #f3f4f6 !important;
}

/* Display signature pads — dark surface + inverted ink preview */
html.dark .cd-sign-pad,
html.dark .rep-sign-pad,
html.dark .ti-sign-pad,
html.dark #ti_signature_pad_td,
html.dark .td_signature,
html.dark .signature_table .td_bordered.td_signature,
html.dark .mobile-ti-signature-pad,
html.dark .mobile-cd-signature-pad,
html.dark .mobile-rep-signature-pad {
  background:
    linear-gradient(#0f172a, #0f172a) padding-box,
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 27px,
      rgba(148, 163, 184, 0.12) 28px
    ) !important;
  background-color: #0f172a !important;
}
html.dark .cd-sign-pad img:not(.is-empty),
html.dark .rep-sign-pad img:not(.is-empty),
html.dark .ti-sign-pad img:not(.is-empty),
html.dark #signature_png:not(.is-empty),
html.dark #main_signature_png,
html.dark #co_signature_png,
html.dark #ti_signature_png,
html.dark #adviser_signature_png,
html.dark #wm2_signature_png,
html.dark .td_signature img,
html.dark .signature_img,
html.dark .mobile-ti-signature-pad img,
html.dark .mobile-cd-signature-pad img,
html.dark .mobile-rep-signature-pad img,
html.dark .client_signature_div img,
html.dark .client_signature_div-followup img {
  /* White ink is applied by WLSignature.paintWhitePreview (JS). Do not CSS-invert. */
  filter: none !important;
  -webkit-filter: none !important;
  /* Override fdpl `img { background: white }` so ink is not lost on a white blank */
  background: transparent !important;
  background-color: transparent !important;
}
html.dark .signature_img[src=""],
html.dark .td_signature img[src=""] {
  display: none !important;
}

/* Portfolio Risk Calculator modal (inline light gray / white table) */
html.dark #riskCalculatorModal,
html.dark #riskCalculatorModal[style] {
  background: #111827 !important;
  background-color: #111827 !important;
  color: #e5e7eb !important;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.55) !important;
}
html.dark #riskCalculatorModal .tr_title td,
html.dark #riskCalculatorModal td,
html.dark #riskCalculatorModal th,
html.dark #riskCalculatorModal label,
html.dark #riskCalculatorModal span,
html.dark #riskCalculatorModal strong {
  color: #e5e7eb !important;
}
html.dark #riskCalculatorModal #dragHandle {
  color: #d1d5db !important;
}
html.dark #riskCalculatorModal #fundTable,
html.dark #riskCalculatorModal #fundTable[style] {
  background-color: #0f172a !important;
  border-color: #374151 !important;
  color: #e5e7eb !important;
}
html.dark #riskCalculatorModal #fundTable th,
html.dark #riskCalculatorModal #fundTable td {
  background-color: #0f172a !important;
  border-color: #374151 !important;
  color: #e5e7eb !important;
}
html.dark #riskCalculatorModal #fundTable thead th {
  background-color: #1f2937 !important;
  color: #f3f4f6 !important;
}
html.dark #riskCalculatorModal #fundTable tfoot td {
  background-color: #111827 !important;
}
html.dark #riskCalculatorModal .input-col:not([type="button"]):not([type="submit"]),
html.dark #riskCalculatorModal select.input-col {
  background-color: #0f172a !important;
  border-color: #374151 !important;
  color: #e5e7eb !important;
}
html.dark #riskCalculatorModal #autosaveStatus {
  color: #86efac !important;
}

/* Legacy white backgrounds from fdpl_main / main.css */
html.dark [style*="background-color: white"],
html.dark [style*="background-color:#fff"],
html.dark [style*="background-color: #fff"],
html.dark [style*="background:#fff"],
html.dark [style*="background: #fff"],
html.dark [style*="background-color:rgb(255"],
html.dark [style*="background-color: rgb(255"],
html.dark [style*="background-color:#e8e8e8"],
html.dark [style*="background-color: #e8e8e8"],
html.dark [style*="background-color:#e5e7eb"],
html.dark [style*="background-color: #e5e7eb"] {
  background-color: #374151 !important;
  color: #9ca3af !important;
}
html.dark [style*="255, 208, 208"],
html.dark [style*="rgb(255, 208, 208)"] {
  background-color: rgba(248, 113, 113, 0.28) !important;
  color: #fecaca !important;
}
html.dark .input-readonly-locked,
html.dark input.input-col[readonly].input-readonly-locked,
html.dark input.input-col:disabled {
  background-color: #374151 !important;
  border-color: #4b5563 !important;
  color: #9ca3af !important;
}
html.dark .input-readonly-risk-high {
  background-color: rgba(248, 113, 113, 0.28) !important;
  border-color: rgba(248, 113, 113, 0.45) !important;
  color: #fecaca !important;
}
html.dark #popup_message_dialog .text-gray-700,
html.dark #popup_message {
  color: #e5e7eb !important;
}
html.dark .ui-widget-content,
html.dark .ui-dialog,
html.dark .ui-dialog-content {
  background: #111827 !important;
  color: #e5e7eb !important;
  border-color: #374151 !important;
}
html.dark .ui-dialog-titlebar {
  background: #1f2937 !important;
  color: #f3f4f6 !important;
  border-color: #374151 !important;
}

/* Fixed overlay backdrops stay dim */
html.dark .fixed.inset-0.bg-gray-900\/40,
html.dark [class*="bg-gray-900/"] {
  background-color: rgba(0, 0, 0, 0.65) !important;
}

/* ---------- Select2 ---------- */
html.dark .select2-container--default .select2-selection--single,
html.dark .select2-container--default .select2-selection--multiple,
html.dark #iForm .select2-container .select2-selection--multiple {
  background-color: #0f172a !important;
  border-color: #4b5563 !important;
  color: #e5e7eb !important;
}
html.dark .select2-dropdown {
  background-color: #111827 !important;
  border-color: #374151 !important;
  color: #e5e7eb !important;
}
html.dark .select2-container--default .select2-results__option {
  border-bottom-color: #374151 !important;
  color: #e5e7eb !important;
}
html.dark .select2-container--default .select2-results__option[aria-selected="true"] {
  background-color: #1f2937 !important;
}
html.dark .select2-container--default .select2-results__option--highlighted[aria-selected],
html.dark .select2-container--default .select2-results__option--highlighted {
  background-color: var(--brand-main, #465fff) !important;
  color: #fff !important;
}
html.dark .select2-container--default .select2-selection--multiple .select2-selection__choice {
  background-color: #1f2937 !important;
  border-color: #4b5563 !important;
  color: #e5e7eb !important;
}
html.dark .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
  color: #9ca3af !important;
}
html.dark .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
  color: #fca5a5 !important;
}
html.dark .select2-search__field,
html.dark textarea.select2-search__field,
html.dark .select2-container--default .select2-search--inline .select2-search__field {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: #e5e7eb !important;
}
html.dark .select2-search__field.error_form_value,
html.dark textarea.select2-search__field.error_form_value {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: #e5e7eb !important;
}
html.dark .select2-container:has(.error_form_value) .select2-selection,
html.dark .select2-container.select2-container--error .select2-selection,
html.dark select.error_form_value + .select2-container .select2-selection {
  border-color: #f87171 !important;
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.45) !important;
}
html.dark .select2-container--default .select2-selection--single .select2-selection__rendered {
  color: #e5e7eb !important;
}
html.dark .select2-container--default .select2-selection--single .select2-selection__placeholder,
html.dark .select2-container--default .select2-selection--multiple .select2-selection__placeholder {
  color: #6b7280 !important;
}

/* ---------- Legacy fdpl / main cards ---------- */
html.dark .card,
html.dark .panel,
html.dark .box,
html.dark .content-box,
html.dark .dashboard-card,
html.dark .form-style,
html.dark .form_style {
  background-color: #111827 !important;
  color: #e5e7eb !important;
  border-color: #374151 !important;
}
html.dark .button_standard,
html.dark .btn-default {
  background-color: #1f2937 !important;
  color: #e5e7eb !important;
  border-color: #374151 !important;
}

/* TinyMCE editor chrome (content iframe uses oxide-dark when html.dark) */
html.dark .tox-tinymce,
html.dark .tox .tox-toolbar,
html.dark .tox .tox-menubar,
html.dark .tox .tox-edit-area__iframe {
  border-color: #374151 !important;
}
html.dark .tox .tox-toolbar,
html.dark .tox .tox-toolbar__primary,
html.dark .tox .tox-menubar,
html.dark .tox .tox-statusbar {
  background-color: #1f2937 !important;
}
html.dark .tox .tox-tbtn,
html.dark .tox .tox-tbtn__select-label,
html.dark .tox .tox-statusbar__path-item,
html.dark .tox .tox-statusbar__wordcount {
  color: #e5e7eb !important;
}
html.dark .tox .tox-tbtn svg {
  fill: #e5e7eb !important;
}
html.dark .tox .tox-edit-area__iframe {
  background: #0f172a !important;
}

/* Generate Recommendation page */
html.dark #generate_recommendation_page {
  color: #f3f4f6;
}
html.dark #generate_recommendation_page .rounded-2xl.border.border-gray-200.bg-white,
html.dark #generate_recommendation_page .overflow-hidden.rounded-2xl.border.border-gray-200.bg-white {
  background-color: #111827 !important;
  border-color: #374151 !important;
}
html.dark #generate_recommendation_page h1,
html.dark #generate_recommendation_page .text-gray-800 {
  color: #f3f4f6 !important;
}
html.dark #generate_recommendation_page #recommendation_wrapper {
  background: #0f172a !important;
  border-color: #374151 !important;
  color: #e5e7eb !important;
  box-shadow: none !important;
}
html.dark #generate_recommendation_page .btn,
html.dark #generate_recommendation_page .btn-secondary,
html.dark #generate_recommendation_page button.input-col {
  background: color-mix(in srgb, var(--brand-main, #465fff) 22%, #111827) !important;
  border-color: color-mix(in srgb, var(--brand-main, #465fff) 45%, #374151) !important;
  color: #f3f4f6 !important;
}

/* Theme toggle icon swap */
html.dark #themeToggle .theme-icon-sun { display: none; }
html.dark #themeToggle .theme-icon-moon { display: inline-flex; }
html:not(.dark) #themeToggle .theme-icon-sun { display: inline-flex; }
html:not(.dark) #themeToggle .theme-icon-moon { display: none; }

/* Priority M/C badges (Products dropzones + legacy inline styles) */
.priority-badge-main,
.priority-badge-co {
  display: inline-block;
  border-radius: 4px;
  padding: 2px 4px;
  font-style: normal;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
}
.priority-badge-main {
  background-color: rgb(228, 238, 255);
  color: #1d4ed8;
}
.priority-badge-co {
  background-color: rgb(255, 253, 119);
  color: #854d0e;
}
html.dark .priority-badge-main,
html.dark .fna-tab-badge-main,
html.dark i.bg-blue-50 {
  background-color: rgba(59, 130, 246, 0.35) !important;
  color: #bfdbfe !important;
}
html.dark .priority-badge-co,
html.dark .fna-tab-badge-co,
html.dark i.bg-amber-100 {
  background-color: rgba(251, 191, 36, 0.35) !important;
  color: #fde68a !important;
}
html.dark i[style*="228, 238, 255"],
html.dark i[style*="228,238,255"] {
  background-color: rgba(59, 130, 246, 0.35) !important;
  color: #bfdbfe !important;
}
html.dark i[style*="255, 253, 119"],
html.dark i[style*="255,253,119"] {
  background-color: rgba(251, 191, 36, 0.35) !important;
  color: #fde68a !important;
}

/* Client survey (/client_survey/) */
html.dark #survey_body {
  background: #0b1220 !important;
  background-color: #0b1220 !important;
  color: #e5e7eb !important;
}
html.dark #survey_body .round_field {
  background: #111827 !important;
  background-color: #111827 !important;
  border-color: #374151 !important;
  color: #e5e7eb !important;
}
html.dark #survey_body .survey-info-card,
html.dark #survey_body .survey-choice {
  background-color: #1f2937 !important;
  color: #e5e7eb !important;
}
html.dark #survey_body .survey-error {
  color: #fca5a5 !important;
}
html.dark #survey_body .btn-primary_iform,
html.dark #survey_body input.btn-primary_iform {
  background: color-mix(in srgb, var(--brand-main, #465fff) 22%, #111827) !important;
  border: 1px solid color-mix(in srgb, var(--brand-main, #465fff) 45%, #374151) !important;
  color: #f3f4f6 !important;
}

/* Supervisor checklist / approval signature */
html.dark #open_tab_supervisor_checklist {
  background-color: #111827 !important;
  border-color: #374151 !important;
  color: #e5e7eb !important;
}
html.dark #open_tab_supervisor_checklist .supervisor-sign-pad,
html.dark .supervisor-sign-pad {
  background: #0f172a !important;
  background-color: #0f172a !important;
  border-color: #4b5563 !important;
}
html.dark #open_tab_supervisor_checklist #supervisor_signature_png,
html.dark #open_tab_supervisor_checklist img[alt="Supervisor signature"],
html.dark .supervisor-sign-pad img {
  filter: none !important;
  -webkit-filter: none !important;
  background: transparent !important;
}
html.dark #open_tab_supervisor_checklist table,
html.dark #open_tab_supervisor_checklist .table,
html.dark #open_tab_supervisor_checklist td,
html.dark #open_tab_supervisor_checklist th {
  background-color: #1f2937 !important;
  border-color: #374151 !important;
  color: #e5e7eb !important;
  --bs-table-bg: #1f2937 !important;
  --bs-table-accent-bg: transparent !important;
  box-shadow: none !important;
}
html.dark #open_tab_supervisor_checklist .table > :not(caption) > * > * {
  background-color: #1f2937 !important;
  color: #e5e7eb !important;
  box-shadow: none !important;
}

/* Client follow-up panels: border instead of light box-shadow */
html.dark .page-button-container-pc,
html.dark #page-button-container-pc,
html.dark .followup-text {
  box-shadow: none !important;
  border: 1px solid #374151 !important;
  background-color: #111827 !important;
  color: #e5e7eb !important;
}
html.dark .client_signature_div-followup,
html.dark .client_signature_div {
  box-shadow: none !important;
  border: 1px solid #374151 !important;
}
