/* ════════ Deuda de mami — dark fintech ════════ */
:root {
  --bg: #0a0e1a;
  --bg2: #0e1426;
  --card: rgba(255, 255, 255, 0.045);
  --card-border: rgba(255, 255, 255, 0.09);
  --txt: #eef1f8;
  --muted: #8b93a7;
  --violet: #8b5cf6;
  --violet2: #c084fc;
  --green: #34d399;
  --red: #f87171;
  --amber: #fbbf24;
  --blue: #60a5fa;
  --radius: 20px;
  font-size: 16px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(139, 92, 246, 0.18), transparent 60%),
    radial-gradient(900px 400px at -10% 30%, rgba(96, 165, 250, 0.10), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
  background-attachment: fixed;
  color: var(--txt);
  min-height: 100dvh;
  line-height: 1.45;
}
.app { max-width: 580px; margin: 0 auto; padding: 18px 16px 0; display: flex; flex-direction: column; gap: 14px; }
h1 { font-size: 1.45rem; letter-spacing: -0.02em; }
h2 { font-size: 0.95rem; font-weight: 600; letter-spacing: -0.01em; }
.muted { color: var(--muted); font-size: 0.8rem; }
.heart { display: inline-block; animation: beat 2.4s ease-in-out infinite; transform-origin: center; }
@keyframes beat { 0%, 100% { transform: scale(1); } 12% { transform: scale(1.18); } 24% { transform: scale(1); } 36% { transform: scale(1.12); } 48% { transform: scale(1); } }

/* ── loader ── */
.loader { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: var(--bg); z-index: 100; color: var(--muted); transition: opacity .35s; }
.loader-heart { font-size: 3rem; animation: beat 1.2s infinite; }
.loader.out { opacity: 0; pointer-events: none; }

/* ── header ── */
.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding-top: 6px; }
.sub { color: var(--muted); font-size: 0.8rem; margin-top: 2px; }
.icon-btn { background: var(--card); border: 1px solid var(--card-border); color: var(--muted); width: 38px; height: 38px; border-radius: 12px; font-size: 1rem; cursor: pointer; flex-shrink: 0; transition: all .2s; }
.icon-btn:active { transform: scale(0.92); }

/* ── cards ── */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; width: 100%; }
.collapsible { background: none; border: none; color: inherit; cursor: pointer; font: inherit; padding: 0; margin-bottom: 0; }
.collapsible h2 { pointer-events: none; }
.chev { display: inline-block; transition: transform .25s; }
.chev.open { transform: rotate(180deg); }

/* ── banner estado ── */
.banner { border-radius: var(--radius); padding: 14px 16px; font-size: 0.9rem; font-weight: 500; display: flex; gap: 10px; align-items: flex-start; border: 1px solid; animation: fadeUp .5s ease both; }
.banner .big { font-size: 1.3rem; line-height: 1; margin-top: 2px; }
.banner small { display: block; font-weight: 400; opacity: 0.85; margin-top: 3px; font-size: 0.78rem; }
.banner.ok { background: rgba(52, 211, 153, 0.10); border-color: rgba(52, 211, 153, 0.35); color: #a7f3d0; }
.banner.mora { background: rgba(248, 113, 113, 0.12); border-color: rgba(248, 113, 113, 0.4); color: #fecaca; }
.banner.hoy { background: rgba(251, 191, 36, 0.10); border-color: rgba(251, 191, 36, 0.35); color: #fde68a; }
.banner.fin { background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(52, 211, 153, 0.2)); border-color: rgba(192, 132, 252, 0.5); color: #f3e8ff; }

/* ── hero ── */
.hero { background: linear-gradient(135deg, rgba(139, 92, 246, 0.22) 0%, rgba(99, 102, 241, 0.12) 55%, rgba(255, 255, 255, 0.04) 100%); border-color: rgba(139, 92, 246, 0.35); position: relative; overflow: hidden; animation: fadeUp .5s .05s ease both; }
.hero::after { content: ""; position: absolute; top: -60%; right: -20%; width: 60%; height: 160%; background: radial-gradient(closest-side, rgba(192, 132, 252, 0.25), transparent); pointer-events: none; }
.hero-label { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; }
.hero-amount { font-size: clamp(2.2rem, 9vw, 3rem); font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; margin: 2px 0 12px; }
.progress { height: 10px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.progress-fill { height: 100%; width: 0%; border-radius: 99px; background: linear-gradient(90deg, var(--violet), var(--violet2), var(--green)); transition: width 1.2s cubic-bezier(.22, 1, .36, 1); box-shadow: 0 0 14px rgba(139, 92, 246, 0.6); }
.hero-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 9px; font-size: 0.8rem; flex-wrap: wrap; }

/* ── stats grid ── */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--card-border); border-radius: 16px; padding: 13px 14px; animation: fadeUp .5s ease both; }
.stat .k { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; display: flex; gap: 5px; align-items: center; }
.stat .v { font-size: 1.12rem; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.stat .s { color: var(--muted); font-size: 0.74rem; margin-top: 2px; }
.stat .v.green { color: var(--green); }
.stat .v.red { color: var(--red); }
.stat .v.amber { color: var(--amber); }

/* ── chart ── */
.chart-card { animation: fadeUp .5s .1s ease both; }
.chart svg { width: 100%; height: auto; display: block; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 99px; }
.dot-real { background: var(--violet2); }
.dot-proy { background: rgba(139, 92, 246, 0.4); }

/* ── historial ── */
.historial { display: flex; flex-direction: column; gap: 10px; }
.pago { background: rgba(255, 255, 255, 0.03); border: 1px solid var(--card-border); border-radius: 14px; padding: 12px 13px; animation: fadeUp .4s ease both; }
.pago-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.pago-monto { font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.pago-fecha { color: var(--muted); font-size: 0.76rem; }
.pago-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.tag { font-size: 0.68rem; padding: 3px 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.06); color: var(--muted); border: 1px solid rgba(255, 255, 255, 0.07); font-variant-numeric: tabular-nums; }
.tag.cap { color: #c4b5fd; border-color: rgba(139, 92, 246, 0.35); background: rgba(139, 92, 246, 0.12); }
.tag.extra { color: #6ee7b7; border-color: rgba(52, 211, 153, 0.35); background: rgba(52, 211, 153, 0.1); }
.tag.ahorro { color: #6ee7b7; font-weight: 600; }
.tag.costo { color: #fca5a5; }
.tag.cuota-ok { color: #93c5fd; border-color: rgba(96, 165, 250, 0.35); background: rgba(96, 165, 250, 0.1); }
.pago-nota { color: var(--muted); font-size: 0.76rem; margin-top: 7px; font-style: italic; }
.pago-del { background: none; border: none; color: rgba(248, 113, 113, 0.5); font-size: 0.8rem; cursor: pointer; padding: 2px 6px; border-radius: 8px; }
.pago-del:hover { background: rgba(248, 113, 113, 0.1); color: var(--red); }
.empty { text-align: center; color: var(--muted); padding: 18px 0; font-size: 0.85rem; }

/* ── proyección ── */
.proyeccion { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; max-height: 320px; overflow-y: auto; }
.proy-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 6px; border-bottom: 1px dashed rgba(255, 255, 255, 0.06); font-size: 0.84rem; }
.proy-row:last-child { border-bottom: none; }
.proy-row .n { color: var(--muted); width: 30px; }
.proy-row .f { flex: 1; }
.proy-row .m { font-variant-numeric: tabular-nums; font-weight: 600; }
.proy-row.fng-row .m::after { content: " 🛡️"; }

/* ── footer ── */
.foot { text-align: center; padding: 8px 0 12px; display: flex; flex-direction: column; gap: 4px; }
.foot p:first-child { color: var(--muted); font-size: 0.78rem; }

/* ── FAB ── */
.fab-space { height: 86px; }
.fab {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  width: min(548px, calc(100% - 32px));
  padding: 16px; border: none; border-radius: 18px;
  background: linear-gradient(135deg, var(--violet) 0%, #7c3aed 100%);
  color: white; font-size: 1.02rem; font-weight: 700; font-family: inherit;
  cursor: pointer; z-index: 40;
  box-shadow: 0 10px 30px rgba(139, 92, 246, 0.45), 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: transform .15s, box-shadow .15s;
}
.fab:active { transform: translateX(-50%) scale(0.97); }

/* ── modales ── */
.modal { position: fixed; inset: 0; background: rgba(5, 8, 16, 0.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: 60; display: flex; align-items: flex-end; justify-content: center; animation: fadeIn .2s ease; }
.modal-card { background: #131a2e; border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 24px 24px 0 0; padding: 20px 18px 26px; width: 100%; max-width: 580px; max-height: 92dvh; overflow-y: auto; animation: slideUp .3s cubic-bezier(.22, 1, .36, 1); }
@media (min-width: 620px) {
  .modal { align-items: center; }
  .modal-card { border-radius: 24px; }
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-head h2 { font-size: 1.15rem; }

.lbl { display: block; color: var(--muted); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.06em; margin: 12px 0 6px; }
.monto-wrap { display: flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, 0.05); border: 1.5px solid rgba(139, 92, 246, 0.4); border-radius: 16px; padding: 12px 16px; }
.monto-wrap:focus-within { border-color: var(--violet2); box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15); }
.monto-sign { font-size: 1.5rem; color: var(--muted); font-weight: 600; }
#montoInput { flex: 1; background: none; border: none; outline: none; color: var(--txt); font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; width: 100%; font-family: inherit; }
input[type="date"], input[type="text"], #pinInput { background: rgba(255, 255, 255, 0.05); border: 1px solid var(--card-border); border-radius: 12px; padding: 11px 12px; color: var(--txt); font-size: 0.9rem; width: 100%; outline: none; font-family: inherit; color-scheme: dark; }
input:focus { border-color: rgba(139, 92, 246, 0.5); }
.row2 { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.chip { background: rgba(139, 92, 246, 0.12); border: 1px solid rgba(139, 92, 246, 0.35); color: #d8c8ff; padding: 7px 12px; border-radius: 99px; font-size: 0.78rem; font-weight: 600; cursor: pointer; font-family: inherit; transition: all .15s; }
.chip:active { transform: scale(0.95); }
.chip.gold { background: rgba(251, 191, 36, 0.1); border-color: rgba(251, 191, 36, 0.4); color: #fde68a; }

.preview { margin-top: 14px; border-radius: 16px; padding: 13px 14px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--card-border); font-size: 0.84rem; display: flex; flex-direction: column; gap: 9px; animation: fadeUp .25s ease; }
.preview .pv-head { font-weight: 700; font-size: 0.92rem; }
.preview .pv-head.ok { color: var(--green); }
.preview .pv-head.warn { color: var(--amber); }
.preview .pv-head.fin { color: var(--violet2); }
.pv-rows { display: flex; flex-direction: column; gap: 4px; }
.pv-row { display: flex; justify-content: space-between; color: var(--muted); font-variant-numeric: tabular-nums; }
.pv-row b { color: var(--txt); font-weight: 600; }
.pv-impact { border-top: 1px dashed rgba(255, 255, 255, 0.1); padding-top: 9px; line-height: 1.5; }

.btn { border: none; border-radius: 14px; font-family: inherit; font-weight: 700; cursor: pointer; transition: all .15s; }
.btn-primary { background: linear-gradient(135deg, var(--violet), #7c3aed); color: white; padding: 13px 18px; font-size: 0.95rem; box-shadow: 0 6px 18px rgba(139, 92, 246, 0.35); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.btn-primary:not(:disabled):active { transform: scale(0.97); }
.btn-big { width: 100%; margin-top: 16px; padding: 15px; font-size: 1rem; }

/* ── resultado ── */
.resultado-card { text-align: center; }
.resultado-emoji { font-size: 3.4rem; margin: 6px 0 10px; animation: pop .45s cubic-bezier(.22, 1.6, .36, 1) both; }
.resultado-title { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.02em; }
.resultado-sub { color: var(--muted); font-size: 0.88rem; margin-top: 8px; line-height: 1.6; }
.resultado-sub b { color: var(--green); }
.resultado-stats { display: flex; gap: 8px; margin-top: 16px; }
.resultado-stats .stat { flex: 1; text-align: center; }

/* ── PIN ── */
.pin-gate { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); z-index: 90; padding: 20px; }
.pin-card { text-align: center; max-width: 320px; width: 100%; display: flex; flex-direction: column; gap: 12px; }
.pin-emoji { font-size: 3.5rem; animation: beat 2s infinite; }
.pin-card p { color: var(--muted); font-size: 0.88rem; }
#pinInput { text-align: center; font-size: 1.6rem; letter-spacing: 0.4em; padding: 14px; }
.pin-error { color: var(--red) !important; animation: shake .4s; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }

/* ── info modal ── */
.info-body { font-size: 0.86rem; display: flex; flex-direction: column; gap: 14px; color: #c8cede; }
.info-body h3 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--violet2); }
.info-body table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.info-body td { padding: 5px 0; border-bottom: 1px dashed rgba(255, 255, 255, 0.07); }
.info-body td:last-child { text-align: right; font-weight: 600; color: var(--txt); }
.info-body ul { padding-left: 18px; display: flex; flex-direction: column; gap: 6px; color: var(--muted); }
.info-nota { background: rgba(251, 191, 36, 0.07); border: 1px solid rgba(251, 191, 36, 0.25); color: #fde68a; border-radius: 12px; padding: 10px 12px; font-size: 0.78rem; }

/* ── confetti ── */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 200; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(40px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@keyframes pop { from { transform: scale(0.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 99px; }
