:root {
    --theme-bg: #ffffff;
    --theme-bg-accent-1: rgba(7, 123, 161, 0.12);
    --theme-bg-accent-2: rgba(187, 8, 8, 0.12);
    --theme-surface: #ffffff;
    --theme-surface-soft: #f7fafc;
    --theme-surface-alt: #fbfdff;
    --theme-border: #d9e6ef;
    --theme-border-strong: #c7d8e4;
    --theme-text: #446078;
    --theme-text-muted: #7e8080;
    --theme-link: #bb0808;
    --theme-link-hover: #8f0606;
    --theme-primary: #077ba1;
    --theme-primary-strong: #446078;
    --theme-success: #198754;
    --theme-warning-bg: #fff7e8;
    --theme-warning-border: #f0dfb6;
    --theme-warning-text: #6f5a2e;
    --theme-danger-bg: #fdeeee;
    --theme-danger-border: #f3c3c3;
    --theme-danger-text: #8b2f2f;
    --theme-topbar: rgba(255, 255, 255, 0.88);
    --theme-sidebar-start: #0b86af;
    --theme-sidebar-end: #446078;
    --theme-input-bg: #ffffff;
    --theme-input-text: #446078;
    --theme-placeholder: #8ba0af;
    --theme-table-head: #f8fbfd;
    --theme-table-row-hover: #f7fbff;
    --theme-shadow: 0 16px 30px -24px rgba(0, 0, 0, 0.4);
}

html[data-theme='dark'] {
    --theme-bg: #0e1720;
    --theme-bg-accent-1: rgba(57, 166, 201, 0.2);
    --theme-bg-accent-2: rgba(187, 8, 8, 0.14);
    --theme-surface: #14212c;
    --theme-surface-soft: #172734;
    --theme-surface-alt: #1c2d3a;
    --theme-border: #294152;
    --theme-border-strong: #3a586c;
    --theme-text: #d7e6f0;
    --theme-text-muted: #96afbf;
    --theme-link: #ff7a7a;
    --theme-link-hover: #ff9b9b;
    --theme-primary: #39a6c9;
    --theme-primary-strong: #84b8cf;
    --theme-success: #33a06f;
    --theme-warning-bg: #392f1b;
    --theme-warning-border: #6a5830;
    --theme-warning-text: #f0d895;
    --theme-danger-bg: #3f2226;
    --theme-danger-border: #6c3940;
    --theme-danger-text: #f1b4bb;
    --theme-topbar: rgba(20, 33, 44, 0.92);
    --theme-sidebar-start: #112736;
    --theme-sidebar-end: #18384b;
    --theme-input-bg: #10202b;
    --theme-input-text: #e0edf5;
    --theme-placeholder: #7d94a3;
    --theme-table-head: #1a2b38;
    --theme-table-row-hover: #1c3242;
    --theme-shadow: 0 18px 34px -26px rgba(0, 0, 0, 0.75);

    --status-success-bg: #1b3b2f;
    --status-success-border: #2e6b52;
    --status-success-text: #b8e4d0;
    --status-success-solid: #2b8f62;
    --status-success-solid-strong: #22764f;

    --status-warning-bg: #392f1b;
    --status-warning-border: #6a5830;
    --status-warning-text: #f0d895;
    --status-warning-solid: #b07a1c;
    --status-warning-solid-strong: #956618;

    --status-danger-bg: #3f2226;
    --status-danger-border: #6c3940;
    --status-danger-text: #f1b4bb;
    --status-danger-solid: #b04a56;
    --status-danger-solid-strong: #973f49;
}

html[data-theme='dark'] body {
    background-color: var(--theme-bg);
    background-image: radial-gradient(circle at top right, var(--theme-bg-accent-1) 0%, transparent 48%),
        radial-gradient(circle at bottom left, var(--theme-bg-accent-2) 0%, transparent 42%);
    color: var(--theme-text);
}

html[data-theme='dark'] a {
    color: var(--theme-link);
}

html[data-theme='dark'] a:hover,
html[data-theme='dark'] a:focus {
    color: var(--theme-link-hover);
}

html[data-theme='dark'] .scanner-button-icon,
html[data-theme='dark'] .scanner-hint-icon {
    filter: brightness(0) saturate(100%) invert(90%) sepia(15%) saturate(217%) hue-rotate(165deg) brightness(99%) contrast(93%);
}

html[data-theme='dark'] .navbar,
html[data-theme='dark'] .app-topbar,
html[data-theme='dark'] .card,
html[data-theme='dark'] .card-soft,
html[data-theme='dark'] .section-card,
html[data-theme='dark'] .report-card,
html[data-theme='dark'] .crud-card,
html[data-theme='dark'] .table-wrap,
html[data-theme='dark'] .summary-item,
html[data-theme='dark'] .preview-item,
html[data-theme='dark'] .detail-card,
html[data-theme='dark'] .modal-content,
html[data-theme='dark'] .offcanvas,
html[data-theme='dark'] .inventory-stat,
html[data-theme='dark'] .modal-field,
html[data-theme='dark'] .items-empty-cell {
    background: var(--theme-surface) !important;
    color: var(--theme-text);
    border-color: var(--theme-border) !important;
    box-shadow: var(--theme-shadow);
}

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

html[data-theme='dark'] .dashboard-shell .selection-bar,
html[data-theme='dark'] .dashboard-shell .chart-card {
    background: var(--theme-surface) !important;
    border-color: var(--theme-border) !important;
    color: var(--theme-text) !important;
    box-shadow: var(--theme-shadow);
}

html[data-theme='dark'] .dashboard-home .dash-panel,
html[data-theme='dark'] .dashboard-home .dash-panel .card-body {
    background: var(--theme-surface) !important;
    border-color: var(--theme-border) !important;
    color: var(--theme-text) !important;
    box-shadow: var(--theme-shadow);
}

html[data-theme='dark'] .dashboard-home .dash-panel .card-header {
    background: var(--theme-surface-alt) !important;
    border-bottom-color: var(--theme-border) !important;
    color: var(--theme-text) !important;
}

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

html[data-theme='dark'] .dashboard-shell .chart-toggle-btn {
    background: var(--theme-surface-alt) !important;
    border-color: var(--theme-border) !important;
    color: var(--theme-text) !important;
}

html[data-theme='dark'] .dashboard-shell .chart-toggle-btn:hover,
html[data-theme='dark'] .dashboard-shell .chart-toggle-btn:focus {
    background: rgba(57, 166, 201, 0.14) !important;
    border-color: rgba(57, 166, 201, 0.4) !important;
    color: #eef9fd !important;
}

html[data-theme='dark'] .dashboard-shell .chart-toggle-btn.active {
    background: var(--theme-primary) !important;
    border-color: var(--theme-primary) !important;
    color: #08141b !important;
}

html[data-theme='dark'] .app-topbar {
    background: var(--theme-topbar) !important;
    border-bottom-color: var(--theme-border) !important;
    backdrop-filter: blur(12px);
}

html[data-theme='dark'] .app-sidebar,
html[data-theme='dark'] #mobileSidebar {
    background: linear-gradient(180deg, var(--theme-sidebar-start) 0%, var(--theme-sidebar-end) 100%) !important;
}

html[data-theme='dark'] .brand-logo,
html[data-theme='dark'] .dashboard-icon {
    background: rgba(255, 255, 255, 0.92);
}

html[data-theme='dark'] .topbar-breadcrumb .breadcrumb-item a,
html[data-theme='dark'] .breadcrumb-item,
html[data-theme='dark'] .navbar-brand,
html[data-theme='dark'] .modal-title,
html[data-theme='dark'] .section-title,
html[data-theme='dark'] .detail-value,
html[data-theme='dark'] .summary-item .value,
html[data-theme='dark'] .preview-item .value,
html[data-theme='dark'] .inventory-stat-value,
html[data-theme='dark'] .inventory-code,
html[data-theme='dark'] .inventory-qty,
html[data-theme='dark'] .responsable-highlight {
    color: var(--theme-text) !important;
}

html[data-theme='dark'] .topbar-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    color: var(--theme-text-muted) !important;
}

html[data-theme='dark'] .topbar-breadcrumb .breadcrumb-item.active,
html[data-theme='dark'] .text-muted,
html[data-theme='dark'] .text-dark,
html[data-theme='dark'] .text-muted-brand,
html[data-theme='dark'] .summary-item .label,
html[data-theme='dark'] .preview-item .label,
html[data-theme='dark'] .detail-label,
html[data-theme='dark'] .inventory-stat-label,
html[data-theme='dark'] .inventory-location,
html[data-theme='dark'] .items-empty-state,
html[data-theme='dark'] .form-text,
html[data-theme='dark'] .text-secondary {
    color: var(--theme-text-muted) !important;
}

html[data-theme='dark'] .fw-semibold.text-dark,
html[data-theme='dark'] .card .text-dark,
html[data-theme='dark'] .report-card .text-dark {
    color: var(--theme-text) !important;
}

html[data-theme='dark'] .table,
html[data-theme='dark'] .table > :not(caption) > * > * {
    color: var(--theme-text);
    border-color: var(--theme-border);
    background-color: transparent;
}

html[data-theme='dark'] .table thead th,
html[data-theme='dark'] .crud-table-wrap table thead th,
html[data-theme='dark'] .table-wrap thead th,
html[data-theme='dark'] .operation-result .table thead th {
    background: var(--theme-table-head) !important;
    color: var(--theme-primary) !important;
    border-bottom-color: var(--theme-border) !important;
}

html[data-theme='dark'] .crud-table-wrap table tbody tr:hover,
html[data-theme='dark'] .table-hover > tbody > tr:hover > *,
html[data-theme='dark'] .table tbody tr:hover > * {
    background: var(--theme-table-row-hover) !important;
}

html[data-theme='dark'] .operation-result {
    background: linear-gradient(180deg, rgba(57, 166, 201, 0.14) 0%, rgba(20, 33, 44, 0.98) 100%) !important;
    border-color: rgba(57, 166, 201, 0.38) !important;
}

html[data-theme='dark'] .report-nav a,
html[data-theme='dark'] .report-nav span {
    background: var(--theme-surface-alt) !important;
    border-color: var(--theme-border) !important;
    color: var(--theme-text) !important;
}

html[data-theme='dark'] .report-nav a:hover,
html[data-theme='dark'] .report-nav a:focus {
    background: rgba(57, 166, 201, 0.14) !important;
    border-color: rgba(57, 166, 201, 0.4) !important;
    color: #eef9fd !important;
}

html[data-theme='dark'] .report-nav a.active {
    background: var(--theme-primary) !important;
    border-color: var(--theme-primary) !important;
    color: #08141b !important;
}

html[data-theme='dark'] .operation-result strong,
html[data-theme='dark'] .operation-result .value,
html[data-theme='dark'] .badge.text-bg-primary {
    color: #ecf8fd !important;
}

html[data-theme='dark'] .form-control,
html[data-theme='dark'] .form-select,
html[data-theme='dark'] textarea.form-control,
html[data-theme='dark'] .modal-field .form-control,
html[data-theme='dark'] .modal-field .form-select {
    background: var(--theme-input-bg) !important;
    color: var(--theme-input-text) !important;
    border-color: var(--theme-border) !important;
}

html[data-theme='dark'] .form-control::placeholder,
html[data-theme='dark'] textarea.form-control::placeholder {
    color: var(--theme-placeholder) !important;
}

html[data-theme='dark'] .form-control:focus,
html[data-theme='dark'] .form-select:focus,
html[data-theme='dark'] .modal-field .form-control:focus,
html[data-theme='dark'] .modal-field .form-select:focus {
    border-color: rgba(57, 166, 201, 0.72) !important;
    box-shadow: 0 0 0 0.2rem rgba(57, 166, 201, 0.18) !important;
}

html[data-theme='dark'] .btn-outline-secondary,
html[data-theme='dark'] .sidebar-toggle-btn,
html[data-theme='dark'] .theme-toggle-btn,
html[data-theme='dark'] .operation-counter,
html[data-theme='dark'] .topbar-user-role,
html[data-theme='dark'] .action-icon-btn,
html[data-theme='dark'] .observation-indicator {
    background: var(--theme-surface-alt) !important;
    color: var(--theme-text) !important;
    border-color: var(--theme-border-strong) !important;
}

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

html[data-theme='dark'] .topbar-user-role-label {
    color: var(--theme-text-muted) !important;
}

html[data-theme='dark'] .operation-counter-value {
    color: var(--theme-primary) !important;
}

html[data-theme='dark'] .topbar-user-role-value {
    color: var(--theme-primary) !important;
}

html[data-theme='dark'] .btn-outline-secondary:hover,
html[data-theme='dark'] .btn-outline-secondary:focus,
html[data-theme='dark'] .sidebar-toggle-btn:hover,
html[data-theme='dark'] .theme-toggle-btn:hover,
html[data-theme='dark'] .theme-toggle-btn:focus,
html[data-theme='dark'] .action-icon-btn:hover,
html[data-theme='dark'] .action-icon-btn:focus,
html[data-theme='dark'] .observation-indicator:hover,
html[data-theme='dark'] .observation-indicator:focus {
    background: var(--theme-primary) !important;
    border-color: var(--theme-primary) !important;
    color: #08141b !important;
}

html[data-theme='dark'] .btn-outline-primary {
    color: #ff9b9b;
    border-color: #ff7a7a;
}

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

html[data-theme='dark'] .btn-brand,
html[data-theme='dark'] .btn-success,
html[data-theme='dark'] .btn-excel,
html[data-theme='dark'] .page-item.active .page-link {
    color: #08141b !important;
}

html[data-theme='dark'] .btn-light {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.18);
    color: #f3f9fc;
}

html[data-theme='dark'] .btn-light:hover,
html[data-theme='dark'] .btn-light:focus {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

html[data-theme='dark'] .filters-actions .btn:disabled,
html[data-theme='dark'] .filters-actions .btn.disabled {
    color: var(--theme-text-muted) !important;
    border-color: var(--theme-border) !important;
    background-color: var(--theme-surface-alt) !important;
}

html[data-theme='dark'] .alert-primary,
html[data-theme='dark'] .alert-info {
    background: rgba(57, 166, 201, 0.16);
    border-color: rgba(57, 166, 201, 0.28);
    color: #d8eef7;
}

html[data-theme='dark'] .alert-warning {
    background: var(--theme-warning-bg);
    border-color: var(--theme-warning-border);
    color: var(--theme-warning-text);
}

html[data-theme='dark'] .alert-danger {
    background: var(--theme-danger-bg);
    border-color: var(--theme-danger-border);
    color: var(--theme-danger-text);
}

html[data-theme='dark'] .page-link {
    background: var(--theme-surface-alt);
    color: var(--theme-link);
    border-color: var(--theme-border);
}

html[data-theme='dark'] .page-link:hover {
    background: rgba(255, 122, 122, 0.12);
    color: var(--theme-link-hover);
    border-color: rgba(255, 122, 122, 0.28);
}

html[data-theme='dark'] .modal-header,
html[data-theme='dark'] .crud-modal .modal-header {
    background: linear-gradient(180deg, #1a2a37 0%, #14212c 100%) !important;
    border-bottom-color: var(--theme-border) !important;
}

html[data-theme='dark'] .modal-body,
html[data-theme='dark'] .crud-modal .modal-body,
html[data-theme='dark'] .modal-footer,
html[data-theme='dark'] .crud-modal .modal-footer,
html[data-theme='dark'] .offcanvas-header,
html[data-theme='dark'] .offcanvas-body {
    background: var(--theme-surface) !important;
    color: var(--theme-text);
    border-color: var(--theme-border) !important;
}

html[data-theme='dark'] .modal-content.border-0.shadow,
html[data-theme='dark'] .shadow,
html[data-theme='dark'] .shadow-sm {
    box-shadow: var(--theme-shadow) !important;
}

html[data-theme='dark'] .btn-close {
    filter: invert(1) grayscale(1);
}


html[data-theme='dark'] .theme-toggle-btn,
html[data-theme='dark'] .operation-counter,
html[data-theme='dark'] .topbar-user-role {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 2.15rem;
    font-weight: 600;
    border: 1px solid var(--theme-border);
    border-radius: 10px;
    background: var(--theme-surface);
    color: var(--theme-text);
}

html[data-theme='light'] .theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 2.15rem;
    font-weight: 600;
}

html[data-theme='dark'] .inventory-filter-select {
    background: var(--theme-input-bg) !important;
    color: var(--theme-input-text) !important;
    border-color: var(--theme-border) !important;
}

html[data-theme='dark'] .offcanvas .side-link.text-dark,
html[data-theme='dark'] .offcanvas .side-link.border {
    color: rgba(255, 255, 255, 0.92) !important;
    border-color: rgba(255, 255, 255, 0.16) !important;
}

html[data-theme='dark'] .offcanvas .side-link:hover,
html[data-theme='dark'] .offcanvas .side-link.active {
    background: rgba(255, 255, 255, 0.18) !important;
    color: #ffffff !important;
}

html[data-theme='dark'] .table-responsive,
html[data-theme='dark'] .crud-table-wrap {
    scrollbar-color: #4a6578 #14212c;
}

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

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

@media (max-width: 991.98px) {
    html[data-theme='dark'] .mobile-menu-trigger {
        background: var(--theme-surface-alt);
        border-color: var(--theme-border-strong);
        color: var(--theme-text);
    }
}