/**
 * Tema oscuro — capa sobre theme-modern.css (variables --rb-*).
 * Activado con <html data-theme="dark"> (ver theme-toggle.js y script en base.html).
 */

html[data-theme='dark'] {
    color-scheme: dark;
    --rb-bg: #0b1020;
    --rb-surface: #141c2f;
    --rb-primary: #8b9cff;
    --rb-primary-hover: #aab8ff;
    --rb-primary-soft: rgba(139, 156, 255, 0.18);
    --rb-accent: #38bdf8;
    --rb-text: #e8edf7;
    --rb-text-muted: #94a3c8;
    --rb-border: #273454;
    --rb-radius: 0.85rem;
    --rb-radius-sm: 0.5rem;
    --rb-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
    --rb-shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.55);
}

html[data-theme='dark'] body {
    background-color: var(--rb-bg) !important;
    color: var(--rb-text);
}

/*
 * Bootstrap: utilidades que por defecto son blancas / gris muy claro
 * (p. ej. portal técnico recepción: formularios con .bg-light, galerías .img-thumbnail).
 */
html[data-theme='dark'] .bg-light {
    background-color: #1a2438 !important;
    color: var(--rb-text);
}

html[data-theme='dark'] .bg-white {
    background-color: var(--rb-surface) !important;
    color: var(--rb-text);
}

html[data-theme='dark'] .img-thumbnail {
    background-color: #0f1628 !important;
    border-color: var(--rb-border) !important;
}

html[data-theme='dark'] .badge-light {
    background-color: #1a2438 !important;
    color: var(--rb-text) !important;
    border-color: var(--rb-border) !important;
}

html[data-theme='dark'] .badge-secondary {
    background-color: #334155 !important;
    color: #e2e8f0 !important;
}

html[data-theme='dark'] .form-control-file {
    color: var(--rb-text-muted);
}

html[data-theme='dark'] .bg-light.border,
html[data-theme='dark'] .bg-light.rounded {
    border-color: var(--rb-border) !important;
}

/* Recepción / formulario vehículo: valores del panel (evita texto oscuro ilegible sobre .bg-light en oscuro) */
html[data-theme='dark'] .vehicle-detail-panel {
    color: var(--rb-text) !important;
}
html[data-theme='dark'] .vehicle-detail-panel .vehicle-detail-value {
    color: var(--rb-text) !important;
}
html[data-theme='dark'] .vehicle-detail-panel .vehicle-detail-label,
html[data-theme='dark'] .vehicle-detail-panel .text-muted {
    color: var(--rb-text-muted) !important;
}

/* DataTables RowGroup (p. ej. orden de reparación: MANO DE OBRA / REPUESTOS) */
html[data-theme='dark'] table.dataTable tr.dtrg-group td {
    background-color: #1a2438 !important;
    color: var(--rb-text) !important;
    border-color: var(--rb-border) !important;
}

html[data-theme='dark'] table.dataTable tr.dtrg-group.dtrg-level-1 td,
html[data-theme='dark'] table.dataTable tr.dtrg-group.dtrg-level-2 td,
html[data-theme='dark'] table.dataTable tr.dtrg-group.dtrg-level-3 td,
html[data-theme='dark'] table.dataTable tr.dtrg-group.dtrg-level-4 td,
html[data-theme='dark'] table.dataTable tr.dtrg-group.dtrg-level-5 td {
    background-color: #161f30 !important;
    color: var(--rb-text-muted) !important;
}

/* AdminLTE sidebar oscuro: ítem activo en submenú usa fondo casi blanco por defecto */
html[data-theme='dark'] [class*='sidebar-dark-'] .nav-treeview > .nav-item > .nav-link.active,
html[data-theme='dark'] [class*='sidebar-dark-'] .nav-treeview > .nav-item > .nav-link.active:hover,
html[data-theme='dark'] [class*='sidebar-dark-'] .nav-treeview > .nav-item > .nav-link.active:focus {
    background-color: rgba(139, 156, 255, 0.22) !important;
    color: var(--rb-text) !important;
}

html[data-theme='dark'] [class*='sidebar-dark-'] .nav-flat .nav-item .nav-treeview .nav-treeview,
html[data-theme='dark'] [class*='sidebar-dark-'] .nav-flat .nav-item .nav-treeview > .nav-item > .nav-link,
html[data-theme='dark'] [class*='sidebar-dark-'] .nav-flat .nav-item .nav-treeview > .nav-item > .nav-link.active {
    border-color: var(--rb-border) !important;
}

/* Sidebar claro (sidebar-light-*): en modo oscuro unificar con el resto */
html[data-theme='dark'] .main-sidebar[class*='sidebar-light'] {
    background-color: #0d1424 !important;
    color: var(--rb-text);
}

html[data-theme='dark'] .main-sidebar[class*='sidebar-light'] .brand-link {
    color: var(--rb-text) !important;
    border-bottom-color: var(--rb-border) !important;
}

html[data-theme='dark'] .main-sidebar[class*='sidebar-light'] .nav-sidebar > .nav-item > .nav-link,
html[data-theme='dark'] .main-sidebar[class*='sidebar-light'] .nav-header,
html[data-theme='dark'] .main-sidebar[class*='sidebar-light'] .sidebar a {
    color: #e2e8f0 !important;
}

html[data-theme='dark'] .main-sidebar[class*='sidebar-light'] .nav-sidebar > .nav-item.menu-open > .nav-link,
html[data-theme='dark'] .main-sidebar[class*='sidebar-light'] .nav-sidebar > .nav-item:hover > .nav-link {
    background-color: rgba(255, 255, 255, 0.06) !important;
    color: #fff !important;
}

html[data-theme='dark'] .main-sidebar[class*='sidebar-light'] .nav-treeview > .nav-item > .nav-link {
    color: #cbd5e1 !important;
}

html[data-theme='dark'] .main-sidebar[class*='sidebar-light'] .nav-treeview > .nav-item > .nav-link:hover,
html[data-theme='dark'] .main-sidebar[class*='sidebar-light'] .nav-treeview > .nav-item > .nav-link.active {
    background-color: rgba(139, 156, 255, 0.12) !important;
    color: var(--rb-text) !important;
}

/* AdminLTE: unificar cabecera en oscuro (cualquier variante navbar del dashboard) */
html[data-theme='dark'] .main-header {
    background: linear-gradient(180deg, #161f33 0%, #121a2b 100%) !important;
    border-bottom: 1px solid var(--rb-border) !important;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35) !important;
}

html[data-theme='dark'] .main-header .nav-link {
    color: var(--rb-text) !important;
}

html[data-theme='dark'] .main-header .nav-link:hover {
    background: var(--rb-primary-soft) !important;
    color: var(--rb-primary) !important;
}

html[data-theme='dark'] .main-header .navbar-badge {
    box-shadow: 0 0 0 2px var(--rb-surface);
}

html[data-theme='dark'] .main-header.navbar-light .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.35);
}

html[data-theme='dark'] .main-header.navbar-light .navbar-toggler-icon {
    filter: invert(1) brightness(1.05);
}

html[data-theme='dark'] .main-header .brand-text {
    color: var(--rb-text) !important;
}

html[data-theme='dark'] .main-sidebar {
    background-color: #0d1424 !important;
    border-color: var(--rb-border) !important;
}

html[data-theme='dark'] .main-sidebar .brand-link {
    border-bottom-color: var(--rb-border) !important;
}

html[data-theme='dark'] .wrapper,
html[data-theme='dark'] .content-wrapper {
    background: var(--rb-bg) !important;
}

html[data-theme='dark'] .content-header {
    color: var(--rb-text-muted);
}

/* Legacy style.css + theme-modern */
html[data-theme='dark'] .breadcrumb {
    background: var(--rb-surface) !important;
    border-color: var(--rb-border) !important;
    color: var(--rb-text);
}

html[data-theme='dark'] .breadcrumb a {
    color: var(--rb-primary) !important;
}

html[data-theme='dark'] .card .card-header {
    background: linear-gradient(180deg, #1a2438 0%, #151f32 100%) !important;
    border-bottom-color: var(--rb-border) !important;
    color: var(--rb-text);
}

html[data-theme='dark'] .table thead tr {
    background: linear-gradient(180deg, #1c2740 0%, #151f32 100%) !important;
    color: var(--rb-text) !important;
}

html[data-theme='dark'] .table thead th {
    color: var(--rb-text-muted) !important;
    border-color: var(--rb-border) !important;
}

html[data-theme='dark'] .table {
    color: var(--rb-text);
}

html[data-theme='dark'] .table td,
html[data-theme='dark'] .table th {
    border-color: var(--rb-border) !important;
}

html[data-theme='dark'] .table-hover tbody tr:hover {
    background-color: rgba(139, 156, 255, 0.08) !important;
}

html[data-theme='dark'] a.card-icon {
    color: var(--rb-text) !important;
    background: var(--rb-surface) !important;
    border-color: var(--rb-border) !important;
}

html[data-theme='dark'] a.card-icon:hover {
    background: #1c2740 !important;
    border-color: rgba(139, 156, 255, 0.45) !important;
}

html[data-theme='dark'] .card-icon-selected {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.25) 0%, rgba(56, 189, 248, 0.12) 100%) !important;
    border-color: var(--rb-primary) !important;
}

html[data-theme='dark'] .dropdown-menu {
    background: var(--rb-surface) !important;
    border-color: var(--rb-border) !important;
    box-shadow: var(--rb-shadow-lg) !important;
}

html[data-theme='dark'] .dropdown-item {
    color: var(--rb-text);
}

html[data-theme='dark'] .dropdown-item:hover,
html[data-theme='dark'] .dropdown-item:focus {
    background: rgba(139, 156, 255, 0.12) !important;
    color: var(--rb-text);
}

html[data-theme='dark'] .dropdown-header {
    color: var(--rb-text-muted);
    background: transparent;
}

html[data-theme='dark'] .dropdown-divider {
    border-color: var(--rb-border);
}

html[data-theme='dark'] .form-control,
html[data-theme='dark'] .custom-select {
    background-color: #0f1628 !important;
    border-color: var(--rb-border) !important;
    color: var(--rb-text) !important;
}

html[data-theme='dark'] .form-control:focus,
html[data-theme='dark'] .custom-select:focus {
    background-color: #121c30 !important;
    color: var(--rb-text) !important;
}

html[data-theme='dark'] .input-group-text {
    background: #1a2438 !important;
    border-color: var(--rb-border) !important;
    color: var(--rb-text-muted);
}

html[data-theme='dark'] .modal-content {
    background: var(--rb-surface);
    color: var(--rb-text);
    border: 1px solid var(--rb-border);
}

html[data-theme='dark'] .modal-header,
html[data-theme='dark'] .modal-footer {
    border-color: var(--rb-border);
}

html[data-theme='dark'] .close {
    color: var(--rb-text);
    text-shadow: none;
    opacity: 0.85;
}

html[data-theme='dark'] .close:hover {
    color: #fff;
    opacity: 1;
}

html[data-theme='dark'] .nav-tabs .nav-link {
    color: var(--rb-text-muted) !important;
    background: transparent !important;
}

html[data-theme='dark'] .nav-tabs .nav-link.active {
    color: var(--rb-primary) !important;
    background: var(--rb-surface) !important;
    border-color: var(--rb-border) var(--rb-border) var(--rb-surface) !important;
}

html[data-theme='dark'] .list-group-item {
    background: var(--rb-surface);
    border-color: var(--rb-border);
    color: var(--rb-text);
}

html[data-theme='dark'] .list-group-item-action:hover {
    background: rgba(139, 156, 255, 0.08);
}

html[data-theme='dark'] .text-dark {
    color: var(--rb-text) !important;
}

html[data-theme='dark'] .border,
html[data-theme='dark'] .border-top,
html[data-theme='dark'] .border-bottom {
    border-color: var(--rb-border) !important;
}

/* Select2 bootstrap4 */
html[data-theme='dark'] .select2-container--bootstrap4 .select2-selection {
    background-color: #0f1628 !important;
    border-color: var(--rb-border) !important;
    color: var(--rb-text) !important;
}

html[data-theme='dark'] .select2-container--bootstrap4 .select2-selection__rendered {
    color: var(--rb-text) !important;
}

html[data-theme='dark'] .select2-dropdown {
    background-color: var(--rb-surface) !important;
    border-color: var(--rb-border) !important;
}

html[data-theme='dark'] .select2-container--bootstrap4 .select2-results__option {
    color: var(--rb-text);
}

/* bootstrap4 usa #f2f2f2 en .select2-dropdown …[aria-selected="true"] (más específico que reglas sin .select2-dropdown) */
html[data-theme='dark'] .select2-container--bootstrap4 .select2-dropdown .select2-results__option[aria-selected='true'] {
    background-color: rgba(139, 156, 255, 0.12) !important;
    color: var(--rb-text) !important;
}

html[data-theme='dark'] .select2-container--bootstrap4 .select2-dropdown .select2-results__option--highlighted,
html[data-theme='dark']
    .select2-container--bootstrap4
    .select2-dropdown
    .select2-results__option--highlighted.select2-results__option[aria-selected='true'] {
    background-color: rgba(139, 156, 255, 0.28) !important;
    color: var(--rb-text) !important;
}

/* bootstrap-daterangepicker (color: inherit + fondo #fff = texto invisible en oscuro) */
html[data-theme='dark'] .daterangepicker {
    background-color: var(--rb-surface) !important;
    border-color: var(--rb-border) !important;
    color: var(--rb-text) !important;
}

html[data-theme='dark'] .daterangepicker:before {
    border-bottom-color: var(--rb-border) !important;
}

html[data-theme='dark'] .daterangepicker:after {
    border-bottom-color: var(--rb-surface) !important;
}

html[data-theme='dark'] .daterangepicker.drop-up:before {
    border-top-color: var(--rb-border) !important;
}

html[data-theme='dark'] .daterangepicker.drop-up:after {
    border-top-color: var(--rb-surface) !important;
}

html[data-theme='dark'] .daterangepicker .calendar-table {
    background-color: var(--rb-surface) !important;
    border-color: var(--rb-border) !important;
}

html[data-theme='dark'] .daterangepicker .calendar-table th,
html[data-theme='dark'] .daterangepicker .calendar-table td {
    color: var(--rb-text) !important;
}

html[data-theme='dark'] .daterangepicker .calendar-table thead tr:nth-child(2) th {
    color: var(--rb-text-muted) !important;
}

html[data-theme='dark'] .daterangepicker .calendar-table .next span,
html[data-theme='dark'] .daterangepicker .calendar-table .prev span {
    border-color: var(--rb-text-muted) !important;
}

html[data-theme='dark'] .daterangepicker td.available:hover,
html[data-theme='dark'] .daterangepicker th.available:hover {
    background-color: rgba(139, 156, 255, 0.18) !important;
    color: var(--rb-text) !important;
}

html[data-theme='dark'] .daterangepicker td.off,
html[data-theme='dark'] .daterangepicker td.off.in-range,
html[data-theme='dark'] .daterangepicker td.off.start-date,
html[data-theme='dark'] .daterangepicker td.off.end-date {
    background-color: var(--rb-surface) !important;
    color: var(--rb-text-muted) !important;
}

html[data-theme='dark'] .daterangepicker td.in-range {
    background-color: rgba(139, 156, 255, 0.22) !important;
    color: var(--rb-text) !important;
}

html[data-theme='dark'] .daterangepicker td.active,
html[data-theme='dark'] .daterangepicker td.active:hover {
    background-color: #5b6fd6 !important;
    color: #fff !important;
}

html[data-theme='dark'] .daterangepicker td.disabled,
html[data-theme='dark'] .daterangepicker option.disabled {
    color: var(--rb-text-muted) !important;
}

html[data-theme='dark'] .daterangepicker td.week,
html[data-theme='dark'] .daterangepicker th.week {
    color: var(--rb-text-muted) !important;
}

html[data-theme='dark'] .daterangepicker select.monthselect,
html[data-theme='dark'] .daterangepicker select.yearselect {
    background-color: #0f1628 !important;
    color: var(--rb-text) !important;
    border: 1px solid var(--rb-border) !important;
}

html[data-theme='dark'] .daterangepicker select.hourselect,
html[data-theme='dark'] .daterangepicker select.minuteselect,
html[data-theme='dark'] .daterangepicker select.secondselect,
html[data-theme='dark'] .daterangepicker select.ampmselect {
    background-color: #0f1628 !important;
    color: var(--rb-text) !important;
    border-color: var(--rb-border) !important;
}

html[data-theme='dark'] .daterangepicker .drp-buttons {
    border-top-color: var(--rb-border) !important;
    background-color: var(--rb-surface) !important;
}

html[data-theme='dark'] .daterangepicker .drp-selected {
    color: var(--rb-text-muted) !important;
}

html[data-theme='dark'] .daterangepicker .ranges li {
    color: var(--rb-text) !important;
}

html[data-theme='dark'] .daterangepicker .ranges li:hover {
    background-color: rgba(139, 156, 255, 0.12) !important;
}

html[data-theme='dark'] .daterangepicker .ranges li.active {
    background-color: #5b6fd6 !important;
    color: #fff !important;
}

html[data-theme='dark'] .daterangepicker.show-ranges.single.rtl .drp-calendar.left,
html[data-theme='dark'] .daterangepicker.show-ranges.single.ltr .drp-calendar.left,
html[data-theme='dark'] .daterangepicker.show-ranges.rtl .drp-calendar.right,
html[data-theme='dark'] .daterangepicker.show-ranges.ltr .drp-calendar.left {
    border-color: var(--rb-border) !important;
}

/* jQuery UI autocomplete (búsqueda de productos en cotización, venta, OR, etc.) */
html[data-theme='dark'] ul.ui-autocomplete.ui-widget-content,
html[data-theme='dark'] .ui-autocomplete.ui-widget-content {
    background: var(--rb-surface) !important;
    border: 1px solid var(--rb-border) !important;
    color: var(--rb-text) !important;
    box-shadow: var(--rb-shadow);
}

html[data-theme='dark'] .ui-autocomplete .ui-menu-item-wrapper {
    color: var(--rb-text) !important;
    border-color: transparent !important;
    background: transparent !important;
}

html[data-theme='dark'] .ui-autocomplete .ui-menu-item-wrapper.ui-state-active,
html[data-theme='dark'] .ui-autocomplete .ui-menu-item-wrapper.ui-state-focus,
html[data-theme='dark'] .ui-autocomplete .ui-menu-item-wrapper.ui-state-hover {
    background: rgba(139, 156, 255, 0.22) !important;
    border-color: transparent !important;
    color: var(--rb-text) !important;
}

/* bootstrap-tagsinput (cliente: campo Emails; fondo #fff en la librería) */
html[data-theme='dark'] .bootstrap-tagsinput {
    background-color: #0f1628 !important;
    border-color: var(--rb-border) !important;
    color: var(--rb-text) !important;
    box-shadow: none !important;
}

html[data-theme='dark'] .bootstrap-tagsinput input {
    color: var(--rb-text) !important;
}

html[data-theme='dark'] .bootstrap-tagsinput input::placeholder {
    color: var(--rb-text-muted) !important;
    opacity: 1;
}

html[data-theme='dark'] .bootstrap-tagsinput .badge {
    background-color: rgba(139, 156, 255, 0.25) !important;
    color: var(--rb-text) !important;
    border: 1px solid var(--rb-border);
}

html[data-theme='dark'] .bootstrap-tagsinput .badge [data-role='remove']:after {
    background-color: rgba(255, 255, 255, 0.12) !important;
    color: var(--rb-text);
}

html[data-theme='dark'] .bootstrap-tagsinput .badge [data-role='remove']:hover:after {
    background-color: rgba(255, 255, 255, 0.22) !important;
    color: #fff;
}

html[data-theme='dark'] .tt-menu {
    background-color: var(--rb-surface) !important;
    border: 1px solid var(--rb-border) !important;
    box-shadow: var(--rb-shadow);
}

html[data-theme='dark'] .tt-suggestion {
    color: var(--rb-text) !important;
}

html[data-theme='dark'] .tt-suggestion:hover,
html[data-theme='dark'] .tt-suggestion:focus {
    background-color: rgba(139, 156, 255, 0.22) !important;
    color: var(--rb-text) !important;
}

/* SweetAlert2 */
html[data-theme='dark'] .swal2-popup {
    background: var(--rb-surface) !important;
    color: var(--rb-text) !important;
}

html[data-theme='dark'] .swal2-title {
    color: var(--rb-text) !important;
}

html[data-theme='dark'] .swal2-html-container {
    color: var(--rb-text) !important;
}

html[data-theme='dark'] .swal2-styled.swal2-confirm {
    background-color: var(--rb-primary) !important;
}

html[data-theme='dark'] .swal2-styled.swal2-cancel {
    background-color: #3d4a63 !important;
    color: #e8edf7 !important;
}

/* jquery-confirm (material theme usa .jconfirm-content, no div.content) */
html[data-theme='dark'] .jconfirm .jconfirm-box {
    background: var(--rb-surface) !important;
    color: var(--rb-text) !important;
    border-color: var(--rb-border) !important;
}

html[data-theme='dark'] .jconfirm .jconfirm-box .title,
html[data-theme='dark'] .jconfirm.jconfirm-material .jconfirm-box div.jconfirm-title-c,
html[data-theme='dark'] .jconfirm.jconfirm-material .jconfirm-box div.jconfirm-title-c .title {
    color: var(--rb-text) !important;
}

html[data-theme='dark'] .jconfirm.jconfirm-material .jconfirm-box div.jconfirm-title-c .jconfirm-icon-c i {
    color: var(--rb-text) !important;
}

html[data-theme='dark'] .jconfirm.jconfirm-material .jconfirm-box div.jconfirm-closeIcon {
    color: var(--rb-text-muted) !important;
}

html[data-theme='dark'] .jconfirm .jconfirm-box div.content,
html[data-theme='dark'] .jconfirm.jconfirm-material .jconfirm-box div.jconfirm-content {
    color: var(--rb-text) !important;
}

/* DataTables */
html[data-theme='dark'] .dataTables_wrapper .dataTables_length,
html[data-theme='dark'] .dataTables_wrapper .dataTables_filter,
html[data-theme='dark'] .dataTables_wrapper .dataTables_info,
html[data-theme='dark'] .dataTables_wrapper .dataTables_processing,
html[data-theme='dark'] .dataTables_wrapper .dataTables_paginate {
    color: var(--rb-text-muted) !important;
}

html[data-theme='dark'] .page-item .page-link {
    background-color: var(--rb-surface);
    border-color: var(--rb-border);
    color: var(--rb-text);
}

html[data-theme='dark'] .page-item.disabled .page-link {
    background-color: #0f1628;
    color: var(--rb-text-muted);
}

/* jQuery UI datepicker */
html[data-theme='dark'] .ui-datepicker {
    background: var(--rb-surface);
    border-color: var(--rb-border);
    color: var(--rb-text);
}

html[data-theme='dark'] .ui-datepicker-header {
    background: #1a2438;
    color: var(--rb-text);
    border-color: var(--rb-border);
}

html[data-theme='dark'] .ui-state-default,
html[data-theme='dark'] .ui-widget-content .ui-state-default {
    background: #0f1628;
    border-color: var(--rb-border);
    color: var(--rb-text);
}

html[data-theme='dark'] .ui-state-hover,
html[data-theme='dark'] .ui-state-active {
    background: rgba(139, 156, 255, 0.2) !important;
    color: var(--rb-text) !important;
}

/*
 * Tempus Dominus (tempusdominus-bootstrap-4) — .bootstrap-datetimepicker-widget
 * El CSS por defecto fuerza fondo claro (#fff), azul Bootstrap (#007bff) y hovers #e9ecef;
 * en tema oscuro se ve “otro tema” respecto a cards / Select2 / daterangepicker.
 */
html[data-theme='dark'] .bootstrap-datetimepicker-widget.dropdown-menu {
    background-color: var(--rb-surface) !important;
    border: 1px solid var(--rb-border) !important;
    color: var(--rb-text) !important;
    box-shadow: var(--rb-shadow) !important;
}

html[data-theme='dark'] .bootstrap-datetimepicker-widget.dropdown-menu.bottom:before {
    border-bottom-color: var(--rb-border) !important;
}

html[data-theme='dark'] .bootstrap-datetimepicker-widget.dropdown-menu.bottom:after {
    border-bottom-color: var(--rb-surface) !important;
}

html[data-theme='dark'] .bootstrap-datetimepicker-widget.dropdown-menu.top:before {
    border-top-color: var(--rb-border) !important;
}

html[data-theme='dark'] .bootstrap-datetimepicker-widget.dropdown-menu.top:after {
    border-top-color: var(--rb-surface) !important;
}

html[data-theme='dark'] .bootstrap-datetimepicker-widget table th,
html[data-theme='dark'] .bootstrap-datetimepicker-widget table td {
    color: var(--rb-text) !important;
}

html[data-theme='dark'] .bootstrap-datetimepicker-widget table thead tr:first-child th:hover {
    background: rgba(139, 156, 255, 0.12) !important;
    color: var(--rb-text) !important;
}

html[data-theme='dark'] .bootstrap-datetimepicker-widget table td.day:hover,
html[data-theme='dark'] .bootstrap-datetimepicker-widget table td.hour:hover,
html[data-theme='dark'] .bootstrap-datetimepicker-widget table td.minute:hover,
html[data-theme='dark'] .bootstrap-datetimepicker-widget table td.second:hover {
    background: rgba(139, 156, 255, 0.18) !important;
    color: var(--rb-text) !important;
}

html[data-theme='dark'] .bootstrap-datetimepicker-widget table td.new,
html[data-theme='dark'] .bootstrap-datetimepicker-widget table td.old {
    color: var(--rb-text-muted) !important;
}

html[data-theme='dark'] .bootstrap-datetimepicker-widget table td.active,
html[data-theme='dark'] .bootstrap-datetimepicker-widget table td.active:hover {
    background-color: #5b6fd6 !important;
    color: #fff !important;
    text-shadow: none !important;
}

html[data-theme='dark'] .bootstrap-datetimepicker-widget table td.today:before {
    border-bottom-color: var(--rb-primary) !important;
}

html[data-theme='dark'] .bootstrap-datetimepicker-widget table td.active.today:before {
    border-bottom-color: #fff !important;
}

html[data-theme='dark'] .bootstrap-datetimepicker-widget table th.disabled,
html[data-theme='dark'] .bootstrap-datetimepicker-widget table th.disabled:hover,
html[data-theme='dark'] .bootstrap-datetimepicker-widget table td.disabled,
html[data-theme='dark'] .bootstrap-datetimepicker-widget table td.disabled:hover {
    color: var(--rb-text-muted) !important;
}

html[data-theme='dark'] .bootstrap-datetimepicker-widget table td.cw {
    color: var(--rb-text-muted) !important;
}

html[data-theme='dark'] .bootstrap-datetimepicker-widget table td span:hover {
    background: rgba(139, 156, 255, 0.18) !important;
}

html[data-theme='dark'] .bootstrap-datetimepicker-widget table td span.active {
    background-color: #5b6fd6 !important;
    color: #fff !important;
    text-shadow: none !important;
}

html[data-theme='dark'] .bootstrap-datetimepicker-widget table td span.old {
    color: var(--rb-text-muted) !important;
}

html[data-theme='dark'] .bootstrap-datetimepicker-widget a[data-action] {
    color: var(--rb-primary) !important;
}

html[data-theme='dark'] .bootstrap-datetimepicker-widget a[data-action]:hover {
    color: var(--rb-primary-hover) !important;
}

html[data-theme='dark'] .bootstrap-datetimepicker-widget .timepicker .timepicker-picker a.btn {
    color: var(--rb-primary) !important;
}

html[data-theme='dark'] .bootstrap-datetimepicker-widget .timepicker .timepicker-picker a.btn:hover {
    color: var(--rb-primary-hover) !important;
}

/* Dashboard KPI boxes */
html[data-theme='dark'] .dashboard-admin .dashboard-kpi {
    background: var(--rb-surface);
    border-color: var(--rb-border);
}

html[data-theme='dark'] .small-box {
    background: var(--rb-surface) !important;
    border: 1px solid var(--rb-border);
}

/*
 * Login: AdminLTE fuerza .login-card-body { background #fff; color #666 }.
 * Con tema oscuro, theme-modern pone título (.login-box-msg) con --rb-text claro → texto invisible sobre blanco.
 */
html[data-theme='dark'] .login-box .card,
html[data-theme='dark'] .register-box .card {
    background: var(--rb-surface);
    border: 1px solid var(--rb-border);
}

html[data-theme='dark'] .login-card-body,
html[data-theme='dark'] .register-card-body {
    background-color: var(--rb-surface) !important;
    border-color: var(--rb-border) !important;
    color: var(--rb-text) !important;
}

html[data-theme='dark'] .login-box-msg,
html[data-theme='dark'] .register-box-msg {
    color: var(--rb-text) !important;
}

html[data-theme='dark'] .login-card-body .form-group label,
html[data-theme='dark'] .register-card-body .form-group label {
    color: var(--rb-text-muted) !important;
}

html[data-theme='dark'] .login-card-body .form-control,
html[data-theme='dark'] .register-card-body .form-control {
    background-color: #0f172a;
    border-color: var(--rb-border);
    color: var(--rb-text);
}

html[data-theme='dark'] .login-card-body .form-control::placeholder,
html[data-theme='dark'] .register-card-body .form-control::placeholder {
    color: var(--rb-text-muted);
    opacity: 0.9;
}

html[data-theme='dark'] .login-card-body .input-group-append .btn,
html[data-theme='dark'] .register-card-body .input-group-append .btn {
    border-color: var(--rb-border);
}

html[data-theme='dark'] .login-page .details,
html[data-theme='dark'] .register-page .details {
    color: var(--rb-text-muted) !important;
}

html[data-theme='dark'] .login-page .details a,
html[data-theme='dark'] .register-page .details a {
    color: var(--rb-accent);
}

html[data-theme='dark'] .btn-outline-secondary,
html[data-theme='dark'] .btn-outline-info {
    color: var(--rb-text-muted);
    border-color: var(--rb-border);
}

html[data-theme='dark'] .btn-outline-secondary:hover,
html[data-theme='dark'] .btn-outline-info:hover {
    background: rgba(139, 156, 255, 0.12);
    color: var(--rb-text);
    border-color: var(--rb-border);
}

html[data-theme='dark'] .alert {
    border-color: var(--rb-border);
}

html[data-theme='dark'] .alert-light,
html[data-theme='dark'] .alert-secondary {
    background: #1a2438;
    color: var(--rb-text);
    border-color: var(--rb-border);
}

html[data-theme='dark'] .tooltip-inner {
    background-color: #1e293b;
    color: var(--rb-text);
}

html[data-theme='dark'] .popover {
    background-color: var(--rb-surface);
    border-color: var(--rb-border);
}

html[data-theme='dark'] .popover-header {
    background: #1a2438;
    border-bottom-color: var(--rb-border);
    color: var(--rb-text);
}

html[data-theme='dark'] .popover-body {
    color: var(--rb-text);
}

/* Highcharts (modo clásico SVG): respaldo sobre atributos fill/stroke */
html[data-theme='dark'] .highcharts-background {
    fill: #141c2f !important;
}

html[data-theme='dark'] .highcharts-plot-background {
    fill: #141c2f !important;
}

html[data-theme='dark'] .highcharts-title {
    fill: #e8edf7 !important;
}

html[data-theme='dark'] .highcharts-subtitle {
    fill: #94a3c8 !important;
}

html[data-theme='dark'] .highcharts-axis-labels text {
    fill: #94a3c8 !important;
}

html[data-theme='dark'] .highcharts-yaxis .highcharts-axis-title,
html[data-theme='dark'] .highcharts-xaxis .highcharts-axis-title {
    fill: #94a3c8 !important;
}

html[data-theme='dark'] .highcharts-grid-line {
    stroke: #273454 !important;
}

html[data-theme='dark'] .highcharts-minor-grid-line {
    stroke: #1e293b !important;
}

html[data-theme='dark'] .highcharts-axis-line,
html[data-theme='dark'] .highcharts-tick {
    stroke: #273454 !important;
}

html[data-theme='dark'] .highcharts-legend-item text {
    fill: #e8edf7 !important;
}

html[data-theme='dark'] .highcharts-credits {
    fill: #64748b !important;
}

html[data-theme='dark'] .highcharts-data-label text {
    fill: #e8edf7 !important;
}

/* Contorno “contrast” de Highcharts: halo claro sobre texto claro en fondo oscuro */
html[data-theme='dark'] .highcharts-data-label .highcharts-text-outline {
    fill: none !important;
    stroke: none !important;
}

html[data-theme='dark'] .highcharts-tooltip-box {
    fill: #1a2438 !important;
    stroke: #273454 !important;
}

/* Agendamiento interno POS (/vehicle/appointment/add/) — wizard .appointment-brand-shell */
html[data-theme='dark'] .appointment-brand-shell {
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: linear-gradient(180deg, #1e293b 0%, #172033 55%, #151c2c 100%);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

html[data-theme='dark'] .appointment-brand-shell .form-group label,
html[data-theme='dark'] .appointment-brand-shell label:not(.custom-control-label) {
    color: #e2e8f0 !important;
}

html[data-theme='dark'] .appointment-brand-shell .form-control,
html[data-theme='dark'] .appointment-brand-shell select.form-control {
    background-color: #0f172a !important;
    color: #f8fafc !important;
    border-color: rgba(148, 163, 184, 0.4) !important;
}

html[data-theme='dark'] .appointment-brand-shell .form-control:focus,
html[data-theme='dark'] .appointment-brand-shell select.form-control:focus {
    border-color: #38bdf8 !important;
    box-shadow: 0 0 0 0.15rem rgba(56, 189, 248, 0.25) !important;
}

html[data-theme='dark'] .appointment-brand-shell .form-control::placeholder {
    color: #64748b !important;
}

html[data-theme='dark'] .appointment-brand-shell select.form-control option {
    background: #1e293b;
    color: #f1f5f9;
}

html[data-theme='dark'] .appointment-brand-shell h5.text-secondary {
    color: #e2e8f0 !important;
    border-bottom-color: rgba(148, 163, 184, 0.35) !important;
}

html[data-theme='dark'] .appointment-brand-shell h5.text-secondary .fas {
    color: #94a3b8;
}

html[data-theme='dark'] .appointment-brand-shell .text-muted {
    color: #94a3b8 !important;
}

html[data-theme='dark'] .appointment-brand-shell .text-danger {
    color: #fca5a5 !important;
}

html[data-theme='dark'] .appointment-brand-title {
    color: #f1f5f9;
}

html[data-theme='dark'] .appointment-brand-title .fa-tools {
    color: #5eead4;
}

html[data-theme='dark'] .appointment-brand-logo {
    border-color: rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.6);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

html[data-theme='dark'] .appointment-step-pill {
    border-color: rgba(148, 163, 184, 0.35);
    color: #cbd5e1;
    background: rgba(15, 23, 42, 0.55);
}

html[data-theme='dark'] .appointment-step-pill.active {
    border-color: #22c55e;
    color: #fff;
    background: linear-gradient(90deg, #0d4a2c 0%, #15803d 50%, #166534 100%);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.25);
}

html[data-theme='dark'] .appointment-brand-shell .appointment-next {
    border-color: #0284c7 !important;
    background: linear-gradient(180deg, #0284c7 0%, #0369a1 100%) !important;
    color: #fff !important;
}

html[data-theme='dark'] .appointment-brand-shell .appointment-next:hover {
    border-color: #38bdf8 !important;
    background: linear-gradient(180deg, #0ea5e9 0%, #0284c7 100%) !important;
    filter: brightness(1.05);
}

html[data-theme='dark'] .appointment-brand-shell .appointment-prev,
html[data-theme='dark'] .appointment-brand-shell .btn-outline-secondary {
    color: #e2e8f0 !important;
    border-color: rgba(148, 163, 184, 0.5) !important;
    background: rgba(15, 23, 42, 0.4) !important;
}

html[data-theme='dark'] .appointment-brand-shell .appointment-prev:hover,
html[data-theme='dark'] .appointment-brand-shell .btn-outline-secondary:hover {
    background: rgba(51, 65, 85, 0.85) !important;
    color: #fff !important;
    border-color: #94a3b8 !important;
}

html[data-theme='dark'] .appointment-brand-shell .btn-outline-success {
    color: #86efac !important;
    border-color: rgba(34, 197, 94, 0.55) !important;
    background: rgba(20, 83, 45, 0.25) !important;
}

html[data-theme='dark'] .appointment-brand-shell .btn-outline-success:hover {
    color: #fff !important;
    background: rgba(22, 101, 52, 0.75) !important;
    border-color: #22c55e !important;
}

html[data-theme='dark'] .appointment-brand-shell input[type='radio'] {
    accent-color: #22c55e;
}

html[data-theme='dark'] .appointment-brand-shell label[for^='id_document_type'],
html[data-theme='dark'] .appointment-brand-shell .form-check-label {
    color: #cbd5e1;
}

html[data-theme='dark'] .appointment-matricula-loading-box {
    border-color: rgba(56, 189, 248, 0.35);
    background: linear-gradient(90deg, rgba(30, 58, 95, 0.55) 0%, rgba(30, 64, 90, 0.45) 100%);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

html[data-theme='dark'] .appointment-matricula-loading-box .text-primary {
    color: #7dd3fc !important;
}

html[data-theme='dark'] .appointment-brand-shell .border-top {
    border-top-color: rgba(148, 163, 184, 0.28) !important;
}

html[data-theme='dark'] .appointment-brand-shell .alert-danger {
    background: rgba(127, 29, 29, 0.45);
    border-color: rgba(248, 113, 113, 0.45);
    color: #fecaca;
}

html[data-theme='dark'] .card.rb-appointment-wizard .card-header .card-title {
    color: var(--rb-text);
}

