@font-face { font-family: "Jakarta"; src: url("/fonts/jakarta.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }

:root {
  --bg: #F5F6FB;
  --surface: #FFFFFF;
  --surface-2: #F0F1F8;
  --line: #E6E8F2;
  --text: #12132A;
  --muted: #6B6F8E;
  --primary: #5B4CF0;
  --primary-2: #7C5CFA;
  --primary-soft: #ECE9FF;
  --in: #0FA37F;
  --in-soft: #DDF6EE;
  --out: #F04466;
  --out-soft: #FDE6EB;
  --amber: #F5A524;
  --amber-soft: #FFF2D9;
  --grad: linear-gradient(135deg, #4F46E5 0%, #7C3AED 55%, #C026D3 100%);
  --shadow: 0 1px 2px rgba(18,19,42,.04), 0 8px 24px -12px rgba(18,19,42,.12);
  --font: "Jakarta", system-ui, -apple-system, "Segoe UI", sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 10px; }
h1, h2, h3, p { margin: 0; }
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.money { font-variant-numeric: tabular-nums; letter-spacing: -0.02em; font-weight: 700; }

#app { max-width: 520px; margin: 0 auto; padding: calc(14px + var(--safe-t)) 18px calc(110px + var(--safe-b)); }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 17px; flex: none; }
.topbar .hi { flex: 1; min-width: 0; }
.topbar .hi small { display: block; color: var(--muted); font-size: 13px; font-weight: 500; }
.topbar .hi b { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; }
.iconbtn { width: 44px; height: 44px; border-radius: 14px; background: var(--surface); display: grid; place-items: center; color: var(--text); box-shadow: var(--shadow); }
.iconbtn:active { transform: scale(.96); }
.page-title { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; margin: 2px 0 4px; }
.page-sub { color: var(--muted); font-size: 15px; margin-bottom: 18px; }

.monthbar { display: flex; align-items: center; justify-content: space-between; background: var(--surface); border-radius: 18px; padding: 6px; box-shadow: var(--shadow); margin-bottom: 16px; }
.monthbar button { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--muted); }
.monthbar button:active { background: var(--surface-2); }
.monthbar span { font-weight: 700; }

/* ---------- balance card ---------- */
.balance { position: relative; overflow: hidden; background: var(--grad); color: #fff; border-radius: 28px; padding: 22px 22px 18px; box-shadow: 0 20px 40px -20px rgba(91,76,240,.7); }
.balance::before, .balance::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255,255,255,.10); pointer-events: none; }
.balance::before { width: 220px; height: 220px; right: -70px; top: -90px; }
.balance::after { width: 140px; height: 140px; right: 40px; bottom: -80px; background: rgba(255,255,255,.07); }
.balance .lbl { font-size: 14px; font-weight: 500; opacity: .85; }
.balance .amount { font-size: clamp(38px, 11vw, 48px); line-height: 1.1; margin: 4px 0 16px; }
.balance .amount.neg { color: #FFD1DC; }
.pills { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; position: relative; z-index: 1; }
.pill { background: rgba(255,255,255,.16); backdrop-filter: blur(8px); border-radius: 18px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; }
.pill .dot { width: 32px; height: 32px; border-radius: 10px; background: rgba(255,255,255,.22); display: grid; place-items: center; }
.pill .dot svg.i { width: 18px; height: 18px; }
.pill small { display: block; font-size: 12px; opacity: .85; }
.pill b { font-size: 15px; }
.timeline { position: relative; z-index: 1; margin-top: 18px; }
.timeline .track { position: relative; height: 46px; }
.timeline .base { position: absolute; left: 0; right: 0; bottom: 10px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.22); }
.timeline .done { position: absolute; left: 0; bottom: 10px; height: 4px; border-radius: 4px; background: #fff; }
.timeline .pin { position: absolute; bottom: 10px; transform: translateX(-50%); width: 10px; display: flex; flex-direction: column; align-items: center; }
.timeline .pin i { width: 2px; height: var(--h); background: rgba(255,255,255,.55); }
.timeline .pin em { width: 10px; height: 10px; border-radius: 50%; background: #fff; margin-bottom: -1px; order: -1; }
.timeline .pin.past em { background: rgba(255,255,255,.4); }
.timeline .today { position: absolute; bottom: 4px; transform: translateX(-50%); width: 16px; height: 16px; border-radius: 50%; background: #FDE047; border: 3px solid #7C3AED; }
.timeline .ticks { display: flex; justify-content: space-between; font-size: 11px; opacity: .75; font-weight: 600; }

/* ---------- secciones y cards ---------- */
.sec { margin-top: 26px; }
.sec-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.sec-h h2 { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.sec-h small { color: var(--muted); font-weight: 600; font-size: 13px; }
.card { background: var(--surface); border-radius: 24px; box-shadow: var(--shadow); }
.list { padding: 6px; }
.item { display: flex; align-items: center; gap: 12px; padding: 10px; width: 100%; text-align: left; border-radius: 18px; }
button.item:active { background: var(--surface-2); }
.tile { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; flex: none; color: var(--c); background: color-mix(in srgb, var(--c) 14%, white); }
.tile svg.i { width: 20px; height: 20px; }
.item .tx { flex: 1; min-width: 0; }
.item .tx b { display: block; font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .tx span { font-size: 13px; color: var(--muted); }
.item .amt { font-weight: 800; font-size: 15px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.amt.in { color: var(--in); } .amt.out { color: var(--text); }
.date-chip { width: 44px; height: 48px; border-radius: 14px; background: var(--surface-2); display: grid; place-content: center; text-align: center; flex: none; line-height: 1.05; }
.date-chip b { font-size: 17px; font-weight: 800; } .date-chip span { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.date-chip.soon { background: var(--primary-soft); color: var(--primary); } .date-chip.soon span { color: var(--primary); }
.daylabel { font-size: 13px; color: var(--muted); font-weight: 700; padding: 16px 4px 8px; }
.daylabel::first-letter { text-transform: uppercase; }

.cats { padding: 18px; display: grid; gap: 16px; }
.cat { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: center; }
.cat .tile { width: 38px; height: 38px; border-radius: 12px; grid-row: span 2; }
.cat .n { font-weight: 700; font-size: 14px; } .cat .v { font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; }
.cat .t { grid-column: 2 / 4; height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.cat .t i { display: block; height: 100%; border-radius: 99px; background: var(--c); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.split .card { padding: 16px; }
.split span { color: var(--muted); font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.split .mini { width: 26px; height: 26px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 800; }
.split b { display: block; font-size: 20px; margin-top: 8px; }
.banner { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 20px; background: var(--amber-soft); color: #8A5A00; font-weight: 600; }
.banner b { margin-left: auto; color: var(--text); }

.empty { text-align: center; padding: 28px 22px; }
.empty .tile { margin: 0 auto 12px; width: 56px; height: 56px; border-radius: 18px; }
.empty h3 { font-size: 17px; font-weight: 800; margin-bottom: 6px; }
.empty p { color: var(--muted); font-size: 14px; margin-bottom: 16px; }

/* ---------- botones y forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 22px; border-radius: 16px; background: var(--primary); color: #fff; font-weight: 700; font-size: 15px; }
.btn:active { transform: scale(.98); }
.btn.grad { background: var(--grad); box-shadow: 0 10px 24px -12px rgba(91,76,240,.8); }
.btn.soft { background: var(--primary-soft); color: var(--primary); }
.btn.ghost { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--out-soft); color: var(--out); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn svg.i { width: 20px; height: 20px; }
.field { display: grid; gap: 8px; margin-bottom: 16px; }
.field > label, .field > .lbl { font-size: 13px; font-weight: 700; color: var(--muted); }
.field input, .field select, .field textarea { width: 100%; background: var(--surface-2); border: 2px solid transparent; border-radius: 16px; padding: 13px 16px; min-height: 52px; font-weight: 500; }
.field textarea { min-height: 140px; resize: vertical; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 0; border-color: var(--primary); background: var(--surface); }
.hint { font-size: 13px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 40px; padding: 0 16px; border-radius: 12px; background: var(--surface-2); font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.chip[aria-pressed="true"] { background: var(--primary); color: #fff; }
.seg { display: grid; grid-auto-flow: column; background: var(--surface-2); border-radius: 16px; padding: 4px; margin-bottom: 16px; }
.seg button { min-height: 44px; border-radius: 12px; font-weight: 700; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 6px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg button[data-t="out"][aria-pressed="true"] { color: var(--out); }
.seg button[data-t="in"][aria-pressed="true"] { color: var(--in); }

.preview { background: var(--surface); border-radius: 20px; border: 1px solid var(--line); padding: 4px; margin: 14px 0; }
.preview .item { padding: 8px; }
.preview .bad { background: var(--out-soft); color: var(--out); font-size: 14px; font-weight: 600; padding: 12px 14px; border-radius: 16px; margin: 4px; display: flex; align-items: center; gap: 8px; }
.preview .bad span { flex: 1; }
.preview select { border: 0; background: var(--surface-2); border-radius: 10px; padding: 5px 8px; font-size: 12px; font-weight: 600; max-width: 140px; margin-top: 4px; }
.preview input[type=number] { width: 52px; border: 0; background: var(--surface-2); border-radius: 8px; padding: 3px 6px; font-weight: 700; }
.preview .tx span { white-space: nowrap; }
.x { width: 36px; height: 36px; border-radius: 12px; color: var(--muted); display: grid; place-items: center; flex: none; }
.x:active { background: var(--surface-2); }
.x svg.i { width: 18px; height: 18px; }

/* ---------- planes ---------- */
.capacity { padding: 20px; }
.capacity .row1 { display: flex; align-items: center; gap: 14px; }
.capacity .ring { --p: 0; width: 72px; height: 72px; border-radius: 50%; flex: none; display: grid; place-items: center; background: conic-gradient(var(--primary) calc(var(--p) * 1%), var(--surface-2) 0); }
.capacity .ring div { width: 56px; height: 56px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-weight: 800; font-size: 15px; color: var(--primary); }
.capacity .ring svg.i { width: 26px; height: 26px; stroke-width: 2.6; }
.capacity small { color: var(--muted); font-size: 13px; font-weight: 600; }
.capacity .big { font-size: 26px; }
.capacity p { font-size: 14px; color: var(--muted); margin-top: 12px; }
.capacity p b { color: var(--text); }
.sim { margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line); }
.sim label { font-weight: 700; font-size: 14px; }
.sim label b { color: var(--primary); }
.sim input[type=range] { width: 100%; accent-color: var(--primary); height: 32px; }
.sim .out { display: grid; gap: 6px; font-size: 14px; }
.sim .out span { display: flex; align-items: center; gap: 8px; }
.sim .ok { color: var(--in); } .sim .late { color: var(--out); }
.plan { overflow: hidden; margin-bottom: 14px; }
.plan .cover { height: 96px; background: var(--g); position: relative; display: flex; align-items: flex-end; padding: 14px 18px; }
.plan .cover .em { font-size: 44px; line-height: 1; filter: drop-shadow(0 6px 10px rgba(0,0,0,.18)); }
.plan .cover .when { position: absolute; top: 12px; right: 12px; background: rgba(255,255,255,.9); color: var(--text); font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 99px; }
.plan .body { padding: 16px 18px 18px; }
.plan h3 { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; }
.meter { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: 14px 0 8px; }
.meter i { display: block; height: 100%; background: var(--grad); border-radius: 99px; }
.plan.done .meter i { background: var(--in); }
.plan .nums { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); font-weight: 600; }
.plan .nums b { color: var(--text); }
.need { margin-top: 14px; background: var(--surface-2); border-radius: 18px; padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.need small { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.need b { font-size: 20px; }
.tag { font-size: 12px; font-weight: 800; padding: 6px 10px; border-radius: 99px; white-space: nowrap; }
.tag.ok { background: var(--in-soft); color: var(--in); } .tag.tight { background: var(--amber-soft); color: #A16207; } .tag.late { background: var(--out-soft); color: var(--out); }
.items { margin: 12px 0 0; padding: 0; list-style: none; font-size: 14px; }
.items li { display: flex; justify-content: space-between; padding: 7px 0; border-top: 1px solid var(--line); color: var(--muted); font-weight: 500; }
.items li b { color: var(--text); font-variant-numeric: tabular-nums; }
.plan .acts { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 16px; }
.plan .acts .btn { min-height: 48px; }

/* ---------- navegación ---------- */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: rgba(255,255,255,.92); backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.tabs nav { display: grid; grid-template-columns: repeat(4, 1fr); max-width: 520px; margin: 0 auto; }
.tabs button { padding: 10px 0 10px; display: grid; justify-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
.tabs .ind { width: 60px; height: 32px; border-radius: 99px; display: grid; place-items: center; transition: background .2s; }
.tabs button[aria-current="page"] { color: var(--text); }
.tabs button[aria-current="page"] .ind { background: var(--primary-soft); color: var(--primary); }
.fab { position: fixed; right: max(18px, calc(50% - 242px)); bottom: calc(84px + var(--safe-b)); z-index: 21; height: 56px; padding: 0 22px 0 18px; border-radius: 18px; background: var(--grad); color: #fff; font-weight: 800; display: flex; align-items: center; gap: 8px; box-shadow: 0 14px 30px -12px rgba(91,76,240,.9); }
.fab:active { transform: scale(.97); }

/* ---------- sheet ---------- */
.scrim { position: fixed; inset: 0; background: rgba(18,19,42,.45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; animation: fade .18s ease-out; }
.sheet { background: var(--surface); width: 100%; max-width: 520px; max-height: 92dvh; overflow: auto; border-radius: 28px 28px 0 0; padding: 10px 20px calc(24px + var(--safe-b)); animation: up .24s cubic-bezier(.2,.9,.3,1); }
.sheet .grab { width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto 16px; }
.sheet h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; margin-bottom: 16px; }
@keyframes up { from { transform: translateY(40px); opacity: .6; } }
@keyframes fade { from { opacity: 0; } }

#toast { position: fixed; left: 50%; bottom: calc(156px + var(--safe-b)); transform: translateX(-50%) translateY(10px); background: var(--text); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 700; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; max-width: 90vw; display: flex; gap: 8px; align-items: center; }
#toast.show { opacity: 1; transform: translateX(-50%); }

/* ---------- login ---------- */
.login-wrap { min-height: 100dvh; background: var(--grad); display: flex; flex-direction: column; justify-content: flex-end; }
.login-hero { color: #fff; padding: calc(48px + var(--safe-t)) 28px 28px; max-width: 520px; width: 100%; margin: 0 auto; flex: 1; display: flex; flex-direction: column; justify-content: center; }
.login-hero .logo { width: 64px; height: 64px; border-radius: 20px; background: rgba(255,255,255,.2); display: grid; place-items: center; margin-bottom: 22px; }
.login-hero .logo svg.i { width: 32px; height: 32px; }
.login-hero h1 { font-size: 38px; line-height: 1.05; font-weight: 800; letter-spacing: -0.03em; }
.login-hero p { opacity: .85; margin-top: 10px; font-size: 16px; }
.login { background: var(--surface); border-radius: 32px 32px 0 0; padding: 28px 24px calc(28px + var(--safe-b)); max-width: 520px; width: 100%; margin: 0 auto; }
.login .err { color: var(--out); min-height: 22px; margin-bottom: 8px; font-weight: 700; font-size: 14px; }

@media (min-width: 560px) { .login { border-radius: 32px; margin-bottom: 40px; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

em.cash { font-style: normal; font-size: 11px; font-weight: 800; color: #15803D; background: #DCFCE7; padding: 2px 7px; border-radius: 99px; margin-left: 4px; }
.banner.cashbar { background: #DCFCE7; color: #166534; font-size: 14px; }
