:root {
    --bps-bg-app: #f5f7fb;
    --bps-bg-surface: #ffffff;
    --bps-bg-subtle: #f8fafc;
    --bps-text-primary: #233446;
    --bps-text-secondary: #5f6f82;
    --bps-text-muted: #7b899b;
    --bps-border-subtle: #e5eaf0;
    --bps-border-strong: #d5dde7;
    --bps-shadow-sm: 0 1px 2px rgba(35, 52, 70, 0.06);
    --bps-shadow-md: 0 8px 24px rgba(35, 52, 70, 0.08);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --bps-bg-app: #000000;
    --bps-bg-surface: #090909;
    --bps-bg-subtle: #111111;
    --bps-bg-control: #0a0a0a;
    --bps-bg-hover: #1a1a1a;
    --bps-text-primary: #ffffff;
    --bps-text-secondary: #f4f4f5;
    --bps-text-muted: #d4d4d8;
    --bps-border-subtle: #262626;
    --bps-border-strong: #3f3f46;
    --bps-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28);
    --bps-shadow-md: 0 10px 30px rgba(0, 0, 0, 0.34);
    --bs-body-color: #f4f4f5;
    --bs-body-bg: #000000;
    --bs-heading-color: #ffffff;
    --bs-border-color: #262626;
    --bs-secondary-color: #d4d4d8;
    --bs-secondary-bg: #111111;
    --bps-sidebar-surface: #000000;
    --bps-sidebar-subtle: #0a0a0a;
    --bps-sidebar-border: #262626;
    --bps-sidebar-text: #f4f4f5;
    --bps-sidebar-muted: #d4d4d8;
    --bps-sidebar-strong: #ffffff;
    --bps-sidebar-shadow: 8px 0 28px rgba(0, 0, 0, 0.34);
}

.bps-nav-theme {
    height: 35px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0 0.7rem;
    border: 1px solid #d9dee3;
    border-radius: 0.45rem;
    color: #435971;
    background: #ffffff;
    font-size: 0.75rem;
    font-weight: 600;
}

.bps-nav-theme:focus-visible {
    outline: 3px solid var(--bps-primary-focus);
    outline-offset: 2px;
}

html[data-theme="dark"] body,
html[data-theme="dark"] .layout-wrapper,
html[data-theme="dark"] .layout-container,
html[data-theme="dark"] .layout-page,
html[data-theme="dark"] .content-wrapper {
    color: var(--bps-text-secondary);
    background-color: var(--bps-bg-app) !important;
}

html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5,
html[data-theme="dark"] h6,
html[data-theme="dark"] .card-title,
html[data-theme="dark"] .modal-title,
html[data-theme="dark"] .offcanvas-title,
html[data-theme="dark"] legend {
    color: var(--bps-text-primary);
}

html[data-theme="dark"] .text-body,
html[data-theme="dark"] .text-dark,
html[data-theme="dark"] .text-secondary {
    color: var(--bps-text-secondary) !important;
}

html[data-theme="dark"] .text-muted,
html[data-theme="dark"] small,
html[data-theme="dark"] .form-text {
    color: var(--bps-text-muted) !important;
}

html[data-theme="dark"] .bg-white,
html[data-theme="dark"] .bg-light,
html[data-theme="dark"] .card,
html[data-theme="dark"] .card-header,
html[data-theme="dark"] .card-footer,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer,
html[data-theme="dark"] .offcanvas,
html[data-theme="dark"] .accordion-item,
html[data-theme="dark"] .list-group-item,
html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .popover,
html[data-theme="dark"] .toast,
html[data-theme="dark"] .swal2-popup {
    color: var(--bps-text-secondary) !important;
    border-color: var(--bps-border-subtle) !important;
    background-color: var(--bps-bg-surface) !important;
    background-image: none !important;
}

html[data-theme="dark"] .swal2-title,
html[data-theme="dark"] .swal2-close {
    color: var(--bps-text-primary) !important;
}

html[data-theme="dark"] .swal2-html-container,
html[data-theme="dark"] .swal2-validation-message {
    color: var(--bps-text-secondary) !important;
}

html[data-theme="dark"] .border,
html[data-theme="dark"] .border-top,
html[data-theme="dark"] .border-end,
html[data-theme="dark"] .border-bottom,
html[data-theme="dark"] .border-start,
html[data-theme="dark"] hr,
html[data-theme="dark"] .dropdown-divider,
html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer,
html[data-theme="dark"] .card-header,
html[data-theme="dark"] .card-footer {
    border-color: var(--bps-border-subtle) !important;
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] .input-group-text,
html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .choices__inner,
html[data-theme="dark"] .choices__list--dropdown,
html[data-theme="dark"] .select2-container--default .select2-selection--single,
html[data-theme="dark"] .select2-container--default .select2-selection--multiple,
html[data-theme="dark"] .select2-dropdown {
    color: var(--bps-text-primary) !important;
    border-color: var(--bps-border-strong) !important;
    background-color: var(--bps-bg-control) !important;
}

html[data-theme="dark"] input::file-selector-button,
html[data-theme="dark"] .form-control::file-selector-button {
    color: var(--bps-text-primary) !important;
    border-color: var(--bps-border-strong) !important;
    background: var(--bps-bg-subtle) !important;
}

html[data-theme="dark"] :disabled,
html[data-theme="dark"] .form-control:disabled,
html[data-theme="dark"] .form-select:disabled {
    color: var(--bps-text-muted) !important;
    background-color: var(--bps-bg-subtle) !important;
    opacity: 0.8;
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder,
html[data-theme="dark"] .form-control::placeholder {
    color: var(--bps-text-muted) !important;
    opacity: 1;
}

html[data-theme="dark"] label,
html[data-theme="dark"] .form-label,
html[data-theme="dark"] .col-form-label {
    color: var(--bps-text-secondary);
}

html[data-theme="dark"] option,
html[data-theme="dark"] .choices__item,
html[data-theme="dark"] .select2-results__option {
    color: var(--bps-text-primary);
    background-color: var(--bps-bg-control);
}

html[data-theme="dark"] .dropdown-item,
html[data-theme="dark"] .nav-link,
html[data-theme="dark"] .page-link,
html[data-theme="dark"] .list-group-item-action {
    color: var(--bps-text-secondary);
}

html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .dropdown-item:focus,
html[data-theme="dark"] .dropdown-item.active,
html[data-theme="dark"] .nav-link:hover,
html[data-theme="dark"] .list-group-item-action:hover {
    color: #ffffff;
    background-color: var(--bps-bg-hover);
}

html[data-theme="dark"] .table,
html[data-theme="dark"] table,
html[data-theme="dark"] .table-responsive,
html[data-theme="dark"] .dataTables_wrapper,
html[data-theme="dark"] .dt-container {
    --bs-table-color: var(--bps-text-secondary);
    --bs-table-bg: var(--bps-bg-surface);
    --bs-table-border-color: var(--bps-border-subtle);
    --bs-table-striped-bg: var(--bps-bg-subtle);
    --bs-table-striped-color: var(--bps-text-secondary);
    --bs-table-hover-bg: var(--bps-bg-hover);
    --bs-table-hover-color: #ffffff;
    color: var(--bps-text-secondary) !important;
    border-color: var(--bps-border-subtle) !important;
    background-color: var(--bps-bg-surface) !important;
}

html[data-theme="dark"] .table > :not(caption) > * > *,
html[data-theme="dark"] table.dataTable > thead > tr > th,
html[data-theme="dark"] table.dataTable > tbody > tr > td {
    color: var(--bps-text-secondary) !important;
    border-color: var(--bps-border-subtle) !important;
    background-color: transparent !important;
    box-shadow: none !important;
}

html[data-theme="dark"] .table-light > :not(caption) > * > *,
html[data-theme="dark"] table.dataTable thead th,
html[data-theme="dark"] table.dataTable thead td {
    color: var(--bps-text-secondary) !important;
    border-color: var(--bps-border-strong) !important;
    background-color: var(--bps-bg-subtle) !important;
}

html[data-theme="dark"] .table-hover > tbody > tr:hover > *,
html[data-theme="dark"] table.dataTable tbody tr:hover > * {
    color: #ffffff !important;
    background-color: var(--bps-bg-hover) !important;
}

html[data-theme="dark"] .dataTables_info,
html[data-theme="dark"] .dataTables_length,
html[data-theme="dark"] .dataTables_filter,
html[data-theme="dark"] .dt-info,
html[data-theme="dark"] .dt-length,
html[data-theme="dark"] .dt-search {
    color: var(--bps-text-muted) !important;
}

html[data-theme="dark"] .pagination .page-link,
html[data-theme="dark"] .dataTables_paginate .paginate_button,
html[data-theme="dark"] .dt-paging .dt-paging-button {
    color: var(--bps-text-secondary) !important;
    border-color: var(--bps-border-subtle) !important;
    background: var(--bps-bg-surface) !important;
}

html[data-theme="dark"] .pagination .active .page-link,
html[data-theme="dark"] .dataTables_paginate .paginate_button.current,
html[data-theme="dark"] .dt-paging .dt-paging-button.current {
    color: #ffffff !important;
    border-color: var(--bps-primary) !important;
    background: var(--bps-primary) !important;
}

html[data-theme="dark"] .bps-top-navbar {
    color: var(--bps-text-primary);
    border-bottom-color: var(--bps-border-subtle);
    background: rgba(0, 0, 0, 0.96) !important;
}

html[data-theme="dark"] .bps-top-navbar .bps-navbar-brand {
    border-radius: 6px;
    background: #ffffff;
}

.bps-navbar-brand-logo--dark {
    display: none !important;
}

html[data-theme="dark"] .bps-top-navbar .bps-navbar-brand.has-dark-logo {
    background: transparent !important;
}

html[data-theme="dark"] .bps-navbar-brand.has-dark-logo .bps-navbar-brand-logo--light {
    display: none !important;
}

html[data-theme="dark"] .bps-navbar-brand.has-dark-logo .bps-navbar-brand-logo--dark {
    display: block !important;
}

html[data-theme="dark"] .bps-nav-theme,
html[data-theme="dark"] .bps-nav-fullscreen,
html[data-theme="dark"] .bps-nav-clock,
html[data-theme="dark"] .nav-top-btn:not(.btn-primary),
html[data-theme="dark"] .bps-notifications-button {
    color: var(--bps-text-primary) !important;
    border-color: var(--bps-border-strong) !important;
    background: var(--bps-bg-control) !important;
}

html[data-theme="dark"] .bps-nav-theme:hover,
html[data-theme="dark"] .bps-nav-theme[aria-pressed="true"],
html[data-theme="dark"] .bps-nav-fullscreen:hover {
    color: #ffffff !important;
    border-color: var(--bps-primary) !important;
    background: rgba(var(--bps-primary-rgb), 0.18) !important;
}

html[data-theme="dark"] #miMenuDesplegable.bps-sidebar {
    background: var(--bps-sidebar-surface);
    box-shadow: 3px 0 12px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] #miMenuDesplegable .menu-link,
html[data-theme="dark"] #miMenuDesplegable .menu-sub .menu-link,
html[data-theme="dark"] #miMenuDesplegable .menu-link > div {
    color: #ffffff !important;
}

html[data-theme="dark"] #miMenuDesplegable .menu-toggle::after {
    border-color: var(--bps-sidebar-muted) !important;
}

html[data-theme="dark"] #miMenuDesplegable .menu-item-blocked > .menu-link,
html[data-theme="dark"] #miMenuDesplegable .menu-item-blocked > .menu-link > div {
    color: var(--bps-sidebar-muted) !important;
}

html[data-theme="dark"] #miMenuDesplegable .menu-link:hover,
html[data-theme="dark"] #miMenuDesplegable .menu-item.active > .menu-link,
html[data-theme="dark"] #miMenuDesplegable .menu-item.open > .menu-link,
html[data-theme="dark"] #miMenuDesplegable .menu-item.active-path > .menu-link {
    color: #ffffff !important;
    background-color: var(--bps-bg-hover) !important;
}

html[data-theme="dark"] #miMenuDesplegable .menu-header,
html[data-theme="dark"] #miMenuDesplegable .bps-sidebar-brand-copy small,
html[data-theme="dark"] #miMenuDesplegable .bps-sidebar-search input::placeholder {
    color: var(--bps-sidebar-muted) !important;
}

html[data-theme="dark"] #miMenuDesplegable .bps-sidebar-search,
html[data-theme="dark"] #miMenuDesplegable .bps-sidebar-brand-mark,
html[data-theme="dark"] #miMenuDesplegable .bps-sidebar-collapse {
    color: var(--bps-text-secondary);
    border-color: var(--bps-border-strong);
    background: var(--bps-bg-subtle);
}

html[data-theme="dark"] .bps-home-page {
    --bps-home-surface: var(--bps-bg-surface);
    --bps-home-border: var(--bps-border-subtle);
    --bps-home-text: var(--bps-text-primary);
    --bps-home-muted: var(--bps-text-muted);
}

html[data-theme="dark"] .bps-home-module-card,
html[data-theme="dark"] .bps-home-access {
    color: var(--bps-text-secondary);
    border-color: var(--bps-border-subtle);
    background: var(--bps-bg-surface);
}

html[data-theme="dark"] .bps-home-module-copy > span,
html[data-theme="dark"] .bps-home-module-link,
html[data-theme="dark"] .bps-logistics-dashboard .logistics-page-eyebrow,
html[data-theme="dark"] .bps-erp-dashboard .erp-page-eyebrow,
html[data-theme="dark"] .bps-erp-dashboard .erp-panel-eyebrow,
html[data-theme="dark"] .wms-dashboard__eyebrow {
    color: #818cf8 !important;
}

html[data-theme="dark"] .bps-home-access-list > div {
    border-color: var(--bps-border-subtle);
}

html[data-theme="dark"] .bps-app-footer {
    color: var(--bps-text-muted) !important;
    border-color: var(--bps-border-subtle) !important;
    background: var(--bps-bg-surface) !important;
}

html[data-theme="dark"] .bps-app-footer__powered-by,
html[data-theme="dark"] .bps-app-footer__brand,
html[data-theme="dark"] .bps-app-footer__date .bx {
    color: var(--bps-text-secondary) !important;
}

html[data-theme="dark"] .bps-app-footer__divider {
    background: var(--bps-border-strong) !important;
}

html[data-theme="dark"] .bps-logistics-dashboard {
    --logistics-bg: var(--bps-bg-app);
    --logistics-surface: var(--bps-bg-surface);
    --logistics-surface-muted: var(--bps-bg-subtle);
    --logistics-border: var(--bps-border-strong);
    --logistics-border-soft: var(--bps-border-subtle);
    --logistics-text: var(--bps-text-primary);
    --logistics-muted: var(--bps-text-secondary);
    --logistics-muted-light: var(--bps-text-muted);
    --logistics-shadow: var(--bps-shadow-sm);
}

html[data-theme="dark"] .bps-logistics-dashboard .logistics-page-header h1,
html[data-theme="dark"] .bps-logistics-dashboard .logistics-section-heading h2,
html[data-theme="dark"] .bps-logistics-dashboard .logistics-kpi-value,
html[data-theme="dark"] .bps-logistics-dashboard .logistics-card-title {
    color: var(--bps-text-primary) !important;
}

html[data-theme="dark"] .bps-logistics-dashboard .choices__inner,
html[data-theme="dark"] .bps-logistics-dashboard .form-control,
html[data-theme="dark"] .bps-logistics-dashboard .form-select {
    color: var(--bps-text-primary) !important;
    background: var(--bps-bg-control) !important;
}

html[data-theme="dark"].bps-tms-dashboard-page body,
html[data-theme="dark"].bps-tms-dashboard-page .layout-wrapper,
html[data-theme="dark"].bps-tms-dashboard-page .layout-container,
html[data-theme="dark"].bps-tms-dashboard-page .layout-page,
html[data-theme="dark"].bps-tms-dashboard-page .content-wrapper {
    background: var(--bps-bg-app) !important;
}

html[data-theme="dark"].bps-tms-dashboard-page .bps-top-navbar {
    color: var(--bps-text-primary) !important;
    border-color: var(--bps-border-subtle) !important;
    background: rgba(0, 0, 0, 0.96) !important;
}

html[data-theme="dark"].bps-tms-dashboard-page #miMenuDesplegable {
    color: var(--bps-sidebar-text) !important;
    border-color: var(--bps-sidebar-border) !important;
    background: var(--bps-sidebar-surface) !important;
    box-shadow: var(--bps-sidebar-shadow) !important;
}

html[data-theme="dark"].bps-tms-dashboard-page .bps-nav-theme,
html[data-theme="dark"].bps-tms-dashboard-page .bps-nav-fullscreen,
html[data-theme="dark"].bps-tms-dashboard-page .bps-nav-clock,
html[data-theme="dark"].bps-tms-dashboard-page .nav-settings-btn {
    color: var(--bps-text-primary) !important;
    border-color: var(--bps-border-strong) !important;
    background: var(--bps-bg-surface) !important;
}

html[data-theme="dark"] .bps-logistics-dashboard .is-pending .logistics-summary-title {
    color: #f7d895 !important;
    background: #2b2114 !important;
}

html[data-theme="dark"] .bps-logistics-dashboard .logistics-planning-section .mt-1,
html[data-theme="dark"] .bps-logistics-dashboard .tb-custom tbody tr:hover td {
    background: var(--bps-bg-subtle) !important;
}

html[data-theme="dark"] .bps-erp-dashboard {
    --erp-bg: var(--bps-bg-app);
    --erp-surface: var(--bps-bg-surface);
    --erp-surface-muted: var(--bps-bg-subtle);
    --erp-border: var(--bps-border-strong);
    --erp-border-soft: var(--bps-border-subtle);
    --erp-text: var(--bps-text-primary);
    --erp-muted: var(--bps-text-muted);
    --erp-shadow: var(--bps-shadow-sm);
}

html[data-theme="dark"] .wms-dashboard {
    --wms-ink: var(--bps-text-primary);
    --wms-muted: var(--bps-text-muted);
    --wms-line: var(--bps-border-subtle);
    --wms-surface: var(--bps-bg-surface);
    --wms-bg: var(--bps-bg-app);
    color: var(--bps-text-secondary);
    background: var(--bps-bg-app);
}

html[data-theme="dark"] .wms-dashboard__title,
html[data-theme="dark"] .wms-kpi__value,
html[data-theme="dark"] .wms-panel__title,
html[data-theme="dark"] .wms-activity__date,
html[data-theme="dark"] .wms-activity__name {
    color: var(--bps-text-primary) !important;
}

html[data-theme="dark"] .wms-dashboard__updated,
html[data-theme="dark"] .wms-kpi,
html[data-theme="dark"] .wms-panel,
html[data-theme="dark"] .wms-kpi__footer,
html[data-theme="dark"] .wms-panel__header {
    color: var(--bps-text-secondary) !important;
    border-color: var(--bps-border-subtle) !important;
    background: var(--bps-bg-surface) !important;
}

html[data-theme="dark"] .wms-activity__table thead th {
    color: var(--bps-text-secondary) !important;
    border-color: var(--bps-border-strong) !important;
    background: var(--bps-bg-subtle) !important;
}

html[data-theme="dark"] .wms-activity__table tbody td {
    color: var(--bps-text-secondary) !important;
    border-color: var(--bps-border-subtle) !important;
}

html[data-theme="dark"] .tasks-shell {
    --task-ink: var(--bps-text-primary);
    --task-muted: var(--bps-text-muted);
    --task-line: var(--bps-border-subtle);
    --task-bg: var(--bps-bg-app);
    color: var(--bps-text-secondary) !important;
    background: var(--bps-bg-app) !important;
}

html[data-theme="dark"] .tasks-kpis article,
html[data-theme="dark"] .tasks-toolbar,
html[data-theme="dark"] .task-card,
html[data-theme="dark"] .tasks-modal,
html[data-theme="dark"] .task-step-row,
html[data-theme="dark"] .task-files a,
html[data-theme="dark"] .org-canvas,
html[data-theme="dark"] .org-card,
html[data-theme="dark"] .org-group {
    color: var(--bps-text-secondary) !important;
    border-color: var(--bps-border-subtle) !important;
    background: var(--bps-bg-surface) !important;
    background-image: none !important;
}

html[data-theme="dark"] .tasks-column,
html[data-theme="dark"] .task-current-step,
html[data-theme="dark"] .tasks-editor-aside,
html[data-theme="dark"] .task-detail-description,
html[data-theme="dark"] .task-detail-meta div,
html[data-theme="dark"] .task-detail-step,
html[data-theme="dark"] .tasks-aside-title,
html[data-theme="dark"] .complete-step-name {
    color: var(--bps-text-secondary) !important;
    border-color: var(--bps-border-subtle) !important;
    background: var(--bps-bg-subtle) !important;
}

html[data-theme="dark"] .task-card h3,
html[data-theme="dark"] .tasks-modal .modal-title,
html[data-theme="dark"] .org-card h3,
html[data-theme="dark"] .tasks-column h2 {
    color: var(--bps-text-primary) !important;
}

html[data-theme="dark"] .usuarios-config-page .portal-user-section,
html[data-theme="dark"] .usuarios-config-page .tms-access-section,
html[data-theme="dark"] .usuarios-config-page .bps-multicheck,
html[data-theme="dark"] .usuarios-config-page .bps-multicheck.is-disabled,
html[data-theme="dark"] .usuarios-config-page .bps-multicheck .portal-search-wrapper {
    color: var(--bps-text-secondary) !important;
    border-color: var(--bps-border-subtle) !important;
    background: var(--bps-bg-surface) !important;
}

html[data-theme="dark"] .usuarios-config-page .bps-multicheck.is-disabled,
html[data-theme="dark"] .usuarios-config-page .bps-multicheck .portal-search-wrapper {
    background: var(--bps-bg-subtle) !important;
}

html[data-theme="dark"] .usuarios-config-page .bps-multicheck-option,
html[data-theme="dark"] .usuarios-config-page .bps-multicheck-action,
html[data-theme="dark"] .usuarios-config-page .label-submenu {
    color: var(--bps-text-secondary) !important;
}

html[data-theme="dark"] .usuarios-config-page .bps-multicheck-option:hover,
html[data-theme="dark"] .usuarios-config-page .bps-multicheck-option.is-selected,
html[data-theme="dark"] .usuarios-config-page .bps-multicheck-action:hover:not(:disabled) {
    color: #ffffff !important;
    background: var(--bps-bg-hover) !important;
}

html[data-theme="dark"] .route-planner-page {
    --route-surface: var(--bps-bg-surface);
    --route-subtle: var(--bps-bg-subtle);
    --route-border: var(--bps-border-subtle);
    --route-text: var(--bps-text-primary);
    --route-muted: var(--bps-text-muted);
}

html[data-theme="dark"] .route-workspace,
html[data-theme="dark"] .route-planner-panel,
html[data-theme="dark"] .route-section,
html[data-theme="dark"] .route-map-legend {
    color: var(--bps-text-secondary) !important;
    border-color: var(--bps-border-subtle) !important;
    background: var(--bps-bg-surface) !important;
}

html[data-theme="dark"] .route-planner-panel {
    background: var(--bps-bg-subtle) !important;
}

html[data-theme="dark"] .route-planner-page .form-label,
html[data-theme="dark"] .route-map-legend,
html[data-theme="dark"] .route-map-legend span {
    color: var(--bps-text-secondary) !important;
}

html[data-theme="dark"] .contabilidad-page {
    color: var(--bps-text-secondary) !important;
    background: var(--bps-bg-app) !important;
}

html[data-theme="dark"] .contabilidad-hero,
html[data-theme="dark"] .contabilidad-card,
html[data-theme="dark"] .contabilidad-kpi,
html[data-theme="dark"] .contabilidad-tab {
    color: var(--bps-text-secondary) !important;
    border-color: var(--bps-border-subtle) !important;
    background: var(--bps-bg-surface) !important;
    box-shadow: var(--bps-shadow-sm) !important;
}

html[data-theme="dark"] .contabilidad-tab.active {
    color: #ffffff !important;
    border-color: var(--bps-primary) !important;
    background: var(--bps-primary) !important;
}

html[data-theme="dark"] .contabilidad-kpi strong,
html[data-theme="dark"] #tablaContabilidad th,
html[data-theme="dark"] #tablaAsientoManual th {
    color: var(--bps-text-primary) !important;
}

html[data-theme="dark"] .alq-page {
    --alq-text: var(--bps-text-primary);
    --alq-muted: var(--bps-text-muted);
    --alq-border: var(--bps-border-subtle);
    --alq-surface: var(--bps-bg-surface);
    color: var(--bps-text-secondary) !important;
    background: var(--bps-bg-app) !important;
}

html[data-theme="dark"] .alq-hero h1,
html[data-theme="dark"] .alq-metric strong,
html[data-theme="dark"] .alq-panel h2,
html[data-theme="dark"] .alq-section-heading {
    color: var(--bps-text-primary) !important;
}

html[data-theme="dark"] .alq-context,
html[data-theme="dark"] .alq-metric,
html[data-theme="dark"] .alq-panel,
html[data-theme="dark"] .alq-form-section,
html[data-theme="dark"] .alq-actions,
html[data-theme="dark"] .alq-filterbar,
html[data-theme="dark"] .alq-checks label,
html[data-theme="dark"] .alq-table-wrap,
html[data-theme="dark"] .alq-table {
    color: var(--bps-text-secondary) !important;
    border-color: var(--bps-border-subtle) !important;
    background: var(--bps-bg-surface) !important;
}

html[data-theme="dark"] .alq-workflow,
html[data-theme="dark"] .alq-form-section,
html[data-theme="dark"] .alq-actions,
html[data-theme="dark"] .alq-filterbar,
html[data-theme="dark"] .alq-checks label {
    background: var(--bps-bg-subtle) !important;
}

html[data-theme="dark"] .alq-tab {
    color: var(--bps-text-secondary) !important;
}

html[data-theme="dark"] .alq-tab:hover,
html[data-theme="dark"] .alq-tab.active {
    color: #ffffff !important;
    border-color: var(--bps-primary) !important;
    background: var(--bps-bg-hover) !important;
}

html[data-theme="dark"] .alq-field label,
html[data-theme="dark"] .alq-metric span,
html[data-theme="dark"] .alq-section-heading,
html[data-theme="dark"] .alq-help {
    color: var(--bps-text-secondary) !important;
}

html[data-theme="dark"] .alq-btn.secondary {
    color: var(--bps-text-secondary) !important;
    border-color: var(--bps-border-strong) !important;
    background: var(--bps-bg-surface) !important;
}

html[data-theme="dark"] .alq-table th {
    color: var(--bps-text-secondary) !important;
    border-color: var(--bps-border-strong) !important;
    background: var(--bps-bg-subtle) !important;
}

html[data-theme="dark"] .alq-table td {
    color: var(--bps-text-secondary) !important;
    border-color: var(--bps-border-subtle) !important;
}

html[data-theme="dark"] .alq-table tbody tr:hover {
    background: var(--bps-bg-hover) !important;
}

html[data-theme="dark"] .status-flota-page {
    color: var(--bps-text-secondary) !important;
}

html[data-theme="dark"] .fleet-title,
html[data-theme="dark"] .fleet-kpi strong,
html[data-theme="dark"] .fleet-panel-heading h5 {
    color: var(--bps-text-primary) !important;
}

html[data-theme="dark"] .fleet-snapshot,
html[data-theme="dark"] .fleet-kpi,
html[data-theme="dark"] .fleet-status-filters,
html[data-theme="dark"] .fleet-tabs .nav-link,
html[data-theme="dark"] .fleet-panel,
html[data-theme="dark"] .fleet-panel-heading {
    color: var(--bps-text-secondary) !important;
    border-color: var(--bps-border-subtle) !important;
    background: var(--bps-bg-surface) !important;
}

html[data-theme="dark"] .fleet-mode-selector,
html[data-theme="dark"] .fleet-panel-heading {
    background: var(--bps-bg-subtle) !important;
}

html[data-theme="dark"] .fleet-mode-label,
html[data-theme="dark"] .fleet-mode-btn,
html[data-theme="dark"] .fleet-filter-field label,
html[data-theme="dark"] .fleet-panel-heading span,
html[data-theme="dark"] .fleet-kpi span {
    color: var(--bps-text-secondary) !important;
}

html[data-theme="dark"] .fleet-mode-btn.active,
html[data-theme="dark"] .fleet-tabs .nav-link.active {
    color: #ffffff !important;
    border-color: var(--bps-primary) !important;
    background: var(--bps-primary) !important;
}

html[data-theme="dark"] .fleet-panel .table th {
    color: var(--bps-text-secondary) !important;
    background: var(--bps-bg-subtle) !important;
}

html[data-theme="dark"] .fleet-panel .table td {
    color: var(--bps-text-secondary) !important;
}

html[data-theme="dark"] .cot-page {
    color: var(--bps-text-secondary) !important;
    background: var(--bps-bg-app) !important;
}

html[data-theme="dark"] .cot-head,
html[data-theme="dark"] .cot-kpi,
html[data-theme="dark"] .cot-tab,
html[data-theme="dark"] .cot-panel,
html[data-theme="dark"] .cot-btn,
html[data-theme="dark"] .cot-dialog,
html[data-theme="dark"] .cot-drop,
html[data-theme="dark"] .cot-summary-box,
html[data-theme="dark"] .cot-summary-route {
    color: var(--bps-text-secondary) !important;
    border-color: var(--bps-border-subtle) !important;
    background: var(--bps-bg-surface) !important;
}

html[data-theme="dark"] .cot-title,
html[data-theme="dark"] .cot-kpi strong,
html[data-theme="dark"] .cot-totalbar,
html[data-theme="dark"] .cot-summary-box strong,
html[data-theme="dark"] .cot-mini-title {
    color: var(--bps-text-primary) !important;
}

html[data-theme="dark"] .cot-tab.active,
html[data-theme="dark"] .cot-btn.primary,
html[data-theme="dark"] .cot-btn.blue,
html[data-theme="dark"] .cot-btn.green,
html[data-theme="dark"] .cot-btn.amber,
html[data-theme="dark"] .cot-btn.red {
    color: #ffffff !important;
}

html[data-theme="dark"] .cot-table th,
html[data-theme="dark"] .cot-summary-box,
html[data-theme="dark"] .cot-drop {
    color: var(--bps-text-secondary) !important;
    border-color: var(--bps-border-subtle) !important;
    background: var(--bps-bg-subtle) !important;
}

html[data-theme="dark"] .cot-table td {
    color: var(--bps-text-secondary) !important;
    border-color: var(--bps-border-subtle) !important;
}

html[data-theme="dark"] .tab-content {
    color: var(--bps-text-secondary);
    border-color: var(--bps-border-subtle) !important;
    background-color: var(--bps-bg-surface) !important;
}

/*
 * Normalización de vistas legacy con estilos embebidos.
 * Estas reglas permanecen al final de la cascada para impedir superficies
 * blancas y textos de paleta clara dentro del tema oscuro.
 */
html[data-theme="dark"] .import-panel,
html[data-theme="dark"] .clock-panel,
html[data-theme="dark"] .clock-chip,
html[data-theme="dark"] .clock-next-action,
html[data-theme="dark"] .clock-detail-item,
html[data-theme="dark"] .clock-scanner,
html[data-theme="dark"] .import-stat,
html[data-theme="dark"] .import-table,
html[data-theme="dark"] .import-type-card,
html[data-theme="dark"] .content-wrapper .panel,
html[data-theme="dark"] .content-wrapper .well,
html[data-theme="dark"] .content-wrapper .box {
    color: var(--bps-text-secondary) !important;
    border-color: var(--bps-border-subtle) !important;
    background: var(--bps-bg-surface) !important;
    background-image: none !important;
    box-shadow: var(--bps-shadow-sm) !important;
}

html[data-theme="dark"] .import-panel-header,
html[data-theme="dark"] .clock-panel-heading,
html[data-theme="dark"] .clock-mode,
html[data-theme="dark"] .import-table th,
html[data-theme="dark"] .clock-records-table th {
    color: var(--bps-text-secondary) !important;
    border-color: var(--bps-border-subtle) !important;
    background: var(--bps-bg-subtle) !important;
}

html[data-theme="dark"] .import-type-card:has(input:checked),
html[data-theme="dark"] .clock-mode button:not(.active):hover {
    color: #ffffff !important;
    border-color: var(--bps-primary) !important;
    background: rgba(var(--bps-primary-rgb), 0.2) !important;
}

html[data-theme="dark"] .content-wrapper h1,
html[data-theme="dark"] .content-wrapper h2,
html[data-theme="dark"] .content-wrapper h3,
html[data-theme="dark"] .content-wrapper h4,
html[data-theme="dark"] .content-wrapper h5,
html[data-theme="dark"] .content-wrapper h6,
html[data-theme="dark"] .page-title,
html[data-theme="dark"] [class$="-title"],
html[data-theme="dark"] [class$="-name"],
html[data-theme="dark"] .import-type-card strong,
html[data-theme="dark"] .import-stat strong,
html[data-theme="dark"] .clock-next-action strong,
html[data-theme="dark"] .clock-detail-item strong {
    color: var(--bps-text-primary) !important;
}

html[data-theme="dark"] .content-wrapper p,
html[data-theme="dark"] .content-wrapper label,
html[data-theme="dark"] [class$="-subtitle"],
html[data-theme="dark"] [class$="-help"],
html[data-theme="dark"] [class$="-meta"],
html[data-theme="dark"] .clock-panel-heading span,
html[data-theme="dark"] .clock-placeholder,
html[data-theme="dark"] .clock-records-empty,
html[data-theme="dark"] .import-type-card span,
html[data-theme="dark"] .import-stat span,
html[data-theme="dark"] .import-table td,
html[data-theme="dark"] .clock-records-table td {
    color: var(--bps-text-muted) !important;
}

html[data-theme="dark"] .page-kicker,
html[data-theme="dark"] [class$="-kicker"],
html[data-theme="dark"] [class$="-eyebrow"] {
    color: #8fa2ff !important;
}

html[data-theme="dark"] .choices__placeholder,
html[data-theme="dark"] .select2-selection__placeholder,
html[data-theme="dark"] .choices__input,
html[data-theme="dark"] .choices__list--single,
html[data-theme="dark"] .choices__item--choice,
html[data-theme="dark"] .select2-selection__rendered {
    color: var(--bps-text-muted) !important;
    opacity: 1 !important;
}

html[data-theme="dark"] .btn-outline-secondary,
html[data-theme="dark"] .btn-outline-dark {
    color: var(--bps-text-secondary) !important;
    border-color: var(--bps-border-strong) !important;
    background: var(--bps-bg-surface) !important;
}

html[data-theme="dark"] .btn-outline-secondary:hover,
html[data-theme="dark"] .btn-outline-dark:hover {
    color: #ffffff !important;
    border-color: var(--bps-primary) !important;
    background: rgba(var(--bps-primary-rgb), 0.2) !important;
}

/* Superficies operativas legacy que no heredan .card/.panel de Bootstrap. */
html[data-theme="dark"] .content-wrapper > .container-fluid,
html[data-theme="dark"] .bps-form-toolbar,
html[data-theme="dark"] .bps-form-panel,
html[data-theme="dark"] .metric,
html[data-theme="dark"] .predespacho-shell,
html[data-theme="dark"] .predespacho-kpi,
html[data-theme="dark"] #accordionCliente,
html[data-theme="dark"] .guia-form-actions,
html[data-theme="dark"] .bps-system-state__card,
html[data-theme="dark"] .bps-system-state__notice,
html[data-theme="dark"] .entregas-panel,
html[data-theme="dark"] .base-summary__item,
html[data-theme="dark"] .base-empty,
html[data-theme="dark"] .rendicion-card-header,
html[data-theme="dark"] .aprobacion-metric,
html[data-theme="dark"] .aprobacion-card-header,
html[data-theme="dark"] .aprobacion-filter-panel,
html[data-theme="dark"] .aprobacion-actions,
html[data-theme="dark"] .lotes-card-header,
html[data-theme="dark"] .lotes-toolbar,
html[data-theme="dark"] .sat-metric,
html[data-theme="dark"] .asignacion-metric,
html[data-theme="dark"] .asignacion-card-header,
html[data-theme="dark"] .asignacion-toolbar,
html[data-theme="dark"] .gate-header,
html[data-theme="dark"] .gate-mode,
html[data-theme="dark"] .people-kpi,
html[data-theme="dark"] .transportistas-card,
html[data-theme="dark"] .transportistas-panel,
html[data-theme="dark"] .carrier-card,
html[data-theme="dark"] .carrier-panel,
html[data-theme="dark"] .liq-card,
html[data-theme="dark"] .liq-panel,
html[data-theme="dark"] #form-filtros,
html[data-theme="dark"] .nomina-hero,
html[data-theme="dark"] .nomina-stat,
html[data-theme="dark"] .documental-filter-panel,
html[data-theme="dark"] .maintenance-header,
html[data-theme="dark"] .maintenance-filter-panel {
    color: var(--bps-text-secondary) !important;
    border-color: var(--bps-border-subtle) !important;
    background: var(--bps-bg-surface) !important;
    background-image: none !important;
}

html[data-theme="dark"] .base-summary__item,
html[data-theme="dark"] .base-empty,
html[data-theme="dark"] .bps-system-state__notice,
html[data-theme="dark"] .rendicion-card-header,
html[data-theme="dark"] .aprobacion-card-header,
html[data-theme="dark"] .lotes-card-header,
html[data-theme="dark"] .asignacion-card-header,
html[data-theme="dark"] .gate-header,
html[data-theme="dark"] .gate-mode,
html[data-theme="dark"] .documental-filter-panel,
html[data-theme="dark"] .maintenance-filter-panel {
    background: var(--bps-bg-subtle) !important;
}

html[data-theme="dark"] #cantidad_guias_seleccionadas {
    color: var(--bps-text-primary) !important;
    border-color: var(--bps-border-strong) !important;
    background: var(--bps-bg-subtle) !important;
}

html[data-theme="dark"] :is(
    .bps-form-toolbar,
    .bps-form-panel,
    .metric,
    .predespacho-shell,
    .predespacho-kpi,
    #accordionCliente,
    .guia-form-actions,
    .bps-system-state__card,
    .bps-system-state__notice,
    .entregas-panel,
    .base-summary__item,
    .base-empty,
    .rendicion-card-header,
    .aprobacion-metric,
    .aprobacion-card-header,
    .aprobacion-filter-panel,
    .aprobacion-actions,
    .lotes-card-header,
    .lotes-toolbar,
    .sat-metric,
    .asignacion-metric,
    .asignacion-card-header,
    .asignacion-toolbar,
    .gate-header,
    .gate-mode,
    .people-kpi,
    .transportistas-card,
    .transportistas-panel,
    .carrier-card,
    .carrier-panel,
    .liq-card,
    .liq-panel,
    #form-filtros,
    .nomina-hero,
    .nomina-stat,
    .documental-filter-panel,
    .maintenance-header,
    .maintenance-filter-panel
) :is(p, span, label, small, td, th) {
    color: var(--bps-text-muted) !important;
}

html[data-theme="dark"] .content-wrapper :is(button, a)[class$="-tab"]:not(.active) {
    color: var(--bps-text-secondary) !important;
    border-color: var(--bps-border-strong) !important;
    background: var(--bps-bg-surface) !important;
    background-image: none !important;
}

html[data-theme="dark"] .content-wrapper :is(button, a)[class$="-tab"].active {
    color: #ffffff !important;
    border-color: var(--bps-primary) !important;
    background: var(--bps-primary) !important;
}

html[data-theme="dark"] .people-mode-label {
    color: var(--bps-text-muted) !important;
}

html[data-theme="dark"] .gate-upload,
html[data-theme="dark"] .gate-check {
    color: var(--bps-text-secondary) !important;
    border-color: var(--bps-border-strong) !important;
    background: var(--bps-bg-surface) !important;
}

html[data-theme="dark"] .bps-section-heading span {
    color: var(--bps-text-primary) !important;
}

html[data-theme="dark"] .guia-page-breadcrumb span,
html[data-theme="dark"] .sku-table-toolbar span,
html[data-theme="dark"] .moviles-panel-heading span,
html[data-theme="dark"] .movil-fecha-baja {
    color: var(--bps-text-muted) !important;
}

html[data-theme="dark"] :is(
    .bps-form-toolbar,
    .bps-form-panel,
    .metric,
    .predespacho-shell,
    .predespacho-kpi,
    #accordionCliente,
    .guia-form-actions,
    .bps-system-state__card,
    .entregas-panel,
    .base-summary__item,
    .rendicion-card-header,
    .aprobacion-metric,
    .lotes-card-header,
    .sat-metric,
    .asignacion-metric,
    .gate-header,
    .people-kpi,
    .transportistas-card,
    .carrier-card,
    .liq-card,
    .nomina-hero,
    .nomina-stat,
    .maintenance-header
) :is(h1, h2, h3, h4, h5, h6, strong) {
    color: var(--bps-text-primary) !important;
}

html[data-theme="dark"] .wms-kpi__unit,
html[data-theme="dark"] .wms-kpi__hint,
html[data-theme="dark"] .aprobacion-empty-hint,
html[data-theme="dark"] .people-snapshot,
html[data-theme="dark"] .mq-advanced-hint,
html[data-theme="dark"] .maintenance-kpi-filter-label {
    color: var(--bps-text-muted) !important;
}

/* Convención transversal para contenedores con nomenclatura propia de módulos. */
html[data-theme="dark"] .content-wrapper :is(div, section, article, form)[class*="-panel"],
html[data-theme="dark"] .content-wrapper :is(div, section, article)[class*="-card"],
html[data-theme="dark"] .content-wrapper :is(div, section, form)[class*="-toolbar"],
html[data-theme="dark"] .content-wrapper :is(div, section)[class*="-filters"],
html[data-theme="dark"] .content-wrapper :is(div, section)[class*="-summary"],
html[data-theme="dark"] #formFiltrosRecibidas,
html[data-theme="dark"] #panel-egreso-guia,
html[data-theme="dark"] #tab-novedades,
html[data-theme="dark"] .sat-panel,
html[data-theme="dark"] .gate-scan-card,
html[data-theme="dark"] .gate-summary,
html[data-theme="dark"] .people-status-filters,
html[data-theme="dark"] .people-mode-selector,
html[data-theme="dark"] .people-panel {
    color: var(--bps-text-secondary) !important;
    border-color: var(--bps-border-subtle) !important;
    background: var(--bps-bg-surface) !important;
    background-image: none !important;
}

html[data-theme="dark"] .content-wrapper :is(div, section, article)[class*="-header"],
html[data-theme="dark"] .content-wrapper :is(div, section)[class*="-summary"] {
    border-color: var(--bps-border-subtle) !important;
    background: var(--bps-bg-surface) !important;
}

html[data-theme="dark"] :is([class*="-metric"], [class*="-kpi"], [class*="-summary"]) :is(span, small, label),
html[data-theme="dark"] :is(.gate-summary, .people-panel, .sat-panel) :is(span, small, label),
html[data-theme="dark"] .nomina-tab,
html[data-theme="dark"] #tab-novedades th {
    color: var(--bps-text-muted) !important;
}

html[data-theme="dark"] :is([class*="-metric"], [class*="-kpi"], [class*="-summary"]) :is(strong, h1, h2, h3, h4, h5, h6),
html[data-theme="dark"] :is(.gate-summary, .people-panel, .sat-panel) :is(strong, h1, h2, h3, h4, h5, h6) {
    color: var(--bps-text-primary) !important;
}

html[data-theme="dark"] .nomina-tab {
    border-color: var(--bps-border-strong) !important;
    background: var(--bps-bg-surface) !important;
}

html[data-theme="dark"] .nomina-tab.active {
    color: #ffffff !important;
    border-color: var(--bps-primary) !important;
    background: var(--bps-primary) !important;
}

html[data-theme="dark"] .content-wrapper :is(div, section)[class$="-page"],
html[data-theme="dark"] .arca-shell,
html[data-theme="dark"] .fondos-page,
html[data-theme="dark"] .prov-page,
html[data-theme="dark"] #prov-notas-page,
html[data-theme="dark"] .portal-control-page,
html[data-theme="dark"] .ins-page {
    color: var(--bps-text-secondary) !important;
    background: var(--bps-bg-app) !important;
    background-image: none !important;
}

html[data-theme="dark"] .content-wrapper :is(div, section, article)[class$="-hero"],
html[data-theme="dark"] .content-wrapper :is(div, section, article)[class$="-kpi"],
html[data-theme="dark"] .arca-help,
html[data-theme="dark"] .cuentas-hero,
html[data-theme="dark"] .empresa-chip,
html[data-theme="dark"] .empresa-branding-section {
    color: var(--bps-text-secondary) !important;
    border-color: var(--bps-border-subtle) !important;
    background: var(--bps-bg-surface) !important;
    background-image: none !important;
    box-shadow: var(--bps-shadow-sm) !important;
}

html[data-theme="dark"] :is(
    .fondos-page,
    .prov-page,
    #prov-notas-page,
    .portal-control-page,
    .ins-page,
    .arca-shell,
    .cuentas-hero,
    .empresa-branding-section
) :is(h1, h2, h3, h4, h5, h6, strong) {
    color: var(--bps-text-primary) !important;
}

html[data-theme="dark"] :is(
    .fondos-page,
    .prov-page,
    #prov-notas-page,
    .portal-control-page,
    .ins-page,
    .arca-shell,
    .cuentas-hero,
    .empresa-branding-section
) :is(p, span, label, small, th, td) {
    color: var(--bps-text-muted) !important;
}

@media screen and (min-width: 992px) and (max-width: 1499.98px) {
    .fleet-status-filter-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }

    .fleet-filter-actions.is-status {
        grid-column: 1 / -1;
    }
}

html[data-theme="dark"] .apexcharts-canvas text,
html[data-theme="dark"] .apexcharts-legend-text,
html[data-theme="dark"] .apexcharts-text,
html[data-theme="dark"] svg text {
    fill: var(--bps-text-secondary) !important;
    color: var(--bps-text-secondary) !important;
}

html[data-theme="dark"] .apexcharts-gridline,
html[data-theme="dark"] .apexcharts-xaxis line,
html[data-theme="dark"] .apexcharts-yaxis line {
    stroke: var(--bps-border-subtle) !important;
}

html[data-theme="dark"] .apexcharts-tooltip,
html[data-theme="dark"] .apexcharts-tooltip-title {
    color: var(--bps-text-primary) !important;
    border-color: var(--bps-border-strong) !important;
    background: var(--bps-bg-surface) !important;
}

html[data-theme="dark"] .flatpickr-calendar,
html[data-theme="dark"] .flatpickr-months,
html[data-theme="dark"] .flatpickr-weekdays,
html[data-theme="dark"] .flatpickr-days {
    color: var(--bps-text-primary);
    border-color: var(--bps-border-subtle);
    background: var(--bps-bg-surface);
}

html[data-theme="dark"] .alert-light,
html[data-theme="dark"] .alert-secondary {
    color: var(--bps-text-secondary);
    border-color: var(--bps-border-strong);
    background: var(--bps-bg-subtle);
}

@media (max-width: 1199.98px) {
    .bps-nav-theme {
        width: 36px;
        padding: 0;
    }

    .bps-nav-theme-label {
        display: none;
    }
}

@media print {
    html[data-theme="dark"],
    html[data-theme="dark"] body {
        color-scheme: light;
        color: #111827 !important;
        background: #ffffff !important;
    }
}
