:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;

  --bg: #f4f5f9;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --text: #111215;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;

  --primary: #4361ee;
  --primary-light: #eef0ff;
  --ingreso: #10b981;
  --ingreso-soft: #d1fae5;
  --salida: #ef4444;
  --salida-soft: #fee2e2;
  --transferencia: #8b5cf6;
  --transferencia-soft: #ede9fe;

  --shadow-sm: 0 2px 6px rgba(0,0,0,0.04);
  --shadow: 0 8px 24px rgba(0,0,0,0.08);
  --shadow-lg: 0 16px 40px rgba(0,0,0,0.12);

  --radius: 18px;
  --radius-lg: 28px;
  --radius-xl: 36px;
}

body.dark {
  --bg: #0b0d12;
  --surface: #161922;
  --surface-elevated: #1e2230;
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --primary: #6366f1;
  --primary-light: rgba(99, 102, 241, 0.15);
  --ingreso: #34d399;
  --ingreso-soft: rgba(52, 211, 153, 0.15);
  --salida: #f87171;
  --salida-soft: rgba(248, 113, 113, 0.15);
  --transferencia: #a78bfa;
  --transferencia-soft: rgba(167, 139, 250, 0.15);

  --shadow-sm: 0 2px 6px rgba(0,0,0,0.25);
  --shadow: 0 8px 24px rgba(0,0,0,0.35);
  --shadow-lg: 0 16px 40px rgba(0,0,0,0.45);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  transition: background 0.3s, color 0.3s;
  overflow: hidden;
}

/* ===== AMBIENT BACKGROUND ===== */
.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
  animation: drift 22s ease-in-out infinite;
}

.blob-1 {
  width: 320px;
  height: 320px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  top: -120px;
  left: -80px;
  animation-delay: 0s;
}

.blob-2 {
  width: 280px;
  height: 280px;
  background: linear-gradient(135deg, #ec4899, #f43f5e);
  top: 35%;
  right: -100px;
  animation-delay: -8s;
}

.blob-3 {
  width: 260px;
  height: 260px;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  bottom: -100px;
  left: 25%;
  animation-delay: -16s;
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(40px, -30px) scale(1.08); }
  50% { transform: translate(-20px, 40px) scale(0.95); }
  75% { transform: translate(30px, 20px) scale(1.02); }
}

/* ===== APP SHELL ===== */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  background: transparent;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px 8px;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
  color: var(--text);
  padding: 10px 14px;
  margin: -8px -10px;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: var(--primary-gradient, linear-gradient(135deg, var(--primary), #8b5cf6));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 16px;
  box-shadow: var(--shadow);
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--surface);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}

.btn-icon.small {
  width: 32px;
  height: 32px;
  font-size: 22px;
  font-weight: 300;
}

.btn-icon:active {
  transform: scale(0.92);
}

/* ===== SCREENS ===== */
.screens {
  flex: 1;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 16px 180px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.screen {
  display: none;
  animation: fadeIn 0.25s ease;
}

.screen.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.screen-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 4px 18px;
  gap: 10px;
}

.screen-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.screen-header h2 {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
}

.header-total {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.header-total span:first-child {
  font-size: 14px;
  color: var(--text-muted);
}

.header-amount {
  font-size: 22px;
  font-weight: 800;
  color: var(--salida);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 24px 4px 14px;
}

.section-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.btn-text {
  border: none;
  background: transparent;
  color: var(--primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px;
}

/* ===== HERO BALANCE ===== */
.hero-balance {
  margin: 4px 4px 18px;
  padding: 22px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  color: white;
  box-shadow: 0 14px 34px rgba(67, 97, 238, 0.35);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  position: relative;
  overflow: hidden;
}

.hero-balance::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(255,255,255,0.18), transparent 60%);
}

.balance-label {
  font-size: 13px;
  font-weight: 500;
  opacity: 0.85;
  z-index: 1;
}

.balance-amount {
  font-size: 34px;
  font-weight: 800;
  margin: 4px 0 8px;
  z-index: 1;
  letter-spacing: -0.5px;
}

.grupos-resumen {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 14px;
  z-index: 1;
  width: 100%;
}

.grupo-resumen {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  opacity: 0.9;
}

.grupo-resumen .grupo-nombre {
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.85;
}

.grupo-resumen .grupo-monto {
  font-weight: 700;
}

.balance-pills {
  display: flex;
  gap: 10px;
  z-index: 1;
  width: 100%;
}

.pill {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.16);
  backdrop-filter: blur(8px);
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.pill.ingreso .pill-dot { background: #34d399; }
.pill.salida .pill-dot { background: #f87171; }

.pill-label {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.85;
}

.pill-value {
  font-size: 16px;
  font-weight: 800;
}

/* ===== CAROUSEL CUENTAS ===== */
.cuentas-carousel {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 4px 12px;
  margin-right: -16px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-right: 22px;
}

.cuentas-carousel::after {
  content: '';
  flex: 0 0 16px;
}

.cuenta-mini {
  scroll-snap-align: start;
  flex: 0 0 150px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.5);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

body.dark .cuenta-mini {
  border-color: rgba(255,255,255,0.05);
}

.cuenta-mini-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cuenta-mini-nombre {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.cuenta-mini-icono {
  font-size: 20px;
}

.cuenta-mini-monto {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}

/* ===== LISTA MOVIMIENTOS ===== */
.movimientos-lista {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.movimiento-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255,255,255,0.4);
  transition: transform 0.12s;
}

body.dark .movimiento-row {
  border-color: rgba(255,255,255,0.04);
}

.movimiento-row:active {
  transform: scale(0.98);
}

.movimiento-avatar {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.movimiento-avatar.ingreso { background: var(--ingreso-soft); color: var(--ingreso); }
.movimiento-avatar.salida { background: var(--salida-soft); color: var(--salida); }

.movimiento-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.movimiento-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.movimiento-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.movimiento-amount {
  font-size: 16px;
  font-weight: 800;
  flex-shrink: 0;
}

.movimiento-amount.ingreso { color: var(--ingreso); }
.movimiento-amount.salida { color: var(--salida); }

/* ===== FECHA DIVIDER ===== */
.fecha-divider {
  padding: 18px 4px 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.selector-mes {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0 0 12px;
  padding: 8px 0;
}

.mes-arrow {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--surface);
  color: var(--text);
  font-size: 22px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mes-label {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  min-width: 120px;
  text-align: center;
  text-transform: capitalize;
}

.filtros-movimientos {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  padding: 2px 4px;
}

.chip {
  padding: 8px 16px;
  border-radius: 20px;
  border: none;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

.chip.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(67, 97, 238, 0.25);
}

.chip:active {
  transform: scale(0.95);
}

/* ===== CUENTAS GRID ===== */
.cuentas-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.cuenta-big {
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255,255,255,0.4);
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
}

body.dark .cuenta-big {
  border-color: rgba(255,255,255,0.04);
}

.cuenta-big-total .cuenta-big-monto {
  background: var(--primary-gradient, linear-gradient(135deg, var(--primary), #8b5cf6));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.cuenta-big-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cuenta-big-nombre {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cuenta-big-icono {
  font-size: 24px;
}

.cuenta-big-monto {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}

/* ===== PENDIENTES ===== */
.pendientes-lista {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pendiente-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255,255,255,0.4);
  overflow: hidden;
}

body.dark .pendiente-card {
  border-color: rgba(255,255,255,0.04);
}

.pendiente-card-header {
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--salida-soft);
}

.pendiente-card-header span:first-child {
  font-weight: 800;
  font-size: 14px;
  color: var(--salida);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.pendiente-card-total {
  font-weight: 800;
  font-size: 16px;
  color: var(--salida);
}

.pendiente-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-top: 1px solid var(--bg);
}

.pendiente-item-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pendiente-item-desc {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.pendiente-item-meta {
  font-size: 13px;
  color: var(--text-muted);
}

.pendiente-item-monto {
  font-size: 16px;
  font-weight: 800;
  color: var(--salida);
}

.pendiente-item.paid .pendiente-item-desc,
.pendiente-item.paid .pendiente-item-monto {
  text-decoration: line-through;
  opacity: 0.5;
}

/* ===== FAB ===== */
.fab-main {
  position: fixed;
  bottom: 92px;
  right: 20px;
  left: auto;
  transform: none;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  background: var(--primary-gradient, linear-gradient(135deg, var(--primary), #8b5cf6));
  color: white;
  font-size: 32px;
  font-weight: 300;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(67, 97, 238, 0.4);
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.fab-main.active {
  transform: rotate(45deg);
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4);
}

.fab-main:active {
  transform: scale(0.92);
}

.fab-main.active:active {
  transform: rotate(45deg) scale(0.92);
}

.fab-menu {
  position: fixed;
  bottom: 160px;
  right: 20px;
  left: auto;
  transform: translateY(20px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  opacity: 0;
  pointer-events: none;
  z-index: 79;
  transition: all 0.3s ease;
}

.fab-menu.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.fab-item {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  border: none;
  background: transparent;
  cursor: pointer;
}

.fab-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  font-weight: 600;
  box-shadow: var(--shadow);
  transition: transform 0.15s;
}

.fab-icon:active {
  transform: scale(0.9);
}

.fab-item.ingreso .fab-icon { background: var(--ingreso); }
.fab-item.salida .fab-icon { background: var(--salida); }
.fab-item.transferencia .fab-icon { background: var(--transferencia); }

.fab-caption {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  background: var(--surface);
  padding: 6px 10px;
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 28px);
  max-width: 440px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 10px 8px 14px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255,255,255,0.5);
  z-index: 90;
}

body.dark .bottom-nav {
  border-color: rgba(255,255,255,0.05);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 16px;
  transition: all 0.2s;
  flex: 1;
}

.nav-item.active {
  color: var(--primary);
  background: var(--primary-light);
}

.nav-icon {
  font-size: 22px;
}

.nav-label {
  font-size: 11px;
  font-weight: 700;
}

/* ===== MODALES ===== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: flex-end;
  justify-content: center;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 60px;
  padding-bottom: 60px;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 80px);
  min-height: auto;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 16px 22px 24px;
  animation: slideUp 0.32s ease;
  display: flex;
  flex-direction: column;
}

.modal-card-tall {
  max-height: calc(100vh - 80px);
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 40px;
  padding-bottom: 40px;
}

.modal-card form,
.modal-card > div:not(.modal-header):not(.modal-drag) {
  flex-shrink: 0;
}

.modal-card .btn-giant {
  flex-shrink: 0;
  margin-top: 4px;
  margin-bottom: 4px;
  padding: 14px;
}

.modal-card .btn-delete-transaccion {
  flex-shrink: 0;
  margin-top: 8px;
  padding: 12px;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-drag {
  width: 44px;
  height: 5px;
  border-radius: 3px;
  background: var(--text-muted);
  margin: 0 auto 8px;
  opacity: 0.5;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}

.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--bg);
  color: var(--text);
  font-size: 24px;
  font-weight: 300;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-hint {
  margin: -10px 0 18px;
  font-size: 14px;
  color: var(--text-muted);
}

/* ===== TIPO SWITCH ===== */
.tipo-switch {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 12px;
}

.tipo-btn {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.tipo-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* ===== FORMULARIOS ===== */
.form-group {
  margin-bottom: 10px;
}

.form-group label {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--bg);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary);
  background: var(--surface);
}

.form-row {
  display: flex;
  gap: 10px;
}

.form-group.half {
  flex: 1;
  margin-bottom: 10px;
}

.monto-input {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--bg);
}

.monto-input:focus-within {
  border-color: var(--primary);
  background: var(--surface);
}

.monto-symbol {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
}

.monto-input input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 0;
  font-size: 18px;
  font-weight: 800;
}

.monto-input input:focus {
  background: transparent;
  border: none;
}

.input-with-button {
  display: flex;
  gap: 10px;
}

.input-with-button input,
.input-with-button select {
  flex: 1;
}

.btn-inline {
  width: 48px;
  height: auto;
  border-radius: var(--radius);
  border: none;
  background: var(--primary);
  color: white;
  font-size: 24px;
  font-weight: 300;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.btn-inline:active {
  transform: scale(0.95);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

/* ===== BOTONES GIGANTES ===== */
.btn-giant {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius);
  border: none;
  background: var(--primary-gradient, linear-gradient(135deg, var(--primary), #8b5cf6));
  color: white;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(67, 97, 238, 0.3);
  transition: transform 0.15s;
  margin-top: 8px;
}

.btn-giant:active {
  transform: scale(0.98);
}

.btn-giant.secondary {
  background: var(--surface);
  color: var(--primary);
  border: 2px solid var(--primary);
  box-shadow: none;
}

.btn-delete-transaccion {
  background: var(--surface) !important;
  color: var(--salida) !important;
  border: 2px solid var(--salida) !important;
  box-shadow: none !important;
  margin-top: 12px;
}

.btn-giant.reiniciar {
  background: var(--surface);
  color: var(--salida);
  border: 2px solid var(--salida);
  box-shadow: none;
  margin-top: 12px;
}

/* ===== CONFIG LIST ===== */
.config-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.config-row {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 20px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid rgba(128, 128, 128, 0.12);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.06);
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: transform 0.12s, box-shadow 0.2s;
}

body.dark .config-row {
  background: var(--bg);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.18);
}

.config-row + .config-row {
  margin-top: 4px;
}

.config-row:active {
  transform: scale(0.98);
}

.config-icon {
  font-size: 24px;
  width: 28px;
  text-align: center;
}

.config-text {
  flex: 1;
}

.config-chevron {
  font-size: 22px;
  color: var(--text-muted);
}

.config-toggle {
  width: 50px;
  height: 28px;
  border-radius: 14px;
  background: var(--text-muted);
  position: relative;
  transition: background 0.2s;
}

.config-toggle.active {
  background: var(--primary);
}

.toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: white;
  transition: transform 0.2s;
}

.config-toggle.active .toggle-knob {
  transform: translateX(22px);
}

/* ===== LISTA CUENTAS CONFIG ===== */
.lista-cuentas {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.cuenta-config-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--bg);
}

.cuenta-config-row label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
}

.cuenta-config-row input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--primary);
}

.btn-delete {
  background: var(--salida-soft);
  color: var(--salida);
  border: none;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.btn-icon.small {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: none;
  background: var(--surface);
  color: var(--primary);
  font-size: 20px;
  font-weight: 300;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.btn-icon.small.reiniciar-icon {
  color: var(--salida);
  border: 1px solid var(--salida);
  background: var(--salida-soft);
}

.separador {
  height: 1px;
  background: var(--bg);
  margin: 20px 0;
}

/* ===== GRUPOS CUENTAS CONFIG ===== */
.lista-grupos {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.grupo-config-card {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.grupo-config-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.grupo-config-header span {
  font-weight: 800;
  font-size: 15px;
  text-transform: uppercase;
}

.grupo-config-actions {
  display: flex;
  gap: 6px;
}

.grupo-config-cuentas {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-cuenta {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-secondary);
}

.checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.checkbox-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--bg);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}

.checkbox-pill input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

/* ===== FORM PENDIENTE ===== */
.form-pendiente {
  display: none;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 18px;
}

.form-pendiente.active {
  display: block;
}

.lista-gestion-pendientes {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.gestion-categoria {
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255,255,255,0.4);
}

body.dark .gestion-categoria {
  border-color: rgba(255,255,255,0.04);
}

.gestion-categoria-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: var(--salida-soft);
}

.gestion-categoria-header span {
  font-weight: 800;
  font-size: 14px;
  color: var(--salida);
  text-transform: uppercase;
}

.gestion-categoria-header button {
  background: rgba(255,255,255,0.3);
  border: none;
  color: var(--salida);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.gestion-pendiente-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-top: 1px solid var(--bg);
}

.gestion-pendiente-info {
  flex: 1;
}

.gestion-pendiente-desc {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}

.gestion-pendiente-meta {
  font-size: 13px;
  color: var(--text-muted);
}

.gestion-pendiente-actions {
  display: flex;
  gap: 6px;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: var(--surface-elevated);
  color: var(--text);
  padding: 16px 28px;
  border-radius: var(--radius);
  font-weight: 800;
  font-size: 15px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255,255,255,0.2);
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
}

.toast.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}

.mensaje-vacio {
  text-align: center;
  padding: 30px 20px;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 600;
}

/* ===== APP MODULES ===== */
.app-module {
  display: none;
  flex-direction: column;
  height: 100vh;
}

.app-module.active {
  display: flex;
}

.brand-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255,255,255,0.5);
  padding: 6px;
  min-width: 220px;
  z-index: 1001;
}

body.dark .brand-menu {
  border-color: rgba(255,255,255,0.05);
}

.brand-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}

.brand-menu-item.active {
  background: var(--primary-light);
  color: var(--primary);
}

/* ===== TARJETAS ===== */
.tarjetas-lista {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tarjeta-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255,255,255,0.4);
  cursor: pointer;
  transition: transform 0.12s;
  position: relative;
  overflow: hidden;
}

body.dark .tarjeta-card {
  border-color: rgba(255,255,255,0.04);
}

.tarjeta-card:active {
  transform: scale(0.98);
}

.tarjeta-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 5px;
  height: 100%;
  background: var(--tarjeta-color, var(--primary));
}

.tarjeta-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.tarjeta-card-nombre {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
}

.tarjeta-card-franquicia {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tarjeta-card-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.tarjeta-card-row:last-child {
  margin-bottom: 0;
}

.tarjeta-card-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.tarjeta-card-value {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}

.tarjeta-progress {
  width: 100%;
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  margin-top: 12px;
  overflow: hidden;
}

.tarjeta-progress-bar {
  height: 100%;
  background: var(--tarjeta-color, var(--primary));
  border-radius: 4px;
  transition: width 0.3s;
}

.tarjetas-resumen-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.tarjeta-resumen-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tarjeta-resumen-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 700;
}

.tarjeta-resumen-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

.tarjeta-big-card {
  background: linear-gradient(135deg, #ef4444, #f97316);
  border-radius: var(--radius-xl);
  padding: 22px;
  color: white;
  box-shadow: 0 14px 34px rgba(239, 68, 68, 0.35);
  margin-bottom: 20px;
}

.tarjeta-big-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}

.tarjeta-big-franquicia {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.9;
}

.tarjeta-big-chip {
  font-size: 28px;
}

.tarjeta-big-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 18px;
}

.tarjeta-big-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tarjeta-big-label {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.85;
}

.tarjeta-big-value {
  font-size: 20px;
  font-weight: 800;
}

.tarjeta-dates {
  display: flex;
  gap: 14px;
  margin-top: 12px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0.9;
}

.compras-lista, .pagos-lista, .simulaciones-lista {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.compra-card, .pago-card, .simulacion-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255,255,255,0.4);
  border-left-width: 5px;
  border-left-color: var(--border);
}

body.dark .compra-card,
body.dark .pago-card,
body.dark .simulacion-card {
  border-color: rgba(255,255,255,0.04);
}

.compra-card-header, .pago-card-header, .simulacion-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.compra-card-nombre, .pago-card-tipo, .simulacion-card-nombre {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.compra-card-monto, .pago-card-monto, .simulacion-card-cuota {
  font-size: 15px;
  font-weight: 800;
  color: var(--salida);
}

.compra-card-meta, .pago-card-meta, .simulacion-card-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.compra-card-actions, .simulacion-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.btn-small {
  padding: 8px 12px;
  border-radius: 10px;
  border: none;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.btn-small.danger {
  background: var(--salida-soft);
  color: var(--salida);
}

.sim-resultado {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin: 16px 0;
  box-shadow: var(--shadow-sm);
}

.sim-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 14px;
}

.sim-row:last-child {
  margin-bottom: 0;
}

.sim-value {
  font-weight: 800;
  color: var(--text);
}

@media (max-width: 360px) {
  .tarjeta-resumen-value { font-size: 16px; }
}

/* ===== RESPONSIVE ===== */
@media (min-width: 520px) {
  .app {
    border-left: 1px solid rgba(255,255,255,0.1);
    border-right: 1px solid rgba(255,255,255,0.1);
  }
}

@media (max-width: 360px) {
  .balance-amount { font-size: 32px; }
  .nav-label { display: none; }
  .bottom-nav { padding-bottom: 10px; }
}
