:root {
  --fin-bg: #f4f6fb;
  --fin-card: #ffffff;
  --fin-text: #1f2933;
  --fin-muted: #6b7280;
  --fin-border: #e5e7eb;
  --fin-primary: #2f6fed;
  --fin-income: #16a34a;
  --fin-expense: #dc2626;
  --fin-debt: #f59e0b;
  --fin-sidebar: #111827;
}
[data-bs-theme="dark"] {
  --fin-bg: #0f141b;
  --fin-card: #161d27;
  --fin-text: #e5e7eb;
  --fin-muted: #9ca3af;
  --fin-border: #263041;
  --fin-sidebar: #0b0f15;
}
body { background: var(--fin-bg); color: var(--fin-text); font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif; }
.card { background: var(--fin-card); border: 1px solid var(--fin-border); border-radius: 14px; }
.card-header { background: transparent; border-bottom: 1px solid var(--fin-border); font-weight: 600; }
.text-muted, .form-text { color: var(--fin-muted) !important; }
.text-income { color: var(--fin-income) !important; }
.text-expense { color: var(--fin-expense) !important; }
.text-debt { color: var(--fin-debt) !important; }
.amount { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* layout del panel */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: var(--fin-sidebar); color: #cbd5e1; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { color: #fff; font-weight: 700; font-size: 1.1rem; padding: 1.25rem 1.25rem .75rem; display: flex; gap: .5rem; align-items: center; text-decoration: none; }
.sidebar .nav-link { color: #cbd5e1; border-radius: 10px; margin: 2px 10px; padding: .55rem .85rem; display: flex; gap: .65rem; align-items: center; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar .nav-link.active { background: var(--fin-primary); color: #fff; }
.sidebar .section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #64748b; padding: 1rem 1.4rem .3rem; }
.main { flex: 1; min-width: 0; padding: 1.5rem; }
.topbar { display: none; }
@media (max-width: 991.98px) {
  .sidebar { position: fixed; left: -260px; z-index: 1040; transition: left .2s; }
  .sidebar.open { left: 0; }
  .topbar { display: flex; align-items: center; justify-content: space-between; padding: .75rem 1rem; background: var(--fin-sidebar); color: #fff; position: sticky; top: 0; z-index: 1030; }
  .main { padding: 1rem; }
}

/* tarjetas de resumen */
.stat { padding: 1.1rem 1.2rem; height: 100%; }
.stat .label { font-size: .8rem; color: var(--fin-muted); text-transform: uppercase; letter-spacing: .04em; display: flex; align-items: center; gap: .4rem; }
.stat .value { font-size: 1.55rem; font-weight: 700; margin-top: .25rem; }
.stat .hint { font-size: .8rem; color: var(--fin-muted); }
.stat-icon { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; }
.bg-soft-income { background: rgba(22,163,74,.12); color: var(--fin-income); }
.bg-soft-expense { background: rgba(220,38,38,.12); color: var(--fin-expense); }
.bg-soft-debt { background: rgba(245,158,11,.15); color: var(--fin-debt); }
.bg-soft-primary { background: rgba(47,111,237,.12); color: var(--fin-primary); }

.month-nav { display: flex; align-items: center; gap: .5rem; }
.month-nav .current { font-weight: 600; min-width: 150px; text-align: center; text-transform: capitalize; }
.cat-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.cat-badge { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .55rem; border-radius: 999px; font-size: .78rem; background: rgba(127,127,127,.12); }
.table { --bs-table-bg: transparent; color: var(--fin-text); }
.table > :not(caption) > * > * { border-bottom-color: var(--fin-border); }
.table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--fin-muted); font-weight: 600; }
.chart-box { position: relative; height: 280px; }
.progress { height: 8px; border-radius: 99px; }
.empty { text-align: center; color: var(--fin-muted); padding: 2rem 1rem; }
.empty i { font-size: 2rem; display: block; margin-bottom: .5rem; }

/* portada pública */
.hero { background: linear-gradient(135deg, #1e3a8a 0%, #2f6fed 55%, #06b6d4 100%); color: #fff; padding: 3.5rem 0 7rem; }
.hero h1 { font-weight: 800; }
.hero-cards { margin-top: -5rem; }
.month-pill { border: 1px solid var(--fin-border); border-radius: 14px; padding: .8rem; text-align: center; height: 100%; background: var(--fin-card); }
.month-pill.current { border-color: var(--fin-primary); box-shadow: 0 0 0 2px rgba(47,111,237,.15); }
.month-pill .m { text-transform: capitalize; font-size: .8rem; color: var(--fin-muted); }
.month-pill .v { font-weight: 700; font-size: 1.05rem; }
.status-pendiente { background: rgba(245,158,11,.15); color: #b45309; }
.status-informada { background: rgba(47,111,237,.15); color: var(--fin-primary); }
.status-pagada { background: rgba(22,163,74,.15); color: var(--fin-income); }
.status-vencida { background: rgba(220,38,38,.15); color: var(--fin-expense); }
.badge-status { padding: .3rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 600; }
code.token { word-break: break-all; font-size: .85rem; }
.status-cancelada { background: rgba(107,114,128,.15); color: var(--fin-muted); text-decoration: line-through; }
.accordion-item { background: var(--fin-card); border-color: var(--fin-border); }
.accordion-button { background: var(--fin-card); color: var(--fin-text); gap: .5rem; flex-wrap: wrap; }
.accordion-button:not(.collapsed) { background: rgba(47,111,237,.06); color: var(--fin-text); box-shadow: none; }
.inst-actions { display: flex; gap: .35rem; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.inst-actions input[type=date] { max-width: 150px; }
pre.copy-box { white-space: pre-wrap; background: var(--bs-tertiary-bg); border-radius: 10px; padding: .75rem; font-size: .85rem; margin: 0; }
.l-mini-logo { width: 30px; height: 30px; border-radius: 9px; display: inline-grid; place-items: center; font-size: .95rem;
  background: linear-gradient(135deg, #6d8bff, #22d3ee); color: #06101f; }
.sidebar .brand { font-size: 1rem; }
.year-title { font-size: 2.4rem; font-weight: 800; letter-spacing: -.03em; color: var(--fin-muted); line-height: 1; margin: .25rem 0 1rem; }
.month-card { color: var(--fin-text); transition: transform .12s, box-shadow .12s, border-color .12s; }
.month-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(15, 23, 42, .08); border-color: var(--fin-primary); color: var(--fin-text); }
.month-card.is-current { border: 2px solid var(--fin-primary); }
.mc-year { font-size: .75rem; font-weight: 600; color: var(--fin-muted); letter-spacing: .08em; }
.mc-month { font-size: 1.25rem; font-weight: 700; margin-bottom: .4rem; }
.mc-spend { font-size: 1.35rem; font-weight: 700; color: var(--fin-expense); }
.pay-check { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--fin-border); background: transparent;
  display: inline-grid; place-items: center; padding: 0; color: #fff; flex-shrink: 0; transition: background .12s, border-color .12s; }
.pay-check:hover { border-color: var(--fin-income); }
.pay-check.is-paid { background: var(--fin-income); border-color: var(--fin-income); }
/* filas que vienen de una cartola (gastos que el banco cobra y no registraste tú) */
.row-cartola > * { background: #fff8db !important; }
[data-bs-theme="dark"] .row-cartola > * { background: rgba(250, 204, 21, .10) !important; }
.legend-cartola { display: inline-block; width: 14px; height: 14px; border-radius: 4px; background: #fff3bf; border: 1px solid #f0d77b; vertical-align: middle; }
.alert-kind { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: .15rem .45rem; border-radius: 6px; }
.k-duplicado { background: rgba(220,38,38,.12); color: var(--fin-expense); }
.k-alto { background: rgba(245,158,11,.18); color: #b45309; }
.k-recurrente { background: rgba(47,111,237,.12); color: var(--fin-primary); }
.cat-link { color: inherit; text-decoration: none; }
.cat-link:hover { color: var(--fin-primary); text-decoration: underline; }
.pay-row { cursor: pointer; margin: 0; }
.pay-row .form-check-input { width: 1.2rem; height: 1.2rem; margin: 0; flex-shrink: 0; }
button.month-pill { background: var(--fin-card); color: var(--fin-text); }
button.month-pill:hover { border-color: var(--fin-primary); }
.pay-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; padding: .75rem 16px; background: var(--fin-card);
  border-top: 1px solid var(--fin-border); box-shadow: 0 -8px 24px rgba(15, 23, 42, .12); }
/* pendiente de un mes que ya pasó: ¿se me olvidó registrarlo? */
.row-vencida > * { background: #fde2e2 !important; }
.row-vencida-li { background: #fde2e2; }
[data-bs-theme="dark"] .row-vencida > *, [data-bs-theme="dark"] .row-vencida-li { background: rgba(220, 38, 38, .14) !important; }
.legend-vencida { display: inline-block; width: 14px; height: 14px; border-radius: 4px; background: #fde2e2; border: 1px solid #f5a3a3; vertical-align: middle; }
