:root {
    --bg: #0b0f1a;
    --card: #161e2d;
    --primary: #38bdf8;
    --accent: #f472b6;
    --success: #10b981;
    --danger: #ef4444;
    --text: #f8fafc;
    --secondary: #64748b;
    --border: #2d3748;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', sans-serif; }
body { background-color: var(--bg); color: var(--text); overflow-x: hidden; }
.hidden { display: none !important; }

/* --- LOGIN & REGISTRO ESTILIZADO --- */
.login-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100vh;
    background: radial-gradient(circle at center, #1e293b 0%, #0b0f1a 100%);
    display: flex; justify-content: center; align-items: center; z-index: 5000;
}
.login-glass-card {
    background: rgba(22, 30, 45, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 3rem;
    border-radius: 24px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.5s ease-out;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.auth-form { display: flex; flex-direction: column; gap: 20px; margin-top: 30px; }
.input-group label { display: block; font-size: 0.85rem; color: var(--secondary); margin-bottom: 8px; font-weight: 600; }
.input-group input { 
    width: 100%; padding: 14px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--border);
    border-radius: 10px; color: white; font-size: 1rem; transition: 0.3s;
}
.input-group input:focus { border-color: var(--primary); background: rgba(0,0,0,0.5); outline: none; }

.auth-btn {
    width: 100%; padding: 14px; background: linear-gradient(135deg, var(--primary), #0284c7);
    color: white; border: none; border-radius: 10px; font-weight: bold; cursor: pointer;
    font-size: 1rem; transition: transform 0.2s, box-shadow 0.2s; margin-top: 10px;
}
.auth-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 20px -5px rgba(56, 189, 248, 0.4); }
.auth-btn.signup-btn { background: linear-gradient(135deg, var(--accent), #db2777); }
.auth-btn.signup-btn:hover { box-shadow: 0 10px 20px -5px rgba(244, 114, 182, 0.4); }

.toggle-msg { text-align: center; font-size: 0.9rem; color: var(--secondary); margin-top: 15px; }
.toggle-msg a { color: var(--primary); text-decoration: none; font-weight: 600; }
.toggle-msg a:hover { text-decoration: underline; }

/* --- NAVBAR & UI PRINCIPAL --- */
.navbar { 
    background: rgba(11,15,26,0.95); 
    backdrop-filter: blur(15px); 
    border-bottom: 1px solid var(--border); 
    padding: 1rem 3rem; position: sticky; top: 0; z-index: 100; width: 100%;
}
.nav-grid { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; width: 100%; }
.nav-right { display: flex; justify-content: flex-end; }
.logo-main { text-align: center; font-size: 3rem; font-weight: 900; letter-spacing: -2px; line-height: 1; }
.logo-main span { display: block; font-size: 0.9rem; color: var(--accent); letter-spacing: 4px; font-weight: 400; margin-top: 5px; }

.nav-tabs { display: flex; justify-content: center; gap: 40px; margin-top: 25px; }
.nav-link {
    background: transparent; border: none; color: var(--secondary); font-size: 1rem;
    font-weight: 600; cursor: pointer; padding: 10px 5px; position: relative; transition: color 0.3s;
}
.nav-link::after {
    content: ''; position: absolute; width: 0; height: 2px; bottom: 0; left: 50%;
    background-color: var(--primary); transition: all 0.3s ease; transform: translateX(-50%);
}
.nav-link:hover { color: var(--text); }
.nav-link.active { color: var(--primary); }
.nav-link.active::after { width: 100%; }

/* --- INPUTS & COMPONENTES --- */
.search-wrapper { position: relative; margin-bottom: 20px; }
.search-icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); font-size: 1.2rem; opacity: 0.6; }
.search-wrapper input {
    width: 100%; padding: 14px 14px 14px 45px; background: #0f1523; border: 1px solid var(--border);
    border-radius: 50px; color: white; font-size: 1rem; transition: all 0.3s;
}
.search-wrapper input:focus { border-color: var(--primary); box-shadow: 0 0 15px rgba(56, 189, 248, 0.15); background: #161e2d; outline: none; }

.main-header { text-align: center; padding: 3rem 0; display: flex; flex-direction: column; align-items: center; gap: 20px; }
#total-val { font-size: 5rem; font-weight: 900; line-height: 1.1; margin-top: 5px; }

.sub-stats-capsule {
    display: flex; align-items: center; background: #111827; border: 1px solid var(--border);
    padding: 15px 30px; border-radius: 20px; gap: 30px; box-shadow: 0 10px 25px rgba(0,0,0,0.3); margin-top: 10px;
}
.stat-item { text-align: center; }
.stat-label { display: block; font-size: 0.8rem; color: var(--secondary); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 5px; }
.stat-item b { font-size: 1.5rem; display: block; }
.text-blue { color: #60a5fa; }
.text-green { color: #34d399; }
.stat-separator { width: 1px; height: 40px; background: var(--border); }

/* --- FORMULARIOS GENERALES --- */
.type-selector-new { display: flex; gap: 10px; margin-top: 25px; margin-bottom: 20px; }
.type-selector-new button {
    flex: 1; padding: 14px; border: 2px solid var(--border); background: transparent; 
    color: var(--secondary); border-radius: 12px; cursor: pointer; font-weight: 800; transition: 0.3s;
}
.type-selector-new button.active#btn-gasto { border-color: var(--danger); color: white; background: var(--danger); }
.type-selector-new button.active#btn-ingreso { border-color: var(--success); color: white; background: var(--success); }

.dark-form input, .dark-form select {
    width: 100%; padding: 15px; margin-bottom: 15px; background: #0b0f1a;
    border: 1px solid var(--border); border-radius: 12px; color: white; outline: none;
}
.dark-form input:focus { border-color: var(--primary); }

.form-footer { text-align: center; margin-top: 15px; }
.btn-cancel-text {
    background: none; border: none; color: var(--danger); font-size: 0.95rem; cursor: pointer; 
    text-decoration: none; padding: 5px 10px; opacity: 0.8; transition: 0.2s;
}
.btn-cancel-text:hover { opacity: 1; text-decoration: underline; }

/* --- CARDS & LAYOUT --- */
.narrow-center-container { display: flex; justify-content: center; width: 100%; }
.narrow-center-container .glass-card { width: 100%; max-width: 500px; }
.glass-card { background: var(--card); border: 1px solid var(--border); border-radius: 24px; padding: 2rem; position: relative; }
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; max-width: 1200px; margin: 0 auto; }

.chart-card { height: 400px; display: flex; flex-direction: column; }
.chart-box { position: relative; flex-grow: 1; display: flex; align-items: center; justify-content: center; min-height: 0; }
.bar-box { padding: 10px; }
.chart-center-text { position: absolute; font-size: 2.2rem; font-weight: 800; top: 50%; left: 50%; transform: translate(-50%, -50%); color: white; pointer-events: none; }
.card-title-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }

.btn-icon-styled {
    background: rgba(255,255,255,0.05); border: 1px solid var(--border); color: var(--secondary);
    padding: 6px 12px; border-radius: 8px; font-size: 0.8rem; cursor: pointer; transition: 0.2s;
}
.btn-icon-styled:hover { background: var(--primary); color: #0b0f1a; border-color: var(--primary); }

/* --- LISTA --- */
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.btn-danger-action { background: var(--danger); color: white; border: none; padding: 8px 16px; border-radius: 8px; font-weight: bold; cursor: pointer; }
.m-item { display: grid; grid-template-columns: 40px 1fr auto auto; align-items: center; padding: 14px; background: rgba(255,255,255,0.03); border-radius: 12px; margin-bottom: 8px; border: 1px solid transparent; }
.m-item:hover { border-color: rgba(255,255,255,0.1); background: rgba(255,255,255,0.05); }
.del-checkbox { width: 18px; height: 18px; accent-color: var(--danger); cursor: pointer; }
.btn-icon { background: none; border: none; cursor: pointer; font-size: 1.2rem; filter: opacity(0.5); transition: 0.2s; }
.btn-icon:hover { filter: opacity(1); transform: scale(1.1); }

/* --- MODALES & NOTIFICACIONES --- */
#notification-container { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 6000; }
.toast { background: var(--card); border: 1px solid var(--primary); padding: 12px 30px; border-radius: 50px; box-shadow: 0 10px 40px rgba(0,0,0,0.6); font-weight: bold; color: white; display: flex; align-items: center; gap: 10px; }

.modal-overlay { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(5px); 
    display: flex; justify-content: center; align-items: center; z-index: 3000; 
}
.modal-card { 
    background: #1e293b; border: 1px solid var(--border); padding: 2rem; 
    border-radius: 20px; width: 90%; max-width: 400px; text-align: center; 
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); 
}
.modal-card h3 { margin-bottom: 10px; font-size: 1.5rem; }
.modal-card p { color: var(--secondary); margin-bottom: 20px; }
.modal-input-styled {
    width: 100%; padding: 12px; background: #0b0f1a; border: 1px solid var(--border);
    color: white; border-radius: 10px; margin-bottom: 12px; text-align: center; font-size: 1rem;
}
.modal-card input[type="number"] {
    width: 100%; padding: 12px; background: #0b0f1a; border: 1px solid var(--border);
    color: white; border-radius: 10px; margin-bottom: 20px; text-align: center; font-size: 1.2rem;
}

.modal-actions { display: flex; gap: 10px; justify-content: center; }
.btn-primary-modal { flex: 1; padding: 10px; background: var(--primary); border: none; border-radius: 8px; font-weight: bold; cursor: pointer; color: #0b0f1a; }
.btn-secondary-modal { flex: 1; padding: 10px; background: transparent; border: 1px solid var(--border); border-radius: 8px; color: white; cursor: pointer; }

/* --- PERFIL --- */
.profile-btn { background: #1e293b; border: 1px solid var(--border); color: white; padding: 8px 16px; border-radius: 12px; cursor: pointer; font-weight: 500; }
.dropdown-menu { position: absolute; right: 0; top: 50px; background: #1e293b; border: 1px solid var(--border); border-radius: 12px; width: 200px; padding: 5px; box-shadow: 0 20px 25px rgba(0,0,0,0.5); }
.dropdown-menu button { width: 100%; padding: 10px; background: none; border: none; color: white; text-align: left; border-radius: 6px; cursor: pointer; }
.dropdown-menu button:hover { background: #334155; }
.btn-primary { width: 100%; padding: 16px; background: var(--primary); color: #0b0f1a; border: none; border-radius: 12px; font-weight: 800; cursor: pointer; margin-top: 10px; }

/* CHECKBOX TRASPASO */
.custom-check { display: flex; align-items: center; gap: 10px; cursor: pointer; color: var(--primary); font-size: 0.9rem; margin: 15px 0; }
.checkmark { width: 20px; height: 20px; border: 2px solid var(--primary); border-radius: 6px; display: inline-block; position: relative; }
.custom-check input { display: none; }
.custom-check input:checked + .checkmark::after { content: '✓'; position: absolute; left: 3px; top: -3px; font-weight: bold; }