/**
 * Capa Materio: barra y menú claros, pastillas activas, KPI suaves.
 * No depende de la piel AdminLTE guardada en Dashboard.
 */
html:not([data-theme='dark']) body {
    background-color: var(--rb-bg) !important;
}

html:not([data-theme='dark']) .wrapper,
html:not([data-theme='dark']) .content-wrapper {
    background-color: var(--rb-bg) !important;
}

/* —— Cabecera blanca (anula navbar-danger / navy / dark) —— */
html:not([data-theme='dark']) .main-header.navbar,
html:not([data-theme='dark']) .main-header.navbar-dark,
html:not([data-theme='dark']) .main-header[class*='navbar-'] {
    background: var(--rb-surface) !important;
    color: var(--rb-text) !important;
    border-bottom: 1px solid var(--rb-border) !important;
    box-shadow: 0 0.125rem 0.5rem rgba(47, 43, 61, 0.06) !important;
}

html:not([data-theme='dark']) .main-header .nav-link,
html:not([data-theme='dark']) .main-header.navbar-dark .navbar-nav .nav-link,
html:not([data-theme='dark']) .main-header.navbar-light .navbar-nav .nav-link {
    color: var(--rb-text-muted) !important;
}

html:not([data-theme='dark']) .main-header .nav-link:hover,
html:not([data-theme='dark']) .main-header.navbar-dark .navbar-nav .nav-link:hover {
    color: var(--rb-primary) !important;
    background: var(--rb-primary-soft) !important;
}

html:not([data-theme='dark']) .main-header .navbar-badge {
    box-shadow: 0 0 0 2px var(--rb-surface);
}

html:not([data-theme='dark']) .main-header.navbar-dark .rb-theme-toggle,
html:not([data-theme='dark']) .main-header.navbar-dark .rb-theme-toggle:hover {
    color: var(--rb-text) !important;
    border-color: var(--rb-border) !important;
    background: rgba(47, 43, 61, 0.04) !important;
}

html:not([data-theme='dark']) .main-header.navbar-dark .rb-theme-toggle:hover {
    color: var(--rb-primary) !important;
    background: var(--rb-primary-soft) !important;
}

/* —— Sidebar blanco + ítem activo en pastilla —— */
html:not([data-theme='dark']) .main-sidebar,
html:not([data-theme='dark']) .main-sidebar[class*='sidebar-'] {
    background-color: var(--rb-surface) !important;
    border-right: 1px solid var(--rb-border) !important;
    box-shadow: 0 0.25rem 1.25rem rgba(47, 43, 61, 0.08);
}

html:not([data-theme='dark']) .main-sidebar .brand-link,
html:not([data-theme='dark']) .main-sidebar[class*='sidebar-'] .brand-link {
    background: transparent !important;
    border-bottom: 1px solid var(--rb-border) !important;
    color: var(--rb-text) !important;
}

html:not([data-theme='dark']) .main-sidebar .brand-link .brand-text,
html:not([data-theme='dark']) .main-sidebar .brand-link .brand-image + .brand-text {
    color: var(--rb-text) !important;
    font-weight: 700 !important;
    letter-spacing: -0.02em;
}

html:not([data-theme='dark']) .main-sidebar .user-panel,
html:not([data-theme='dark']) .main-sidebar[class*='sidebar-'] .user-panel {
    border-bottom: 1px solid var(--rb-border) !important;
}

html:not([data-theme='dark']) .main-sidebar .user-panel .info,
html:not([data-theme='dark']) .main-sidebar .user-panel .info a {
    color: var(--rb-text) !important;
}

html:not([data-theme='dark']) .main-sidebar .nav-header {
    color: var(--rb-text-muted) !important;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

html:not([data-theme='dark']) .main-sidebar .nav-sidebar > .nav-item > .nav-link,
html:not([data-theme='dark']) .main-sidebar[class*='sidebar-'] .nav-sidebar > .nav-item > .nav-link {
    color: var(--rb-text-muted) !important;
    border-radius: 0.5rem !important;
    margin: 0.1rem 0.55rem;
    padding: 0.55rem 0.75rem;
}

html:not([data-theme='dark']) .main-sidebar .nav-sidebar > .nav-item > .nav-link:hover,
html:not([data-theme='dark']) .main-sidebar[class*='sidebar-'] .nav-sidebar > .nav-item > .nav-link:hover {
    background: var(--rb-primary-soft) !important;
    color: var(--rb-primary) !important;
}

html:not([data-theme='dark']) .main-sidebar .nav-sidebar > .nav-item > .nav-link.active,
html:not([data-theme='dark']) .main-sidebar .nav-sidebar > .nav-item.menu-open > .nav-link,
html:not([data-theme='dark']) .main-sidebar[class*='sidebar-'] .nav-sidebar > .nav-item > .nav-link.active,
html:not([data-theme='dark']) .main-sidebar[class*='sidebar-'] .nav-sidebar > .nav-item.menu-open > .nav-link {
    background: var(--rb-primary) !important;
    color: #fff !important;
    box-shadow: 0 0.125rem 0.5rem rgba(115, 103, 240, 0.35);
}

html:not([data-theme='dark']) .main-sidebar .nav-sidebar > .nav-item.menu-open > .nav-link .right,
html:not([data-theme='dark']) .main-sidebar .nav-sidebar > .nav-item > .nav-link.active .right {
    color: #fff !important;
}

html:not([data-theme='dark']) .main-sidebar .nav-treeview > .nav-item > .nav-link,
html:not([data-theme='dark']) .main-sidebar[class*='sidebar-'] .nav-treeview > .nav-item > .nav-link {
    color: var(--rb-text-muted) !important;
    border-radius: 0.45rem !important;
    margin: 0.05rem 0.75rem 0.05rem 1.1rem;
}

html:not([data-theme='dark']) .main-sidebar .nav-treeview > .nav-item > .nav-link:hover {
    background: var(--rb-primary-soft) !important;
    color: var(--rb-primary) !important;
}

html:not([data-theme='dark']) .main-sidebar .nav-treeview > .nav-item > .nav-link.active,
html:not([data-theme='dark']) .main-sidebar[class*='sidebar-'] .nav-treeview > .nav-item > .nav-link.active {
    background: var(--rb-primary-soft) !important;
    color: var(--rb-primary) !important;
    font-weight: 600;
}

html:not([data-theme='dark']) .main-sidebar .nav-sidebar .nav-icon,
html:not([data-theme='dark']) .main-sidebar .nav-sidebar .nav-link p {
    color: inherit !important;
}

/* Sidebar colapsado: pastilla centrada */
@media (min-width: 992px) {
    html:not([data-theme='dark']) body.sidebar-mini.sidebar-collapse .main-sidebar .nav-sidebar > .nav-item > .nav-link {
        margin: 0.15rem 0.4rem;
        justify-content: center;
    }
}

/* —— Tarjetas y KPI —— */
html:not([data-theme='dark']) .card .card-header {
    background: var(--rb-surface) !important;
    color: var(--rb-text) !important;
}

/* AdminLTE: .card-navy/.card-primary > .card-header a { color:#fff } deja botones outline invisibles. */
html:not([data-theme='dark']) .card[class*='card-']:not(.card-outline) > .card-header,
html:not([data-theme='dark']) .card .card-header a:not(.btn) {
    color: var(--rb-text) !important;
}

html:not([data-theme='dark']) .btn-outline-primary {
    color: var(--rb-primary) !important;
    background: #fff !important;
    border-color: var(--rb-primary) !important;
}

html:not([data-theme='dark']) .btn-outline-secondary {
    color: var(--rb-text) !important;
    background: #fff !important;
    border-color: var(--rb-border) !important;
}

html:not([data-theme='dark']) .btn-outline-info {
    color: #0a7a88 !important;
    background: #fff !important;
    border-color: #17a2b8 !important;
}

html:not([data-theme='dark']) .btn-outline-success {
    color: #1b7a3d !important;
    background: #fff !important;
    border-color: #28a745 !important;
}

html:not([data-theme='dark']) .btn-outline-warning {
    color: #8a6a00 !important;
    background: #fff !important;
    border-color: #e0a800 !important;
}

html:not([data-theme='dark']) .btn-outline-danger {
    color: #c82333 !important;
    background: #fff !important;
    border-color: #dc3545 !important;
}

html:not([data-theme='dark']) .btn-outline-primary:hover,
html:not([data-theme='dark']) .btn-outline-primary:focus {
    color: #fff !important;
    background: var(--rb-primary) !important;
}

html:not([data-theme='dark']) .btn-outline-secondary:hover,
html:not([data-theme='dark']) .btn-outline-secondary:focus {
    color: #fff !important;
    background: #5c5968 !important;
    border-color: #5c5968 !important;
}

html:not([data-theme='dark']) .btn-outline-info:hover,
html:not([data-theme='dark']) .btn-outline-success:hover,
html:not([data-theme='dark']) .btn-outline-warning:hover,
html:not([data-theme='dark']) .btn-outline-danger:hover,
html:not([data-theme='dark']) .btn-outline-info:focus,
html:not([data-theme='dark']) .btn-outline-success:focus,
html:not([data-theme='dark']) .btn-outline-warning:focus,
html:not([data-theme='dark']) .btn-outline-danger:focus {
    color: #fff !important;
}

html:not([data-theme='dark']) .btn-outline-warning:hover,
html:not([data-theme='dark']) .btn-outline-warning:focus {
    color: #212529 !important;
    background: #ffc107 !important;
}

html:not([data-theme='dark']) .card .card-header .btn-primary,
html:not([data-theme='dark']) .card .card-header .btn-success,
html:not([data-theme='dark']) .card .card-header .btn-info,
html:not([data-theme='dark']) .card .card-header .btn-danger {
    color: #fff !important;
}

html:not([data-theme='dark']) .card .card-header .btn-warning {
    color: #212529 !important;
}

html:not([data-theme='dark']) .btn-outline-secondary .badge,
html:not([data-theme='dark']) .btn-outline-primary .badge,
html:not([data-theme='dark']) .btn-outline-info .badge,
html:not([data-theme='dark']) .btn-outline-success .badge,
html:not([data-theme='dark']) .btn-outline-warning .badge,
html:not([data-theme='dark']) .btn-outline-danger .badge {
    color: var(--rb-text) !important;
    background: #ececf2 !important;
}

html:not([data-theme='dark']) .btn-primary .badge,
html:not([data-theme='dark']) .btn-success .badge,
html:not([data-theme='dark']) .btn-info .badge,
html:not([data-theme='dark']) .btn-danger .badge {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.22) !important;
}

html:not([data-theme='dark']) .table thead tr {
    background: #f6f6f8 !important;
}

.dashboard-admin .dashboard-kpi {
    border-radius: var(--rb-radius) !important;
    box-shadow: var(--rb-shadow) !important;
}

.dashboard-admin .dashboard-kpi .info-box-icon {
    border-radius: 0.5rem !important;
    margin: 0.85rem 0 0.85rem 0.85rem !important;
    width: 3rem !important;
    height: 3rem !important;
    font-size: 1.15rem !important;
}

.dashboard-admin .dashboard-kpi .info-box-icon.bg-info {
    background: rgba(0, 207, 232, 0.16) !important;
    color: #00cfe8 !important;
}

.dashboard-admin .dashboard-kpi .info-box-icon.bg-success {
    background: rgba(40, 199, 111, 0.16) !important;
    color: #28c76f !important;
}

.dashboard-admin .dashboard-kpi .info-box-icon.bg-warning {
    background: rgba(255, 159, 67, 0.16) !important;
    color: #ff9f43 !important;
}

.dashboard-admin .dashboard-kpi .info-box-icon.bg-danger {
    background: rgba(234, 84, 85, 0.16) !important;
    color: #ea5455 !important;
}

.badge-primary,
.btn-primary.badge {
    background-color: var(--rb-primary) !important;
}

.page-item.active .page-link,
.dataTables_wrapper .dataTables_paginate .page-item.active .page-link {
    background-color: var(--rb-primary) !important;
    border-color: var(--rb-primary) !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--rb-primary) !important;
}

/* Oscuro: sidebar y cabecera Materio */
html[data-theme='dark'] .main-sidebar,
html[data-theme='dark'] .main-sidebar[class*='sidebar-'] {
    background-color: #2f3349 !important;
    border-right-color: var(--rb-border) !important;
}

html[data-theme='dark'] .main-sidebar .nav-sidebar > .nav-item > .nav-link {
    border-radius: 0.5rem !important;
    margin: 0.1rem 0.55rem;
}

html[data-theme='dark'] .main-sidebar .nav-sidebar > .nav-item > .nav-link.active,
html[data-theme='dark'] .main-sidebar .nav-sidebar > .nav-item.menu-open > .nav-link {
    background: var(--rb-primary) !important;
    color: #fff !important;
}

html[data-theme='dark'] .main-sidebar .nav-treeview > .nav-item > .nav-link.active {
    background: var(--rb-primary-soft) !important;
    color: #cfc7ff !important;
}
