/* AGPEV dark theme — activated via html[data-theme="dark"] (localStorage agpev.theme) */

html[data-theme="dark"] {
    color-scheme: dark;
    --bg-primary: #0f172a;
    --bg-secondary: #111827;
    --bg-tertiary: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-light: #334155;
    --border-medium: #475569;
}

html[data-theme="dark"] body {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
    color: var(--text-primary);
}

html[data-theme="dark"] .dash-info-chip {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
html[data-theme="dark"] .dash-info-chip-sync {
    background: #1e3a5f !important;
    border-color: #3b82f6 !important;
    color: #bfdbfe !important;
}
html[data-theme="dark"] .dash-info-chip-dump {
    background: #064e3b !important;
    border-color: #34d399 !important;
    color: #a7f3d0 !important;
}

html[data-theme="dark"] .agpev-main-content,
html[data-theme="dark"] .agpev-card,
html[data-theme="dark"] .agpev-card-body,
html[data-theme="dark"] .agpev-stat-card,
html[data-theme="dark"] .ui-widget-content,
html[data-theme="dark"] .ui-panel,
html[data-theme="dark"] .ui-datatable,
html[data-theme="dark"] .ui-dialog .ui-dialog-content {
    background: #111827 !important;
    color: #e2e8f0 !important;
}

html[data-theme="dark"] .agpev-card,
html[data-theme="dark"] .agpev-stat-card {
    border-color: #334155 !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35) !important;
}

html[data-theme="dark"] .agpev-card-header,
html[data-theme="dark"] .agpev-card-title,
html[data-theme="dark"] .agpev-stat-content p,
html[data-theme="dark"] .agpev-stat-content h3 {
    color: #f8fafc !important;
    -webkit-text-fill-color: #f8fafc !important;
    background: none !important;
}

html[data-theme="dark"] .agpev-busy-overlay,
html[data-theme="dark"] #ajaxStatus_start {
    background: transparent !important;
}

html[data-theme="dark"] .agpev-busy-card {
    background: #1e293b;
    color: #f8fafc;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .agpev-busy-card i {
    color: #93c5fd;
}

html[data-theme="dark"] .ui-button.agpev-btn-icon.success {
    background: #22c55e !important;
    border-color: #4ade80 !important;
    color: #052e16 !important;
}

html[data-theme="dark"] .ui-button.agpev-btn-icon.success .ui-button-icon-left,
html[data-theme="dark"] .ui-button.agpev-btn-icon.success .ui-icon {
    color: #052e16 !important;
}

html[data-theme="dark"] .ui-button.agpev-btn-icon.danger {
    background: #7f1d1d !important;
    border-color: #fca5a5 !important;
    color: #fecaca !important;
}

html[data-theme="dark"] .ui-button.agpev-btn-icon.warning {
    background: #78350f !important;
    border-color: #fcd34d !important;
    color: #fde68a !important;
}

html[data-theme="dark"] .ui-button.agpev-btn-icon.info {
    background: #1e3a8a !important;
    border-color: #93c5fd !important;
    color: #bfdbfe !important;
}

html[data-theme="dark"] .agpev-sidebar {
    background: #0b1220 !important;
    border-color: #1e293b !important;
}

html[data-theme="dark"] .agpev-menu-item,
html[data-theme="dark"] .agpev-menu-group-header,
html[data-theme="dark"] .agpev-sidebar-user-footer,
html[data-theme="dark"] .user-name,
html[data-theme="dark"] .user-role,
html[data-theme="dark"] .logout-label {
    color: #e2e8f0 !important;
}

html[data-theme="dark"] .agpev-footer {
    background: #0b1220 !important;
    color: #94a3b8 !important;
}

html[data-theme="dark"] .ui-datatable thead th,
html[data-theme="dark"] .ui-datatable tbody td,
html[data-theme="dark"] .engins-recents-table th,
html[data-theme="dark"] .engins-recents-table td {
    background: #1e293b !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}

html[data-theme="dark"] .ui-inputfield,
html[data-theme="dark"] .ui-selectonemenu,
html[data-theme="dark"] .ui-selectonemenu-label,
html[data-theme="dark"] .ui-selectonemenu-label.ui-inputfield,
html[data-theme="dark"] .ui-selectcheckboxmenu,
html[data-theme="dark"] .ui-selectcheckboxmenu-label,
html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
    background: #1e293b !important;
    color: #f1f5f9 !important;
    -webkit-text-fill-color: #f1f5f9 !important;
    border-color: #475569 !important;
}

html[data-theme="dark"] select option,
html[data-theme="dark"] .ui-selectonemenu-item,
html[data-theme="dark"] .ui-selectcheckboxmenu-item {
    background: #1e293b !important;
    color: #f1f5f9 !important;
}

html[data-theme="dark"] .login-container,
html[data-theme="dark"] .login-form-wrapper {
    background: #111827 !important;
    color: #e2e8f0 !important;
}

html[data-theme="dark"] .login-form-wrapper h2,
html[data-theme="dark"] .login-form-wrapper p,
html[data-theme="dark"] .login-form-wrapper label {
    color: #e2e8f0 !important;
}

html[data-theme="dark"] .agpev-prefs .agpev-lang-select,
html[data-theme="dark"] .agpev-lang-btn {
    background: rgba(15, 23, 42, 0.55);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.28);
}

.agpev-header-tools {
    position: relative;
    display: flex;
    align-items: center;
    overflow: visible;
}

.agpev-header-more-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
}

.agpev-header-more-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.agpev-header-more-icon svg {
    display: block;
}

.agpev-header-more-btn:hover {
    background: rgba(255, 255, 255, 0.22);
}

.agpev-header-more-panel {
    display: flex;
    align-items: center;
    gap: 8px;
}

.agpev-header-tool-label {
    display: none;
}

.agpev-prefs {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.user-profile-section-rightmost {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-left: auto;
}

.agpev-lang-wrap {
    position: relative;
}

.agpev-lang-select {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.agpev-lang-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 40px;
    min-width: 64px;
    padding: 0 10px;
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.22);
    background: rgba(15, 23, 42, 0.28);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.4px;
    cursor: pointer;
}

.agpev-lang-code {
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}

.agpev-lang-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 168px;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: #ffffff;
    color: #0f172a;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
    z-index: 1300;
}

.agpev-lang-option {
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.agpev-lang-option:hover,
.agpev-lang-option.is-active {
    background: #eff6ff;
    color: #1d4ed8;
}

html[data-theme="dark"] .agpev-lang-menu {
    background: #1e293b;
    color: #f8fafc;
    border-color: #334155;
}

html[data-theme="dark"] .agpev-lang-option:hover,
html[data-theme="dark"] .agpev-lang-option.is-active {
    background: #334155;
    color: #93c5fd;
}

.agpev-lang-select option {
    background-color: #ffffff;
    color: #0f172a;
    font-weight: 600;
}

html[data-theme="dark"] .agpev-lang-select option {
    background-color: #1e293b;
    color: #f8fafc;
}

.agpev-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    padding: 0;
}

.agpev-theme-icon {
    display: none;
    line-height: 0;
}

.agpev-theme-icon svg {
    display: block;
    width: 22px;
    height: 22px;
}

html:not([data-theme="dark"]) .agpev-theme-icon--moon,
html[data-theme="dark"] .agpev-theme-icon--sun {
    display: inline-flex;
}

.agpev-theme-toggle:hover,
.agpev-lang-btn:hover {
    background: rgba(255, 255, 255, 0.22);
}

.agpev-prefs--login {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 50;
}

.agpev-prefs--login .agpev-lang-btn,
.agpev-prefs--login .agpev-theme-toggle {
    background: rgba(15, 23, 42, 0.55);
    color: #fff;
}

@media (max-width: 768px) {
    .agpev-prefs {
        gap: 8px;
        width: 100%;
        justify-content: flex-end;
        padding: 6px 4px 6px 10px;
        border-radius: 10px;
        background: #f8fafc;
    }

    .agpev-header-more-btn {
        display: inline-flex;
        width: 32px;
        height: 32px;
        border-radius: 8px;
    }

    .agpev-header-more-panel {
        display: none;
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        min-width: 228px;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 10px;
        background: #ffffff;
        color: #0f172a;
        border: 1px solid #e2e8f0;
        border-radius: 14px;
        box-shadow: 0 16px 36px rgba(15, 23, 42, 0.2);
        z-index: 1400;
        pointer-events: none;
    }

    .agpev-header-more-panel.is-open {
        display: flex;
        pointer-events: auto;
    }

    .agpev-header-tool-label {
        display: inline;
        font-size: 13px;
        font-weight: 700;
        color: #0f172a;
    }

    .agpev-header-more-panel .home-icon-link,
    .agpev-header-more-panel .header-export-btn {
        display: inline-flex;
        align-items: center;
        width: 100%;
        height: 44px;
        justify-content: flex-start;
        gap: 10px;
        padding: 0 12px;
        border-radius: 10px;
        border: none;
        box-shadow: none;
        background: #f8fafc;
        color: #0f172a;
    }

    .agpev-header-more-panel .home-icon-link i,
    .agpev-header-more-panel .header-export-btn i {
        width: 18px;
        text-align: center;
        color: #2563eb;
    }

    .agpev-header-more-panel .agpev-prefs .agpev-header-tool-label {
        margin-right: auto;
    }

    .agpev-header-more-panel .agpev-lang-btn,
    .agpev-header-more-panel .agpev-theme-toggle {
        height: 36px;
        background: #e2e8f0;
        border-color: #cbd5e1;
        color: #0f172a;
    }

    .agpev-header-more-panel .agpev-lang-btn {
        min-width: 52px;
        padding: 0 8px;
        gap: 4px;
        border-radius: 8px;
    }

    .agpev-header-more-panel .agpev-lang-code {
        color: #0f172a;
    }

    html[data-theme="dark"] .agpev-header-more-panel {
        background: #1e293b;
        color: #f8fafc;
        border-color: #334155;
    }

    html[data-theme="dark"] .agpev-header-more-panel .agpev-header-tool-label {
        color: #f8fafc;
    }

    html[data-theme="dark"] .agpev-header-more-panel .home-icon-link,
    html[data-theme="dark"] .agpev-header-more-panel .header-export-btn,
    html[data-theme="dark"] .agpev-header-more-panel .agpev-prefs {
        background: #0f172a;
        color: #f8fafc;
    }

    html[data-theme="dark"] .agpev-header-more-panel .agpev-lang-btn,
    html[data-theme="dark"] .agpev-header-more-panel .agpev-theme-toggle {
        background: #334155;
        border-color: #475569;
        color: #f8fafc;
    }

    html[data-theme="dark"] .agpev-header-more-panel .agpev-lang-code {
        color: #f8fafc;
    }
}

/* Remaining light surfaces in dark mode */
html[data-theme="dark"] {
    color-scheme: dark;
}

html[data-theme="dark"] .agpev-main-content,
html[data-theme="dark"] .agpev-content,
html[data-theme="dark"] .agpev-page-content,
html[data-theme="dark"] .agpev-card-body,
html[data-theme="dark"] .agpev-chart-container,
html[data-theme="dark"] .agpev-fleet-chart-panel,
html[data-theme="dark"] .agpev-fleet-kpi,
html[data-theme="dark"] .agpev-chantier-flotte-kpi,
html[data-theme="dark"] .agpev-chantier-flotte-legends,
html[data-theme="dark"] .agpev-fleet-chart-empty,
html[data-theme="dark"] .agpev-chantier-flotte-chart-empty,
html[data-theme="dark"] .agpev-quick-action-btn,
html[data-theme="dark"] .engins-recents-table-container,
html[data-theme="dark"] .utilization-gauge,
html[data-theme="dark"] .agpev-distribution-list,
html[data-theme="dark"] .agpev-costs-summary,
html[data-theme="dark"] .cost-item,
html[data-theme="dark"] .jqplot-target,
html[data-theme="dark"] .ui-chart,
html[data-theme="dark"] .ui-tabs,
html[data-theme="dark"] .ui-tabs-panel,
html[data-theme="dark"] .ui-dialog,
html[data-theme="dark"] .ui-dialog-titlebar,
html[data-theme="dark"] .ui-overlaypanel,
html[data-theme="dark"] .ui-paginator,
html[data-theme="dark"] .ui-panelgrid,
html[data-theme="dark"] .ui-panelgrid td,
html[data-theme="dark"] .ui-panelgrid .ui-panelgrid-cell,
html[data-theme="dark"] .ui-datatable-header,
html[data-theme="dark"] .ui-datatable-footer,
html[data-theme="dark"] .ui-messages,
html[data-theme="dark"] .ui-growl-item,
html[data-theme="dark"] #tableViewY .ui-datatable tbody tr,
html[data-theme="dark"] #tableViewY .ui-datatable tbody tr:nth-child(even) {
    background: #111827 !important;
    background-color: #111827 !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}

html[data-theme="dark"] .agpev-fleet-kpi,
html[data-theme="dark"] .agpev-chantier-flotte-kpi {
    background: linear-gradient(180deg, #1e293b 0%, #111827 100%) !important;
}

html[data-theme="dark"] .agpev-fleet-kpi-label,
html[data-theme="dark"] .agpev-chantier-flotte-kpi-label,
html[data-theme="dark"] .agpev-fleet-chart-subtitle,
html[data-theme="dark"] .agpev-chantier-flotte-subtitle,
html[data-theme="dark"] .agpev-card-subtitle,
html[data-theme="dark"] .utilization-label,
html[data-theme="dark"] .cost-label,
html[data-theme="dark"] .distribution-label,
html[data-theme="dark"] .agpev-fleet-chart-panel-title,
html[data-theme="dark"] .agpev-fleet-chart-panel-title span,
html[data-theme="dark"] .agpev-page-title,
html[data-theme="dark"] .agpev-alert-content,
html[data-theme="dark"] .agpev-alert-content p,
html[data-theme="dark"] .agpev-alert-content strong,
html[data-theme="dark"] .agpev-alerts-section-title {
    color: #e2e8f0 !important;
}

html[data-theme="dark"] .agpev-fleet-kpi-value {
    color: #f8fafc !important;
}

html[data-theme="dark"] .agpev-chantier-flotte-type-legend {
    background: #1e293b !important;
}

html[data-theme="dark"] .jqplot-title {
    display: none;
}

html[data-theme="dark"] .jqplot-xaxis-tick,
html[data-theme="dark"] .jqplot-yaxis-tick,
html[data-theme="dark"] .jqplot-xaxis-label,
html[data-theme="dark"] .jqplot-yaxis-label,
html[data-theme="dark"] .jqplot-point-label,
html[data-theme="dark"] .jqplot-data-label,
html[data-theme="dark"] .jqplot-table-legend,
html[data-theme="dark"] .jqplot-table-legend td,
html[data-theme="dark"] .jqplot-highlighter-tooltip,
html[data-theme="dark"] .jqplot-cursor-tooltip {
    color: #e2e8f0 !important;
}

html[data-theme="dark"] .jqplot-table-legend {
    background: #1e293b !important;
    border: 1px solid #475569 !important;
}

html[data-theme="dark"] .jqplot-grid-canvas,
html[data-theme="dark"] .jqplot-series-canvas,
html[data-theme="dark"] .jqplot-event-canvas,
html[data-theme="dark"] .jqplot-target canvas,
html[data-theme="dark"] .agpev-chart-container canvas {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
}

html[data-theme="dark"] .agpev-card:has(.fa-gas-pump),
html[data-theme="dark"] .agpev-card:has(.fa-gas-pump) .agpev-card-body,
html[data-theme="dark"] .agpev-card:has(.fa-chart-bar),
html[data-theme="dark"] .agpev-card:has(.fa-chart-bar) .agpev-card-body,
html[data-theme="dark"] .agpev-card:has(.fa-clock),
html[data-theme="dark"] .agpev-card:has(.fa-clock) .agpev-card-body {
    background: #111827 !important;
    background-image: none !important;
}

html[data-theme="dark"] .agpev-card:has(.fa-gas-pump) .agpev-card-body::before {
    background: none !important;
}

html[data-theme="dark"] .agpev-card:has(.fa-gas-pump) .jqplot-point-label {
    color: #fde68a !important;
}

html[data-theme="dark"] .jqplot-highlighter-tooltip,
html[data-theme="dark"] .agpev-card:has(.fa-gas-pump) .jqplot-highlighter-tooltip {
    background: #0f172a !important;
    color: #f1f5f9 !important;
    border: 1px solid #475569 !important;
}

html[data-theme="dark"] .ui-widget-header,
html[data-theme="dark"] .ui-tabs .ui-tabs-nav,
html[data-theme="dark"] .ui-dialog-title {
    background: #0b1220 !important;
    color: #f1f5f9 !important;
    border-color: #334155 !important;
}

html[data-theme="dark"] .login-container,
html[data-theme="dark"] .login-form-wrapper,
html[data-theme="dark"] .login-form-wrapper h2 {
    background: #111827 !important;
}

html[data-theme="dark"] body.login-page,
html[data-theme="dark"] .login-merged-container {
    background: #0f172a !important;
}

html[data-theme="dark"] .agpev-alert-item {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

html[data-theme="dark"] .agpev-quick-action-btn {
    color: #f8fafc !important;
}

html[data-theme="dark"] .status-badge {
    filter: brightness(0.92);
}

.agpev-chart-container .jqplot-title {
    display: none;
}

html[data-theme="dark"] .agpev-sidebar,
html[data-theme="dark"] .agpev-sidebar-scroll,
html[data-theme="dark"] .agpev-menu-footer,
html[data-theme="dark"] .agpev-menu-group,
html[data-theme="dark"] .agpev-menu-group-header,
html[data-theme="dark"] .agpev-menu-items {
    background: #0b1220 !important;
    background-color: #0b1220 !important;
    color: #e2e8f0 !important;
    border-color: #1e293b !important;
}

html[data-theme="dark"] .agpev-menu-item {
    background: transparent !important;
    color: #cbd5e1 !important;
}

html[data-theme="dark"] .agpev-menu-item:hover,
html[data-theme="dark"] .agpev-menu-group-header:hover {
    background: #1e293b !important;
    color: #f8fafc !important;
}

html[data-theme="dark"] .agpev-menu-item.active {
    background: #1e3a5f !important;
    color: #93c5fd !important;
}

html[data-theme="dark"] .agpev-main-content,
html[data-theme="dark"] .agpev-content,
html[data-theme="dark"] .agpev-table-container,
html[data-theme="dark"] .agpev-card,
html[data-theme="dark"] .engin-group-section,
html[data-theme="dark"] .engin-group-header,
html[data-theme="dark"] .group-table-wrap,
html[data-theme="dark"] .ui-datatable-tablewrapper,
html[data-theme="dark"] .ui-widget-content,
html[data-theme="dark"] .ui-datatable .ui-datatable-data tr,
html[data-theme="dark"] .ui-datatable .ui-datatable-data td,
html[data-theme="dark"] .ui-datatable tbody tr,
html[data-theme="dark"] .ui-datatable tbody tr:hover,
html[data-theme="dark"] .ui-paginator,
html[data-theme="dark"] .ui-dialog-buttonpane,
html[data-theme="dark"] .jqplot-target,
html[data-theme="dark"] .agpev-chart-container,
html[data-theme="dark"] .agpev-fleet-chart-panel,
html[data-theme="dark"] .agpev-fleet-chart-canvas-wrap,
html[data-theme="dark"] .agpev-chantier-flotte-chart-canvas-wrap {
    background: #111827 !important;
    background-color: #111827 !important;
    background-image: none !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}

html[data-theme="dark"] .chip,
html[data-theme="dark"] .eng-chip,
html[data-theme="dark"] .group-badge {
    background: #1e293b !important;
    color: #e2e8f0 !important;
}

html[data-theme="dark"] .notif-overlay-header,
html[data-theme="dark"] .ui-overlaypanel,
html[data-theme="dark"] .mobile-responsive-overlay {
    background: #111827 !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}

html[data-theme="dark"] .notif-overlay-title {
    color: #f8fafc !important;
}

html[data-theme="dark"] .unread-notif-dark {
    background: #1e293b !important;
}

html[data-theme="dark"] .ui-selectonemenu-panel,
html[data-theme="dark"] .ui-autocomplete-panel,
html[data-theme="dark"] .ui-datepicker,
html[data-theme="dark"] .ui-datepicker-header,
html[data-theme="dark"] .ui-selectcheckboxmenu-panel,
html[data-theme="dark"] .ui-filter-column,
html[data-theme="dark"] .ui-column-filter,
html[data-theme="dark"] .ui-inputfield.ui-state-default {
    background: #1e293b !important;
    color: #f1f5f9 !important;
    border-color: #475569 !important;
}

html[data-theme="dark"] .ui-selectonemenu-item,
html[data-theme="dark"] .ui-selectonemenu-list,
html[data-theme="dark"] .ui-autocomplete-item {
    background: #1e293b !important;
    color: #e2e8f0 !important;
}

html[data-theme="dark"] .ui-selectonemenu-item.ui-state-highlight,
html[data-theme="dark"] .ui-selectonemenu-item:hover {
    background: #334155 !important;
    color: #f8fafc !important;
}

/* Engins page: cards, filters, count bar, dialogs — no leftover white surfaces */
html[data-theme="dark"] .cardY,
html[data-theme="dark"] .cardY-header,
html[data-theme="dark"] .cardY-body,
html[data-theme="dark"] .cardY-empty,
html[data-theme="dark"] .filters-panel,
html[data-theme="dark"] .view-toggle-topright,
html[data-theme="dark"] .view-toggle-topright .tab-toggle,
html[data-theme="dark"] .filters-toggle,
html[data-theme="dark"] .evt-card,
html[data-theme="dark"] .agpev-field-md.ui-selectonemenu,
html[data-theme="dark"] .agpev-field-md .ui-selectonemenu-trigger,
html[data-theme="dark"] .agpev-table-count-bar,
html[data-theme="dark"] .agpev-table-count-range,
html[data-theme="dark"] .assur-card,
html[data-theme="dark"] .group-mobile-cards,
html[data-theme="dark"] #enginDialogForm .engin-maint-tab,
html[data-theme="dark"] .agpev-panel,
html[data-theme="dark"] .agpev-grid {
    background: #1e293b !important;
    background-color: #1e293b !important;
    background-image: none !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}

html[data-theme="dark"] .ui-tabs .ui-tabs-nav li a {
    background: #1e293b !important;
    color: #cbd5e1 !important;
    border-color: #334155 !important;
}

html[data-theme="dark"] .ui-tabs .ui-tabs-nav li.ui-tabs-selected a,
html[data-theme="dark"] .ui-tabs .ui-tabs-nav li.ui-state-active a,
html[data-theme="dark"] .ui-tabs .ui-tabs-nav .ui-tabs-header.ui-tabs-selected a,
html[data-theme="dark"] .ui-tabs .ui-tabs-nav .ui-tabs-header.ui-state-active a {
    background: #2563eb !important;
    color: #ffffff !important;
    border-color: #3b82f6 !important;
}

html[data-theme="dark"] .assur-card-actions {
    border-top-color: #334155 !important;
}

html[data-theme="dark"] .tbl,
html[data-theme="dark"] .tbl .ui-datatable,
html[data-theme="dark"] .tbl .ui-datatable-tablewrapper,
html[data-theme="dark"] .tbl table {
    background: #111827 !important;
    background-color: #111827 !important;
    color: #e2e8f0 !important;
}

html[data-theme="dark"] .cardY {
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35) !important;
}

html[data-theme="dark"] .cardY-title,
html[data-theme="dark"] .cardY-sub,
html[data-theme="dark"] .agpev-col-label,
html[data-theme="dark"] .agpev-col-value,
html[data-theme="dark"] #enginDialogForm .engin-details-grid .ui-outputlabel,
html[data-theme="dark"] #enginDialogForm .engin-maint-tab .ui-outputlabel,
html[data-theme="dark"] #enginDialogForm .engin-maint-hint {
    color: #e2e8f0 !important;
}

html[data-theme="dark"] .agpev-table-count-bar {
    background: linear-gradient(135deg, #1e3a5f 0%, #14532d 100%) !important;
    border-color: #334155 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35) !important;
}

html[data-theme="dark"] .agpev-table-count-range {
    background: rgba(15, 23, 42, 0.65) !important;
    color: #cbd5e1 !important;
}

html[data-theme="dark"] .agpev-table-count-range strong {
    color: #93c5fd !important;
}

html[data-theme="dark"] .filters-toggle,
html[data-theme="dark"] .filters-toggle.active {
    background: #1e3a5f !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}

html[data-theme="dark"] .view-toggle-topright .tab-toggle.agpev-btn-primary {
    background: #2563eb !important;
    border-color: #2563eb !important;
    color: #fff !important;
}

html[data-theme="dark"] .card-rented,
html[data-theme="dark"] .card-rented .cardY-header,
html[data-theme="dark"] .card-rented .cardY-body {
    background: #14532d !important;
}

html[data-theme="dark"] .card-panne,
html[data-theme="dark"] .card-panne .cardY-header,
html[data-theme="dark"] .card-panne .cardY-body {
    background: #4c0519 !important;
}

html[data-theme="dark"] .card-reparation,
html[data-theme="dark"] .card-reparation .cardY-header,
html[data-theme="dark"] .card-reparation .cardY-body {
    background: #0c4a6e !important;
}

html[data-theme="dark"] .card-maintenance,
html[data-theme="dark"] .card-maintenance .cardY-header,
html[data-theme="dark"] .card-maintenance .cardY-body {
    background: #431407 !important;
}

html[data-theme="dark"] .card-reforme,
html[data-theme="dark"] .card-reforme .cardY-header,
html[data-theme="dark"] .card-reforme .cardY-body {
    background: #2e1065 !important;
}

html[data-theme="dark"] .card-vendu,
html[data-theme="dark"] .card-vendu .cardY-header,
html[data-theme="dark"] .card-vendu .cardY-body {
    background: #422006 !important;
}

html[data-theme="dark"] .chip {
    background: #0f172a !important;
    color: #e2e8f0 !important;
}

html[data-theme="dark"] .eng-chip span:not([style*="background"]):not(.eng-compteur-badge),
html[data-theme="dark"] .eng-identity-title {
    color: #e2e8f0 !important;
}

html[data-theme="dark"] .eng-chip .eng-identity-model,
html[data-theme="dark"] .eng-identity-model {
    color: #94a3b8 !important;
}

html[data-theme="dark"] .eng-chip .eng-identity-id,
html[data-theme="dark"] .eng-identity-id {
    color: #93c5fd !important;
}

html[data-theme="dark"] .eng-chip .eng-identity-counter,
html[data-theme="dark"] .eng-identity-counter {
    color: #86efac !important;
}

html[data-theme="dark"] .eng-chip .eng-identity-meta,
html[data-theme="dark"] .eng-identity-meta {
    color: #cbd5e1 !important;
}

/* Date / calendar popup: readable days, months, time */
html[data-theme="dark"] .ui-datepicker,
html[data-theme="dark"] #ui-datepicker-div,
html[data-theme="dark"] .ui-datepicker-calendar,
html[data-theme="dark"] .p-datepicker,
html[data-theme="dark"] .ui-monthpicker,
html[data-theme="dark"] .ui-timepicker,
html[data-theme="dark"] .ui-timepicker-div {
    background: #1e293b !important;
    color: #f1f5f9 !important;
    border-color: #475569 !important;
}

html[data-theme="dark"] .ui-datepicker-header,
html[data-theme="dark"] .ui-datepicker-title,
html[data-theme="dark"] .ui-datepicker-calendar th,
html[data-theme="dark"] .ui-datepicker-calendar td,
html[data-theme="dark"] .ui-datepicker-buttonpane,
html[data-theme="dark"] .ui-timepicker-div dl,
html[data-theme="dark"] .ui-timepicker-div dt,
html[data-theme="dark"] .ui-timepicker-div dd {
    background: #1e293b !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}

html[data-theme="dark"] .ui-datepicker .ui-state-default,
html[data-theme="dark"] .ui-datepicker td a,
html[data-theme="dark"] .ui-datepicker td span,
html[data-theme="dark"] .p-datepicker td > span,
html[data-theme="dark"] .p-datepicker td > a {
    background: #0f172a !important;
    color: #f1f5f9 !important;
    border-color: #334155 !important;
}

html[data-theme="dark"] .ui-datepicker .ui-state-hover,
html[data-theme="dark"] .ui-datepicker td a:hover {
    background: #334155 !important;
    color: #fff !important;
}

html[data-theme="dark"] .ui-datepicker .ui-state-highlight,
html[data-theme="dark"] .ui-datepicker .ui-state-active,
html[data-theme="dark"] .p-datepicker .ui-state-active,
html[data-theme="dark"] .p-datepicker .ui-state-highlight {
    background: #2563eb !important;
    color: #fff !important;
    border-color: #3b82f6 !important;
}

html[data-theme="dark"] .ui-datepicker-month,
html[data-theme="dark"] .ui-datepicker-year,
html[data-theme="dark"] .ui-datepicker select,
html[data-theme="dark"] .ui-timepicker-div input,
html[data-theme="dark"] .ui-datepicker-buttonpane button {
    background: #0f172a !important;
    color: #f1f5f9 !important;
    border: 1px solid #475569 !important;
}

html[data-theme="dark"] .ui-datepicker .ui-datepicker-prev,
html[data-theme="dark"] .ui-datepicker .ui-datepicker-next,
html[data-theme="dark"] .ui-datepicker .ui-icon {
    filter: invert(1) brightness(1.4);
}

html[data-theme="dark"] .ui-calendar input,
html[data-theme="dark"] .ui-datepicker-trigger {
    background: #1e293b !important;
    color: #f1f5f9 !important;
    border-color: #475569 !important;
}

html[data-theme="dark"] .ui-inputnumber,
html[data-theme="dark"] .ui-inputnumber input,
html[data-theme="dark"] .ui-spinner,
html[data-theme="dark"] .ui-spinner-input {
    background: #1e293b !important;
    color: #f1f5f9 !important;
    border-color: #475569 !important;
}

html[data-theme="dark"] .eng-compteur-badge,
html[data-theme="dark"] .eng-chip .eng-compteur-badge,
html[data-theme="dark"] .eng-chip span.eng-compteur-badge,
html[data-theme="dark"] .eng-compteur-badge i,
html[data-theme="dark"] .eng-chip .eng-compteur-badge i {
    background: #ecfeff !important;
    color: #0f172a !important;
}

html[data-theme="dark"] .eng-compteur-badge i,
html[data-theme="dark"] .eng-chip .eng-compteur-badge i {
    background: transparent !important;
}

/*
 * Dark mode contrast: only the element that still has a light inline background
 * gets dark text. Do NOT paint descendants (that made table cells unreadable).
 */
html[data-theme="dark"] body :not(.chip):not(.eng-chip):not(.ui-button):not(.agpev-btn):not(.ui-inputfield):not(.ui-datatable):not(.ui-widget)[style*="background:#fff" i],
html[data-theme="dark"] body :not(.chip):not(.eng-chip):not(.ui-button):not(.agpev-btn):not(.ui-inputfield):not(.ui-datatable):not(.ui-widget)[style*="background: #fff" i],
html[data-theme="dark"] body :not(.chip):not(.eng-chip):not(.ui-button):not(.agpev-btn):not(.ui-inputfield):not(.ui-datatable):not(.ui-widget)[style*="background:#ffffff" i],
html[data-theme="dark"] body :not(.chip):not(.eng-chip):not(.ui-button):not(.agpev-btn):not(.ui-inputfield):not(.ui-datatable):not(.ui-widget)[style*="background: #ffffff" i],
html[data-theme="dark"] body :not(.chip):not(.eng-chip):not(.ui-button):not(.agpev-btn):not(.ui-inputfield):not(.ui-datatable):not(.ui-widget)[style*="background:#f8fafc" i],
html[data-theme="dark"] body :not(.chip):not(.eng-chip):not(.ui-button):not(.agpev-btn):not(.ui-inputfield):not(.ui-datatable):not(.ui-widget)[style*="background: #f8fafc" i],
html[data-theme="dark"] body :not(.chip):not(.eng-chip):not(.ui-button):not(.agpev-btn):not(.ui-inputfield):not(.ui-datatable):not(.ui-widget)[style*="background:#f1f5f9" i],
html[data-theme="dark"] body :not(.chip):not(.eng-chip):not(.ui-button):not(.agpev-btn):not(.ui-inputfield):not(.ui-datatable):not(.ui-widget)[style*="background: #f1f5f9" i],
html[data-theme="dark"] body :not(.chip):not(.eng-chip):not(.ui-button):not(.agpev-btn):not(.ui-inputfield):not(.ui-datatable):not(.ui-widget)[style*="background:#ecfeff" i],
html[data-theme="dark"] body :not(.chip):not(.eng-chip):not(.ui-button):not(.agpev-btn):not(.ui-inputfield):not(.ui-datatable):not(.ui-widget)[style*="background: #ecfeff" i],
html[data-theme="dark"] body :not(.chip):not(.eng-chip):not(.ui-button):not(.agpev-btn):not(.ui-inputfield):not(.ui-datatable):not(.ui-widget)[style*="background:#eff6ff" i],
html[data-theme="dark"] body :not(.chip):not(.eng-chip):not(.ui-button):not(.agpev-btn):not(.ui-inputfield):not(.ui-datatable):not(.ui-widget)[style*="background:#fde68a" i],
html[data-theme="dark"] body :not(.chip):not(.eng-chip):not(.ui-button):not(.agpev-btn):not(.ui-inputfield):not(.ui-datatable):not(.ui-widget)[style*="background:#e5e7eb" i],
html[data-theme="dark"] body :not(.chip):not(.eng-chip):not(.ui-button):not(.agpev-btn):not(.ui-inputfield):not(.ui-datatable):not(.ui-widget)[style*="background-color:#fff" i],
html[data-theme="dark"] body :not(.chip):not(.eng-chip):not(.ui-button):not(.agpev-btn):not(.ui-inputfield):not(.ui-datatable):not(.ui-widget)[style*="background-color:#f8fafc" i],
html[data-theme="dark"] body :not(.chip):not(.eng-chip):not(.ui-button):not(.agpev-btn):not(.ui-inputfield):not(.ui-datatable):not(.ui-widget)[style*="background-color:#ecfeff" i] {
    color: #0f172a !important;
}

/* Tables: light text on dark cells (beats inline color:#0f172a) */
html[data-theme="dark"] .ui-datatable thead th,
html[data-theme="dark"] .ui-datatable thead th .ui-column-title,
html[data-theme="dark"] .ui-datatable tbody td,
html[data-theme="dark"] .ui-datatable tfoot td,
html[data-theme="dark"] .ui-datatable tbody td > span:not([style*="background"]):not(.agpev-badge):not(.chip):not(.status-badge):not(.eng-chip),
html[data-theme="dark"] .ui-datatable tbody td > div:not([style*="background"]):not(.agpev-badge):not(.chip):not(.eng-chip),
html[data-theme="dark"] .ui-datatable tbody td [style*="color:#0f172a"]:not(.agpev-badge):not(.chip),
html[data-theme="dark"] .ui-datatable tbody td [style*="color: #0f172a"]:not(.agpev-badge):not(.chip),
html[data-theme="dark"] .ui-datatable tbody td [style*="color:#1e293b"]:not(.agpev-badge):not(.chip),
html[data-theme="dark"] .ui-datatable tbody td [style*="color:#334155"]:not(.agpev-badge):not(.chip),
html[data-theme="dark"] .ui-datatable tbody td [style*="color:#64748b"]:not(.agpev-badge):not(.chip),
html[data-theme="dark"] .agpev-table tbody td,
html[data-theme="dark"] .tbl tbody td {
    color: #e2e8f0 !important;
}

html[data-theme="dark"] .ui-datatable thead th,
html[data-theme="dark"] .ui-datatable tbody td,
html[data-theme="dark"] .ui-datatable tfoot td,
html[data-theme="dark"] .tbl tbody td,
html[data-theme="dark"] .ui-datatable tbody tr,
html[data-theme="dark"] #tableViewY .ui-datatable tbody tr,
html[data-theme="dark"] #tableViewY .ui-datatable tbody tr:nth-child(even),
html[data-theme="dark"] #tableViewY .ui-datatable tbody td {
    background: #1e293b !important;
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

html[data-theme="dark"] .ui-datatable thead th,
html[data-theme="dark"] .ui-datatable thead th .ui-column-title,
html[data-theme="dark"] .tbl thead th {
    background: linear-gradient(135deg, #1e3a5f 0%, #1d4ed8 100%) !important;
    color: #f8fafc !important;
}

/* Status rows: dark tints + light text (page CSS used pastel + !important) */
html[data-theme="dark"] .ui-datatable tbody tr.row-rented > td,
html[data-theme="dark"] .tbl tbody tr.row-rented > td,
html[data-theme="dark"] #tableViewY .ui-datatable tbody tr.row-rented > td,
html[data-theme="dark"] .ui-datatable tbody tr.loc-row-active > td,
html[data-theme="dark"] .ui-datatable tbody tr.loc-row-terminee > td {
    background: #14532d !important;
    color: #e2e8f0 !important;
}

html[data-theme="dark"] .ui-datatable tbody tr.row-panne > td,
html[data-theme="dark"] .tbl tbody tr.row-panne > td,
html[data-theme="dark"] #tableViewY .ui-datatable tbody tr.row-panne > td {
    background: #4c0519 !important;
    color: #e2e8f0 !important;
}

html[data-theme="dark"] .ui-datatable tbody tr.row-reparation > td,
html[data-theme="dark"] .tbl tbody tr.row-reparation > td,
html[data-theme="dark"] #tableViewY .ui-datatable tbody tr.row-reparation > td {
    background: #0c4a6e !important;
    color: #e2e8f0 !important;
}

html[data-theme="dark"] .ui-datatable tbody tr.row-maintenance > td,
html[data-theme="dark"] .tbl tbody tr.row-maintenance > td,
html[data-theme="dark"] #tableViewY .ui-datatable tbody tr.row-maintenance > td,
html[data-theme="dark"] .ui-datatable tbody tr.vidange-row-afaire > td {
    background: #431407 !important;
    color: #e2e8f0 !important;
}

html[data-theme="dark"] .ui-datatable tbody tr.row-reforme > td,
html[data-theme="dark"] .tbl tbody tr.row-reforme > td,
html[data-theme="dark"] #tableViewY .ui-datatable tbody tr.row-reforme > td {
    background: #2e1065 !important;
    color: #e2e8f0 !important;
}

html[data-theme="dark"] .ui-datatable tbody tr.row-vendu > td,
html[data-theme="dark"] .tbl tbody tr.row-vendu > td,
html[data-theme="dark"] #tableViewY .ui-datatable tbody tr.row-vendu > td {
    background: #422006 !important;
    color: #e2e8f0 !important;
}

html[data-theme="dark"] .ui-datatable tbody tr.vidange-row-urgent > td {
    background: #7f1d1d !important;
    color: #e2e8f0 !important;
}

html[data-theme="dark"] .ui-datatable tbody tr:hover > td {
    background: #334155 !important;
}

/* Audit: checkbox + label readable on dark cards */
html[data-theme="dark"] .audit-filter-label,
html[data-theme="dark"] .audit-failed-login-filter label,
html[data-theme="dark"] .audit-filters-grid label {
    color: #e2e8f0 !important;
}

html[data-theme="dark"] .ui-chkbox .ui-chkbox-box {
    background: #1e293b !important;
    border-color: #94a3b8 !important;
}

html[data-theme="dark"] .ui-chkbox .ui-chkbox-box.ui-state-active {
    background: #2563eb !important;
    border-color: #60a5fa !important;
}

html[data-theme="dark"] .ui-chkbox .ui-chkbox-icon,
html[data-theme="dark"] .ui-chkbox .ui-icon {
    color: #f8fafc !important;
}

html[data-theme="dark"] .audit-action-failed {
    background: #7f1d1d !important;
    color: #fecaca !important;
}

html[data-theme="dark"] .audit-card-date,
html[data-theme="dark"] .audit-card-value,
html[data-theme="dark"] .audit-card-label {
    color: #e2e8f0 !important;
}

html[data-theme="dark"] .audit-card-user {
    background: #334155 !important;
    color: #e2e8f0 !important;
}

html[data-theme="dark"] .audit-card-item {
    background: #1e293b !important;
    border-color: #334155 !important;
}

html[data-theme="dark"] .audit-card-header {
    border-bottom-color: #334155 !important;
}

/*
 * Document status chips (assurance, permis, vignette, visite, carte grise, taxe…)
 * Keep pastel intent but use dark fills + light text so labels stay readable.
 */
html[data-theme="dark"] .agpev-badge.status-active,
html[data-theme="dark"] .status-active,
html[data-theme="dark"] .status-badge.valide {
    background: #14532d !important;
    color: #bbf7d0 !important;
    border-color: #166534 !important;
}

html[data-theme="dark"] .agpev-badge.status-expirante,
html[data-theme="dark"] .status-expirante,
html[data-theme="dark"] .status-badge.proche,
html[data-theme="dark"] .status-badge.warning {
    background: #713f12 !important;
    color: #fde68a !important;
    border-color: #a16207 !important;
}

html[data-theme="dark"] .agpev-badge.status-expiree,
html[data-theme="dark"] .status-expiree,
html[data-theme="dark"] .status-badge.expire,
html[data-theme="dark"] .agpev-badge.vidange-retardee {
    background: #7f1d1d !important;
    color: #fecaca !important;
    border-color: #991b1b !important;
}

html[data-theme="dark"] .agpev-badge.vidange-planifier {
    background: #713f12 !important;
    color: #fde68a !important;
    border-color: #a16207 !important;
}

html[data-theme="dark"] .agpev-badge.vidange-effectuee {
    background: #14532d !important;
    color: #bbf7d0 !important;
    border-color: #166534 !important;
}

html[data-theme="dark"] .agpev-badge.status-unknown,
html[data-theme="dark"] .status-unknown {
    background: #1e3a8a !important;
    color: #c7d2fe !important;
    border-color: #4338ca !important;
}

html[data-theme="dark"] .agpev-badge,
html[data-theme="dark"] .agpev-badge span,
html[data-theme="dark"] .agpev-badge i,
html[data-theme="dark"] .status-badge,
html[data-theme="dark"] .status-badge span,
html[data-theme="dark"] .status-active span,
html[data-theme="dark"] .status-expirante span,
html[data-theme="dark"] .status-expiree span,
html[data-theme="dark"] .status-unknown span {
    color: inherit !important;
}

html[data-theme="dark"] .chip,
html[data-theme="dark"] .chips .chip {
    background: #334155 !important;
    color: #f1f5f9 !important;
    border: 1px solid #475569;
}

html[data-theme="dark"] .chip span,
html[data-theme="dark"] .chip i,
html[data-theme="dark"] .chips .chip span,
html[data-theme="dark"] .chips .chip i {
    color: #f1f5f9 !important;
}

html[data-theme="dark"] .compteur-photo-block {
    background: #1e293b !important;
    border-color: #475569 !important;
}

html[data-theme="dark"] .compteur-photo-camera-actions {
    background: #1e293b !important;
}

html[data-theme="dark"] .km-add-dialog-footer,
html[data-theme="dark"] .agpev-dialog-actions {
    background: #1e293b !important;
    border-top-color: #334155 !important;
}

html[data-theme="dark"] .compteur-photo-title,
html[data-theme="dark"] .compteur-photo-result label {
    color: #f8fafc !important;
}

html[data-theme="dark"] .compteur-photo-hint,
html[data-theme="dark"] .compteur-photo-status {
    color: #94a3b8 !important;
}

html[data-theme="dark"] .compteur-photo-status.is-ok {
    color: #6ee7b7 !important;
}

html[data-theme="dark"] .compteur-photo-status.is-error {
    color: #fca5a5 !important;
}

html[data-theme="dark"] .compteur-photo-result-row input {
    background: #0f172a !important;
    border-color: #475569 !important;
    color: #f8fafc !important;
}

html[data-theme="dark"] .compteur-photo-result-row #compteurPhotoUnite {
    color: #cbd5e1 !important;
}

html[data-theme="dark"] .compteur-photo-alts-label {
    color: #94a3b8;
}

html[data-theme="dark"] .compteur-photo-alt {
    background: #1e3a5f;
    border-color: #3b82f6;
    color: #bfdbfe;
}

html[data-theme="dark"] .compteur-photo-alt.is-selected {
    background: #2563eb;
    color: #fff;
    border-color: #60a5fa;
}

html[data-theme="dark"] .compteur-frame-label {
    color: #86efac !important;
}

html[data-theme="dark"] .eng-details-type {
    color: #f1f5f9 !important;
}

html[data-theme="dark"] .eng-details-model {
    color: #94a3b8 !important;
}

html[data-theme="dark"] .eng-details-plate {
    color: #93c5fd !important;
}

html[data-theme="dark"] .eng-chip {
    background: #1e293b;
}

@media (max-width: 1024px) {
    html[data-theme="dark"] .ui-dialog table.ui-panelgrid > tbody > tr,
    html[data-theme="dark"] .ui-dialog table.agpev-grid > tbody > tr,
    html[data-theme="dark"] .ui-dialog table.form-ux > tbody > tr,
    html[data-theme="dark"] .ui-dialog table.engin-details-grid > tbody > tr,
    html[data-theme="dark"] .ui-dialog .ui-panelgrid > table > tbody > tr,
    html[data-theme="dark"] .ui-dialog .form-ux > table > tbody > tr {
        background: #1e293b !important;
        border-color: #334155 !important;
    }

    html[data-theme="dark"] .ui-dialog .ui-selectoneradio,
    html[data-theme="dark"] .ui-dialog .ui-selectoneradio table,
    html[data-theme="dark"] .ui-dialog .ui-selectoneradio tr,
    html[data-theme="dark"] .ui-dialog .ui-selectoneradio td {
        background: transparent !important;
        border: none !important;
    }
}

@media (max-width: 768px) {
    html[data-theme="dark"] .ui-dialog .ui-datatable tbody > tr {
        background: #1e293b !important;
        border-color: #334155 !important;
    }

    html[data-theme="dark"] .ui-dialog .ui-datatable tbody > tr > td {
        background: #334155 !important;
        color: #f8fafc !important;
    }

    html[data-theme="dark"] .ui-dialog .ui-datatable tbody > tr > td::before {
        color: #94a3b8;
    }

    html[data-theme="dark"] .ui-dialog .ui-datatable tbody > tr > td.actions-cell,
    html[data-theme="dark"] .ui-dialog .ui-datatable tbody > tr > td:has(button),
    html[data-theme="dark"] .ui-dialog .ui-datatable tbody > tr > td:has(.ui-button) {
        background: transparent !important;
    }
}

html[data-theme="dark"] .agpev-stock-fuel-alert-badge {
    background: #7f1d1d !important;
    color: #fecaca !important;
    border-color: #f87171 !important;
}

html[data-theme="dark"] .agpev-stock-fuel-subtitle,
html[data-theme="dark"] .agpev-fuel-modern-subtitle {
    color: #cbd5e1 !important;
}

html[data-theme="dark"] .agpev-fuel-remaining-chip {
    background: #1e293b;
    border-color: #334155;
}

html[data-theme="dark"] .agpev-fuel-remaining-chip span {
    color: #94a3b8;
}

html[data-theme="dark"] .agpev-fuel-kpi,
html[data-theme="dark"] .agpev-fuel-month-detail,
html[data-theme="dark"] .agpev-fuel-sites-toggle,
html[data-theme="dark"] .agpev-fuel-sites-panel {
    background: #1e293b;
    border-color: #334155;
}

html[data-theme="dark"] .agpev-fuel-kpi-label,
html[data-theme="dark"] .agpev-fuel-kpi-hint,
html[data-theme="dark"] .agpev-fuel-month-title,
html[data-theme="dark"] .agpev-fuel-sites-help,
html[data-theme="dark"] .agpev-fuel-sites-empty {
    color: #94a3b8;
}

html[data-theme="dark"] .agpev-fuel-kpi-value,
html[data-theme="dark"] .agpev-fuel-month-total,
html[data-theme="dark"] .agpev-fuel-sites-toggle {
    color: #e2e8f0;
}

html[data-theme="dark"] .agpev-fuel-alert-pill--stock,
html[data-theme="dark"] .agpev-fuel-sites-alert-badge {
    background: #7f1d1d;
    color: #fecaca;
    border-color: #f87171;
}

html[data-theme="dark"] .agpev-fuel-alert-pill--card {
    background: #312e81;
    color: #c7d2fe;
    border-color: #6366f1;
}

html[data-theme="dark"] .agpev-fuel-split--stock {
    background: #134e4a;
    color: #99f6e4;
}

html[data-theme="dark"] .agpev-fuel-split--diesel {
    background: #134e4a;
    color: #99f6e4;
}

html[data-theme="dark"] .agpev-fuel-split--essence {
    background: #713f12;
    color: #fde68a;
}

html[data-theme="dark"] .agpev-fuel-split--station {
    background: #0c4a6e;
    color: #bae6fd;
}

html[data-theme="dark"] .agpev-fuel-split--carte {
    background: #312e81;
    color: #c7d2fe;
}

html[data-theme="dark"] .agpev-fuel-now-col {
    background: #0f172a;
    border-color: #334155;
}

html[data-theme="dark"] .agpev-fuel-now-title,
html[data-theme="dark"] .agpev-fuel-now-name,
html[data-theme="dark"] .agpev-fuel-now-qty {
    color: #e2e8f0;
}

html[data-theme="dark"] .agpev-fuel-now-meta,
html[data-theme="dark"] .agpev-fuel-now-empty,
html[data-theme="dark"] .agpev-fuel-chart-caption,
html[data-theme="dark"] .agpev-fuel-chart-help,
html[data-theme="dark"] .agpev-fuel-daily-empty,
html[data-theme="dark"] .agpev-fuel-cost-label {
    color: #cbd5e1;
}

html[data-theme="dark"] .agpev-fuel-now-track {
    background: #334155;
}

html[data-theme="dark"] .agpev-fuel-month-picker {
    color: #e2e8f0;
}

html[data-theme="dark"] .agpev-fuel-month-picker select {
    background-color: #1e293b;
    border-color: #475569;
    color: #f8fafc;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23e2e8f0' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
}

html[data-theme="dark"] .agpev-fuel-unit-toggle {
    background: rgba(15, 23, 42, 0.55);
    border-color: #475569;
}

html[data-theme="dark"] .agpev-card-header .agpev-fuel-unit-btn,
html[data-theme="dark"] .agpev-fuel-unit-btn {
    color: #e2e8f0 !important;
    -webkit-text-fill-color: #e2e8f0 !important;
    background: transparent !important;
}

html[data-theme="dark"] .agpev-card-header .agpev-fuel-unit-btn.is-active,
html[data-theme="dark"] .agpev-fuel-unit-btn.is-active {
    background: #f8fafc !important;
    color: #9a3412 !important;
    -webkit-text-fill-color: #9a3412 !important;
}

html[data-theme="dark"] .agpev-source-checks {
    background: #0f172a;
    border-color: #334155;
}

html[data-theme="dark"] .agpev-source-check {
    background: transparent;
    color: #cbd5e1;
}

html[data-theme="dark"] .agpev-source-check:has(input[type="checkbox"]:checked) {
    background: #0d9488;
    color: #fff;
}

html[data-theme="dark"] .ui-dialog .ui-datatable thead th.actions-cell {
    background: linear-gradient(135deg, #1e3a5f 0%, #1d4ed8 100%) !important;
    color: #f8fafc !important;
}

html[data-theme="dark"] .ui-dialog .ui-datatable tbody td.actions-cell {
    background: #1e293b !important;
}
