/* ═══════════════════════════════════════════════════════════════
   AppliWeb — Dark mode (chargé en dernier)
   Active via html[data-bs-theme="dark"]
   ═══════════════════════════════════════════════════════════════ */

html[data-bs-theme="dark"],
html[data-bs-theme="dark"] body {
    background: var(--aw-canvas, #020617) !important;
    color: var(--aw-ink, #f8fafc);
}

html[data-bs-theme="dark"] .app-boot-fallback,
html[data-bs-theme="dark"] .app-boot-fallback__inner {
    background: #020617 !important;
    color: #e2e8f0 !important;
}

/* ——— Shell ERP ——— */
html[data-bs-theme="dark"] .app-layout,
html[data-bs-theme="dark"] .main-area,
html[data-bs-theme="dark"] .page-content,
html[data-bs-theme="dark"] .page-shell {
    background: var(--aw-canvas) !important;
    color: var(--aw-ink);
}

html[data-bs-theme="dark"] .topbar {
    background: var(--aw-surface) !important;
    border-bottom-color: var(--aw-border) !important;
}

html[data-bs-theme="dark"] .topbar-page-name,
html[data-bs-theme="dark"] .aw-account--light .aw-account__name,
html[data-bs-theme="dark"] .aw-account--light .aw-account__head-name {
    color: var(--aw-ink) !important;
}

html[data-bs-theme="dark"] .topbar-date,
html[data-bs-theme="dark"] .aw-account--light .aw-account__role {
    color: var(--aw-muted) !important;
}

html[data-bs-theme="dark"] .topbar-tool,
html[data-bs-theme="dark"] .topbar-menu-btn,
html[data-bs-theme="dark"] .topbar-btn {
    background: var(--aw-surface-2) !important;
    border-color: var(--aw-border) !important;
    color: var(--aw-ink) !important;
}

html[data-bs-theme="dark"] .topbar-tool:hover,
html[data-bs-theme="dark"] .topbar-menu-btn:hover,
html[data-bs-theme="dark"] .topbar-btn:hover {
    background: var(--aw-surface-3) !important;
    color: var(--aw-primary) !important;
}

html[data-bs-theme="dark"] .aw-account__menu,
html[data-bs-theme="dark"] .aw-float-panel {
    background: var(--aw-surface-2) !important;
    border-color: var(--aw-border) !important;
    color: var(--aw-ink) !important;
}

html[data-bs-theme="dark"] .aw-account__item {
    color: var(--aw-ink) !important;
}

html[data-bs-theme="dark"] .aw-account__item:hover {
    background: var(--aw-surface-3) !important;
}

html[data-bs-theme="dark"] .aw-account__currency-label {
    color: var(--aw-muted, #94a3b8) !important;
}

/* ——— Nav module GRH (hors mockup-scope) ——— */
html[data-bs-theme="dark"] .grh-sb-host {
    background: #0f172a;
    border-right-color: #334155;
}

html[data-bs-theme="dark"] .grh-rz-module-nav,
html[data-bs-theme="dark"] .grh-module-chrome,
html[data-bs-theme="dark"] .grh-module-chrome .grh-rz-module-nav {
    background: var(--aw-surface, #0f172a) !important;
    border-bottom-color: var(--aw-border, #334155) !important;
    color: var(--aw-ink, #f8fafc) !important;
    box-shadow: none !important;
}

html[data-bs-theme="dark"] .grh-rz-module-nav__tab {
    color: var(--aw-muted) !important;
}

html[data-bs-theme="dark"] .grh-rz-module-nav__tab:hover {
    color: var(--aw-ink) !important;
    background: rgba(255, 255, 255, 0.04) !important;
}

html[data-bs-theme="dark"] .grh-rz-module-nav__tab.is-active {
    color: var(--aw-primary) !important;
    border-bottom-color: var(--aw-primary) !important;
}

html[data-bs-theme="dark"] .grh-rz-module-nav__side {
    border-left-color: var(--aw-border) !important;
}

html[data-bs-theme="dark"] .grh-rz-module-nav__divider {
    background: var(--aw-border) !important;
}

html[data-bs-theme="dark"] .grh-rz-module-nav__icon-btn {
    color: var(--aw-muted) !important;
}

html[data-bs-theme="dark"] .grh-rz-module-nav__icon-btn:hover {
    color: var(--aw-ink) !important;
    background: var(--aw-surface-2) !important;
}

html[data-bs-theme="dark"] .grh-rz-module-nav__action {
    background: var(--aw-surface-2) !important;
    border-color: var(--aw-border) !important;
    color: var(--aw-ink) !important;
}

html[data-bs-theme="dark"] .grh-rz-module-nav__action:hover,
html[data-bs-theme="dark"] .grh-rz-module-nav__action.is-active {
    border-color: var(--aw-primary) !important;
    color: var(--aw-primary) !important;
    background: rgba(22, 163, 74, 0.12) !important;
}

/* ——— Formulaires & champs ——— */
html[data-bs-theme="dark"] .aw-form,
html[data-bs-theme="dark"] .aw-form__body,
html[data-bs-theme="dark"] .aw-dialog,
html[data-bs-theme="dark"] .aw-dialog__body {
    background: var(--aw-surface) !important;
    color: var(--aw-ink) !important;
}

html[data-bs-theme="dark"] .aw-form .aw-input,
html[data-bs-theme="dark"] .aw-form .form-control,
html[data-bs-theme="dark"] .aw-dialog .aw-input,
html[data-bs-theme="dark"] .aw-dialog .form-control,
html[data-bs-theme="dark"] .aw-form select,
html[data-bs-theme="dark"] .aw-form textarea,
html[data-bs-theme="dark"] input.form-control,
html[data-bs-theme="dark"] select.form-control,
html[data-bs-theme="dark"] textarea.form-control {
    background: var(--aw-surface-2) !important;
    border-color: var(--aw-border-strong) !important;
    color: var(--aw-ink) !important;
    color-scheme: dark;
}

html[data-bs-theme="dark"] .aw-form .form-label,
html[data-bs-theme="dark"] .aw-dialog .form-label,
html[data-bs-theme="dark"] .aw-field__label,
html[data-bs-theme="dark"] .aw-dialog__section {
    color: var(--aw-ink) !important;
}

html[data-bs-theme="dark"] .aw-form .text-muted,
html[data-bs-theme="dark"] .aw-field__hint {
    color: var(--aw-muted) !important;
}

/* ——— Radzen inputs / dropdowns / pager ——— */
html[data-bs-theme="dark"] {
    --rz-input-background-color: #1e293b;
    --rz-input-hover-background-color: #334155;
    --rz-input-focus-background-color: #1e293b;
    --rz-input-border: #475569;
    --rz-input-hover-border: #64748b;
    --rz-input-focus-border: #2dd4bf;
    --rz-input-value-color: #f8fafc;
    --rz-input-placeholder-color: #94a3b8;
    --rz-input-disabled-background-color: #0f172a;
    --rz-input-disabled-color: #64748b;
    --rz-dropdown-background-color: #1e293b;
    --rz-dropdown-filter-background-color: #0f172a;
    --rz-form-field-background-color: #1e293b;
    --rz-form-field-border-color: #475569;
    --rz-form-field-label-color: #94a3b8;
}

html[data-bs-theme="dark"] .rz-form-field,
html[data-bs-theme="dark"] .rz-form-field.rz-variant-outlined,
html[data-bs-theme="dark"] .rz-form-field.rz-variant-filled,
html[data-bs-theme="dark"] .rz-form-field.rz-variant-flat,
html[data-bs-theme="dark"] .rz-form-field .rz-form-field-content,
html[data-bs-theme="dark"] .aw-form .rz-form-field,
html[data-bs-theme="dark"] .aw-field .rz-form-field,
html[data-bs-theme="dark"] .grh-m-sec .rz-form-field,
html[data-bs-theme="dark"] .grh-mockup-scope .rz-form-field {
    background: #1e293b !important;
    background-color: #1e293b !important;
    border-color: #475569 !important;
    color: #f8fafc !important;
    box-shadow: none !important;
}

html[data-bs-theme="dark"] .rz-form-field::before,
html[data-bs-theme="dark"] .rz-form-field::after,
html[data-bs-theme="dark"] .rz-form-field .rz-form-field-content::before,
html[data-bs-theme="dark"] .rz-form-field .rz-form-field-content::after {
    background: #1e293b !important;
    background-color: #1e293b !important;
    border-color: #475569 !important;
    box-shadow: none !important;
}

html[data-bs-theme="dark"] .rz-form-field:focus-within::before,
html[data-bs-theme="dark"] .rz-form-field:focus-within::after,
html[data-bs-theme="dark"] .rz-form-field:focus-within .rz-form-field-content::before,
html[data-bs-theme="dark"] .rz-form-field:focus-within .rz-form-field-content::after {
    border-color: #2dd4bf !important;
}

html[data-bs-theme="dark"] .rz-form-field-label,
html[data-bs-theme="dark"] .rz-form-field .rz-label,
html[data-bs-theme="dark"] .rz-form-field legend,
html[data-bs-theme="dark"] .aw-form .rz-form-field-label,
html[data-bs-theme="dark"] .grh-m-sec .rz-form-field-label {
    color: #94a3b8 !important;
    background: #0f172a !important;
    background-color: #0f172a !important;
}

html[data-bs-theme="dark"] .rz-textbox,
html[data-bs-theme="dark"] .rz-textarea,
html[data-bs-theme="dark"] .rz-dropdown,
html[data-bs-theme="dark"] .rz-dropdown .rz-inputtext,
html[data-bs-theme="dark"] .rz-dropdown .rz-dropdown-label,
html[data-bs-theme="dark"] .rz-dropdown .rz-dropdown-trigger,
html[data-bs-theme="dark"] .rz-spinner,
html[data-bs-theme="dark"] .rz-datepicker,
html[data-bs-theme="dark"] .rz-datepicker .rz-inputtext,
html[data-bs-theme="dark"] .rz-numeric,
html[data-bs-theme="dark"] .rz-numeric .rz-inputtext,
html[data-bs-theme="dark"] .rz-lookup-search,
html[data-bs-theme="dark"] input.rz-inputtext,
html[data-bs-theme="dark"] .rz-selectbar,
html[data-bs-theme="dark"] .rz-form-field .rz-textbox,
html[data-bs-theme="dark"] .rz-form-field .rz-dropdown,
html[data-bs-theme="dark"] .rz-form-field .rz-datepicker,
html[data-bs-theme="dark"] .rz-form-field input,
html[data-bs-theme="dark"] .rz-form-field textarea,
html[data-bs-theme="dark"] .aw-form .rz-textbox,
html[data-bs-theme="dark"] .aw-form .rz-dropdown,
html[data-bs-theme="dark"] .aw-field .rz-textbox,
html[data-bs-theme="dark"] .aw-field .rz-dropdown,
html[data-bs-theme="dark"] .grh-m-sec .rz-textbox,
html[data-bs-theme="dark"] .grh-m-sec .rz-dropdown,
html[data-bs-theme="dark"] .grh-m-sec .rz-datepicker,
html[data-bs-theme="dark"] .grh-mockup-scope .rz-textbox,
html[data-bs-theme="dark"] .grh-mockup-scope .rz-dropdown,
html[data-bs-theme="dark"] .grh-mockup-scope .rz-datepicker,
html[data-bs-theme="dark"] .grh-mockup-scope input.rz-inputtext {
    background: #1e293b !important;
    background-color: #1e293b !important;
    border-color: #475569 !important;
    color: #f8fafc !important;
    caret-color: #f8fafc !important;
    box-shadow: none !important;
    -webkit-text-fill-color: #f8fafc !important;
    color-scheme: dark;
}

html[data-bs-theme="dark"] .rz-dropdown .rz-dropdown-label.rz-placeholder,
html[data-bs-theme="dark"] .rz-textbox::placeholder,
html[data-bs-theme="dark"] input.rz-inputtext::placeholder {
    color: #94a3b8 !important;
    -webkit-text-fill-color: #94a3b8 !important;
    opacity: 1 !important;
}

html[data-bs-theme="dark"] .rz-textbox:disabled,
html[data-bs-theme="dark"] .rz-textbox.rz-state-disabled,
html[data-bs-theme="dark"] input.rz-inputtext:disabled,
html[data-bs-theme="dark"] .rz-form-field:has(.rz-state-disabled),
html[data-bs-theme="dark"] .rz-form-field:has(:disabled) {
    background: #0f172a !important;
    background-color: #0f172a !important;
    color: #94a3b8 !important;
    -webkit-text-fill-color: #94a3b8 !important;
    opacity: 1 !important;
}

html[data-bs-theme="dark"] .rz-dropdown-panel,
html[data-bs-theme="dark"] .rz-popup,
html[data-bs-theme="dark"] .rz-overlaypanel,
html[data-bs-theme="dark"] .rz-menu,
html[data-bs-theme="dark"] .rz-contextmenu,
html[data-bs-theme="dark"] .rz-datepicker-popup,
html[data-bs-theme="dark"] .rz-multiselect-panel {
    background: var(--aw-surface-2) !important;
    background-color: var(--aw-surface-2) !important;
    border-color: var(--aw-border) !important;
    color: var(--aw-ink) !important;
}

html[data-bs-theme="dark"] .rz-dropdown-item,
html[data-bs-theme="dark"] .rz-menu-item,
html[data-bs-theme="dark"] .rz-listbox-item {
    color: var(--aw-ink) !important;
}

html[data-bs-theme="dark"] .rz-dropdown-item:hover,
html[data-bs-theme="dark"] .rz-dropdown-item.rz-state-highlight {
    background: var(--aw-surface-3) !important;
    color: var(--aw-primary) !important;
}

html[data-bs-theme="dark"] .rz-pager,
html[data-bs-theme="dark"] .rz-pager .rz-dropdown,
html[data-bs-theme="dark"] .rz-pager .rz-pager-page,
html[data-bs-theme="dark"] .rz-pager .rz-pager-summary,
html[data-bs-theme="dark"] .aw-pager,
html[data-bs-theme="dark"] .aw-pager .rz-dropdown {
    background: transparent !important;
    color: var(--aw-ink) !important;
    border-color: var(--aw-border) !important;
}

html[data-bs-theme="dark"] .rz-pager .rz-pager-page {
    background: var(--aw-surface-2) !important;
    border-color: var(--aw-border) !important;
    color: var(--aw-ink) !important;
}

html[data-bs-theme="dark"] .rz-pager .rz-pager-page.rz-state-active {
    background: var(--aw-primary) !important;
    border-color: var(--aw-primary) !important;
    color: var(--aw-on-primary) !important;
}

html[data-bs-theme="dark"] .rz-card,
html[data-bs-theme="dark"] .RadzenCard,
html[data-bs-theme="dark"] .rz-data-grid,
html[data-bs-theme="dark"] .rz-data-grid .rz-data-row,
html[data-bs-theme="dark"] .rz-data-grid .rz-datatable-even,
html[data-bs-theme="dark"] .rz-data-grid .rz-datatable-odd,
html[data-bs-theme="dark"] .rz-grid-table,
html[data-bs-theme="dark"] .rz-grid-table-striped tbody tr {
    background: var(--aw-surface) !important;
    background-color: var(--aw-surface) !important;
    color: var(--aw-ink) !important;
    border-color: var(--aw-border) !important;
}

html[data-bs-theme="dark"] .rz-data-grid th,
html[data-bs-theme="dark"] .rz-grid-table th {
    background: var(--aw-surface-2) !important;
    color: var(--aw-ink) !important;
    border-color: var(--aw-border) !important;
}

html[data-bs-theme="dark"] .rz-button.rz-variant-outlined,
html[data-bs-theme="dark"] .rz-button.rz-light,
html[data-bs-theme="dark"] .rz-button.rz-secondary {
    background: var(--aw-surface-2) !important;
    color: var(--aw-ink) !important;
    border-color: var(--aw-border) !important;
}

/* ——— Skeletons / chargement ——— */
html[data-bs-theme="dark"] .aw-skel__panel {
    background: var(--aw-surface) !important;
    border-color: var(--aw-border) !important;
}

html[data-bs-theme="dark"] .aw-skel__block {
    background: linear-gradient(
        90deg,
        var(--aw-surface-3) 0%,
        var(--aw-surface-2) 45%,
        var(--aw-surface-3) 90%
    ) !important;
    background-size: 200% 100% !important;
}

html[data-bs-theme="dark"] .rz-loading,
html[data-bs-theme="dark"] .rz-progressbar,
html[data-bs-theme="dark"] .rz-progressbar-value {
    background-color: var(--aw-surface-2) !important;
}

html[data-bs-theme="dark"] .rz-progressbar-value {
    background-color: var(--aw-primary) !important;
}

/* ——— Settings / cartes génériques ——— */
html[data-bs-theme="dark"] .aw-settings__card,
html[data-bs-theme="dark"] .aw-card,
html[data-bs-theme="dark"] .card {
    background: var(--aw-surface) !important;
    border-color: var(--aw-border) !important;
    color: var(--aw-ink) !important;
}

html[data-bs-theme="dark"] .modal-content,
html[data-bs-theme="dark"] .dropdown-menu {
    background: var(--aw-surface-2) !important;
    border-color: var(--aw-border) !important;
    color: var(--aw-ink) !important;
}

/* ——— Modales Radzen / formulaires dialog ——— */
html[data-bs-theme="dark"] .rz-dialog,
html[data-bs-theme="dark"] .rz-dialog-content,
html[data-bs-theme="dark"] .rz-dialog-titlebar,
html[data-bs-theme="dark"] .rz-dialog-side-titlebar,
html[data-bs-theme="dark"] .rz-dialog-body,
html[data-bs-theme="dark"] .rz-dialog-confirm,
html[data-bs-theme="dark"] .rz-dialog-alert {
    background: var(--aw-surface) !important;
    background-color: var(--aw-surface) !important;
    border-color: var(--aw-border) !important;
    color: var(--aw-ink) !important;
}

html[data-bs-theme="dark"] .rz-dialog-title,
html[data-bs-theme="dark"] .rz-dialog-titlebar-title,
html[data-bs-theme="dark"] .rz-dialog-titlebar .rz-dialog-title {
    color: var(--aw-ink) !important;
}

html[data-bs-theme="dark"] .rz-dialog-mask,
html[data-bs-theme="dark"] .rz-dialog-wrapper::before {
    background: rgba(2, 6, 23, 0.72) !important;
}

html[data-bs-theme="dark"] .lov-form-header,
html[data-bs-theme="dark"] .lov-form-body,
html[data-bs-theme="dark"] .lov-card,
html[data-bs-theme="dark"] .grh-rz-form-page--dialog,
html[data-bs-theme="dark"] .grh-rz-form-page--dialog .lov-form-header,
html[data-bs-theme="dark"] .grh-rz-form-page--dialog .lov-form-body {
    background: var(--aw-surface) !important;
    background-color: var(--aw-surface) !important;
    border-color: var(--aw-border) !important;
    color: var(--aw-ink) !important;
}

html[data-bs-theme="dark"] .lov-form-header {
    background: var(--aw-surface-2) !important;
}

html[data-bs-theme="dark"] .lov-form-header h5,
html[data-bs-theme="dark"] .lov-form-header h1,
html[data-bs-theme="dark"] .lov-form-header .text-primary {
    color: var(--aw-ink) !important;
}

html[data-bs-theme="dark"] .lov-form-body .form-label,
html[data-bs-theme="dark"] .lov-form-body label {
    color: var(--aw-muted) !important;
}

html[data-bs-theme="dark"] .rz-dialog-actions,
html[data-bs-theme="dark"] .grh-rz-dialog-actions,
html[data-bs-theme="dark"] .grh-rz-form-page--dialog .modal-footer {
    background: var(--aw-surface-2) !important;
    border-top: 1px solid var(--aw-border) !important;
}

html[data-bs-theme="dark"] .aw-dialog__head,
html[data-bs-theme="dark"] .aw-dialog__footer,
html[data-bs-theme="dark"] .aw-dialog__meta {
    background: var(--aw-surface-2) !important;
    border-color: var(--aw-border) !important;
}

html[data-bs-theme="dark"] .aw-dialog__body {
    background: var(--aw-surface) !important;
    color: var(--aw-ink) !important;
}

html[data-bs-theme="dark"] .aw-dialog__title,
html[data-bs-theme="dark"] .aw-dialog__section {
    color: var(--aw-ink) !important;
}

html[data-bs-theme="dark"] .rz-switch .rz-switch-circle,
html[data-bs-theme="dark"] .rz-switch {
    border-color: var(--aw-border-strong) !important;
}

html[data-bs-theme="dark"] input[type="file"]::file-selector-button {
    background: var(--aw-surface-3) !important;
    color: var(--aw-ink) !important;
    border: 1px solid var(--aw-border) !important;
}

html[data-bs-theme="dark"] .grh-rz-workspace.grh-rz-form-page--dialog,
html[data-bs-theme="dark"] .grh-rz-form-page.grh-rz-form-page--dialog,
html[data-bs-theme="dark"] .rz-dialog .grh-rz-workspace,
html[data-bs-theme="dark"] .rz-dialog .aw-profile-head {
    background: var(--aw-surface) !important;
    color: var(--aw-ink) !important;
}

html[data-bs-theme="dark"] .rz-dialog .text-muted,
html[data-bs-theme="dark"] .lov-form-body .text-muted {
    color: var(--aw-muted) !important;
}

html[data-bs-theme="dark"] .dropdown-item {
    color: var(--aw-ink) !important;
}

html[data-bs-theme="dark"] .dropdown-item:hover {
    background: var(--aw-surface-3) !important;
}

html[data-bs-theme="dark"] .table,
html[data-bs-theme="dark"] .table > :not(caption) > * > * {
    background: transparent !important;
    color: var(--aw-ink) !important;
    border-color: var(--aw-border) !important;
}

html[data-bs-theme="dark"] .form-select {
    background-color: var(--aw-surface-2) !important;
    border-color: var(--aw-border-strong) !important;
    color: var(--aw-ink) !important;
    color-scheme: dark;
}

html[data-bs-theme="dark"] .app-footer {
    background: var(--aw-surface) !important;
    border-top-color: var(--aw-border) !important;
    color: var(--aw-muted) !important;
}

html[data-bs-theme="dark"] .currency-toggle,
html[data-bs-theme="dark"] .currency-toggle button {
    background: var(--aw-surface-2) !important;
    border-color: var(--aw-border) !important;
    color: var(--aw-ink) !important;
}

/* Panneaux / sections GRH restants */
html[data-bs-theme="dark"] .aw-grh-shell,
html[data-bs-theme="dark"] .grh-route-stage {
    background: var(--aw-canvas) !important;
    color: var(--aw-ink);
}

