/* ===== SPLASH SCREEN ===== */
#splash {
  position: fixed;
  inset: 0;
  background: var(--primary, #FF6B35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}
#splash-text {
  font-family: 'Lilita One', 'Georgia', serif;
  font-size: clamp(42px, 12vw, 72px);
  font-weight: 400;
  color: #fff;
  letter-spacing: 0.01em;
  animation: splashTextIn 0.45s cubic-bezier(0.22, 0.8, 0.44, 1) both;
}
@keyframes splashTextIn {
  from { transform: scale(0.82); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

/* ===== LIGHT MODE TOKENS (default) ===== */
:root {
  --primary: #FF6B35;
  --primary-dark: #E8502A;
  --primary-light: #FF9A5A;
  --primary-pale: rgba(255,107,53,0.11);
  --primary-glow: rgba(255,107,53,0.28);
  --grad: linear-gradient(135deg, #FF6B35 0%, #FF9A3C 100%);

  --bg:        #F0F0F8;
  --surface-0: #F8F8FC;
  --surface-1: #FFFFFF;
  --surface-2: #F4F4FA;
  --surface-3: #EEEEFC;
  --surface-4: #E6E6F4;

  --glass:        rgba(255,255,255,0.75);
  --glass-hover:  rgba(255,255,255,0.92);
  --glass-border: rgba(0,0,0,0.07);
  --glass-strong: rgba(0,0,0,0.12);

  --text-1: #1A1A2E;
  --text-2: #6B6B8A;
  --text-3: #AAAABF;
  --text-4: #CCCCE0;

  --income:       #00A882;
  --income-pale:  rgba(0,168,130,0.10);
  --income-glow:  rgba(0,168,130,0.20);
  --expense:      #E83258;
  --expense-pale: rgba(232,50,88,0.10);
  --expense-glow: rgba(232,50,88,0.20);

  --success: #00A882;
  --warning: #FF9F0A;
  --danger:  #E83258;

  --border:   rgba(0,0,0,0.07);
  --border-2: rgba(0,0,0,0.12);

  --shadow-s: 0 2px 10px rgba(0,0,0,0.06);
  --shadow-m: 0 6px 24px rgba(0,0,0,0.08);
  --shadow-l: 0 16px 48px rgba(0,0,0,0.12);
  --shadow-p: 0 8px 32px rgba(255,107,53,0.40);
  --glow-p:   0 0 48px rgba(255,107,53,0.15);

  --r-s:    8px;
  --r-m:    14px;
  --r-l:    20px;
  --r-xl:   28px;
  --r-2xl:  36px;
  --r-full: 9999px;

  --nav-h:    76px;
  --header-h: 66px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);

  /* Chart colors (accessible via CSS, read in JS) */
  --chart-grid:   rgba(0,0,0,0.06);
  --chart-label:  rgba(107,107,138,0.85);
  --chart-hole:   #FFFFFF;

  /* Aliases — used in inline styles and legacy references */
  --bg-card:        var(--surface-1);
  --bg-input:       var(--surface-2);
  --text:           var(--text-1);
  --text-secondary: var(--text-2);
}

/* ===== DARK MODE OVERRIDES ===== */
[data-theme="dark"] {
  --bg:        #111118;
  --surface-0: #18181F;
  --surface-1: #1E1E28;
  --surface-2: #252532;
  --surface-3: #2E2E3E;
  --surface-4: #38384A;

  --glass:        rgba(255,255,255,0.05);
  --glass-hover:  rgba(255,255,255,0.09);
  --glass-border: rgba(255,255,255,0.13);
  --glass-strong: rgba(255,255,255,0.18);

  --text-1: #F0F0FA;
  --text-2: #A0A0C0;
  --text-3: #6A6A90;
  --text-4: #44445E;

  --income:       #00D4AA;
  --income-pale:  rgba(0,212,170,0.15);
  --income-glow:  rgba(0,212,170,0.28);
  --expense:      #FF4D6D;
  --expense-pale: rgba(255,77,109,0.15);
  --expense-glow: rgba(255,77,109,0.28);

  --border:   rgba(255,255,255,0.10);
  --border-2: rgba(255,255,255,0.16);

  --shadow-s: 0 2px 12px rgba(0,0,0,0.35);
  --shadow-m: 0 8px 32px rgba(0,0,0,0.45);
  --shadow-l: 0 20px 60px rgba(0,0,0,0.55);
  --shadow-p: 0 8px 36px rgba(255,107,53,0.45);
  --glow-p:   0 0 60px rgba(255,107,53,0.15);

  --chart-grid:  rgba(255,255,255,0.07);
  --chart-label: rgba(160,160,192,0.9);
  --chart-hole:  #1E1E28;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text-1);
  line-height: 1.5;
  overflow: hidden;
  height: 100dvh; height: 100vh;
  transition: background .3s, color .3s;
}
#app { width: 100%; height: 100%; display: flex; flex-direction: column; }
button { cursor: pointer; border: none; background: none; font-family: inherit; -webkit-tap-highlight-color: transparent; outline: none; }
input, select, textarea { font-family: inherit; outline: none; -webkit-tap-highlight-color: transparent; }
a { text-decoration: none; color: inherit; -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }
::-webkit-scrollbar { display: none; }
* { scrollbar-width: none; }

/* ===== ONBOARDING ===== */
/* Siempre en modo claro: se anulan aquí las variables de tema oscuro */
.onboarding {
  position: fixed; inset: 0; z-index: 1000;
  overflow: hidden;
  /* Forzar siempre tema claro, independientemente del data-theme del sistema */
  --bg: #FFFFFF;
  --surface-0: #F8F8FC;
  --surface-1: #FFFFFF;
  --text-1: #1a1a2e;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --border: #ebebf5;
  color-scheme: light;
}

/* ── Pantalla base: animación slide horizontal ── */
.ob-screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  background: #FFFFFF;
  transition: transform 0.42s cubic-bezier(0.4,0,0.2,1);
  transform: translateX(0);
}
.ob-screen-right { transform: translateX(100%); }
.ob-screen.ob-exit  { transform: translateX(-100%); }
.ob-screen.ob-enter { transform: translateX(0); }

/* ─────────────────────────────────────────────
   PASO 1 — Bienvenida emocional
   ───────────────────────────────────────────── */
/* Paso 1: fondo blanco limpio */
.ob-screen-p1 {
  background: #FFFFFF;
}

/* Bloque central con logo + titulares — ocupa el espacio libre y centra */
.ob-p1-hero {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 0 20px 8px;
  text-align: center;
  overflow: hidden;
}

/* Logo con animación de entrada fade+scale — fusionado al fondo blanco */
.ob-logo {
  width: 116px; height: 116px;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  margin-bottom: 18px;
}
@keyframes obLogoIn {
  from { opacity: 0; transform: scale(0.72); }
  to   { opacity: 1; transform: scale(1); }
}
.ob-logo-anim {
  animation: obLogoIn 0.55s cubic-bezier(0.34,1.4,0.64,1) both;
}

/* Headline principal */
.ob-p1-headline {
  font-size: clamp(22px, 6vw, 28px); font-weight: 900;
  color: #1a1a2e; letter-spacing: -0.5px;
  margin: 0 0 8px; line-height: 1.2;
}

/* Subheadline — escala proporcionalmente al headline (ratio 34/60 chars)
   para que ocupe visualmente el mismo ancho en todos los dispositivos */
.ob-p1-sub {
  font-size: clamp(12.5px, 3.4vw, 15.9px); font-weight: 500;
  color: #8a8fa8; margin: 0; line-height: 1.5;
  white-space: nowrap;
}

/* Tarjetas de propuesta de valor */
.ob-features {
  flex: 0 0 auto;
  padding: 0 16px 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.ob-feat {
  background: #fff; border-radius: 16px;
  padding: 14px 16px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: 0 2px 14px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.03);
}
.ob-feat-icon {
  width: 46px; height: 46px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ob-feat-icon svg { display: block; }
.ob-feat-orange { background: #FFF0EB; color: #F26522; }
.ob-feat-blue   { background: #EEF2FF; color: #4F7CFF; }
.ob-feat-green  { background: #EDFAF3; color: #2DB87A; }
.ob-feat-text { min-width: 0; flex: 1; }
.ob-feat strong {
  display: block; font-size: 14px; font-weight: 700; color: #1a1a2e;
  margin-bottom: 2px;
}
.ob-feat span {
  font-size: 12.5px; color: #9ca3af; display: block;
}

/* ─────────────────────────────────────────────
   PASO 2 — Personalización
   ───────────────────────────────────────────── */
.ob-p2-body {
  flex: 1; display: flex; flex-direction: column;
  justify-content: center; padding: 20px 24px 8px; gap: 24px;
}
.ob-p2-headline {
  font-size: clamp(22px, 6vw, 27px); font-weight: 900;
  color: #1a1a2e; letter-spacing: -0.4px;
  margin: 0; line-height: 1.22;
}
.ob-p2-field {
  display: flex; flex-direction: column; gap: 8px;
}
.ob-p2-label {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: #9ca3af;
}

/* Inputs y selects compartidos en pasos 2 */
.ob-conv-input {
  width: 100%; background: #fff;
  border: 2px solid #ebebf5; border-radius: 16px;
  padding: 16px 18px; font-size: 17px; color: #1a1a2e;
  outline: none;
  box-shadow: 0 1px 6px rgba(0,0,0,0.05);
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}
.ob-conv-select {
  width: 100%; background: #fff;
  border: 2px solid #ebebf5; border-radius: 16px;
  padding: 16px 48px 16px 18px; font-size: 17px; color: #1a1a2e;
  outline: none; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%238a8fa8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  box-shadow: 0 1px 6px rgba(0,0,0,0.05);
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}
.ob-conv-input:focus,
.ob-conv-select:focus {
  border-color: #F26522;
  box-shadow: 0 0 0 3px rgba(242,101,34,0.12);
}

/* ─────────────────────────────────────────────
   PASO 3 — Momento editorial
   ───────────────────────────────────────────── */
.ob-p3-body {
  flex: 1; display: flex; flex-direction: column;
  justify-content: center;
  padding: 20px 36px; gap: 26px;
}

/* Headline tipográfico — 3 líneas apiladas */
.ob-p3-headline {
  margin: 0; display: flex; flex-direction: column; gap: 0;
  font-size: clamp(28px, 8.5vw, 38px); font-weight: 900;
  line-height: 1.12; letter-spacing: -0.7px; color: #1a1a2e;
  opacity: 0; animation: obSlideUp 0.45s 0.15s cubic-bezier(0.2,0.9,0.4,1) forwards;
}
.ob-p3-hl-name { color: #F26522; }

/* Separador corto */
.ob-p3-rule {
  width: 36px; height: 3px; border-radius: 3px;
  background: #F26522; opacity: 0;
  animation: obFadeIn 0.4s 0.45s ease-out forwards;
}

/* Lista de outcomes */
.ob-p3-outcomes {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 13px;
  opacity: 0; animation: obSlideUp 0.45s 0.5s cubic-bezier(0.2,0.9,0.4,1) forwards;
}
.ob-p3-outcomes li {
  display: flex; align-items: center; gap: 11px;
  font-size: 14.5px; color: #4b5563; font-weight: 500; line-height: 1.4;
}
.ob-p3-outcomes li::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: #F26522; opacity: 0.55; flex-shrink: 0;
}

@keyframes obSlideUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes obFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ─────────────────────────────────────────────
   ELEMENTOS COMPARTIDOS
   ───────────────────────────────────────────── */

/* Footer con botón principal */
.ob-footer { padding: 0 16px calc(var(--safe-b, 20px) + 12px); }

/* Botón CTA principal */
.ob-cta {
  width: 100%; background: #F26522; color: #fff;
  border: none; border-radius: 16px;
  padding: 17px; font-size: 17px; font-weight: 700;
  cursor: pointer; letter-spacing: -0.2px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 8px 24px rgba(242,101,34,0.35);
  transition: opacity 0.25s, box-shadow 0.25s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.ob-cta:active { transform: scale(0.98); }

/* Estado desactivado (paso 2 hasta escribir nombre) */
.ob-cta-disabled,
.ob-cta:disabled {
  opacity: 0.38;
  box-shadow: none;
  cursor: not-allowed;
  transform: none !important;
}

/* Transición suave al activarse el botón Continuar */
.ob-cta-ready {
  opacity: 1 !important;
  box-shadow: 0 8px 24px rgba(242,101,34,0.35) !important;
}


/* Topbar (todos los pasos) */
.ob-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--safe-t, 44px) + 14px) 20px 0;
  flex-shrink: 0;
}

/* Botón volver atrás */
.ob-back-btn {
  width: 38px; height: 38px;
  background: #fff; border: 1.5px solid #e8e8f2;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: #1a1a2e; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.ob-back-btn:active { background: #f4f4f8; }

/* Indicador de progreso (dots) */
.ob-step-track { display: flex; gap: 5px; align-items: center; }
.ob-step-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #dde0ef;
  transition: all 0.3s;
}
.ob-step-dot.ob-step-act {
  width: 22px; height: 7px; border-radius: 4px;
  background: #F26522;
}

/* Botón "Saltar" (solo en paso 1) */
.ob-skip-btn {
  background: none; border: none; cursor: pointer;
  color: #aaa; font-size: 13px; font-weight: 600;
  padding: 8px 4px; width: 60px; text-align: right;
  -webkit-tap-highlight-color: transparent;
}
.ob-skip-btn:active { color: #F26522; }

/* ── Banner de bienvenida en Inicio (primera visita sin transacciones) ── */
.welcome-banner {
  margin: 0 16px 16px;
  background: linear-gradient(135deg, rgba(242,101,34,0.08), rgba(242,101,34,0.04));
  border: 1px solid rgba(242,101,34,0.2);
  border-radius: 16px; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.welcome-banner-text {
  font-size: 14px; font-weight: 600; color: var(--text-1);
  line-height: 1.45;
}
.welcome-banner-btn {
  background: #F26522; color: #fff;
  border: none; border-radius: 12px;
  padding: 12px; font-size: 14px; font-weight: 700;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}

/* ── Tooltip contextual de primera visita ── */
.section-tip {
  display: flex; align-items: flex-start; gap: 8px;
  background: var(--primary-pale, rgba(255,107,53,0.08));
  border: 1px solid rgba(255,107,53,0.18);
  border-radius: 12px; padding: 10px 12px;
  margin: 8px 16px 0; font-size: 13px; color: var(--text-2);
  line-height: 1.45; transition: opacity 0.4s;
}
.section-tip svg { color: var(--primary); margin-top: 1px; }
.section-tip span { flex: 1; }
.section-tip button {
  background: none; border: none; cursor: pointer;
  color: var(--text-3); padding: 0; flex-shrink: 0;
}
.section-tip-fade { opacity: 0; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 11px; font-weight: 700;
  color: var(--text-3); margin-bottom: 8px;
  text-transform: uppercase; letter-spacing: 1px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 15px 16px;
  border: 1.5px solid var(--glass-border);
  border-radius: var(--r-m);
  font-size: 16px;
  background: var(--surface-2);
  color: var(--text-1);
  transition: border-color .2s, background .2s;
  appearance: none; -webkit-appearance: none;
}
.form-group input:focus,
.form-group select:focus { border-color: var(--primary); background: var(--surface-1); }
.form-group input::placeholder { color: var(--text-3); }
.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239090B0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

/* ===== BUTTONS ===== */
.btn-primary {
  background: var(--grad);
  color: white; font-size: 16px; font-weight: 700;
  padding: 16px 28px; border-radius: var(--r-full);
  box-shadow: var(--shadow-p);
  transition: transform .15s, box-shadow .15s;
  letter-spacing: 0.2px; position: relative; overflow: hidden;
}
.btn-primary:active { transform: scale(.97); box-shadow: 0 4px 16px rgba(255,107,53,.3); }
.btn-primary.full-width { width: 100%; display: block; margin-top: 20px; }

.btn-secondary {
  background: var(--primary-pale); color: var(--primary);
  font-size: 15px; font-weight: 600; padding: 12px 24px;
  border-radius: var(--r-full);
  border: 1px solid rgba(255,107,53,0.2);
  transition: background .15s;
}
.btn-secondary:active { background: rgba(255,107,53,.18); }

.btn-ghost {
  color: var(--text-2); font-size: 15px; font-weight: 500;
  padding: 10px 16px; border-radius: var(--r-m);
  transition: background .15s;
}
.btn-ghost:active { background: var(--surface-2); }

.btn-danger {
  background: var(--expense-pale); color: var(--danger);
  font-size: 15px; font-weight: 700; padding: 14px 24px;
  border-radius: var(--r-full);
  border: 1px solid rgba(232,50,88,0.2);
}

/* ===== HEADER ===== */
.app-header {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 100;
  background: #ffffff;
  box-shadow: 0 1px 16px rgba(0,0,0,0.07);
  height: calc(var(--header-h) + var(--safe-t));
  padding-top: var(--safe-t);
  transition: background .3s, box-shadow .3s;
}
[data-theme="dark"] .app-header {
  background: #0d0d1a;
  box-shadow: 0 1px 16px rgba(0,0,0,0.28);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--header-h); padding: 0 20px;
}
.header-brand {
  display: flex; align-items: center; gap: 10px;
}
.header-logo-img {
  flex-shrink: 0;
  width: 56px; height: 56px;
  object-fit: fill;
  object-view-box: inset(30% 30%);
  margin-left: -8px;
  transition: filter 0.3s;
}
[data-theme="dark"] .header-logo-img {
  filter: invert(1) brightness(1.8) contrast(1.1) saturate(0.4);
}
/* ===== MAIN ===== */
/* ── Pull-to-refresh ── */
#ptr-indicator {
  position: fixed;
  top: calc(var(--header-h) + var(--safe-t) + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-54px);
  width: 38px; height: 38px;
  background: var(--card-bg);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.14);
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  color: var(--primary);
  will-change: transform, opacity;
}
#ptr-indicator.ptr-snap {
  transition: transform 0.28s cubic-bezier(0.25,0.46,0.45,0.94), opacity 0.28s;
}
#ptr-indicator.ptr-spin svg {
  animation: ptrSpin 0.65s linear infinite;
}
@keyframes ptrSpin { to { transform: rotate(360deg); } }

.app-main {
  position: fixed;
  top: calc(var(--header-h) + var(--safe-t));
  bottom: calc(var(--nav-h) + var(--safe-b));
  left: 0; right: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: none;
  background: var(--bg);
  transition: background .3s;
}
.view { min-height: 100%; }
.view-content { padding: 20px 16px 32px; }
.home-greeting {
  font-size: 17px; font-weight: 600; color: var(--text-2);
  letter-spacing: -0.4px; margin-bottom: 18px; line-height: 1.3;
}

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: rgba(255,255,255,0.90);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-around;
  z-index: 100;
  transition: background .3s;
}
[data-theme="dark"] .bottom-nav {
  background: rgba(14,14,28,0.92);
}
.nav-item {
  display: flex; flex-direction: column; align-items: center;
  gap: 5px; flex: 1; padding: 8px 0 4px;
  color: var(--text-3);
  transition: color .2s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.nav-item.active { color: var(--primary); }
.nav-icon { width: 22px; height: 22px; transition: transform .2s; }
.nav-item.active .nav-icon { transform: scale(1.1); }
.nav-label { font-size: 10px; font-weight: 600; letter-spacing: 0.3px; }
.nav-center { position: relative; }
.nav-center::before { display: none; }
.nav-add-bubble {
  width: 46px; height: 46px;
  background: var(--primary);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  transition: transform .15s;
}
.nav-center:active .nav-add-bubble { transform: scale(.91) translateY(2px); }
.nav-center .nav-icon { width: 20px; height: 20px; }

/* ===== CARDS ===== */
.card {
  background: var(--surface-1);
  border-radius: var(--r-xl);
  border: 1px solid var(--glass-border);
  overflow: hidden;
  transition: background .3s;
}
.card-pad { padding: 20px; }

/* ===== BALANCE CARD — Light: orange gradient, Dark: dark glass ===== */
.balance-card {
  background: var(--primary);
  border-radius: var(--r-xl);
  padding: 20px 20px 18px;
  margin-bottom: 18px;
  position: relative; overflow: hidden;
}
.balance-label {
  font-size: 10px; font-weight: 700;
  color: rgba(255,255,255,0.70);
  text-transform: uppercase; letter-spacing: 1.2px; margin-bottom: 5px;
}
.balance-amount-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  position: relative; z-index: 1;
}
.balance-amount {
  font-size: 36px; font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1; color: #FFFFFF;
}
.balance-eye-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.balance-eye-btn:active { background: rgba(255,255,255,0.25); }
.balance-actions {
  display: flex; gap: 8px; position: relative; z-index: 1;
}
.balance-action-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.18); border: 1px solid rgba(255,255,255,0.26);
  border-radius: 14px; padding: 10px 6px;
  cursor: pointer; transition: background .15s, transform .12s;
  backdrop-filter: blur(10px);
}
.balance-action-btn:active { transform: scale(0.95); background: rgba(255,255,255,0.30); }
.balance-action-icon {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,0.20);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.balance-action-label {
  font-size: 10px; font-weight: 700; color: rgba(255,255,255,0.92);
  letter-spacing: 0.1px;
}

/* Dark mode balance card */
[data-theme="dark"] .balance-card {
  background: var(--surface-1);
  border: 1px solid var(--glass-border);
}
[data-theme="dark"] .balance-label { color: var(--text-3); }
[data-theme="dark"] .balance-amount {
  background: linear-gradient(135deg, #FFFFFF 0%, rgba(255,255,255,.65) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
}
[data-theme="dark"] .balance-action-btn {
  background: var(--glass); border-color: var(--glass-border);
}
[data-theme="dark"] .balance-action-btn:active { background: var(--glass-hover); }
[data-theme="dark"] .balance-action-icon {
  background: var(--surface-2); color: var(--primary);
}
[data-theme="dark"] .balance-action-label { color: var(--text-1); }

/* ===== SECTION ===== */
/* ===== STATS GRID ===== */
.stats-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--surface-1); border-radius: 16px;
  border: 1px solid var(--glass-border);
  padding: 14px 14px 12px; display: flex; flex-direction: column; gap: 3px;
  position: relative; cursor: pointer;
  transition: background .15s, transform .15s; -webkit-tap-highlight-color: transparent;
}
.stat-card:active { transform: scale(0.95); background: var(--surface-2); }
.stat-card::after {
  content: '›'; position: absolute; bottom: 10px; right: 11px;
  font-size: 15px; font-weight: 700; color: var(--text-3);
  line-height: 1; pointer-events: none;
}
@keyframes flamePulse {
  0%, 100% { transform: scale(1);    opacity: 1; }
  50%       { transform: scale(1.25); opacity: 0.75; }
}
.flame-active { animation: flamePulse 2s ease-in-out infinite; display: flex; }
.stat-card-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.7px; color: var(--text-3); margin-bottom: 4px;
}
.stat-card-value {
  font-size: 17px; font-weight: 800; letter-spacing: -0.5px; line-height: 1.2;
}
.stat-card-sub {
  font-size: 10px; color: var(--text-3); margin-top: 1px;
}

/* ===== SOBRES ===== */
.sobres-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px;
}
.sobres-title { font-size: 18px; font-weight: 800; color: var(--text-1); letter-spacing: -0.3px; }
.sobre-add-btn {
  font-size: 12px; font-weight: 700; color: var(--primary);
  background: var(--primary-pale); border: none; border-radius: var(--r-full);
  padding: 8px 14px; cursor: pointer; transition: background .15s;
}
.sobre-add-btn:active { background: var(--primary-glow); }
.sobres-summary {
  display: flex; background: var(--surface-1); border-radius: 18px;
  border: 1px solid var(--glass-border); overflow: hidden;
  margin-bottom: 16px; box-shadow: var(--shadow-s);
}
.sobres-summary-item {
  flex: 1; padding: 14px 8px; text-align: center;
  display: flex; flex-direction: column; gap: 4px;
}
.sobres-summary-item + .sobres-summary-item { border-left: 1px solid var(--border); }
.sobres-summary-label { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-3); }
.sobres-summary-value { font-size: 14px; font-weight: 800; letter-spacing: -0.3px; color: var(--text-1); }
.sobres-empty {
  text-align: center; padding: 48px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.sobres-empty-icon { color: var(--text-3); margin-bottom: 4px; }
.sobres-empty-title { font-size: 17px; font-weight: 800; color: var(--text-1); }
.sobres-empty-desc { font-size: clamp(11px, 3.5vw, 13px); color: var(--text-3); white-space: nowrap; }
.sobres-list { display: flex; flex-direction: column; gap: 14px; }

/* ── Envelope card ───────────────────────────────────────── */
.sobre-card {
  border-radius: 18px; border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-s); cursor: pointer;
  transition: transform .18s, box-shadow .18s;
  overflow: hidden; position: relative; padding: 0;
  background: var(--surface-1); -webkit-tap-highlight-color: transparent;
}
.sobre-card:active { transform: scale(0.978); box-shadow: none; }

/* Flap — solid accent color, V-shape at bottom */
.sobre-env-flap {
  position: relative; width: 100%; height: 82px;
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 13px;
  clip-path: polygon(0 0, 100% 0, 100% 58%, 50% 100%, 0 58%);
}

/* Shoulder triangles — darker tint on each side of the V */
.sobre-env-shoulder-l,
.sobre-env-shoulder-r {
  position: absolute; top: 0; width: 50%; height: 100%;
  background: rgba(0,0,0,0.10);
  pointer-events: none;
}
.sobre-env-shoulder-l {
  left: 0;
  clip-path: polygon(0 0, 0% 100%, 100% 100%);
}
.sobre-env-shoulder-r {
  right: 0;
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

/* Icon in the flap */
.sobre-env-icon-wrap {
  width: 42px; height: 42px; border-radius: 13px; flex-shrink: 0;
  background: rgba(255,255,255,0.22); color: #fff;
  display: flex; align-items: center; justify-content: center;
  position: relative; z-index: 1;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Seal — small circle sitting on the V tip */
.sobre-env-seal {
  position: absolute; left: 50%; top: 82px;
  transform: translate(-50%, -50%);
  width: 14px; height: 14px; border-radius: 50%;
  border: 2.5px solid var(--surface-1);
  z-index: 3;
}

/* Body — content below the flap */
.sobre-env-body { padding: 18px 16px 14px; }
.sobre-env-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
  margin-bottom: 10px;
}
.sobre-env-meta { flex: 1; min-width: 0; }
.sobre-name { font-size: 15px; font-weight: 700; color: var(--text-1); }
.sobre-health-label { font-size: 11px; font-weight: 600; margin-top: 4px; letter-spacing: 0.1px; }
.sobre-current {
  font-size: 18px; font-weight: 800; color: var(--text-1); flex-shrink: 0; letter-spacing: -0.5px;
}

/* Keep legacy classes used elsewhere */
.sobre-icon {
  width: 44px; height: 44px; border-radius: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.sobre-health-bar {
  height: 4px; background: var(--surface-3); border-radius: 99px;
  overflow: hidden; margin-top: 12px;
}
.sobre-health-empty {
  background: repeating-linear-gradient(
    90deg,
    var(--glass-border) 0px, var(--glass-border) 3px,
    transparent 3px, transparent 7px
  );
}
.sobre-health-fill {
  height: 100%; border-radius: 99px;
  transition: width .5s cubic-bezier(.4,0,.2,1);
}
/* balance card in sobres view */
.sobre-balance-card {
  background: var(--surface-1); border-radius: 18px; padding: 14px 16px;
  border: 1px solid var(--glass-border); box-shadow: var(--shadow-s); margin-bottom: 12px;
}
.sobre-balance-row { display: flex; align-items: center; }
.sobre-balance-item { flex: 1; text-align: center; padding: 4px 0; }
.sobre-balance-divider { width: 1px; height: 36px; background: var(--border); flex-shrink: 0; margin: 0 8px; }
.sobre-balance-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-3); margin-bottom: 3px; }
.sobre-balance-value { font-size: 16px; font-weight: 800; letter-spacing: -0.4px; }
/* sobre detail modal */
.sobre-detail-amount { font-size: 28px; font-weight: 900; letter-spacing: -1px; color: var(--text-1); }
.sobre-detail-label { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.4px; margin-top: 2px; }
/* history */
.sobre-hist-section { margin-top: 4px; }
.sobre-hist-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-3); margin-bottom: 8px; }
.sobre-hist-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.sobre-hist-row:last-child { border-bottom: none; }
.sobre-hist-icon {
  width: 24px; height: 24px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.sobre-hist-icon.add { background: var(--income-pale); color: var(--income); }
.sobre-hist-icon.withdraw { background: var(--expense-pale); color: var(--expense); }
.sobre-hist-info { flex: 1; min-width: 0; }
.sobre-hist-label { font-size: 12px; font-weight: 600; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sobre-hist-date { font-size: 10px; color: var(--text-3); margin-top: 1px; font-weight: 500; }
.sobre-hist-amount { font-size: 13px; font-weight: 700; flex-shrink: 0; }
/* balance sub-label in home card *//* sobre detail action grid */
.sobre-action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.sobre-action-card {
  display: flex; align-items: center; gap: 11px;
  border-radius: 16px; padding: 13px 11px;
  border: 1.5px solid var(--glass-border); cursor: pointer;
  text-align: left; transition: transform .13s, background .13s;
  background: var(--surface-2);
}
.sobre-action-card:active { transform: scale(0.96); }
.sobre-action-add:hover   { background: var(--income-pale); border-color: var(--income); }
.sobre-action-withdraw:hover { background: var(--expense-pale); border-color: var(--expense); }
.sobre-action-icon-wrap {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.sobre-action-icon-wrap.add      { background: var(--income-pale); color: var(--income); }
.sobre-action-icon-wrap.withdraw { background: var(--expense-pale); color: var(--expense); }
.sobre-action-text { min-width: 0; }
.sobre-action-title { font-size: 13px; font-weight: 700; color: var(--text-1); line-height: 1.2; }
.sobre-action-desc  { font-size: 10px; font-weight: 500; color: var(--text-3); margin-top: 3px; line-height: 1.3; }
/* sobre detail footer */
.sobre-detail-footer { display: flex; gap: 8px; margin-bottom: 16px; }
.sobre-footer-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px;
  padding: 9px 10px; border-radius: 12px; font-size: 12px; font-weight: 600;
  cursor: pointer; border: 1.5px solid var(--glass-border);
  background: var(--surface-2); color: var(--text-2);
  transition: background .13s, color .13s, border-color .13s;
}
.sobre-footer-btn:hover { background: var(--surface-3); color: var(--text-1); }
.sobre-footer-btn.danger { color: var(--expense); }
.sobre-footer-btn.danger:hover { background: var(--expense-pale); border-color: var(--expense); }
/* ===== CALENDAR ===== */
.cal-wrapper {
  background: var(--surface-1); border-radius: 20px;
  padding: 14px 12px 10px; box-shadow: var(--shadow-m);
  border: 1px solid var(--glass-border);
}
.cal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; padding: 0 2px;
}
.cal-month-wrap { text-align: center; }
.cal-month-name {
  display: block; font-size: 15px; font-weight: 800;
  color: var(--text-1); text-transform: capitalize; letter-spacing: -0.3px; line-height: 1.15;
}
.cal-month-year {
  display: block; font-size: 11px; font-weight: 600;
  color: var(--text-3); letter-spacing: 0.2px; margin-top: 1px;
}
.cal-nav {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--surface-2); border: 1px solid var(--glass-border);
  color: var(--text-2); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s, transform .1s;
}
.cal-nav:hover { background: var(--primary-pale); color: var(--primary); }
.cal-nav:active { transform: scale(0.9); }
.cal-dow-row {
  display: grid; grid-template-columns: repeat(7, 1fr);
  margin-bottom: 2px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.cal-dow {
  text-align: center; font-size: 9px; font-weight: 700;
  color: var(--text-3); text-transform: uppercase; letter-spacing: 0.4px;
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; padding-top: 4px; }

/* Base cell */
.cal-cell {
  height: 46px; border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; transition: background .15s, transform .12s;
  gap: 4px; padding: 4px 2px; -webkit-tap-highlight-color: transparent;
}
.cal-cell:not(.cal-empty):hover { background: var(--surface-2); }
.cal-cell:not(.cal-empty):active { transform: scale(0.88); }
.cal-empty { cursor: default; pointer-events: none; }

/* Past days with transactions — color reflects net balance */
.cal-day-pos { background: var(--income-pale); }
.cal-day-neg { background: var(--expense-pale); }
.cal-day-pos:hover { background: rgba(0,168,130,0.18) !important; }
.cal-day-neg:hover { background: rgba(255,59,48,0.12) !important; }
/* Future days — muted, non-interactive */
.cal-future { cursor: default; pointer-events: none; }
.cal-future .cal-day-num { opacity: 0.3; }
.cal-future .cal-pips { opacity: 0.3; }

/* Today — no cell background, only the number carries the indicator */
.cal-today { }
.cal-today:hover { background: var(--surface-2); }

/* Day number */
.cal-day-num {
  font-size: 12px; font-weight: 500; color: var(--text-3); line-height: 1;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  transition: color .15s, background .15s;
}
/* Active days — bolder number */
.cal-has-tx .cal-day-num {
  font-weight: 700; color: var(--text-1);
}
/* Today — soft primary bg + primary text, rounded square */
.cal-today .cal-day-num {
  background: var(--primary-pale);
  color: var(--primary) !important;
  font-weight: 800; font-size: 13px;
  border-radius: 7px;
}

/* Activity pips */
.cal-pips {
  display: flex; gap: 3px; align-items: center;
  height: 6px;
}
.cal-pip {
  width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
}
.cal-pip.inc {
  background: var(--income);
  box-shadow: 0 0 5px var(--income-glow);
}
.cal-pip.exp {
  background: var(--expense);
  box-shadow: 0 0 5px var(--expense-glow);
}
/* Pips on today cell get a white ring to pop against the pale bg */
.cal-today .cal-pip.inc { box-shadow: 0 0 5px var(--income-glow), 0 0 0 1.5px var(--surface-1); }
.cal-today .cal-pip.exp { box-shadow: 0 0 5px var(--expense-glow), 0 0 0 1.5px var(--surface-1); }

/* ===== MONTHLY HISTORY ===== */
.hist-content-card {
  background: var(--bg-card);
  border-radius: 22px;
  border: 1px solid var(--border);
  padding: 18px 16px 6px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.07);
  margin-top: 20px;
}
[data-theme="dark"] .hist-content-card {
  box-shadow: 0 4px 24px rgba(0,0,0,0.25);
}
.hist-section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin: 0 0 14px; padding: 0 2px;
}
.hist-month-pill {
  font-size: 11px; font-weight: 700; color: var(--text-3);
  background: var(--surface-2); border-radius: 20px;
  padding: 4px 10px; text-transform: capitalize; letter-spacing: 0.2px;
  border: 1px solid var(--border);
}

/* Summary strip */
.hist-summary-strip {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  background: var(--surface-2); border-radius: 14px;
  border: 1px solid var(--border);
  padding: 0; margin-bottom: 14px;
  overflow: hidden;
}
.hist-summary-col {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 13px 8px; gap: 3px;
}
.hist-summary-col + .hist-summary-col { border-left: 1px solid var(--border); }
.hist-summary-col-label {
  font-size: 10px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.hist-summary-col-value {
  font-size: 14px; font-weight: 800; letter-spacing: -0.4px;
}
.hist-summary-col-value.income { color: var(--income); }
.hist-summary-col-value.expense { color: var(--expense); }

/* Filter tabs */
.hist-filter-tabs {
  display: flex; gap: 6px; margin-bottom: 18px;
}
.hist-filter-tab {
  flex: 1; padding: 8px 6px; border-radius: 22px;
  border: 1.5px solid var(--border); background: transparent; color: var(--text-2);
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all .2s cubic-bezier(.34,1.56,.64,1);
  font-family: inherit;
}
.hist-filter-tab.active {
  background: var(--primary); color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px var(--primary-glow);
  transform: scale(1.04);
}

/* Day groups */
.hist-day-group {
  margin-bottom: 16px;
  opacity: 0;
  animation: histGroupIn .3s ease forwards;
}
.hist-day-label-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 7px; padding: 0 4px;
}
.hist-day-label-left { display: flex; align-items: center; gap: 7px; }
.hist-day-label {
  font-size: 11px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.hist-day-label.today { color: var(--primary); }
.hist-day-count {
  font-size: 10px; font-weight: 700; color: var(--text-3);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 20px; padding: 1px 7px; letter-spacing: 0;
}
.hist-day-net { font-size: 13px; font-weight: 800; letter-spacing: -0.3px; }
.hist-day-card {
  background: var(--bg-card); border-radius: 18px;
  border: 1px solid var(--border); overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* Transaction rows */
.hist-tx-row {
  display: flex; align-items: center; gap: 13px;
  padding: 13px 16px; cursor: pointer;
  transition: background .15s;
  opacity: 0;
  animation: histRowIn .25s ease forwards;
  position: relative; -webkit-tap-highlight-color: transparent;
}
.hist-tx-row::before {
  content: ''; position: absolute;
  left: 0; top: 0; bottom: 0; width: 3px;
}
.hist-tx-row.tx-income::before { background: var(--income); }
.hist-tx-row.tx-expense::before { background: var(--expense); }
.hist-tx-row + .hist-tx-row { border-top: 1px solid var(--border); }
.hist-tx-row:active { background: var(--surface-2); }
.hist-tx-icon {
  position: relative;
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.hist-tx-icon.income { background: var(--income-pale); color: var(--income); }
.hist-tx-icon.expense { background: var(--expense-pale); color: var(--expense); }
.hist-tx-icon.conscious::after {
  content: '';
  position: absolute; top: -3px; right: -3px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--income);
  border: 2px solid var(--bg-card);
  box-shadow: 0 0 6px var(--income-glow);
}
.hist-tx-body { flex: 1; min-width: 0; }
.hist-tx-cat {
  font-size: 13px; font-weight: 700; color: var(--text-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hist-tx-desc {
  font-size: 12px; color: var(--text-2); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-weight: 500;
}
.hist-tx-right {
  display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex-shrink: 0;
}
.hist-tx-amount {
  font-size: 15px; font-weight: 800; letter-spacing: -0.5px;
}
.hist-tx-amount.income { color: var(--income); }
.hist-tx-amount.expense { color: var(--expense); }
.hist-tx-time {
  font-size: 10px; color: var(--text-3); font-weight: 500;
}
.hist-tx-row-meta {
  display: flex; align-items: center; gap: 4px; justify-content: flex-end;
}
.tx-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
}
.tx-badge-pending   { color: var(--primary); }
.tx-badge-recurring { color: var(--text-3); }
.hist-tx-row.tx-pending .hist-tx-amount { opacity: 0.55; }
.hist-day-label-row { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.hist-day-label-row:active .hist-day-label,
.hist-day-label-row:active .hist-day-net { opacity: 0.6; }

/* Filter empty + empty states */
.hist-filter-empty {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 28px 16px; color: var(--text-3);
  font-size: 13px; font-weight: 600;
  background: var(--bg-card); border-radius: 16px; border: 1px solid var(--border);
}
.hist-empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 36px 20px 16px; color: var(--text-3); text-align: center;
  gap: 10px;
}
.hist-empty-title { font-size: 15px; font-weight: 700; color: var(--text-2); }
.hist-empty-desc { font-size: 13px; color: var(--text-3); }

@keyframes histGroupIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes histRowIn {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Day detail modal — stats strip */
.cal-day-stats {
  display: flex;
  background: var(--surface-2);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  margin-bottom: 16px;
}
.cal-day-stat-item {
  flex: 1; padding: 14px 6px; text-align: center;
  display: flex; flex-direction: column; justify-content: center; gap: 5px;
}
.cal-day-stat-item + .cal-day-stat-item {
  border-left: 1px solid var(--border);
}
.cal-day-stat-label {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-3); line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-day-stat-value {
  font-size: 14px; font-weight: 800; letter-spacing: -0.4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1;
}
/* Transaction list */
.cal-tx-list { display: flex; flex-direction: column; gap: 8px; }
.cal-tx-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-1); border-radius: 14px; padding: 12px;
  border: 1px solid var(--glass-border); box-shadow: var(--shadow-s);
}
.cal-tx-icon { width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.cal-tx-body { flex: 1; min-width: 0; }
.cal-tx-cat { font-size: 13px; font-weight: 700; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-tx-desc { font-size: 11px; color: var(--text-2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-tx-time { font-size: 10px; color: var(--text-3); margin-top: 3px; }
.cal-tx-edited { font-size: 10px; color: var(--primary); margin-top: 1px; }
.cal-tx-right {
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0;
  min-width: 80px;
}
.cal-tx-amount { font-size: 15px; font-weight: 800; letter-spacing: -0.3px; text-align: right; }
.cal-tx-actions { display: flex; gap: 5px; }
.btn-sm-icon {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--surface-2); border: 1px solid var(--glass-border);
  color: var(--text-2); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.btn-sm-icon:hover { background: var(--surface-3); }
.btn-sm-icon.btn-sm-danger { color: var(--expense); }
.btn-sm-icon.btn-sm-danger:hover { background: var(--expense-pale); }

.section { margin-bottom: 24px; }
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; padding: 0 2px;
}
.section-title { font-size: 16px; font-weight: 800; color: var(--text-1); letter-spacing: -0.3px; }
/* ===== TRANSACTIONS ===== */
.transaction-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: var(--surface-1);
  border-radius: var(--r-l);
  border: 1px solid var(--glass-border);
  margin-bottom: 8px;
  box-shadow: var(--shadow-s);
  transition: transform .15s, background .15s;
  -webkit-tap-highlight-color: transparent;
}
.transaction-item:active { transform: scale(.99); background: var(--surface-2); }
.tx-icon {
  width: 46px; height: 46px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 21px; flex-shrink: 0;
}
.tx-icon.income { background: var(--income-pale); }
.tx-icon.expense { background: var(--expense-pale); }
.tx-info { flex: 1; min-width: 0; }
.tx-desc { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-meta { font-size: 12px; color: var(--text-2); margin-top: 3px; font-weight: 500; }
.tx-amount { font-size: 16px; font-weight: 800; flex-shrink: 0; letter-spacing: -0.4px; }
.tx-amount.income { color: var(--income); }
.tx-amount.expense { color: var(--expense); }
.tx-tag {
  display: inline-flex; align-items: center;
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: var(--r-full); margin-top: 4px;
}
.tx-tag.conscious { background: var(--income-pale); color: var(--income); }
.tx-tag.impulsive { background: var(--expense-pale); color: var(--expense); }

/* ===== GOALS ===== */.goal-card {
  flex-shrink: 0; width: 172px;
  background: var(--surface-1); border-radius: var(--r-xl);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-s);
  padding: 18px; cursor: pointer;
  transition: transform .15s; -webkit-tap-highlight-color: transparent;
}
.goal-card:active { transform: scale(.97); }
.goal-icon-wrap {
  width: 46px; height: 46px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; margin-bottom: 12px;
}
.goal-name { font-size: 14px; font-weight: 800; margin-bottom: 4px; }
.goal-amounts { font-size: 12px; color: var(--text-2); margin-bottom: 12px; font-weight: 500; }
.goal-amounts span { font-weight: 700; color: var(--text-1); }
.goal-progress-bar {
  height: 4px; background: var(--surface-3); border-radius: var(--r-full); overflow: hidden;
}
.goal-progress-fill {
  height: 100%; border-radius: var(--r-full);
  transition: width .6s cubic-bezier(.34,1.4,.64,1);
}
.goal-pct { font-size: 11px; font-weight: 700; margin-top: 7px; color: var(--text-2); }

.goal-card-full {
  background: var(--surface-1); border-radius: var(--r-xl);
  border: 1px solid var(--glass-border); box-shadow: var(--shadow-s);
  padding: 20px; margin-bottom: 12px; cursor: pointer;
  transition: transform .15s; -webkit-tap-highlight-color: transparent;
}
.goal-card-full:active { transform: scale(.99); }
.goal-header { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.goal-meta-row { display: flex; justify-content: space-between; align-items: center; }
.goal-deadline { font-size: 12px; color: var(--text-2); font-weight: 500; }
.goal-pct-full { font-size: 14px; font-weight: 800; }

/* ===== ADD TRANSACTION ===== */
.add-view { background: var(--bg); min-height: 100%; }
.type-toggle {
  display: flex; background: var(--surface-2);
  border-radius: 16px; padding: 5px;
  margin-bottom: 24px; border: 1px solid var(--glass-border); gap: 4px;
}
.type-btn {
  flex: 1; padding: 11px; border-radius: 12px;
  font-size: 14px; font-weight: 700; transition: all .2s; color: var(--text-2);
}
.type-btn.active.income { background: var(--income); color: #fff; box-shadow: 0 4px 16px var(--income-glow); }
.type-btn.active.expense { background: var(--expense); color: #fff; box-shadow: 0 4px 16px var(--expense-glow); }

.amount-display { text-align: center; padding: 20px 0 16px; }
.amount-currency { font-size: 26px; font-weight: 800; color: var(--text-1); }
.amount-value {
  font-size: 60px; font-weight: 800; letter-spacing: -3px;
  color: var(--text-1); display: inline-block; min-width: 2ch; transition: color .2s;
}
.amount-value.income { color: var(--income); }
.amount-value.expense { color: var(--expense); }

.numpad {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; margin: 16px 0;
}
.numpad-btn {
  height: 66px; background: var(--surface-1);
  border-radius: var(--r-l); border: 1px solid var(--glass-border);
  font-size: 22px; font-weight: 700; color: var(--text-1);
  box-shadow: var(--shadow-s);
  transition: background .1s, transform .08s;
  -webkit-tap-highlight-color: transparent;
}
.numpad-btn:active { background: var(--surface-3); transform: scale(.94); box-shadow: none; }
.numpad-btn.del { color: var(--text-2); }

.category-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 8px; margin: 8px 0;
}
.cat-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 6px 10px; border-radius: var(--r-m);
  background: var(--surface-1); border: 1.5px solid transparent;
  font-size: 11px; font-weight: 700; color: var(--text-2);
  transition: all .15s; -webkit-tap-highlight-color: transparent;
  box-shadow: var(--shadow-s);
}
.cat-icon-wrap { display: flex; align-items: center; justify-content: center; }
.category-grid--scroll {
  grid-template-columns: unset;
  grid-auto-flow: column;
  grid-auto-columns: calc((100vw - 56px) / 4);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.category-grid--scroll::-webkit-scrollbar { display: none; }
.cat-btn.selected {
  border-color: var(--primary); color: var(--primary);
  background: var(--primary-pale);
}
.cat-btn--new-cat {
  border: 1.5px dashed var(--primary) !important;
  color: var(--primary) !important;
  background: transparent !important;
  font-size: 12px; font-weight: 600;
  flex-direction: row; gap: 0;
}

.conscious-check {
  display: flex; align-items: flex-start; gap: 14px;
  background: var(--surface-1); border-radius: var(--r-m);
  border: 1.5px solid var(--glass-border);
  padding: 14px 16px; margin: 12px 0; cursor: pointer;
  transition: border-color .15s, background .15s; -webkit-tap-highlight-color: transparent;
}
.conscious-check.checked { border-color: var(--income); background: var(--income-pale); }
.conscious-check input { width: 20px; height: 20px; accent-color: var(--income); flex-shrink: 0; margin-top: 2px; }
.conscious-label strong { font-size: 14px; font-weight: 700; display: block; margin-bottom: 2px; }
.conscious-label span { font-size: 12px; color: var(--text-2); }

/* ===== PENDING TOGGLE ===== */
.pending-toggle {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-1); border-radius: var(--r-m);
  border: 1.5px solid var(--glass-border);
  padding: 13px 16px; margin: 12px 0; cursor: pointer;
  transition: border-color .2s, background .2s;
  user-select: none; -webkit-tap-highlight-color: transparent;
}
.pending-toggle.active { border-color: var(--primary); background: var(--primary-pale); }
.pending-toggle-icon {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  background: var(--surface-2); color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, color .2s;
}
.pending-toggle.active .pending-toggle-icon { background: var(--primary-pale); color: var(--primary); }
.pending-toggle-text { flex: 1; min-width: 0; }
.pending-toggle-text strong { font-size: 13px; font-weight: 700; color: var(--text-1); display: block; margin-bottom: 2px; }
.pending-toggle-text span { font-size: 11px; color: var(--text-3); }
.toggle-switch {
  width: 42px; height: 26px; border-radius: 13px;
  background: var(--surface-3); position: relative;
  transition: background .22s; flex-shrink: 0;
  border: 1.5px solid var(--border);
}
.toggle-switch.on { background: var(--primary); border-color: var(--primary); }
.toggle-switch .toggle-knob {
  position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform .22s cubic-bezier(.34,1.56,.64,1);
  box-shadow: 0 1px 4px rgba(0,0,0,0.22);
}
.toggle-switch.on .toggle-knob { transform: translateX(16px); }

/* Pending stat card */

/* Pending list modal */
.pending-list { display: flex; flex-direction: column; gap: 10px; }
.pending-list-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-1); border-radius: 14px;
  border: 1px solid var(--border); padding: 12px 14px;
}
.pending-list-icon {
  width: 38px; height: 38px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.pending-list-icon.income { background: var(--income-pale); color: var(--income); }
.pending-list-body { flex: 1; min-width: 0; }
.pending-list-cat { font-size: 13px; font-weight: 700; color: var(--text-1); }
.pending-list-desc { font-size: 11px; color: var(--text-3); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pending-list-date { font-size: 10px; color: var(--text-3); margin-top: 2px; }
.pending-list-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.pending-list-amount { font-size: 14px; font-weight: 800; color: var(--income); letter-spacing: -0.3px; }
.pending-receive-btn {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700; color: var(--primary);
  background: var(--primary-pale); border: 1px solid var(--primary);
  border-radius: 20px; padding: 5px 10px; cursor: pointer;
  font-family: inherit; transition: all .15s; white-space: nowrap;
}
.pending-receive-btn:active { transform: scale(0.96); opacity: 0.8; }

/* ===== ANALYSIS ===== */
.score-ring-wrap {
  display: flex; flex-direction: column; align-items: center;
  padding: 24px 0 16px;
}
.score-ring { position: relative; width: 148px; height: 148px; margin-bottom: 14px; }
.score-ring svg { transform: rotate(-90deg); }
.score-ring-bg { fill: none; stroke: var(--surface-3); stroke-width: 10; }
.score-ring-fill {
  fill: none; stroke-width: 10; stroke-linecap: round;
  transition: stroke-dashoffset .9s cubic-bezier(.34,1.2,.64,1);
}
.score-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.score-number { font-size: 36px; font-weight: 900; letter-spacing: -1.5px; }
.score-max { font-size: 12px; color: var(--text-3); font-weight: 600; }
.score-label { font-size: 16px; font-weight: 800; }
.score-desc { font-size: clamp(10px, 3vw, 12px); color: var(--text-2); text-align: center; white-space: nowrap; line-height: 1.5; }

canvas { display: block; }

/* ===== DONUT TOGGLE ===== */
.donut-toggle {
  display: flex;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
  flex-shrink: 0;
}
.donut-toggle-btn {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  white-space: nowrap;
}
.donut-toggle-btn.active {
  background: var(--surface-1);
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.insight-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; background: var(--surface-1);
  border-radius: var(--r-l); border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-s); margin-bottom: 10px;
}
.insight-icon { flex-shrink: 0; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; background: var(--primary-pale); border-radius: 10px; }
.insight-text { min-width: 0; flex: 1; }
.insight-text strong { font-size: 13px; font-weight: 800; display: block; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.insight-text p { font-size: 12px; color: var(--text-2); line-height: 1.5; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== SETTINGS ===== */
.settings-group {
  background: var(--surface-1); border-radius: var(--r-xl);
  overflow: hidden; margin-bottom: 16px;
  border: 1px solid var(--glass-border); box-shadow: var(--shadow-s);
}

/* Plan status badges in settings */
.ajustes-plan-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.4px;
  border-radius: 6px;
  padding: 3px 9px;
  white-space: nowrap;
}
.ajustes-plan-badge--pro {
  background: rgba(212,160,23,0.15);
  color: #D4A017;
  border: 1px solid rgba(212,160,23,0.3);
}.ajustes-plan-badge--free {
  background: rgba(142,142,147,0.12);
  color: var(--text-2);
  border: 1px solid rgba(142,142,147,0.2);
}.settings-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-top: 1px solid var(--border);
  cursor: pointer; transition: background .15s; -webkit-tap-highlight-color: transparent;
  color: var(--text-1); background: none; width: 100%; text-align: left;
}
.settings-item:first-of-type { border-top: none; }
.settings-item:active { background: var(--surface-2); }
.settings-item-left { display: flex; align-items: center; gap: 14px; }
.settings-item-icon {
  width: 38px; height: 38px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.settings-item-text { display: flex; flex-direction: column; gap: 1px; }
.settings-item-text strong { font-size: 15px; font-weight: 700; line-height: 1.2; }
.settings-item-text span { font-size: 12px; color: var(--text-2); font-weight: 500; line-height: 1.3; }
.settings-item-right { color: var(--text-3); }
.flag-icon {
  display: inline-flex; overflow: hidden; flex-shrink: 0;
}
.flag-icon svg { display: block; }

/* ===== TOGGLE SWITCH ===== */
.toggle {
  width: 50px; height: 28px;
  background: var(--surface-4); border-radius: var(--r-full);
  position: relative; flex-shrink: 0;
  transition: background .25s;
  border: 1px solid var(--glass-border);
}
.toggle.on { background: var(--primary); border-color: var(--primary); }
.toggle .toggle-knob {
  position: absolute;
  width: 22px; height: 22px;
  background: white;
  border-radius: 50%;
  top: 2px; left: 2px;
  transition: transform .25s cubic-bezier(.34,1.4,.64,1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
.toggle.on .toggle-knob { transform: translateX(22px); }

/* ===== THEME SEGMENTED CONTROL ===== */
.theme-seg {
  display: flex;
  gap: 4px;
  background: var(--surface-3);
  border-radius: 10px;
  padding: 3px;
  flex-shrink: 0;
}
.theme-seg-btn {
  flex: 1;
  border: none;
  background: transparent;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: background .18s, color .18s, box-shadow .18s;
  white-space: nowrap;
}
.theme-seg-btn.active {
  background: var(--surface-0);
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}

/* ===== MODAL ===== */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: opacity .35s cubic-bezier(.32,1,.23,1);
}
.modal-container {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 201;
  background: var(--surface-1);
  border-radius: 32px 32px 0 0;
  border-top: 1px solid var(--glass-border);
  padding: 0 0 calc(24px + var(--safe-b));
  max-height: 88vh; overflow-y: auto;
  box-shadow: 0 -12px 48px rgba(0,0,0,0.14);
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(.32,1,.23,1);
}
.modal-container.open { transform: translateY(0); }
.modal-handle {
  width: 100%; height: 32px;
  display: flex; align-items: center; justify-content: center;
  margin: 0; cursor: grab;
}
.modal-handle::before {
  content: ''; display: block;
  width: 44px; height: 5px;
  background: var(--text-4); border-radius: var(--r-full);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 17px; font-weight: 800; }
.modal-close-btn {
  width: 32px; height: 32px; background: var(--surface-2);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: var(--text-2); font-size: 14px; font-weight: 700;
  border: 1px solid var(--border);
}
.modal-body { padding: 20px; }

/* ===== TOAST ===== */
#toast-container {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-b) + 16px);
  left: 50%; transform: translateX(-50%);
  z-index: 500;
  display: flex; flex-direction: column-reverse; align-items: center; gap: 10px;
  pointer-events: none; width: calc(100% - 40px); max-width: 340px;
}
.toast {
  position: relative; overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.06);
  padding: 12px 16px 15px 12px;
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  animation: toastIn .52s cubic-bezier(.34,1.56,.64,1) forwards;
}
.toast-icon {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: rgba(0,212,170,0.15); color: var(--income);
  animation: toastIconPop .4s cubic-bezier(.34,1.8,.64,1) .1s both;
}
.toast.error   .toast-icon { background: rgba(232,50,88,0.15); color: var(--expense); }
.toast.warning .toast-icon { background: rgba(255,149,0,0.15);  color: #FF9500; }
.toast.default .toast-icon { background: var(--primary-pale);   color: var(--primary); }
.toast-content { flex: 1; min-width: 0; }
.toast-msg {
  font-size: 14px; font-weight: 700; color: var(--text-1);
  line-height: 1.3; display: block;
  animation: toastTextSlide .38s ease .08s both;
}
.toast-bar {
  position: absolute; bottom: 0; left: 0;
  height: 3px; border-radius: 0 0 20px 20px;
  background: var(--income); opacity: 0.4;
  animation: toastProgress var(--toast-dur, 2800ms) linear .1s forwards;
}
.toast.error   .toast-bar { background: var(--expense); }
.toast.warning .toast-bar { background: #FF9500; }
.toast.default .toast-bar { background: var(--primary); }
.toast-check-path {
  stroke-dasharray: 20; stroke-dashoffset: 20;
  animation: toastCheckDraw .42s ease .28s forwards;
}
@keyframes toastIn {
  0%   { opacity: 0; transform: translateY(56px) scale(0.76); filter: blur(8px); }
  60%  { opacity: 1; filter: blur(0); transform: translateY(-8px) scale(1.03); }
  80%  { transform: translateY(3px) scale(0.988); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  0%   { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
  100% { opacity: 0; transform: translateY(28px) scale(0.86); filter: blur(4px); }
}
@keyframes toastProgress {
  from { width: 100%; }
  to   { width: 0%; }
}
@keyframes toastIconPop {
  from { transform: scale(0.4); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
@keyframes toastTextSlide {
  from { opacity: 0; transform: translateX(10px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastCheckDraw {
  to { stroke-dashoffset: 0; }
}

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 52px 24px; color: var(--text-2); }
.empty-state-icon { font-size: 54px; margin-bottom: 16px; display: flex; align-items: center; justify-content: center; }
.empty-state h3 { font-size: 18px; font-weight: 800; color: var(--text-1); margin-bottom: 8px; }
.empty-state p { font-size: 14px; line-height: 1.65; margin-bottom: 28px; }

/* ===== 50/30/20 ===== */
.rule-bar-wrap { margin: 10px 0; }
.rule-bar-label { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; font-weight: 600; }
.rule-bar { height: 8px; background: var(--surface-3); border-radius: var(--r-full); overflow: hidden; }
.rule-bar-fill { height: 100%; border-radius: var(--r-full); transition: width .6s cubic-bezier(.34,1.2,.64,1); }

/* ===== GOAL COLORS ===== */
.goal-color-1 { background: rgba(255,107,53,0.10); } .fill-1 { background: var(--primary); }
.goal-color-2 { background: rgba(255,214,10,0.12); }  .fill-2 { background: #FFD60A; }
.goal-color-3 { background: rgba(0,168,130,0.10); }  .fill-3 { background: var(--income); }
.goal-color-4 { background: rgba(255,159,10,0.10); } .fill-4 { background: var(--warning); }
.goal-color-5 { background: rgba(175,82,222,0.10); } .fill-5 { background: #AF52DE; }
.goal-color-6 { background: rgba(232,50,88,0.10); }  .fill-6 { background: var(--expense); }

/* ===== ANIMATIONS ===== */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeSlideUp .38s cubic-bezier(.22,1,.36,1) both; }

/* ===== GOAL ICON BTN ===== */
.goal-icon-btn {
  background: var(--surface-2) !important;
  border: 1.5px solid var(--glass-border) !important;
  transition: all .15s !important;
}
.goal-icon-btn.gib-sel {
  background: var(--primary-pale) !important;
  border-color: var(--primary) !important;
}
.goal-icon-btn:active { transform: scale(.9) !important; }

/* ===== UTILS ===== */
.full-width { width: 100%; display: block; }
.text-sm { font-size: 13px; }.text-muted { color: var(--text-2); }
.text-income { color: var(--income); }
.text-expense { color: var(--expense); }
.text-primary { color: var(--primary); }

/* ===== FEATURE 4: SEARCH ===== */
.search-bar-wrap {
  padding: 4px 0 14px;
}
.search-bar-inner {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-card);
  border-radius: 18px;
  border: 1.5px solid var(--border);
  padding: 13px 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.search-bar-inner:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-pale), 0 2px 12px rgba(0,0,0,0.07);
}
.search-icon {
  color: var(--text-3); flex-shrink: 0;
  transition: color 0.2s ease;
}
.search-bar-inner:focus-within .search-icon { color: var(--primary); }
.search-input {
  flex: 1; background: none; border: none; outline: none;
  font-size: 15px; color: var(--text-1); font-weight: 500;
}
.search-input::placeholder { color: var(--text-3); }
.search-clear {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--surface-2); border: none; cursor: pointer;
  color: var(--text-2); flex-shrink: 0;
  transition: background 0.15s, transform 0.15s;
}
.search-clear:active { transform: scale(0.9); }

/* ===== FEATURE 7: DEUDAS ===== */
/* ===== FEATURE 13: SCORE DETAIL BTN ===== */
.score-detail-btn {
  margin-top: 10px; font-size: 12px; font-weight: 700; color: var(--primary);
  background: var(--primary-pale); border: none; border-radius: 8px;
  padding: 6px 14px; cursor: pointer; transition: opacity 0.15s;
}
.score-detail-btn:hover { opacity: 0.8; }

/* ===== FEATURE 16: THEMES GRID ===== */
/* ===== FEATURE 19: PIN LOCK ===== */@keyframes pin-shake {
  0%,100% { transform: translateX(0); }
  25%      { transform: translateX(-6px); }
  75%      { transform: translateX(6px); }
}
/* ===== FEATURE 2: RECURRING TOGGLE ===== */
/* reuses .pending-toggle styles already defined */

/* ===== SCORE-RING WRAP BUTTON ===== */
.score-ring-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0; }

/* ===== DESKTOP ===== */
@media (min-width: 430px) {
  body { background: #E8E8F0; display: flex; justify-content: center; }
  [data-theme="dark"] body, body:has([data-theme="dark"]) { background: #0A0A12; }
  #app {
    max-width: 390px; width: 100%;
    background: var(--bg);
    box-shadow: 0 0 80px rgba(0,0,0,0.15), 0 0 200px rgba(0,0,0,0.08);
  }
  .app-header, .bottom-nav { max-width: 390px; left: 50%; transform: translateX(-50%); }
  .app-main { max-width: 390px; left: 50%; transform: translateX(-50%); }
  .modal-container {
    max-width: 390px; left: 50%;
    transform: translateX(-50%) translateY(100%);
    right: auto; width: 390px;
  }
  .modal-container.open { transform: translateX(-50%) translateY(0); }
  .modal-backdrop { max-width: 390px; left: 50%; transform: translateX(-50%); right: auto; width: 390px; }
}


/* ===== DARK MODE FIXES ===== */

/* Toggle knobs — white on dark bg causes invisibility */
[data-theme="dark"] .toggle-switch .toggle-knob {
  background: #fff;
  box-shadow: 0 1px 6px rgba(0,0,0,0.5);
}
[data-theme="dark"] .toggle .toggle-knob {
  background: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,0.5);
}
/* Toggle track off-state needs to be visible in dark */
[data-theme="dark"] .toggle-switch:not(.on),
[data-theme="dark"] .toggle:not(.on) {
  background: var(--surface-3);
  border-color: var(--glass-border);
}

/* Sobre shoulders — black overlay invisible on dark */
[data-theme="dark"] .sobre-env-shoulder-l,
[data-theme="dark"] .sobre-env-shoulder-r {
  background: rgba(255,255,255,0.06);
}

/* Modal backdrop — more contrast on dark */
[data-theme="dark"] .modal-backdrop {
  background: rgba(0,0,0,0.65);
}

/* Cal-nav buttons in dark */
[data-theme="dark"] .cal-nav {
  background: var(--surface-2);
  color: var(--text-1);
}

/* Settings section titles */
/* Score ring background */
[data-theme="dark"] .score-ring-bg {
  stroke: var(--surface-3);
}

/* Insight items */
[data-theme="dark"] .insight-item {
  background: var(--surface-1);
  border-color: var(--glass-border);
}

/* Análisis cards & rule sections */
/* Budget bar background */
/* Tag chips */
[data-theme="dark"] .tag-chip {
  background: var(--surface-3);
  color: var(--text-2);
}

/* Hist day header */
/* Empty state icons */
[data-theme="dark"] .sobres-empty-icon {
  color: var(--text-3);
}

/* Pending stat card empty text */
[data-theme="dark"] .stat-card-value {
  color: var(--text-1);
}

/* ===== PRO HEADER BUTTON ===== */
.header-pro-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 13px;
  border-radius: 8px;
  border: 1.5px solid var(--glass-border);
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.2s;
}
.header-pro-btn:active { transform: scale(0.95); }
.header-pro-btn svg { flex-shrink: 0; }
.header-pro-label { font-size: 11px; font-weight: 800; letter-spacing: 0.5px; }

.header-pro-btn.header-pro-active {
  background: #FF6B35;
  border: 2px solid #FF9500;
  outline: 1.5px solid rgba(255,149,0,0.4);
  color: #fff;
  box-shadow: 0 2px 14px rgba(255,107,53,0.45);
}
.header-pro-btn.header-pro-active .header-pro-label {
  font-weight: 900;
  color: #fff;
}
.header-pro-btn.header-pro-active svg {
  color: #fff;
  stroke: #fff;
}

[data-theme="dark"] .header-pro-btn {
  background: var(--surface-2);
  border-color: var(--glass-border);
  color: var(--text-2);
}
[data-theme="dark"] .header-pro-btn.header-pro-active {
  background: #FF6B35;
  border: 2px solid #FF9500;
  outline: 1.5px solid rgba(255,149,0,0.4);
  color: #fff;
  box-shadow: 0 2px 14px rgba(255,107,53,0.5);
}

/* ===== PRO PAGE v3 ===== */
.pro-page {
  min-height: 100%;
  background: var(--bg);
  padding-bottom: 48px;
}

/* ── Hero ── */
/* Ambient glow behind crown */@keyframes proStarPulse {
  0%,100% { opacity: 0.12; transform: scale(1); }
  50%      { opacity: 0.5;  transform: scale(1.4); }
}

.pro-back-btn {
  position: absolute;
  top: 16px; left: 16px;
  z-index: 3;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  color: var(--text-1);
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: background 0.2s;
}
.pro-back-btn:active { background: var(--glass-hover); }

.pro-hero-v2-content {
  position: relative;
  z-index: 2;
}


.pro-hero-v2-title {
  font-size: clamp(36px, 11vw, 52px);
  font-weight: 900;
  color: #fff;
  letter-spacing: -1.5px;
  line-height: 1;
  margin-bottom: 10px;
}
.pro-hero-v2-title span {
  background: linear-gradient(90deg, #FFE44D 0%, #FF8C00 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.pro-hero-v2-tagline {
  color: rgba(255,255,255,0.55);
  font-size: 14px;
  margin: 0 0 22px;
  font-weight: 400;
}

/* Hero pills */@keyframes dotBlink {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.3; transform: scale(0.8); }
}

/* Trial day widget */@keyframes dotCurrentPulse {
  0%,100% { box-shadow: 0 0 8px rgba(255,255,255,0.25); transform: scale(1); }
  50%      { box-shadow: 0 0 18px rgba(255,255,255,0.5); transform: scale(1.1); }
}
/* ── Features block ── */
.pro-feat-row-icon {
  width: 38px; height: 38px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.pro-feat-row-body { flex: 1; min-width: 0; }
.pro-feat-row-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.pro-feat-row-desc {
  font-size: 10px;
  color: var(--text-2);
  margin-top: 2px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Feature status badges */.pro-feat-badge--yes {
  background: rgba(52,199,89,0.15);
  color: #34C759;
}
.pro-feat-badge--lock {
  background: rgba(255,59,48,0.1);
  color: #FF3B30;
}
.pro-feat-badge--partial {
  background: rgba(255,149,0,0.15);
  color: #FF9500;
  border-radius: 100px;
  width: auto;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 800;
  height: auto;
}

/* ── Precio ── */
/* CTA */
.pro-cta-btn {
  width: 100%;
  background: linear-gradient(135deg, #FF9500 0%, #FF6B35 100%);
  color: #fff;
  border: none;
  border-radius: 18px;
  padding: 18px 24px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
  letter-spacing: -0.2px;
  box-shadow: 0 6px 24px rgba(255,107,53,0.45), 0 2px 6px rgba(255,107,53,0.3);
  transition: transform 0.15s, box-shadow 0.15s;
  animation: ctaPulse 3s ease-in-out infinite;
}
@keyframes ctaPulse {
  0%,100% { box-shadow: 0 6px 24px rgba(255,107,53,0.45), 0 2px 6px rgba(255,107,53,0.3); }
  50%      { box-shadow: 0 8px 36px rgba(255,107,53,0.65), 0 2px 8px rgba(255,107,53,0.4); }
}
.pro-cta-btn:active {
  transform: scale(0.97);
  box-shadow: 0 3px 12px rgba(255,107,53,0.3);
  animation: none;
}
/* ── Estado pagado ── */
/* ── PRO EXPIRED (legacy, keep for banner) ── */
/* ===== PRO EXPIRED BANNER ===== */

/* ── PRO Trial Badge ─────────────────────────────────────────── */
.header-pro-trial {
  background: linear-gradient(135deg, #3B82F6, #1D4ED8) !important;
  color: #fff !important;
}

/* ══════════════════════════════════════════
   PRO PAGE — MINIMAL REDESIGN
══════════════════════════════════════════ */

/* Hero */
.pro-hero-min {
  position: relative;
  background: var(--bg);
  padding: 19px 24px 16px;
  text-align: center;
  overflow: hidden;
}.pro-hero-min-inner {
  position: relative;
  z-index: 2;
}
/* Offer label */
/* Product badge */
/* Benefit headline */
/* Support copy */
/* Trial progress bar */@keyframes barShimmer {
  0%     { left: -60%; }
  100%   { left: 150%; }
}
.pro-hero-min-title {
  font-size: clamp(26px, 8vw, 38px);
  font-weight: 900;
  color: var(--text-1);
  letter-spacing: -1.5px;
  line-height: 1;
  margin-bottom: 10px;
}
.pro-hero-min-title span {
  background: linear-gradient(135deg, #FF9500 0%, #FF6B35 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Paywall container */
/* Price block — direct typography, no card */.pro-price-min-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #FF9500;
  margin-bottom: 14px;
}
.pro-price-min-amount {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  line-height: 1;
  margin-bottom: 10px;
  gap: 1px;
}
.pro-price-min-int {
  font-size: 80px;
  font-weight: 900;
  color: var(--text-1);
  letter-spacing: -4px;
  line-height: 0.9;
}
.pro-price-min-dec {
  font-size: 34px;
  font-weight: 800;
  color: var(--text-1);
  letter-spacing: -1px;
  align-self: flex-end;
  margin-bottom: 7px;
}
.pro-price-min-sym {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-2);
  align-self: flex-end;
  margin-bottom: 7px;
}
.pro-price-min-tagline {
  font-size: 13px;
  color: var(--text-2);
}

/* CTA */@keyframes ctaSweep {
  0%      { left: -55%; }
  50%,100% { left: 150%; }
}
/* Secondary CTA — free plan */
/* Trial badge variant */
.pro-paid-status-badge--trial {
  background: rgba(52,199,89,0.12);
  color: #34C759;
  border-color: rgba(52,199,89,0.25);
}

/* Trust signals — inline, minimal */.pro-trust-min-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-2);
  font-weight: 500;
}
.pro-trust-min-sep {
  color: var(--text-2);
  opacity: 0.35;
  font-size: 12px;
  line-height: 1;
}

/* Legacy PRO classes removed — replaced by v2 */

/* ── Banner sin conexión ─────────────────────────────────────── */
#offline-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: #FF3B30;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  animation: offlineDrop .25s ease;
}
#offline-banner svg { flex-shrink: 0; }
@keyframes offlineDrop {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

/* ── Spinner de carga en modal ───────────────────────────────── */
.modal-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
}
.modal-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Tab switcher PRO ===== */
.pro-tab-wrap {
  padding: 4px 16px 4px;
}
.pro-tab-seg {
  display: flex;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 3px;
  gap: 2px;
}
.pro-tab-btn {
  flex: 1;
  padding: 8px 0;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-3);
  background: none;
  border: none;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.pro-tab-btn.active {
  background: var(--bg-card);
  color: var(--text-1);
  box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}

/* ===== Tarjetas de uso ===== */
.pro-usage-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 10px;
}
.pro-usage-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.pro-usage-icon {
  color: var(--primary);
  flex-shrink: 0;
  display: flex;
}
.pro-usage-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-1);
  flex: 1;
}
.pro-usage-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
}
.pro-usage-badge-full {
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  background: var(--expense);
  padding: 2px 8px;
  border-radius: 99px;
}
.pro-usage-bar-bg {
  height: 7px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
  margin-bottom: 7px;
}
.pro-usage-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .5s cubic-bezier(.34,1.4,.64,1);
}
.pro-usage-hint {
  font-size: 11px;
  color: var(--text-3);
}

/* ===== Comparador PRO ===== */

/* Tabla comparativa */
.pro-comp-table-wrap {
  margin: 0 16px 20px;
  border-radius: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
}
.pro-comp-table {
  min-width: 320px;
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
}

/* Cabecera de columnas */
.pro-comp-head {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.pro-comp-head-feat { flex: 1; min-width: 0; }
.pro-comp-head-cell {
  width: 64px;
  min-width: 64px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-3);
}
.pro-comp-head-cell--pro { color: #F26522; }

/* Fila de funcionalidad */
.pro-comp-row {
  display: flex;
  align-items: center;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.pro-comp-row:last-child { border-bottom: none; }

/* Celda izquierda: icono + etiqueta */
.pro-comp-feat {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}
.pro-comp-feat-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  flex-shrink: 0;
}
.pro-comp-feat-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Celdas de valor */
.pro-comp-col {
  width: 64px;
  min-width: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pro-comp-val {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Texto Free — gris atenuado */
.pro-comp-text {
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
  color: var(--text-3);
}

/* Texto PRO — naranja */
.pro-comp-text--pro { color: #F26522; }

/* Checkmark PRO — naranja */
.pro-comp-check {
  color: #F26522;
  display: flex;
  align-items: center;
}

/* Cruz Free — gris */
.pro-comp-cross {
  color: var(--text-3);
  display: flex;
  align-items: center;
}

/* Columna PRO con fondo sutil */
.pro-comp-col--pro { background: rgba(242,101,34,0.05); }
/* Cuando el usuario ya es PRO, sin fondo en la columna */
.pro-comp-table--active .pro-comp-col--pro { background: none; flex: 0 0 85px !important; }
.pro-comp-table--active .pro-comp-feat-label { white-space: normal; }

/* CTA */
.pro-cta-wrap { padding: 0 16px 8px; }
.pro-cta-btn {
  width: 100%;
  padding: 16px;
  border-radius: 16px;
  border: none;
  background: #F26522;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.2px;
  transition: opacity 0.15s, transform 0.15s;
}
.pro-cta-btn:active { opacity: 0.88; transform: scale(0.98); }
.pro-cta-sub {
  text-align: center;
  margin: 8px 0 24px;
  font-size: 12px;
  color: var(--text-3);
}

/* ── Responsive scaling para pantallas grandes ───────────────────────────────
   zoom escala todo (px incluidos) en Chromium/Android WebView              */
@media (min-width: 390px) {
  html { zoom: 0.93; }
}
@media (min-width: 420px) {
  html { zoom: 0.89; }
}
@media (min-width: 480px) {
  html { zoom: 0.85; }
}

