/* ============================================
   VENTAS TECHLAB - Mobile-First Design System
   Base: mobile → escala a desktop
   ============================================ */

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

/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
    --primary-color: #6366f1;
    --primary-light: #818cf8;
    --secondary-color: #ec4899;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;

    --dark-bg: #0f0f23;
    --card-bg: rgba(255, 255, 255, 0.08);
    --glass-bg: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --border-color: rgba(255, 255, 255, 0.1);

    --shadow-light: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-heavy: 0 12px 32px rgba(0, 0, 0, 0.3);

    --primary-rgb: 99, 102, 241;
    --success-rgb: 16, 185, 129;
    --warning-rgb: 245, 158, 11;
    --danger-rgb: 239, 68, 68;
    --info-rgb: 6, 182, 212;
    --secondary-rgb: 236, 72, 153;

    --sidebar-width: 80px;
    --sidebar-expanded: 280px;
}

/* ============================================
   THEMES
   ============================================ */
[data-theme="light"] {
    --dark-bg: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.95);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: rgba(0, 0, 0, 0.1);
    --shadow-light: 0 8px 32px rgba(0, 0, 0, 0.08);
    --shadow-heavy: 0 20px 60px rgba(0, 0, 0, 0.15);
}

[data-theme="dim"] {
    --dark-bg: #2c2c2c;
    --card-bg: rgba(255, 255, 255, 0.05);
    --glass-bg: rgba(255, 255, 255, 0.07);
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="high-contrast"] {
    --dark-bg: #000000;
    --card-bg: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.12);
    --text-primary: #ffffff;
    --text-secondary: #ffff00;
    --border-color: rgba(255, 255, 0, 0.3);
    --primary-color: #7c7fff;
}

[data-theme="pastel-blue"] {
    --primary-color: #64748B; --primary-light: #94A3B8; --secondary-color: #7C93C3;
    --dark-bg: #F1F5F9; --card-bg: rgba(255,255,255,0.9); --glass-bg: rgba(255,255,255,0.8);
    --text-primary: #1E293B; --text-secondary: #475569;
    --border-color: rgba(100,116,139,0.2);
    --shadow-light: 0 8px 32px rgba(100,116,139,0.1); --shadow-heavy: 0 20px 60px rgba(100,116,139,0.15);
}

[data-theme="pastel-green"] {
    --primary-color: #527853; --primary-light: #6B8E6B; --secondary-color: #8FBC8F;
    --dark-bg: #F0F5F0; --card-bg: rgba(255,255,255,0.9); --glass-bg: rgba(255,255,255,0.8);
    --text-primary: #344E41; --text-secondary: #588157;
    --border-color: rgba(82,120,83,0.2);
    --shadow-light: 0 8px 32px rgba(82,120,83,0.1); --shadow-heavy: 0 20px 60px rgba(82,120,83,0.15);
}

[data-theme="pastel-pink"] {
    --primary-color: #C08497; --primary-light: #D4A5B5; --secondary-color: #E8B4C8;
    --dark-bg: #F5E6E8; --card-bg: rgba(255,255,255,0.9); --glass-bg: rgba(255,255,255,0.8);
    --text-primary: #723D46; --text-secondary: #A0616D;
    --border-color: rgba(192,132,151,0.2);
    --shadow-light: 0 8px 32px rgba(192,132,151,0.1); --shadow-heavy: 0 20px 60px rgba(192,132,151,0.15);
}

[data-theme="pastel-yellow"] {
    --primary-color: #D4A276; --primary-light: #E0B992; --secondary-color: #DEB887;
    --dark-bg: #F7F3ED; --card-bg: rgba(255,255,255,0.9); --glass-bg: rgba(255,255,255,0.8);
    --text-primary: #6F4518; --text-secondary: #8B6914;
    --border-color: rgba(212,162,118,0.2);
    --shadow-light: 0 8px 32px rgba(212,162,118,0.1); --shadow-heavy: 0 20px 60px rgba(212,162,118,0.15);
}

[data-theme="pastel-lavender"] {
    --primary-color: #9370DB; --primary-light: #AB8FE0; --secondary-color: #B19CD9;
    --dark-bg: #F3F1F7; --card-bg: rgba(255,255,255,0.9); --glass-bg: rgba(255,255,255,0.8);
    --text-primary: #4A235A; --text-secondary: #7D5BA6;
    --border-color: rgba(147,112,219,0.2);
    --shadow-light: 0 8px 32px rgba(147,112,219,0.1); --shadow-heavy: 0 20px 60px rgba(147,112,219,0.15);
}

/* ============================================
   BASE - MOBILE FIRST (default = mobile)
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--dark-bg);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    transition: background 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   SIDEBAR - MOBILE (default: oculto, drawer)
   ============================================ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 85vw;
    max-width: 280px;
    height: 100vh;
    height: 100dvh;
    z-index: 1060;
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 1.25rem 0.75rem;
    backdrop-filter: blur(20px);
    background: var(--glass-bg);
    border-right: 1px solid var(--border-color);
    box-shadow: var(--shadow-heavy);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: var(--text-primary);
}

.sidebar.show {
    transform: translateX(0);
}

/* En mobile el icon se oculta, titulo visible */
.sidebar-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    min-width: 50px;
    margin: 0 auto;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    font-size: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.sidebar.show .sidebar-icon {
    opacity: 0;
    height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.sidebar h3 {
    opacity: 1;
    text-align: center;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.85rem;
    white-space: nowrap;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    transition: opacity 0.3s ease 0.1s;
}

/* ---- Menu ---- */
.menu {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.menu li {
    margin-bottom: 0.3rem;
}

.menu a {
    color: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
    padding: 11px 14px;
    border-radius: 14px;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    transition: all 0.25s ease;
    font-size: 0.9rem;
    font-weight: 500;
    gap: 0;
}

.menu a i {
    min-width: 26px;
    margin-right: 11px;
    font-size: 1.15rem;
    text-align: center;
}

.menu a span {
    opacity: 1;
    transition: opacity 0.3s ease 0.1s;
}

/* Gradient fill on hover/active — only for direct nav links */
.menu a::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    transition: width 0.3s ease;
    z-index: -1;
}

/* All menu items: gradient fills on hover */
.menu a:hover::before {
    width: 100%;
}

.menu a:hover {
    color: white;
    transform: translateX(5px);
}

/* Active state — only [data-view] items keep gradient persistently */
.menu a[data-view].active::before {
    width: 100%;
}

.menu a[data-view].active {
    color: white;
}

/* Submenu toggle: suppress gradient — it's a UI expander, not a nav destination */
.menu a.submenu-toggle::before {
    content: none;
}
.menu a.submenu-toggle:hover {
    color: inherit;          /* no white text without a gradient backing it */
    transform: none;
    background: rgba(var(--primary-rgb), 0.1);  /* subtle hover tint instead */
}

/* Submenu children: slightly dimmer gradient */
.submenu a::before {
    opacity: 0.85;
}

/* ---- Sidebar Footer ---- */
.sidebar-footer {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 0.5rem;
    border-top: 1px solid var(--border-color);
    white-space: nowrap;
    margin-top: auto;
}

.user-avatar {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
}

.user-name {
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    opacity: 1;
}

/* ============================================
   MOBILE MENU TOGGLE (visible by default)
   ============================================ */
.mobile-menu-toggle {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1070;
    background: var(--primary-color);
    border: none;
    color: white;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.2rem;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
    -webkit-tap-highlight-color: transparent;
}

.mobile-menu-toggle:active {
    transform: scale(0.92);
}

/* ---- Overlay ---- */
.mobile-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.55);
    z-index: 1055;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-overlay.show {
    display: block;
    opacity: 1;
}

/* ============================================
   CONTENT - MOBILE FIRST
   ============================================ */
.content {
    width: 100%;
    padding: 0.75rem;
    padding-top: 4rem;
    min-height: 100vh;
    min-height: 100dvh;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Top Bar ---- */
.top-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.25rem 0;
}

.theme-select {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: 8px;
    font-size: 0.78rem;
    padding: 0.35rem 2rem 0.35rem 0.6rem;
    min-width: 130px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-select:hover,
.theme-select:focus {
    border-color: var(--primary-color) !important;
}

.theme-select option {
    background: var(--dark-bg);
    color: var(--text-primary);
}

/* ============================================
   PAGE TITLE
   ============================================ */
.page-title {
    font-size: 1.6rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1.25rem;
    text-align: center;
    animation: fadeIn 0.6s ease-out;
}

/* ============================================
   GLASS CARD
   ============================================ */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-light);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
}

.glass-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-heavy);
    border-color: var(--primary-color);
}

.card-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

/* ============================================
   STAT CARDS
   ============================================ */
.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1rem;
    cursor: default;
}

.stat-card:hover .stat-icon {
    transform: scale(1.1) rotate(-5deg);
}

.stat-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

/* ============================================
   FORM ELEMENTS
   ============================================ */
.form-control,
.form-select {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px;
    color: var(--text-primary) !important;
    padding: 0.5rem 0.75rem;
    height: 42px;
    font-size: 1rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.form-control:focus,
.form-select:focus {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.2) !important;
    color: var(--text-primary) !important;
}

.form-control::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

textarea.form-control {
    height: auto;
    min-height: 80px;
    resize: vertical;
}

.form-select option {
    background: var(--dark-bg);
    color: var(--text-primary);
}

.form-control:focus-visible,
.form-select:focus-visible,
.btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ============================================
   TABLE
   ============================================ */
.table-responsive {
    border-radius: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: var(--shadow-light);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    background: var(--glass-bg);
}

.table-custom {
    color: var(--text-primary);
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    margin-bottom: 0;
    min-width: 500px;
}

.table-custom thead th {
    background: rgba(99, 102, 241, 0.15);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.7rem 0.6rem;
    border: none;
    white-space: nowrap;
    position: sticky;
    top: 0;
}

.table-custom thead th:first-child { border-radius: 10px 0 0 10px; }
.table-custom thead th:last-child { border-radius: 0 10px 10px 0; }

.table-custom tbody tr {
    transition: all 0.2s ease;
    position: relative;
}

.table-custom tbody tr:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.table-custom tbody td {
    padding: 0.6rem 0.6rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.82rem;
    vertical-align: middle;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    font-weight: 600;
    font-size: 0.72rem;
    padding: 0.35em 0.7em;
    border-radius: 8px;
    letter-spacing: 0.3px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.badge:hover { transform: scale(1.05); }
.badge.bg-primary { background-color: #4f46e5 !important; color: #fff; }
.badge.bg-warning { background-color: #f59e0b !important; color: #000; }
.badge.bg-success { background-color: #059669 !important; color: #fff; }
.badge.bg-danger { background-color: #ef4444 !important; color: #fff; }
.badge.bg-info { background-color: #0891b2 !important; color: #fff; }
.badge.bg-secondary { background-color: #4b5563 !important; color: #fff; }

/* ============================================
   BUTTONS - Touch friendly (min 44px)
   ============================================ */
.btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    min-height: 44px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    border-radius: 10px;
    -webkit-tap-highlight-color: transparent;
}

.btn-sm {
    min-height: 36px;
    padding: 0.35rem 0.85rem;
    font-size: 0.82rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light)) !important;
    border: none !important;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.45);
}

.btn-primary:active { transform: translateY(0); }

.btn-secondary {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    font-weight: 600;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #f87171) !important;
    border: none !important;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color), #34d399) !important;
    border: none !important;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.25);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-outline-primary {
    border: 1px solid var(--primary-color) !important;
    color: var(--primary-color) !important;
    background: transparent !important;
    font-weight: 600;
}

.btn-outline-primary:hover {
    background: var(--primary-color) !important;
    color: white !important;
    transform: translateY(-1px);
}

/* ============================================
   MODALS - Mobile first (casi fullscreen)
   ============================================ */
.modal-content {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: 14px;
    overflow: hidden;
    animation: slide-down 0.4s ease-out;
}

.modal-dialog {
    max-width: calc(100% - 1rem);
    margin: 0.5rem auto;
}

.modal-header {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border-bottom: 1px solid var(--border-color);
    padding: 0.85rem 1rem;
}

.modal-title {
    font-weight: 600;
    font-size: 1rem;
}

.modal-body {
    padding: 1rem;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Tabla detalle dashboard — override Bootstrap para respetar el tema */
.dash-detalle-table,
.dash-detalle-table tbody tr,
.dash-detalle-table tbody td {
    background-color: transparent !important;
    color: var(--text-primary) !important;
    --bs-table-bg: transparent;
    --bs-table-striped-bg: transparent;
    --bs-table-hover-bg: transparent;
}

.dash-detalle-table tbody tr:hover td {
    background: rgba(99,102,241,0.08) !important;
}

/* ── Desglose modal: sin blur en ningún tema ─────────────────── */
#desgloseModal,
#desgloseModal * {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
#desgloseModal .modal-content {
    background: #1e1e1e !important;
    border: 1px solid #3a3a3a !important;
    border-radius: 16px;
    box-shadow: 0 32px 80px rgba(0,0,0,0.7);
}

/* Header */
#desgloseModal .modal-header {
    background: linear-gradient(135deg, #7c3aed, #9333ea);
    border-bottom: none;
    border-radius: 14px 14px 0 0;
    padding: 1rem 1.25rem;
}
#desgloseModal .modal-header .modal-title,
#desgloseModal .modal-header small {
    color: #fff !important;
}

/* Body y footer */
#desgloseModal .modal-body  { padding: 1.25rem; }
#desgloseModal .modal-footer {
    background: #181818;
    border-top: 1px solid #2e2e2e;
    border-radius: 0 0 14px 14px;
    padding: .85rem 1.25rem;
}

/* Panel de info del gasto padre */
#desgloseModal .glass-card {
    background: #2a2a2a !important;
    border: 1px solid #cccccc33 !important;
    border-radius: 10px;
    backdrop-filter: none !important;
}
#desgloseModal .glass-card .text-muted {
    color: #bbbbbb !important;
    font-size: .8rem;
}
#desgloseModal .glass-card strong {
    color: #ffffff !important;
    font-weight: 700;
}

/* Tabla interna */
#desgloseModal .dash-detalle-table {
    --bs-table-bg: transparent;
    background: #252525;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #333333;
}
#desgloseModal .dash-detalle-table thead th {
    background: #2e2e2e !important;
    color: #ffffff !important;
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .8px;
    text-transform: uppercase;
    padding: .6rem .75rem;
    border-bottom: 1px solid #3a3a3a !important;
}
#desgloseModal .dash-detalle-table tbody tr:nth-child(odd) td {
    background: #2a2a2a !important;
}
#desgloseModal .dash-detalle-table tbody tr:nth-child(even) td {
    background: #2e2e2e !important;
}
#desgloseModal .dash-detalle-table tbody td {
    border-bottom: 1px solid #333333 !important;
    padding: .55rem .75rem;
    color: #ffffff !important;
}
#desgloseModal .dash-detalle-table tbody tr:last-child td {
    border-bottom: none !important;
}

/* Inputs */
#desgloseModal .form-control-sm,
#desgloseModal .form-select-sm {
    height: 34px;
    font-size: .82rem;
    padding: .25rem .6rem;
    background: #333333 !important;
    border: 1px solid #cccccc55 !important;
    color: #ffffff !important;
    border-radius: 7px;
    transition: border-color .15s, box-shadow .15s;
}
#desgloseModal .form-control-sm:focus,
#desgloseModal .form-select-sm:focus {
    background: #3a3a3a !important;
    border-color: #9333ea !important;
    box-shadow: 0 0 0 3px rgba(147,51,234,0.3) !important;
    color: #ffffff !important;
}
#desgloseModal .form-control-sm::placeholder {
    color: #bbbbbb !important;
    opacity: 1;
}

/* Botón eliminar fila */
#desgloseModal .btn-outline-danger {
    border-color: rgba(239,68,68,0.5);
    color: rgba(239,68,68,0.85);
    background: transparent;
}
#desgloseModal .btn-outline-danger:hover {
    background: rgba(239,68,68,0.18);
    border-color: #ef4444;
    color: #ef4444;
}

/* Botón + Agregar división */
#desgloseModal .btn-outline-primary {
    border-color: #cccccc66;
    color: #cccccc;
    background: transparent;
    font-size: .82rem;
}
#desgloseModal .btn-outline-primary:hover {
    background: rgba(255,255,255,0.08);
    border-color: #cccccc;
    color: #ffffff;
}

/* Botón Cancelar */
#desgloseModal .btn-secondary {
    background: #2e2e2e !important;
    border-color: #3a3a3a !important;
    color: #ffffff !important;
}
#desgloseModal .btn-secondary:hover {
    background: #3a3a3a !important;
}

/* Botón Guardar */
#desgloseModal .btn-primary {
    background: linear-gradient(135deg,#7c3aed,#9333ea) !important;
    border-color: #9333ea !important;
    color: #ffffff !important;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(147,51,234,0.4);
}
#desgloseModal .btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg,#6d28d9,#7c3aed) !important;
    box-shadow: 0 4px 18px rgba(147,51,234,0.55);
}
#desgloseModal .btn-primary:disabled {
    opacity: .45;
    box-shadow: none;
}

/* Botón revertir */
#desgloseModal .btn-outline-danger[id="btn-revertir-split"] {
    border-color: rgba(239,68,68,0.6);
    color: #fca5a5;
}

/* Barra de progreso — contraste automático por tema */
.desglose-bar-labels         { font-size: .82rem; color: var(--text-primary); }
.desglose-bar-labels strong  { color: var(--text-primary); font-weight: 700; }
.desglose-bar-track          { background: var(--border-color); border-radius:4px; height:7px; overflow:hidden; }

/* ── Overrides LIGHT MODE para desgloseModal ─────────────────── */
[data-theme="light"] #desgloseModal .modal-content,
[data-theme^="pastel"] #desgloseModal .modal-content {
    background: #ffffff !important;
    border-color: #d0d0d0 !important;
    box-shadow: 0 20px 60px rgba(0,0,0,0.18);
}
[data-theme="light"] #desgloseModal .modal-footer,
[data-theme^="pastel"] #desgloseModal .modal-footer {
    background: #f4f4f4;
    border-top-color: #ddd;
}
[data-theme="light"] #desgloseModal .glass-card,
[data-theme^="pastel"] #desgloseModal .glass-card {
    background: #f4f4f4 !important;
    border-color: #cccccc !important;
}
[data-theme="light"] #desgloseModal .glass-card .text-muted,
[data-theme^="pastel"] #desgloseModal .glass-card .text-muted {
    color: #555555 !important;
}
[data-theme="light"] #desgloseModal .glass-card strong,
[data-theme^="pastel"] #desgloseModal .glass-card strong {
    color: #111111 !important;
}
[data-theme="light"] #desgloseModal .dash-detalle-table,
[data-theme^="pastel"] #desgloseModal .dash-detalle-table {
    background: #fafafa;
    border-color: #cccccc;
}
[data-theme="light"] #desgloseModal .dash-detalle-table thead th,
[data-theme^="pastel"] #desgloseModal .dash-detalle-table thead th {
    background: #eeeeee !important;
    color: #111111 !important;
    border-bottom-color: #cccccc !important;
}
[data-theme="light"] #desgloseModal .dash-detalle-table tbody tr:nth-child(odd) td,
[data-theme^="pastel"] #desgloseModal .dash-detalle-table tbody tr:nth-child(odd) td {
    background: #ffffff !important;
}
[data-theme="light"] #desgloseModal .dash-detalle-table tbody tr:nth-child(even) td,
[data-theme^="pastel"] #desgloseModal .dash-detalle-table tbody tr:nth-child(even) td {
    background: #f7f7f7 !important;
}
[data-theme="light"] #desgloseModal .dash-detalle-table tbody td,
[data-theme^="pastel"] #desgloseModal .dash-detalle-table tbody td {
    border-bottom-color: #e0e0e0 !important;
    color: #111111 !important;
}
[data-theme="light"] #desgloseModal .form-control-sm,
[data-theme="light"] #desgloseModal .form-select-sm,
[data-theme^="pastel"] #desgloseModal .form-control-sm,
[data-theme^="pastel"] #desgloseModal .form-select-sm {
    background: #ffffff !important;
    border: 1px solid #bbbbbb !important;
    color: #111111 !important;
}
[data-theme="light"] #desgloseModal .form-control-sm::placeholder,
[data-theme^="pastel"] #desgloseModal .form-control-sm::placeholder {
    color: #888888 !important;
}
[data-theme="light"] #desgloseModal .btn-secondary,
[data-theme^="pastel"] #desgloseModal .btn-secondary {
    background: #e8e8e8 !important;
    border-color: #cccccc !important;
    color: #111111 !important;
}
[data-theme="light"] #desgloseModal .btn-outline-primary,
[data-theme^="pastel"] #desgloseModal .btn-outline-primary {
    border-color: #7c3aed;
    color: #7c3aed;
}
[data-theme="light"] #desgloseModal .btn-outline-primary:hover,
[data-theme^="pastel"] #desgloseModal .btn-outline-primary:hover {
    background: rgba(124,58,237,0.08);
}

.modal-footer .btn {
    flex: 1;
    min-width: 110px;
}

.btn-close-white {
    filter: brightness(0) invert(1);
}

/* Backdrop: oscuro en dark, suave en light */
.modal-backdrop.show {
    opacity: 0.75;
}
[data-theme="light"] .modal-backdrop.show,
[data-theme^="pastel"] .modal-backdrop.show {
    opacity: 0.45;
}

/* ============================================
   SUBMENU
   ============================================ */
.has-submenu > .submenu {
    list-style: none;
    padding: 3px 0 3px 14px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.has-submenu.open > .submenu {
    max-height: 300px;
}

.submenu li { margin-bottom: 0.2rem; }

.submenu a {
    font-size: 0.84rem !important;
    padding: 9px 8px 9px 12px !important;
    border-radius: 12px !important;
    transform: none !important; /* reset base, hover overrides */
}

.submenu a:hover {
    transform: translateX(4px) !important;
}

.submenu a i {
    font-size: 1rem !important;
    min-width: 22px !important;
    margin-right: 9px !important;
}

.submenu-arrow {
    min-width: auto !important;
    margin-right: 0 !important;
    margin-left: auto;
    font-size: 0.72rem !important;
    transition: transform 0.25s ease;
}

.has-submenu.open .submenu-arrow {
    transform: rotate(180deg);
}

/* Desktop collapsed: hide arrow + submenu completely (visibility stops pseudo-element bleed) */
@media (min-width: 768px) {
    .sidebar:not(:hover) .submenu-arrow { display: none; }
    .sidebar:not(:hover) .has-submenu > .submenu {
        max-height: 0 !important;
        overflow: hidden !important;
        visibility: hidden;      /* hides ::before pseudo-elements too */
    }
    .sidebar:hover .has-submenu > .submenu {
        visibility: visible;
    }
}

/* ============================================
   COLOR SWATCH (settings categorías)
   ============================================ */
.color-swatch {
    display: inline-block;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid rgba(255,255,255,0.2);
    vertical-align: middle;
}

.color-preset {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 2px solid rgba(255,255,255,0.2);
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s, border-color 0.2s;
}

.color-preset:hover {
    transform: scale(1.2);
    border-color: white;
}

/* ============================================
   GASTOS TABLE - Clean flat dark design
   ============================================ */

.gastos-table-wrap {
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255,255,255,0.02);
}

[data-theme="light"] .gastos-table-wrap,
[data-theme="pastel-blue"] .gastos-table-wrap,
[data-theme="pastel-green"] .gastos-table-wrap,
[data-theme="pastel-pink"] .gastos-table-wrap,
[data-theme="pastel-yellow"] .gastos-table-wrap,
[data-theme="pastel-lavender"] .gastos-table-wrap {
    border-color: rgba(0,0,0,0.08);
    background: rgba(255,255,255,0.6);
}

.table-gastos {
    /* Override Bootstrap's table CSS variables */
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-primary);
    --bs-table-striped-bg: transparent;
    --bs-table-hover-bg: rgba(255,255,255,0.04);
    --bs-table-border-color: transparent;
    color: var(--text-primary) !important;
    background-color: transparent !important;
    border-collapse: collapse;
    width: 100%;
    margin: 0;
}

/* Force transparent on every cell — prevents Bootstrap from injecting white */
.table-gastos > :not(caption) > * > * {
    background-color: transparent !important;
    color: inherit;
    border-bottom-width: 0;
}

.table-gastos thead th {
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    white-space: nowrap;
}

[data-theme="light"] .table-gastos thead th,
[data-theme^="pastel"] .table-gastos thead th {
    border-bottom-color: rgba(0,0,0,0.07);
}

.table-gastos tbody td {
    padding: 0.55rem 0.85rem;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    vertical-align: middle;
    font-size: 0.83rem;
}

[data-theme="light"] .table-gastos tbody td,
[data-theme^="pastel"] .table-gastos tbody td {
    border-bottom-color: rgba(0,0,0,0.05);
}

.table-gastos tbody tr:last-child td {
    border-bottom: none;
}

.table-gastos tbody tr:hover {
    background: rgba(255,255,255,0.04) !important;
}

[data-theme="light"] .table-gastos tbody tr:hover,
[data-theme^="pastel"] .table-gastos tbody tr:hover {
    background: rgba(0,0,0,0.03) !important;
}

/* Columns */
.td-desc {
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
    color: var(--text-primary);
}

.td-fecha {
    white-space: nowrap;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
}

.td-banco {
    white-space: nowrap;
}

.banco-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
    flex-shrink: 0;
}

.banco-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
    vertical-align: middle;
}

.td-monto { white-space: nowrap; }

.monto-value {
    font-weight: 700;
    font-size: 0.86rem;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}

.td-ref {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.82rem;
    font-family: monospace;
    color: var(--text-secondary);
}

/* Category pill select */
.cat-pill-select {
    appearance: auto;
    background: rgba(255,255,255,0.05) !important;
    border: 1px solid rgba(255,255,255,0.12) !important;
    border-radius: 20px;
    color: var(--text-secondary) !important;
    font-size: 0.78rem;
    padding: 0.25rem 0.6rem;
    height: 28px;
    width: 100%;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    min-width: 120px;
}

.cat-pill-select:hover {
    border-color: rgba(255,255,255,0.25) !important;
}

.cat-pill-select:focus {
    outline: none;
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.15);
}

.cat-pill-select.cat-assigned {
    font-weight: 600;
}

.cat-pill-select:disabled {
    opacity: 0.4;
    cursor: wait;
}

[data-theme="light"] .cat-pill-select,
[data-theme^="pastel"] .cat-pill-select {
    background: rgba(0,0,0,0.04) !important;
    border-color: rgba(0,0,0,0.15) !important;
    color: var(--text-secondary) !important;
}

/* ============================================
   CATEGORY DROPDOWN - Custom searchable
   ============================================ */

.cat-dd {
    min-width: 140px;
}

.cat-dd-trigger {
    display: flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 500;
    padding: 0.22rem 0.65rem;
    height: 28px;
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    transition: border-color 0.2s, background 0.2s;
}

.cat-dd-trigger:hover {
    border-color: rgba(255,255,255,0.28);
    background: rgba(255,255,255,0.08);
}

.cat-dd-trigger:disabled {
    opacity: 0.4;
    cursor: wait;
}

.cat-dd-label {
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.cat-dd-arrow {
    margin-left: auto;
    font-size: 0.62rem;
    flex-shrink: 0;
    opacity: 0.55;
    transition: transform 0.2s;
}

.cat-dd-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
}

.cat-dd-dot.empty {
    background: rgba(255,255,255,0.2) !important;
}

[data-theme="light"] .cat-dd-trigger,
[data-theme^="pastel"] .cat-dd-trigger {
    background: rgba(0,0,0,0.04);
    border-color: rgba(0,0,0,0.15);
}

/* Panel */
.cat-dd-panel {
    position: fixed;
    z-index: 1055;
    background: var(--dark-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.45);
    overflow: hidden;
    min-width: 230px;
    max-width: 300px;
    display: none;
    animation: slideIn 0.14s ease-out;
}

.cat-dd-panel.open {
    display: block;
}

.cat-dd-search-wrap {
    position: relative;
    border-bottom: 1px solid var(--border-color);
}

.cat-dd-search-icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 0.8rem;
    pointer-events: none;
}

.cat-dd-search {
    width: 100%;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    color: var(--text-primary) !important;
    font-size: 0.82rem;
    padding: 0.55rem 0.75rem 0.55rem 2rem !important;
    height: 38px;
    outline: none;
}

.cat-dd-search::placeholder {
    color: var(--text-secondary);
    opacity: 0.65;
}

.cat-dd-list {
    list-style: none;
    padding: 4px 0;
    margin: 0;
    max-height: 260px;
    overflow-y: auto;
}

.cat-dd-group {
    padding: 6px 12px 3px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-secondary);
    opacity: 0.6;
    pointer-events: none;
}

.cat-dd-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 14px;
    font-size: 0.82rem;
    cursor: pointer;
    color: var(--text-primary);
    transition: background 0.12s;
    white-space: nowrap;
}

.cat-dd-item:hover {
    background: rgba(255,255,255,0.07);
}

.cat-dd-item.active {
    background: rgba(var(--primary-rgb), 0.15);
    color: var(--primary-light);
    font-weight: 600;
}

.cat-dd-empty {
    padding: 14px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Light themes */
[data-theme="light"] .cat-dd-panel,
[data-theme^="pastel"] .cat-dd-panel {
    background: #fff;
    box-shadow: 0 12px 40px rgba(0,0,0,0.18);
}

[data-theme="light"] .cat-dd-item:hover,
[data-theme^="pastel"] .cat-dd-item:hover {
    background: rgba(0,0,0,0.05);
}

/* Draggable / sortable column headers */
.col-draggable {
    cursor: grab;
    user-select: none;
    position: relative;
}

.col-draggable:active {
    cursor: grabbing;
}

.col-sortable {
    cursor: pointer;
}

.col-dragging {
    opacity: 0.45;
}

.col-drag-over {
    background: rgba(var(--primary-rgb), 0.18) !important;
    outline: 2px dashed rgba(var(--primary-rgb), 0.5);
    outline-offset: -2px;
}

.sort-icon {
    font-size: 0.7rem;
    vertical-align: middle;
}

/* Row exit animation */
.gasto-row {
    transition: opacity 0.32s ease, transform 0.32s ease;
}

.gasto-row.row-exit {
    opacity: 0;
    transform: translateX(16px);
    pointer-events: none;
}

/* ============================================
   VIEWS
   ============================================ */
.view { display: none; }
.view.active { display: block; }
.fade-in { animation: fadeIn 0.4s ease-out; }

/* ============================================
   KEYFRAMES
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slide-down {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ---- Spinner utility ---- */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(99,102,241,0.3); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(99,102,241,0.5); }

/* ============================================
   GLOBAL TRANSITIONS
   ============================================ */
.content, .sidebar, .glass-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   ============================================
   SCALE UP: TABLET (min-width: 576px)
   ============================================
   ============================================ */
@media (min-width: 576px) {
    .content {
        padding: 1rem 1.25rem;
        padding-top: 4rem;
    }

    .page-title {
        font-size: 1.9rem;
    }

    .glass-card {
        padding: 1.15rem;
        border-radius: 14px;
    }

    .stat-icon {
        width: 48px;
        height: 48px;
        min-width: 48px;
        font-size: 1.3rem;
    }

    .stat-value {
        font-size: 1.35rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    .table-custom thead th {
        font-size: 0.75rem;
        padding: 0.75rem 0.7rem;
    }

    .table-custom tbody td {
        font-size: 0.85rem;
        padding: 0.65rem 0.7rem;
    }

    .modal-dialog {
        max-width: 500px;
    }

    .modal-footer .btn {
        flex: 0 1 auto;
        min-width: auto;
    }
}

/* ============================================
   ============================================
   SCALE UP: TABLET LANDSCAPE (min-width: 768px)
   Sidebar aparece colapsado (80px)
   ============================================
   ============================================ */
@media (min-width: 768px) {
    /* Ocultar boton hamburguesa */
    .mobile-menu-toggle {
        display: none;
    }

    /* Sidebar: fijo colapsado, hover expand */
    .sidebar {
        width: var(--sidebar-width);
        max-width: none;
        transform: translateX(0);
        border-radius: 0 20px 20px 0;
        box-shadow: var(--shadow-light);
        padding: 15px;
    }

    .sidebar:hover {
        width: var(--sidebar-expanded);
    }

    /* Sidebar icon: visible colapsado, oculta al expandir */
    .sidebar-icon {
        opacity: 1;
        height: 50px;
        margin: 0 auto;
    }

    .sidebar:hover .sidebar-icon {
        opacity: 0;
        height: 0;
        margin: 0;
        padding: 0;
        overflow: hidden;
        transform: scale(0.8);
    }

    /* Titulo: oculto colapsado, visible al expandir */
    .sidebar h3 {
        opacity: 0;
    }

    .sidebar:hover h3 {
        opacity: 1;
    }

    /* Menu labels: ocultos colapsado */
    .menu a span {
        opacity: 0;
    }

    .sidebar:hover .menu a span {
        opacity: 1;
    }

    /* User name + logout: ocultos colapsado */
    .user-name,
    .btn-logout {
        opacity: 0;
    }

    .sidebar:hover .user-name,
    .sidebar:hover .btn-logout {
        opacity: 1;
    }

    /* Content: margen para sidebar colapsado */
    .content {
        padding: 1.25rem 2rem;
        padding-left: 140px;
        padding-right: 40px;
        max-width: 95%;
        margin-left: auto;
        margin-right: auto;
        padding-top: 1.5rem;
    }

    /* Content se empuja con hover del sidebar */
    .sidebar:hover ~ .content {
        padding-left: 320px;
        max-width: 90%;
    }

    .page-title {
        font-size: 2.4rem;
        margin-bottom: 1.75rem;
    }

    .glass-card {
        padding: 1.5rem;
        margin-bottom: 1.25rem;
        border-radius: 16px;
    }

    .stat-card {
        padding: 1.1rem 1.35rem;
        gap: 1.15rem;
    }

    .stat-icon {
        width: 52px;
        height: 52px;
        min-width: 52px;
        border-radius: 14px;
        font-size: 1.4rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.78rem;
    }

    .form-control,
    .form-select {
        height: 38px;
        font-size: 0.875rem;
    }

    .table-custom {
        min-width: 0;
    }

    .table-custom thead th {
        font-size: 0.78rem;
        padding: 0.8rem 0.85rem;
    }

    .table-custom tbody td {
        font-size: 0.86rem;
        padding: 0.7rem 0.85rem;
    }

    .modal-dialog {
        max-width: 600px;
    }

    .modal-header {
        padding: 1rem 1.5rem;
    }

    .modal-body {
        padding: 1.5rem;
    }

    .modal-footer {
        padding: 1rem 1.5rem;
        flex-wrap: nowrap;
    }

    .top-bar {
        margin-bottom: 1.5rem;
    }

    .theme-select {
        font-size: 0.8rem;
        min-width: 150px;
    }
}

/* ============================================
   ============================================
   SCALE UP: DESKTOP (min-width: 1024px)
   ============================================
   ============================================ */
@media (min-width: 1024px) {
    .page-title {
        font-size: 2.8rem;
        margin-bottom: 2rem;
    }

    .glass-card {
        padding: 1.75rem;
        margin-bottom: 1.5rem;
    }

    .stat-card {
        padding: 1.25rem 1.5rem;
        gap: 1.25rem;
    }

    .stat-icon {
        width: 56px;
        height: 56px;
        min-width: 56px;
        border-radius: 16px;
        font-size: 1.5rem;
    }

    .stat-value {
        font-size: 1.6rem;
    }

    .stat-label {
        font-size: 0.8rem;
    }

    .table-custom thead th {
        font-size: 0.8rem;
        padding: 0.85rem 1rem;
    }

    .table-custom tbody td {
        font-size: 0.88rem;
        padding: 0.75rem 1rem;
    }

    .modal-dialog {
        max-width: 700px;
    }

    .btn {
        min-height: 38px;
        font-size: 0.88rem;
    }

    .btn-sm {
        min-height: 32px;
        font-size: 0.8rem;
    }
}

/* ============================================
   ============================================
   SCALE UP: LARGE DESKTOP (min-width: 1400px)
   ============================================
   ============================================ */
@media (min-width: 1400px) {
    .content {
        max-width: 92%;
    }

    .sidebar:hover ~ .content {
        max-width: 88%;
    }

    .modal-dialog {
        max-width: 800px;
    }
}

/* ============================================
   DASHBOARD
   ============================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
    align-items: start;
}

.dash-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.25rem 1.5rem 1.25rem 1.75rem;
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.2s, border-color 0.2s;
    min-height: 100px;
}

.dash-card[data-ancho="1"] { grid-column: span 1; }
.dash-card[data-ancho="2"] { grid-column: span 2; }
.dash-card[data-ancho="3"] { grid-column: span 3; }
.dash-card[data-ancho="4"] { grid-column: span 4; }
.dash-card[data-ancho="6"] { grid-column: span 6; }

.dash-card-accent {
    position: absolute;
    top: 0; left: 0;
    width: 5px; height: 100%;
    border-radius: 16px 0 0 16px;
}

.dash-card-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.5rem;
}

.dash-card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
    transition: color 0.3s;
    word-break: break-word;
}

.dash-card-value.dash-updated {
    color: var(--primary-color);
}

.dash-card-meta {
    font-size: 0.8rem;
    color: var(--primary-color);
    margin-top: 0.35rem;
    opacity: 0.85;
}

.dash-card-eye {
    position: absolute;
    top: 0.55rem; right: 0.6rem;
    background: none;
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--text-secondary);
    opacity: 0.5;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    transition: opacity 0.2s, background 0.2s, border-color 0.2s;
    z-index: 2;
}

.dash-card-eye:hover {
    opacity: 1;
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.35);
}

.dash-card.edit-mode .dash-card-eye {
    display: none;
}

.dash-card-actions {
    position: absolute;
    top: 0.6rem; right: 0.6rem;
    display: none;
    gap: 0.25rem;
    z-index: 2;
}

.dash-card.edit-mode {
    border-color: var(--primary-color);
}

.dash-card.edit-mode .dash-card-actions {
    display: flex;
}

.btn-xs {
    padding: 0.15rem 0.4rem;
    font-size: 0.75rem;
    line-height: 1.4;
}

.dash-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 3rem 1rem;
}

/* Sidebar user info + logout */
.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.btn-logout {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 0.2rem 0.35rem;
    border-radius: 6px;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
    flex-shrink: 0;
}

.btn-logout:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.12);
}

/* Responsive dashboard */
@media (max-width: 1200px) {
    .dashboard-grid { grid-template-columns: repeat(4, 1fr); }
    .dash-card[data-ancho="6"] { grid-column: span 4; }
    .dash-card[data-ancho="4"] { grid-column: span 4; }
    .dash-card[data-ancho="3"] { grid-column: span 2; }
}

@media (max-width: 768px) {
    .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
    .dash-card[data-ancho] { grid-column: span 1; }
    .dash-card[data-ancho="3"],
    .dash-card[data-ancho="4"],
    .dash-card[data-ancho="6"] { grid-column: span 2; }
    .dash-card-value { font-size: 1.5rem; }
}

@media (max-width: 480px) {
    .dashboard-grid { grid-template-columns: 1fr 1fr; }
}

/* ============================================
   CAPTURADORES
   ============================================ */
.settings-nav .nav-link {
    color: var(--text-secondary);
    border-radius: 8px;
    font-size: .875rem;
    font-weight: 500;
    padding: .4rem .9rem;
    transition: background .15s, color .15s;
}
.settings-nav .nav-link.active {
    background: var(--primary-color);
    color: #fff;
}
.settings-nav .nav-link:not(.active):hover {
    background: var(--glass-bg);
    color: var(--text-primary);
}

.capt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.capt-card {
    background: var(--bg-secondary, rgba(255,255,255,.04));
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem 1.1rem;
    transition: border-color .2s;
}

.capt-name { font-size: .95rem; }

.capt-meta {
    font-size: .78rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: .35rem;
    flex-wrap: wrap;
}
.capt-sep { opacity: .4; }

.capt-estado-live    { color: #10b981; font-weight: 600; }
.capt-estado-idle    { color: #f59e0b; font-weight: 600; }
.capt-estado-offline { color: #ef4444; font-weight: 600; }

.capt-bancos { display: flex; gap: .3rem; flex-wrap: wrap; }
.capt-banco-badge {
    background: var(--glass-border);
    color: var(--text-secondary);
    font-size: .7rem;
    font-weight: 500;
    border-radius: 5px;
    padding: .1rem .45rem;
}

/* Status dot */
.status-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.status-dot.status-live {
    background: #10b981;
    box-shadow: 0 0 0 2px rgba(16,185,129,.25);
    animation: pulse-live 2s infinite;
}
.status-dot.status-idle    { background: #f59e0b; }
.status-dot.status-offline { background: #ef4444; }

@keyframes pulse-live {
    0%, 100% { box-shadow: 0 0 0 2px rgba(16,185,129,.25); }
    50%       { box-shadow: 0 0 0 6px rgba(16,185,129,.08); }
}
