/* ============================================================
   WALLETCAMBIOS ADMIN — MODERN THEME v2.1
   Solo sobreescribe estilos VISUALES. El layout (position,
   margin-left, flex-structure) lo maneja app.css original.
   ============================================================ */

/* ─── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ─── LIGHT MODE — CSS Variables ────────────────────────────── */
:root {
    --brand: #36b4c2;
    --brand-dark: #289aaa;
    --brand-glow: rgba(54, 180, 194, 0.18);
    --brand-light: #7dd8e2;

    --brand-accent: #e55112;
    --brand-accent-dark: #c4420d;
    --brand-accent-glow: rgba(229, 81, 18, 0.18);

    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-info: #06b6d4;

    /* Surfaces */
    --bg-body: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-surface-2: #f8fafc;
    --bg-sidebar: #0f172a;
    --bg-navbar: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #f8fafc;

    /* Text */
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-on-dark: rgba(255, 255, 255, 0.72);

    /* Borders */
    --border: #e2e8f0;
    --border-focus: #36b4c2;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.05);
    --shadow-lg: 0 10px 28px rgba(15, 23, 42, 0.11), 0 4px 10px rgba(15, 23, 42, 0.06);

    /* Sidebar */
    --sidebar-text: rgba(255, 255, 255, 0.62);
    --sidebar-text-active: #ffffff;
    --sidebar-active-bg: rgba(54, 180, 194, 0.18);
    --sidebar-border: rgba(255, 255, 255, 0.07);
    --sidebar-icon: rgba(255, 255, 255, 0.45);

    /* Misc */
    --radius: 12px;
    --radius-sm: 6px;
    --radius-lg: 16px;
    --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── DARK MODE — Variable Overrides ───────────────────────── */
[data-theme="dark"] {
    --bg-body: #0b0f1a;
    --bg-surface: #111827;
    --bg-surface-2: #1a2235;
    --bg-sidebar: #060c18;
    --bg-navbar: #111827;
    --bg-card: #111827;
    --bg-input: #1a2235;

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #4b5563;

    --border: #1e293b;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.30), 0 1px 2px rgba(0, 0, 0, 0.22);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.40), 0 2px 4px rgba(0, 0, 0, 0.28);
    --shadow-lg: 0 10px 28px rgba(0, 0, 0, 0.52), 0 4px 10px rgba(0, 0, 0, 0.35);
}

/* ─── BASE ───────────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', 'Poppins', sans-serif !important;
    background-color: var(--bg-body) !important;
    color: var(--text-primary) !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    transition: color var(--transition);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ─────────────────────────────────────────────────────────────
   S I D E B A R  — Override visual only
   ───────────────────────────────────────────────────────────── */

/* El ancho y position lo mantiene app.css (250px, fixed) */
.sidebar {
    background-color: var(--bg-sidebar) !important;
    border-right: 1px solid var(--sidebar-border) !important;
}

/* Logo area */
.sidebar__logo {
    border-bottom: 1px solid var(--sidebar-border) !important;
    padding: 18px 16px !important;
}

/* Menu section headers */
.sidebar__menu-header {
    font-family: 'Inter', sans-serif !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    letter-spacing: 0.10em !important;
    color: rgba(255, 255, 255, 0.24) !important;
    padding-left: 16px !important;
    margin-top: 12px !important;
}

/* Each menu item row */
.sidebar__menu .sidebar-menu-item>a {
    color: var(--sidebar-text) !important;
    border-radius: var(--radius-sm) !important;
    margin: 1px 8px !important;
    padding: 9px 12px !important;
    border-left: none !important;
    font-size: 13.5px !important;
    font-weight: 500 !important;
    font-family: 'Inter', sans-serif !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    transition: all var(--transition) !important;
}

.sidebar__menu .sidebar-menu-item>a:hover {
    background-color: rgba(255, 255, 255, 0.06) !important;
    color: var(--sidebar-text-active) !important;
    padding-left: 12px !important;
}

/* Active + open states */
.sidebar__menu .sidebar-menu-item>a.side-menu--open,
.sidebar__menu .sidebar-menu-item.active>a {
    background: var(--sidebar-active-bg) !important;
    color: var(--sidebar-text-active) !important;
    border-left: none !important;
}

/* Active left accent stripe */
.sidebar__menu .sidebar-menu-item.active>a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 56%;
    border-radius: 0 3px 3px 0;
    background: var(--brand);
}

.sidebar__menu .sidebar-menu-item>a {
    position: relative;
}

/* Icons */
.sidebar__menu .menu-icon {
    font-size: 15px !important;
    color: var(--sidebar-icon) !important;
    width: 18px !important;
    text-align: center !important;
    flex-shrink: 0 !important;
    margin-right: 0 !important;
    transition: color var(--transition) !important;
}

.sidebar__menu .sidebar-menu-item:hover .menu-icon,
.sidebar__menu .sidebar-menu-item.active .menu-icon {
    color: var(--brand-light) !important;
    text-shadow: none !important;
}

/* Submenu items */
.sidebar__menu .sidebar-submenu {
    background-color: rgba(0, 0, 0, 0.12) !important;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm) !important;
}

.sidebar__menu .sidebar-submenu .sidebar-menu-item a {
    font-size: 12.5px !important;
    padding: 8px 12px 8px 36px !important;
    color: var(--sidebar-text) !important;
    border-radius: var(--radius-sm) !important;
    margin: 1px 8px !important;
}

.sidebar__menu .sidebar-submenu .sidebar-menu-item a:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    color: var(--sidebar-text-active) !important;
}

.sidebar__menu .sidebar-submenu .sidebar-menu-item.active a {
    background: rgba(54, 180, 194, 0.13) !important;
    color: var(--sidebar-text-active) !important;
}

.sidebar__menu .sidebar-submenu .sidebar-menu-item a .menu-icon {
    font-size: 7px !important;
    color: rgba(255, 255, 255, 0.30) !important;
}

.sidebar__menu .sidebar-submenu .sidebar-menu-item.active a .menu-icon,
.sidebar__menu .sidebar-submenu .sidebar-menu-item:hover a .menu-icon {
    color: var(--brand-light) !important;
}

/* Dropdown arrow (la ::before de sidebar) */
.sidebar__menu .sidebar-dropdown>a::before {
    color: rgba(255, 255, 255, 0.28) !important;
}

/* Menu badge */
.sidebar__menu .menu-badge {
    background: var(--brand) !important;
    color: #fff !important;
    border-radius: 99px !important;
    font-size: 10px !important;
    font-weight: 700 !important;
}

/* Menu title text */
.sidebar__menu .menu-title {
    color: inherit !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 13.5px !important;
}

/* Version info bar */
.sidebar .version-info {
    background-color: rgba(0, 0, 0, 0.25) !important;
    border-top: 1px solid var(--sidebar-border) !important;
    color: rgba(255, 255, 255, 0.30) !important;
    font-size: 11px !important;
    width: 100% !important;
    text-align: center;
    padding: 10px 8px;
}

.sidebar .version-info .text--primary {
    color: var(--brand-light) !important;
}

.sidebar .version-info .text--success {
    color: #34d399 !important;
}

/* Sidebar close btn (responsive) */
.sidebar .res-sidebar-close-btn {
    background-color: var(--brand) !important;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0 !important;
    width: 32px !important;
    height: 32px !important;
}

/* Hamburger btn: visible sobre fondo claro del navbar */
.res-sidebar-open-btn {
    color: var(--text-secondary) !important;
    font-size: 1.35rem !important;
    width: 38px !important;
    height: 38px !important;
    display: none;
    align-items: center !important;
    justify-content: center !important;
    border-radius: var(--radius-sm) !important;
    transition: background var(--transition) !important;
    flex-shrink: 0 !important;
}
.res-sidebar-open-btn:hover {
    background-color: var(--bg-surface-2) !important;
    color: var(--brand) !important;
}
@media (max-width: 991px) {
    .res-sidebar-open-btn {
        display: inline-flex !important;
    }
}

/* ─────────────────────────────────────────────────────────────
   N A V B A R — Override visual only
   (app.css: position:relative, margin-left:250px — se mantiene)
   ───────────────────────────────────────────────────────────── */
.navbar-wrapper {
    background-color: var(--bg-navbar) !important;
    border-bottom: 1px solid var(--border) !important;
    padding: 10px 24px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    min-height: 60px !important;
}

/* Search field */
.navbar-search-field {
    background-color: var(--bg-input) !important;
    border: 1.5px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    color: var(--text-primary) !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 13px !important;
    height: 38px !important;
}

.navbar-search-field::placeholder {
    color: var(--text-muted) !important;
}

.navbar-search-field::-moz-placeholder {
    color: var(--text-muted) !important;
}

.navbar-search-field::-webkit-input-placeholder {
    color: var(--text-muted) !important;
}

.navbar-search-field:focus {
    border-color: var(--brand) !important;
    box-shadow: 0 0 0 3px var(--brand-glow) !important;
    background-color: var(--bg-surface) !important;
}

/* Search icon */
.navbar-search i {
    color: var(--text-muted) !important;
}

/* Search results list */
.search-list {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-lg) !important;
}

/* Icon action buttons */
.primary--layer {
    background: transparent !important;
    border: none !important;
    color: var(--text-secondary) !important;
    width: 38px !important;
    height: 38px !important;
    border-radius: var(--radius-sm) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all var(--transition) !important;
    font-size: 1.25rem !important;
    padding: 0 !important;
}

.primary--layer a {
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit !important;
}

.primary--layer:hover {
    background-color: var(--bg-surface-2) !important;
    color: var(--brand) !important;
}

.primary--layer i {
    color: inherit !important;
    text-shadow: none !important;
}

/* Override the generic button icon color from app.css */
.navbar__right button i {
    color: var(--text-secondary) !important;
    text-shadow: none !important;
    font-size: 1.15rem !important;
}

/* Notification badge */
.notification-bell {
    position: relative !important;
}

.notification-count {
    position: absolute !important;
    top: 4px !important;
    right: 4px !important;
    min-width: 16px !important;
    height: 16px !important;
    background: var(--color-danger) !important;
    color: #fff !important;
    font-size: 9px !important;
    font-weight: 700 !important;
    border-radius: 99px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 3px !important;
    border: 2px solid var(--bg-navbar) !important;
    line-height: 1 !important;
}

/* Bell animation */
.icon-left-right {
    animation: bellRing 2s infinite ease-in-out;
}

@keyframes bellRing {

    0%,
    100% {
        transform: rotate(0deg);
    }

    15% {
        transform: rotate(12deg);
    }

    30% {
        transform: rotate(-9deg);
    }

    45% {
        transform: rotate(7deg);
    }

    60% {
        transform: rotate(-5deg);
    }

    75% {
        transform: rotate(3deg);
    }
}

/* Profile user area */
.navbar-user {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 4px 6px !important;
    border-radius: var(--radius-sm) !important;
    transition: background var(--transition) !important;
}

.navbar-user:hover {
    background: var(--bg-surface-2) !important;
}

.navbar-user__thumb {
    width: 32px !important;
    border-radius: 50% !important;
    border: 2px solid var(--brand) !important;
    overflow: hidden !important;
}

.navbar-user__thumb img {
    width: 32px !important;
    height: 32px !important;
    object-fit: cover !important;
    border-radius: 50% !important;
}

.navbar-user__name {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
}

.navbar-user .icon i {
    color: var(--text-muted) !important;
}

/* ─── Theme Toggle Button ────────────────────────────────────── */
#themeToggleBtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all var(--transition);
}

#themeToggleBtn:hover {
    background-color: var(--bg-surface-2);
    color: var(--brand);
}

#themeToggleIcon {
    pointer-events: none;
}

/* ─────────────────────────────────────────────────────────────
   D R O P D O W N S
   ───────────────────────────────────────────────────────────── */
.dropdown-menu {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-lg) !important;
    padding: 6px !important;
    color: var(--text-primary) !important;
}

.dropdown-menu__header {
    border-bottom: 1px solid var(--border) !important;
    padding: 10px 12px 8px !important;
}

.dropdown-menu__header .caption {
    font-size: 11px !important;
    font-weight: 700 !important;
    letter-spacing: 0.07em !important;
    text-transform: uppercase !important;
    color: var(--text-muted) !important;
}

.dropdown-menu__header p {
    font-size: 12px !important;
    color: var(--text-secondary) !important;
}

.dropdown-menu__body {
    max-height: 300px;
    overflow-y: auto;
}

.dropdown-menu__item {
    border-bottom: none !important;
    border-radius: var(--radius-sm) !important;
    padding: 8px 12px !important;
    color: var(--text-primary) !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    font-size: 13.5px !important;
    font-weight: 500 !important;
    transition: background var(--transition) !important;
}

.dropdown-menu__item:hover {
    background: var(--bg-surface-2) !important;
}

.dropdown-menu__icon {
    color: var(--text-muted) !important;
    font-size: 15px !important;
}

.dropdown-menu__caption {
    color: var(--text-primary) !important;
}

.dropdown-menu__footer {
    border-top: 1px solid var(--border) !important;
    margin-top: 4px !important;
    padding: 8px 12px 4px !important;
}

.view-all-message {
    color: var(--brand) !important;
    font-size: 12.5px !important;
    font-weight: 600 !important;
    text-align: center !important;
    display: block !important;
}

/* Notification items */
.notifi__title {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
}

.navbar-notifi .time {
    font-size: 11px !important;
    color: var(--text-muted) !important;
}

/* Divider inside dropdown */
.divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* ─────────────────────────────────────────────────────────────
   B O D Y   W R A P P E R   (el app.css maneja margin-left:250px)
   ───────────────────────────────────────────────────────────── */
.body-wrapper {
    /* NO tocamos margin-left ni padding — app.css los maneja */
    background-color: var(--bg-body) !important;
}

.bodywrapper__inner {
    padding: 24px !important;
}

/* Page title */
.page-title {
    font-family: 'Inter', sans-serif !important;
    font-size: 17px !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
    letter-spacing: -0.01em !important;
}

/* ─────────────────────────────────────────────────────────────
   C A R D S
   ───────────────────────────────────────────────────────────── */
.card {
    background-color: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-sm) !important;
    transition: box-shadow var(--transition), background-color var(--transition), border-color var(--transition) !important;
}

.card:hover {
    box-shadow: var(--shadow-md) !important;
}

.card-body {
    color: var(--text-primary) !important;
}

.card-title {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
}

/* ─────────────────────────────────────────────────────────────
   W I D G E T   C A R D S  (nuevo widget-6)
   ───────────────────────────────────────────────────────────── */
.widget-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    overflow: hidden;
    position: relative;
    height: 100%; /* Asegurar que todas las cards tengan el mismo alto */
}

.widget-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: rgba(54, 180, 194, 0.22);
}

.widget-card__icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.widget-card__content {
    flex-grow: 1; /* Ocupar el espacio disponible */
    min-width: 0; /* Evitar desbordamiento de texto */
}

.widget-card__value {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.widget-card__label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.widget-card__arrow {
    color: var(--text-muted);
    font-size: 12px;
    margin-left: auto;
    opacity: 0;
    transform: translateX(-4px);
    transition: all var(--transition);
    flex-shrink: 0;
}

@media (max-width: 575px) {
    .widget-card {
        padding: 15px 12px;
        gap: 10px;
    }
    .widget-card__icon {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    .widget-card__value {
        font-size: 18px;
    }
    .widget-card__label {
        font-size: 11px;
    }
    .widget-card__arrow {
        display: none; /* Ahorrar espacio en móviles muy pequeños */
    }
}

/* Color variants */
.widget-card__icon.icon--primary {
    background: rgba(54, 180, 194, 0.12);
    color: #36b4c2;
}

.widget-card__icon.icon--success {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
}

.widget-card__icon.icon--danger {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

.widget-card__icon.icon--warning {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
}

.widget-card__icon.icon--info {
    background: rgba(229, 81, 18, 0.12);
    color: #e55112;
}

.widget-card__icon.icon--dark {
    background: rgba(100, 116, 139, 0.12);
    color: #64748b;
}

/* — Reserved Currencies Widget — */
.widget-two {
    padding: 15px !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    background-color: var(--bg-card) !important;
}

.widget-two__icon {
    width: 45px !important;
    height: 45px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background-color: var(--bg-surface-2) !important;
    overflow: hidden !important;
}

.reserved-currency-image {
    width: 30px !important;
    height: 30px !important;
    object-fit: contain !important;
}

.widget-two__content h4 {
    font-size: 14px !important;
    font-weight: 700 !important;
    margin-bottom: 2px !important;
}

.widget-two__content p {
    font-size: 13px !important;
    color: var(--text-secondary) !important;
    margin-bottom: 0 !important;
}

/* ─────────────────────────────────────────────────────────────
   B U T T O N S
   ───────────────────────────────────────────────────────────── */
.btn {
    font-family: 'Inter', sans-serif !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    border-radius: var(--radius-sm) !important;
    transition: all var(--transition) !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
}

.btn:focus {
    box-shadow: none !important;
}

.btn--primary,
.btn-primary {
    background: var(--brand) !important;
    border-color: var(--brand) !important;
    color: #fff !important;
}

.btn--primary:hover,
.btn-primary:hover {
    background: var(--brand-dark) !important;
    border-color: var(--brand-dark) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px var(--brand-glow) !important;
}

.btn-outline--primary {
    color: var(--brand) !important;
    border-color: var(--brand) !important;
    background: transparent !important;
}

.btn-outline--primary:hover {
    background: var(--brand) !important;
    color: #fff !important;
}

/* — Submit / primary action via brand gradient — */
.btn--base,
input[type="submit"].btn,
.btn[type="submit"] {
    background: var(--brand) !important;
    border: none !important;
    color: #fff !important;
    font-weight: 700 !important;
}

.btn--base:hover,
input[type="submit"].btn:hover,
.btn[type="submit"]:hover {
    background: var(--brand-dark) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 14px var(--brand-glow) !important;
}


/* ─────────────────────────────────────────────────────────────
   F O R M S
   ───────────────────────────────────────────────────────────── */
.form-control,
.form-select,
input.form-control,
select.form-control,
textarea.form-control {
    background-color: var(--bg-input) !important;
    border: 1.5px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    color: var(--text-primary) !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 13.5px !important;
    transition: all var(--transition) !important;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand) !important;
    box-shadow: 0 0 0 3px var(--brand-glow) !important;
    background-color: var(--bg-surface) !important;
}

.form-control::placeholder {
    color: var(--text-muted) !important;
}

label {
    font-family: 'Inter', sans-serif !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: var(--text-secondary) !important;
}

label.required::after {
    content: ' *';
    color: var(--color-danger);
}

.input-group-text {
    background-color: var(--bg-surface-2) !important;
    border: 1.5px solid var(--border) !important;
    color: var(--text-secondary) !important;
    border-radius: var(--radius-sm) !important;
}

/* ─────────────────────────────────────────────────────────────
   T A B L E S
   ───────────────────────────────────────────────────────────── */
.table {
    color: var(--text-primary) !important;
    border-color: var(--border) !important;
    font-size: 13.5px !important;
    font-family: 'Inter', sans-serif !important;
}

.table>thead {
    background: var(--bg-surface-2) !important;
    border-bottom: 2px solid var(--border) !important;
}

.table>thead th {
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.07em !important;
    color: var(--text-muted) !important;
    border: none !important;
    background: var(--bg-surface-2) !important;
    padding: 12px 16px !important;
    white-space: nowrap !important;
}

.table>tbody td {
    padding: 12px 16px !important;
    border-color: var(--border) !important;
    color: var(--text-primary) !important;
    vertical-align: middle !important;
}

.table>tbody tr {
    transition: background var(--transition) !important;
}

.table>tbody tr:hover {
    background-color: var(--bg-surface-2) !important;
}

/* ─────────────────────────────────────────────────────────────
   M O D A L S
   ───────────────────────────────────────────────────────────── */
.modal-content {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-lg) !important;
    color: var(--text-primary) !important;
}

.modal-header {
    border-bottom: 1px solid var(--border) !important;
    padding: 18px 24px 14px !important;
}

.modal-title {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
}

.modal-footer {
    border-top: 1px solid var(--border) !important;
    padding: 12px 24px !important;
}

[data-theme="dark"] .btn-close {
    filter: invert(1);
}

/* ─────────────────────────────────────────────────────────────
   A L E R T S
   ───────────────────────────────────────────────────────────── */
.alert {
    border-radius: var(--radius-sm) !important;
    border: none !important;
    font-size: 13.5px !important;
    font-weight: 500 !important;
}

.alert-success {
    background: rgba(16, 185, 129, 0.10) !important;
    color: #059669 !important;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.10) !important;
    color: #dc2626 !important;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.10) !important;
    color: #d97706 !important;
}

.alert-info {
    background: rgba(6, 182, 212, 0.10) !important;
    color: #0891b2 !important;
}

/* ─────────────────────────────────────────────────────────────
   N A V   T A B S
   ───────────────────────────────────────────────────────────── */
.nav-tabs {
    border-bottom: 1.5px solid var(--border) !important;
    gap: 2px !important;
}

.nav-tabs .nav-link {
    border: none !important;
    background: transparent !important;
    color: var(--text-secondary) !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    font-family: 'Inter', sans-serif !important;
    padding: 9px 16px !important;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0 !important;
    position: relative !important;
    transition: color var(--transition) !important;
}

.nav-tabs .nav-link.active {
    color: var(--brand) !important;
    border-bottom: 2px solid var(--brand) !important;
}

/* ─────────────────────────────────────────────────────────────
   P A G I N A T I O N
   ───────────────────────────────────────────────────────────── */
.page-link {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-sm) !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    transition: all var(--transition) !important;
}

.page-link:hover {
    background: var(--bg-surface-2) !important;
    border-color: var(--brand) !important;
    color: var(--brand) !important;
}

.page-item.active .page-link {
    background: var(--brand) !important;
    border-color: var(--brand) !important;
    color: #fff !important;
}

/* ─────────────────────────────────────────────────────────────
   S E L E C T 2
   ───────────────────────────────────────────────────────────── */
.select2-container--default .select2-selection--single {
    background: var(--bg-input) !important;
    border: 1.5px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    height: 42px !important;
    display: flex !important;
    align-items: center !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--text-primary) !important;
    line-height: 40px !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 40px !important;
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--brand) !important;
    box-shadow: 0 0 0 3px var(--brand-glow) !important;
}

.select2-dropdown {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-lg) !important;
}

.select2-container--default .select2-results__option {
    color: var(--text-primary) !important;
    font-size: 13.5px !important;
}

.select2-container--default .select2-results__option--highlighted {
    background: var(--bg-surface-2) !important;
    color: var(--text-primary) !important;
}

.select2-container--default .select2-results__option--selected {
    background: rgba(99, 102, 241, 0.10) !important;
    color: var(--brand) !important;
}

.select2-search--dropdown .select2-search__field {
    background: var(--bg-input) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-sm) !important;
}

/* ─────────────────────────────────────────────────────────────
   T Y P O G R A P H Y
   ───────────────────────────────────────────────────────────── */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Inter', sans-serif !important;
    color: var(--text-primary) !important;
}

p,
span,
li {
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
}

/* ─────────────────────────────────────────────────────────────
   U T I L I T Y   O V E R R I D E S
   ───────────────────────────────────────────────────────────── */
.text--primary {
    color: var(--brand) !important;
}

.text--success {
    color: var(--color-success) !important;
}

.text--danger {
    color: var(--color-danger) !important;
}

.text--warning {
    color: var(--color-warning) !important;
}

.text--info {
    color: var(--color-info) !important;
}

.text--secondary {
    color: var(--text-secondary) !important;
}

.text--muted {
    color: var(--text-muted) !important;
}

/* ─────────────────────────────────────────────────────────────
   D A R K   M O D E   —   Deep overrides
   ───────────────────────────────────────────────────────────── */

/* Forms */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] input:not([type="radio"]):not([type="checkbox"]):not([type="range"]),
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background-color: var(--bg-input) !important;
    border-color: var(--border) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: var(--text-muted) !important;
}

/* Selects */
[data-theme="dark"] .select2-selection--single {
    background: var(--bg-input) !important;
    border-color: var(--border) !important;
}

[data-theme="dark"] .select2-selection__rendered {
    color: var(--text-primary) !important;
}

/* Dropdowns */
[data-theme="dark"] .dropdown-item {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .dropdown-item:hover {
    background: var(--bg-surface-2) !important;
}

/* Borders */
[data-theme="dark"] .border,
[data-theme="dark"] [class*="border-"] {
    border-color: var(--border) !important;
}

/* Misc components */
[data-theme="dark"] .bg--white {
    background-color: var(--bg-surface) !important;
}

[data-theme="dark"] .box--shadow2,
[data-theme="dark"] .box--shadow3 {
    box-shadow: var(--shadow-md) !important;
}

[data-theme="dark"] pre,
[data-theme="dark"] code {
    background: var(--bg-surface-2) !important;
    color: #a5b4fc !important;
    border-color: var(--border) !important;
}

/* ─────────────────────────────────────────────────────────────
   S M O O T H   T R A N S I T I O N   O N   T H E M E   S W I T C H
   ───────────────────────────────────────────────────────────── */
body,
.sidebar,
.navbar-wrapper,
.card,
.body-wrapper,
.form-control,
.form-select,
.table,
.modal-content,
.dropdown-menu,
.page-link,
.input-group-text {
    transition:
        background-color 0.22s cubic-bezier(0.4, 0, 0.2, 1),
        color 0.22s cubic-bezier(0.4, 0, 0.2, 1),
        border-color 0.22s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* ─────────────────────────────────────────────────────────────
   R E S P O N S I V E   (complementa app.css)
   ───────────────────────────────────────────────────────────── */

/* ── 991px: sidebar oculto, navbar sin margin-left ── */
@media (max-width: 991px) {
    .navbar-wrapper {
        padding: 10px 14px !important;
    }
    .bodywrapper__inner {
        padding: 16px !important;
    }
    /* Evitar overflow horizontal en el área de contenido (no en body - rompe flex centering en auth) */
    .body-wrapper {
        overflow-x: hidden !important;
    }
}

/* ── 767px: todo en una fila — search flexible, iconos fijos ── */
@media (max-width: 767px) {
    .navbar-wrapper {
        padding: 8px 12px !important;
        min-height: unset !important;
    }
    /* Left toma el espacio restante después de los iconos */
    .navbar__left {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        overflow: hidden !important;
    }
    /* Search ocupa todo el left disponible */
    .navbar-search {
        flex: 1 !important;
        width: auto !important;
        min-width: 60px !important;
        max-width: none !important;
    }
    /* Iconos: sin envolver, tamaño fijo — width:fit-content evita que el bloque
       se expanda al ancho del padre y aplaste el hamburger + search */
    .navbar__right {
        flex-shrink: 0 !important;
        width: fit-content !important;
        max-width: fit-content !important;
    }
    .navbar__action-list {
        flex-wrap: nowrap !important;
        width: fit-content !important;
    }
    .navbar__action-list li {
        flex-shrink: 0 !important;
        margin-right: 4px !important;
    }
}

/* ── 575px: ajustes adicionales para pantallas pequeñas ── */
@media (max-width: 575px) {
    .bodywrapper__inner {
        padding: 10px 8px !important;
    }
    .navbar-wrapper {
        padding: 6px 10px !important;
    }
    /* Reducir iconos del navbar ligeramente */
    .primary--layer {
        width: 34px !important;
        height: 34px !important;
        font-size: 1.1rem !important;
    }
    .navbar__right button i,
    .navbar__right button a i {
        font-size: 1.05rem !important;
    }
    /* Breadcrumb: no overflow */
    .breadcrumb-area {
        flex-wrap: wrap !important;
        gap: 4px !important;
    }
    .breadcrumb-area .breadcrumb {
        flex-wrap: wrap !important;
    }
}

/* ── CARD HEADERS: headers con múltiples botones de acción ── */
@media (max-width: 767px) {
    /* Cualquier card-header / panel-header con flex y botones */
    .card-header .d-flex,
    .panel-header .d-flex {
        flex-wrap: wrap !important;
        gap: 6px !important;
    }
    /* Breadcrumb con botón de Atrás + título */
    .breadcrumb-area {
        align-items: flex-start !important;
    }
}

@media (max-width: 575px) {
    /* Botones sm en mobile: fuente más pequeña */
    .btn-sm, .btn.btn-sm {
        font-size: .72rem !important;
        padding: .2rem .45rem !important;
    }
    /* Grupos de botones que pueden desbordarse */
    .button--group {
        flex-wrap: wrap !important;
        gap: 4px !important;
    }
    /* Header de cualquier card con múltiples elementos */
    .card-header {
        flex-wrap: wrap !important;
        gap: 6px !important;
        row-gap: 6px !important;
    }
    /* Títulos de página que pueden ser largos */
    .page-title {
        font-size: 1rem !important;
        word-break: break-word !important;
    }
}

/* ── TABLAS: mejoras data-label en mobile stacking ── */
@media (max-width: 991px) {
    /* Mejorar visualización de celdas sin data-label en modo stacked */
    .table-responsive--md tr td:first-child {
        padding-top: .6rem !important;
    }
    .table-responsive--md tr td:last-child {
        padding-bottom: .6rem !important;
    }
    /* Separador visual entre filas en mobile */
    .table-responsive--md tbody tr {
        border-bottom: 2px solid var(--border, #e5e7eb) !important;
        margin-bottom: .5rem !important;
    }
}

/* ── FORMULARIOS: campos en full-width en mobile ── */
@media (max-width: 575px) {
    /* Input groups que puedan overflow */
    .input-group {
        flex-wrap: nowrap !important;
    }
    /* Evitar que select2 se salga del contenedor */
    .select2-container {
        max-width: 100% !important;
    }
}

/* ── MODALES: ajustar en mobile ── */
@media (max-width: 575px) {
    .modal-dialog {
        margin: .5rem !important;
    }
    .modal-body {
        padding: 1rem !important;
    }
}

/* ── PAGINATION: en mobile ── */
@media (max-width: 575px) {
    .pagination {
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 2px !important;
    }
    .pagination .page-item .page-link {
        padding: .3rem .55rem !important;
        font-size: .78rem !important;
    }
}

/* ── OVERFLOW PROTECTION: evitar scroll horizontal en contenido ── */
@media (max-width: 991px) {
    /* Solo dentro del panel, no en auth/login */
    .body-wrapper,
    .bodywrapper__inner {
        max-width: 100vw !important;
    }
}

/* ─────────────────────────────────────────────────────────────
   G L O B A L   T O G G L E   &   L I S T   G R O U P
   ───────────────────────────────────────────────────────────── */

.toggle.btn {
    border: 1px solid var(--border) !important;
    overflow: hidden;
    background-color: var(--bg-input) !important;
}

.toggle-handle {
    background-color: #ffffff !important;
    border-radius: 0 !important;
}

[data-theme="dark"] .toggle-handle {
    background-color: #dee2e6 !important;
}

.list-group-item {
    background-color: transparent !important;
    color: var(--text-primary) !important;
    border-color: var(--border) !important;
}

[data-theme="dark"] .list-group-item {
    background-color: transparent !important;
    color: var(--text-primary) !important;
}

/* ─── Dark mode: btn--dark / btn-outline--dark / badge--dark ──── */
[data-theme="dark"] .btn--dark {
    background-color: #334155 !important;
    border-color: #475569 !important;
    color: #e2e8f0 !important;
}
[data-theme="dark"] .btn--dark:hover,
[data-theme="dark"] .btn--dark:focus {
    background-color: #475569 !important;
    border-color: #64748b !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .btn-outline--dark {
    border-color: #64748b !important;
    color: #cbd5e1 !important;
    background-color: transparent !important;
}
[data-theme="dark"] .btn-outline--dark:hover,
[data-theme="dark"] .btn-outline--dark:focus {
    background-color: #334155 !important;
    border-color: #94a3b8 !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .badge--dark {
    background-color: rgba(148, 163, 184, 0.15) !important;
    border-color: #64748b !important;
    color: #94a3b8 !important;
}