/* ==========================================================================
   Finanzas Personales — sistema visual (sobre AdminLTE 4 / Bootstrap 5.3)
   Tinta #0E1B2E · Papel #F6F7F9 · Superficie #FFF · Línea #E3E7ED · Caribe #0B7A6E
   Una familia (Geist). Las cifras son la tipografía principal: centavos más pequeños.
   ========================================================================== */

@font-face {
  font-family: "Geist";
  src: url("/vendor/geist/geist-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 100 900; font-style: normal; font-display: swap;
}

:root, [data-bs-theme="light"] {
  --ink: #0E1B2E;
  --ink-2: #3B4A5E;
  --muted: #6B7889;
  --paper: #F6F7F9;
  --surface: #FFFFFF;
  --surface-2: #F1F3F6;
  --line: #E3E7ED;
  --line-strong: #D3D9E1;
  --accent: #0B7A6E;
  --accent-ink: #FFFFFF;
  --accent-soft: #E4F2EF;
  --income: #11805A;
  --expense: #C2412D;
  --warn: #9A5B05;
  --warn-soft: #FDF3E1;
  --danger-soft: #FCEDEA;
  --focus: rgba(11, 122, 110, .32);
  --r-sm: 8px; --r-md: 12px; --r-lg: 18px;
  --shadow-pop: 0 12px 32px -12px rgba(14, 27, 46, .22), 0 2px 6px rgba(14, 27, 46, .06);

  /* compatibilidad con nombres anteriores */
  --pf-accent: var(--accent); --pf-income: var(--income); --pf-expense: var(--expense);
  --pf-muted: var(--muted); --pf-warning: var(--warn); --pf-surface: var(--surface); --pf-surface-2: var(--surface-2);
  --pf-card-border: var(--line); --pf-accent-soft: var(--accent-soft); --pf-navy-900: var(--ink);

  --bs-body-font-family: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-font-size: .9375rem;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--paper); --bs-body-bg-rgb: 246, 247, 249;
  --bs-tertiary-bg: var(--paper); --bs-tertiary-bg-rgb: 246, 247, 249;
  --bs-secondary-bg: var(--surface-2);
  --bs-secondary-color: var(--muted);
  --bs-border-color: var(--line);
  --bs-primary: var(--ink); --bs-primary-rgb: 14, 27, 46;
  --bs-link-color: var(--accent); --bs-link-color-rgb: 11, 122, 110; --bs-link-hover-color: #075C53;
  --bs-success: var(--income); --bs-success-rgb: 17, 128, 90;
  --bs-danger: var(--expense); --bs-danger-rgb: 194, 65, 45;
  --bs-warning-rgb: 154, 91, 5;
  --bs-focus-ring-color: var(--focus);
  --bs-border-radius: var(--r-sm);
}

[data-bs-theme="dark"] {
  --ink: #E8EDF4; --ink-2: #B9C4D2; --muted: #8C99AB;
  --paper: #0A1220; --surface: #101A2B; --line: #1F2B3E; --line-strong: #2A384E;
  --surface-2: #142034;
  --accent: #3CC3AE; --accent-ink: #052620; --accent-soft: rgba(60, 195, 174, .13);
  --income: #4FD19A; --expense: #FF8A75; --warn: #F2B957; --warn-soft: rgba(242, 185, 87, .12); --danger-soft: rgba(255, 138, 117, .12);
  --focus: rgba(60, 195, 174, .35);
  --shadow-pop: 0 16px 40px -12px rgba(0, 0, 0, .6);
  --bs-body-bg-rgb: 10, 18, 32; --bs-tertiary-bg-rgb: 10, 18, 32;
  --bs-primary-rgb: 232, 237, 244; --bs-link-color-rgb: 60, 195, 174; --bs-link-hover-color: #6FD9C8;
  --bs-success-rgb: 79, 209, 154; --bs-danger-rgb: 255, 138, 117; --bs-warning-rgb: 242, 185, 87;
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--bs-body-font-family); background: var(--paper); color: var(--ink);
  font-feature-settings: "tnum" 1, "ss01" 1; -webkit-font-smoothing: antialiased; letter-spacing: -.003em;
}
h1, h2, h3, .h1, .h2, .h3, .h4, .h5, .h6 { color: var(--ink); letter-spacing: -.018em; font-weight: 600; }
a { text-underline-offset: 3px; }
.text-body-secondary { color: var(--muted) !important; }
.pf-booting .app-wrapper { visibility: hidden; }
::selection { background: var(--accent-soft); }

/* ── Cifras ─────────────────────────────────────────────────────────────── */
.pf-money { font-variant-numeric: tabular-nums; white-space: nowrap; letter-spacing: -.02em; }
.pf-money .pf-dec { font-size: .58em; color: var(--muted); font-weight: 500; letter-spacing: 0; margin-left: .04em; }
.pf-amount { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; letter-spacing: -.01em; }
.pf-in { color: var(--income) !important; }
.pf-out { color: var(--expense) !important; }
.pf-neutral, .pf-muted { color: var(--muted) !important; }

/* ── Splash y acceso ────────────────────────────────────────────────────── */
.pf-splash { position: fixed; inset: 0; z-index: 2000; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #0E1B2E; }
.pf-splash img { border-radius: 18px; }
.pf-auth { min-height: 100dvh; display: grid; grid-template-columns: 1fr; background: var(--paper); }
@media (min-width: 992px) { .pf-auth { grid-template-columns: minmax(420px, 1fr) minmax(460px, 1fr); } }
.pf-auth-hero { display: none; background: #0E1B2E; color: #C9D3E0; padding: 3.5rem 4rem; }
@media (min-width: 992px) { .pf-auth-hero { display: flex; flex-direction: column; justify-content: space-between; } }
.pf-auth-hero h2 { color: #fff; font-weight: 600; font-size: 2.6rem; line-height: 1.08; letter-spacing: -.035em; max-width: 14ch; }
.pf-auth-hero li { margin-bottom: .85rem; max-width: 40ch; }
.pf-auth-hero .bi { color: #3CC3AE; }
.pf-auth-panel { display: flex; align-items: center; justify-content: center; padding: calc(2rem + env(safe-area-inset-top)) 1.25rem calc(2rem + env(safe-area-inset-bottom)); }
.pf-auth-card { width: 100%; max-width: 380px; }
.pf-auth-card h1 { font-size: 1.75rem; letter-spacing: -.03em; }
.pf-auth-card .form-control, .pf-auth-card .form-select { min-height: 48px; }
.pf-brand-mark { display: inline-flex; align-items: center; gap: .6rem; font-weight: 650; font-size: 1.05rem; color: inherit; }
.pf-brand-mark img { border-radius: 9px; }

/* ── Estructura ─────────────────────────────────────────────────────────── */
.app-header {
  position: sticky; top: 0; z-index: 1030;
  background: color-mix(in srgb, var(--paper) 82%, transparent) !important;
  -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line); box-shadow: none;
  padding-top: env(safe-area-inset-top); padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
  min-height: calc(3.5rem + env(safe-area-inset-top));
}
.pf-page-title { font-size: 1rem; font-weight: 600; letter-spacing: -.01em; outline: none; }
.pf-icon-btn { min-width: 40px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem;
  border: 0; background: transparent; border-radius: 10px; color: var(--ink-2) !important; }
.pf-icon-btn:hover { background: var(--surface-2); }
.pf-avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); font-size: .78rem; font-weight: 650; }
.pf-dot { position: absolute; top: 9px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--expense); box-shadow: 0 0 0 2px var(--paper); }
.pf-skip { position: absolute; z-index: 3000; left: 1rem; top: 1rem; background: var(--surface); padding: .5rem 1rem; }

/* Barra lateral clara */
.app-sidebar { background: var(--surface) !important; border-right: 1px solid var(--line); box-shadow: none !important; --lte-sidebar-width: 248px; }
.app-sidebar .sidebar-brand { border-bottom: 0; padding-top: env(safe-area-inset-top); height: calc(3.5rem + env(safe-area-inset-top)); justify-content: flex-start; padding-left: 1.1rem; }
.app-sidebar .brand-link { display: flex; align-items: center; gap: .6rem; text-decoration: none; }
.app-sidebar .brand-link .brand-image { border-radius: 8px; box-shadow: none; opacity: 1; margin: 0; float: none; max-height: 30px; }
.app-sidebar .brand-text { font-weight: 650; letter-spacing: -.02em; color: var(--ink) !important; }
.app-sidebar .sidebar-wrapper { padding: .25rem .6rem calc(1rem + env(safe-area-inset-bottom)); }
.sidebar-menu .nav-header { color: var(--muted) !important; font-size: .75rem; font-weight: 550; letter-spacing: 0; text-transform: none;
  padding: 1.1rem .7rem .35rem; background: transparent !important; }
.sidebar-menu .nav-link { border-radius: 9px; margin: 1px 0; padding: .5rem .7rem; color: var(--ink-2) !important; font-weight: 500; gap: .15rem; }
.sidebar-menu .nav-link .nav-icon { color: var(--muted); font-size: 1.05rem; }
.sidebar-menu .nav-link:hover { background: var(--surface-2) !important; color: var(--ink) !important; }
.sidebar-menu .nav-link.active { background: var(--accent-soft) !important; color: var(--accent) !important; font-weight: 600; box-shadow: none; }
.sidebar-menu .nav-link.active .nav-icon { color: var(--accent); }
.app-main { background: var(--paper); }
.app-footer { border-top: 1px solid var(--line); background: var(--paper); color: var(--muted); }
.app-content .container-fluid { max-width: 1240px; }
@media (min-width: 1400px) { .app-content .container-fluid { padding-left: 2rem; padding-right: 2rem; } }

/* ── Controles ──────────────────────────────────────────────────────────── */
.btn { border-radius: 10px; font-weight: 550; letter-spacing: -.005em; --bs-btn-padding-y: .45rem; --bs-btn-padding-x: .95rem; }
.btn-sm { border-radius: 8px; --bs-btn-padding-y: .32rem; --bs-btn-padding-x: .7rem; }
.btn-accent { --bs-btn-color: var(--accent-ink); --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent);
  --bs-btn-hover-color: var(--accent-ink); --bs-btn-hover-bg: color-mix(in srgb, var(--accent) 88%, #000); --bs-btn-hover-border-color: transparent;
  --bs-btn-active-bg: color-mix(in srgb, var(--accent) 80%, #000); --bs-btn-active-color: var(--accent-ink);
  --bs-btn-disabled-bg: var(--accent); --bs-btn-disabled-border-color: var(--accent); --bs-btn-disabled-color: var(--accent-ink); }
.btn-primary { --bs-btn-color: var(--paper); --bs-btn-bg: var(--ink); --bs-btn-border-color: var(--ink); --bs-btn-hover-bg: var(--ink-2);
  --bs-btn-hover-border-color: var(--ink-2); --bs-btn-hover-color: var(--paper); --bs-btn-active-bg: var(--ink); --bs-btn-active-color: var(--paper);
  --bs-btn-disabled-bg: var(--ink); --bs-btn-disabled-border-color: var(--ink); --bs-btn-disabled-color: var(--paper); }
.btn-outline-primary, .btn-outline-secondary { --bs-btn-color: var(--ink); --bs-btn-border-color: var(--line-strong); --bs-btn-bg: var(--surface);
  --bs-btn-hover-bg: var(--surface-2); --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: var(--line-strong);
  --bs-btn-active-bg: var(--surface-2); --bs-btn-active-color: var(--ink); --bs-btn-active-border-color: var(--line-strong); }
.btn-check:checked + .btn-outline-primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn-link { color: var(--accent); }
.form-control, .form-select { border-radius: 10px; border-color: var(--line-strong); background-color: var(--surface); color: var(--ink); }
.form-control::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); background-color: var(--surface); color: var(--ink); }
.form-label { font-weight: 550; font-size: .85rem; color: var(--ink-2); margin-bottom: .35rem; }
.form-text { color: var(--muted); font-size: .8rem; }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.dropdown-menu { border-radius: var(--r-md); border-color: var(--line); box-shadow: var(--shadow-pop); padding: .35rem; background: var(--surface); }
.dropdown-item { border-radius: 8px; padding: .5rem .7rem; color: var(--ink); }
.dropdown-item:hover, .dropdown-item:focus { background: var(--surface-2); color: var(--ink); }
.dropdown-header { color: var(--muted); }
.badge { font-weight: 600; border-radius: 6px; letter-spacing: 0; }
.pf-badge-soft { background: var(--accent-soft); color: var(--accent); }
.badge.text-bg-pending { background: var(--warn-soft) !important; color: var(--warn) !important; }
.alert { border-radius: var(--r-md); border-width: 1px; }
.alert-info { background: var(--accent-soft); border-color: transparent; color: var(--ink); }
.alert-warning { background: var(--warn-soft); border-color: transparent; color: var(--ink); }
.alert-danger { background: var(--danger-soft); border-color: transparent; color: var(--ink); }
.alert-light { background: var(--surface-2); border-color: transparent !important; color: var(--ink-2); }

/* ── Superficies ────────────────────────────────────────────────────────── */
.card { border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: none; background: var(--surface); color: var(--ink); }
.card-header { background: transparent; border-bottom: 0; padding: 1rem 1.15rem .25rem; }
.card-header .card-title, .card-title { font-size: .95rem; font-weight: 600; margin: 0; letter-spacing: -.01em; }
.card-body { padding: 1rem 1.15rem; }
.card-footer { background: transparent; border-top: 1px solid var(--line); padding: .75rem 1.15rem; }
.list-group-item { border-color: var(--line); color: var(--ink); }
.modal-content { border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-pop); }
.modal-header, .modal-footer { border-color: var(--line); }
.modal-backdrop.show { opacity: .32; }

.pf-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: .5rem 0 1.25rem; }
.pf-section-head > div:first-child { flex: 1 1 auto; min-width: 0; }
.pf-section-head h2 { font-size: 1.6rem; font-weight: 650; letter-spacing: -.03em; margin: 0; }
.pf-section-head p { margin: .2rem 0 0; color: var(--muted); font-size: .9rem; max-width: 60ch; }

/* KPI (compacto, sin mayúsculas) */
.pf-kpi { padding: 1rem 1.15rem; height: 100%; container-type: inline-size; }
.pf-kpi .pf-kpi-label { color: var(--muted); font-size: .82rem; font-weight: 500; display: flex; align-items: center; gap: .4rem; }
.pf-kpi .pf-kpi-value { font-size: clamp(1rem, 11cqi, 1.5rem); font-weight: 650; letter-spacing: -.025em; margin-top: .3rem; white-space: nowrap; }
.pf-kpi .pf-kpi-sub { font-size: .8rem; color: var(--muted); margin-top: .2rem; }
.pf-kpi-hero { background: var(--ink); color: var(--paper); border: 0; }
.pf-kpi-hero .pf-kpi-label, .pf-kpi-hero .pf-kpi-sub { color: color-mix(in srgb, var(--paper) 65%, transparent); }

/* ── Inicio: bloque de saldo y flujo del mes ────────────────────────────── */
.pf-hero { display: grid; gap: 1.25rem 2.5rem; grid-template-columns: 1fr; padding: 1.5rem 1.4rem; margin-bottom: 1rem; }
@media (min-width: 992px) { .pf-hero { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); padding: 1.9rem 2rem; align-items: end; } }
.pf-hero-label { color: var(--muted); font-size: .9rem; font-weight: 500; }
.pf-hero-balance { font-size: clamp(2.4rem, 9vw, 3.6rem); font-weight: 650; line-height: 1; margin: .45rem 0 .9rem; color: var(--ink); }
.pf-hero-stats { display: flex; flex-wrap: wrap; gap: .4rem 1.6rem; font-size: .85rem; color: var(--muted); }
.pf-hero-stats strong { display: block; color: var(--ink); font-weight: 600; font-size: .98rem; }
.pf-flow-title { display: flex; justify-content: space-between; align-items: baseline; font-size: .9rem; color: var(--muted); margin-bottom: .6rem; }
.pf-flow-title strong { color: var(--ink); font-size: 1.05rem; font-weight: 650; }
.pf-flow-bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--surface-2); gap: 2px; }
.pf-flow-bar > span { display: block; height: 100%; }
.pf-flow-bar .in { background: var(--income); }
.pf-flow-bar .out { background: var(--expense); }
.pf-flow-legend { display: flex; justify-content: space-between; gap: 1rem; margin-top: .7rem; font-size: .85rem; color: var(--muted); }
.pf-flow-legend strong { display: block; font-size: 1.05rem; font-weight: 650; }
.pf-legend-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: .35rem; vertical-align: 1px; }

/* Primeros pasos (secuencia real → numerada) */
.pf-steps { padding: 1.1rem 1.15rem; margin-bottom: 1rem; }
.pf-steps-head { display: flex; align-items: center; gap: .75rem; margin-bottom: .75rem; }
.pf-steps-head h3 { font-size: 1rem; margin: 0; font-weight: 650; }
.pf-steps-progress { flex: 1; max-width: 160px; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.pf-steps-progress span { display: block; height: 100%; background: var(--accent); }
.pf-steps ol { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; grid-template-columns: 1fr; counter-reset: step; }
@media (min-width: 768px) { .pf-steps ol { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1200px) { .pf-steps ol { grid-template-columns: repeat(4, 1fr); } }
.pf-steps li a { display: flex; gap: .7rem; align-items: flex-start; padding: .75rem .8rem; border-radius: var(--r-md); border: 1px solid var(--line);
  text-decoration: none; color: var(--ink); height: 100%; }
.pf-steps li a:hover { border-color: var(--accent); }
.pf-steps li a::before { counter-increment: step; content: counter(step); flex: 0 0 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 650; background: var(--surface-2); color: var(--ink-2); }
.pf-steps li.done a { color: var(--muted); }
.pf-steps li.done a::before { content: "✓"; background: var(--accent); color: var(--accent-ink); }
.pf-steps li span { display: block; font-weight: 600; font-size: .9rem; }
.pf-steps li small { color: var(--muted); }

/* Lista de avisos */
.pf-notes { display: grid; gap: .5rem; margin-bottom: 1rem; }
.pf-note { display: flex; gap: .7rem; align-items: flex-start; padding: .7rem .9rem; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); font-size: .9rem; }
.pf-note .bi { margin-top: .1rem; }
.pf-note.is-danger .bi { color: var(--expense); }
.pf-note.is-warning .bi { color: var(--warn); }
.pf-note.is-info .bi { color: var(--accent); }
.pf-note a { margin-left: auto; white-space: nowrap; font-weight: 550; }

/* Barras de categoría */
.pf-bars { list-style: none; padding: 0; margin: 0; display: grid; gap: .8rem; }
.pf-bars li { display: grid; grid-template-columns: 1fr auto; gap: .3rem .75rem; font-size: .88rem; }
.pf-bars .pf-bar { grid-column: 1 / -1; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.pf-bars .pf-bar span { display: block; height: 100%; border-radius: 99px; }

/* ── Movimientos ────────────────────────────────────────────────────────── */
.pf-txn { display: flex; align-items: center; gap: .85rem; padding: .7rem 1.15rem; text-decoration: none; color: inherit; position: relative; }
.pf-txn + .pf-txn::after { content: ""; position: absolute; left: 4.1rem; right: 1.15rem; top: 0; border-top: 1px solid var(--line); }
.pf-txn:hover { background: var(--surface-2); }
.pf-txn-icon { width: 38px; height: 38px; border-radius: 11px; flex: 0 0 38px; display: flex; align-items: center; justify-content: center; font-size: 1.05rem; color: #fff; }
.pf-txn-main { min-width: 0; flex: 1; }
.pf-txn-title { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-txn-meta { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-txn-meta .sep { display: inline-block; width: .9em; }
.pf-day-head { padding: .9rem 1.15rem .35rem; font-size: .8rem; font-weight: 600; color: var(--muted); }

/* Progreso */
.progress { height: 6px; border-radius: 99px; background: var(--surface-2); }
.progress-bar { border-radius: 99px; background: var(--accent); }
.progress-bar.pf-warn { background: #D99124; }
.progress-bar.pf-over { background: var(--expense); }

/* Estados */
.pf-empty { text-align: center; padding: 2.2rem 1rem; color: var(--muted); }
.pf-empty .bi { font-size: 1.6rem; color: var(--accent); display: inline-flex; width: 52px; height: 52px; align-items: center; justify-content: center;
  border-radius: 14px; background: var(--accent-soft); margin-bottom: .8rem; }
.pf-empty h3 { font-size: 1rem; color: var(--ink); font-weight: 650; margin-bottom: .3rem; }
.pf-empty p { max-width: 42ch; margin-left: auto; margin-right: auto; }
.pf-skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--line) 37%, var(--surface-2) 63%); background-size: 400% 100%;
  animation: pf-shimmer 1.4s ease infinite; border-radius: var(--r-lg); min-height: 1rem; }
@keyframes pf-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.pf-chart { position: relative; height: 240px; }
.pf-chart-sm { position: relative; height: 200px; }

/* Sincronización y conexión */
.pf-sync { font-weight: 600; font-size: .74rem; padding: .42em .75em; border-radius: 99px; }
.pf-sync.is-pending { background: var(--warn-soft); color: var(--warn); }
.pf-sync.is-syncing { background: var(--accent-soft); color: var(--accent); }
.pf-sync.is-error { background: var(--danger-soft); color: var(--expense); }
.pf-sync.is-offline { background: var(--surface-2); color: var(--ink-2); }
.pf-offline-banner { display: flex; gap: .6rem; align-items: center; padding: .55rem 1rem; background: var(--ink); color: var(--paper); font-size: .85rem; }
.pf-stale { font-size: .8rem; color: var(--warn); margin-bottom: .5rem; }
.pf-update { position: fixed; z-index: 1090; left: 50%; transform: translateX(-50%); bottom: calc(92px + env(safe-area-inset-bottom));
  background: var(--ink); color: var(--paper); padding: .55rem .6rem .55rem 1rem; border-radius: 99px; display: flex; gap: .8rem; align-items: center;
  box-shadow: var(--shadow-pop); font-size: .9rem; white-space: nowrap; }
@media (min-width: 992px) { .pf-update { bottom: 24px; } }
.pf-toasts { right: 0; bottom: 0; z-index: 1095; }
.toast { border-radius: var(--r-md); background: var(--surface); color: var(--ink); border: 1px solid var(--line) !important; box-shadow: var(--shadow-pop) !important; }
@media (max-width: 991.98px) {
  .pf-toasts { top: calc(3.75rem + env(safe-area-inset-top)); bottom: auto !important; left: 0; right: 0; }
  .pf-toasts .toast { width: 100%; }
}

/* ── Navegación inferior móvil ──────────────────────────────────────────── */
.pf-bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1035; display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  background: color-mix(in srgb, var(--surface) 88%, transparent); -webkit-backdrop-filter: saturate(180%) blur(16px); backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--line); padding: .3rem .25rem calc(.3rem + env(safe-area-inset-bottom));
}
.pf-bottom-nav a, .pf-bottom-nav button { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 50px; justify-content: center;
  color: var(--muted); text-decoration: none; font-size: .7rem; font-weight: 550; border: 0; background: transparent; }
.pf-bottom-nav .bi { font-size: 1.3rem; }
.pf-bottom-nav a.active { color: var(--ink); }
.pf-bottom-nav a.active .bi { color: var(--accent); }
.pf-bottom-nav .pf-fab { width: 54px; height: 54px; min-height: 54px; margin: 0 auto; border-radius: 17px; background: var(--ink); color: var(--paper) !important; }
.pf-bottom-nav .pf-fab .bi { font-size: 1.55rem; color: var(--paper) !important; }
@media (max-width: 575.98px) {
  .pf-section-head:has(> .btn-group:last-child) { flex-wrap: nowrap; align-items: flex-start; }
}
@media (max-width: 991.98px) {
  .app-main { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
  .app-content .container-fluid { padding-left: 1rem; padding-right: 1rem; }
  .btn, .form-control, .form-select { min-height: 44px; }
  .btn-sm { min-height: 36px; }
  .pf-section-head h2 { font-size: 1.4rem; }
}

/* Menú de acciones (botón +) */
.pf-sheet.offcanvas-bottom { height: auto; border-radius: 22px 22px 0 0; border: 0; background: var(--surface); padding-bottom: env(safe-area-inset-bottom); }
.pf-sheet .offcanvas-header { padding: 1rem 1.25rem .25rem; }
.pf-sheet-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; padding: .75rem 1.25rem 1.25rem; }
.pf-sheet-grid a, .pf-sheet-grid button { display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; padding: 1rem; border-radius: 16px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; text-align: left; font-weight: 600; }
.pf-sheet-grid small { color: var(--muted); font-weight: 400; }
.pf-sheet-grid .bi { font-size: 1.3rem; width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; }
.pf-sheet-grid .t-out .bi { background: var(--danger-soft); color: var(--expense); }
.pf-sheet-grid .t-in .bi { background: rgba(17, 128, 90, .1); color: var(--income); }
.pf-sheet-grid .t-tr .bi, .pf-sheet-grid .t-cc .bi { background: var(--surface-2); color: var(--ink-2); }

/* ── Registro rápido ────────────────────────────────────────────────────── */
.pf-quick { max-width: 480px; margin: 0 auto; }
.pf-quick-amount { text-align: center; padding: .9rem 0 1.1rem; }
.pf-quick-amount .pf-cur { font-size: 1.15rem; color: var(--muted); font-weight: 550; vertical-align: .9em; margin-right: .3rem; }
.pf-quick-amount .pf-num { font-size: 3.4rem; font-weight: 650; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.pf-kind-switch { background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 3px !important; }
.pf-kind-switch > .btn { border: 0; min-height: 40px; }
.pf-kind-switch > .btn-primary { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(14, 27, 46, .12); }
.pf-kind-switch > .btn-outline-secondary { background: transparent; color: var(--muted); }
.pf-keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .45rem; }
.pf-keypad button { min-height: 58px; font-size: 1.45rem; font-weight: 550; border-radius: 14px; border: 0; background: var(--surface); color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line); font-variant-numeric: tabular-nums; }
.pf-keypad button:active { background: var(--surface-2); }
.pf-cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .45rem; }
@media (min-width: 576px) { .pf-cat-grid { grid-template-columns: repeat(5, 1fr); } }
.pf-cat { border: 0; box-shadow: inset 0 0 0 1px var(--line); background: var(--surface); border-radius: 14px; padding: .6rem .25rem .5rem; text-align: center;
  font-size: .72rem; line-height: 1.15; min-height: 76px; color: var(--ink-2); }
.pf-cat .pf-cat-ic { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 1rem; margin-bottom: .3rem; }
.pf-cat[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.pf-chip { border: 0; box-shadow: inset 0 0 0 1px var(--line-strong); background: var(--surface); border-radius: 99px; padding: .4rem .85rem; font-size: .82rem;
  white-space: nowrap; color: var(--ink-2); }
.pf-chip[aria-pressed="true"] { box-shadow: inset 0 0 0 1.5px var(--ink); color: var(--ink); font-weight: 600; }
.pf-scroll-x { display: flex; gap: .45rem; overflow-x: auto; padding: 2px 2px .3rem; scrollbar-width: none; }
.pf-scroll-x::-webkit-scrollbar { display: none; }
.pf-save-bar { position: sticky; bottom: calc(86px + env(safe-area-inset-bottom)); padding-top: .75rem; background: linear-gradient(to top, var(--paper) 72%, transparent); }
@media (min-width: 992px) { .pf-save-bar { bottom: 0; } }
.pf-save-bar .btn { min-height: 54px; font-size: 1.02rem; border-radius: 14px; }
.pf-step-label { font-size: .82rem; color: var(--muted); font-weight: 500; margin-bottom: .4rem; display: flex; align-items: center; }

/* Tarjetas de crédito */
.pf-cc { border-radius: var(--r-lg); color: #fff; padding: 1.15rem 1.25rem; background: #13294A; position: relative; overflow: hidden; min-height: 150px; }
.pf-cc::after { content: ""; position: absolute; inset: auto -30% -60% auto; width: 70%; aspect-ratio: 1; border-radius: 50%; background: rgba(255, 255, 255, .06); }
.pf-cc .pf-cc-name { font-weight: 600; }
.pf-cc .pf-cc-num { letter-spacing: .16em; opacity: .75; font-size: .85rem; }
.pf-cc .pf-cc-debt { font-size: 1.6rem; font-weight: 650; letter-spacing: -.03em; }

/* Calendario */
.pf-cal { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.pf-cal > div { min-height: 92px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: .35rem; font-size: .72rem; }
.pf-cal .pf-cal-h { min-height: auto; text-align: center; font-weight: 550; color: var(--muted); background: var(--surface-2); padding: .45rem 0; }
.pf-cal .pf-cal-d { font-weight: 600; font-size: .8rem; }
.pf-cal .is-out { background: var(--surface-2); }
.pf-cal .is-today .pf-cal-d { background: var(--ink); color: var(--paper); border-radius: 6px; padding: 0 .35rem; }
.pf-ev { display: block; border-radius: 4px; padding: 1px 4px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--surface-2); border-left: 3px solid var(--muted); }
.pf-ev.t-card_due, .pf-ev.t-loan_due { border-left-color: #D99124; }
.pf-ev.t-loan_overdue { border-left-color: var(--expense); }
.pf-ev.t-income { border-left-color: var(--income); }
.pf-ev.t-goal { border-left-color: var(--accent); }
@media (max-width: 767.98px) { .pf-cal > div { min-height: 58px; } .pf-ev { font-size: 0; height: 6px; padding: 0; } }

/* Tablas */
.table { --bs-table-bg: transparent; --bs-table-color: var(--ink); --bs-table-striped-bg: var(--surface-2); --bs-table-hover-bg: var(--surface-2); }
.table > :not(caption) > * > * { padding: .65rem .9rem; border-color: var(--line); }
.table thead th { font-size: .8rem; color: var(--muted); font-weight: 550; text-transform: none; letter-spacing: 0; border-bottom-width: 1px; }

/* Accesibilidad, movimiento e impresión */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media print {
  .app-header, .app-sidebar, .app-footer, .pf-bottom-nav, .pf-no-print, .pf-offline-banner, .toast-container { display: none !important; }
  .app-main { margin: 0 !important; padding: 0 !important; }
  .card { break-inside: avoid; }
  body { background: #fff; }
}
