html[data-theme="dark"] {
    color-scheme: dark;
    --body-bg: #10131b;
    --navbar-bg: #171c2a;
    --color-dark: #e8ebf6;
    --color-dark-hover: #ffffff;
    --p-ink: #e8ebf6;
    --p-muted: #b4bdd0;
    --p-line: rgba(255, 255, 255, 0.12);
    --portal-surface: #1b2130;
    --portal-sunken: #141824;
    --p-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --p-shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
    --p-shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.45);
    --bs-body-color: #e8ebf6;
    --bs-body-bg: #10131b;
    --bs-emphasis-color: #f5f7fc;
    --bs-secondary-color: #b4bdd0;
    --bs-tertiary-color: #9aa3b8;
    --bs-border-color: rgba(255, 255, 255, 0.14);
    --bs-secondary-bg: #1b2130;
    --bs-tertiary-bg: #141824;
}

html[data-theme="dark"] body {
    background: var(--body-bg);
    color: var(--p-ink);
}

html[data-theme="dark"] body:has(.auth-shell) {
    background: linear-gradient(160deg, #0c3332 0%, #10131b 58%, #3d2418 150%);
}

html[data-theme="dark"] .navbar {
    background: rgba(23, 28, 42, 0.94);
    color: var(--p-ink);
    border-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .custom-card,
html[data-theme="dark"] .custom-card .card-header,
html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .list-group-item,
html[data-theme="dark"] .offcanvas,
html[data-theme="dark"] .auth-card {
    background: var(--portal-surface);
    color: var(--p-ink);
    border-color: var(--p-line);
}

html[data-theme="dark"] .custom-card .card-header .card-title h3,
html[data-theme="dark"] .custom-card .card-header .card-title p,
html[data-theme="dark"] .nav-user-name,
html[data-theme="dark"] .nav-user-desc,
html[data-theme="dark"] .dropdown-item {
    color: var(--p-ink);
}

html[data-theme="dark"] .btn-outline-dark {
    --bs-btn-color: #e8ebf6;
    --bs-btn-bg: rgba(255, 255, 255, 0.06);
    --bs-btn-border-color: rgba(255, 255, 255, 0.55);
    --bs-btn-hover-bg: rgba(255, 255, 255, 0.08);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-border-color: rgba(255, 255, 255, 0.55);
    --bs-btn-active-bg: rgba(255, 255, 255, 0.14);
    --bs-btn-active-color: #fff;
    --bs-btn-disabled-color: rgba(232, 235, 246, 0.45);
    --bs-btn-disabled-border-color: rgba(255, 255, 255, 0.16);
}

.theme-toggle {
    width: 36px;
    height: 36px;
    margin-right: 0.35rem;
    border: 0;
    border-radius: 10px;
    background: #ecebeb;
    color: #212529;
}

.theme-toggle:hover {
    background: #e2e2e2;
}

html[data-theme="dark"] .theme-toggle {
    background: #2a3148;
    color: #e8ebf6;
}

html[data-theme="dark"] .theme-toggle:hover {
    background: #353d58;
}

.mobile-theme-toggle,
.mobile-theme-toggle:hover {
    width: 100%;
    height: auto;
    margin: 0;
    padding: 0.35rem 0.25rem;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: transparent;
    color: var(--color-lopes-white);
    font-size: inherit;
}

.mobile-theme-toggle i {
    font-size: 1.25rem;
}

.mobile-theme-toggle span {
    font-size: 0.68rem;
    font-weight: 600;
}

html[data-theme="dark"] .mobile-theme-toggle,
html[data-theme="dark"] .mobile-theme-toggle:hover {
    background: transparent;
    color: var(--color-lopes-white);
}

html[data-theme="dark"] .nav-user-profile a.dropdown-item div.icon {
    background: #262d42;
}

html[data-theme="dark"] .navbar-search,
html[data-theme="dark"] .btn.navbar-search:hover,
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus,
html[data-theme="dark"] .order-multi > summary {
    background-color: #242b3d;
    color: var(--p-ink);
    border-color: rgba(255, 255, 255, 0.16);
}

html[data-theme="dark"] .form-control::placeholder {
    color: #8b95ab;
}

html[data-theme="dark"] .custom-card .card-header,
html[data-theme="dark"] .portal-kpi,
html[data-theme="dark"] .order-empty,
html[data-theme="dark"] .portal-kpi .portal-kpi-icon {
    background: var(--portal-surface);
    color: var(--p-ink);
    border-color: var(--p-line);
}

html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .dropdown-item:focus {
    background: #262d42;
    color: #fff;
}

html[data-theme="dark"] .table {
    --bs-table-bg: transparent;
    --bs-table-color: #e8ebf6;
    --bs-table-border-color: rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] .copilot-answer,
html[data-theme="dark"] .navbar .sidebar-toggler {
    background: #242b3d;
    color: #e8ebf6;
}

html[data-theme="dark"] .auth-card .form-control {
    background: #121722;
    color: #e8ebf6;
}

html[data-theme="dark"] :is(.btn-outline-lopes, .btn-outline-lopes-blue) {
    --bs-btn-color: #7fd4cf;
    --bs-btn-border-color: #7fd4cf;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-color: #fff;
    --bs-btn-disabled-color: rgba(127, 212, 207, 0.45);
    --bs-btn-disabled-border-color: rgba(127, 212, 207, 0.35);
}
