:root {
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.4);
    --secondary: #10b981;
    --danger: #f43f5e;
    --dark: #1e293b;
    --text: #334155;
    --text-light: #94a3b8;
    --bg-color: #f8fafc;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --shadow-soft: 0 8px 30px rgba(0, 0, 0, 0.04);
    --font-main: 'Plus Jakarta Sans', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; font-family: var(--font-main); }
body { background: var(--bg-color); color: var(--text); overflow-x: hidden; min-height: 100vh; }

/* FONDO ANIMADO */
.bg-blobs { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.5; }
.blob-1 { top: -10%; right: -10%; width: 300px; height: 300px; background: #e0e7ff; animation: float 10s infinite alternate; }
.blob-2 { bottom: 10%; left: -10%; width: 250px; height: 250px; background: #d1fae5; animation: float 10s infinite alternate-reverse; }

.app-container { max-width: 480px; margin: 0 auto; padding: 0 20px; position: relative; z-index: 1; }

/* HEADER */
.glass-header { padding-top: 50px; padding-bottom: 20px; }
.header-content { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }
.user-greeting span { font-size: 0.9rem; color: var(--text-light); }
.user-greeting h1 { font-size: 1.5rem; font-weight: 800; color: var(--dark); display: flex; align-items: center; gap: 8px; }
.notification-dot { width: 40px; height: 40px; background: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-soft); color: var(--text); }

/* TARJETA BALANCE */
.main-balance-card {
    background: linear-gradient(135deg, #4f46e5, #818cf8);
    color: white; padding: 25px; border-radius: 28px;
    box-shadow: 0 20px 40px -10px var(--primary-glow);
    position: relative; overflow: hidden; margin-bottom: 10px;
}
.main-balance-card p { opacity: 0.9; font-size: 0.9rem; margin-bottom: 5px; }
.main-balance-card h2 { font-size: 2.5rem; font-weight: 800; letter-spacing: -1px; margin-bottom: 15px; }
.trend-indicator { background: rgba(255,255,255,0.2); display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 20px; font-size: 0.8rem; backdrop-filter: blur(5px); }

/* ESTADÍSTICAS RÁPIDAS */
.quick-stats { display: flex; gap: 15px; margin: 20px 0; }
.stat-pill { flex: 1; background: white; padding: 15px; border-radius: 20px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow-soft); }
.icon-circle { width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }
.income .icon-circle { background: #d1fae5; color: var(--secondary); }
.expense .icon-circle { background: #fee2e2; color: var(--danger); }
.stat-pill div { display: flex; flex-direction: column; overflow: hidden; }
.stat-pill span { font-weight: 700; color: var(--dark); font-size: 1rem; white-space: nowrap; }

/* LISTA DE TRANSACCIONES */
.section-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.transaction-item {
    display: flex; justify-content: space-between; align-items: center;
    background: white; padding: 16px; margin-bottom: 12px;
    border-radius: 20px; box-shadow: var(--shadow-soft);
    transition: transform 0.2s;
}
.transaction-item:active { transform: scale(0.98); }
.t-left { display: flex; align-items: center; gap: 15px; overflow: hidden; }
.t-icon { width: 45px; height: 45px; background: #f1f5f9; border-radius: 14px; display: flex; align-items: center; justify-content: center; color: #64748b; font-size: 1.2rem; flex-shrink: 0; }
.t-info { overflow: hidden; }
.t-info h4 { font-size: 1rem; font-weight: 600; color: var(--dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.amount { font-weight: 700; font-size: 1rem; white-space: nowrap; }
.amount.plus { color: var(--secondary); }
.amount.minus { color: var(--dark); }

/* MENÚ FLOTANTE */
.floating-dock { position: fixed; bottom: 25px; left: 50%; transform: translateX(-50%); width: 90%; max-width: 400px; z-index: 1000; }
.dock-container {
    background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(15px);
    border-radius: 24px; padding: 10px 15px;
    display: flex; justify-content: space-between;
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.15); border: 1px solid rgba(255,255,255,0.5);
}
.nav-item { background: none; border: none; padding: 8px; flex: 1; display: flex; flex-direction: column; align-items: center; color: var(--text-light); transition: all 0.3s; }
.nav-item.active { color: var(--primary); }
.nav-label { font-size: 0.7rem; font-weight: 600; margin-top: 4px; }

/* FAB */
.fab-container { position: fixed; bottom: 110px; right: 25px; z-index: 900; }
.fab-main { width: 60px; height: 60px; border-radius: 50%; background: var(--dark); color: white; border: none; font-size: 1.5rem; box-shadow: 0 10px 25px rgba(30, 41, 59, 0.3); cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* VISTAS */
.view-section { display: none; padding-top: 20px; animation: fadeIn 0.4s ease; }
.view-section.active { display: block; }

/* ARREGLO GRAFICA INFINITA */
.chart-wrapper { 
    position: relative; 
    padding: 20px; 
    background: white; 
    border-radius: 24px; 
    height: 300px; /* IMPORTANTE: ALTURA FIJA */
    box-shadow: var(--shadow-soft); 
    margin-bottom: 25px;
    overflow: hidden; /* IMPORTANTE: EVITA DESBORDE */
    display: flex;
    align-items: center;
    justify-content: center;
}
canvas#statsChart {
    max-height: 100% !important;
    max-width: 100% !important;
}
.chart-center-text { 
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); 
    text-align: center; pointer-events: none; 
}

/* AJUSTES - NUEVOS ESTILOS PARA CELDAS */
.settings-group { background: white; padding: 20px; border-radius: 24px; box-shadow: var(--shadow-soft); margin-bottom: 20px; }
.input-row-settings, .add-cat-box { display: flex; gap: 10px; margin-top: 15px; }
.input-row-settings input, .add-cat-box input {
    flex: 1; padding: 12px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; outline: none; min-width: 0;
}
.btn-primary-sm { background: var(--primary); color: white; border: none; padding: 0 20px; border-radius: 12px; font-weight: 600; }
.btn-icon-plus { width: 44px; background: var(--primary); color: white; border: none; border-radius: 12px; cursor: pointer; flex-shrink: 0; }
.tags-container { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; }
.tag-item { background: #f1f5f9; padding: 8px 12px; border-radius: 12px; font-size: 0.9rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.btn-danger-block { width: 100%; padding: 15px; background: #fee2e2; color: var(--danger); border: none; border-radius: 16px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 10px; }

/* MODAL */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); backdrop-filter: blur(5px); z-index: 2000; display: none; align-items: flex-end; }
.modal-card { background: white; width: 100%; border-radius: 35px 35px 0 0; padding: 30px 25px 40px; animation: slideUp 0.3s; }
.amount-wrapper { display: flex; justify-content: center; align-items: baseline; margin-bottom: 30px; font-weight: 800; color: var(--dark); }
.amount-wrapper input { border: none; font-size: 3.5rem; font-weight: 800; width: 200px; text-align: center; outline: none; color: var(--dark); background: transparent; }
.input-field { background: #f8fafc; border-radius: 16px; padding: 15px; display: flex; align-items: center; gap: 15px; margin-bottom: 15px; }
.input-field input, .input-field select { border: none; background: transparent; outline: none; width: 100%; font-size: 1rem; font-weight: 600; color: var(--dark); }
.switch-selector { display: flex; background: #f1f5f9; padding: 5px; border-radius: 16px; margin-bottom: 25px; }
.switch-btn { flex: 1; text-align: center; padding: 12px; border-radius: 12px; font-weight: 600; color: var(--text-light); transition: all 0.2s; }
input:checked + .expense { background: white; color: var(--danger); box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
input:checked + .income { background: white; color: var(--secondary); box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.btn-submit { width: 100%; background: var(--dark); color: white; padding: 18px; border-radius: 18px; font-size: 1.1rem; font-weight: 700; border: none; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.show-modal { display: flex; }