/**
 * Concetto AI – Light / dark theme overrides
 * Works with Mazer (app.css + app-dark.css) and data-bs-theme on <html>.
 * Toggle: #toggle-dark in sidebar (dark.js).
 */

/* -------------------------------------------------------------------------- */
/* Design tokens                                                              */
/* -------------------------------------------------------------------------- */

:root,
[data-bs-theme="light"] {
    --app-bg: #f2f3f7;
    --app-surface: #ffffff;
    --app-surface-2: #f8fafc;
    --app-surface-hover: #f1f5f9;
    --app-border: #e2e8f0;
    --app-border-soft: #edf0f7;
    --app-text: #1e293b;
    --app-text-secondary: #334155;
    --app-text-muted: #64748b;
    --app-input-bg: #ffffff;
    --app-input-border: #dce3ef;
    --app-input-focus: rgba(var(--bs-primary-rgb), 0.2);
    --app-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
    --app-shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
    --app-code-bg: #f1f5f9;
    --app-highlight-bg: #d1fae5;
    --app-highlight-text: #065f46;
    --app-scrollbar: #cbd5e1;
}

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

    --app-bg: #151521;
    --app-surface: #1e1e2d;
    --app-surface-2: #252536;
    --app-surface-hover: #2d2d42;
    --app-border: #34344a;
    --app-border-soft: #2a2a3d;
    --app-text: #e8edf5;
    --app-text-secondary: #c8d0dc;
    --app-text-muted: #94a3b8;
    --app-input-bg: #252536;
    --app-input-border: #43435c;
    --app-input-focus: rgba(var(--bs-primary-rgb), 0.35);
    --app-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
    --app-shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.45);
    --app-code-bg: #2d2d42;
    --app-highlight-bg: rgba(16, 185, 129, 0.22);
    --app-highlight-text: #6ee7b7;
    --app-scrollbar: #4b5563;

    --bs-body-bg: var(--app-bg);
    --bs-body-color: var(--app-text);
    --bs-border-color: var(--app-border);
    --bs-secondary-color: var(--app-text-muted);
    --bs-tertiary-bg: var(--app-surface-2);
    --bs-emphasis-color: #f8fafc;
    --bs-heading-color: var(--app-text);
    --bs-link-color: #7eb8ff;
    --bs-link-hover-color: #a5cfff;

    .bi-arrow-clockwise{
        color: #99aaff !important;
    }
}

/* -------------------------------------------------------------------------- */
/* Base layout                                                                */
/* -------------------------------------------------------------------------- */

[data-bs-theme="dark"] body {
    background-color: var(--app-bg) !important;
    color: var(--app-text);
}

[data-bs-theme="dark"] #main,
[data-bs-theme="dark"] #main-content,
[data-bs-theme="dark"] .page-heading {
    background-color: var(--app-bg);
    color: var(--app-text);
}

[data-bs-theme="dark"] .page-title h3,
[data-bs-theme="dark"] .page-title h4,
[data-bs-theme="dark"] h1,
[data-bs-theme="dark"] h2,
[data-bs-theme="dark"] h3,
[data-bs-theme="dark"] h4,
[data-bs-theme="dark"] h5,
[data-bs-theme="dark"] h6 {
    color: var(--app-text);
}

[data-bs-theme="dark"] .text-dark,
[data-bs-theme="dark"] .text-gray-600,
[data-bs-theme="dark"] .text-gray-700 {
    color: var(--app-text-secondary) !important;
}

[data-bs-theme="dark"] .text-muted {
    color: var(--app-text-muted) !important;
}

[data-bs-theme="dark"] .bg-white,
[data-bs-theme="dark"] .bg-light {
    background-color: var(--app-surface) !important;
    color: var(--app-text);
}

[data-bs-theme="dark"] .border,
[data-bs-theme="dark"] .border-top,
[data-bs-theme="dark"] .border-bottom,
[data-bs-theme="dark"] .border-start,
[data-bs-theme="dark"] .border-end {
    border-color: var(--app-border) !important;
}

/* -------------------------------------------------------------------------- */
/* Sidebar & navbar                                                           */
/* -------------------------------------------------------------------------- */

[data-bs-theme="dark"] .sidebar-wrapper,
[data-bs-theme="dark"] .sidebar-header {
    background-color: var(--app-surface) !important;
    border-color: var(--app-border);
}

[data-bs-theme="dark"] .sidebar-menu .menu .sidebar-link,
[data-bs-theme="dark"] .sidebar-menu .menu .sidebar-link span {
    color: var(--app-text-secondary);
}

[data-bs-theme="dark"] .sidebar-menu .menu .sidebar-item.active .sidebar-link,
[data-bs-theme="dark"] .sidebar-menu .menu .sidebar-link:hover {
    color: #99aaff !important;
    background-color: var(--app-surface-hover);
}

[data-bs-theme="dark"] .theme-toggle svg {
    color: var(--app-text-muted);
}

[data-bs-theme="dark"] .navbar-top {
    background-color: var(--app-surface) !important;
    border-color: var(--app-border);
    box-shadow: var(--app-shadow);
}

[data-bs-theme="dark"] .navbar-top .burger-btn i {
    color: var(--app-text);
}

/* -------------------------------------------------------------------------- */
/* Cards, tables, lists                                                       */
/* -------------------------------------------------------------------------- */

[data-bs-theme="dark"] .card {
    background-color: var(--app-surface);
    border-color: var(--app-border);
    color: var(--app-text);
    box-shadow: var(--app-shadow);
}

[data-bs-theme="dark"] .card-header,
[data-bs-theme="dark"] .card-footer {
    background-color: var(--app-surface-2);
    border-color: var(--app-border);
    color: var(--app-text);
}

[data-bs-theme="dark"] .table {
    --bs-table-bg: var(--app-surface);
    --bs-table-color: var(--app-text);
    --bs-table-border-color: var(--app-border);
    --bs-table-striped-bg: var(--app-surface-2);
    --bs-table-hover-bg: var(--app-surface-hover);
    --bs-table-active-bg: var(--app-surface-hover);
}

[data-bs-theme="dark"] .table thead th,
[data-bs-theme="dark"] .table-light {
    background-color: var(--app-surface-2) !important;
    color: var(--app-text-secondary) !important;
    border-color: var(--app-border) !important;
}

[data-bs-theme="dark"] .table > :not(caption) > * > * {
    border-color: var(--app-border);
    color: var(--app-text);
}

[data-bs-theme="dark"] .list-group-item {
    background-color: var(--app-surface);
    border-color: var(--app-border);
    color: var(--app-text);
}

[data-bs-theme="dark"] .list-group-item-action:hover,
[data-bs-theme="dark"] .list-group-item-action:focus {
    background-color: var(--app-surface-hover);
    color: var(--app-text);
}

/* -------------------------------------------------------------------------- */
/* Forms — inputs, selects, textarea, switches                                */
/* -------------------------------------------------------------------------- */

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] textarea.form-control,
[data-bs-theme="dark"] .input-group-text,
[data-bs-theme="dark"] .form-control-plaintext {
    background-color: var(--app-input-bg);
    border-color: var(--app-input-border);
    color: var(--app-text);
}

[data-bs-theme="dark"] .form-control::placeholder,
[data-bs-theme="dark"] textarea::placeholder {
    color: #6b7280;
    opacity: 1;
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus,
[data-bs-theme="dark"] textarea.form-control:focus {
    background-color: var(--app-input-bg);
    border-color: var(--bs-primary);
    color: var(--app-text);
    box-shadow: 0 0 0 0.2rem var(--app-input-focus);
}

[data-bs-theme="dark"] .form-control:disabled,
[data-bs-theme="dark"] .form-select:disabled {
    background-color: var(--app-surface-2);
    color: var(--app-text-muted);
}

[data-bs-theme="dark"] .form-label,
[data-bs-theme="dark"] label {
    color: var(--app-text-secondary);
}

[data-bs-theme="dark"] .form-check-input {
    background-color: var(--app-input-bg);
    border-color: var(--app-input-border);
}

[data-bs-theme="dark"] .form-check-input:checked {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

[data-bs-theme="dark"] .form-text,
[data-bs-theme="dark"] .invalid-feedback,
[data-bs-theme="dark"] .valid-feedback {
    color: var(--app-text-muted);
}

[data-bs-theme="dark"] select option {
    background-color: var(--app-surface);
    color: var(--app-text);
}

/* -------------------------------------------------------------------------- */
/* Buttons & dropdowns                                                        */
/* -------------------------------------------------------------------------- */

html[data-bs-theme=dark] .text-white{
    color: #fff !important;
}

html[data-bs-theme=dark] .tm-ingested-page-url:hover {
    color: #99aaff !important;
    text-decoration: underline;
}

html[data-bs-theme=dark] .btn:hover{
    background-color: #435ebe !important;
    border-color: #435ebe !important;
    color: #fff !important;
}

[data-bs-theme="dark"] .btn-light,
[data-bs-theme="dark"] .btn-outline-light {
    background-color: var(--app-surface-2);
    border-color: var(--app-border);
    color: var(--app-text);
}

[data-bs-theme="dark"] .btn-light:hover,
[data-bs-theme="dark"] .btn-outline-light:hover {
    background-color: var(--app-surface-hover);
    border-color: var(--app-border);
    color: var(--app-text);
}

[data-bs-theme="dark"] .btn-outline-secondary {
    border-color: var(--app-border);
    color: var(--app-text-secondary);
}

[data-bs-theme="dark"] .btn-outline-secondary:hover {
    background-color: var(--app-surface-hover);
    border-color: var(--app-text-muted);
    color: var(--app-text);
}

[data-bs-theme="dark"] .dropdown-menu {
    background-color: var(--app-surface);
    border-color: var(--app-border);
    box-shadow: var(--app-shadow-lg);
}

[data-bs-theme="dark"] .dropdown-item {
    color: var(--app-text);
}

[data-bs-theme="dark"] .dropdown-item:hover,
[data-bs-theme="dark"] .dropdown-item:focus {
    background-color: var(--app-surface-hover);
    color: var(--app-text);
}

[data-bs-theme="dark"] .dropdown-header {
    color: var(--app-text-muted);
}

[data-bs-theme="dark"] .dropdown-divider {
    border-color: var(--app-border);
}

/* -------------------------------------------------------------------------- */
/* Modals, alerts, badges, pagination                                         */
/* -------------------------------------------------------------------------- */

[data-bs-theme="dark"] .modal-content {
    background-color: var(--app-surface);
    border-color: var(--app-border);
    color: var(--app-text);
}

[data-bs-theme="dark"] .modal-header,
[data-bs-theme="dark"] .modal-footer {
    border-color: var(--app-border);
    background-color: var(--app-surface);
}

[data-bs-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

[data-bs-theme="dark"] .alert {
    border-color: var(--app-border);
}

[data-bs-theme="dark"] .alert-light {
    background-color: var(--app-surface-2);
    border-color: var(--app-border);
    color: var(--app-text);
}

[data-bs-theme="dark"] .badge.bg-light {
    background-color: var(--app-surface-2) !important;
    color: var(--app-text) !important;
}

[data-bs-theme="dark"] .page-link {
    background-color: var(--app-surface);
    border-color: var(--app-border);
    color: var(--app-text);
}

[data-bs-theme="dark"] .page-item.active .page-link {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

[data-bs-theme="dark"] .page-item.disabled .page-link {
    background-color: var(--app-surface-2);
    color: var(--app-text-muted);
}

/* -------------------------------------------------------------------------- */
/* Progress, nav tabs, accordion                                              */
/* -------------------------------------------------------------------------- */

[data-bs-theme="dark"] .progress {
    background-color: var(--app-surface-2);
}

[data-bs-theme="dark"] .nav-tabs {
    border-color: var(--app-border);
}

[data-bs-theme="dark"] .nav-tabs .nav-link {
    color: var(--app-text-muted);
}

[data-bs-theme="dark"] .nav-tabs .nav-link.active {
    background-color: var(--app-surface);
    border-color: var(--app-border) var(--app-border) var(--app-surface);
    color: var(--app-text);
}

[data-bs-theme="dark"] .accordion-item {
    background-color: var(--app-surface);
    border-color: var(--app-border);
}

[data-bs-theme="dark"] .accordion-button {
    background-color: var(--app-surface-2);
    color: var(--app-text);
}

[data-bs-theme="dark"] .accordion-button:not(.collapsed) {
    background-color: var(--app-surface-hover);
    color: var(--app-text);
}

/* -------------------------------------------------------------------------- */
/* Scrollbars                                                                 */
/* -------------------------------------------------------------------------- */

[data-bs-theme="dark"] ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

[data-bs-theme="dark"] ::-webkit-scrollbar-thumb {
    background: var(--app-scrollbar);
    border-radius: 8px;
}

[data-bs-theme="dark"] ::-webkit-scrollbar-track {
    background: var(--app-surface-2);
}

/* -------------------------------------------------------------------------- */
/* Customer dashboard                                                         */
/* -------------------------------------------------------------------------- */

[data-bs-theme="dark"] .dashboard-card {
    background: var(--app-surface);
    border-color: var(--app-border);
    box-shadow: var(--app-shadow);
}

[data-bs-theme="dark"] .website-card-title {
    color: var(--app-text);
}

[data-bs-theme="dark"] #embedCodeModal .modal-content,
[data-bs-theme="dark"] #embedCodeModal .modal-header,
[data-bs-theme="dark"] #embedCodeModal .modal-body {
    background-color: var(--app-surface) !important;
    color: var(--app-text);
}

[data-bs-theme="dark"] #embedCodeModal .embed-code-tab {
    background: var(--app-surface-2) !important;
    border-color: var(--app-border) !important;
    color: var(--app-text) !important;
}

[data-bs-theme="dark"] #embedCodeModal .embed-code-wrapper {
    background: var(--app-code-bg) !important;
    border-color: var(--app-border) !important;
}

[data-bs-theme="dark"] #embedCodeModal .embed-code-field,
[data-bs-theme="dark"] #embedCodeModal textarea.embed-code-field {
    background: transparent !important;
    color: var(--app-text) !important;
}

[data-bs-theme="dark"] #embedCodeModal .embed-title,
[data-bs-theme="dark"] #embedCodeModal .embed-subtitle {
    color: var(--app-text-muted);
}

[data-bs-theme="dark"] #embedCodeModal .embed-title span {
    color: var(--app-text);
}

[data-bs-theme="dark"] .tm-faq-table textarea.form-control,
[data-bs-theme="dark"] .tm-faq-table .faq-q,
[data-bs-theme="dark"] .tm-faq-table .faq-a {
    background: var(--app-input-bg) !important;
    border-color: var(--app-input-border) !important;
    color: var(--app-text) !important;
}

[data-bs-theme="dark"] .tm-faq-table-toolbar {
    background: var(--app-surface-2) !important;
    border-color: var(--app-border) !important;
}

/* -------------------------------------------------------------------------- */
/* Training materials / scraping                                              */
/* -------------------------------------------------------------------------- */

[data-bs-theme="dark"] .training-wrapper,
[data-bs-theme="dark"] .training-section,
[data-bs-theme="dark"] .training-tab,
[data-bs-theme="dark"] .training-preview-card,
[data-bs-theme="dark"] .file-drop-area {
    background: var(--app-surface) !important;
    border-color: var(--app-border) !important;
    color: var(--app-text);
}

[data-bs-theme="dark"] .training-tab {
    background: var(--app-surface-2) !important;
}

[data-bs-theme="dark"] .training-tab.active {
    background: rgba(var(--bs-primary-rgb), 0.15) !important;
    border-color: var(--bs-primary) !important;
}

[data-bs-theme="dark"] .file-drop-area:hover,
[data-bs-theme="dark"] .file-drop-area.dragover {
    background: var(--app-surface-hover) !important;
    border-color: var(--bs-primary) !important;
}

[data-bs-theme="dark"] .upload-progress-track {
    background: var(--app-surface-2) !important;
}

[data-bs-theme="dark"] .tm-card {
    background: var(--app-surface) !important;
    box-shadow: var(--app-shadow) !important;
}

[data-bs-theme="dark"] .tm-module-tabs {
    border-bottom-color: var(--app-border) !important;
}

[data-bs-theme="dark"] .tm-module-tabs .tm-tab-btn {
    color: var(--app-text-muted);
}

[data-bs-theme="dark"] .tm-module-tabs .tm-tab-btn.active,
[data-bs-theme="dark"] .tm-module-tabs .tm-tab-btn:hover {
    color: #99aaff !important;
    background: rgba(var(--bs-primary-rgb), 0.12);
    border-bottom-color: #99aaff !important;
}

[data-bs-theme="dark"] .tm-ingest-step-card,
[data-bs-theme="dark"] .tm-ingest-choice-card,
[data-bs-theme="dark"] .tm-ingested-urls-card,
[data-bs-theme="dark"] .tm-faq-add-card,
[data-bs-theme="dark"] .tm-faq-table-card {
    background: var(--app-surface) !important;
    border-color: var(--app-border) !important;
    box-shadow: var(--app-shadow) !important;
}

[data-bs-theme="dark"] .tm-ingest-heading,
[data-bs-theme="dark"] .tm-ingest-choice-title,
[data-bs-theme="dark"] .tm-batch-title {
    color: var(--app-text) !important;
}

[data-bs-theme="dark"] .tm-ingest-url-highlight {
    background: var(--app-highlight-bg);
    color: var(--app-highlight-text);
}

[data-bs-theme="dark"] .tm-ingest-choice-card:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25) !important;
}

[data-bs-theme="dark"] .tm-ingest-select-table thead th,
[data-bs-theme="dark"] .tm-ingested-urls-thead th,
[data-bs-theme="dark"] .tm-faq-thead th {
    background: var(--app-surface-2) !important;
    border-color: var(--app-border) !important;
    color: var(--app-text-muted) !important;
}

[data-bs-theme="dark"] .tm-faq-table tbody tr,
[data-bs-theme="dark"] .tm-ingest-select-table tbody tr,
[data-bs-theme="dark"] .tm-ingested-urls-table tbody tr {
    background: var(--app-surface) !important;
}

[data-bs-theme="dark"] .tm-faq-table tbody tr:hover,
[data-bs-theme="dark"] .tm-ingest-select-table tbody tr:hover,
[data-bs-theme="dark"] .tm-ingested-urls-table tbody tr:hover {
    background: var(--app-surface-hover) !important;
}

[data-bs-theme="dark"] .tm-url-ingest-input,
[data-bs-theme="dark"] .tm-ingest-search-input,
[data-bs-theme="dark"] .tm-ingested-list-search-input {
    background-color: var(--app-input-bg);
    border-color: var(--app-input-border);
    color: var(--app-text);
}

[data-bs-theme="dark"] .tm-ingest-error-box,
[data-bs-theme="dark"] .tm-ingest-error-alert {
    background: var(--app-surface-2);
    border-color: var(--app-border);
    color: var(--app-text);
}

[data-bs-theme="dark"] .tm-ingest-training-banner,
[data-bs-theme="dark"] .tm-ingested-list-toolbar,
[data-bs-theme="dark"] .tm-ingested-urls-card .border-bottom {
    background: var(--app-surface) !important;
    border-color: var(--app-border) !important;
}

[data-bs-theme="dark"] .tm-batch-url-item {
    color: var(--app-text-secondary);
    border-color: var(--app-border-soft);
}

[data-bs-theme="dark"] .tm-batch-url-item.is-done {
    color: var(--app-text-muted);
}

[data-bs-theme="dark"] .tm-ingest-error-alert {
    background: rgba(239, 68, 68, 0.12) !important;
    border-color: rgba(239, 68, 68, 0.35) !important;
    color: #fca5a5 !important;
}

[data-bs-theme="dark"] .tm-ingest-training-banner {
    background: rgba(16, 185, 129, 0.12) !important;
    border-color: rgba(16, 185, 129, 0.35) !important;
}

[data-bs-theme="dark"] .tm-ingested-section-label,
[data-bs-theme="dark"] .tm-ingested-page-title {
    color: var(--app-text) !important;
}

[data-bs-theme="dark"] .tm-ingested-page-url {
    color: var(--app-text-muted) !important;
}

[data-bs-theme="dark"] .tm-ingested-refresh-btn {
    color: var(--app-text-muted);
}

[data-bs-theme="dark"] .tm-ingested-refresh-btn:hover,
[data-bs-theme="dark"] .tm-ingested-refresh-btn:focus {
    color: #99aaff !important;
}

[data-bs-theme="dark"] .tm-ingested-page-url:hover {
    color: #99aaff !important;
}

[data-bs-theme="dark"] .tm-usage-badge {
    background: var(--app-surface-2) !important;
    border-color: var(--app-border) !important;
    color: var(--app-text-muted) !important;
}

[data-bs-theme="dark"] .tm-usage-badge.tm-usage-has-selection {
    background: rgba(16, 185, 129, 0.15) !important;
    border-color: rgba(16, 185, 129, 0.35) !important;
    color: #6ee7b7 !important;
}

[data-bs-theme="dark"] .tm-ingested-urls-table td {
    border-color: var(--app-border) !important;
    color: var(--app-text-secondary);
}

[data-bs-theme="dark"] .tm-ingested-material-cell {
    border-color: var(--app-border) !important;
}

/* -------------------------------------------------------------------------- */
/* Leads, chat history, appearance                                            */
/* -------------------------------------------------------------------------- */

[data-bs-theme="dark"] .lead-card {
    background: var(--app-surface);
    border-color: var(--app-border);
    box-shadow: var(--app-shadow);
}

[data-bs-theme="dark"] .lead-name {
    color: var(--app-text);
}

[data-bs-theme="dark"] .lead-meta {
    color: var(--app-text-muted);
}

[data-bs-theme="dark"] .lead-avatar {
    background: rgba(var(--bs-primary-rgb), 0.15);
    color: #99aaff !important;
}

[data-bs-theme="dark"] .badge-manual {
    background: rgba(var(--bs-primary-rgb), 0.15);
    color: #93c5fd !important;
}

[data-bs-theme="dark"] .preview-img {
    background-color: var(--app-surface-2);
    border-color: var(--app-border);
}

[data-bs-theme="dark"] .preview-name {
    color: var(--app-text-muted);
}

/* -------------------------------------------------------------------------- */
/* Setup widget (onboarding assistant)                                        */
/* -------------------------------------------------------------------------- */

[data-bs-theme="dark"] .setup-widget {
    background: var(--app-surface) !important;
    border-color: var(--app-border) !important;
    box-shadow: var(--app-shadow-lg) !important;
}

[data-bs-theme="dark"] .setup-widget h6 {
    color: var(--app-text) !important;
}

[data-bs-theme="dark"] .setup-task {
    color: var(--app-text) !important;
}

[data-bs-theme="dark"] .setup-task:hover:not(.completed) {
    background-color: var(--app-surface-hover) !important;
    border-color: var(--app-border) !important;
}

[data-bs-theme="dark"] .setup-widget .progress {
    background-color: var(--app-surface-2) !important;
}

/* -------------------------------------------------------------------------- */
/* Auth pages                                                                 */
/* -------------------------------------------------------------------------- */

[data-bs-theme="dark"] #auth .auth-logo h1,
[data-bs-theme="dark"] #auth .auth-title,
[data-bs-theme="dark"] #auth label,
[data-bs-theme="dark"] #auth .card {
    color: var(--app-text);
}

[data-bs-theme="dark"] #auth .card {
    background-color: var(--app-surface);
    border-color: var(--app-border);
}

/* -------------------------------------------------------------------------- */
/* SweetAlert2 (training materials, etc.)                                     */
/* -------------------------------------------------------------------------- */

[data-bs-theme="dark"] .swal2-popup {
    background: var(--app-surface) !important;
    color: var(--app-text) !important;
    border: 1px solid var(--app-border);
}

[data-bs-theme="dark"] .swal2-title,
[data-bs-theme="dark"] .swal2-html-container {
    color: var(--app-text) !important;
}

[data-bs-theme="dark"] .swal2-input,
[data-bs-theme="dark"] .swal2-textarea,
[data-bs-theme="dark"] .swal2-select {
    background: var(--app-input-bg) !important;
    border-color: var(--app-input-border) !important;
    color: var(--app-text) !important;
}

/* -------------------------------------------------------------------------- */
/* Inline style overrides (pages using style="background:#fff")             */
/* -------------------------------------------------------------------------- */

[data-bs-theme="dark"] [style*="background: #fff"],
[data-bs-theme="dark"] [style*="background:#fff"],
[data-bs-theme="dark"] [style*="background: white"],
[data-bs-theme="dark"] [style*="background-color: #fff"],
[data-bs-theme="dark"] [style*="background-color:#fff"] {
    background-color: var(--app-surface) !important;
}

[data-bs-theme="dark"] [style*="color: #1e293b"],
[data-bs-theme="dark"] [style*="color:#1e293b"],
[data-bs-theme="dark"] [style*="color: #111827"] {
    color: var(--app-text) !important;
}

[data-bs-theme="dark"] [style*="border-color: #e2e8f0"],
[data-bs-theme="dark"] [style*="border: 1px solid #e2e8f0"],
[data-bs-theme="dark"] [style*="border:1px solid #e2e8f0"] {
    border-color: var(--app-border) !important;
}

/* -------------------------------------------------------------------------- */
/* Admin panel — global polish (all pages)                                    */
/* -------------------------------------------------------------------------- */

.page-heading {
    padding-bottom: 0.5rem;
}

.page-title h3 {
    font-weight: 700;
    letter-spacing: -0.02em;
}

.breadcrumb-item a {
    color: #99aaff !important;
    text-decoration: none;
}

.breadcrumb-item a:hover {
    text-decoration: underline;
}

[data-bs-theme="dark"] .breadcrumb-item.active,
[data-bs-theme="dark"] .breadcrumb-item + .breadcrumb-item::before {
    color: var(--app-text-muted);
}

[data-bs-theme="dark"] .card .card-title,
[data-bs-theme="dark"] .card h4,
[data-bs-theme="dark"] .card h5 {
    color: var(--app-text);
}

[data-bs-theme="dark"] .shadow-sm,
[data-bs-theme="dark"] .shadow {
    box-shadow: var(--app-shadow) !important;
}

[data-bs-theme="dark"] .border-end,
[data-bs-theme="dark"] .border-bottom,
[data-bs-theme="dark"] .border-top {
    border-color: var(--app-border) !important;
}

[data-bs-theme="dark"] .session-item.bg-light,
[data-bs-theme="dark"] .bg-light {
    background-color: var(--app-surface-hover) !important;
    color: var(--app-text) !important;
}

[data-bs-theme="dark"] input[type="search"],
[data-bs-theme="dark"] input[type="text"],
[data-bs-theme="dark"] input[type="email"],
[data-bs-theme="dark"] input[type="password"],
[data-bs-theme="dark"] input[type="number"],
[data-bs-theme="dark"] input[type="url"],
[data-bs-theme="dark"] input[type="file"],
[data-bs-theme="dark"] textarea,
[data-bs-theme="dark"] select {
    background-color: var(--app-input-bg);
    border-color: var(--app-input-border);
    color: var(--app-text);
}

[data-bs-theme="dark"] .form-control-color {
    background-color: var(--app-input-bg);
}

[data-bs-theme="dark"] .offcanvas,
[data-bs-theme="dark"] .popover {
    background-color: var(--app-surface);
    border-color: var(--app-border);
    color: var(--app-text);
}

[data-bs-theme="dark"] .popover-header {
    background-color: var(--app-surface-2);
    border-color: var(--app-border);
    color: var(--app-text);
}

[data-bs-theme="dark"] .popover-body {
    color: var(--app-text-secondary);
}

[data-bs-theme="dark"] hr {
    border-color: var(--app-border);
    opacity: 1;
}

[data-bs-theme="dark"] pre,
[data-bs-theme="dark"] code {
    background-color: var(--app-code-bg);
    color: var(--app-text);
}

[data-bs-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-accent-bg: var(--app-surface-2);
}

[data-bs-theme="dark"] .dataTable-wrapper,
[data-bs-theme="dark"] .dataTables_wrapper {
    color: var(--app-text);
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_filter input,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_length select {
    background-color: var(--app-input-bg);
    border-color: var(--app-input-border);
    color: var(--app-text);
}

[data-bs-theme="dark"] .embed-title-icon {
    background: rgb(0 167 154 / 25%) !important;
}

[data-bs-theme="dark"] .embed-title-icon i {
    color: #00decd !important;
}