html.theme-dark {
    --theme-dark-body: #222a35;
    --theme-dark-surface: #2b3240;
    --theme-dark-elevated: #323a4a;
    --theme-dark-border: #3a4456;
    --theme-dark-text: #e5e9f5;
    --theme-dark-muted: #c7cedd;
    --theme-dark-accent: #3b82f6;
    --theme-dark-accent-soft: rgba(59, 130, 246, 0.25);
    --theme-dark-highlight: #8fb4ff;
}

html.theme-dark,
html.theme-dark body {
    background-color: var(--theme-dark-body);
    color: var(--theme-dark-text);
}

html.theme-dark body {
    background-image: none !important;
    transition: background-color 0.3s ease, color 0.3s ease;
}

html.theme-dark a {
    color: var(--theme-dark-highlight);
}

html.theme-dark a:hover,
html.theme-dark a:focus {
    color: #d3e2ff;
}

html.theme-dark .header-box {
    background-color: var(--theme-dark-elevated);
    border-bottom: none;
    box-shadow: 0 1px 12px rgba(15, 23, 42, 0.4);
}

html.theme-dark header {
    border-bottom: 2px solid var(--theme-dark-border) !important;
}

html.theme-dark .header-box .nav-link,
html.theme-dark .header-box .dropdown-item,
html.theme-dark .header-box .theme-toggle-label {
    color: var(--theme-dark-text);
}

html.theme-dark .header-box .dropdown-menu {
    background-color: var(--theme-dark-surface);
    border-color: var(--theme-dark-border);
}

html.theme-dark .dropdown-item:hover,
html.theme-dark .dropdown-item:focus {
    background-color: #353f52;
    color: #f8fafc;
}

html.theme-dark .theme-toggle .form-check-input {
    background-color: var(--theme-dark-body);
    border-color: var(--theme-dark-border);
}

html.theme-dark .theme-toggle .form-check-input:checked {
    background-color: var(--theme-dark-accent);
    border-color: var(--theme-dark-accent);
}

html.theme-dark .theme-toggle .form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(143, 180, 255, 0.35);
}

html.theme-dark .bg,
html.theme-dark .dashboard-main,
html.theme-dark .main-inner-content,
html.theme-dark .main-content,
html.theme-dark .card,
html.theme-dark .card-body,
html.theme-dark .card-header,
html.theme-dark .card-footer,
html.theme-dark .modal-content,
html.theme-dark .list-group-item,
html.theme-dark .dropdown-menu,
html.theme-dark .snackbar-container,
html.theme-dark .side-navigation {
    background-color: var(--theme-dark-surface) !important;
    color: var(--theme-dark-text);
}

html.theme-dark .card,
html.theme-dark .card-header,
html.theme-dark .card-footer,
html.theme-dark .list-group-item,
html.theme-dark .modal-content,
html.theme-dark .modal-header,
html.theme-dark .modal-footer {
    border: none;
}

html.theme-dark .card,
html.theme-dark .modal-content,
html.theme-dark .list-group-item,
html.theme-dark .theme-surface {
    box-shadow: 0 14px 30px rgba(17, 24, 39, 0.26);
}

html.theme-dark .side-navigation a {
    color: var(--theme-dark-text);
}

html.theme-dark .side-navigation a:hover,
html.theme-dark .side-navigation .active > a {
    background-color: #343e50;
    color: #f8fafc;
}

html.theme-dark .tools-box {
    border: 1px solid rgba(58, 68, 86, 0.8);
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.25);
}

html.theme-dark hr,
html.theme-dark .border,
html.theme-dark .border-top,
html.theme-dark .border-bottom,
html.theme-dark .border-left,
html.theme-dark .border-right {
    border-color: var(--theme-dark-border) !important;
}

html.theme-dark .form-control,
html.theme-dark .form-select,
html.theme-dark textarea,
html.theme-dark input[type="text"],
html.theme-dark input[type="email"],
html.theme-dark input[type="password"],
html.theme-dark input[type="search"],
html.theme-dark input[type="number"],
html.theme-dark input[type="tel"],
html.theme-dark input[type="url"],
html.theme-dark input[type="date"],
html.theme-dark select {
    background-color: #353d4f;
    border-color: var(--theme-dark-border);
    color: #f8fafc;
}

html.theme-dark .form-control:focus,
html.theme-dark .form-select:focus,
html.theme-dark textarea:focus,
html.theme-dark input:focus,
html.theme-dark select:focus {
    background-color: #3a4356;
    border-color: var(--theme-dark-accent);
    color: #f8fafc;
    box-shadow: 0 0 0 0.2rem var(--theme-dark-accent-soft);
}

html.theme-dark label,
html.theme-dark .form-label,
html.theme-dark .form-group label,
html.theme-dark h1,
html.theme-dark h2,
html.theme-dark h3,
html.theme-dark h4,
html.theme-dark h5,
html.theme-dark h6,
html.theme-dark p,
html.theme-dark span,
html.theme-dark li {
    color: var(--theme-dark-text);
}

html.theme-dark .table {
    color: var(--theme-dark-text);
    border-color: var(--theme-dark-border);
}

html.theme-dark .table,
html.theme-dark .table > :not(caption) > * > * {
    background-color: #303848;
    color: #f8fafc;
}

html.theme-dark .table tbody tr {
    background-color: #333b4b;
    color: #f8fafc;
}

html.theme-dark .table tbody tr:nth-child(even) {
    background-color: #384150;
}

html.theme-dark .table tbody tr:hover {
    background-color: #3e4758;
}

html.theme-dark .table thead th {
    background-color: #323a4a;
    border-color: var(--theme-dark-border);
    color: #f8fafc;
}

html.theme-dark .table-striped tbody tr:nth-of-type(odd) {
    background-color: #353d4e;
}

html.theme-dark .alert {
    background-color: rgba(143, 180, 255, 0.12);
    border-color: rgba(143, 180, 255, 0.35);
    color: var(--theme-dark-text);
}

html.theme-dark .btn-primary,
html.theme-dark .btn.btn__t1.primary {
    background-color: var(--theme-dark-accent);
    border-color: var(--theme-dark-accent);
    color: #f8fafc;
}

html.theme-dark .btn-secondary,
html.theme-dark .btn.btn__t1.secondary {
    background-color: #3b4558;
    border-color: #3b4558;
    color: #f8fafc;
}

html.theme-dark .btn-outline-primary {
    border-color: var(--theme-dark-accent);
    color: var(--theme-dark-highlight);
}

html.theme-dark .btn-outline-primary:hover,
html.theme-dark .btn-outline-primary:focus {
    background-color: var(--theme-dark-accent);
    color: #f8fafc;
}

html.theme-dark .btn-link,
html.theme-dark .form__row .btn-link {
    color: var(--theme-dark-highlight);
}

html.theme-dark .btn-link:hover,
html.theme-dark .form__row .btn-link:hover {
    color: #d3e2ff;
}

html.theme-dark .badge.bg-light,
html.theme-dark .badge.bg-white {
    background-color: var(--theme-dark-surface) !important;
    color: #f8fafc !important;
}

html.theme-dark .dropdown-menu .dropdown-item,
html.theme-dark .dropdown-menu .dropdown-header {
    color: #e2e8f0;
}

html.theme-dark .list-inline a {
    color: #93c5fd;
}

html.theme-dark .list-inline a:hover {
    color: #bfdbfe;
}

html.theme-dark .logo__right-container {
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    padding-bottom: 0.5rem;
}

html.theme-dark .theme-toggle-label {
    color: #cbd5f5;
    font-weight: 500;
}

html.theme-dark .theme-toggle {
    gap: 0.5rem;
}

html.theme-dark .modal-header,
html.theme-dark .modal-footer {
    background-color: var(--theme-dark-elevated);
}

html.theme-dark .theme-surface,
html.theme-dark .tools-box,
html.theme-dark .page-header,
html.theme-dark .list-group-item,
html.theme-dark .breadcrumb,
html.theme-dark .nav-tabs {
    background-color: var(--theme-dark-surface) !important;
    border-bottom: 2px solid var(--theme-dark-border);
}

html.theme-dark .nav-tabs .nav-link,
html.theme-dark .card.theme-surface {
    background-color: var(--theme-dark-surface) !important;
    color: var(--theme-dark-text);
}

html.theme-dark .card.theme-surface,
html.theme-dark .theme-surface.card,
html.theme-dark .card.theme-surface .card-body {
    background-color: var(--theme-dark-surface);
}

html.theme-dark .card.theme-surface .card-body,
html.theme-dark .theme-surface .card-body,
html.theme-dark .theme-surface .form,
html.theme-dark .theme-surface .form-group,
html.theme-dark .theme-surface .form-control,
html.theme-dark .theme-surface .form-select,
html.theme-dark .theme-surface label,
html.theme-dark .tools-box .heading {
    color: var(--theme-dark-text);
}

html.theme-dark .nav-tabs .nav-link {
    border-color: transparent;
    color: var(--theme-dark-muted);
    transition: background-color 0.2s ease, color 0.2s ease;
}

html.theme-dark .nav-tabs .nav-link.active,
html.theme-dark .nav-tabs .nav-link:hover {
    background-color: #3a4356;
    border-color: var(--theme-dark-border);
    color: var(--theme-dark-text);
}

html.theme-dark .breadcrumb .breadcrumb-item,
html.theme-dark .breadcrumb .breadcrumb-item a {
    color: var(--theme-dark-muted);
}

html.theme-dark .breadcrumb .breadcrumb-item.active {
    color: var(--theme-dark-text);
}

html.theme-light body,
html.theme-light .header-box,
html.theme-light .theme-toggle-label {
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* --- Dark Mode: DataTables --- */
html.theme-dark .dataTables_wrapper,
html.theme-dark .dataTables_wrapper label,
html.theme-dark .dataTables_wrapper .dataTables_info,
html.theme-dark .dataTables_wrapper .dataTables_paginate,
html.theme-dark .dataTables_wrapper .dataTables_length,
html.theme-dark .dataTables_wrapper .dataTables_filter {
    color: var(--theme-dark-text);
}

html.theme-dark table.dataTable,
html.theme-dark table.dataTable th,
html.theme-dark table.dataTable td {
    color: var(--theme-dark-text);
    border-color: var(--theme-dark-border);
}

html.theme-dark table.dataTable tbody tr {
    background-color: #333b4b;
}

html.theme-dark table.dataTable tbody tr:nth-child(even) {
    background-color: #384150;
}

html.theme-dark table.dataTable tbody tr:hover {
    background-color: #3e4758;
}

html.theme-dark .dataTables_wrapper .dataTables_filter input,
html.theme-dark .dataTables_wrapper .dataTables_length select {
    background-color: #353d4f;
    border-color: var(--theme-dark-border);
    color: #f8fafc;
}

html.theme-dark .dataTables_wrapper .dataTables_filter input:focus,
html.theme-dark .dataTables_wrapper .dataTables_length select:focus {
    background-color: #3a4356;
    border-color: var(--theme-dark-accent);
    color: #f8fafc;
    box-shadow: 0 0 0 0.2rem var(--theme-dark-accent-soft);
}

html.theme-dark .dataTables_wrapper .dataTables_paginate .paginate_button {
    color: var(--theme-dark-text) !important;
    border: none;
    background-color: #323a4a;
    margin-left: 0.25rem;
}

html.theme-dark .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    color: #f8fafc !important;
    background-color: #3a4356;
    border-color: var(--theme-dark-accent);
}

html.theme-dark .dataTables_wrapper .dataTables_paginate .paginate_button.current,
html.theme-dark .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    color: #f8fafc !important;
    background-color: var(--theme-dark-accent);
    border-color: var(--theme-dark-accent);
}

html.theme-dark .dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
html.theme-dark .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    color: var(--theme-dark-muted) !important;
    background-color: transparent;
    border-color: var(--theme-dark-border);
}

html.theme-dark .dataTables_wrapper .dataTables_paginate .paginate_button.next,
html.theme-dark .dataTables_wrapper .dataTables_paginate .paginate_button.previous {
    background-color: transparent;
}

/* --- Dark Mode: Dashboard --- */
html.theme-dark .dashboard-container,
html.theme-dark .dashboard-grid {
    color: var(--theme-dark-text);
}

html.theme-dark .dashboard-container {
    background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
}

html.theme-dark .dashboard-grid {
    gap: 2.5rem;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(59, 130, 246, 0.12);
    padding: 3rem 3.5rem;
    border-radius: 32px;
    box-shadow: inset 0 0 40px rgba(15, 23, 42, 0.45);
}

html.theme-dark .dashboard-card {
    background-color: var(--theme-dark-elevated);
    border: none;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.35);
}

html.theme-dark .dashboard-card .dashboard-title,
html.theme-dark .dashboard-card a {
    color: var(--theme-dark-text);
}

html.theme-dark .dashboard-card svg {
    opacity: 1;
}

html.theme-dark .dashboard-card .notification-bubble {
    border-color: var(--theme-dark-body);
}

html.theme-dark .dashboard-card:hover {
    background-color: #394258;
    border-color: var(--theme-dark-accent);
    box-shadow: 0 18px 40px rgba(59, 130, 246, 0.2);
}

/* --- Dark Mode: Sidebar & Submenu --- */
html.theme-dark .side-navigation {
    background: var(--theme-dark-elevated);
    border-color: var(--theme-dark-border);
}

html.theme-dark .side-navigation li {
    border-color: var(--theme-dark-border);
}

html.theme-dark .side-navigation .submenu {
    background-color: #303848;
    border-left: 2px solid var(--theme-dark-border);
}

html.theme-dark .side-navigation .submenu a {
    color: var(--theme-dark-muted);
}

html.theme-dark .side-navigation .submenu a:hover,
html.theme-dark .side-navigation .submenu .active > a {
    color: var(--theme-dark-text);
}

html.theme-dark .submenu {
    background-color: #303848 !important;
    border: none !important;
    border-radius: 0.5rem;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.35);
}

html.theme-dark .submenu li,
html.theme-dark .submenu li a {
    background-color: transparent !important;
    color: var(--theme-dark-text) !important;
}

html.theme-dark .submenu li a:hover,
html.theme-dark .submenu li a:focus {
    background-color: #3a4356 !important;
    color: #f8fafc !important;
}

html.theme-dark .sidebar-toggle {
    color: var(--theme-dark-text);
}

/* --- Dark Mode: Utility Text Overrides --- */
html.theme-dark .text-dark,
html.theme-dark .text-body,
html.theme-dark .text-black,
html.theme-dark .text-primary {
    color: var(--theme-dark-text) !important;
}

html.theme-dark .text-muted,
html.theme-dark .text-secondary {
    color: var(--theme-dark-muted) !important;
}

/* --- Dark Mode: Create Matter Form --- */
html.theme-dark .form-heading,
html.theme-dark .tools-box .heading {
    color: var(--theme-dark-text);
}

html.theme-dark .form__label,
html.theme-dark .form__bottom-info {
    color: var(--theme-dark-muted);
}

html.theme-dark .form__text-field,
html.theme-dark .form__text-area,
html.theme-dark .form__select-field,
html.theme-dark .form-control.form__text-field {
    background-color: #353d4f;
    color: var(--theme-dark-text);
    border-color: var(--theme-dark-border);
}

html.theme-dark .form__text-field:focus,
html.theme-dark .form__text-area:focus,
html.theme-dark .form__select-field:focus,
html.theme-dark .form-control.form__text-field:focus {
    background-color: #3a4356;
    border-color: var(--theme-dark-accent);
    color: #f8fafc;
    box-shadow: 0 0 0 0.2rem var(--theme-dark-accent-soft);
}

html.theme-dark .form__text-field::placeholder,
html.theme-dark .form__text-area::placeholder {
    color: var(--theme-dark-muted);
}

html.theme-dark .form-group__select-wrap:after {
    border-top-color: var(--theme-dark-accent);
}

html.theme-dark .btn__t1.btn--mw1 {
    background-color: var(--theme-dark-accent);
    color: #f8fafc;
}

html.theme-dark .btn__t1.btn--mw1:hover {
    background-color: #1d4ed8;
}

html.theme-dark .btn__t1.btn--mw2 {
    background-color: #475569;
    color: var(--theme-dark-text);
}

html.theme-dark .btn__t1.btn--mw2:hover {
    background-color: #5b6b80;
    color: #f8fafc;
}

html.theme-dark .check-types label {
    color: var(--theme-dark-text);
}

html.theme-dark .form-check-input,
html.theme-dark .matter_types {
    accent-color: var(--theme-dark-accent);
}

html.theme-dark #caselinesRadiosGroup {
    background-color: #2f3747;
    border: none;
}

html.theme-dark #caselinesRadiosGroup label,
html.theme-dark #caselinesRadiosGroup .form-check-label {
    color: var(--theme-dark-text);
}

html.theme-dark .card.shadow-sm.border-0.theme-surface.main-content-dashboard {
    background-color: var(--theme-dark-elevated) !important;
    border: none !important;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.35);
}

html.theme-dark .card.shadow-sm.border-0.theme-surface.main-content-dashboard .card-body {
    background-color: transparent;
    color: var(--theme-dark-text);
}

html.theme-dark .tools-box {
    background-color: var(--theme-dark-elevated) !important;
    border-color: var(--theme-dark-border) !important;
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.28);
    border-radius: 0.75rem;
}

html.theme-dark .matter-list-group-item {
    background-color: #303848;
    border: none;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.35);
    color: var(--theme-dark-text);
}

html.theme-dark .matter-list-group-item:hover {
    background-color: #384155;
    border-color: var(--theme-dark-accent);
    box-shadow: 0 10px 24px rgba(59, 130, 246, 0.2);
}

html.theme-dark .matter-list-group-item a {
    color: var(--theme-dark-text);
}

html.theme-dark .matter-list-group-item a:hover {
    color: var(--theme-dark-highlight);
}

html.theme-dark .matter-list-group-item svg {
    fill: var(--theme-dark-highlight);
}

html.theme-dark .matter-list-group-item:hover svg {
    fill: #60a5fa;
}

html.theme-dark .matter-list-group-item .fa-trash-can {
    color: #fca5a5;
}

html.theme-dark .matter-list-group-item .fa-trash-can:hover {
    color: #f87171;
}

/* --- Dark Mode: Matter Detail View --- */
html.theme-dark .btn-primary {
    background-color: var(--theme-dark-accent);
    border-color: var(--theme-dark-accent);
    color: #f8fafc;
}

html.theme-dark .btn-primary:hover {
    background-color: #2563eb;
}

html.theme-dark .btn-info {
    background-color: #3b82f6;
    border-color: #3b82f6;
    color: #f8fafc;
}

html.theme-dark .btn-info:hover {
    background-color: #2563eb;
}

html.theme-dark .btn-secondary {
    background-color: #475569;
    border-color: #475569;
    color: var(--theme-dark-text);
}

html.theme-dark .btn-secondary:hover {
    background-color: #5b6b80;
    color: #f8fafc;
}

html.theme-dark .btn-danger {
    background-color: #ef4444;
    border-color: #ef4444;
    color: #f8fafc;
}

html.theme-dark .btn-danger:hover {
    background-color: #dc2626;
}

html.theme-dark .btn-success {
    background-color: #22c55e;
    border-color: #22c55e;
    color: #0b1727;
}

html.theme-dark .btn-success:hover {
    background-color: #16a34a;
    color: #f8fafc;
}

html.theme-dark .highlight-box {
    background-color: var(--theme-dark-elevated);
    border: none;
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.28);
    color: var(--theme-dark-text);
}

html.theme-dark .highlight-box:hover {
    box-shadow: 0 18px 36px rgba(59, 130, 246, 0.2);
}

html.theme-dark .highlight-box h5 {
    color: var(--theme-dark-text);
}

html.theme-dark .content-list .item {
    border-bottom-color: rgba(148, 163, 184, 0.2);
}

html.theme-dark .content-list .left-text,
html.theme-dark .content-list .right-text {
    color: var(--theme-dark-text);
}

html.theme-dark .integration-link a {
    color: var(--theme-dark-highlight);
}

html.theme-dark .integration-link a:hover {
    color: #d3e2ff;
}

html.theme-dark .directory-item {
    background-color: #303848;
    border: none;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.3);
}

html.theme-dark .directory-item:hover {
    background-color: #394258;
    border-color: var(--theme-dark-accent);
    box-shadow: 0 12px 28px rgba(59, 130, 246, 0.22);
}

html.theme-dark .folder-icon {
    color: var(--theme-dark-highlight);
}

html.theme-dark .directory-item:hover .folder-icon {
    color: #60a5fa;
}

html.theme-dark .directory-item small {
    color: var(--theme-dark-muted);
}

html.theme-dark .add-folder-btn {
    background-color: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.4);
    color: var(--theme-dark-text);
    box-shadow: none;
}

html.theme-dark .add-folder-btn:hover {
    background-color: rgba(59, 130, 246, 0.2);
    border-color: var(--theme-dark-accent);
    color: #f8fafc;
}

html.theme-dark .alert.alert-light {
    background-color: #1f2735;
    border-color: var(--theme-dark-border);
    color: var(--theme-dark-muted);
}

html.theme-dark .bg-light {
    background-color: #2b3343 !important;
    color: var(--theme-dark-text);
}

html.theme-dark .media.card {
    background-color: #303848;
    border: none;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.25);
}

html.theme-dark .media.card:hover {
    box-shadow: 0 14px 32px rgba(59, 130, 246, 0.2);
}

html.theme-dark .comment-text {
    color: var(--theme-dark-text);
}

html.theme-dark .comment-text strong {
    color: var(--theme-dark-muted);
}

html.theme-dark .sub-comments {
    border-left: 2px solid rgba(148, 163, 184, 0.3);
}

html.theme-dark .btn-close,
html.theme-dark .custom-close {
    filter: invert(1) grayscale(100%);
}

html.theme-dark .folder-modal,
html.theme-dark .delete-modal {
    background-color: var(--theme-dark-elevated);
    border: none;
    color: var(--theme-dark-text);
}

html.theme-dark .folder-modal .modal-header,
html.theme-dark .folder-modal .modal-footer,
html.theme-dark .delete-modal .modal-header,
html.theme-dark .delete-modal .modal-footer {
    border-color: rgba(148, 163, 184, 0.2);
}

/* --- Dark Mode: Matter File Listing --- */
html.theme-dark .dropzone {
    border-color: var(--theme-dark-border);
    background: rgba(59, 130, 246, 0.08);
    color: var(--theme-dark-text);
}

html.theme-dark .dropzone:hover {
    border-color: var(--theme-dark-accent);
    background: rgba(59, 130, 246, 0.16);
}

html.theme-dark .dropzone .dz-message {
    color: var(--theme-dark-text);
}

html.theme-dark .dropzone .text-muted {
    color: var(--theme-dark-muted) !important;
}

html.theme-dark .upload-section .alert {
    background-color: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.4);
    color: #bbf7d0;
}

html.theme-dark .dashboard-grid .table {
    background-color: transparent;
}

html.theme-dark .dashboard-grid .table .table {
    background-color: transparent;
}

html.theme-dark .dataTables_wrapper .dataTables_length label,
html.theme-dark .dataTables_wrapper .dataTables_filter label {
    color: var(--theme-dark-text);
}

html.theme-dark .dataTables_wrapper .dataTables_filter input,
html.theme-dark .dataTables_wrapper .dataTables_length select {
    background-color: #353d4f;
    color: var(--theme-dark-text);
    border: none;
}

html.theme-dark .dataTables_wrapper .dataTables_filter input::placeholder {
    color: var(--theme-dark-muted);
}

html.theme-dark input::placeholder,
html.theme-dark textarea::placeholder,
html.theme-dark .form-control::placeholder,
html.theme-dark .form-select::placeholder {
    color: var(--theme-dark-muted);
}

html.theme-dark .dataTables_wrapper .dataTables_filter input:focus,
html.theme-dark .dataTables_wrapper .dataTables_length select:focus {
    background-color: #3a4356;
    border-color: var(--theme-dark-accent);
    box-shadow: 0 0 0 0.2rem var(--theme-dark-accent-soft);
    color: #f8fafc;
}

html.theme-dark .dataTables_wrapper .dataTables_length select option {
    background-color: #1f2937;
    color: var(--theme-dark-text);
}

html.theme-dark .yajra-datatable thead th {
    background-color: #2f3747;
}

html.theme-dark .yajra-datatable tbody tr {
    background-color: #303848;
}

html.theme-dark .yajra-datatable tbody tr:nth-child(even) {
    background-color: #364052;
}

html.theme-dark .yajra-datatable tbody tr:hover {
    background-color: #3e4a5f;
}

html.theme-dark table.dataTable thead th,
html.theme-dark table.dataTable thead td {
    border-bottom: none;
}

html.theme-dark table.dataTable tfoot th,
html.theme-dark table.dataTable tfoot td {
    border-top: none;
    background-color: #2b3343;
    color: var(--theme-dark-text);
}

html.theme-dark table.dataTable.no-footer {
    border: none;
}


html.theme-dark table.dataTable tbody tr.selected,
html.theme-dark table.dataTable tbody tr.selected td {
    background-color: rgba(59, 130, 246, 0.18) !important;
}

html.theme-dark .dataTables_wrapper .dataTables_paginate {
    color: var(--theme-dark-text);
}

html.theme-dark .dataTables_wrapper .dataTables_paginate .paginate_button {
    background-color: #2f3747;
    border-color: var(--theme-dark-border);
    color: var(--theme-dark-text) !important;
}

html.theme-dark .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background-color: #3a4356;
    border-color: var(--theme-dark-accent);
    color: #f8fafc !important;
}

html.theme-dark .dataTables_wrapper .dataTables_paginate .paginate_button.current,
html.theme-dark .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background-color: var(--theme-dark-accent);
    border-color: var(--theme-dark-accent);
    color: #f8fafc !important;
}

html.theme-dark .dataTables_wrapper .dataTables_paginate .paginate_button.previous,
html.theme-dark .dataTables_wrapper .dataTables_paginate .paginate_button.next {
    background-color: #253045;
    border-color: var(--theme-dark-border);
}

html.theme-dark .dataTables_wrapper .dataTables_paginate .paginate_button.previous:hover,
html.theme-dark .dataTables_wrapper .dataTables_paginate .paginate_button.next:hover {
    background-color: #2f3a50;
    border-color: var(--theme-dark-accent);
}

html.theme-dark .dataTables_wrapper .dataTables_paginate .paginate_button.previous.disabled,
html.theme-dark .dataTables_wrapper .dataTables_paginate .paginate_button.next.disabled {
    background-color: transparent;
    color: var(--theme-dark-muted) !important;
    border-color: var(--theme-dark-border);
}

html.theme-dark .dataTables_wrapper .dataTables_info {
    color: var(--theme-dark-muted);
}

html.theme-dark .pagination .page-link {
    background-color: #253045 !important;
    border: none !important;
    color: var(--theme-dark-text) !important;
}

html.theme-dark .pagination .page-link:hover {
    background-color: #2f3a50 !important;
    border-color: var(--theme-dark-accent) !important;
    color: #f8fafc !important;
}

html.theme-dark .pagination .page-item.active .page-link {
    background-color: var(--theme-dark-accent) !important;
    border-color: var(--theme-dark-accent) !important;
    color: #f8fafc !important;
}

html.theme-dark .pagination .page-item.disabled .page-link {
    background-color: transparent !important;
    border-color: var(--theme-dark-border) !important;
    color: var(--theme-dark-muted) !important;
}

html.theme-dark .dataTables_wrapper .dataTables_paginate .paginate_button:focus,
html.theme-dark .dataTables_wrapper .dataTables_paginate .paginate_button:active {
    outline: none;
    box-shadow: 0 0 0 0.2rem var(--theme-dark-accent-soft);
}

html.theme-dark table.dataTable tbody td,
html.theme-dark table.dataTable tbody th {
    border-top: 1px solid rgba(148, 163, 184, 0.12);
}

html.theme-dark .dataTables_wrapper .dataTables_scrollHead,
html.theme-dark .dataTables_wrapper .dataTables_scrollFoot {
    background-color: #2b3343;
    border-color: var(--theme-dark-border);
}

html.theme-dark .dataTables_wrapper .dataTables_empty {
    color: var(--theme-dark-muted);
}

html.theme-dark .dataTables_wrapper .dataTables_processing {
    background-color: rgba(15, 23, 42, 0.85);
    color: var(--theme-dark-text);
}

html.theme-dark table.table.table-striped.table-bordered.dataTable.yajra-datatable.no-footer.dtr-inline {
    background-color: transparent !important;
    color: var(--theme-dark-text);
    border: none;
}

html.theme-dark table.table.table-striped.table-bordered.dataTable.yajra-datatable.no-footer.dtr-inline thead,
html.theme-dark table.table.table-striped.table-bordered.dataTable.yajra-datatable.no-footer.dtr-inline thead tr,
html.theme-dark table.table.table-striped.table-bordered.dataTable.yajra-datatable.no-footer.dtr-inline thead th,
html.theme-dark table.table.table-striped.table-bordered.dataTable.yajra-datatable.no-footer.dtr-inline thead td {
    background-color: #2f3747 !important;
    color: var(--theme-dark-text);
}

html.theme-dark table.table.table-striped.table-bordered.dataTable.yajra-datatable.no-footer.dtr-inline tbody,
html.theme-dark table.table.table-striped.table-bordered.dataTable.yajra-datatable.no-footer.dtr-inline tbody tr,
html.theme-dark table.table.table-striped.table-bordered.dataTable.yajra-datatable.no-footer.dtr-inline tbody td,
html.theme-dark table.table.table-striped.table-bordered.dataTable.yajra-datatable.no-footer.dtr-inline tbody th {
    background-color: #303848 !important;
    color: var(--theme-dark-text);
}

html.theme-dark table.table.table-striped.table-bordered.dataTable.yajra-datatable.no-footer.dtr-inline tbody tr:nth-child(even) {
    background-color: #364052 !important;
}

html.theme-dark table.table.table-striped.table-bordered.dataTable.yajra-datatable.no-footer.dtr-inline tbody tr:hover {
    background-color: #3e4a5f !important;
}

html.theme-dark table.table.table-striped.table-bordered.dataTable.yajra-datatable.no-footer.dtr-inline tbody td,
html.theme-dark table.table.table-striped.table-bordered.dataTable.yajra-datatable.no-footer.dtr-inline tbody th {
    border-top: 1px solid rgba(148, 163, 184, 0.12);
}

html.theme-dark table.table.table-striped.table-bordered.dataTable.yajra-datatable.no-footer.dtr-inline tbody tr.selected,
html.theme-dark table.table.table-striped.table-bordered.dataTable.yajra-datatable.no-footer.dtr-inline tbody tr.selected td {
    background-color: rgba(59, 130, 246, 0.18) !important;
}

html.theme-dark table.table.table-striped.table-bordered.dataTable.yajra-datatable.no-footer.dtr-inline td.dt-control:before {
    background-color: var(--theme-dark-accent);
    border-color: var(--theme-dark-border);
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.6);
}

html.theme-dark table.table.table-striped.table-bordered.dataTable.yajra-datatable.no-footer.dtr-inline tr.dt-hasChild td.dt-control:before {
    background-color: #ef4444;
}

/* --- Dark Mode: Fee Structure --- */
html.theme-dark .fee-structure-container {
    background: none;
}

html.theme-dark .fee-table thead tr {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.95) 0%, rgba(14, 165, 233, 0.95) 100%) !important;
    color: #f8fafc;
}

html.theme-dark .fee-table th,
html.theme-dark .fee-table td {
    border-color: var(--theme-dark-border);
}

html.theme-dark .fee-table tbody tr {
    background: #1f2937;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

html.theme-dark .fee-table tbody tr:last-child {
    border-bottom: none;
}

html.theme-dark .fee-table tbody td:first-child {
    color: var(--theme-dark-text);
}

html.theme-dark .fee-table tbody td:last-child {
    color: var(--theme-dark-muted);
}

@media (max-width: 768px) {
    html.theme-dark .fee-table tbody td:last-child {
        border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    }
}

/* --- Dark Mode: Team Profiles --- */
html.theme-dark .team-section {
    background: #101827;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.4);
}

html.theme-dark .btn-add-member {
    background-color: var(--theme-dark-accent);
    color: #f8fafc;
}

html.theme-dark .btn-add-member:hover {
    background-color: #2563eb;
}

html.theme-dark .table-wrapper {
    background: #182030;
    box-shadow: 0 16px 35px rgba(15, 23, 42, 0.45);
    border: none;
}

html.theme-dark table.dataTable thead th {
    background: #253045 !important;
    color: var(--theme-dark-text);
    border: none;
}

html.theme-dark table.dataTable tbody tr {
    background: #1f2738 !important;
    color: var(--theme-dark-text);
}

html.theme-dark table.dataTable tbody tr:hover {
    box-shadow: 0 6px 18px rgba(59, 130, 246, 0.18);
}

html.theme-dark table.dataTable tbody td {
    color: var(--theme-dark-text);
}

html.theme-dark .modal-content {
    background: #1b2333;
    border: none;
    color: var(--theme-dark-text);
}

html.theme-dark .modal-title {
    color: var(--theme-dark-text);
}

html.theme-dark .form-control {
    background-color: #253045;
    border: none;
    color: var(--theme-dark-text);
}

html.theme-dark .form-control:focus {
    background-color: #2c374c;
    border-color: var(--theme-dark-accent);
    box-shadow: 0 0 0 0.2rem var(--theme-dark-accent-soft);
    color: #f8fafc;
}

html.theme-dark .btn-outline-secondary {
    border-color: var(--theme-dark-border);
    color: var(--theme-dark-text);
}

html.theme-dark .btn-outline-secondary:hover {
    background-color: #303848;
    border-color: var(--theme-dark-accent);
}

/* --- Dark Mode: SAFLII Leads Kanban --- */
html.theme-dark .kanban-board-header {
    background: #111827;
    border-bottom: none;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.35);
}

html.theme-dark .kanban-header-cell {
    background: #1b2333;
    color: var(--theme-dark-text);
    border-bottom: 2px solid var(--theme-dark-border);
}

html.theme-dark .kanban-board {
    background: #182030;
    border: none;
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.35);
}

html.theme-dark .kanban-board .kanban-drag {
    background: #1f2738;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: var(--theme-dark-text);
}

html.theme-dark .kanban-item {
    background: #1f2738;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.25);
    color: var(--theme-dark-text);
}

html.theme-dark .kanban-card-content .badge {
    border: 1px solid rgba(148, 163, 184, 0.25);
}

html.theme-dark .kanban-board button,
html.theme-dark .kanban-board a {
    color: var(--theme-dark-text);
}

html.theme-dark .kanban-board .badge.bg-info {
    background-color: rgba(14, 165, 233, 0.25) !important;
    color: #dbeafe !important;
}

html.theme-dark .kanban-board .badge.bg-primary {
    background-color: rgba(59, 130, 246, 0.25) !important;
    color: #bfdbfe !important;
}

html.theme-dark .kanban-board .badge.bg-success-subtle {
    background-color: rgba(22, 163, 74, 0.2) !important;
    color: #bbf7d0 !important;
}

html.theme-dark .kanban-board .badge.bg-warning {
    background-color: rgba(251, 191, 36, 0.25) !important;
    color: #fde68a !important;
}

html.theme-dark #kanban-filter-form .form-label {
    color: var(--theme-dark-text);
}

html.theme-dark #kanban-filter-form .form-select {
    background-color: #253045;
    border: none;
    color: var(--theme-dark-text);
}

html.theme-dark #kanban-filter-form .form-select:focus {
    background-color: #2c374c;
    border-color: var(--theme-dark-accent);
    box-shadow: 0 0 0 0.2rem var(--theme-dark-accent-soft);
}

html.theme-dark #kanban-filter-form .btn-secondary {
    background-color: #374151;
    border-color: var(--theme-dark-border);
    color: var(--theme-dark-text);
}

html.theme-dark #kanban-filter-form .btn-secondary:hover {
    background-color: #4b5563;
    border-color: var(--theme-dark-accent);
}

html.theme-dark #delete-lead-modal .modal-content {
    background-color: #1b2333;
    border: none;
    color: var(--theme-dark-text);
}

html.theme-dark #delete-lead-modal .modal-header,
html.theme-dark #delete-lead-modal .modal-footer {
    border-color: rgba(148, 163, 184, 0.2);
}

html.theme-dark #delete-lead-modal .btn-secondary {
    background-color: #374151;
    border-color: var(--theme-dark-border);
    color: var(--theme-dark-text);
}

html.theme-dark #delete-lead-modal .btn-danger {
    background-color: #ef4444;
    border-color: #ef4444;
}

/* --- Dark Mode: SAFLII Lead Forms & Activities --- */
html.theme-dark .breadcrumb {
    background: transparent;
}

html.theme-dark .breadcrumb .breadcrumb-item,
html.theme-dark .breadcrumb .breadcrumb-item a {
    color: var(--theme-dark-muted);
}

html.theme-dark .breadcrumb .breadcrumb-item.active {
    color: var(--theme-dark-text);
}

html.theme-dark .activity-log-panel,
html.theme-dark .activity-log-section,
html.theme-dark .card.activity-log-panel,
html.theme-dark .card.activity-log-section {
    background: #182030;
    border: none;
}

html.theme-dark .card.shadow-sm.border-0.theme-surface.main-content-dashboard,
html.theme-dark .card.shadow-sm.border-0.theme-surface.activity-log-panel {
    background: #182030;
}

html.theme-dark #activities-table_wrapper .card,
html.theme-dark #activities-table {
    background: #1f2738;
}

html.theme-dark #activities-table thead th {
    background: #253045;
    color: var(--theme-dark-text);
}

html.theme-dark #activities-table tbody tr {
    background: #1f2738;
    color: var(--theme-dark-text);
}

html.theme-dark #activityModal .modal-content {
    background: #1b2333;
    border: none;
    color: var(--theme-dark-text);
}

html.theme-dark #activityModal .modal-header {
    background: #253045;
    border-bottom: none;
}

html.theme-dark .btn-primary,
html.theme-dark .btn-primary:focus {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.95), rgba(14, 165, 233, 0.95));
    border-color: transparent;
    color: #f8fafc;
}

html.theme-dark .btn-primary:hover {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.95), rgba(14, 165, 233, 0.95));
}

html.theme-dark .btn-secondary {
    background-color: #374151;
    border-color: var(--theme-dark-border);
    color: var(--theme-dark-text);
}

html.theme-dark .btn-secondary:hover {
    background-color: #4b5563;
    border-color: var(--theme-dark-accent);
}

html.theme-dark #customer_checkboxes {
    background-color: #182030;
    border: 1px solid var(--theme-dark-border) !important;
}

html.theme-dark #customer_checkboxes .form-check-label {
    color: var(--theme-dark-text);
}

/* --- Dark Mode: TinyMCE --- */
html.theme-dark .tox {
    color-scheme: dark;
}

html.theme-dark .tox .tox-editor-header,
html.theme-dark .tox .tox-toolbar-overlord,
html.theme-dark .tox .tox-toolbar__primary,
html.theme-dark .tox .tox-menubar {
    background-color: #1f2738;
    border-bottom: 1px solid var(--theme-dark-border);
}

html.theme-dark .tox .tox-mbtn,
html.theme-dark .tox .tox-tbtn {
    color: var(--theme-dark-text);
}

html.theme-dark .tox .tox-tbtn:hover,
html.theme-dark .tox .tox-mbtn:hover {
    background-color: #2c374c;
    color: #f8fafc;
}

html.theme-dark .tox .tox-edit-area__iframe {
    background-color: #101827;
    border: none;
}

html.theme-dark .tox .tox-edit-area__iframe body,
html.theme-dark .tox .tox-edit-area__iframe html {
    background-color: #101827;
    color: var(--theme-dark-text);
}

html.theme-dark .tox .tox-edit-area {
    background-color: #101827;
}

html.theme-dark .tox .tox-sidebar-wrap {
    background-color: #101827;
}

html.theme-dark .tox .tox-sidebar {
    background-color: #101827;
    border-left: 1px solid var(--theme-dark-border);
}

html.theme-dark .tox .tox-sidebar__slider,
html.theme-dark .tox .tox-sidebar__pane-container {
    background-color: #101827;
}

html.theme-dark .tox .tox-statusbar {
    background-color: #1f2738;
    border-top: 1px solid var(--theme-dark-border);
    color: var(--theme-dark-muted);
}

html.theme-dark .tox .tox-statusbar__path,
html.theme-dark .tox .tox-statusbar__text {
    color: var(--theme-dark-muted);
}

/* --- Dark Mode: Admin Dashboard --- */
html.theme-dark .progress {
    background-color: #253045;
    border-radius: 6px;
}

html.theme-dark .progress-bar.bg-primary {
    background-color: var(--theme-dark-accent) !important;
}

html.theme-dark .progress-bar.bg-success {
    background-color: #22c55e !important;
}

html.theme-dark .progress-bar.bg-warning {
    background-color: #fbbf24 !important;
    color: #0f172a;
}

html.theme-dark .card h6,
html.theme-dark .card small,
html.theme-dark .card p,
html.theme-dark .card span {
    color: var(--theme-dark-text);
}

html.theme-dark .card .text-muted {
    color: var(--theme-dark-muted) !important;
}

html.theme-dark .badge.bg-primary {
    background-color: rgba(59, 130, 246, 0.25) !important;
    color: #bfdbfe !important;
}

html.theme-dark .badge.bg-success {
    background-color: rgba(34, 197, 94, 0.25) !important;
    color: #bbf7d0 !important;
}

html.theme-dark .badge.bg-warning {
    background-color: rgba(251, 191, 36, 0.25) !important;
    color: #fde68a !important;
}

html.theme-dark .swiper-pagination-bullet {
    background-color: rgba(148, 163, 184, 0.45) !important;
}

html.theme-dark .swiper-pagination-bullet-active {
    background-color: var(--theme-dark-accent) !important;
}

/* --- Dark Mode: Common Text Elements --- */
html.theme-dark label,
html.theme-dark .form-label,
html.theme-dark .form-check-label,
html.theme-dark .form-text,
html.theme-dark .form-group label {
    color: var(--theme-dark-text);
}

html.theme-dark .heading,
html.theme-dark .tools-box .heading,
html.theme-dark .card-title,
html.theme-dark .card-text {
    color: var(--theme-dark-text);
}

html.theme-dark .card-body,
html.theme-dark .card-footer,
html.theme-dark .card-header {
    color: var(--theme-dark-text);
}

/* --- Dark Mode: Header Search Modal --- */
html.theme-dark #header-search-modal {
    background: rgba(15, 23, 42, 0.8) !important;
}

html.theme-dark #header-search-modal > div {
    background: #1f2738 !important;
    color: var(--theme-dark-text);
    border: 1px solid var(--theme-dark-border);
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.45);
}

html.theme-dark #header-search-close {
    color: var(--theme-dark-text);
}

html.theme-dark #header-search-results {
    color: var(--theme-dark-text);
}

/* --- Dark Mode: ApexCharts --- */
html.theme-dark .apexcharts-xaxis text,
html.theme-dark .apexcharts-yaxis text,
html.theme-dark .apexcharts-title-text,
html.theme-dark .apexcharts-subtitle-text,
html.theme-dark .apexcharts-legend-text {
    fill: var(--theme-dark-text) !important;
    color: var(--theme-dark-text) !important;
}

html.theme-dark .apexcharts-gridline,
html.theme-dark .apexcharts-gridlines-horizontal line,
html.theme-dark .apexcharts-gridlines-vertical line {
    stroke: rgba(148, 163, 184, 0.18) !important;
}

html.theme-dark .apexcharts-tooltip,
html.theme-dark .apexcharts-tooltip-series-group {
    background: #1f2738 !important;
    border: 1px solid var(--theme-dark-border) !important;
    color: var(--theme-dark-text) !important;
}

html.theme-dark .apexcharts-tooltip-title {
    background: #253045 !important;
    border-bottom: 1px solid var(--theme-dark-border) !important;
    color: var(--theme-dark-text) !important;
}

html.theme-dark .apexcharts-toolbar svg {
    fill: var(--theme-dark-text) !important;
    stroke: var(--theme-dark-text) !important;
}
html.theme-dark .loader {
    border-top-color: var(--theme-dark-accent);
    border-left-color: rgba(59, 130, 246, 0.25);
    border-right-color: rgba(59, 130, 246, 0.25);
    border-bottom-color: rgba(59, 130, 246, 0.25);
}
