/* =====================================================================
   Lili Finanzas — sistema visual inspirado en iOS
   Colores del sistema de Apple, materiales con desenfoque, curvas de
   resorte y tipografía SF (Inter donde no hay SF).
   ===================================================================== */

:root {
  --bg: #f2f2f7;
  --bg-2: #ffffff;
  --card: #ffffff;
  --card-2: #f2f2f7;
  --elev: #ffffff;
  --label: #000000;
  --label-2: rgba(60, 60, 67, 0.6);
  --label-3: rgba(60, 60, 67, 0.3);
  --sep: rgba(60, 60, 67, 0.18);
  --fill: rgba(120, 120, 128, 0.12);
  --fill-2: rgba(120, 120, 128, 0.2);
  --material: rgba(249, 249, 249, 0.78);
  --material-border: rgba(0, 0, 0, 0.12);
  --accent: #5856d6;
  --accent-soft: rgba(88, 86, 214, 0.12);
  --green: #34c759;
  --red: #ff3b30;
  --orange: #ff9500;
  --blue: #007aff;
  --teal: #30b0c7;
  --pink: #ff2d55;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.18);
  --r: 16px;
  --r-lg: 22px;
  --spring: cubic-bezier(0.32, 0.72, 0, 1);
  --bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: calc(50px + var(--safe-bottom));
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", system-ui, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --bg-2: #1c1c1e; --card: #1c1c1e; --card-2: #2c2c2e; --elev: #2c2c2e;
    --label: #ffffff; --label-2: rgba(235, 235, 245, 0.6); --label-3: rgba(235, 235, 245, 0.3);
    --sep: rgba(84, 84, 88, 0.55); --fill: rgba(120, 120, 128, 0.24); --fill-2: rgba(120, 120, 128, 0.36);
    --material: rgba(22, 22, 24, 0.78); --material-border: rgba(255, 255, 255, 0.1);
    --accent: #7d7aff; --accent-soft: rgba(125, 122, 255, 0.18);
    --green: #30d158; --red: #ff453a; --orange: #ff9f0a; --blue: #0a84ff; --teal: #40c8e0; --pink: #ff375f;
    --shadow: none; --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --bg-2: #1c1c1e; --card: #1c1c1e; --card-2: #2c2c2e; --elev: #2c2c2e;
  --label: #ffffff; --label-2: rgba(235, 235, 245, 0.6); --label-3: rgba(235, 235, 245, 0.3);
  --sep: rgba(84, 84, 88, 0.55); --fill: rgba(120, 120, 128, 0.24); --fill-2: rgba(120, 120, 128, 0.36);
  --material: rgba(22, 22, 24, 0.78); --material-border: rgba(255, 255, 255, 0.1);
  --accent: #7d7aff; --accent-soft: rgba(125, 122, 255, 0.18);
  --green: #30d158; --red: #ff453a; --orange: #ff9f0a; --blue: #0a84ff; --teal: #40c8e0; --pink: #ff375f;
  --shadow: none; --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--label);
  font-size: 17px;
  line-height: 1.3;
  letter-spacing: -0.41px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}
input, textarea, select, button { font: inherit; color: inherit; letter-spacing: inherit; }
input, textarea, [contenteditable] { -webkit-user-select: text; user-select: text; }
button { border: 0; background: none; padding: 0; cursor: pointer; }
svg { display: block; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
[hidden] { display: none !important; }

/* ---------- estructura ---------- */
#app { position: fixed; inset: 0; display: flex; }
.contenido { position: relative; flex: 1; min-width: 0; height: 100%; }

.vista {
  position: absolute; inset: 0;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding-bottom: calc(var(--tabbar-h) + 28px);
  opacity: 0; visibility: hidden;
  transform: scale(0.985);
  transition: opacity 0.28s var(--ease), transform 0.4s var(--spring), visibility 0s linear 0.28s;
  scrollbar-width: none;
}
.vista::-webkit-scrollbar { display: none; }
.vista.activa { opacity: 1; visibility: visible; transform: none; transition: opacity 0.28s var(--ease), transform 0.45s var(--spring), visibility 0s; }
.envoltura { max-width: 720px; margin: 0 auto; padding: 0 16px; }

/* barra de navegación con título grande que se colapsa (como iOS) */
.navbar {
  position: sticky; top: 0; z-index: 20;
  padding-top: var(--safe-top);
  background: transparent;
  transition: background 0.25s, border-color 0.25s;
  border-bottom: 0.5px solid transparent;
}
.navbar.solida {
  background: var(--material);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom-color: var(--material-border);
}
.navbar-fila { height: 44px; max-width: 720px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.navbar-titulo {
  position: absolute; left: 50%; transform: translate(-50%, 4px); bottom: 12px;
  font-size: 17px; font-weight: 600; opacity: 0; transition: opacity 0.2s, transform 0.3s var(--spring);
  pointer-events: none; white-space: nowrap;
}
.navbar.solida .navbar-titulo { opacity: 1; transform: translate(-50%, 0); }
.navbar-lado { display: flex; align-items: center; gap: 4px; min-width: 44px; }
.navbar-lado.der { justify-content: flex-end; }
.titulo-grande { font-size: 34px; font-weight: 700; letter-spacing: 0.37px; line-height: 41px; margin: 2px 0 10px; }
.titulo-sub { color: var(--label-2); font-size: 15px; margin: -8px 0 14px; }

.btn-icono {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--accent); background: var(--fill);
  transition: transform 0.2s var(--spring), background 0.2s;
}
.btn-icono:active { transform: scale(0.88); }
.btn-icono svg { width: 18px; height: 18px; }
.btn-texto { color: var(--accent); font-size: 17px; padding: 6px 4px; transition: opacity 0.15s; }
.btn-texto:active { opacity: 0.4; }
.btn-texto.fuerte { font-weight: 600; }

/* ---------- barra de pestañas ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: var(--tabbar-h); padding-bottom: var(--safe-bottom);
  display: flex; justify-content: space-around; align-items: stretch;
  background: var(--material);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--material-border);
}
.tab {
  flex: 1; max-width: 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: #999; font-size: 10px; font-weight: 500; letter-spacing: 0.1px;
  transition: color 0.2s;
}
.tab svg { width: 26px; height: 26px; transition: transform 0.35s var(--bounce); }
.tab.activa { color: var(--accent); }
.tab.activa svg { transform: scale(1.06); }
.tab:active svg { transform: scale(0.85); }
.tab-lili .burbuja-ia {
  width: 30px; height: 30px; border-radius: 50%;
  background: conic-gradient(from 200deg, #5e5ce6, #bf5af2, #ff375f, #ff9f0a, #5e5ce6);
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 2px 10px rgba(94, 92, 230, 0.35);
  transition: transform 0.35s var(--bounce);
}
.tab-lili .burbuja-ia svg { width: 17px; height: 17px; }
.tab-lili.activa .burbuja-ia { transform: scale(1.1) rotate(-8deg); }

/* barra lateral (iPad / escritorio) */
.lateral { display: none; }
@media (min-width: 900px) {
  .tabbar { display: none; }
  .vista { padding-bottom: 40px; }
  .lateral {
    display: flex; flex-direction: column; width: 260px; flex-shrink: 0; padding: 18px 12px;
    background: var(--bg-2); border-right: 0.5px solid var(--sep);
  }
  .lateral-marca { display: flex; align-items: center; gap: 10px; padding: 10px 10px 22px; font-weight: 700; font-size: 20px; }
  .lateral-marca .burbuja-ia { width: 34px; height: 34px; border-radius: 10px; background: conic-gradient(from 200deg, #5e5ce6, #bf5af2, #ff375f, #ff9f0a, #5e5ce6); display: grid; place-items: center; color: #fff; }
  .lateral-marca .burbuja-ia svg { width: 18px; height: 18px; }
  .lateral .tab {
    flex: none; max-width: none; flex-direction: row; justify-content: flex-start; gap: 12px;
    padding: 9px 12px; border-radius: 10px; font-size: 15px; color: var(--label); font-weight: 500;
  }
  .lateral .tab svg { width: 22px; height: 22px; color: var(--accent); }
  .lateral .tab.activa { background: var(--accent); color: #fff; }
  .lateral .tab.activa svg { color: #fff; transform: none; }
  .lateral .tab-lili .burbuja-ia { width: 22px; height: 22px; box-shadow: none; }
  .lateral .tab-lili .burbuja-ia svg { width: 13px; height: 13px; }
  .lateral-pie { margin-top: auto; padding: 12px; font-size: 12px; color: var(--label-2); }
}

/* ---------- tarjetas y listas agrupadas ---------- */
.tarjeta { background: var(--card); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow); }
.tarjeta + .tarjeta, .bloque + .bloque { margin-top: 14px; }
.bloque { margin-top: 26px; }
.bloque-cab { display: flex; align-items: baseline; justify-content: space-between; padding: 0 4px 8px; }
.bloque-cab h2 { font-size: 22px; font-weight: 700; letter-spacing: 0.35px; margin: 0; }
.bloque-cab .btn-texto { font-size: 15px; }
.seccion-cab { font-size: 13px; color: var(--label-2); text-transform: uppercase; letter-spacing: -0.08px; padding: 0 16px 7px; margin-top: 26px; }
.seccion-pie { font-size: 13px; color: var(--label-2); padding: 7px 16px 0; line-height: 1.35; }

.lista { background: var(--card); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.fila {
  position: relative; display: flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 10px 16px; background: var(--card);
  transition: background 0.15s;
}
.fila::after { content: ""; position: absolute; left: 60px; right: 0; bottom: 0; height: 0.5px; background: var(--sep); }
.fila.sin-icono::after { left: 16px; }
.fila:last-child::after { display: none; }
button.fila, .fila.tocable { width: 100%; text-align: left; cursor: pointer; }
button.fila:active, .fila.tocable:active { background: var(--fill); }
.fila-cuerpo { flex: 1; min-width: 0; }
.fila-titulo { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fila-sub { font-size: 13px; color: var(--label-2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fila-valor { color: var(--label-2); font-size: 17px; white-space: nowrap; }
.chevron { width: 8px; height: 13px; color: var(--label-3); flex-shrink: 0; }

.icono-cat {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 19px; line-height: 1;
  background: color-mix(in srgb, var(--c, #8e8e93) 18%, transparent);
}
.icono-cat.chico { width: 30px; height: 30px; border-radius: 8px; font-size: 16px; }
.icono-cat.grande { width: 56px; height: 56px; border-radius: 16px; font-size: 30px; }

.monto { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.monto.ingreso { color: var(--green); }
.positivo { color: var(--green); }
.negativo { color: var(--red); }

/* ---------- selector de mes ---------- */
.selector-mes { display: inline-flex; align-items: center; gap: 2px; background: var(--fill); border-radius: 999px; padding: 3px; }
.selector-mes button { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: var(--accent); transition: transform 0.2s var(--spring), background 0.2s; }
.selector-mes button:active { transform: scale(0.85); background: var(--fill-2); }
.selector-mes button:disabled { opacity: 0.3; }
.selector-mes button svg { width: 14px; height: 14px; }
.selector-mes .mes-nombre { font-size: 15px; font-weight: 600; min-width: 118px; text-align: center; text-transform: capitalize; }

/* ---------- resumen: héroe ---------- */
.heroe {
  position: relative; overflow: hidden; border-radius: 26px; padding: 22px 20px 20px; color: #fff;
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(255, 255, 255, 0.22), transparent 55%),
    radial-gradient(90% 120% at 100% 100%, rgba(255, 55, 95, 0.55), transparent 60%),
    linear-gradient(135deg, #5e5ce6 0%, #8e4ff0 55%, #bf5af2 100%);
  box-shadow: 0 16px 40px -12px rgba(94, 92, 230, 0.55);
  isolation: isolate;
}
.heroe::before {
  content: ""; position: absolute; width: 260px; height: 260px; right: -80px; top: -120px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.28), transparent 70%);
  animation: flotar 9s ease-in-out infinite alternate; z-index: -1;
}
@keyframes flotar { to { transform: translate(-40px, 30px) scale(1.15); } }
.heroe-etiqueta { font-size: 13px; font-weight: 600; opacity: 0.85; text-transform: uppercase; letter-spacing: 0.4px; }
.heroe-cifra { font-size: 44px; font-weight: 700; letter-spacing: -1.2px; margin-top: 4px; line-height: 1.05; }
.heroe-cifra .centavos { font-size: 0.5em; opacity: 0.7; }
.heroe-nota { font-size: 15px; opacity: 0.9; margin-top: 6px; }
.heroe-par { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.heroe-mini { background: rgba(255, 255, 255, 0.16); border-radius: 16px; padding: 11px 13px; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.heroe-mini span { display: block; font-size: 12px; opacity: 0.85; }
.heroe-mini b { display: block; font-size: 19px; font-weight: 650; margin-top: 2px; letter-spacing: -0.4px; }
.heroe-mini small { font-size: 12px; opacity: 0.8; }

/* anillos (tipo Actividad) */
.anillos-tarjeta { display: flex; align-items: center; gap: 18px; }
.anillos { width: 124px; height: 124px; flex-shrink: 0; }
.anillos circle { fill: none; stroke-linecap: round; transition: stroke-dashoffset 1.3s var(--spring); }
.anillos-leyenda { flex: 1; display: grid; gap: 10px; min-width: 0; }
.anillo-dato span { font-size: 13px; color: var(--label-2); display: flex; align-items: center; gap: 6px; }
.anillo-dato span i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.anillo-dato b { font-size: 17px; font-weight: 650; letter-spacing: -0.3px; }
.anillo-dato b small { font-size: 13px; color: var(--label-2); font-weight: 500; }

/* puedes gastar hoy */
.hoy-tarjeta { display: flex; align-items: center; gap: 14px; }
.hoy-tarjeta .icono-cat { --c: var(--green); }
.hoy-tarjeta b { font-size: 22px; letter-spacing: -0.5px; }

/* ideas */
.ideas { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 2px 16px 6px; scrollbar-width: none; }
.ideas::-webkit-scrollbar { display: none; }
.idea { scroll-snap-align: start; flex: 0 0 78%; max-width: 320px; background: var(--card); border-radius: 18px; padding: 14px 15px; display: flex; gap: 11px; align-items: flex-start; box-shadow: var(--shadow); font-size: 15px; line-height: 1.35; }
.idea .e { font-size: 22px; line-height: 1; }

/* gráfica de días */
.grafica { position: relative; }
.grafica svg { width: 100%; height: auto; overflow: visible; }
.grafica .barra { transition: opacity 0.2s; transform-origin: bottom; transform-box: fill-box; animation: crecer 0.8s var(--spring) both; }
@keyframes crecer { from { transform: scaleY(0); } }
.grafica .barra.apagada { opacity: 0.35; }
.grafica-info { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 12px; }
.grafica-info .etq { font-size: 13px; color: var(--label-2); }
.grafica-info b { font-size: 22px; letter-spacing: -0.5px; }
.eje { font-size: 11px; fill: var(--label-2); }
.guia { stroke: var(--sep); stroke-dasharray: 2 3; }

/* categorías del mes */
.cat-fila .barrita { height: 6px; border-radius: 3px; background: var(--fill); margin-top: 7px; overflow: hidden; }
.cat-fila .barrita i { display: block; height: 100%; border-radius: 3px; background: var(--c); width: 0; transition: width 1s var(--spring); }
.cat-fila .barrita.pasada i { background: var(--red); }
.cat-fila .fila-titulo { display: flex; justify-content: space-between; gap: 8px; }

/* dona */
.dona-tarjeta { display: flex; align-items: center; gap: 18px; }
.dona { width: 132px; height: 132px; flex-shrink: 0; }
.dona circle { fill: none; transition: stroke-dasharray 1s var(--spring); }
.dona-leyenda { display: grid; gap: 7px; font-size: 14px; flex: 1; min-width: 0; }
.dona-leyenda div { display: flex; align-items: center; gap: 7px; white-space: nowrap; overflow: hidden; }
.dona-leyenda i { width: 9px; height: 9px; border-radius: 3px; background: var(--c); flex-shrink: 0; }
.dona-leyenda span { overflow: hidden; text-overflow: ellipsis; flex: 1; }
.dona-leyenda b { font-weight: 600; color: var(--label-2); }

/* 50/30/20 */
.regla { display: grid; gap: 14px; }
.regla-fila > div:first-child { display: flex; justify-content: space-between; font-size: 15px; }
.regla-fila small { color: var(--label-2); }
.regla-pista { position: relative; height: 10px; border-radius: 5px; background: var(--fill); margin-top: 7px; overflow: hidden; }
.regla-pista i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; background: var(--c); width: 0; transition: width 1.1s var(--spring); }
.regla-pista u { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--label); opacity: 0.55; border-radius: 1px; }

/* ---------- movimientos ---------- */
.buscador { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 8px; border-radius: 10px; background: var(--fill); color: var(--label-2); }
.buscador svg { width: 16px; height: 16px; flex-shrink: 0; }
.buscador input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 17px; color: var(--label); }
.buscador input::placeholder { color: var(--label-2); }

.segmentado { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--fill); border-radius: 9px; padding: 2px; height: 32px; }
.segmentado button { position: relative; z-index: 1; font-size: 13px; font-weight: 500; border-radius: 7px; transition: opacity 0.15s; }
.segmentado button.activo { font-weight: 600; }
.segmentado .pulgar { position: absolute; z-index: 0; top: 2px; bottom: 2px; border-radius: 7px; background: var(--elev); box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 3px 1px rgba(0, 0, 0, 0.04); transition: transform 0.35s var(--spring), width 0.35s var(--spring); }
:root[data-theme="dark"] .segmentado .pulgar { background: #636366; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .segmentado .pulgar { background: #636366; } }

.chips { display: flex; gap: 8px; overflow-x: auto; margin: 12px -16px 0; padding: 0 16px 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; height: 32px; padding: 0 13px; border-radius: 999px; background: var(--fill); font-size: 15px; display: inline-flex; align-items: center; gap: 5px; transition: background 0.2s, color 0.2s, transform 0.2s var(--spring); white-space: nowrap; }
.chip:active { transform: scale(0.94); }
.chip.activo { background: var(--label); color: var(--bg-2); }

.dia-cab { display: flex; justify-content: space-between; font-size: 13px; color: var(--label-2); padding: 20px 16px 7px; text-transform: uppercase; letter-spacing: -0.08px; }
.mov-fila { overflow: hidden; }
.mov-fila .deslizable { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 16px; background: var(--card); position: relative; z-index: 1; transition: transform 0.35s var(--spring); touch-action: pan-y; }
.mov-fila .accion-borrar { position: absolute; right: 0; top: 0; bottom: 0; width: 90px; background: var(--red); color: #fff; font-size: 15px; font-weight: 500; display: grid; place-items: center; }
.mov-fila.saliendo { animation: colapsar 0.4s var(--spring) forwards; }
@keyframes colapsar { to { height: 0; min-height: 0; padding: 0; opacity: 0; } }
.mov-fila.nuevo .deslizable { animation: resaltar 1.6s var(--ease); }
@keyframes resaltar { 0%, 30% { background: var(--accent-soft); } }

.vacio { text-align: center; padding: 60px 30px; color: var(--label-2); }
.vacio .e { font-size: 46px; margin-bottom: 10px; }
.vacio b { display: block; color: var(--label); font-size: 20px; margin-bottom: 6px; }

/* ---------- hoja de cálculo ---------- */
.hoja-marco { margin: 14px -16px 0; background: var(--card); border-top: 0.5px solid var(--sep); border-bottom: 0.5px solid var(--sep); }
@media (min-width: 560px) { .hoja-marco { margin: 14px 0 0; border-radius: 14px; border: 0.5px solid var(--sep); overflow: hidden; } }
.hoja-scroll { overflow: auto; max-height: calc(100dvh - 300px); min-height: 320px; overscroll-behavior: contain; }
.hoja { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 760px; font-size: 14px; }
.hoja th, .hoja td { border-bottom: 0.5px solid var(--sep); border-right: 0.5px solid var(--sep); padding: 0; height: 38px; white-space: nowrap; text-align: left; }
.hoja th:last-child, .hoja td:last-child { border-right: 0; }
.hoja thead th { position: sticky; top: 0; z-index: 2; background: var(--card-2); font-size: 12px; font-weight: 600; color: var(--label-2); text-transform: uppercase; letter-spacing: 0.2px; padding: 0 10px; cursor: pointer; }
.hoja thead th .flecha { opacity: 0.6; margin-left: 3px; }
.hoja tbody td:first-child, .hoja thead th:first-child { position: sticky; left: 0; z-index: 1; background: var(--card); width: 44px; text-align: center; color: var(--label-3); font-size: 11px; }
.hoja thead th:first-child { z-index: 3; background: var(--card-2); }
.hoja .celda { display: block; width: 100%; height: 37px; line-height: 37px; padding: 0 10px; overflow: hidden; text-overflow: ellipsis; outline: 0; cursor: cell; }
.hoja .celda:hover { background: var(--fill); }
.hoja .celda.editando { box-shadow: inset 0 0 0 2px var(--accent); background: var(--card); overflow: visible; }
.hoja input.celda, .hoja select.celda { border: 0; background: var(--card); box-shadow: inset 0 0 0 2px var(--accent); -webkit-appearance: none; appearance: none; }
.hoja .celda.guardado { animation: guardado 1.1s var(--ease); }
@keyframes guardado { 0% { background: color-mix(in srgb, var(--green) 30%, transparent); } }
.hoja .der { text-align: right; }
.hoja .tipo-pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; line-height: 18px; }
.hoja .tipo-pill.gasto { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
.hoja .tipo-pill.ingreso { background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--green); }
.hoja tfoot td { position: sticky; bottom: 0; background: var(--card-2); font-weight: 600; padding: 0 10px; font-size: 13px; }
.hoja tr.borrando { opacity: 0.3; transition: opacity 0.3s; }
.hoja .borrar-fila { width: 100%; height: 37px; color: var(--label-3); display: grid; place-items: center; }
.hoja .borrar-fila:hover { color: var(--red); }
.hoja-barra { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-top: 0.5px solid var(--sep); font-size: 13px; color: var(--label-2); }
.hoja-barra .btn-texto { font-size: 15px; }

/* ---------- chat con Lili ---------- */
.vista-lili { display: flex; flex-direction: column; padding-bottom: 0; overflow: hidden; }
.vista-lili .navbar { background: var(--material); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-bottom-color: var(--material-border); }
.lili-cab { display: flex; flex-direction: column; align-items: center; padding: 4px 0 8px; }
.lili-avatar { width: 40px; height: 40px; border-radius: 50%; background: conic-gradient(from 200deg, #5e5ce6, #bf5af2, #ff375f, #ff9f0a, #5e5ce6); display: grid; place-items: center; color: #fff; animation: girar 12s linear infinite; }
.lili-avatar svg { width: 20px; height: 20px; animation: girar 12s linear infinite reverse; }
@keyframes girar { to { transform: rotate(360deg); } }
.lili-cab b { font-size: 12px; font-weight: 500; margin-top: 4px; color: var(--label-2); }
.lili-cab.pensando .lili-avatar { animation-duration: 1.6s; }
.lili-cab.pensando .lili-avatar svg { animation-duration: 1.6s; }
.mensajes { flex: 1; overflow-y: auto; padding: 16px 0 12px; overscroll-behavior: contain; scrollbar-width: none; }
.mensajes::-webkit-scrollbar { display: none; }
.mensajes .envoltura { display: flex; flex-direction: column; gap: 3px; }
.msg { max-width: 78%; padding: 8px 13px; border-radius: 19px; font-size: 17px; line-height: 1.32; word-wrap: break-word; animation: aparecer 0.45s var(--spring) both; -webkit-user-select: text; user-select: text; }
@keyframes aparecer { from { opacity: 0; transform: translateY(12px) scale(0.96); } }
.msg.yo { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 6px; transform-origin: bottom right; }
.msg.ella { align-self: flex-start; background: var(--card); border-bottom-left-radius: 6px; transform-origin: bottom left; box-shadow: var(--shadow); }
.msg.yo + .msg.ella, .msg.ella + .msg.yo, .tarjetas-accion + .msg.yo { margin-top: 10px; }
.msg .adj { display: flex; align-items: center; gap: 6px; font-size: 13px; opacity: 0.85; margin-bottom: 3px; }
.msg .adj svg { width: 14px; height: 14px; }
.msg img.foto { display: block; max-width: 220px; max-height: 260px; border-radius: 14px; margin: -3px -8px 4px; }
.hora-chat { text-align: center; font-size: 12px; color: var(--label-2); margin: 14px 0 6px; }
.escribiendo { display: inline-flex; gap: 4px; padding: 13px 15px; }
.escribiendo i { width: 8px; height: 8px; border-radius: 50%; background: var(--label-3); animation: punto 1.3s infinite; }
.escribiendo i:nth-child(2) { animation-delay: 0.16s; }
.escribiendo i:nth-child(3) { animation-delay: 0.32s; }
@keyframes punto { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-5px); opacity: 1; } }

.tarjetas-accion { display: grid; gap: 6px; align-self: flex-start; width: min(82%, 340px); margin-top: 4px; }
.tarjeta-accion { background: var(--card); border-radius: 16px; padding: 12px 13px; display: flex; gap: 11px; align-items: center; box-shadow: var(--shadow); animation: aparecer 0.5s var(--spring) both; }
.tarjeta-accion .fila-cuerpo { min-width: 0; }
.tarjeta-accion .etq { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; color: var(--label-2); }
.tarjeta-accion .etq.ok { color: var(--green); }
.tarjeta-accion .etq.borr { color: var(--red); }
.tarjeta-accion .monto { font-size: 17px; }
.tarjeta-accion .acciones { display: flex; flex-direction: column; gap: 2px; align-items: flex-end; }
.tarjeta-accion .acciones button { font-size: 13px; color: var(--accent); padding: 2px 0; }
.tarjeta-accion.deshecha { opacity: 0.45; }
.tarjeta-accion.deshecha .monto { text-decoration: line-through; }
.progreso-mini { height: 5px; border-radius: 3px; background: var(--fill); margin-top: 6px; overflow: hidden; }
.progreso-mini i { display: block; height: 100%; background: var(--c, var(--accent)); border-radius: 3px; }

.sugerencias { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 10px 0; }
.sugerencia { background: var(--card); border-radius: 999px; padding: 9px 14px; font-size: 15px; box-shadow: var(--shadow); transition: transform 0.2s var(--spring); }
.sugerencia:active { transform: scale(0.94); }
.bienvenida-lili { text-align: center; padding: 30px 20px 10px; animation: aparecer 0.6s var(--spring) both; }
.bienvenida-lili .lili-avatar { width: 76px; height: 76px; margin: 0 auto 14px; box-shadow: 0 12px 30px -8px rgba(191, 90, 242, 0.6); }
.bienvenida-lili .lili-avatar svg { width: 36px; height: 36px; }
.bienvenida-lili h3 { font-size: 24px; margin: 0 0 6px; letter-spacing: -0.3px; }
.bienvenida-lili p { color: var(--label-2); margin: 0 auto; font-size: 15px; max-width: 300px; line-height: 1.4; }

.compositor { padding: 8px 0 calc(var(--tabbar-h) + 8px); background: var(--material); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-top: 0.5px solid var(--material-border); }
@media (min-width: 900px) { .compositor { padding-bottom: 14px; } }
.compositor .envoltura { display: flex; align-items: flex-end; gap: 8px; }
.compositor .btn-redondo { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; background: var(--fill); color: var(--label-2); transition: transform 0.2s var(--spring), background 0.2s; }
.compositor .btn-redondo:active { transform: scale(0.86); }
.compositor .btn-redondo svg { width: 20px; height: 20px; }
.caja-texto { flex: 1; min-width: 0; display: flex; align-items: flex-end; border: 1px solid var(--sep); border-radius: 19px; background: var(--card); padding: 4px 4px 4px 14px; min-height: 38px; }
.caja-texto textarea { flex: 1; resize: none; border: 0; outline: 0; background: none; font-size: 17px; line-height: 22px; max-height: 120px; padding: 4px 0; }
.btn-enviar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; flex-shrink: 0; transform: scale(0); transition: transform 0.35s var(--bounce); }
.btn-enviar.visible { transform: scale(1); }
.btn-enviar svg { width: 16px; height: 16px; }
.btn-mic.grabando { background: var(--red); color: #fff; animation: latido 1.2s ease-in-out infinite; }
@keyframes latido { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--red) 25%, transparent); } }
.adjunto-previo { display: flex; align-items: center; gap: 10px; padding: 0 0 8px; animation: aparecer 0.4s var(--spring) both; }
.adjunto-previo img { width: 54px; height: 54px; object-fit: cover; border-radius: 12px; }
.adjunto-previo button { font-size: 15px; color: var(--red); }
.grabacion { flex: 1; display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px; background: var(--card); border-radius: 19px; border: 1px solid var(--sep); }
.grabacion .punto-rojo { width: 9px; height: 9px; border-radius: 50%; background: var(--red); animation: parpadeo 1s infinite; }
@keyframes parpadeo { 50% { opacity: 0.2; } }
.grabacion canvas { flex: 1; height: 26px; min-width: 0; }
.grabacion .tiempo { font-size: 15px; color: var(--label-2); font-variant-numeric: tabular-nums; }
.grabacion .cancelar { color: var(--red); font-size: 15px; }

/* ---------- ahorro ---------- */
.meta-tarjeta { position: relative; background: var(--card); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow); display: flex; gap: 14px; align-items: center; width: 100%; text-align: left; transition: transform 0.25s var(--spring); }
.meta-tarjeta:active { transform: scale(0.98); }
.meta-anillo { width: 64px; height: 64px; flex-shrink: 0; position: relative; }
.meta-anillo svg { width: 64px; height: 64px; transform: rotate(-90deg); }
.meta-anillo circle { fill: none; stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset 1.2s var(--spring); }
.meta-anillo .e { position: absolute; inset: 0; display: grid; place-items: center; font-size: 26px; }
.meta-tarjeta .fila-titulo { font-weight: 600; }
.meta-tarjeta .cifras { font-size: 15px; margin-top: 3px; }
.meta-tarjeta .cifras small { color: var(--label-2); }
.meta-tarjeta .pista { font-size: 13px; color: var(--label-2); margin-top: 3px; }
.metas-grid { display: grid; gap: 12px; }
@media (min-width: 640px) { .metas-grid { grid-template-columns: 1fr 1fr; } }
.meta-completa { position: absolute; top: 12px; right: 14px; font-size: 12px; font-weight: 600; color: var(--green); }

.plantillas { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.plantilla { background: var(--card); border-radius: 18px; padding: 14px; text-align: left; box-shadow: var(--shadow); transition: transform 0.2s var(--spring); }
.plantilla:active { transform: scale(0.96); }
.plantilla .e { font-size: 28px; }
.plantilla b { display: block; font-size: 15px; margin-top: 8px; }
.plantilla small { display: block; font-size: 13px; color: var(--label-2); margin-top: 2px; }

/* ---------- hojas modales ---------- */
.fondo-hoja { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, 0.4); opacity: 0; transition: opacity 0.4s var(--ease); }
.fondo-hoja.visible { opacity: 1; }
.hoja-modal {
  position: fixed; z-index: 61; left: 0; right: 0; bottom: 0; margin: 0 auto;
  max-width: 640px; max-height: calc(100dvh - var(--safe-top) - 12px);
  display: flex; flex-direction: column;
  background: var(--bg); border-radius: 14px 14px 0 0;
  transform: translateY(105%); transition: transform 0.5s var(--spring);
  box-shadow: var(--shadow-lg); will-change: transform;
}
.hoja-modal.visible { transform: translateY(0); }
.hoja-modal.arrastrando { transition: none; }
@media (min-width: 700px) {
  .hoja-modal { bottom: auto; top: 50%; border-radius: 16px; transform: translateY(-40%) scale(0.96); opacity: 0; transition: transform 0.45s var(--spring), opacity 0.25s; max-height: min(86dvh, 900px); width: 560px; }
  .hoja-modal.visible { transform: translateY(-50%); opacity: 1; }
}
.hoja-agarre { height: 20px; display: grid; place-items: center; flex-shrink: 0; cursor: grab; touch-action: none; }
.hoja-agarre::before { content: ""; width: 36px; height: 5px; border-radius: 3px; background: var(--label-3); }
.hoja-cab { display: flex; align-items: center; justify-content: space-between; padding: 0 16px 8px; flex-shrink: 0; touch-action: none; min-height: 40px; }
.hoja-cab h3 { font-size: 17px; font-weight: 600; margin: 0; position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap; }
.hoja-cuerpo { overflow-y: auto; padding: 4px 16px calc(24px + var(--safe-bottom)); overscroll-behavior: contain; }

/* formularios estilo Ajustes */
.campo { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 16px; background: var(--card); position: relative; }
.campo::after { content: ""; position: absolute; left: 16px; right: 0; bottom: 0; height: 0.5px; background: var(--sep); }
.campo:last-child::after { display: none; }
.campo > label, .campo > span:first-child { flex-shrink: 0; min-width: 96px; }
.campo input, .campo select, .campo textarea { flex: 1; min-width: 0; border: 0; outline: 0; background: none; text-align: right; font-size: 17px; color: var(--label-2); padding: 11px 0; }
.campo input:focus, .campo textarea:focus { color: var(--label); }
.campo textarea { text-align: left; resize: none; min-height: 70px; }
.campo select { -webkit-appearance: none; appearance: none; direction: rtl; cursor: pointer; }
.campo input[type="date"], .campo input[type="datetime-local"] { -webkit-appearance: none; appearance: none; }

.interruptor { position: relative; width: 51px; height: 31px; flex-shrink: 0; }
.interruptor input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.interruptor i { position: absolute; inset: 0; border-radius: 16px; background: var(--fill-2); transition: background 0.25s; }
.interruptor i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 3px 1px rgba(0, 0, 0, 0.06); transition: transform 0.3s var(--spring); }
.interruptor input:checked + i { background: var(--green); }
.interruptor input:checked + i::after { transform: translateX(20px); }

.boton { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 50px; border-radius: 14px; font-size: 17px; font-weight: 600; background: var(--accent); color: #fff; transition: transform 0.2s var(--spring), opacity 0.2s; }
.boton:active { transform: scale(0.97); opacity: 0.85; }
.boton:disabled { opacity: 0.4; }
.boton.suave { background: var(--accent-soft); color: var(--accent); }
.boton.peligro { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); }
.botones-par { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* editor de movimiento: cifra grande + teclado */
.editor-tipo { max-width: 260px; margin: 0 auto 6px; }
.editor-cifra { text-align: center; padding: 14px 0 8px; }
.editor-cifra .valor { font-size: 56px; font-weight: 700; letter-spacing: -2px; line-height: 1; font-variant-numeric: tabular-nums; transition: color 0.2s, font-size 0.2s; display: inline-flex; align-items: baseline; }
.editor-cifra .valor .signo { font-size: 0.6em; color: var(--label-2); margin-right: 2px; font-weight: 600; }
.editor-cifra .valor.vacio { color: var(--label-3); }
.editor-cifra .valor .cursor { width: 3px; height: 0.9em; background: var(--accent); margin-left: 3px; border-radius: 2px; animation: parpadeo 1s steps(1) infinite; align-self: center; }
.editor-cifra .valor.sacudir { animation: sacudir 0.4s; }
.editor-cifra small { display: block; font-size: 13px; color: var(--label-2); margin-top: 6px; min-height: 16px; }
.cat-selector { display: flex; gap: 8px; overflow-x: auto; padding: 8px 16px 12px; margin: 0 -16px; scrollbar-width: none; }
.cat-selector::-webkit-scrollbar { display: none; }
.cat-op { flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 5px; width: 70px; font-size: 11px; color: var(--label-2); text-align: center; transition: transform 0.25s var(--spring); }
.cat-op .icono-cat { width: 50px; height: 50px; border-radius: 16px; font-size: 24px; transition: box-shadow 0.2s, transform 0.3s var(--bounce); }
.cat-op.activa { color: var(--label); font-weight: 600; }
.cat-op .icono-cat { transition: background 0.25s, box-shadow 0.25s, transform 0.35s var(--bounce); }
.cat-op.activa .icono-cat { background: var(--c); box-shadow: 0 6px 16px -6px var(--c); transform: scale(1.08); }
.cat-op > span:last-child { line-height: 1.15; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.teclado { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.tecla { height: 52px; border-radius: 12px; background: var(--card); font-size: 25px; font-weight: 400; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08); transition: background 0.1s, transform 0.12s; display: grid; place-items: center; }
.tecla:active { background: var(--fill-2); transform: scale(0.96); }
.tecla.fn { background: transparent; box-shadow: none; font-size: 17px; }
.tecla svg { width: 24px; height: 24px; }

/* ---------- bloqueo con PIN ---------- */
.bloqueo { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: calc(var(--safe-top) + 20px) 20px calc(var(--safe-bottom) + 20px); color: #fff; overflow: hidden;
  background: radial-gradient(120% 80% at 20% 0%, #7a5cff 0%, transparent 60%), radial-gradient(100% 70% at 100% 100%, #ff375f 0%, transparent 55%), linear-gradient(160deg, #2b1a6b, #120c2e 70%);
  transition: opacity 0.6s var(--ease), transform 0.7s var(--spring); }
.bloqueo.saliendo { opacity: 0; transform: scale(1.08); pointer-events: none; }
.bloqueo .orbe { position: absolute; border-radius: 50%; filter: blur(50px); opacity: 0.55; animation: orbitar 16s ease-in-out infinite alternate; }
.bloqueo .orbe.a { width: 320px; height: 320px; background: #5e5ce6; top: -80px; left: -60px; }
.bloqueo .orbe.b { width: 280px; height: 280px; background: #ff375f; bottom: -60px; right: -80px; animation-delay: -6s; }
.bloqueo .orbe.c { width: 200px; height: 200px; background: #ff9f0a; bottom: 30%; left: 30%; opacity: 0.25; animation-delay: -10s; }
@keyframes orbitar { to { transform: translate(60px, 40px) scale(1.2); } }
.bloqueo-cont { position: relative; display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 320px; }
.bloqueo .hora { font-size: 15px; font-weight: 600; opacity: 0.8; }
.bloqueo h1 { font-size: 22px; font-weight: 600; margin: 14px 0 22px; letter-spacing: -0.2px; text-align: center; }
.puntos-pin { display: flex; gap: 20px; margin-bottom: 36px; height: 14px; }
.puntos-pin i { width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, 0.9); transition: background 0.15s, transform 0.25s var(--bounce); }
.puntos-pin i.lleno { background: #fff; transform: scale(1.1); }
.puntos-pin.sacudir { animation: sacudir 0.5s; }
@keyframes sacudir { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(5px); } 30%, 50%, 70% { transform: translateX(-10px); } 40%, 60% { transform: translateX(10px); } }
.teclado-pin { display: grid; grid-template-columns: repeat(3, 78px); gap: 16px 24px; }
.tecla-pin { width: 78px; height: 78px; border-radius: 50%; background: rgba(255, 255, 255, 0.14); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; transition: background 0.35s; }
.tecla-pin:active { background: rgba(255, 255, 255, 0.45); transition: background 0s; }
.tecla-pin b { font-size: 34px; font-weight: 400; line-height: 1; }
.tecla-pin small { font-size: 10px; letter-spacing: 2px; font-weight: 600; opacity: 0.8; margin-top: 1px; min-height: 12px; }
.tecla-pin.vacia { background: none; pointer-events: none; }
.tecla-pin.texto { background: none; font-size: 17px; }
.bloqueo .error { min-height: 20px; margin-top: 22px; font-size: 15px; opacity: 0.9; }

/* ---------- aviso tipo Dynamic Island ---------- */
.isla { position: fixed; z-index: 200; top: calc(var(--safe-top) + 10px); left: 50%; transform: translateX(-50%) translateY(-120%) scale(0.6); min-width: 120px; max-width: min(92vw, 420px); padding: 12px 18px 12px 12px; border-radius: 28px; background: #000; color: #fff; display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 500; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); transition: transform 0.55s var(--bounce), opacity 0.3s; opacity: 0; pointer-events: none; }
.isla.visible { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; pointer-events: auto; }
.isla .ic { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; background: var(--green); }
.isla .ic.rojo { background: var(--red); }
.isla .ic.azul { background: var(--accent); }
.isla .ic svg { width: 16px; height: 16px; }
.isla button { color: #0a84ff; font-weight: 600; margin-left: 6px; }
:root[data-theme="dark"] .isla { background: #1c1c1e; border: 0.5px solid rgba(255,255,255,0.15); }

/* alerta estilo iOS */
.alerta { position: fixed; z-index: 150; top: 50%; left: 50%; width: 270px; transform: translate(-50%, -50%) scale(1.15); opacity: 0; border-radius: 14px; overflow: hidden; background: var(--material); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%); text-align: center; transition: transform 0.35s var(--spring), opacity 0.2s; }
.alerta.visible { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.alerta-txt { padding: 19px 16px 18px; }
.alerta-txt b { display: block; font-size: 17px; font-weight: 600; }
.alerta-txt p { font-size: 13px; margin: 4px 0 0; line-height: 1.35; }
.alerta-btns { display: grid; grid-template-columns: 1fr 1fr; border-top: 0.5px solid var(--sep); }
.alerta-btns button { height: 44px; color: var(--blue); font-size: 17px; }
.alerta-btns button + button { border-left: 0.5px solid var(--sep); font-weight: 600; }
.alerta-btns button.rojo { color: var(--red); }
.alerta-fondo { z-index: 149; }

/* esqueleto de carga */
.esqueleto { background: linear-gradient(90deg, var(--fill) 25%, var(--fill-2) 50%, var(--fill) 75%); background-size: 200% 100%; animation: brillo 1.4s infinite; border-radius: 12px; }
@keyframes brillo { to { background-position: -200% 0; } }

/* entrada en cascada de bloques */
.cascada > * { animation: subir 0.6s var(--spring) both; }
.cascada > *:nth-child(2) { animation-delay: 0.04s; }
.cascada > *:nth-child(3) { animation-delay: 0.08s; }
.cascada > *:nth-child(4) { animation-delay: 0.12s; }
.cascada > *:nth-child(5) { animation-delay: 0.16s; }
.cascada > *:nth-child(6) { animation-delay: 0.2s; }
.cascada > *:nth-child(7) { animation-delay: 0.24s; }
.cascada > *:nth-child(n + 8) { animation-delay: 0.28s; }
@keyframes subir { from { opacity: 0; transform: translateY(18px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------- ajustes finos ---------- */
.campo > label.interruptor { min-width: 51px; flex: 0 0 51px; }
.mov-fila .accion-borrar { opacity: 0; transition: opacity 0.15s; }
.mov-fila.abriendo .accion-borrar { opacity: 1; }
.fila-sub.envuelve { white-space: normal; }
.editor-fecha { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; height: 30px; padding: 0 12px; border-radius: 999px; background: var(--fill); font-size: 14px; color: var(--label-2); position: relative; }
.editor-fecha svg { width: 15px; height: 15px; }
.editor-fecha input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.editor-cifra { padding: 8px 0 4px; }
.editor-extra .campo { min-height: 42px; }
.teclado { margin-top: 12px; }
@media (max-height: 760px) { .tecla { height: 46px; } .editor-cifra .valor { font-size: 48px; } .cat-op .icono-cat { width: 44px; height: 44px; } }
@media (min-width: 700px) {
  .ideas { margin: 0; padding: 0; overflow: visible; flex-wrap: wrap; }
  .idea { flex: 1 1 240px; max-width: none; }
}
@media (max-height: 700px) {
  .editor-cifra { padding: 2px 0 0; }
  .editor-cifra .valor { font-size: 44px; }
  .editor-fecha { margin-top: 6px; height: 28px; }
  .cat-selector { padding-bottom: 8px; }
  .cat-op .icono-cat { width: 42px; height: 42px; font-size: 21px; border-radius: 13px; }
  .editor-extra .campo { min-height: 40px; }
  .teclado { gap: 6px; margin-top: 8px; }
  .tecla { height: 44px; }
}
.tarjeta-accion .fila-cuerpo { overflow: hidden; }
.tarjeta-accion .fila-sub, .tarjeta-accion .fila-titulo { overflow: hidden; text-overflow: ellipsis; }

/* ---------- sin zoom en iOS ---------- */
/* doble toque no amplía; los campos con letra < 16px hacen que Safari haga zoom al enfocarlos */
html, body { touch-action: manipulation; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
input, select, textarea { font-size: max(16px, 1em); }
.hoja input.celda, .hoja select.celda { font-size: 16px; }

/* íconos dentro de botones grandes y foco sin el contorno azul del navegador */
.boton svg { width: 20px; height: 20px; flex-shrink: 0; }
.boton.peligro { margin-top: 22px; }
button:focus { outline: none; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- recorrido guiado ---------- */
.tour { position: fixed; inset: 0; z-index: 300; opacity: 0; transition: opacity 0.4s var(--ease); }
.tour.visible { opacity: 1; }
.tour.saliendo { opacity: 0; pointer-events: none; }
.tour-velo { position: absolute; inset: 0; background: rgba(0, 0, 0, 0); transition: background 0.5s var(--ease), backdrop-filter 0.5s; }
.tour-velo.lleno { background: rgba(10, 8, 30, 0.55); -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%); }
.tour-foco {
  position: absolute; left: 50%; top: 50%; width: 0; height: 0; border-radius: 22px; cursor: pointer;
  box-shadow: 0 0 0 9999px rgba(10, 8, 30, 0.62), 0 0 0 2px rgba(255, 255, 255, 0.9), 0 0 40px 6px rgba(191, 90, 242, 0.55);
  transition: left 0.6s var(--spring), top 0.6s var(--spring), width 0.6s var(--spring), height 0.6s var(--spring), border-radius 0.6s var(--spring), opacity 0.35s;
}
.tour-foco.oculto { opacity: 0; }
.tour-pulso { position: absolute; inset: -2px; border-radius: inherit; border: 2px solid rgba(255, 255, 255, 0.8); animation: tourPulso 1.8s var(--ease) infinite; pointer-events: none; }
@keyframes tourPulso { 0% { transform: scale(1); opacity: 0.9; } 100% { transform: scale(1.18); opacity: 0; } }

.tour-tarjeta {
  position: absolute; width: min(360px, calc(100vw - 32px)); padding: 20px 20px 16px; border-radius: 26px;
  background: var(--material); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
  border: 0.5px solid var(--material-border); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.55);
  color: var(--label); touch-action: pan-y;
  transition: left 0.55s var(--spring), top 0.55s var(--spring), transform 0.45s var(--spring), opacity 0.25s;
}
.tour-tarjeta.centro { left: 50% !important; top: 50% !important; transform: translate(-50%, -50%); width: min(380px, calc(100vw - 32px)) !important; text-align: center; padding-top: 28px; }
.tour-tarjeta.cambiando .tour-cuerpo { opacity: 0; transform: translateX(calc(var(--dir, 1) * 24px)); }
.tour-cuerpo { transition: opacity 0.3s var(--ease), transform 0.45s var(--spring); }
.tour-emoji { font-size: 34px; line-height: 1; display: inline-block; animation: tourSaludo 0.9s var(--bounce) both; }
.tour-emoji.grande { font-size: 64px; margin-bottom: 6px; animation: tourMano 1.6s ease-in-out 0.3s 2 both; transform-origin: 70% 80%; }
@keyframes tourSaludo { from { transform: scale(0.3) rotate(-20deg); opacity: 0; } }
@keyframes tourMano { 0%, 100% { transform: rotate(0); } 20%, 60% { transform: rotate(16deg); } 40%, 80% { transform: rotate(-10deg); } }
.tour-paso { font-size: 12px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 10px; min-height: 14px; }
.tour-tarjeta.centro .tour-paso { display: none; }
.tour-tarjeta h3 { margin: 4px 0 6px; font-size: 21px; letter-spacing: -0.4px; }
.tour-tarjeta p { margin: 0; font-size: 15.5px; line-height: 1.42; color: var(--label-2); }
.tour-pie { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; gap: 12px; }
.tour-tarjeta.centro .tour-pie { flex-direction: column-reverse; }
.tour-puntos { display: flex; gap: 5px; flex-wrap: wrap; }
.tour-puntos i { width: 6px; height: 6px; border-radius: 3px; background: var(--fill-2); transition: width 0.4s var(--spring), background 0.3s; }
.tour-puntos i.hecho { background: color-mix(in srgb, var(--accent) 45%, transparent); }
.tour-puntos i.activo { width: 20px; background: var(--accent); }
.tour-botones { display: flex; gap: 8px; align-items: center; }
.tour-tarjeta.centro .tour-botones { width: 100%; }
.tour-atras { width: 40px; height: 40px; border-radius: 50%; background: var(--fill); color: var(--label); display: grid; place-items: center; transition: transform 0.2s var(--spring); }
.tour-atras svg { width: 16px; height: 16px; }
.tour-sig { height: 40px; padding: 0 20px; border-radius: 999px; font-size: 16px; font-weight: 600; color: #fff; background: linear-gradient(135deg, #5e5ce6, #bf5af2); box-shadow: 0 8px 20px -8px rgba(94, 92, 230, 0.8); transition: transform 0.2s var(--spring); }
.tour-tarjeta.centro .tour-sig { flex: 1; height: 50px; font-size: 17px; }
.tour-atras:active, .tour-sig:active { transform: scale(0.94); }
.tour-saltar { position: absolute; top: 14px; right: 16px; font-size: 14px; color: var(--label-2); }
.tour-confeti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.tour-puntos { flex-wrap: nowrap; gap: 4px; }
.tour-puntos i { width: 5px; height: 5px; flex-shrink: 0; }
.tour-puntos i.activo { width: 16px; }

/* ---------- ritmo de gasto ---------- */
.ritmo-cab { display: flex; justify-content: space-between; align-items: center; font-size: 15px; color: var(--label-2); font-weight: 500; }
.ritmo-estado { font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.ritmo-estado.verde { color: var(--green); background: color-mix(in srgb, var(--green) 14%, transparent); }
.ritmo-estado.naranja { color: var(--orange); background: color-mix(in srgb, var(--orange) 15%, transparent); }
.ritmo-estado.rojo { color: var(--red); background: color-mix(in srgb, var(--red) 13%, transparent); }
.ritmo-estado.gris { color: var(--label-2); background: var(--fill); }
.ritmo-cifra { margin-top: 8px; }
.ritmo-cifra b { font-size: 26px; letter-spacing: -0.6px; }
.ritmo-cifra span { font-size: 14px; color: var(--label-2); }
.ritmo-pista { position: relative; height: 14px; border-radius: 7px; background: var(--fill); margin-top: 14px; }
.ritmo-pista i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 7px; transition: width 1.2s var(--spring);
  background: linear-gradient(90deg, color-mix(in srgb, var(--green) 70%, #fff), var(--green)); }
.ritmo-pista.naranja i { background: linear-gradient(90deg, #ffd60a, var(--orange)); }
.ritmo-pista.rojo i { background: linear-gradient(90deg, var(--orange), var(--red)); }
.ritmo-pista u { position: absolute; top: -5px; bottom: -5px; width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--label); text-decoration: none; }
.ritmo-pista u em { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 11px; font-style: normal; font-weight: 600; color: var(--label-2); white-space: nowrap; }
.ritmo-escala { display: flex; justify-content: space-between; font-size: 11px; color: var(--label-3); margin-top: 5px; }
.ritmo-nota { font-size: 14px; color: var(--label-2); margin: 10px 0 0; line-height: 1.35; }
.ritmo-ahorro { display: flex; gap: 12px; align-items: center; margin-top: 16px; padding-top: 14px; border-top: 0.5px solid var(--sep); }
.ritmo-ahorro-fila { display: flex; justify-content: space-between; font-size: 15px; }
.ritmo-ahorro-fila small { color: var(--label-2); font-weight: 500; }
.ritmo-ahorro .barrita { height: 6px; border-radius: 3px; background: var(--fill); margin-top: 7px; overflow: hidden; }
.ritmo-ahorro .barrita i { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--c); transition: width 1s var(--spring); }

/* ---------- últimos 6 meses ---------- */
.meses-info { margin-bottom: 8px; min-height: 64px; }
.meses-titulo { font-size: 13px; color: var(--label-2); text-transform: capitalize; }
.meses-cifras { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 4px; }
.meses-cifras span { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--label-2); }
.meses-cifras span i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.meses-cifras b { font-size: 17px; letter-spacing: -0.3px; display: block; margin-top: 1px; white-space: nowrap; }
.meses-svg { touch-action: pan-y; cursor: pointer; }
.meses-svg .mes-grupo .barra { opacity: 0.45; transition: opacity 0.25s; }
.meses-svg .mes-grupo.elegido .barra { opacity: 1; }
.meses-svg .mes-fondo { fill: transparent; transition: fill 0.25s; }
.meses-svg .mes-grupo.elegido .mes-fondo { fill: var(--fill); }
.meses-svg .mes-valor { font-size: 10px; font-weight: 600; fill: var(--label-2); opacity: 0; transition: opacity 0.25s; }
.meses-svg .mes-grupo.elegido .mes-valor { opacity: 1; }
.meses-svg .mes-grupo.elegido .mes-eje { fill: var(--label); font-weight: 600; }
.meses-pista { font-size: 12px; color: var(--label-3); text-align: center; margin-top: 4px; }
