/* ================================================
   jFinanzas — app.css  (completo, responsive)
   ================================================ */

:root {
    --sw: 240px;                          /* sidebar width */
    --th: 60px;                           /* topbar height */
    --primary:      #4f46e5;
    --primary-dark: #3730a3;
    --success:      #10b981;
    --danger:       #ef4444;
    --warning:      #f59e0b;
    --sidebar-bg:   #1e1b4b;
    --tr: all .2s ease;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f3f4f6;
    color: #111827;
    overflow-x: hidden;
}

/* ═══════════════════════════════════════
   LAYOUT PRINCIPAL
═══════════════════════════════════════ */

/* Sidebar fijo en desktop, fuera de pantalla en móvil */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sw);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1050;
    transition: transform .25s ease;
    overflow: hidden;
}

/* MÓVIL: sidebar oculto por defecto */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
        overflow-y: auto;          /* scroll completo en móvil */
    }
    .sidebar.open { transform: translateX(0); }

    /* En móvil el nav NO hace scroll propio, crece libremente */
    .sidebar-nav {
        flex: 0 0 auto !important;
        overflow-y: visible !important;
        min-height: unset !important;
    }

    /* Footer siempre al final, nunca se corta */
    .sidebar-footer {
        position: sticky;
        bottom: 0;
        background: var(--sidebar-bg);
        z-index: 2;
        margin-top: auto;
    }
}
}

/* Overlay oscuro al abrir sidebar en móvil */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1040;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.show { display: block; }

/* Contenido principal */
.main-wrapper {
    margin-left: var(--sw);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left .25s ease;
}

/* MÓVIL: sin margen */
@media (max-width: 991px) {
    .main-wrapper { margin-left: 0; }
}

/* ═══════════════════════════════════════
   SIDEBAR — Contenido
═══════════════════════════════════════ */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 18px;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 800;
    border-bottom: 1px solid rgba(255,255,255,.1);
    letter-spacing: .3px;
}
.sidebar-brand i { font-size: 1.4rem; color: #818cf8; }

.sidebar-nav {
    flex: 1;
    min-height: 0;          /* ← clave: permite que flex-child se encoja */
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    overflow-y: auto;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    color: #c7d2fe;
    text-decoration: none;
    font-size: .88rem;
    font-weight: 500;
    transition: var(--tr);
    white-space: nowrap;
}
.nav-item:hover  { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(99,102,241,.35); color: #a5b4fc; font-weight: 700; }
.nav-item i      { font-size: 1.05rem; width: 20px; flex-shrink: 0; }

.nav-item-logout-mobile {
    display: none;
    margin-top: 8px;
    border: 1px solid rgba(239,68,68,.28);
    background: rgba(239,68,68,.16);
    color: #fecaca;
    font-weight: 600;
}
.nav-item-logout-mobile i { color: #fca5a5; }
.nav-item-logout-mobile:hover {
    background: rgba(239,68,68,.28);
    color: #fff;
}

@media (max-width: 991px) {
    .nav-item-logout-mobile { display: flex; }
}
@media (min-width: 992px) {
    .nav-item-logout-mobile { display: none !important; }
}

.sidebar-footer {
    padding: 14px 12px;
    border-top: 1px solid rgba(255,255,255,.1);
    flex-shrink: 0;         /* ← nunca se comprime ni desaparece */
}
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.user-avatar {
    width: 36px; height: 36px;
    background: var(--primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: .9rem;
    flex-shrink: 0;
}
.btn-salir {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(239,68,68,.15);
    color: #fca5a5;
    font-size: .82rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--tr);
    border: 1px solid rgba(239,68,68,.2);
}
.btn-salir:hover { background: rgba(239,68,68,.28); color: #fff; }

/* ═══════════════════════════════════════
   TOPBAR
═══════════════════════════════════════ */
.topbar {
    height: var(--th);
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 900;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.topbar-toggle {
    background: none; border: none;
    width: 38px; height: 38px;
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    color: #6b7280;
    cursor: pointer;
    transition: var(--tr);
    flex-shrink: 0;
}
.topbar-toggle:hover { background: #f3f4f6; color: var(--primary); }
.topbar-title {
    flex: 1;
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
}
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-date {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .78rem;
    font-weight: 600;
    color: #6366f1;
    background: #eef2ff;
    padding: 5px 12px;
    border-radius: 99px;
    white-space: nowrap;
}

/* ═══════════════════════════════════════
   MAIN CONTENT
═══════════════════════════════════════ */
.main-content {
    padding: 24px;
    flex: 1;
}
@media (max-width: 576px) {
    .main-content { padding: 14px 12px; }
}

/* ═══════════════════════════════════════
   CARDS
═══════════════════════════════════════ */
.card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.card-header {
    background: transparent;
    border-bottom: 1px solid #f3f4f6;
    padding: 14px 18px;
    font-weight: 600;
    font-size: .9rem;
}

/* ═══════════════════════════════════════
   STAT CARDS (Dashboard)
═══════════════════════════════════════ */
.stat-card {
    border-radius: 14px;
    padding: 20px;
    color: #fff;
    position: relative;
    overflow: hidden;
}
.stat-card::after {
    content: '';
    position: absolute;
    bottom: -15px; right: -15px;
    width: 70px; height: 70px;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
}
.stat-card .stat-icon  { font-size: 1.8rem; margin-bottom: 8px; opacity: .85; }
.stat-card .stat-value { font-size: 1.5rem; font-weight: 800; line-height: 1; }
.stat-card .stat-label { font-size: .78rem; opacity: .85; margin-top: 5px; }

.stat-ingresos { background: linear-gradient(135deg,#10b981,#059669); }
.stat-egresos  { background: linear-gradient(135deg,#6366f1,#4f46e5); }
.stat-balance  { background: linear-gradient(135deg,#0ea5e9,#0284c7); }
.stat-cuentas  { background: linear-gradient(135deg,#f59e0b,#d97706); }

/* ═══════════════════════════════════════
   TABLA GENÉRICA
═══════════════════════════════════════ */
.table thead th {
    background: #f8f9ff;
    font-size: .74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: #6366f1;
    border-bottom: 2px solid #e0e7ff;
    padding: 11px 14px;
    white-space: nowrap;
}
.table tbody td {
    font-size: .88rem;
    vertical-align: middle;
    padding: 10px 14px;
    border-bottom: 1px solid #f3f4f6;
}
.table tbody tr:last-child td { border-bottom: none; }
.table-hover tbody tr:hover  { background: #fafbff; }

/* ═══════════════════════════════════════
   FORMULARIOS
═══════════════════════════════════════ */
.form-label  { font-size: .83rem; color: #374151; font-weight: 600; }
.form-control, .form-select {
    border-radius: 9px;
    border-color: #d1d5db;
    font-size: .9rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}

/* ═══════════════════════════════════════
   BOTONES UTILITARIOS
═══════════════════════════════════════ */
.btn-icon {
    background: none; border: none;
    width: 32px; height: 32px;
    border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .85rem; cursor: pointer;
    transition: var(--tr);
}

/* ═══════════════════════════════════════
   DASHBOARD — Transacciones recientes
═══════════════════════════════════════ */
.transaction-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid #f3f4f6;
}
.transaction-item:last-child { border-bottom: none; }
.transaction-icon {
    width: 38px; height: 38px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; flex-shrink: 0;
}
.transaction-info  { flex: 1; min-width: 0; }
.transaction-desc  { font-weight: 600; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.transaction-meta  { font-size: .75rem; color: #9ca3af; margin-top: 2px; }
.transaction-amount { font-weight: 800; font-size: .92rem; flex-shrink: 0; }
.amount-ingreso      { color: #059669; }
.amount-egreso       { color: #6366f1; }
.amount-transferencia{ color: #7c3aed; }

/* ═══════════════════════════════════════
   CUENTAS
═══════════════════════════════════════ */
.account-card {
    border-radius: 14px; padding: 18px;
    color: #fff; cursor: pointer;
    transition: var(--tr); position: relative; overflow: hidden;
}
.account-card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(0,0,0,.15); }
.account-card .acc-name   { font-size: .82rem; opacity: .85; }
.account-card .acc-saldo  { font-size: 1.35rem; font-weight: 800; margin: 6px 0; }
.account-card .acc-tipo   { font-size: .75rem; opacity: .7; }

/* ═══════════════════════════════════════
   PRESUPUESTOS
═══════════════════════════════════════ */
.budget-item { margin-bottom: 14px; }
.budget-info { display: flex; justify-content: space-between; font-size: .8rem; margin-bottom: 4px; }
.progress    { height: 7px; border-radius: 99px; }

/* ═══════════════════════════════════════
   AUTH (login / registro)
═══════════════════════════════════════ */
.auth-body {
    background: linear-gradient(135deg,#1e1b4b 0%,#312e81 50%,#4f46e5 100%);
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.auth-container { width: 100%; max-width: 420px; }
.auth-card {
    background: #fff; border-radius: 18px;
    padding: 36px 32px;
    box-shadow: 0 25px 60px rgba(0,0,0,.25);
}
.auth-header { text-align: center; margin-bottom: 28px; }
.auth-logo {
    width: 64px; height: 64px;
    background: linear-gradient(135deg,var(--primary),#818cf8);
    border-radius: 18px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem; color: #fff;
    margin: 0 auto 14px;
    box-shadow: 0 8px 20px rgba(79,70,229,.3);
}
.auth-header h1 { font-size: 1.5rem; font-weight: 800; color: #111827; margin-bottom: 4px; }
.auth-header p  { color: #6b7280; font-size: .88rem; }
.auth-footer    { margin-top: 20px; text-align: center; }

/* ═══════════════════════════════════════
   UTILIDADES
═══════════════════════════════════════ */
.icon-circle {
    width: 34px; height: 34px;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.text-ingreso { color: var(--success) !important; }
.text-egreso  { color: #6366f1 !important; }

.badge-ingreso      { background:#ecfdf5; color:#065f46; }
.badge-egreso       { background:#eef2ff; color:#3730a3; }
.badge-transferencia{ background:#faf5ff; color:#6b21a8; }

/* ═══════════════════════════════════════
   REPORTES
═══════════════════════════════════════ */
.reporte-header {
    display: flex; align-items: center;
    justify-content: space-between;
    flex-wrap: wrap; gap: 12px;
}
.year-nav {
    display: flex; align-items: center;
    background: #fff; border: 1px solid #e5e7eb;
    border-radius: 12px; overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.year-btn {
    display: flex; align-items: center; justify-content: center;
    width: 42px; height: 42px;
    color: #6b7280; text-decoration: none;
    transition: var(--tr);
}
.year-btn:hover { background: #f3f4f6; color: var(--primary); }
.year-display {
    display: flex; align-items: center; gap: 7px;
    padding: 0 18px; height: 42px;
    font-weight: 700; font-size: 1rem; color: #1e1b4b;
    border-left: 1px solid #e5e7eb; border-right: 1px solid #e5e7eb;
    min-width: 100px; justify-content: center;
}
.year-display i { color: var(--primary); }
.reporte-badge {
    font-size: .78rem; font-weight: 700;
    color: #6366f1; background: #eef2ff;
    padding: 6px 14px; border-radius: 99px;
}
.reporte-stat-card {
    border-radius: 14px; padding: 16px 18px;
    display: flex; align-items: flex-start; gap: 13px;
    border: 1px solid transparent; transition: box-shadow .2s;
}
.reporte-stat-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.rsc-icon {
    width: 44px; height: 44px; border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; flex-shrink: 0;
}
.rsc-body { flex: 1; min-width: 0; }
.rsc-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; margin-bottom: 3px; }
.rsc-value { font-size: 1.2rem; font-weight: 800; line-height: 1.2; margin-bottom: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rsc-bar   { height: 4px; border-radius: 99px; background: rgba(0,0,0,.08); overflow: hidden; }
.rsc-bar-fill { height: 100%; border-radius: 99px; transition: width .6s; }

.rsc-ingresos { background: linear-gradient(135deg,#ecfdf5,#d1fae5); border-color: #a7f3d0; }
.rsc-ingresos .rsc-icon  { background: #10b981; color: #fff; }
.rsc-ingresos .rsc-label { color: #065f46; }
.rsc-ingresos .rsc-value { color: #047857; }
.rsc-ingresos .rsc-bar-fill { background: #10b981; }

.rsc-egresos { background: linear-gradient(135deg,#eef2ff,#e0e7ff); border-color: #c7d2fe; }
.rsc-egresos .rsc-icon  { background: #6366f1; color: #fff; }
.rsc-egresos .rsc-label { color: #3730a3; }
.rsc-egresos .rsc-value { color: #4338ca; }
.rsc-egresos .rsc-bar-fill { background: #6366f1; }

.rsc-positivo { background: linear-gradient(135deg,#f0f9ff,#e0f2fe); border-color: #bae6fd; }
.rsc-positivo .rsc-icon  { background: #0ea5e9; color: #fff; }
.rsc-positivo .rsc-label { color: #0c4a6e; }
.rsc-positivo .rsc-value { color: #0369a1; }
.rsc-positivo .rsc-bar-fill { background: #0ea5e9; }

.rsc-negativo { background: linear-gradient(135deg,#fff1f2,#ffe4e6); border-color: #fecdd3; }
.rsc-negativo .rsc-icon  { background: #f43f5e; color: #fff; }
.rsc-negativo .rsc-label { color: #881337; }
.rsc-negativo .rsc-value { color: #be123c; }
.rsc-negativo .rsc-bar-fill { background: #f43f5e; }

.chart-card { border: 1px solid #e5e7eb; border-radius: 14px; }
.chart-card-header {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 8px;
    padding: 13px 18px; border-bottom: 1px solid #f3f4f6;
}
.chart-title  { display: flex; align-items: center; font-weight: 600; font-size: .9rem; color: #1f2937; gap: 4px; }
.chart-legend { display: flex; gap: 14px; font-size: .78rem; color: #6b7280; }
.legend-item  { display: flex; align-items: center; gap: 5px; }
.legend-dot   { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.badge-anio   { font-size: .73rem; font-weight: 700; background: #eef2ff; color: #6366f1; padding: 3px 10px; border-radius: 99px; }
.chart-wrapper    { position: relative; height: 250px; }
.chart-wrapper-sm { position: relative; height: 195px; }
.chart-wrapper-md { position: relative; height: 170px; }

.donut-legend { display: flex; flex-direction: column; gap: 5px; }
.donut-legend-item { display: flex; align-items: center; gap: 8px; font-size: .79rem; }
.donut-dot  { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.donut-name { flex: 1; color: #374151; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.donut-pct  { font-weight: 700; color: #6b7280; min-width: 35px; text-align: right; }

.table-reporte thead th {
    background: #f8f9ff; font-size: .73rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .6px; color: #6366f1;
    border-bottom: 2px solid #e0e7ff; padding: 11px 14px;
}
.table-reporte tbody td { font-size: .87rem; vertical-align: middle; padding: 10px 14px; border-bottom: 1px solid #f3f4f6; }
.table-reporte tbody tr.row-empty td { opacity: .4; }
.table-reporte tbody tr:hover { background: #fafbff; }
.tfoot-total td { background: #f8f9ff; border-top: 2px solid #e0e7ff !important; padding: 11px 14px; }
.mes-cell { display: flex; align-items: center; gap: 8px; }
.mes-num  { width: 22px; height: 22px; background: #eef2ff; color: #6366f1; border-radius: 5px; font-size: .7rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.chip         { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.chip-ingreso { background: #ecfdf5; color: #065f46; }
.chip-egreso  { background: #eef2ff; color: #3730a3; }
.color-ingreso { color: #059669 !important; }
.color-egreso  { color: #6366f1 !important; }
.pct-bar-wrapper { display: flex; align-items: center; gap: 7px; justify-content: flex-end; }
.pct-bar-track   { width: 55px; height: 4px; background: #f3f4f6; border-radius: 99px; overflow: hidden; flex-shrink: 0; }
.pct-bar-fill    { height: 100%; border-radius: 99px; transition: width .5s; }
.fill-pos { background: #10b981; }
.fill-neg { background: #f43f5e; }
.pct-label { font-size: .76rem; font-weight: 700; min-width: 32px; text-align: right; }
.empty-state { text-align: center; padding: 28px 0; color: #9ca3af; }
.empty-state i { font-size: 1.8rem; display: block; margin-bottom: 8px; }
.empty-state p { font-size: .87rem; margin: 0; }

/* ═══════════════════════════════════════
   TRANSACCIONES
═══════════════════════════════════════ */
.trans-header {
    display: flex; align-items: center;
    justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
    margin-bottom: 14px;
}
.trans-stats { display: flex; gap: 10px; flex-wrap: wrap; flex: 1; }
.trans-stat-pill {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-radius: 12px;
    min-width: 120px; flex: 1;
}
.trans-stat-pill i { font-size: 1.3rem; flex-shrink: 0; }
.pill-label { display: block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; opacity: .8; }
.pill-value { display: block; font-size: .9rem; font-weight: 800; line-height: 1.2; }
.pill-ing { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.pill-egr { background: #eef2ff; color: #4338ca; border: 1px solid #c7d2fe; }
.pill-bal { border: 1px solid; }
.bal-pos  { background: #f0f9ff; color: #0369a1; border-color: #bae6fd; }
.bal-neg  { background: #fff1f2; color: #be123c; border-color: #fecdd3; }

.btn-nueva-trans {
    display: flex; align-items: center; gap: 7px;
    background: var(--primary); color: #fff; border: none;
    border-radius: 11px; padding: 10px 18px;
    font-weight: 700; font-size: .88rem; cursor: pointer;
    transition: var(--tr); flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(79,70,229,.3);
}
.btn-nueva-trans:hover { background: var(--primary-dark); box-shadow: 0 6px 18px rgba(79,70,229,.4); transform: translateY(-1px); }

.filter-card { border: 1px solid #e5e7eb; border-radius: 12px; }
.filter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 10px; align-items: end;
}
.filter-field label { display: block; font-size: .75rem; font-weight: 700; color: #6b7280; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .4px; }
.filter-actions { display: flex; gap: 6px; align-items: flex-end; }

.trans-count { display: flex; align-items: center; justify-content: space-between; font-size: .81rem; color: #6b7280; padding: 0 2px; margin-bottom: 8px; }
.trans-period { background: #eef2ff; color: #6366f1; font-weight: 700; padding: 2px 10px; border-radius: 99px; font-size: .75rem; }

.trans-card { border: 1px solid #e5e7eb; border-radius: 14px; overflow: hidden; }

.trans-empty { text-align: center; padding: 50px 20px; }
.trans-empty-icon { width: 60px; height: 60px; background: #f3f4f6; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; color: #9ca3af; margin: 0 auto 14px; }
.trans-empty-title { font-weight: 700; color: #374151; margin-bottom: 5px; }
.trans-empty-sub   { color: #9ca3af; font-size: .85rem; margin-bottom: 14px; }

/* Tabla desktop */
.table-trans thead th { background: #fafbff; font-size: .73rem; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: #6366f1; border-bottom: 2px solid #e0e7ff; padding: 11px 14px; white-space: nowrap; }
.table-trans tbody td { padding: 10px 14px; vertical-align: middle; border-bottom: 1px solid #f3f4f6; }
.table-trans tbody tr:last-child td { border-bottom: none; }
.table-trans tbody tr:hover { background: #fafbff; }

.date-cell { display: flex; flex-direction: column; line-height: 1.1; }
.date-day  { font-size: 1.05rem; font-weight: 800; color: #1f2937; }
.date-mon  { font-size: .68rem; color: #9ca3af; text-transform: uppercase; letter-spacing: .4px; }

.cat-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; border-radius: 99px; font-size: .76rem; font-weight: 600;
    background: color-mix(in srgb, var(--cat-color) 12%, white);
    color: var(--cat-color); white-space: nowrap;
}
.cuenta-tag { display: inline-block; background: #f3f4f6; color: #374151; padding: 2px 8px; border-radius: 6px; font-size: .76rem; font-weight: 500; white-space: nowrap; }
.tipo-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 7px; font-size: .76rem; font-weight: 600; white-space: nowrap; }
.tipo-ingreso       { background: #ecfdf5; color: #065f46; }
.tipo-egreso        { background: #eef2ff; color: #3730a3; }
.tipo-transferencia { background: #faf5ff; color: #6b21a8; }

.monto-value        { font-weight: 800; font-size: .92rem; white-space: nowrap; }
.monto-ingreso      { color: #059669; }
.monto-egreso       { color: #6366f1; }
.monto-transferencia{ color: #7c3aed; }

.action-btns { display: flex; gap: 4px; justify-content: center; }
.action-btn  { width: 29px; height: 29px; border: none; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: .78rem; cursor: pointer; transition: var(--tr); }
.action-edit { background: #f3f4f6; color: #6b7280; }
.action-edit:hover { background: #eef2ff; color: #6366f1; }
.action-del  { background: #f3f4f6; color: #6b7280; }
.action-del:hover  { background: #fff1f2; color: #e11d48; }

/* Lista móvil */
.trans-mobile-list  { padding: 4px 0; }
.trans-mobile-item  { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid #f3f4f6; gap: 12px; }
.trans-mobile-item:last-child { border-bottom: none; }
.tmi-left  { display: flex; align-items: center; gap: 11px; flex: 1; min-width: 0; }
.tmi-icon  { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }
.tmi-info  { min-width: 0; flex: 1; }
.tmi-desc  { font-weight: 600; font-size: .88rem; color: #1f2937; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tmi-meta  { font-size: .73rem; color: #9ca3af; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tmi-sep   { margin: 0 3px; }
.tmi-right { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.tmi-monto { font-weight: 800; font-size: .92rem; white-space: nowrap; }
.tmi-actions { display: flex; gap: 3px; }

/* Modal transacciones */
.modal-trans .modal-content { border: none; border-radius: 18px; overflow: hidden; box-shadow: 0 25px 60px rgba(0,0,0,.2); }
.modal-trans-header { display: flex; align-items: center; justify-content: space-between; background: var(--sidebar-bg); padding: 16px 18px 0; color: #fff; }
.modal-trans-header h5 { font-weight: 700; font-size: .95rem; margin: 0; }
.tipo-selector { display: flex; background: var(--sidebar-bg); padding: 10px 14px 0; gap: 7px; }
.tipo-option { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 9px 5px; border-radius: 9px 9px 0 0; cursor: pointer; font-size: .75rem; font-weight: 600; color: rgba(255,255,255,.45); transition: var(--tr); user-select: none; }
.tipo-option i { font-size: 1.15rem; }
.tipo-option input[type="radio"] { display: none; }
.tipo-option:has(input:checked) { background: #fff; }
.tipo-ing:has(input:checked) { color: #059669; }
.tipo-egr:has(input:checked) { color: #6366f1; }
.tipo-tra:has(input:checked) { color: #7c3aed; }
.tipo-option:not(:has(input:checked)):hover { background: rgba(255,255,255,.1); color: rgba(255,255,255,.85); }
.monto-input-wrap { display: flex; align-items: center; background: #f8f9ff; border: 2px solid #e0e7ff; border-radius: 11px; padding: 7px 14px; gap: 8px; transition: border-color .2s; }
.monto-input-wrap:focus-within { border-color: var(--primary); background: #fff; }
.monto-prefix { font-size: 1.5rem; font-weight: 800; color: #6366f1; width: 22px; text-align: center; flex-shrink: 0; }
.monto-big-input { border: none !important; background: transparent !important; font-size: 1.5rem !important; font-weight: 800 !important; color: #1f2937 !important; padding: 0 !important; box-shadow: none !important; flex: 1; }
.monto-big-input:focus { outline: none; }
.monto-big-input::placeholder { color: #d1d5db; }
.fs-small { font-size: .81rem !important; }

/* ═══════════════════════════════════════
   RESPONSIVE GLOBAL
═══════════════════════════════════════ */
@media (max-width: 768px) {
    .filter-grid { grid-template-columns: 1fr 1fr; }
    .filter-actions { grid-column: span 2; }
    .chart-legend { display: none; }
    .topbar-date  { display: none; }
}
@media (max-width: 480px) {
    .filter-grid  { grid-template-columns: 1fr; }
    .filter-actions { grid-column: span 1; }
    .trans-stat-pill { min-width: calc(50% - 5px); }
    .pill-bal  { flex-basis: 100%; }
    .chart-wrapper { height: 200px; }
    .auth-card { padding: 28px 20px; }
    .reporte-stat-card { padding: 14px; }
    .rsc-value { font-size: 1rem; }
}

/* ======================================================
   GASTOS FIJOS
   ====================================================== */

.gf-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.gf-card {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    overflow: hidden;
}

/* Día de pago — badge circular */
.gf-dia {
    width: 38px; height: 38px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: .88rem; font-weight: 800;
    flex-shrink: 0;
    margin: 0 auto;
}
.gf-dia-ok   { background: #ecfdf5; color: #059669; }
.gf-dia-pend { background: #eef2ff; color: #6366f1; }

/* Estado badges */
.gf-estado-ok {
    display: inline-flex; align-items: center; gap: 5px;
    background: #ecfdf5; color: #065f46;
    padding: 4px 10px; border-radius: 99px;
    font-size: .75rem; font-weight: 700;
}
.gf-estado-pend {
    display: inline-flex; align-items: center; gap: 5px;
    background: #fffbeb; color: #92400e;
    padding: 4px 10px; border-radius: 99px;
    font-size: .75rem; font-weight: 700;
}

/* Fila pagada: opacidad reducida */
.gf-row-pagado { opacity: .65; }
.gf-row-pagado:hover { opacity: 1; }

/* Botones especiales de acción */
.gf-btn-pagar {
    background: #ecfdf5 !important;
    color: #059669 !important;
    font-size: .9rem !important;
}
.gf-btn-pagar:hover {
    background: #059669 !important;
    color: #fff !important;
    transform: scale(1.1);
}
.gf-btn-deshacer {
    background: #fffbeb !important;
    color: #d97706 !important;
}
.gf-btn-deshacer:hover {
    background: #d97706 !important;
    color: #fff !important;
}

/* MÓVIL: items de gastos fijos */
.gf-mobile-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid #f3f4f6;
    transition: background .15s;
}
.gf-mobile-item:last-child { border-bottom: none; }
.gfm-pagado { opacity: .65; }

.gf-dia-mobile {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: .9rem; font-weight: 800;
    flex-shrink: 0;
}

.gfm-info { flex: 1; min-width: 0; }
.gfm-nombre {
    font-weight: 600; font-size: .9rem; color: #1f2937;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gfm-meta {
    font-size: .74rem; color: #9ca3af; margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.gfm-right {
    display: flex; flex-direction: column;
    align-items: flex-end; gap: 4px; flex-shrink: 0;
}
.gfm-actions { display: flex; gap: 3px; }

/* ======================================================
   SISTEMA DE NOTIFICACIONES
   ====================================================== */

/* ── Campana en topbar ── */
.notif-bell {
    position: relative;
    background: none; border: none;
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.15rem;
    color: #f59e0b;
    cursor: pointer;
    transition: all .2s;
    flex-shrink: 0;
    animation: bellRing 3s ease-in-out infinite;
}
.notif-bell:hover { background: #fffbeb; color: #d97706; }

@keyframes bellRing {
    0%,100%  { transform: rotate(0); }
    10%,30%  { transform: rotate(-12deg); }
    20%,40%  { transform: rotate(12deg); }
    50%      { transform: rotate(0); }
}

.notif-badge {
    position: absolute;
    top: 4px; right: 4px;
    min-width: 17px; height: 17px;
    background: #ef4444;
    color: #fff;
    border-radius: 99px;
    font-size: .65rem;
    font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    padding: 0 4px;
    border: 2px solid #fff;
    line-height: 1;
}

/* ── Panel deslizante ── */
.notif-panel {
    position: fixed;
    top: 0; right: -400px;
    width: 380px; max-width: 95vw;
    height: 100vh;
    background: #fff;
    box-shadow: -8px 0 32px rgba(0,0,0,.15);
    z-index: 1100;
    display: flex; flex-direction: column;
    transition: right .3s cubic-bezier(.4,0,.2,1);
}
.notif-panel.open { right: 0; }

.notif-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.3);
    z-index: 1090;
    backdrop-filter: blur(2px);
}
.notif-overlay.show { display: block; }

.notif-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 18px 16px;
    background: linear-gradient(135deg, #1e1b4b, #4f46e5);
    flex-shrink: 0;
}
.notif-panel-title {
    display: flex; align-items: center; gap: 10px;
    color: #fff; font-weight: 700; font-size: 1rem;
}
.notif-close {
    background: rgba(255,255,255,.15); border: none;
    width: 32px; height: 32px; border-radius: 8px;
    color: #fff; cursor: pointer; font-size: .85rem;
    display: flex; align-items: center; justify-content: center;
    transition: background .2s;
}
.notif-close:hover { background: rgba(255,255,255,.3); }

.notif-panel-body {
    flex: 1; overflow-y: auto; padding: 12px 10px;
}
.notif-panel-body::-webkit-scrollbar { width: 4px; }
.notif-panel-body::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 4px; }

.notif-panel-footer {
    padding: 12px 14px;
    border-top: 1px solid #f3f4f6;
    flex-shrink: 0;
}
.btn-ver-gastos {
    display: flex; align-items: center; justify-content: center;
    width: 100%; padding: 10px;
    background: #eef2ff; color: #6366f1;
    border-radius: 10px; text-decoration: none;
    font-weight: 700; font-size: .85rem;
    transition: background .2s;
}
.btn-ver-gastos:hover { background: #e0e7ff; color: #4338ca; }

/* ── Items del panel ── */
.notif-item {
    display: flex; align-items: flex-start; gap: 11px;
    padding: 11px 10px; border-radius: 12px;
    margin-bottom: 6px; border: 1px solid transparent;
    transition: all .15s;
}
.notif-item:hover { transform: translateX(-2px); }
.notif-vencido { background: #fff1f2; border-color: #fecdd3; }
.notif-critico { background: #fff7ed; border-color: #fed7aa; }
.notif-proximo { background: #fffbeb; border-color: #fde68a; }
.notif-normal  { background: #f8faff; border-color: #e0e7ff; }

.notif-icon {
    width: 36px; height: 36px;
    border-radius: 9px;
    background: rgba(255,255,255,.8);
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.notif-info { flex: 1; min-width: 0; }
.notif-nombre {
    font-weight: 700; font-size: .87rem; color: #1f2937;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.notif-meta {
    font-size: .74rem; color: #9ca3af; margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.notif-vence { font-size: .72rem; color: #6b7280; margin-top: 3px; }
.notif-vence i { margin-right: 3px; }

.notif-right { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.notif-monto { font-weight: 800; font-size: .85rem; color: #6366f1; white-space: nowrap; }
.notif-dias  {
    font-size: .72rem; font-weight: 700;
    padding: 3px 8px; border-radius: 99px;
    white-space: nowrap;
}
.notif-dias-vencido { background: #fff1f2; color: #ef4444; border: 1px solid #fecdd3; }
.notif-dias-critico { background: #fff7ed; color: #f97316; border: 1px solid #fed7aa; }
.notif-dias-proximo { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
.notif-dias-normal  { background: #eef2ff; color: #6366f1; border: 1px solid #c7d2fe; }

/* ── Modal recordatorio ── */
.recordatorio-modal {
    border: none;
    border-radius: 20px !important;
    overflow: hidden;
}
.recordatorio-header {
    background: linear-gradient(135deg, #1e1b4b, #4f46e5);
    color: #fff;
    padding: 24px 24px 20px;
    display: flex; align-items: center; gap: 16px;
}
.recordatorio-icon-wrap {
    width: 54px; height: 54px;
    background: rgba(245,158,11,.25);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem; color: #fcd34d;
    flex-shrink: 0;
    animation: bellRing 2.5s ease-in-out infinite;
}
.recordatorio-body {
    padding: 16px 20px;
    max-height: 55vh;
    overflow-y: auto;
}
.recordatorio-body::-webkit-scrollbar { width: 4px; }
.recordatorio-body::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 4px; }
.recordatorio-footer {
    display: flex; gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid #f3f4f6;
}

/* Items del modal recordatorio */
.rec-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; border-radius: 13px;
    border: 1px solid #f3f4f6;
    margin-bottom: 8px;
    background: #fafbff;
    transition: box-shadow .15s;
}
.rec-item:last-child { margin-bottom: 0; }
.rec-item:hover { box-shadow: 0 4px 12px rgba(0,0,0,.06); }
.rec-urgencia {
    width: 40px; height: 40px;
    border-radius: 10px; border: 1px solid;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; flex-shrink: 0;
}
.rec-info { flex: 1; min-width: 0; }
.rec-nombre { font-weight: 700; font-size: .9rem; color: #1f2937; }
.rec-meta   { font-size: .74rem; color: #9ca3af; margin-top: 2px; }
.rec-right  { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.rec-monto  { font-weight: 800; font-size: .88rem; color: #6366f1; white-space: nowrap; }
.rec-dias-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: 99px;
    font-size: .73rem; font-weight: 700; white-space: nowrap;
}

/* ── Días restantes en tabla de gastos fijos ── */
.dias-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 9px; border-radius: 8px;
    font-size: .73rem; font-weight: 700; white-space: nowrap;
}
.dias-pagado  { background: #f3f4f6; color: #9ca3af; }
.dias-normal  { background: #eef2ff; color: #6366f1; }
.dias-proximo { background: #fffbeb; color: #d97706; }
.dias-critico { background: #fff7ed; color: #f97316; }
.dias-vencido { background: #fff1f2; color: #ef4444; }

/* gap util */
.gap-8 { gap: 8px; }

/* ── Pestañas Activos/Archivados ── */
.gf-tabs {
    display: flex;
    gap: 6px;
    background: #fff;
    border-radius: 12px;
    padding: 5px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.gf-tab {
    flex: 1;
    display: flex; align-items: center; justify-content: center;
    gap: 7px;
    padding: 9px 14px;
    border-radius: 9px;
    text-decoration: none;
    font-weight: 600; font-size: .85rem;
    color: #6b7280;
    transition: all .2s;
}
.gf-tab:hover { background: #f9fafb; color: #4f46e5; }
.gf-tab.active {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
    box-shadow: 0 2px 8px rgba(99,102,241,.25);
}
.gf-tab i { font-size: .95rem; }

/* ── Botón archivar ── */
.gf-btn-archive {
    background: #fffbeb !important;
    color: #d97706 !important;
}
.gf-btn-archive:hover {
    background: #fef3c7 !important;
    color: #92400e !important;
}

/* ── Botón restaurar ── */
.gf-btn-restore {
    background: #f0f9ff !important;
    color: #0284c7 !important;
    font-size: .9rem !important;
}
.gf-btn-restore:hover {
    background: #0284c7 !important;
    color: #fff !important;
}
