:root {
    color-scheme: light dark;
    --sidebar-width: 250px;
    --page-bg: #eaf1ff;
    --surface-bg: #f8fbff;
    --surface-muted: #edf4ff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border-color: #c8d8f0;
    --sidebar-bg: #e4eeff;
    --sidebar-text: #0f172a;
    --sidebar-text-muted: #1e3a5f;
    --sidebar-hover-bg: #d6e6ff;
    --sidebar-hover-text: #0f172a;
    --sidebar-active: #0b5ed7;
    --link-color: #0b5ed7;
    --link-hover: #0846a9;
    --table-header-accent: var(--border-color);
    --shadow-sm: 0 0.15rem 1.75rem rgba(58, 59, 69, 0.15);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.1);
    --card-shadow-customer: 0 12px 30px rgba(15, 23, 42, 0.08);
    --card-shadow-customer-hover: 0 18px 38px rgba(15, 23, 42, 0.12);
    --surface-gloss: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.28));
    --surface-depth-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88), inset 0 -1px 0 rgba(148, 163, 184, 0.16);
    --panel-3d-shadow: 0 18px 34px rgba(15, 23, 42, 0.11), 0 5px 12px rgba(15, 23, 42, 0.08);
    --panel-3d-shadow-hover: 0 24px 42px rgba(15, 23, 42, 0.16), 0 10px 20px rgba(15, 23, 42, 0.12);
    --sidebar-gloss: linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.08));
    --sidebar-depth-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.4), inset -1px 0 0 rgba(148, 163, 184, 0.2);
    --topbar-gloss: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.2));
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-card: 1rem;
}

@media (prefers-color-scheme: dark) {
    :root {
        --page-bg: #0f141a;
        --surface-bg: #161d26;
        --surface-muted: #1d2631;
        --text-main: #e5e7eb;
        --text-muted: #9ca3af;
        --border-color: #2f3b4a;
        --sidebar-bg: #111820;
        --sidebar-text: #e5e7eb;
        --sidebar-text-muted: #c7ced8;
        --sidebar-hover-bg: #273445;
        --sidebar-hover-text: #ffffff;
        --sidebar-active: #ffd54d;
        --link-color: #7cb8ff;
        --link-hover: #a6ceff;
        --table-header-accent: #ffd54d;
        --shadow-sm: 0 0.2rem 1.5rem rgba(0, 0, 0, 0.45);
        --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.45);
        --card-shadow-customer: 0 0.9rem 2rem rgba(2, 6, 23, 0.28);
        --card-shadow-customer-hover: 0 1.2rem 2.6rem rgba(2, 6, 23, 0.36);
        --surface-gloss: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.01));
        --surface-depth-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), inset 0 -1px 0 rgba(2, 6, 23, 0.6);
        --panel-3d-shadow: 0 20px 38px rgba(2, 6, 23, 0.34), 0 8px 18px rgba(2, 6, 23, 0.24);
        --panel-3d-shadow-hover: 0 26px 46px rgba(2, 6, 23, 0.4), 0 12px 22px rgba(2, 6, 23, 0.28);
        --sidebar-gloss: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.01));
        --sidebar-depth-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.05), inset -1px 0 0 rgba(2, 6, 23, 0.6);
        --topbar-gloss: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.015));
    }
}

:root[data-theme="light"],
:root[data-bs-theme="light"] {
    --page-bg: #eaf1ff;
    --surface-bg: #f8fbff;
    --surface-muted: #edf4ff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border-color: #c8d8f0;
    --sidebar-bg: #e4eeff;
    --sidebar-text: #0f172a;
    --sidebar-text-muted: #1e3a5f;
    --sidebar-hover-bg: #d6e6ff;
    --sidebar-hover-text: #0f172a;
    --sidebar-active: #0b5ed7;
    --link-color: #0b5ed7;
    --link-hover: #0846a9;
    --table-header-accent: var(--border-color);
}

:root[data-theme="dark"],
:root[data-bs-theme="dark"] {
    --page-bg: #0f141a;
    --surface-bg: #161d26;
    --surface-muted: #1d2631;
    --text-main: #e5e7eb;
    --text-muted: #9ca3af;
    --border-color: #2f3b4a;
    --sidebar-bg: #111820;
    --sidebar-text: #e5e7eb;
    --sidebar-text-muted: #c7ced8;
    --sidebar-hover-bg: #273445;
    --sidebar-hover-text: #ffffff;
    --sidebar-active: #ffd54d;
    --link-color: #7cb8ff;
    --link-hover: #a6ceff;
    --table-header-accent: #ffd54d;
}

html,
body {
    height: 100%;
    min-height: 100%;
    margin: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    background: var(--page-bg);
    color: var(--text-main);
}

body,
body.app-shell,
body.app-login,
body.bg-light {
    background: var(--page-bg) !important;
    color: var(--text-main);
}

a {
    color: var(--link-color);
}

a:hover {
    color: var(--link-hover);
}

.form-text,
.text-muted,
small.text-muted,
.text-secondary,
.text-gray-300,
.text-gray-400,
.text-gray-600,
.text-gray-800 {
    color: var(--text-muted) !important;
}

.wrapper {
    display: flex;
    width: 100%;
    max-width: 100vw;
    min-height: 100vh;
    overflow-x: hidden;
}

.container-fluid {
    width: 100% !important;
    max-width: 100% !important;
}

.sidebar,
#mainSidebarDesktop {
    width: var(--sidebar-width);
    min-height: 100vh;
    position: fixed;
    z-index: 1050;
    background:
        var(--sidebar-gloss),
        linear-gradient(180deg, color-mix(in srgb, var(--sidebar-bg) 92%, white 8%), color-mix(in srgb, var(--sidebar-bg) 98%, black 2%)) !important;
    color: var(--sidebar-text) !important;
    border-right: none;
    box-shadow: var(--sidebar-depth-shadow), var(--panel-3d-shadow);
    transition: all 0.3s ease-in-out;
}

#mainSidebarMobile {
    background:
        var(--sidebar-gloss),
        linear-gradient(180deg, color-mix(in srgb, var(--sidebar-bg) 92%, white 8%), color-mix(in srgb, var(--sidebar-bg) 98%, black 2%)) !important;
    color: var(--sidebar-text) !important;
}

.sidebar-brand {
    padding: 1rem;
    text-align: center;
    border-bottom: none;
}

.app-header-logo {
    width: min(220px, 32vw);
    max-width: 100%;
    height: 60px;
    object-fit: contain;
    object-position: left center;
    flex: 0 1 auto;
    overflow: hidden;
}

.sidebar-logo-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 72px;
    overflow: hidden;
}

.app-sidebar-logo {
    width: 100%;
    max-width: 180px;
    height: 60px;
    object-fit: contain;
    object-position: center;
    overflow: hidden;
}

.sidebar-brand h2,
.offcanvas-title {
    color: var(--sidebar-text) !important;
}

.sidebar .nav-link,
.sidebar-link,
.app-sidebar-shell .nav-link {
    color: var(--sidebar-text-muted) !important;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease-in-out;
}

.sidebar .nav-link:hover,
.sidebar-link:hover,
.app-sidebar-shell .nav-link:hover {
    background-color: var(--sidebar-hover-bg);
    color: var(--sidebar-hover-text) !important;
}

.sidebar .nav-link.active,
.sidebar .nav-link.active-parent,
.sidebar-link.active,
.sidebar-link.active-parent,
.app-sidebar-shell .nav-link.active,
.app-sidebar-shell .nav-link.active-parent {
    color: var(--sidebar-active) !important;
    font-weight: 600;
    background: transparent;
}

.sidebar .nav-link i,
.sidebar-link i,
.app-sidebar-shell .nav-link i {
    margin-right: 0.5rem;
}

.offcanvas.app-sidebar-shell {
    --bs-offcanvas-width: 280px;
}

.theme-close-btn {
    filter: none;
}

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

.main {
    display: flex;
    flex-direction: column;
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    max-width: calc(100vw - var(--sidebar-width));
    min-height: 100vh;
    box-sizing: border-box;
    padding: 20px;
    background: var(--page-bg);
    overflow-x: hidden;
}

.app-content {
    flex: 1 1 auto;
}

.topbar,
.navbar.topbar,
.theme-topbar {
    background:
        var(--topbar-gloss),
        linear-gradient(180deg, color-mix(in srgb, var(--surface-bg) 92%, white 8%), color-mix(in srgb, var(--surface-bg) 98%, black 2%)) !important;
    color: var(--text-main) !important;
    border: none;
    border-radius: var(--radius-md);
    box-shadow: var(--surface-depth-shadow), var(--panel-3d-shadow) !important;
    overflow: visible;
}

.topbar h4,
.topbar .nav-link,
.topbar .dropdown-toggle,
.topbar .small,
.theme-topbar h4,
.theme-topbar .nav-link,
.theme-topbar .dropdown-toggle,
.theme-topbar .small,
.theme-topbar .btn-link {
    color: var(--text-main) !important;
}

.theme-dropdown,
.dropdown-menu {
    background: var(--surface-bg);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    z-index: 3000;
    box-sizing: border-box;
}

.dropdown-item,
.theme-dropdown .dropdown-item,
.theme-dropdown .theme-menu-label {
    color: var(--text-main);
}

.dropdown-item:hover,
.dropdown-item:focus,
.theme-dropdown .dropdown-item:hover,
.theme-dropdown .dropdown-item:focus {
    background: var(--surface-muted);
    color: var(--text-main);
}

.dropdown-divider {
    border-top-color: var(--border-color);
}

.theme-toggle-option {
    border-color: var(--border-color);
    color: var(--text-main);
    background: var(--surface-bg);
}

.theme-toggle-option:hover,
.theme-toggle-option:focus {
    background: var(--surface-muted);
    border-color: var(--link-color);
    color: var(--text-main);
}

.theme-toggle-option.active {
    background: var(--link-color);
    border-color: var(--link-color);
    color: #fff;
}

.theme-menu-stack {
    display: grid;
    gap: 0.55rem;
}

.theme-toggle-switch {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 0.55rem 0.8rem;
    background: var(--surface-bg);
    color: var(--text-main);
    transition: all 0.2s ease;
    text-align: left;
}

.theme-toggle-switch:hover,
.theme-toggle-switch:focus {
    background: var(--surface-muted);
    border-color: var(--link-color);
}

.theme-switch-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.2rem;
    font-size: 1rem;
    line-height: 1;
}

.theme-switch-track {
    position: relative;
    width: 58px;
    height: 24px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.24), rgba(37, 99, 235, 0.28));
    border: 1px solid color-mix(in srgb, var(--border-color) 82%, transparent);
    overflow: hidden;
    flex: 0 0 auto;
}

.theme-switch-track::before {
    content: "";
    position: absolute;
    inset: 50% 8px auto 8px;
    height: 2px;
    transform: translateY(-50%);
    background: color-mix(in srgb, var(--text-muted) 40%, transparent);
}

.theme-switch-knob {
    position: absolute;
    top: 2px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(180deg, #ffd166, #f59e0b);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
    transition: transform 0.22s ease, background 0.22s ease;
}

.theme-toggle-switch.is-dark .theme-switch-knob {
    transform: translateX(33px);
    background: linear-gradient(180deg, #7dd3fc, #2563eb);
}

.theme-switch-label {
    font-weight: 600;
}

.theme-toggle-row {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 0.55rem 0.8rem;
    background: var(--surface-bg);
    color: var(--text-main);
    transition: all 0.2s ease;
    text-align: left;
}

.theme-toggle-row:hover,
.theme-toggle-row:focus {
    background: var(--surface-muted);
    border-color: var(--link-color);
}

.theme-toggle-row.active {
    background: color-mix(in srgb, var(--link-color) 14%, var(--surface-bg) 86%);
    color: var(--text-main);
    border-color: color-mix(in srgb, var(--link-color) 54%, var(--border-color) 46%);
}

.theme-row-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.2rem;
    font-size: 1rem;
    line-height: 1;
}

.theme-row-sunrise {
    color: #f59e0b;
}

.theme-row-sunset {
    color: #2563eb;
}

.swal2-popup,
.swal2-popup.theme-swal-popup {
    background: var(--surface-bg) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: calc(var(--radius-lg) + 2px) !important;
    box-shadow: var(--shadow-lg) !important;
}

.swal2-title,
.swal2-title.theme-swal-title,
.swal2-html-container,
.swal2-html-container.theme-swal-html {
    color: var(--text-main) !important;
}

.swal2-html-container,
.swal2-html-container.theme-swal-html {
    color: var(--text-muted) !important;
}

.theme-confirm-body {
    text-align: left;
}

.theme-confirm-message {
    color: var(--text-main);
    font-size: 0.98rem;
    line-height: 1.5;
    margin-bottom: 0.9rem;
}

.theme-confirm-details {
    display: grid;
    gap: 0.7rem;
}

.theme-confirm-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.9rem;
    padding: 0.85rem 1rem;
    border-radius: 0.95rem;
    border: 1px solid var(--border-color);
    background: color-mix(in srgb, var(--surface-muted) 82%, white 18%);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.theme-confirm-label {
    flex: 0 0 auto;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.9;
}

.theme-confirm-value {
    flex: 1 1 auto;
    text-align: right;
    color: var(--text-main);
    font-weight: 600;
    word-break: break-word;
}

.theme-confirm-id {
    background: color-mix(in srgb, #dbeafe 78%, var(--surface-bg) 22%);
    border-color: color-mix(in srgb, #60a5fa 52%, var(--border-color) 48%);
}

.theme-confirm-id .theme-confirm-label {
    color: #1d4ed8;
}

.theme-confirm-name {
    background: color-mix(in srgb, #dcfce7 78%, var(--surface-bg) 22%);
    border-color: color-mix(in srgb, #34d399 54%, var(--border-color) 46%);
}

.theme-confirm-name .theme-confirm-label {
    color: #047857;
}

.theme-confirm-type {
    background: color-mix(in srgb, #fef3c7 78%, var(--surface-bg) 22%);
    border-color: color-mix(in srgb, #f59e0b 52%, var(--border-color) 48%);
}

.theme-confirm-type .theme-confirm-label {
    color: #b45309;
}

:root[data-theme="dark"] .theme-confirm-item,
:root[data-bs-theme="dark"] .theme-confirm-item {
    background: color-mix(in srgb, var(--surface-muted) 88%, #0b1220 12%);
    box-shadow: 0 14px 30px rgba(2, 6, 23, 0.28);
}

:root[data-theme="dark"] .theme-confirm-id,
:root[data-bs-theme="dark"] .theme-confirm-id {
    background: color-mix(in srgb, #0f2f5f 62%, var(--surface-muted) 38%);
    border-color: color-mix(in srgb, #60a5fa 50%, var(--border-color) 50%);
}

:root[data-theme="dark"] .theme-confirm-id .theme-confirm-label,
:root[data-bs-theme="dark"] .theme-confirm-id .theme-confirm-label {
    color: #93c5fd;
}

:root[data-theme="dark"] .theme-confirm-name,
:root[data-bs-theme="dark"] .theme-confirm-name {
    background: color-mix(in srgb, #103a2a 62%, var(--surface-muted) 38%);
    border-color: color-mix(in srgb, #34d399 48%, var(--border-color) 52%);
}

:root[data-theme="dark"] .theme-confirm-name .theme-confirm-label,
:root[data-bs-theme="dark"] .theme-confirm-name .theme-confirm-label {
    color: #6ee7b7;
}

:root[data-theme="dark"] .theme-confirm-type,
:root[data-bs-theme="dark"] .theme-confirm-type {
    background: color-mix(in srgb, #4a2a08 60%, var(--surface-muted) 40%);
    border-color: color-mix(in srgb, #fbbf24 48%, var(--border-color) 52%);
}

:root[data-theme="dark"] .theme-confirm-type .theme-confirm-label,
:root[data-bs-theme="dark"] .theme-confirm-type .theme-confirm-label {
    color: #fcd34d;
}

.swal2-actions .swal2-styled.swal2-confirm,
.swal2-actions .swal2-styled.swal2-confirm.theme-swal-confirm {
    background: linear-gradient(135deg, #0b5ed7, #2563eb) !important;
    color: #fff !important;
    border-radius: 999px !important;
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.28) !important;
}

.swal2-actions .swal2-styled.swal2-cancel,
.swal2-actions .swal2-styled.swal2-cancel.theme-swal-cancel {
    background: color-mix(in srgb, var(--surface-muted) 92%, transparent) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 999px !important;
    box-shadow: none !important;
}

.swal2-actions .swal2-styled.swal2-deny,
.swal2-actions .swal2-styled.swal2-deny.theme-swal-deny {
    background: linear-gradient(135deg, #dc3545, #ef4444) !important;
    color: #fff !important;
    border-radius: 999px !important;
    box-shadow: 0 10px 22px rgba(220, 53, 69, 0.28) !important;
}

.swal2-timer-progress-bar {
    background: color-mix(in srgb, var(--link-color) 80%, transparent) !important;
}

.swal2-icon.swal2-warning {
    border-color: color-mix(in srgb, #f59e0b 74%, transparent) !important;
    color: #f59e0b !important;
}

.swal2-icon.swal2-success [class^='swal2-success-line'],
.swal2-icon.swal2-success .swal2-success-ring {
    border-color: color-mix(in srgb, #10b981 78%, transparent) !important;
    color: #10b981 !important;
}

.swal2-icon.swal2-error {
    border-color: color-mix(in srgb, #ef4444 76%, transparent) !important;
    color: #ef4444 !important;
}

body.swal2-shown > [aria-hidden='true'] {
    transition: filter 0.2s ease;
}

.theme-row-auto-icon {
    color: var(--link-color);
}

.theme-row-track {
    position: relative;
    width: 56px;
    height: 22px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.24), rgba(251, 191, 36, 0.16));
    border: 1px solid color-mix(in srgb, var(--border-color) 82%, transparent);
    overflow: hidden;
    flex: 0 0 auto;
}

.theme-row-track::before {
    content: "";
    position: absolute;
    inset: 50% 8px auto 8px;
    height: 2px;
    transform: translateY(-50%);
    background: color-mix(in srgb, var(--text-muted) 40%, transparent);
}

.theme-row-track-dark {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.20), rgba(14, 165, 233, 0.28));
}

.theme-row-knob {
    position: absolute;
    top: 2px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(180deg, #ffd166, #f59e0b);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
}

.theme-row-knob-dark {
    left: auto;
    right: 3px;
    background: linear-gradient(180deg, #7dd3fc, #2563eb);
}

.theme-row-label {
    font-weight: 600;
}

.theme-row-auto-note {
    margin-left: auto;
    font-size: 0.76rem;
    color: var(--text-muted);
}

.card,
.auth-card,
.modal-content,
.offcanvas-header,
.offcanvas-body,
.list-group-item,
.accordion-item,
.main-footer {
    background: var(--surface-bg);
    color: var(--text-main);
    border: none;
}

.card,
.auth-card {
    border-radius: var(--radius-card);
    background:
        var(--surface-gloss),
        linear-gradient(180deg, color-mix(in srgb, var(--surface-bg) 94%, white 6%), color-mix(in srgb, var(--surface-bg) 98%, black 2%));
    box-shadow: var(--surface-depth-shadow), var(--panel-3d-shadow);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--surface-depth-shadow), var(--panel-3d-shadow-hover);
}

.card-header,
.card-footer,
.modal-header,
.modal-footer,
.accordion-button,
.accordion-button:not(.collapsed) {
    background: var(--surface-muted);
    color: var(--text-main);
    border-color: transparent;
}

.card-header {
    border-top-left-radius: var(--radius-card) !important;
    border-top-right-radius: var(--radius-card) !important;
    padding: 0.95rem 1.2rem;
}

.card-footer {
    border-bottom-left-radius: var(--radius-card) !important;
    border-bottom-right-radius: var(--radius-card) !important;
}

.card-body {
    padding: 1.15rem 1.2rem;
}

.card.shadow-sm,
.card.shadow,
.card.shadow-lg,
.auth-card.shadow-sm,
.auth-card.shadow,
.auth-card.shadow-lg {
    box-shadow: var(--surface-depth-shadow), var(--panel-3d-shadow) !important;
}

.card.shadow-sm:hover,
.card.shadow:hover,
.card.shadow-lg:hover,
.auth-card.shadow-sm:hover,
.auth-card.shadow:hover,
.auth-card.shadow-lg:hover {
    box-shadow: var(--surface-depth-shadow), var(--panel-3d-shadow-hover) !important;
}

.card-header h6,
.card-header .font-weight-bold,
.card-header .m-0 {
    color: var(--text-main) !important;
}

.bg-primary,
.btn-primary {
    background: var(--link-color) !important;
    border-color: var(--link-color) !important;
    color: #fff !important;
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--link-hover) !important;
    border-color: var(--link-hover) !important;
}

.bg-info {
    background: color-mix(in srgb, var(--link-color) 82%, #31c7ff 18%) !important;
    border-color: color-mix(in srgb, var(--link-color) 82%, #31c7ff 18%) !important;
    color: #fff !important;
}

.bg-success {
    background: #198754 !important;
    border-color: #198754 !important;
    color: #fff !important;
}

.bg-warning {
    background: #f59e0b !important;
    border-color: #f59e0b !important;
    color: #111827 !important;
}

.bg-danger {
    background: #dc3545 !important;
    border-color: #dc3545 !important;
    color: #fff !important;
}

.btn-secondary,
.btn-outline-secondary,
.btn-light {
    background: var(--surface-bg);
    color: var(--text-main);
    border-color: var(--border-color);
}

.btn-secondary:hover,
.btn-outline-secondary:hover,
.btn-light:hover,
.btn-secondary:focus,
.btn-outline-secondary:focus,
.btn-light:focus {
    background: var(--surface-muted);
    color: var(--text-main);
    border-color: var(--link-color);
}

.table,
.table-responsive,
table.dataTable {
    color: var(--text-main);
}

.table-responsive {
    overflow-x: auto;
}

.table,
table.dataTable {
    --bs-table-bg: var(--surface-bg);
    --bs-table-color: var(--text-main);
    --bs-table-border-color: var(--border-color);
    --bs-table-striped-bg: color-mix(in srgb, var(--surface-bg) 92%, var(--surface-muted) 8%);
    --bs-table-striped-color: var(--text-main);
    --bs-table-hover-bg: color-mix(in srgb, var(--surface-muted) 82%, var(--surface-bg) 18%);
    --bs-table-hover-color: var(--text-main);
}

.table > :not(caption) > * > *,
table.dataTable > :not(caption) > * > * {
    background-color: var(--bs-table-bg) !important;
    color: var(--bs-table-color) !important;
    border-color: var(--bs-table-border-color) !important;
    box-shadow: none !important;
}

.table thead th,
table.dataTable thead th {
    background: linear-gradient(180deg, #4f7fb4 0%, #416f9f 100%) !important;
    color: #f8fbff !important;
    border-color: var(--border-color) !important;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.76rem;
}

:root[data-theme="dark"] .table thead th,
:root[data-theme="dark"] table.dataTable thead th,
:root[data-bs-theme="dark"] .table thead th,
:root[data-bs-theme="dark"] table.dataTable thead th {
    background: var(--surface-muted) !important;
    color: var(--text-main) !important;
    border-color: var(--border-color) !important;
}

.badge {
    font-weight: 500;
}

.alert {
    color: var(--text-main);
    background: var(--surface-muted);
    border-color: var(--border-color);
}

.alert-info {
    color: color-mix(in srgb, #0c4a6e 72%, var(--text-main) 28%);
    background: color-mix(in srgb, #0ea5e9 16%, var(--surface-bg) 84%);
    border-color: color-mix(in srgb, #0ea5e9 38%, var(--border-color) 62%);
}

.alert-success {
    color: color-mix(in srgb, #198754 28%, var(--text-main) 72%);
    background: color-mix(in srgb, #198754 12%, var(--surface-bg) 88%);
    border-color: color-mix(in srgb, #198754 30%, var(--border-color) 70%);
}

.alert-warning {
    color: color-mix(in srgb, #f59e0b 32%, var(--text-main) 68%);
    background: color-mix(in srgb, #f59e0b 12%, var(--surface-bg) 88%);
    border-color: color-mix(in srgb, #f59e0b 32%, var(--border-color) 68%);
}

.alert-danger {
    color: color-mix(in srgb, #dc3545 32%, var(--text-main) 68%);
    background: color-mix(in srgb, #dc3545 12%, var(--surface-bg) 88%);
    border-color: color-mix(in srgb, #dc3545 34%, var(--border-color) 66%);
}

.dataTables_wrapper,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    color: var(--text-main) !important;
}

.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
    margin: 0;
    font-weight: 500;
}

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input,
.form-control,
.form-select,
.input-group-text,
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
    background-color: var(--surface-bg) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-sm) !important;
    caret-color: var(--text-main);
}

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    min-height: 32px;
}

.form-control::placeholder,
textarea::placeholder,
input::placeholder {
    color: #8b5cf6 !important;
    opacity: 1 !important;
}

.form-control:focus,
.form-select:focus,
.btn:focus,
.page-link:focus,
input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
    background-color: var(--surface-bg) !important;
    color: var(--text-main) !important;
    border-color: var(--link-color) !important;
    box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--link-color) 25%, transparent) !important;
}

.form-check-input {
    background-color: var(--surface-bg);
    border-color: var(--border-color);
}

.form-check-input:checked {
    background-color: var(--link-color);
    border-color: var(--link-color);
}

.nav-tabs,
.nav-pills .nav-link,
.nav-tabs .nav-link,
.page-link,
.list-group-item,
.pagination {
    border-color: var(--border-color);
}

.nav-tabs .nav-link,
.nav-pills .nav-link,
.page-link,
.list-group-item {
    background: var(--surface-bg);
    color: var(--text-main);
}

.nav-tabs .nav-link.active,
.nav-pills .nav-link.active,
.page-item.active .page-link {
    background: var(--link-color);
    color: #fff !important;
    border-color: var(--link-color) !important;
}

.page-link:hover,
.page-link:focus {
    background: var(--surface-muted);
    color: var(--text-main);
    border-color: var(--link-color);
}

.border-left-primary,
.border-left-success,
.border-left-info,
.border-left-warning,
.border-left-danger,
.border-left-secondary {
    border-left: 0.25rem solid var(--link-color) !important;
}

.border-left-success { border-left-color: #198754 !important; }
.border-left-info { border-left-color: #0ea5e9 !important; }
.border-left-warning { border-left-color: #f59e0b !important; }
.border-left-danger { border-left-color: #dc3545 !important; }
.border-left-secondary { border-left-color: #6c757d !important; }

.shadow,
.shadow-sm,
.shadow-lg {
    box-shadow: var(--shadow-sm) !important;
}

.main-footer {
    margin-top: auto;
    display: block;
    width: 100%;
    background:
        var(--surface-gloss),
        linear-gradient(180deg, color-mix(in srgb, var(--surface-muted) 94%, white 6%), color-mix(in srgb, var(--surface-muted) 98%, black 2%));
    color: var(--text-main);
    padding: 14px 0;
    text-align: center;
    border: none;
    border-radius: var(--radius-md);
    box-shadow: var(--surface-depth-shadow), var(--panel-3d-shadow);
    overflow: hidden;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
}

.footer-section {
    flex: 1;
    min-width: 200px;
    margin-bottom: 6px;
}

.footer-section h3 {
    font-size: 0.95rem;
    font-weight: bold;
    margin: 2px 0 4px;
}

.footer-section p {
    margin: 2px 0;
    font-size: 0.85rem;
}

.footer-section ul {
    list-style-type: none;
    padding: 0;
}

.footer-section ul li {
    margin-bottom: 4px;
}

.footer-section ul li a {
    text-decoration: none;
    color: var(--link-color);
    font-size: 0.85rem;
}

.footer-section ul li a:hover {
    text-decoration: underline;
    color: var(--link-hover);
}

.login-card {
    border-radius: var(--radius-md);
    background: var(--surface-bg);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.login-brand-shell {
    width: 92px;
    height: 92px;
    margin: 0 auto 1rem;
    border-radius: 24px;
    border: 1px solid var(--border-color);
    background: var(--surface-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-brand-shell img {
    max-height: 58px;
}

.login-brand-image {
    max-width: min(320px, 82%);
    max-height: 88px;
    margin: 0 auto 1rem;
    display: block;
    filter: drop-shadow(0 8px 18px rgba(15, 23, 42, 0.10));
}

.login-theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    border: 1px solid var(--border-color);
    background: var(--surface-muted);
    color: var(--text-main);
    border-radius: 999px;
    padding: 0.45rem 0.8rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.login-theme-toggle:hover,
.login-theme-toggle:focus {
    background: var(--surface-bg);
    border-color: var(--link-color);
}

.login-theme-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
}

.login-theme-sunrise {
    color: #f59e0b;
}

.login-theme-sunset {
    color: #2563eb;
}

.login-theme-track {
    position: relative;
    width: 54px;
    height: 24px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.24), rgba(37, 99, 235, 0.30));
    border: 1px solid color-mix(in srgb, var(--border-color) 82%, transparent);
    overflow: hidden;
}

.login-theme-track::before {
    content: "";
    position: absolute;
    inset: 50% 8px auto 8px;
    height: 2px;
    transform: translateY(-50%);
    background: color-mix(in srgb, var(--text-muted) 40%, transparent);
}

.login-theme-knob {
    position: absolute;
    top: 2px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(180deg, #ffd166, #f59e0b);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2);
    transition: transform 0.22s ease, background 0.22s ease;
}

:root[data-theme="dark"] .login-theme-knob,
:root[data-bs-theme="dark"] .login-theme-knob {
    transform: translateX(29px);
    background: linear-gradient(180deg, #7dd3fc, #2563eb);
}

.glass-panel {
    background: var(--surface-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.hero-title {
    color: var(--text-main);
}

.bg-light {
    background: var(--surface-muted) !important;
    color: var(--text-main) !important;
}

.rounded,
.rounded-3 {
    border-radius: var(--radius-sm) !important;
}

.modal-body canvas {
    width: 100% !important;
    height: 400px !important;
}

#fullChartModal {
    background-color: rgba(0, 0, 0, 0.92) !important;
}

#fullChartModal .modal-content {
    background: transparent !important;
    border: 0 !important;
}

@media (max-width: 768px) {
    #mainSidebarDesktop {
        margin-left: calc(-1 * var(--sidebar-width));
    }

    .main {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        padding: 14px;
    }

    #mainSidebarDesktop.active {
        margin-left: 0;
    }

    #mainSidebarMobile {
        margin-left: 0 !important;
        width: min(88vw, 320px);
        --bs-offcanvas-width: min(88vw, 320px);
    }

    .offcanvas-backdrop.show {
        opacity: 0.28;
    }

    .footer-content {
        flex-direction: column;
        align-items: stretch;
    }

    .footer-section {
        min-width: auto;
        text-align: left;
    }

    .navbar.topbar,
    .theme-topbar {
        border-radius: var(--radius-sm);
    }

    .topbar {
        padding: 0.55rem 0.7rem;
        gap: 0.35rem;
    }

    .topbar h4 {
        font-size: 1.05rem;
        line-height: 1.2;
        margin-right: auto;
    }

    .app-header-logo {
        width: min(140px, 35vw);
        height: 42px;
    }

    .card-header,
    .card-body,
    .card-footer {
        padding-left: 0.85rem;
        padding-right: 0.85rem;
    }

    .table-responsive {
        border-radius: var(--radius-sm);
        -webkit-overflow-scrolling: touch;
    }

    .table th,
    .table td {
        white-space: nowrap;
        vertical-align: middle;
    }

    .dataTables_wrapper .row {
        margin-left: 0;
        margin-right: 0;
        gap: 0.5rem;
    }

    .dataTables_wrapper .col-sm-12,
    .dataTables_wrapper .col-md-6,
    .dataTables_wrapper .col-md-5,
    .dataTables_wrapper .col-md-7 {
        padding-left: 0;
        padding-right: 0;
        width: 100%;
        max-width: 100%;
        flex: 0 0 100%;
    }

    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        text-align: left !important;
    }

    .dataTables_wrapper .dataTables_filter input {
        width: 100%;
        margin-left: 0 !important;
    }

    .input-group {
        flex-wrap: wrap;
    }

    .input-group > .form-control,
    .input-group > .form-select,
    .input-group > .btn {
        width: 100%;
        border-radius: var(--radius-sm) !important;
    }

    .btn-group,
    .btn-group-vertical {
        width: 100%;
    }

    .btn-group > .btn,
    .btn-group-vertical > .btn {
        flex: 1 1 auto;
    }

    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }

    .modal-body {
        overflow-x: auto;
    }

    pre,
    code {
        white-space: pre-wrap;
        word-break: break-word;
    }
}

@media (max-width: 992px) {
    .topbar .navbar-nav {
        margin-left: auto;
    }

    .topbar .dropdown-menu {
        right: 0;
        left: auto;
        max-width: min(92vw, 360px);
    }

    img,
    svg,
    canvas,
    video,
    iframe {
        max-width: 100%;
        height: auto;
    }
}
