[data-theme="dark"] {
  color-scheme: dark;

  /* Bootstrap 5 internal variables */
  --bs-body-color:              #e8e6f0;
  --bs-body-color-rgb:          232, 230, 240;
  --bs-body-bg:                 #13121a;
  --bs-body-bg-rgb:             19, 18, 26;
  --bs-secondary-color:         #9490a8;
  --bs-secondary-color-rgb:     148, 144, 168;
  --bs-secondary-bg:            #1e1d28;
  --bs-secondary-bg-rgb:        30, 29, 40;
  --bs-tertiary-color:          #4e4a62;
  --bs-tertiary-bg:             #181720;
  --bs-emphasis-color:          #e8e6f0;
  --bs-emphasis-color-rgb:      232, 230, 240;
  --bs-heading-color:           #e8e6f0;
  --bs-link-color:              #9B5DD8;
  --bs-link-color-rgb:          155, 93, 216;
  --bs-link-hover-color:        #8A4EC4;
  --bs-border-color:            #2e2b3d;
  --bs-border-color-translucent: rgba(255, 255, 255, 0.12);
  --bs-form-valid-color:        #4caf81;
  --bs-form-invalid-color:      #f07070;

  /* Core brand */
  --primary:         #8B5DD8;
  --primary-hover:   #7A4EC4;
  --secondary:       #1e1d2e;
  --secondary-hover: #26253a;

  /* Dashboard accents */
  --dashboard-requested:  #9a76ea;
  --dashboard-financed:   #49c893;
  --dashboard-invoices:   #e2b85a;
  --dashboard-termsheets: #73b8df;

  /* Backgrounds */
  --background:     #13121a;
  --surface:        #1a1928;
  --surface-alt:    #181720;
  --surface-raised: #1e1d28;
  --surface-hover:  #2a283c;

  /* Semantic states */
  --success:        #1a3d2b;
  --success-light:  #152e1f;
  --success-border: #2a6040;
  --success-text:   #4caf81;
  --warning:        #3d2a12;
  --warning-border: #6b4620;
  --warning-text:   #f0a060;
  --error:          #3d1212;
  --error-border:   #6b2020;
  --error-text:     #f07070;
  --danger:         #e85555;

  /* Text */
  --text-main:      #e8e6f0;
  --text-secondary: #9490a8;
  --text-disabled:  #4e4a62;

  /* Borders */
  --border:        #2e2b3d;
  --border-light:  #2e2b3d;
  --border-medium: #2e2b3d;
  --border-hover:  #424060;

  /* Layout */
  --sidebar-hover: #1e1d2e;
  --footer-bg:     #1e1d28;
  --footer-text:   #9490a8;

  /* Scrollbars */
  --scrollbar-track:       #1a1928;
  --scrollbar-thumb:       #2e2b3d;
  --scrollbar-thumb-hover: #424060;

  /* Auth page */
  --auth-bg:          #0f0e18;
  --auth-footer-text: #9B5DD8;
}

/* Form inputs override for ATB dark theme */
[data-theme="dark"] .form-control {
  background-color: #1e1d28 !important;
  color: #e8e6f0 !important;
  border-color: #2e2b3d !important;
}

[data-theme="dark"] .form-select {
  background-color: #1e1d28 !important;
  color: #e8e6f0 !important;
  border-color: #2e2b3d !important;
  accent-color: #8B5DD8;
}

[data-theme="dark"] .form-control:focus {
  background-color: #1e1d28 !important;
  border-color: #8B5DD8 !important;
  box-shadow: 0 0 0 0.2rem rgba(139, 93, 216, 0.25) !important;
}

[data-theme="dark"] .form-select:focus {
  background-color: #1e1d28 !important;
  border-color: #8B5DD8 !important;
  box-shadow: 0 0 0 0.2rem rgba(139, 93, 216, 0.25) !important;
}

/* Native select popup colors (Windows/Chromium) */
[data-theme="dark"] .form-select option,
[data-theme="dark"] select.form-select option {
  background-color: #1e1d28 !important;
  color: #e8e6f0 !important;
}

[data-theme="dark"] .form-select option:checked,
[data-theme="dark"] .form-select option:hover,
[data-theme="dark"] .form-select option:focus,
[data-theme="dark"] select.form-select option:checked,
[data-theme="dark"] select.form-select option:hover,
[data-theme="dark"] select.form-select option:focus {
  background-color: #8B5DD8 !important;
  color: #FFFFFF !important;
  box-shadow: 0 0 0 100vmax #8B5DD8 inset !important;
}

[data-theme="dark"] .form-control::placeholder {
  color: #9490a8 !important;
}

[data-theme="dark"] input.form-control {
  background-color: #1e1d28 !important;
}

[data-theme="dark"] input.form-control:focus {
  background-color: #1e1d28 !important;
}

/* Disabled form fields styling for dark theme */
[data-theme="dark"] .form-control:disabled,
[data-theme="dark"] .form-control[readonly],
[data-theme="dark"] .form-select:disabled,
[data-theme="dark"] .form-select[readonly],
[data-theme="dark"] input.form-control:disabled,
[data-theme="dark"] input.form-control[readonly],
[data-theme="dark"] textarea.form-control:disabled,
[data-theme="dark"] textarea.form-control[readonly] {
  background-color: #181720 !important;
  border-color: #2e2b3d !important;
  color: #4e4a62 !important;
  cursor: not-allowed;
}

/* Override browser autofill styling for dark theme */
[data-theme="dark"] input:-webkit-autofill,
[data-theme="dark"] input:-webkit-autofill:hover,
[data-theme="dark"] input:-webkit-autofill:focus,
[data-theme="dark"] input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 30px #1e1d28 inset !important;
  -webkit-text-fill-color: #e8e6f0 !important;
}

[data-theme="dark"] input:-webkit-autofill {
  border-color: #2e2b3d !important;
}

[data-theme="dark"] input:-webkit-autofill:focus {
  border-color: #8B5DD8 !important;
  -webkit-box-shadow: 0 0 0 30px #1e1d28 inset, 0 0 0 0.2rem rgba(139, 93, 216, 0.25) !important;
}
