/* =============================================================
   components.css — Componentes reutilizables (base: Pay v5)
   Contrato visual compartido por todas las pantallas (rediseño 2026-10).
   ============================================================= */

/* ===================== BOTONES ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 48px;
  padding: 12px 20px;
  font-size: var(--fs-base);
  font-weight: var(--fw-bold);
  line-height: 1.25;
  border-radius: 14px;
  transition: transform var(--transition-fast), background var(--transition), box-shadow var(--transition), filter var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--primary-solid); color: var(--on-primary); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.06); }

.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-hover); }

.btn-ghost { background: transparent; color: var(--primary); }
.btn-ghost:hover:not(:disabled) { background: var(--primary-soft); }

.btn-danger { background: var(--danger-solid); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(0.95); }

/* Eliminar como acción secundaria: el rojo sólido queda para la confirmación final */
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); }
.btn-danger-soft:hover:not(:disabled) { filter: brightness(0.97); }

.btn-success { background: var(--success); color: #fff; }

/* Botón cuadrado de solo icono, alto táctil ≥44px */
.btn-icon { padding: 0; width: 48px; min-height: 48px; flex: 0 0 auto; font-size: 1.1rem; }

.btn-block { width: 100%; }
.btn-lg { min-height: 54px; padding: 15px 24px; font-size: var(--fs-md); border-radius: 16px; }
.btn-sm { padding: 8px 14px; min-height: 40px; font-size: var(--fs-sm); border-radius: 12px; }

/* Botón circular (acciones) */
.round-button {
  width: 44px; height: 44px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  position: relative;
  flex-shrink: 0;
  transition: transform var(--transition-fast), background var(--transition);
}
.round-button:active { transform: scale(0.92); }
.round-button:disabled { opacity: 0.4; }
.round-button.primary { background: var(--primary-solid); color: var(--on-primary); border: none; }
.round-button .badge-dot {
  position: absolute; top: 9px; right: 10px;
  width: 9px; height: 9px; border-radius: var(--radius-full);
  background: var(--danger); border: 2px solid var(--surface);
}

/* ===================== CABECERAS ===================== */
/* Título de pantalla (Movimientos, Informes, Perfil…) con acciones a la derecha */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 48px;
  margin-bottom: var(--space-4);
}
.page-title { font-size: var(--fs-xl); font-weight: var(--fw-extra); letter-spacing: -0.02em; margin: 0; }
.page-header .header-actions { display: flex; align-items: center; gap: var(--space-2); }
.back-header { display: flex; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-4) calc(-1 * var(--space-3)); }
.back-header .page-title { font-size: var(--fs-lg); }
.back-button {
  width: 44px; height: 44px; border-radius: var(--radius-full);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text); font-size: 1.3rem;
}

/* Saludo de Inicio */
.app-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.header-user { display: flex; align-items: center; gap: var(--space-3); min-width: 0; flex: 1; }
.profile-image {
  width: 44px; height: 44px;
  border-radius: var(--radius-full);
  background: var(--primary-soft) center/cover no-repeat;
  color: var(--primary-ink);
  display: flex; align-items: center; justify-content: center;
  font-weight: var(--fw-extra); font-size: var(--fs-base);
  flex-shrink: 0;
}
.profile-image.has-photo { color: transparent; }
.header-greeting { min-width: 0; }
.header-greeting .greet-label { font-size: var(--fs-sm); color: var(--text-muted); font-weight: var(--fw-semibold); }
.header-greeting .user-name { font-size: var(--fs-md); font-weight: var(--fw-bold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-actions { display: flex; align-items: center; gap: var(--space-2); }

/* Saldo destacado de Inicio (sin tarjeta) */
.hero { display: flex; flex-direction: column; gap: 6px; }
.hero .hero-label { font-size: var(--fs-sm); color: var(--text-muted); font-weight: var(--fw-semibold); }
.hero .hero-value { font-size: var(--fs-2xl); font-weight: var(--fw-extra); letter-spacing: -0.03em; line-height: 1.1; }
.delta-chip {
  align-self: flex-start;
  font-size: var(--fs-sm); font-weight: var(--fw-bold);
  padding: 3px 10px; border-radius: var(--radius-full);
  background: var(--primary-soft); color: var(--primary-ink);
}
.delta-chip.negative { background: var(--danger-soft); color: var(--danger); }

/* Accesos rápidos */
.quick-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2); }
.quick-action {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-2);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--text-secondary);
  background: none; padding: 0;
}
.quick-action .qa-icon {
  width: 52px; height: 52px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 1.35rem;
  transition: transform var(--transition-fast);
}
.quick-action:active .qa-icon { transform: scale(0.94); }
.quick-action.main .qa-icon { background: var(--primary-solid); border-color: var(--primary-solid); color: var(--on-primary); }

/* Resumen del mes */
.summary-card { padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); color: inherit; text-decoration: none; }
.summary-card .stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.stat-label { font-size: var(--fs-sm); color: var(--text-muted); font-weight: var(--fw-semibold); }
.stat-value { font-size: var(--fs-lg); font-weight: var(--fw-extra); letter-spacing: -0.01em; }
.split-bar { display: flex; gap: 3px; height: 8px; border-radius: var(--radius-full); overflow: hidden; background: var(--surface-2); }
.split-bar span { display: block; height: 100%; }

/* Cabecera de sección con enlace */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); }
.section-head .section-title { margin-bottom: 0; }
.section-link { color: var(--primary); font-weight: var(--fw-semibold); font-size: var(--fs-sm); background: none; padding: 12px 0 12px 12px; margin: -12px 0; }

/* ===================== NAV INFERIOR (anclada) ===================== */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: var(--z-nav);
  display: flex;
  justify-content: center;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
}
.bottom-nav-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  width: 100%;
  max-width: var(--content-max);
  height: var(--nav-height);
  padding: 6px var(--space-1) 0;
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1 1 0;
  min-width: 0;
  padding-top: 4px;
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-weight: var(--fw-semibold);
  text-decoration: none;
  transition: color var(--transition-fast);
}
.nav-item span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item i { font-size: 1.4rem; line-height: 1.2; }
.nav-item.active { color: var(--primary); }
.nav-fab {
  flex: 0 0 auto;
  width: 56px; height: 56px;
  margin: -22px var(--space-2) 0;
  border-radius: 18px;
  background: var(--primary-solid);
  color: var(--on-primary);
  font-size: 1.6rem;
  box-shadow: var(--shadow-primary);
  display: flex; align-items: center; justify-content: center;
  transition: transform var(--transition-fast);
}
.nav-fab:active { transform: scale(0.92); }

/* ===================== CARD GENÉRICA ===================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}
.card-flat { background: var(--surface); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); }
.card-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }

/* ===================== SEGMENTED TABS ===================== */
.segmented {
  display: flex;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}
.segmented button {
  flex: 1;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 9px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  color: var(--text-secondary);
  transition: background var(--transition-fast), color var(--transition-fast);
}
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }

/* ===================== LISTAS POR DÍA ===================== */
/* Grupo por día: cabecera con total y tarjeta con las filas */
.day-group { display: flex; flex-direction: column; gap: var(--space-2); }
.day-group + .day-group { margin-top: var(--space-4); }
.day-head {
  display: flex; justify-content: space-between; gap: var(--space-3);
  padding: 0 var(--space-1);
  font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--text-muted);
}
.day-head span:first-child::first-letter { text-transform: uppercase; }

.entry-list { display: flex; flex-direction: column; }
.entry {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 60px;
  padding: 10px var(--space-4);
  cursor: pointer;
  transition: background var(--transition-fast);
  position: relative;
}
.entry + .entry { border-top: 1px solid var(--border); }
.entry:active { background: var(--surface-hover); }
@media (hover: hover) { .entry:hover { background: var(--surface-hover); } }
.entry-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  background: var(--metric-none-bg);
  color: var(--metric-none);
}
.entry-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.entry-info strong { font-size: var(--fs-base); font-weight: var(--fw-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry-info > span { font-size: var(--fs-sm); color: var(--text-muted); }
.entry-meta { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: var(--fs-sm); color: var(--text-muted); }
.entry-meta > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry-value { font-size: var(--fs-base); font-weight: var(--fw-bold); white-space: nowrap; }

/* Etiquetas pequeñas (Auto, Sin categoría, Dividido…) */
.tag {
  flex-shrink: 0;
  font-size: 0.6875rem; font-weight: var(--fw-bold);
  padding: 1px 7px; border-radius: var(--radius-full);
  background: var(--surface-2); color: var(--text-secondary);
}
.tag.tag-primary { background: var(--primary-soft); color: var(--primary-ink); }
.tag.tag-warning { background: var(--warning-soft); color: var(--warning-text); }

.load-more { margin-top: var(--space-4); }

/* Aviso tocable (movimientos sin confirmar) */
.notice-banner {
  display: flex; align-items: center; gap: var(--space-3);
  width: 100%; padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--warning-soft); color: var(--warning-text);
  font-weight: var(--fw-semibold); font-size: var(--fs-sm); text-align: left;
}
.notice-banner span { flex: 1; }

/* Buscador */
.search-field {
  flex: 1;
  display: flex; align-items: center; gap: var(--space-2);
  min-height: 46px; padding: 0 var(--space-3);
  border-radius: 14px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-muted);
}
.search-field:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.search-field input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; }

/* ===================== LISTA DE AJUSTES (Perfil, cuentas) ===================== */
.settings-group + .settings-group { margin-top: var(--space-5); }
.settings-title {
  font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  padding: 0 var(--space-1); margin-bottom: var(--space-2);
}
.settings-list { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; overflow: hidden; }
.settings-row {
  display: flex; align-items: center; gap: var(--space-3);
  width: 100%; min-height: 54px; padding: 8px var(--space-4);
  background: none; color: var(--text); text-align: left; text-decoration: none;
  font-size: var(--fs-base);
}
.settings-row + .settings-row { border-top: 1px solid var(--border); }
button.settings-row:active, a.settings-row:active { background: var(--surface-hover); }
@media (hover: hover) { button.settings-row:hover, a.settings-row:hover { background: var(--surface-hover); } }
.settings-icon {
  width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0;
  background: var(--surface-2); color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center; font-size: 1rem;
}
.settings-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.settings-text strong { font-weight: var(--fw-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.settings-text small { font-size: var(--fs-sm); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.settings-value { color: var(--text-muted); font-size: var(--fs-sm); font-weight: var(--fw-semibold); white-space: nowrap; }
.settings-amount { font-weight: var(--fw-bold); white-space: nowrap; }
.settings-amount.negative { color: var(--danger); }
.settings-chevron { color: var(--text-muted); font-size: 0.95rem; }
.settings-row.is-primary { color: var(--primary); font-weight: var(--fw-bold); }
.settings-row.is-danger, .settings-row.is-danger .settings-icon { color: var(--danger); }
.settings-row.is-muted strong, .settings-row.is-muted .settings-amount { color: var(--text-muted); }

/* Interruptor */
.switch {
  position: relative; flex-shrink: 0;
  width: 50px; height: 30px; border-radius: var(--radius-full);
  background: var(--border-strong);
  transition: background var(--transition-fast);
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px; border-radius: var(--radius-full);
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform var(--transition-fast);
}
.switch[aria-checked="true"] { background: var(--primary-solid); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }

/* Cabecera de perfil */
.profile-head { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-5); }
.profile-head .profile-image { width: 56px; height: 56px; font-size: var(--fs-md); }
.profile-head strong { display: block; font-size: var(--fs-lg); font-weight: var(--fw-extra); }
.profile-head small { color: var(--text-muted); font-size: var(--fs-sm); }

/* Opciones de una lista de selección (tema, cuenta…) */
.choice-list { display: flex; flex-direction: column; gap: var(--space-2); }
.choice {
  display: flex; align-items: center; gap: var(--space-3);
  min-height: 56px; padding: 0 var(--space-4);
  border-radius: 14px; border: 1px solid var(--border); background: var(--surface);
  font-weight: var(--fw-semibold); text-align: left; width: 100%;
}
.choice i:first-child { font-size: 1.2rem; color: var(--text-secondary); }
.choice span { flex: 1; }
.choice .bi-check-lg { color: var(--primary); font-size: 1.2rem; visibility: hidden; }
.choice[aria-checked="true"] { border: 2px solid var(--primary); padding: 0 calc(var(--space-4) - 1px); background: var(--primary-soft); }
.choice[aria-checked="true"] .bi-check-lg { visibility: visible; }

/* ===================== INFORMES ===================== */
.month-nav { display: flex; align-items: center; gap: 2px; }
.month-nav .month-label { font-size: var(--fs-base); font-weight: var(--fw-bold); min-width: 92px; text-align: center; text-transform: capitalize; }
.month-nav .round-button { border: 0; background: transparent; width: 40px; height: 40px; }

.donut-wrap { display: flex; align-items: center; gap: var(--space-5); margin: var(--space-4) 0; }
.donut { position: relative; width: 168px; height: 168px; flex-shrink: 0; }
.donut svg { display: block; transform: rotate(-90deg); }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.donut-center strong { font-size: var(--fs-lg); font-weight: var(--fw-extra); letter-spacing: -0.02em; }
.donut-center small { font-size: var(--fs-xs); color: var(--text-muted); font-weight: var(--fw-semibold); }
.donut-side { display: flex; flex-direction: column; gap: var(--space-2); font-size: var(--fs-sm); min-width: 0; }
.donut-side strong { font-size: var(--fs-base); }
.donut-side span { color: var(--text-muted); }

.category-row { display: flex; flex-direction: column; gap: 6px; padding: 12px var(--space-4); width: 100%; text-align: left; background: none; color: inherit; }
.category-row + .category-row { border-top: 1px solid var(--border); }
.category-row-head { display: flex; align-items: center; gap: var(--space-3); }
.category-row-head .entry-icon { width: 36px; height: 36px; border-radius: 11px; font-size: 1rem; }
.category-row-name { flex: 1; min-width: 0; font-weight: var(--fw-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.category-row-pct { font-size: var(--fs-sm); color: var(--text-muted); font-weight: var(--fw-semibold); }
.category-row-amount { font-weight: var(--fw-bold); min-width: 88px; text-align: right; white-space: nowrap; }
.progress { height: 6px; border-radius: var(--radius-full); background: var(--surface-2); overflow: hidden; margin-left: 48px; }
.progress span { display: block; height: 100%; border-radius: var(--radius-full); }

.month-bars { display: flex; align-items: flex-end; gap: var(--space-3); height: 112px; }
.month-bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--text-muted); }
.month-bar span { display: block; width: 100%; max-width: 30px; min-height: 4px; border-radius: 8px; background: var(--surface-3); }
.month-bar.current { color: var(--primary); }
.month-bar.current span { background: var(--primary-solid); }

/* ===================== FORMULARIO TIPO AJUSTES ===================== */
.field-list { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; overflow: hidden; }
.field-row {
  display: flex; align-items: center; gap: var(--space-3);
  min-height: 54px; padding: 0 var(--space-4);
}
.field-row + .field-row { border-top: 1px solid var(--border); }
.field-row > span:first-child { width: 88px; flex-shrink: 0; color: var(--text-muted); font-weight: var(--fw-semibold); font-size: var(--fs-sm); }
.field-row input, .field-row select {
  flex: 1; min-width: 0; min-height: 52px; border: 0; outline: 0; background: transparent;
  font: inherit; font-weight: var(--fw-semibold); color: var(--text);
}
.field-row select { appearance: none; cursor: pointer; }
.field-row:focus-within { background: var(--surface-hover); }
button.field-row { width: 100%; background: none; text-align: left; color: var(--primary); font-weight: var(--fw-bold); }

/* ===================== LOGIN CON HUELLA ===================== */
.bio-button {
  width: 112px; height: 112px; border-radius: var(--radius-full);
  border: 2px solid var(--primary); background: var(--primary-soft); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 3rem;
  transition: transform var(--transition-fast);
}
.bio-button:active { transform: scale(0.95); }

/* ===================== FORMULARIOS ===================== */
.form-group { margin-bottom: var(--space-4); }
.form-label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}
.form-control, .form-select {
  width: 100%;
  min-height: 50px;
  padding: 12px 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
textarea.form-control { resize: vertical; min-height: 84px; }
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%235C6867' stroke-width='2' stroke-linecap='round' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}
.form-hint { font-size: var(--fs-sm); color: var(--text-muted); margin-top: var(--space-1); }
.form-readonly { background: var(--surface-2); border-radius: 14px; padding: 13px 15px; color: var(--text-secondary); }

/* ===================== SHEET / MODAL A PANTALLA COMPLETA ===================== */
.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-sheet);
  background: rgba(16, 35, 40, 0.45);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity var(--transition);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.sheet-overlay.open { opacity: 1; }

.sheet {
  background: var(--bg);
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform var(--transition-bounce);
  overflow: hidden;
}
.sheet-overlay.open .sheet { transform: translateY(0); }

.sheet-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  padding-top: calc(var(--safe-top) + var(--space-3));
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}
.sheet-header h3 { font-size: var(--fs-md); font-weight: var(--fw-extra); flex: 1; }
.sheet-close {
  width: 44px; height: 44px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.sheet-body { flex: 1; overflow-y: auto; padding: var(--space-5) var(--space-4); -webkit-overflow-scrolling: touch; }
.sheet-footer {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4);
  padding-bottom: calc(var(--safe-bottom) + var(--space-4));
  border-top: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}
.sheet.no-footer .sheet-body { padding-bottom: calc(var(--safe-bottom) + var(--space-6)); }
.sheet-footer .btn { flex: 1; min-width: 0; }
.sheet-footer .btn-icon { flex: 0 0 auto; }

/* Variante compacta (confirmaciones): hoja inferior con alto según contenido */
.sheet-overlay.compact .sheet {
  height: auto;
  min-height: 0;
  max-height: 85dvh;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: var(--shadow-lg);
}
.sheet-overlay.compact .sheet-header { border-bottom: none; padding-top: var(--space-4); padding-bottom: 0; background: var(--bg); }
.sheet-overlay.compact .sheet-body { flex: 0 1 auto; padding-top: var(--space-3); color: var(--text-secondary); }
.sheet-overlay.compact .sheet-footer { border-top: none; background: var(--bg); }

/* Pasos (wizard) dentro de un sheet */
.sheet-steps { display: flex; gap: var(--space-2); margin-bottom: var(--space-4); }
.sheet-step-dot { flex: 1; height: 4px; border-radius: var(--radius-full); background: var(--surface-3); }
.sheet-step-dot.active { background: var(--primary); }

/* ===================== TOASTS ===================== */
.toast-container {
  position: fixed;
  top: calc(var(--safe-top) + var(--space-3));
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: calc(100% - var(--space-8));
  max-width: 420px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--primary);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text);
  animation: fadeInUp 0.3s ease both;
  pointer-events: auto;
}
.toast.success { border-left-color: var(--success); }
.toast.danger { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--info); }
.toast i { font-size: 1.2rem; }
.toast.success i { color: var(--success); }
.toast.danger i { color: var(--danger); }
.toast.warning i { color: var(--warning); }
.toast.info i { color: var(--info); }
.toast.hide { animation: fadeIn 0.25s ease reverse both; }

/* ===================== OVERLAY DE CARGA GLOBAL ===================== */
.loading-overlay {
  position: fixed; inset: 0; z-index: var(--z-toast);
  background: rgba(16,35,40,0.55);
  backdrop-filter: blur(3px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-4);
  color: #fff; text-align: center; padding: var(--space-6);
}
.loading-overlay .spinner { width: 44px; height: 44px; border-width: 4px; }
.loading-overlay p { max-width: 280px; font-size: var(--fs-sm); }

/* ===================== FILTRO ACTIVO ===================== */
.filter-message {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  margin-top: var(--space-3);
}
.filter-message button { margin-left: auto; color: var(--primary); font-size: 1.1rem; }

/* ===================== TOGGLE DE TEMA ===================== */
.theme-toggle {
  width: 44px; height: 44px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
}

/* ===================== AVISO DESTACADO ===================== */
.callout {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  background: var(--surface-2);
  color: var(--text);
}
.callout i { flex-shrink: 0; line-height: 1.5; }
.callout-warning { background: var(--warning-soft); color: var(--warning-text); }

/* ===================== OPCIONES DE MENÚ (sheet selector) ===================== */
.option-list { display: flex; flex-direction: column; gap: var(--space-3); }
.option-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-4);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}
.option-card:active { transform: scale(0.99); }
.option-card:hover { border-color: var(--border-strong); }
.option-icon {
  width: 44px; height: 44px; flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: var(--primary-soft); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
}
.option-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.option-text strong { font-size: var(--fs-base); font-weight: var(--fw-semibold); }
.option-text span { font-size: var(--fs-sm); color: var(--text-muted); }
.option-card > .bi-chevron-right { color: var(--text-muted); }

/* ===================== CHIPS (fila de acciones desplazable) ===================== */
.chip-row {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 calc(-1 * var(--space-5));
  padding: var(--space-1) var(--space-5);
}
.chip-row::-webkit-scrollbar { display: none; }
/* Con ancho de sobra (escritorio) los chips se reparten en líneas en vez de desplazarse */
@media (min-width: 600px) {
  .chip-row { flex-wrap: wrap; overflow: visible; margin: 0; padding: var(--space-1) 0; }
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-full);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  line-height: 1.25;
  white-space: nowrap;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.chip:active { transform: scale(0.97); }
.chip.chip-primary { background: var(--primary-solid); border-color: transparent; color: var(--on-primary); }
.chip.active { background: var(--text); border-color: var(--text); color: var(--bg); }

/* ===================== LISTA ETIQUETA / VALOR ===================== */
.kv-list { display: flex; flex-direction: column; }
.kv-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm);
}
.kv-row:last-child { border-bottom: none; }
.kv-label { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--text-secondary); flex-shrink: 0; }
.kv-value { text-align: right; min-width: 0; overflow-wrap: anywhere; font-weight: var(--fw-medium); }

/* Cabecera con importe destacado dentro de un sheet */
.amount-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.amount-hero-title { font-size: var(--fs-md); font-weight: var(--fw-bold); min-width: 0; overflow-wrap: anywhere; }
.amount-hero-sub { font-size: var(--fs-sm); color: var(--text-muted); margin-top: 2px; }
.amount-hero-value { font-size: var(--fs-xl); font-weight: var(--fw-extra); letter-spacing: -0.02em; white-space: nowrap; }

/* ===================== MOVIMIENTO Y EFECTOS =====================
   Todo con transform/opacity (no relayout). base.css anula las animaciones
   con «reducir movimiento». */

/* Transición entre pantallas (navegación del mismo sitio); la barra inferior no se mueve */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out 140ms ease-in both; }
::view-transition-new(root) { animation: vt-in 280ms cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.bottom-nav { view-transition-name: bottom-nav; }
::view-transition-old(bottom-nav) { animation: none; opacity: 0; }
::view-transition-new(bottom-nav) { animation: none; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }

/* Entrada escalonada del contenido de cada pantalla */
@keyframes rise-in { from { opacity: 0; transform: translateY(12px); } }
.app-shell > * { animation: rise-in 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; }
.app-shell > *:nth-child(2) { animation-delay: 50ms; }
.app-shell > *:nth-child(3) { animation-delay: 100ms; }
.app-shell > *:nth-child(4) { animation-delay: 150ms; }
.app-shell > *:nth-child(5) { animation-delay: 200ms; }
.app-shell > *:nth-child(6) { animation-delay: 250ms; }
.app-shell > *:nth-child(n+7) { animation-delay: 300ms; }
.day-group { animation: rise-in 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; }
.day-group:nth-child(2) { animation-delay: 60ms; }
.day-group:nth-child(3) { animation-delay: 120ms; }
.day-group:nth-child(n+4) { animation-delay: 180ms; }
.category-row { animation: rise-in 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; animation-delay: calc(var(--i, 0) * 45ms + 120ms); }

/* Gráficos que se dibujan al aparecer */
@keyframes donut-in { from { stroke-dasharray: 0 440; } }
@keyframes grow-x { from { transform: scaleX(0); } }
@keyframes grow-y { from { transform: scaleY(0); } }
.donut svg circle + circle { animation: donut-in 0.9s cubic-bezier(0.3, 0.7, 0.2, 1) backwards; }
.donut svg circle:nth-child(3) { animation-delay: 80ms; }
.donut svg circle:nth-child(4) { animation-delay: 160ms; }
.donut svg circle:nth-child(n+5) { animation-delay: 240ms; }
.progress span { transform-origin: left center; animation: grow-x 0.9s cubic-bezier(0.3, 0.7, 0.2, 1) backwards; animation-delay: calc(var(--i, 0) * 45ms + 220ms); }
.split-bar span { transform-origin: left center; animation: grow-x 0.9s cubic-bezier(0.3, 0.7, 0.2, 1) 250ms backwards; }
.month-bar span { transform-origin: center bottom; animation: grow-y 0.8s cubic-bezier(0.3, 0.7, 0.2, 1) backwards; }
.month-bar:nth-child(2) span { animation-delay: 50ms; }
.month-bar:nth-child(3) span { animation-delay: 100ms; }
.month-bar:nth-child(4) span { animation-delay: 150ms; }
.month-bar:nth-child(5) span { animation-delay: 200ms; }
.month-bar:nth-child(6) span { animation-delay: 250ms; }

/* Profundidad: tarjetas con sombra fina; en escritorio se elevan al pasar el ratón */
.card, .card-list, .settings-list, .field-list { box-shadow: var(--shadow-card); }
.summary-card { transition: transform var(--transition), box-shadow var(--transition); }
@media (hover: hover) {
  .summary-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
  .quick-action:hover .qa-icon { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
}
.quick-action .qa-icon { box-shadow: var(--shadow-card); transition: transform var(--transition-fast), box-shadow var(--transition); }
.entry:active, .settings-row:active, .category-row:active { transform: scale(0.985); }
.entry, .settings-row, .category-row { transition: background var(--transition-fast), transform var(--transition-fast); }

/* Botón principal con brillo sutil */
.nav-fab, .quick-action.main .qa-icon {
  background: linear-gradient(150deg, color-mix(in srgb, var(--primary-solid) 78%, #fff) 0%, var(--primary-solid) 55%, color-mix(in srgb, var(--primary-solid) 85%, #000) 100%);
}
.nav-fab { box-shadow: 0 10px 24px -6px var(--glow), var(--shadow-primary); }

/* Pestaña activa con píldora (estilo Material 3) */
.nav-item i {
  display: flex; align-items: center; justify-content: center;
  width: 56px; height: 30px; border-radius: var(--radius-full);
  transition: background var(--transition), transform var(--transition-fast);
}
.nav-item.active i { background: var(--primary-soft); }
.nav-item:active i { transform: scale(0.9); }
.bottom-nav { background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(18px) saturate(1.4); }

/* Halo suave de Inicio */
body.page-home {
  background:
    radial-gradient(120% 45% at 50% -8%, var(--glow) 0%, transparent 65%) no-repeat,
    var(--bg);
}

/* Hojas: velo con desenfoque, tirador en las compactas */
.sheet-overlay { background: var(--scrim); backdrop-filter: blur(6px); }
.sheet-overlay.compact .sheet::before {
  content: ''; display: block; flex-shrink: 0;
  width: 40px; height: 5px; margin: 8px auto 0;
  border-radius: var(--radius-full); background: var(--border-strong);
}

/* Avisos con efecto cristal */
@keyframes toast-in { from { opacity: 0; transform: translateY(-14px) scale(0.98); } }
.toast {
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid var(--border);
  border-left-width: 4px;
  animation: toast-in 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

/* Login: logo que aparece y pulso en el botón de huella */
@keyframes pop-in { from { opacity: 0; transform: scale(0.85); } }
@keyframes pulse-ring { 0% { transform: scale(1); opacity: 0.45; } 100% { transform: scale(1.35); opacity: 0; } }
.auth-logo { animation: pop-in 0.5s cubic-bezier(0.3, 1.4, 0.6, 1) both; box-shadow: 0 12px 30px -10px var(--glow); }
.bio-button { position: relative; }
.bio-button::after {
  content: ''; position: absolute; inset: -2px; border-radius: inherit;
  border: 2px solid var(--primary); animation: pulse-ring 2.2s ease-out infinite;
}

/* Esqueleto de filas mientras cargan */
.skeleton-row { display: flex; align-items: center; gap: var(--space-3); min-height: 60px; padding: 10px var(--space-4); }
.skeleton-row + .skeleton-row { border-top: 1px solid var(--border); }
.skeleton-row .skeleton { border-radius: 12px; }
