/* App-wide theming tokens */
:root {
  --brisk-theme-bg: #f5f7ff;
  --brisk-theme-surface: #ffffff;
  --brisk-theme-surface-strong: #ffffff;
  --brisk-theme-text: #2f3444;
  --brisk-theme-muted: #6b7280;
  --brisk-theme-border: #d8dfec;
  --brisk-theme-navbar: #ffffff;
  --brisk-theme-sidebar: #ffffff;
  --brisk-theme-input: #ffffff;
  --brisk-theme-input-border: #c8d0df;
  --brisk-theme-link: #2b5ac6;
}

html[data-theme='dark'] {
  --brisk-theme-bg: #0f172a;
  --brisk-theme-surface: #111827;
  --brisk-theme-surface-strong: #1f2937;
  --brisk-theme-text: #e5e7eb;
  --brisk-theme-muted: #9ca3af;
  --brisk-theme-border: #334155;
  --brisk-theme-navbar: #111827;
  --brisk-theme-sidebar: #0b1222;
  --brisk-theme-input: #0b1222;
  --brisk-theme-input-border: #334155;
  --brisk-theme-link: #93c5fd;
}

html[data-theme='dark'] body {
  background: var(--brisk-theme-bg);
  color: var(--brisk-theme-text);
}

html[data-theme='dark'] .container-scroller,
html[data-theme='dark'] .container-fluid.page-body-wrapper,
html[data-theme='dark'] .page-body-wrapper,
html[data-theme='dark'] .main-panel,
html[data-theme='dark'] .content-wrapper {
  background: transparent;
  color: var(--brisk-theme-text);
}

html[data-theme='dark'] .navbar.default-layout,
html[data-theme='dark'] .navbar.default-layout .navbar-brand-wrapper,
html[data-theme='dark'] .navbar.default-layout .navbar-menu-wrapper {
  background: var(--brisk-theme-navbar);
  color: var(--brisk-theme-text);
  border-color: var(--brisk-theme-border);
}

html[data-theme='dark'] #top-bar .nav-link,
html[data-theme='dark'] #top-bar .navbar-nav .nav-item,
html[data-theme='dark'] #top-bar .navbar-nav .nav-item i {
  color: var(--brisk-theme-text);
}

html[data-theme='dark'] .sidebar,
html[data-theme='dark'] .sidebar .nav,
html[data-theme='dark'] .sidebar .nav .nav-item .collapse,
html[data-theme='dark'] .sidebar .nav .nav-item .collapsing,
html[data-theme='dark'] .sidebar .nav .nav-item .collapse .sub-menu,
html[data-theme='dark'] .sidebar .nav .nav-item .collapse.show .sub-menu {
  background: var(--brisk-theme-sidebar);
  border-color: var(--brisk-theme-border);
}

html[data-theme='dark'] .sidebar .nav .nav-item .nav-link,
html[data-theme='dark'] .sidebar .nav .nav-item .nav-link .menu-title,
html[data-theme='dark'] .sidebar .nav .nav-item .nav-link .menu-icon,
html[data-theme='dark'] .sidebar .nav .nav-item .nav-link i,
html[data-theme='dark'] .sidebar .nav .sub-menu .nav-item .nav-link {
  color: var(--brisk-theme-text);
}

html[data-theme='dark'] .sidebar .nav .nav-item.active > .nav-link,
html[data-theme='dark'] .sidebar .nav .sub-menu .nav-item .nav-link.nav-link-selected {
  background: rgba(147, 197, 253, 0.15);
}

html[data-theme='dark'] .card,
html[data-theme='dark'] .dropdown-menu,
html[data-theme='dark'] .modal-content,
html[data-theme='dark'] .list-group-item,
html[data-theme='dark'] .settings-panel {
  background: var(--brisk-theme-surface);
  color: var(--brisk-theme-text);
  border-color: var(--brisk-theme-border);
}

html[data-theme='dark'] .card-header,
html[data-theme='dark'] .card-footer {
  background: var(--brisk-theme-surface-strong) !important;
  color: var(--brisk-theme-text) !important;
  border-color: var(--brisk-theme-border) !important;
}

html[data-theme='dark'] .card .card-title,
html[data-theme='dark'] .dropdown-item,
html[data-theme='dark'] .modal-title,
html[data-theme='dark'] .modal-body,
html[data-theme='dark'] .modal-footer,
html[data-theme='dark'] .modal-header,
html[data-theme='dark'] .list-group-item {
  color: var(--brisk-theme-text);
  border-color: var(--brisk-theme-border);
}

html[data-theme='dark'] .dropdown-item:hover,
html[data-theme='dark'] .dropdown-item:focus {
  background: rgba(147, 197, 253, 0.12);
}

html[data-theme='dark'] .modal-header,
html[data-theme='dark'] .modal-footer {
  background: var(--brisk-theme-surface-strong) !important;
}

html[data-theme='dark'] .modal-body {
  background: var(--brisk-theme-surface) !important;
}

html[data-theme='dark'] .modal .close,
html[data-theme='dark'] .modal .close span {
  color: #e5e7eb !important;
  text-shadow: none !important;
  opacity: 0.9;
}

html[data-theme='dark'] .modal .close:hover,
html[data-theme='dark'] .modal .close:focus {
  color: #f8fafc !important;
  opacity: 1;
}

html[data-theme='dark'] .modal .alert-light {
  background: #1f2937 !important;
  color: var(--brisk-theme-text) !important;
  border-color: var(--brisk-theme-border) !important;
}

html[data-theme='dark'] .modal .input-group-text,
html[data-theme='dark'] .modal hr {
  background: #111827 !important;
  color: var(--brisk-theme-text) !important;
  border-color: var(--brisk-theme-border) !important;
}

html[data-theme='dark'] .iframe-modal .close {
  background-color: #111827 !important;
  border: 1px solid var(--brisk-theme-border) !important;
  border-radius: 8px;
}

html[data-theme='dark'] .dropdown-menu .dropdown-item,
html[data-theme='dark'] .dropdown-menu .dropdown-item-text,
html[data-theme='dark'] .dropdown-menu .dropdown-header {
  background: var(--brisk-theme-surface) !important;
  color: var(--brisk-theme-text) !important;
}

html[data-theme='dark'] .dropdown-menu .dropdown-item:hover,
html[data-theme='dark'] .dropdown-menu .dropdown-item:focus,
html[data-theme='dark'] .dropdown-menu a:not([href]):not([tabindex]):hover.dropdown-item,
html[data-theme='dark'] .dropdown-menu a:not([href]):not([tabindex]):focus.dropdown-item {
  background: #1f2937 !important;
  color: var(--brisk-theme-text) !important;
}

html[data-theme='dark'] .dropdown-menu .dropdown-item:active,
html[data-theme='dark'] .dropdown-menu .dropdown-item.active {
  background: #334155 !important;
  color: #f8fafc !important;
}

html[data-theme='dark'] .table,
html[data-theme='dark'] .table th,
html[data-theme='dark'] .table td,
html[data-theme='dark'] .table thead th,
html[data-theme='dark'] .table tbody tr {
  color: var(--brisk-theme-text);
  border-color: var(--brisk-theme-border);
}

html[data-theme='dark'] .table thead th,
html[data-theme='dark'] .jsgrid .jsgrid-table thead th,
html[data-theme='dark'] .table tbody td,
html[data-theme='dark'] .jsgrid .jsgrid-table tbody td {
  border-color: var(--brisk-theme-border) !important;
  border-bottom-color: var(--brisk-theme-border) !important;
  border-top-color: var(--brisk-theme-border) !important;
}

html[data-theme='dark'] .table.table-bordered thead,
html[data-theme='dark'] .jsgrid .table-bordered.jsgrid-table thead,
html[data-theme='dark'] .table.table-bordered td,
html[data-theme='dark'] .jsgrid .table-bordered.jsgrid-table td,
html[data-theme='dark'] .table.table-bordered th,
html[data-theme='dark'] .jsgrid .table-bordered.jsgrid-table th {
  border-color: var(--brisk-theme-border) !important;
}

html[data-theme='dark'] table.dataTable thead th,
html[data-theme='dark'] table.dataTable thead td,
html[data-theme='dark'] table.table-bordered.dataTable th,
html[data-theme='dark'] table.table-bordered.dataTable td,
html[data-theme='dark'] div.dataTables_scrollHead table.table-bordered,
html[data-theme='dark'] div.dataTables_scrollBody > table > tbody tr:first-child th,
html[data-theme='dark'] div.dataTables_scrollBody > table > tbody tr:first-child td {
  border-color: var(--brisk-theme-border) !important;
}

html[data-theme='dark'] .table-hover tbody tr:hover {
  background: rgba(148, 163, 184, 0.1);
}

html[data-theme='dark'] .form-control,
html[data-theme='dark'] .form-control:focus,
html[data-theme='dark'] .form-check-input,
html[data-theme='dark'] .custom-select,
html[data-theme='dark'] .sublist-control,
html[data-theme='dark'] .select2-container--default .select2-selection--single {
  background: var(--brisk-theme-input);
  color: var(--brisk-theme-text);
  border-color: var(--brisk-theme-input-border);
}

html[data-theme='dark'] .select2-container--default .select2-selection--single,
html[data-theme='dark'] .select2-container--default .select2-selection--multiple,
html[data-theme='dark'] .select2-container--default.select2-container--focus .select2-selection--multiple,
html[data-theme='dark'] .select2-container--default.select2-container--open .select2-selection--single,
html[data-theme='dark'] .select2-container--default.select2-container--open .select2-selection--multiple {
  background: var(--brisk-theme-input) !important;
  color: var(--brisk-theme-text) !important;
  border-color: var(--brisk-theme-input-border) !important;
}

html[data-theme='dark'] .select2-container--default .select2-selection--single .select2-selection__rendered,
html[data-theme='dark'] .select2-container--default .select2-selection--single .select2-selection__placeholder,
html[data-theme='dark'] .select2-container--default .select2-selection--single .select2-selection__clear,
html[data-theme='dark'] .select2-container--default .select2-selection--multiple .select2-selection__rendered,
html[data-theme='dark'] .select2-container--default .select2-selection--multiple .select2-search__field,
html[data-theme='dark'] .select2-container--default .select2-selection--multiple .select2-selection__clear {
  color: var(--brisk-theme-text) !important;
}

html[data-theme='dark'] .select2-container--default .select2-selection--single .select2-selection__placeholder,
html[data-theme='dark'] .select2-container--default .select2-search--inline .select2-search__field::placeholder,
html[data-theme='dark'] .select2-container--default .select2-search--dropdown .select2-search__field::placeholder {
  color: var(--brisk-theme-muted) !important;
}

html[data-theme='dark'] .select2-container--default .select2-selection--single .select2-selection__arrow {
  background: #111827 !important;
}

html[data-theme='dark'] .select2-container--default .select2-selection--single .select2-selection__arrow b {
  border-color: #cbd5e1 transparent transparent transparent !important;
}

html[data-theme='dark'] .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
  border-color: transparent transparent #cbd5e1 transparent !important;
}

html[data-theme='dark'] .select2-dropdown,
html[data-theme='dark'] .select2-container--default .select2-dropdown {
  background: var(--brisk-theme-surface) !important;
  color: var(--brisk-theme-text) !important;
  border-color: var(--brisk-theme-border) !important;
}

html[data-theme='dark'] .select2-container--default .select2-search--dropdown,
html[data-theme='dark'] .select2-container--default .select2-search--dropdown .select2-search__field {
  background: var(--brisk-theme-input) !important;
  color: var(--brisk-theme-text) !important;
  border-color: var(--brisk-theme-input-border) !important;
}

html[data-theme='dark'] .select2-container--default .select2-results__option,
html[data-theme='dark'] .select2-container--default .select2-results__group {
  background: transparent !important;
  color: var(--brisk-theme-text) !important;
}

html[data-theme='dark'] .select2-container--default .select2-results__option--disabled {
  color: var(--brisk-theme-muted) !important;
}

html[data-theme='dark'] .select2-container--default .select2-results__option--selected {
  background: #1f2937 !important;
  color: #e5e7eb !important;
}

html[data-theme='dark'] .select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
  background: #2563eb !important;
  color: #eff6ff !important;
}

html[data-theme='dark'] .select2-container--default .select2-selection--multiple .select2-selection__choice {
  background: #1f2937 !important;
  border-color: #475569 !important;
  color: #e5e7eb !important;
}

html[data-theme='dark'] .select2-container--default .select2-selection--multiple .select2-selection__choice__display {
  color: #e5e7eb !important;
}

html[data-theme='dark'] .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
  background: #0f172a !important;
  border-color: #475569 !important;
  color: #cbd5e1 !important;
}

html[data-theme='dark'] .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover,
html[data-theme='dark'] .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:focus {
  background: #334155 !important;
  color: #f8fafc !important;
}

html[data-theme='dark'] .form-control::placeholder {
  color: var(--brisk-theme-muted);
}

html[data-theme='dark'] .text-dark {
  color: var(--brisk-theme-text) !important;
}

html[data-theme='dark'] .text-muted,
html[data-theme='dark'] .small,
html[data-theme='dark'] small {
  color: var(--brisk-theme-muted) !important;
}

html[data-theme='dark'] .footer,
html[data-theme='dark'] .footer a {
  background: transparent;
  color: var(--brisk-theme-muted);
}

html[data-theme='dark'] a:not(.btn):not(.dropdown-item) {
  color: var(--brisk-theme-link);
}

html[data-theme='dark'] a:not(.btn):not(.dropdown-item):hover {
  color: #bfdbfe;
}

html[data-theme='dark'] .auth.theme-one .auto-form-wrapper {
  background: var(--brisk-theme-surface);
  box-shadow: 0 16px 40px rgba(2, 6, 23, 0.5);
}

html[data-theme='dark'] .auth.theme-one .auto-form-wrapper .form-control,
html[data-theme='dark'] .auth.theme-one .auto-form-wrapper .input-group-text {
  background: var(--brisk-theme-input);
  color: var(--brisk-theme-text);
  border-color: var(--brisk-theme-input-border);
}

html[data-theme='dark'] .auth.theme-one .auto-form-wrapper,
html[data-theme='dark'] .auth.theme-one .auto-form-wrapper h1,
html[data-theme='dark'] .auth.theme-one .auto-form-wrapper h2,
html[data-theme='dark'] .auth.theme-one .auto-form-wrapper h3,
html[data-theme='dark'] .auth.theme-one .auto-form-wrapper h4,
html[data-theme='dark'] .auth.theme-one .auto-form-wrapper h5,
html[data-theme='dark'] .auth.theme-one .auto-form-wrapper h6,
html[data-theme='dark'] .auth.theme-one .auto-form-wrapper p,
html[data-theme='dark'] .auth.theme-one .auto-form-wrapper li,
html[data-theme='dark'] .auth.theme-one .auto-form-wrapper label,
html[data-theme='dark'] .auth.theme-one .auto-form-wrapper legend {
  color: #d1d5db !important;
}

html[data-theme='dark'] .auth.theme-one .auto-form-wrapper .text-danger {
  color: #fca5a5 !important;
}

html[data-theme='dark'] .auth.theme-one .auto-form-wrapper .text-muted {
  color: #9ca3af !important;
}

html[data-theme='dark'] .auth.theme-one .footer-text,
html[data-theme='dark'] .auth.theme-one .auth-footer li a {
  color: #d1d5db;
}

html[data-theme='dark'] #content-main .password-change-intro,
html[data-theme='dark'] #content-main .help {
  color: #d1d5db;
}

html[data-theme='dark'] .auth.theme-one .auto-form-wrapper #content-main,
html[data-theme='dark'] .auth.theme-one .auto-form-wrapper #content-main p,
html[data-theme='dark'] .auth.theme-one .auto-form-wrapper #content-main div,
html[data-theme='dark'] .auth.theme-one .auto-form-wrapper #content-main label,
html[data-theme='dark'] .auth.theme-one .auto-form-wrapper #content-main li,
html[data-theme='dark'] .auth.theme-one .auto-form-wrapper #content-main .password-change-intro,
html[data-theme='dark'] .auth.theme-one .auto-form-wrapper #content-main .help {
  color: #d1d5db !important;
}

html[data-theme='dark'] .auth.theme-one .auto-form-wrapper .mfa-status-copy {
  color: #d1d5db !important;
}

html[data-theme='dark'] .main-wrap {
  background: radial-gradient(circle at 8% 8%, #1e293b 0%, #111827 38%, #0b1222 100%);
  border-color: var(--brisk-theme-border);
}

html[data-theme='dark'] .main-card {
  background: var(--brisk-theme-surface);
  border-color: var(--brisk-theme-border);
}

html[data-theme='dark'] .main-title,
html[data-theme='dark'] .main-card h3 {
  color: #f8fafc;
}

html[data-theme='dark'] .main-sub,
html[data-theme='dark'] .main-card p {
  color: #cbd5e1;
}

html[data-theme='dark'] .dashboard-badges {
  background: var(--brisk-theme-surface-strong) !important;
  border: 1px solid var(--brisk-theme-border);
  border-radius: 8px;
}

html[data-theme='dark'] .dashboard-badges .badge.badge-dark {
  background: #334155;
  color: #e5e7eb;
}

html[data-theme='dark'] .dashboard-badges .badge.badge-primary {
  background: #1d4ed8;
  color: #eff6ff;
}

html[data-theme='dark'] .dashboard-badges .badge.badge-success {
  background: #15803d;
  color: #ecfdf5;
}

html[data-theme='dark'] .badge.badge-secondary {
  background: #334155;
  border-color: #475569;
  color: #e5e7eb;
}

html[data-theme='dark'] a.badge.badge-secondary:hover,
html[data-theme='dark'] a.badge.badge-secondary:focus {
  background: #475569;
  color: #f8fafc;
}

html[data-theme='dark'] .card-deck .card .table tr td {
  background: transparent;
}

html[data-theme='dark'] .navbar.default-layout .navbar-menu-wrapper .navbar-nav .nav-item.dropdown .navbar-dropdown,
html[data-theme='dark'] .navbar.default-layout .navbar-menu-wrapper .navbar-nav .nav-item.user-dropdown .dropdown-menu,
html[data-theme='dark'] #top-bar .navbar-dropdown {
  background: var(--brisk-theme-surface);
  color: var(--brisk-theme-text);
  border-color: var(--brisk-theme-border);
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.45);
}

html[data-theme='dark'] #top-bar .navbar-dropdown .dropdown-header {
  background: #0f172a;
  color: var(--brisk-theme-text);
  border-bottom: 1px solid var(--brisk-theme-border);
}

html[data-theme='dark'] #top-bar .navbar-dropdown .dropdown-divider,
html[data-theme='dark'] #top-bar .navbar-dropdown .border-bottom {
  border-color: var(--brisk-theme-border) !important;
}

html[data-theme='dark'] #top-bar .navbar-dropdown .dropdown-item,
html[data-theme='dark'] #top-bar .navbar-dropdown .preview-item-content,
html[data-theme='dark'] #top-bar .navbar-dropdown .preview-subject,
html[data-theme='dark'] #top-bar .navbar-dropdown .small-text,
html[data-theme='dark'] #top-bar .navbar-dropdown .text-muted {
  color: var(--brisk-theme-text) !important;
}

html[data-theme='dark'] #top-bar .navbar-dropdown #new_notifications {
  color: #e5e7eb !important;
}

html[data-theme='dark'] #top-bar .navbar-dropdown .preview-thumbnail {
  color: #93c5fd !important;
}

html[data-theme='dark'] #top-bar .navbar-dropdown .dropdown-item:hover,
html[data-theme='dark'] #top-bar .navbar-dropdown .dropdown-item:focus {
  background: #1f2937;
}

html[data-theme='dark'] #searchgroup #globalsearch,
html[data-theme='dark'] #searchgroup #globalsearch-toggle {
  background: var(--brisk-theme-input);
  color: var(--brisk-theme-text);
  border-color: var(--brisk-theme-input-border);
}

html[data-theme='dark'] #searchgroup #globalsearch::placeholder {
  color: var(--brisk-theme-muted);
}

html[data-theme='dark'] #searchgroup #globalsearch-toggle option {
  background: var(--brisk-theme-surface);
  color: var(--brisk-theme-text);
}

html[data-theme='dark'] #searchresults.dropdown-menu {
  background: var(--brisk-theme-surface);
  border-color: var(--brisk-theme-border);
}

html[data-theme='dark'] #searchresults .dropdown-item {
  color: var(--brisk-theme-text);
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

html[data-theme='dark'] #searchresults .dropdown-item:last-child {
  border-bottom: none;
}

html[data-theme='dark'] #searchresults .dropdown-item .detail-link,
html[data-theme='dark'] #searchresults .dropdown-item .edit-link {
  color: #cbd5e1 !important;
}

html[data-theme='dark'] #searchresults .dropdown-item:hover,
html[data-theme='dark'] #searchresults .dropdown-item:focus {
  background: #1f2937;
}

html[data-theme='dark'] #searchresults .dropdown-item.dropdown-selected {
  background-color: #334155 !important;
}

html[data-theme='dark'] .bg-white {
  background-color: var(--brisk-theme-surface-strong) !important;
}

html[data-theme='dark'] .bg-light {
  background-color: #1f2937 !important;
}

html[data-theme='dark'] .border-white {
  border-color: var(--brisk-theme-border) !important;
}

html[data-theme='dark'] .btn-group {
  border-color: var(--brisk-theme-border) !important;
}

html[data-theme='dark'] .btn-group .btn,
html[data-theme='dark'] .btn-group .ajax-upload-dragdrop .ajax-file-upload,
html[data-theme='dark'] .ajax-upload-dragdrop .btn-group .ajax-file-upload,
html[data-theme='dark'] .btn-group .swal2-modal .swal2-buttonswrapper .swal2-styled,
html[data-theme='dark'] .swal2-modal .swal2-buttonswrapper .btn-group .swal2-styled,
html[data-theme='dark'] .btn-group .wizard > .actions a,
html[data-theme='dark'] .wizard > .actions .btn-group a {
  border-color: rgba(148, 163, 184, 0.45) !important;
}

html[data-theme='dark'] .btn-primary {
  background-color: #2563eb;
  border-color: #2563eb;
  color: #eff6ff;
}

html[data-theme='dark'] .btn-primary:hover,
html[data-theme='dark'] .btn-primary:focus,
html[data-theme='dark'] .btn-primary:active {
  background-color: #1d4ed8;
  border-color: #1d4ed8;
  color: #eff6ff;
}

html[data-theme='dark'] .btn-secondary {
  background-color: #475569;
  border-color: #475569;
  color: #e2e8f0;
}

html[data-theme='dark'] .btn-secondary:hover,
html[data-theme='dark'] .btn-secondary:focus,
html[data-theme='dark'] .btn-secondary:active {
  background-color: #334155;
  border-color: #334155;
  color: #e2e8f0;
}

html[data-theme='dark'] .btn-info {
  background-color: #0e7490;
  border-color: #0e7490;
  color: #ecfeff;
}

html[data-theme='dark'] .btn-info:hover,
html[data-theme='dark'] .btn-info:focus,
html[data-theme='dark'] .btn-info:active {
  background-color: #155e75;
  border-color: #155e75;
  color: #ecfeff;
}

html[data-theme='dark'] .btn-success {
  background-color: #166534;
  border-color: #166534;
  color: #ecfdf5;
}

html[data-theme='dark'] .btn-success:hover,
html[data-theme='dark'] .btn-success:focus,
html[data-theme='dark'] .btn-success:active {
  background-color: #14532d;
  border-color: #14532d;
  color: #ecfdf5;
}

html[data-theme='dark'] .btn-warning {
  background-color: #b45309;
  border-color: #b45309;
  color: #fff7ed;
}

html[data-theme='dark'] .btn-warning:hover,
html[data-theme='dark'] .btn-warning:focus,
html[data-theme='dark'] .btn-warning:active {
  background-color: #92400e;
  border-color: #92400e;
  color: #fff7ed;
}

html[data-theme='dark'] .btn-danger {
  background-color: #991b1b;
  border-color: #991b1b;
  color: #fef2f2;
}

html[data-theme='dark'] .btn-danger:hover,
html[data-theme='dark'] .btn-danger:focus,
html[data-theme='dark'] .btn-danger:active {
  background-color: #7f1d1d;
  border-color: #7f1d1d;
  color: #fef2f2;
}

html[data-theme='dark'] .btn-light {
  background-color: #1f2937;
  border-color: #475569;
  color: #e5e7eb;
}

html[data-theme='dark'] .btn-light:hover,
html[data-theme='dark'] .btn-light:focus,
html[data-theme='dark'] .btn-light:active {
  background-color: #334155;
  border-color: #64748b;
  color: #e5e7eb;
}

html[data-theme='dark'] .btn-dark {
  background-color: #020617;
  border-color: #334155;
  color: #e5e7eb;
}

html[data-theme='dark'] .btn-dark:hover,
html[data-theme='dark'] .btn-dark:focus,
html[data-theme='dark'] .btn-dark:active {
  background-color: #0b1222;
  border-color: #475569;
  color: #e5e7eb;
}

html[data-theme='dark'] .btn-outline-primary {
  color: #93c5fd;
  border-color: #3b82f6;
}

html[data-theme='dark'] .btn-outline-primary:hover,
html[data-theme='dark'] .btn-outline-primary:focus,
html[data-theme='dark'] .btn-outline-primary:active {
  color: #eff6ff;
  background-color: #1d4ed8;
  border-color: #1d4ed8;
}

html[data-theme='dark'] .btn-outline-secondary {
  color: #cbd5e1;
  border-color: #64748b;
}

html[data-theme='dark'] .btn-outline-secondary:hover,
html[data-theme='dark'] .btn-outline-secondary:focus,
html[data-theme='dark'] .btn-outline-secondary:active {
  color: #e2e8f0;
  background-color: #334155;
  border-color: #334155;
}

html[data-theme='dark'] .btn-outline-info {
  color: #67e8f9;
  border-color: #0891b2;
}

html[data-theme='dark'] .btn-outline-info:hover,
html[data-theme='dark'] .btn-outline-info:focus,
html[data-theme='dark'] .btn-outline-info:active {
  color: #ecfeff;
  background-color: #155e75;
  border-color: #155e75;
}

html[data-theme='dark'] .btn-outline-success {
  color: #86efac;
  border-color: #16a34a;
}

html[data-theme='dark'] .btn-outline-success:hover,
html[data-theme='dark'] .btn-outline-success:focus,
html[data-theme='dark'] .btn-outline-success:active {
  color: #ecfdf5;
  background-color: #14532d;
  border-color: #14532d;
}

html[data-theme='dark'] .btn-outline-warning {
  color: #fdba74;
  border-color: #c2410c;
}

html[data-theme='dark'] .btn-outline-warning:hover,
html[data-theme='dark'] .btn-outline-warning:focus,
html[data-theme='dark'] .btn-outline-warning:active {
  color: #fff7ed;
  background-color: #92400e;
  border-color: #92400e;
}

html[data-theme='dark'] .btn-outline-danger {
  color: #fca5a5;
  border-color: #b91c1c;
}

html[data-theme='dark'] .btn-outline-danger:hover,
html[data-theme='dark'] .btn-outline-danger:focus,
html[data-theme='dark'] .btn-outline-danger:active {
  color: #fef2f2;
  background-color: #7f1d1d;
  border-color: #7f1d1d;
}

html[data-theme='dark'] .btn:focus,
html[data-theme='dark'] .btn.focus {
  box-shadow: 0 0 0 0.2rem rgba(147, 197, 253, 0.25);
}

/* Module dashboard dark-mode overrides for /index pages */
html[data-theme='dark'] {
  --main-ink: #f8fafc;
  --main-muted: #cbd5e1;
  --main-card: var(--brisk-theme-surface);
  --main-line: var(--brisk-theme-border);
  --main-chip: #1e293b;

  --acct-ink: #f8fafc;
  --acct-card: var(--brisk-theme-surface);
  --acct-line: var(--brisk-theme-border);
  --acct-wash: #0f172a;

  --inventory-ink: #f8fafc;
  --inventory-card: var(--brisk-theme-surface);
  --inventory-line: var(--brisk-theme-border);
  --inventory-wash: #0f172a;

  --mgmt-ink: #f8fafc;
  --mgmt-card: var(--brisk-theme-surface);
  --mgmt-line: var(--brisk-theme-border);
  --mgmt-wash: #0f172a;

  --mfg-ink: #f8fafc;
  --mfg-card: var(--brisk-theme-surface);
  --mfg-line: var(--brisk-theme-border);
  --mfg-wash: #0f172a;

  --pay-ink: #f8fafc;
  --pay-card: var(--brisk-theme-surface);
  --pay-line: var(--brisk-theme-border);
  --pay-wash: #0f172a;

  --reports-ink: #f8fafc;
  --reports-card: var(--brisk-theme-surface);
  --reports-line: var(--brisk-theme-border);
  --reports-wash: #0f172a;

  --sales-ink: #f8fafc;
  --sales-card: var(--brisk-theme-surface);
  --sales-line: var(--brisk-theme-border);
  --sales-wash: #0f172a;

  --service-ink: #f8fafc;
  --service-card: var(--brisk-theme-surface);
  --service-line: var(--brisk-theme-border);
  --service-wash: #0f172a;

  --setup-ink: #f8fafc;
  --setup-card: var(--brisk-theme-surface);
  --setup-line: var(--brisk-theme-border);
  --setup-wash: #0f172a;

  --time-ink: #f8fafc;
  --time-card: var(--brisk-theme-surface);
  --time-line: var(--brisk-theme-border);
  --time-wash: #0f172a;
}

html[data-theme='dark'] .acct-hero,
html[data-theme='dark'] .inventory-hero,
html[data-theme='dark'] .mgmt-hero,
html[data-theme='dark'] .mfg-hero,
html[data-theme='dark'] .pay-hero,
html[data-theme='dark'] .reports-hero,
html[data-theme='dark'] .sales-hero,
html[data-theme='dark'] .service-hero,
html[data-theme='dark'] .setup-hero,
html[data-theme='dark'] .time-hero {
  background: radial-gradient(circle at 18% 12%, #1e293b 0%, #111827 48%, #0b1222 100%) !important;
  border-color: var(--brisk-theme-border) !important;
}

html[data-theme='dark'] .acct-pill,
html[data-theme='dark'] .inventory-pill,
html[data-theme='dark'] .mgmt-pill,
html[data-theme='dark'] .mfg-pill,
html[data-theme='dark'] .pay-pill,
html[data-theme='dark'] .reports-pill,
html[data-theme='dark'] .sales-pill,
html[data-theme='dark'] .service-pill,
html[data-theme='dark'] .setup-pill,
html[data-theme='dark'] .time-pill {
  background: #1e293b !important;
  color: #bfdbfe !important;
  border: 1px solid var(--brisk-theme-border);
}

html[data-theme='dark'] .acct-card,
html[data-theme='dark'] .inventory-card,
html[data-theme='dark'] .mgmt-card,
html[data-theme='dark'] .mfg-card,
html[data-theme='dark'] .pay-card,
html[data-theme='dark'] .reports-card,
html[data-theme='dark'] .sales-card,
html[data-theme='dark'] .service-card,
html[data-theme='dark'] .setup-card,
html[data-theme='dark'] .time-card {
  background: var(--brisk-theme-surface) !important;
  border-color: var(--brisk-theme-border) !important;
}

html[data-theme='dark'] .acct-card h3,
html[data-theme='dark'] .inventory-card h3,
html[data-theme='dark'] .mgmt-card h3,
html[data-theme='dark'] .mfg-card h3,
html[data-theme='dark'] .pay-card h3,
html[data-theme='dark'] .reports-card h3,
html[data-theme='dark'] .sales-card h3,
html[data-theme='dark'] .service-card h3,
html[data-theme='dark'] .setup-card h3,
html[data-theme='dark'] .time-card h3,
html[data-theme='dark'] .acct-hero h1,
html[data-theme='dark'] .inventory-hero h1,
html[data-theme='dark'] .mgmt-hero h1,
html[data-theme='dark'] .mfg-hero h1,
html[data-theme='dark'] .pay-hero h1,
html[data-theme='dark'] .reports-hero h1,
html[data-theme='dark'] .sales-hero h1,
html[data-theme='dark'] .service-hero h1,
html[data-theme='dark'] .setup-hero h1,
html[data-theme='dark'] .time-hero h1 {
  color: #f8fafc !important;
}

html[data-theme='dark'] .acct-card p,
html[data-theme='dark'] .inventory-card p,
html[data-theme='dark'] .mgmt-card p,
html[data-theme='dark'] .mfg-card p,
html[data-theme='dark'] .pay-card p,
html[data-theme='dark'] .reports-card p,
html[data-theme='dark'] .sales-card p,
html[data-theme='dark'] .service-card p,
html[data-theme='dark'] .setup-card p,
html[data-theme='dark'] .time-card p,
html[data-theme='dark'] .acct-hero p,
html[data-theme='dark'] .inventory-hero p,
html[data-theme='dark'] .mgmt-hero p,
html[data-theme='dark'] .mfg-hero p,
html[data-theme='dark'] .pay-hero p,
html[data-theme='dark'] .reports-hero p,
html[data-theme='dark'] .sales-hero p,
html[data-theme='dark'] .service-hero p,
html[data-theme='dark'] .setup-hero p,
html[data-theme='dark'] .time-hero p {
  color: #cbd5e1 !important;
}

html[data-theme='dark'] .acct-accent,
html[data-theme='dark'] .inventory-accent,
html[data-theme='dark'] .mgmt-accent,
html[data-theme='dark'] .mfg-accent,
html[data-theme='dark'] .pay-accent,
html[data-theme='dark'] .reports-accent,
html[data-theme='dark'] .sales-accent,
html[data-theme='dark'] .service-accent,
html[data-theme='dark'] .setup-accent,
html[data-theme='dark'] .time-accent {
  color: #7dd3fc !important;
}

/* django-selectable / jQuery UI autocomplete dark-mode overrides */
html[data-theme='dark'] input.ui-autocomplete-input,
html[data-theme='dark'] input.ui-combo-input,
html[data-theme='dark'] input.ui-widget.ui-widget-content {
  background: var(--brisk-theme-input) !important;
  color: var(--brisk-theme-text) !important;
  border-color: var(--brisk-theme-input-border) !important;
}

html[data-theme='dark'] ul.ui-autocomplete,
html[data-theme='dark'] .ui-autocomplete.ui-widget-content,
html[data-theme='dark'] .ui-menu.ui-widget-content {
  background: var(--brisk-theme-surface) !important;
  color: var(--brisk-theme-text) !important;
  border: 1px solid var(--brisk-theme-border) !important;
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.5);
}

html[data-theme='dark'] ul.ui-autocomplete li.ui-menu-item,
html[data-theme='dark'] ul.ui-autocomplete li.ui-menu-item > a,
html[data-theme='dark'] .ui-menu .ui-menu-item,
html[data-theme='dark'] .ui-menu .ui-menu-item-wrapper {
  color: var(--brisk-theme-text) !important;
}

html[data-theme='dark'] .ui-menu .ui-state-hover,
html[data-theme='dark'] .ui-menu .ui-state-focus,
html[data-theme='dark'] .ui-widget-content .ui-state-hover,
html[data-theme='dark'] .ui-widget-content .ui-state-focus {
  background: #1f2937 !important;
  color: #f8fafc !important;
  border: 1px solid #334155 !important;
}

html[data-theme='dark'] .ui-menu .ui-state-active,
html[data-theme='dark'] .ui-widget-content .ui-state-active {
  background: #334155 !important;
  color: #f8fafc !important;
  border: 1px solid #475569 !important;
}

html[data-theme='dark'] ul.ui-autocomplete li.ui-menu-item .highlight {
  color: #bfdbfe !important;
}

html[data-theme='dark'] ul.ui-autocomplete li.selectable-advancedsearch {
  color: #93c5fd !important;
}

html[data-theme='dark'] .selectable-customer-subtitle {
  color: #94a3b8 !important;
}

html[data-theme='dark'] ul.selectable-deck {
  background: transparent !important;
  color: var(--brisk-theme-text) !important;
}

html[data-theme='dark'] ul.selectable-deck li.selectable-deck-item {
  background: var(--brisk-theme-surface-strong) !important;
  border: 1px solid var(--brisk-theme-border) !important;
  color: var(--brisk-theme-text) !important;
  border-radius: 8px;
  margin: 0 0 6px 0;
  padding: 4px 8px;
}

html[data-theme='dark'] a.ui-combo-button,
html[data-theme='dark'] .ui-button.ui-combo-button,
html[data-theme='dark'] .selectable-deck-remove.ui-button {
  background: #1f2937 !important;
  color: var(--brisk-theme-text) !important;
  border-color: var(--brisk-theme-input-border) !important;
}

/* Bootstrap datepicker dark-mode overrides */
html[data-theme='dark'] .datepicker,
html[data-theme='dark'] .datepicker-dropdown,
html[data-theme='dark'] .datepicker table {
  background: var(--brisk-theme-surface) !important;
  color: var(--brisk-theme-text) !important;
}

html[data-theme='dark'] .datepicker-dropdown {
  border: 1px solid var(--brisk-theme-border) !important;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.5);
}

html[data-theme='dark'] .datepicker-dropdown.datepicker-orient-bottom:before {
  border-bottom-color: var(--brisk-theme-border) !important;
}

html[data-theme='dark'] .datepicker-dropdown.datepicker-orient-bottom:after {
  border-bottom-color: var(--brisk-theme-surface) !important;
}

html[data-theme='dark'] .datepicker-dropdown.datepicker-orient-top:before {
  border-top-color: var(--brisk-theme-border) !important;
}

html[data-theme='dark'] .datepicker-dropdown.datepicker-orient-top:after {
  border-top-color: var(--brisk-theme-surface) !important;
}

html[data-theme='dark'] .datepicker th,
html[data-theme='dark'] .datepicker td,
html[data-theme='dark'] .datepicker table tr td span {
  color: var(--brisk-theme-text) !important;
  border: none !important;
}

html[data-theme='dark'] .datepicker .datepicker-switch,
html[data-theme='dark'] .datepicker .next,
html[data-theme='dark'] .datepicker .prev,
html[data-theme='dark'] .datepicker tfoot tr th {
  background: #111827 !important;
  color: #e5e7eb !important;
}

html[data-theme='dark'] .datepicker .datepicker-switch:hover,
html[data-theme='dark'] .datepicker .next:hover,
html[data-theme='dark'] .datepicker .prev:hover,
html[data-theme='dark'] .datepicker tfoot tr th:hover,
html[data-theme='dark'] .datepicker table tr td.day:hover,
html[data-theme='dark'] .datepicker table tr td.day.focused,
html[data-theme='dark'] .datepicker table tr td span:hover,
html[data-theme='dark'] .datepicker table tr td span.focused {
  background: #1f2937 !important;
  color: #f8fafc !important;
}

html[data-theme='dark'] .datepicker table tr td.old,
html[data-theme='dark'] .datepicker table tr td.new,
html[data-theme='dark'] .datepicker table tr td span.old,
html[data-theme='dark'] .datepicker table tr td span.new {
  color: #94a3b8 !important;
}

html[data-theme='dark'] .datepicker table tr td.disabled,
html[data-theme='dark'] .datepicker table tr td.disabled:hover,
html[data-theme='dark'] .datepicker table tr td span.disabled,
html[data-theme='dark'] .datepicker table tr td span.disabled:hover,
html[data-theme='dark'] .datepicker .next.disabled,
html[data-theme='dark'] .datepicker .prev.disabled {
  color: #64748b !important;
  background: transparent !important;
}

html[data-theme='dark'] .datepicker table tr td.today,
html[data-theme='dark'] .datepicker table tr td.today:hover,
html[data-theme='dark'] .datepicker table tr td.today.disabled,
html[data-theme='dark'] .datepicker table tr td.today.disabled:hover {
  background: #92400e !important;
  background-image: none !important;
  color: #fff7ed !important;
}

html[data-theme='dark'] .datepicker table tr td.range,
html[data-theme='dark'] .datepicker table tr td.range:hover,
html[data-theme='dark'] .datepicker table tr td.range.disabled,
html[data-theme='dark'] .datepicker table tr td.range.disabled:hover {
  background: #1e293b !important;
  background-image: none !important;
  color: #dbeafe !important;
}

html[data-theme='dark'] .datepicker table tr td.range.today,
html[data-theme='dark'] .datepicker table tr td.range.today:hover,
html[data-theme='dark'] .datepicker table tr td.range.today.disabled,
html[data-theme='dark'] .datepicker table tr td.range.today.disabled:hover {
  background: #78350f !important;
  background-image: none !important;
  color: #ffedd5 !important;
}

html[data-theme='dark'] .datepicker table tr td.selected,
html[data-theme='dark'] .datepicker table tr td.selected:hover,
html[data-theme='dark'] .datepicker table tr td.selected.disabled,
html[data-theme='dark'] .datepicker table tr td.selected.disabled:hover {
  background: #475569 !important;
  background-image: none !important;
  color: #f8fafc !important;
  text-shadow: none !important;
}

html[data-theme='dark'] .datepicker table tr td.active,
html[data-theme='dark'] .datepicker table tr td.active:hover,
html[data-theme='dark'] .datepicker table tr td.active.disabled,
html[data-theme='dark'] .datepicker table tr td.active.disabled:hover,
html[data-theme='dark'] .datepicker table tr td span.active,
html[data-theme='dark'] .datepicker table tr td span.active:hover,
html[data-theme='dark'] .datepicker table tr td span.active.disabled,
html[data-theme='dark'] .datepicker table tr td span.active.disabled:hover {
  background: #2563eb !important;
  background-image: none !important;
  color: #eff6ff !important;
  text-shadow: none !important;
}

html[data-theme='dark'] .datepicker table tr td.highlighted {
  background: #0f766e !important;
  color: #ecfeff !important;
}

html[data-theme='dark'] .input-daterange .add-on {
  background: #1f2937 !important;
  color: var(--brisk-theme-text) !important;
  border-color: var(--brisk-theme-border) !important;
  text-shadow: none !important;
}

/* Attachment modal dark-mode overrides */
html[data-theme='dark'] .attachment-upload-area {
  border-color: var(--brisk-theme-border) !important;
  background: #111827 !important;
}

html[data-theme='dark'] .attachment-dropzone,
html[data-theme='dark'] .attachment-preview-card {
  border-color: var(--brisk-theme-border) !important;
  background: var(--brisk-theme-surface) !important;
}

html[data-theme='dark'] .attachment-dropzone.is-dragover {
  border-color: #3b82f6 !important;
  background: #172554 !important;
}

html[data-theme='dark'] .attachment-dropzone-help,
html[data-theme='dark'] .attachment-preview-meta,
html[data-theme='dark'] .attachment-upload-progress-text {
  color: #94a3b8 !important;
}

html[data-theme='dark'] .attachment-queue-hint {
  border-color: #854d0e !important;
  background: #422006 !important;
  color: #fed7aa !important;
}

html[data-theme='dark'] .attachment-preview-remove {
  background: #0f172a !important;
  border-color: #b91c1c !important;
  color: #fca5a5 !important;
}

html[data-theme='dark'] .attachment-preview-remove:hover,
html[data-theme='dark'] .attachment-preview-remove:focus {
  background: #991b1b !important;
  color: #fef2f2 !important;
}

html[data-theme='dark'] .attachment-preview-image,
html[data-theme='dark'] .attachment-preview-pdf,
html[data-theme='dark'] .attachment-preview-text {
  background: #111827 !important;
  border-color: var(--brisk-theme-border) !important;
  color: var(--brisk-theme-text) !important;
}
html[data-theme='dark'] .preference-highlight {
  background: #10B981 !important;
}
