/* =====================================================
   MISFINANZAS - CSS Principal
   Sistema de Finanzas Personales
   ===================================================== */

/* ====== VARIABLES ====== */
:root {
    --accent: #4F46E5;
    --accent-hover: #4338CA;
    --accent-light: rgba(79, 70, 229, 0.1);
    --accent-glow: rgba(79, 70, 229, 0.25);
    
    --green: #10B981;
    --green-light: rgba(16, 185, 129, 0.1);
    --red: #EF4444;
    --red-light: rgba(239, 68, 68, 0.1);
    --yellow: #F59E0B;
    --yellow-light: rgba(245, 158, 11, 0.1);
    --blue: #3B82F6;
    --blue-light: rgba(59, 130, 246, 0.1);
    
    --bg-primary: #F8FAFC;
    --bg-secondary: #F1F5F9;
    --bg-card: #FFFFFF;
    --bg-hover: #F1F5F9;
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    --border: #E2E8F0;
    --border-light: #F1F5F9;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.07);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.08);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    
    --font: 'Plus Jakarta Sans', -apple-system, sans-serif;
    --sidebar-width: 260px;
    --topbar-height: 64px;
}

/* ====== RESET ====== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    width: 100%;
}

a { color: var(--accent); text-decoration: none; }

/* ====== LAYOUT ====== */
.app-layout {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
}

/* ====== SIDEBAR ====== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 1.25rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border-light);
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    background: var(--accent);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-logo svg { width: 20px; height: 20px; color: white; }

.sidebar-brand {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 1rem 0.75rem 0.4rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.15s;
    cursor: pointer;
    text-decoration: none;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-item.active svg { opacity: 1; }

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-light);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--accent);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
}

.user-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ====== MAIN CONTENT ====== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    overflow-x: hidden;
    max-width: 100%;
}

/* ====== TOPBAR ====== */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar-left h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.topbar-left .breadcrumb {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-primary);
}

.menu-toggle svg { width: 24px; height: 24px; }

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ====== PAGE CONTENT ====== */
.page-content {
    padding: 1.5rem;
    max-width: 1400px;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* ====== CARDS ====== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
    box-sizing: border-box;
    overflow: hidden;
}

.card:hover { box-shadow: var(--shadow-md); }
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.card-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

/* ====== STAT CARDS ====== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: all 0.2s;
    box-sizing: border-box;
    overflow: hidden;
    min-width: 0;
}

.stat-card:hover { 
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.green { background: var(--green-light); color: var(--green); }
.stat-icon.red { background: var(--red-light); color: var(--red); }
.stat-icon.blue { background: var(--blue-light); color: var(--blue); }
.stat-icon.yellow { background: var(--yellow-light); color: var(--yellow); }
.stat-icon.purple { background: rgba(139, 92, 246, 0.1); color: #8B5CF6; }

.stat-info { flex: 1; }

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.15rem;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    word-break: break-word;
    overflow-wrap: break-word;
}

.stat-value.positive { color: var(--green); }
.stat-value.negative { color: var(--red); }

.stat-change {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.2rem;
}

/* ====== GRID LAYOUTS ====== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.5rem; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; }

/* ====== TABLES ====== */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 0.85rem 1rem;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.data-table tr:hover td {
    background: var(--bg-hover);
}

.data-table .monto-positivo { color: var(--green); font-weight: 700; }
.data-table .monto-negativo { color: var(--red); font-weight: 700; }

/* ====== BADGES ====== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-green { background: var(--green-light); color: var(--green); }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-blue { background: var(--blue-light); color: var(--blue); }
.badge-yellow { background: var(--yellow-light); color: var(--yellow); }

/* ====== BUTTONS ====== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font);
    text-decoration: none;
    white-space: nowrap;
}

.btn svg { width: 18px; height: 18px; }

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 12px var(--accent-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-success { background: var(--green); color: white; }
.btn-success:hover { background: #059669; }

.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #DC2626; }

.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn-sm svg { width: 16px; height: 16px; }

.btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ====== FORMS ====== */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

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

.form-control {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: var(--font);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
    background: var(--bg-card);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394A3B8' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 6l3.5 4 3.5-4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

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

/* ====== MODAL ====== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay.show { display: flex; }

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    animation: modalIn 0.25s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: none;
    background: var(--bg-secondary);
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.15s;
}

.modal-close:hover { background: var(--red-light); color: var(--red); }

.modal-body { padding: 1.5rem; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-light);
}

/* ====== PROGRESS BAR ====== */
.progress-bar {
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* ====== CUENTAS LIST ====== */
.cuenta-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem;
    border-radius: var(--radius-md);
    transition: background 0.15s;
    cursor: pointer;
}

.cuenta-item:hover { background: var(--bg-hover); }

.cuenta-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cuenta-icon svg { width: 20px; height: 20px; color: white; }

.cuenta-info { flex: 1; min-width: 0; }

.cuenta-nombre {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cuenta-tipo {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.cuenta-saldo {
    font-weight: 700;
    font-size: 0.95rem;
    text-align: right;
    white-space: nowrap;
}

/* ====== MOVIMIENTO ROW ====== */
.mov-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-light);
}

.mov-item:last-child { border-bottom: none; }

.mov-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mov-icon svg { width: 18px; height: 18px; }

.mov-info { flex: 1; min-width: 0; }

.mov-desc {
    font-weight: 600;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mov-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    gap: 0.5rem;
}

.mov-monto {
    font-weight: 700;
    font-size: 0.9rem;
    text-align: right;
    white-space: nowrap;
}

/* ====== PRESUPUESTO ITEM ====== */
.pres-item {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-light);
}

.pres-item:last-child { border-bottom: none; }

.pres-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.pres-cat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
}

.pres-amounts {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.pres-amounts span { font-weight: 700; }

/* ====== QUICK ADD (FLOATING) ====== */
.fab-add {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 56px;
    height: 56px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 24px var(--accent-glow);
    cursor: pointer;
    z-index: 90;
    transition: all 0.2s;
}

.fab-add:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 32px var(--accent-glow);
}

.fab-add svg { width: 28px; height: 28px; }

/* ====== CHART CONTAINER ====== */
.chart-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    height: 280px;
    overflow: hidden;
}

.chart-container canvas {
    max-width: 100% !important;
}

/* ====== QUICK TABS ====== */
.quick-tabs {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 3px;
}

.quick-tab {
    padding: 0.5rem 1rem;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font);
}

.quick-tab.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* ====== EMPTY STATE ====== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.empty-state p {
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* ====== TOAST ====== */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    z-index: 300;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-lg);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ====== SIDEBAR OVERLAY (MOBILE) ====== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 99;
}

/* ====== FILTER BAR ====== */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1.5rem;
}

.filter-bar .form-control {
    width: auto;
    min-width: 140px;
}

/* ====== RESPONSIVE ====== */
@media (max-width: 1024px) {
    .grid-2-1 { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-overlay.show {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .menu-toggle {
        display: flex;
    }
    
    .page-content {
        padding: 0.75rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .stat-card {
        padding: 0.75rem;
        gap: 0.6rem;
    }
    
    .stat-icon {
        width: 36px;
        height: 36px;
        border-radius: 10px;
    }
    
    .stat-icon svg {
        width: 18px;
        height: 18px;
    }
    
    .stat-value {
        font-size: 1.05rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    .stat-change {
        font-size: 0.65rem;
    }
    
    .topbar {
        padding: 0 0.75rem;
        height: 56px;
    }
    
    .topbar-left h1 {
        font-size: 1.05rem;
    }
    
    .card {
        padding: 1rem;
        border-radius: var(--radius-lg);
    }
    
    .card-header {
        margin-bottom: 0.75rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .card-title {
        font-size: 0.9rem;
    }
    
    /* Filter bar mobile */
    .filter-bar {
        gap: 0.5rem;
        margin-bottom: 1rem;
    }
    
    .filter-bar .form-control {
        width: 100%;
        min-width: 0;
        font-size: 0.85rem;
        padding: 0.55rem 0.7rem;
    }
    
    .filter-bar .btn {
        width: 100%;
        justify-content: center;
    }
    
    .filter-bar > a.btn,
    .filter-bar > strong {
        width: auto;
    }
    
    /* Tables mobile - horizontal scroll */
    .table-container {
        margin: 0 -1rem;
        padding: 0 1rem;
    }
    
    .data-table td, .data-table th {
        padding: 0.5rem 0.4rem;
        font-size: 0.75rem;
    }
    
    .data-table th {
        font-size: 0.65rem;
    }
    
    /* Movimiento items mobile */
    .mov-item {
        gap: 0.6rem;
        padding: 0.6rem 0;
    }
    
    .mov-icon {
        width: 34px;
        height: 34px;
        border-radius: 8px;
    }
    
    .mov-icon svg {
        width: 16px;
        height: 16px;
    }
    
    .mov-desc {
        font-size: 0.8rem;
    }
    
    .mov-meta {
        font-size: 0.65rem;
    }
    
    .mov-monto {
        font-size: 0.8rem;
    }
    
    /* Cuenta items mobile */
    .cuenta-item {
        padding: 0.65rem 0.25rem;
        gap: 0.6rem;
    }
    
    .cuenta-icon {
        width: 36px;
        height: 36px;
        border-radius: 10px;
    }
    
    .cuenta-icon svg {
        width: 18px;
        height: 18px;
    }
    
    .cuenta-nombre {
        font-size: 0.8rem;
    }
    
    .cuenta-tipo {
        font-size: 0.65rem;
    }
    
    .cuenta-saldo {
        font-size: 0.8rem;
    }
    
    /* Presupuesto mobile */
    .pres-header {
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .pres-cat {
        font-size: 0.8rem;
    }
    
    .pres-amounts {
        font-size: 0.7rem;
    }
    
    /* Charts mobile */
    .chart-container {
        height: 220px;
    }
    
    /* Buttons mobile */
    .btn {
        padding: 0.5rem 0.9rem;
        font-size: 0.8rem;
    }
    
    .btn-sm {
        padding: 0.35rem 0.6rem;
        font-size: 0.75rem;
    }
    
    .btn-icon {
        width: 32px;
        height: 32px;
    }
    
    /* Modal mobile */
    .modal {
        margin: 0;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        max-height: 92vh;
        align-self: flex-end;
        max-width: 100%;
    }
    
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }
    
    .modal-header {
        padding: 1rem;
        position: sticky;
        top: 0;
        background: var(--bg-card);
        z-index: 2;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-footer {
        padding: 0.75rem 1rem;
        position: sticky;
        bottom: 0;
        background: var(--bg-card);
        z-index: 2;
    }
    
    .modal-header h3 {
        font-size: 1rem;
    }
    
    .form-control {
        padding: 0.6rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .form-group label {
        font-size: 0.75rem;
    }
    
    .form-group {
        margin-bottom: 0.75rem;
    }
    
    /* Quick tabs mobile */
    .quick-tabs {
        width: 100%;
    }
    
    .quick-tab {
        flex: 1;
        text-align: center;
        padding: 0.45rem 0.5rem;
        font-size: 0.75rem;
    }
    
    /* FAB mobile */
    .fab-add {
        bottom: 1rem;
        right: 1rem;
        width: 50px;
        height: 50px;
        border-radius: 14px;
    }
    
    .fab-add svg {
        width: 24px;
        height: 24px;
    }
    
    /* Badge mobile */
    .badge {
        padding: 0.15rem 0.45rem;
        font-size: 0.65rem;
    }
    
    /* Toast mobile */
    .toast {
        left: 1rem;
        right: 1rem;
        transform: translateY(100px);
        text-align: center;
        font-size: 0.8rem;
    }
    
    .toast.show {
        transform: translateY(0);
    }
    
    /* Nav section title */
    .nav-section-title {
        font-size: 0.65rem;
    }
    
    /* Empty state mobile */
    .empty-state {
        padding: 2rem 0.5rem;
    }
    
    .empty-state svg {
        width: 36px;
        height: 36px;
    }
    
    .empty-state p {
        font-size: 0.85rem;
    }
}

@media (max-width: 380px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.4rem;
    }
    
    .stat-card {
        flex-direction: row;
        padding: 0.65rem;
    }
    
    .stat-value {
        font-size: 1rem;
    }
    
    .page-content {
        padding: 0.5rem;
    }
    
    .filter-bar {
        gap: 0.4rem;
    }
    
    .card {
        padding: 0.75rem;
        border-radius: var(--radius-md);
    }
    
    .cuenta-item {
        padding: 0.5rem 0;
    }
    
    .topbar-left h1 {
        font-size: 0.95rem;
    }
    
    .data-table td, .data-table th {
        padding: 0.4rem 0.3rem;
        font-size: 0.7rem;
    }
}

/* ====== ANIMATIONS ====== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.fade-in { animation: fadeIn 0.3s ease; }
.slide-up { animation: slideUp 0.3s ease; }

/* ====== SCROLLBAR ====== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ====== ACCOUNT TYPE COLORS ====== */
.tipo-efectivo { background: var(--green); }
.tipo-banco { background: var(--blue); }
.tipo-credito { background: var(--red); }
.tipo-prestamo-banco { background: var(--yellow); }
.tipo-prestamo-personal { background: #8B5CF6; }
.tipo-inversion { background: #06B6D4; }
.tipo-ahorro { background: #EC4899; }

/* ====== MOBILE SHOW/HIDE ====== */
.show-mobile-only { display: none; }
.hide-mobile { display: block; }

@media (max-width: 768px) {
    .show-mobile-only { display: block; }
    .hide-mobile { display: none !important; }
}
