/* ===== Finanzas - estilos (mobile-first, look iOS, modo oscuro automatico) ===== */
:root {
  --bg: #f2f2f7; --card: #ffffff; --card2: #f7f7fa; --text: #1c1c1e; --muted: #8a8a8e; --sep: rgba(60, 60, 67, .13);
  --blue: #007aff; --green: #1f9d45; --green-bg: rgba(52, 199, 89, .14); --red: #e5372c; --red-bg: rgba(255, 59, 48, .12);
  --orange: #d97706; --orange-bg: rgba(255, 149, 0, .15); --gray: #9a9aa0; --gray-bg: rgba(142, 142, 147, .14);
  --tab-bg: rgba(249, 249, 251, .86); --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .05);
  --r: 16px; --r-sm: 11px;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --tabh: 58px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000; --card: #1c1c1e; --card2: #2c2c2e; --text: #f5f5f7; --muted: #8e8e93; --sep: rgba(84, 84, 88, .55);
    --blue: #0a84ff; --green: #30d158; --green-bg: rgba(48, 209, 88, .16); --red: #ff453a; --red-bg: rgba(255, 69, 58, .16);
    --orange: #ff9f0a; --orange-bg: rgba(255, 159, 10, .16); --gray: #8e8e93; --gray-bg: rgba(142, 142, 147, .2);
    --tab-bg: rgba(22, 22, 24, .86); --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #000; --card: #1c1c1e; --card2: #2c2c2e; --text: #f5f5f7; --muted: #8e8e93; --sep: rgba(84, 84, 88, .55);
    --blue: #0a84ff; --green: #30d158; --green-bg: rgba(48, 209, 88, .16); --red: #ff453a; --red-bg: rgba(255, 69, 58, .16);
    --orange: #ff9f0a; --orange-bg: rgba(255, 159, 10, .16); --gray: #8e8e93; --gray-bg: rgba(142, 142, 147, .2);
    --tab-bg: rgba(22, 22, 24, .86); --shadow: none;
    color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums; overscroll-behavior-y: none; min-height: 100vh; min-height: 100dvh;
}
body.logged { padding-bottom: calc(var(--tabh) + var(--safe-b) + 16px); }
body.sheet-open { overflow: hidden; }
body.has-sel { padding-bottom: calc(var(--tabh) + var(--safe-b) + 120px); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1, h2, h3, h4 { margin: 0; }
.pos { color: var(--green); } .neg { color: var(--red); } .blue { color: var(--blue); }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; }
b { font-weight: 650; }

#app { max-width: 1400px; margin: 0 auto; }
#view { padding: 0 16px; }
.view-inicio, .view-ahorro, .view-mas { max-width: 640px; margin: 0 auto; }

/* ---------- Barra superior ---------- */
.top { padding: calc(var(--safe-t) + 14px) 2px 10px; position: sticky; top: 0; z-index: 20; background: var(--bg); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.top h1 { font-size: 30px; font-weight: 750; letter-spacing: -.5px; }
.top-sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.sync-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); padding: 6px 10px; border-radius: 99px; background: var(--card); box-shadow: var(--shadow); }
.sync-chip svg { width: 14px; height: 14px; }
.sync-chip.stale { color: var(--orange); }
body.busy .sync-chip svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Tarjetas ---------- */
.card { background: var(--card); border-radius: var(--r); padding: 16px; margin: 12px 0; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; width: 100%; text-align: left; }
.card-head h2 { font-size: 17px; font-weight: 700; }
.card-head.toggle { margin-bottom: 0; }
.card.summary .card-head.toggle + * { margin-top: 12px; }
.caret { color: var(--muted); }
.link { color: var(--blue); font-size: 15px; font-weight: 500; }
.kv { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0; border-bottom: .5px solid var(--sep); font-size: 15px; }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }
.kv.big b { font-size: 18px; }
.kv.sub { padding: 2px 0 2px 14px; font-size: 13px; border-bottom: 0; }
.kv.sub span:last-child { color: var(--muted); }
.trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.trio div { background: var(--card2); border-radius: var(--r-sm); padding: 10px; min-width: 0; }
.trio span { display: block; font-size: 12px; color: var(--muted); }
.trio b { font-size: 14px; display: block; overflow-wrap: anywhere; line-height: 1.25; }
.stat2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.stat2 div { background: var(--card2); border-radius: var(--r-sm); padding: 10px 12px; }
.stat2 span { display: block; font-size: 12px; color: var(--muted); }
.stat2 b { font-size: 18px; }

.hero { border-radius: 22px; padding: 20px; margin: 6px 0 12px; color: #fff; background: linear-gradient(135deg, #0a7a5c, #11a37f 55%, #2fbf8f); box-shadow: 0 10px 30px rgba(16, 150, 110, .25); }
.hero.savings { background: linear-gradient(135deg, #3a3aa8, #5e5ce6 55%, #8e7cf0); box-shadow: 0 10px 30px rgba(94, 92, 230, .25); }
.hero-lbl { font-size: 14px; opacity: .85; }
.hero-amt { font-size: 38px; font-weight: 750; letter-spacing: -1px; margin: 2px 0 8px; }
.hero-amt.sm { font-size: 28px; margin: 0; }
.hero-amt.neg { color: #ffd1cc; }
.hero-row { display: flex; justify-content: space-between; font-size: 14px; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, .22); margin-top: 8px; }
.hero-row span { opacity: .85; }
.hero-row b.neg { color: #ffd1cc; }

.acc-scroll { display: flex; gap: 10px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 6px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.acc-scroll::-webkit-scrollbar { display: none; }
.acc { flex: 0 0 auto; min-width: 150px; max-width: 200px; scroll-snap-align: start; background: var(--card); border-radius: var(--r); padding: 12px 14px; text-align: left; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); border-top: 4px solid var(--c); }
.acc-tipo { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600; }
.acc-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-bal { font-size: 17px; font-weight: 700; }
.acc-bal.neg { color: var(--red); }
.acc.add { align-items: center; justify-content: center; color: var(--blue); border-top-color: transparent; min-width: 96px; font-weight: 600; font-size: 14px; }

.alert { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; border-radius: var(--r); padding: 12px 14px; margin: 10px 0; font-size: 15px; }
.alert small { font-size: 13px; opacity: .9; }
.alert.warn { background: var(--orange-bg); color: var(--text); }
.alert.warn b { color: var(--orange); }
.alert.danger { background: var(--red-bg); }
.alert.danger > span > b:first-child { color: var(--red); }
.alert.slim { padding: 9px 12px; }
.al-ico { font-size: 22px; }

.bars { margin-top: 12px; display: grid; gap: 7px; }
.barrow { display: grid; grid-template-columns: minmax(0, 40%) 1fr auto; gap: 8px; align-items: center; font-size: 13px; }
.bl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.bt { height: 8px; background: var(--card2); border-radius: 9px; overflow: hidden; }
.bt i { display: block; height: 100%; background: var(--red); opacity: .75; border-radius: 9px; }
.bv { font-weight: 600; }

.onboard { text-align: center; padding: 26px 20px; }
.onboard h2 { font-size: 22px; margin: 6px 0; }
.onboard p { color: var(--muted); margin: 0 0 18px; }
.onboard .btn { margin-top: 8px; }
.onb-emoji { font-size: 44px; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.empty.small { padding: 18px 10px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--sep); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 10px; }

/* ---------- Botones / formularios ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 11px 16px; border-radius: 12px; font-weight: 600; background: var(--card2); color: var(--blue); min-height: 44px; }
.btn.primary { background: var(--blue); color: #fff; }
.btn.big { width: 100%; padding: 14px; font-size: 17px; min-height: 52px; border-radius: 14px; margin-top: 8px; }
.btn.sm { padding: 8px 12px; min-height: 36px; font-size: 14px; border-radius: 10px; }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 1px var(--sep); }
.btn.danger-ghost { background: var(--red-bg); color: var(--red); }
.btn.wide { width: 100%; margin-top: 10px; }
.btn:disabled { opacity: .5; }
.btn:active, .tab:active, .acc:active, .mv:active, .li:active, .menu-item:active, .meta:active { transform: scale(.98); }
.btn-row { display: flex; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.btn-row > * { flex: 1 1 0; }
.btn-row.tight { margin: 4px 0 10px; }
.pill { padding: 7px 13px; border-radius: 99px; font-size: 14px; font-weight: 600; background: var(--card); color: var(--blue); box-shadow: var(--shadow); white-space: nowrap; }
.pill.accent { background: var(--blue); color: #fff; }
.pill.done { color: var(--green); }
.pill.filt { display: inline-flex; align-items: center; gap: 6px; background: var(--text); color: var(--bg); max-width: 170px; overflow: hidden; text-overflow: ellipsis; }
.pill.filt i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--card); color: var(--blue); box-shadow: var(--shadow); flex: none; }
.mini { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--card2); color: var(--muted); flex: none; }
.mini svg { width: 16px; height: 16px; }
.mini.ok { background: var(--green-bg); color: var(--green); }
.mini.del { color: var(--red); }

.fld { display: block; margin: 12px 0; }
.fld > span { display: block; font-size: 13px; color: var(--muted); margin: 0 0 5px 2px; font-weight: 500; }
.fld > small { display: block; margin: 6px 2px 0; }
.fld input, .fld select, .inp { width: 100%; font-size: 17px; padding: 12px 13px; border-radius: 12px; border: 0; background: var(--card2); outline: none; min-height: 48px; -webkit-appearance: none; appearance: none; }
.fld select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 21px, calc(100% - 13px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.fld input:focus, .fld select:focus, .inp:focus { box-shadow: 0 0 0 2px var(--blue); }
.fld input:disabled, .fld select:disabled { opacity: .6; }
.inp.sm { min-height: 38px; padding: 8px 11px; font-size: 16px; }
.inp.num { text-align: right; width: 130px; flex: none; }
input[type=date] { min-height: 48px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row2 .fld { margin: 12px 0 0; }

.seg { display: flex; background: var(--card2); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button { flex: 1; padding: 9px 6px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--muted); min-height: 40px; }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.seg.big button { font-size: 15px; }
.seg button.on.gasto { color: var(--red); } .seg button.on.ingreso { color: var(--green); } .seg button.on.transfer { color: var(--blue); }
.seg.sm button { padding: 6px 8px; min-height: 34px; font-size: 13px; }
.card .seg { margin-bottom: 12px; }

.amount { display: flex; align-items: center; gap: 8px; margin: 16px 0 6px; padding: 6px 16px; border-radius: 16px; background: var(--card2); }
.amount span { font-size: 26px; font-weight: 600; color: var(--muted); }
.amount input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 40px; font-weight: 700; padding: 8px 0; outline: none; letter-spacing: -1px; }
.amount.gasto input { color: var(--red); } .amount.ingreso input { color: var(--green); } .amount.transfer input { color: var(--blue); }
.xfer { display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; align-items: end; }
.xfer .fld { margin-bottom: 0; }
.xfer-arrow { padding-bottom: 13px; color: var(--muted); }

.swatches, .emojis { display: flex; flex-wrap: wrap; gap: 10px; }
.sw { width: 36px; height: 36px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .5); }
.sw.on { box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--c); }
.em { width: 44px; height: 44px; border-radius: 12px; font-size: 24px; background: var(--card2); }
.em.on { box-shadow: 0 0 0 2px var(--blue); background: var(--card); }

.banner { border-radius: 12px; padding: 10px 12px; margin: 0 0 12px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.banner svg { width: 16px; height: 16px; }
.banner.lock, .banner.warn { background: var(--orange-bg); }
.banner.ok { background: var(--green-bg); }
.banner.info { background: var(--gray-bg); }
.tag { display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 99px; background: var(--gray-bg); color: var(--muted); font-weight: 600; white-space: nowrap; }
.tag.ok { background: var(--green-bg); color: var(--green); }
.tag.warn { background: var(--orange-bg); color: var(--orange); }
.badge { background: var(--red); color: #fff; border-radius: 99px; font-size: 12px; font-weight: 700; padding: 2px 8px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); margin-right: 4px; vertical-align: 1px; }
.swatch { width: 12px; height: 34px; border-radius: 6px; background: var(--c); flex: none; }
.daybox { width: 36px; height: 36px; border-radius: 10px; background: var(--card2); display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.sec { font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin: 18px 2px 6px; font-weight: 600; }
.steps { padding-left: 20px; margin: 0 0 8px; } .steps li { margin: 6px 0; }

/* ---------- Listas ---------- */
.list { background: var(--card); border-radius: var(--r); overflow: hidden; }
.sheet .list { background: var(--card2); }
.card .list { background: transparent; margin: 0 -4px; }
.mv { display: flex; align-items: center; gap: 10px; padding: 11px 12px 11px 0; border-bottom: .5px solid var(--sep); position: relative; cursor: pointer; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.mv:last-child { border-bottom: 0; }
.mv-bar { width: 4px; align-self: stretch; border-radius: 0 3px 3px 0; background: var(--gray); flex: none; }
.mv.real .mv-bar { background: var(--green); } .mv.real.out .mv-bar { background: var(--red); } .mv.venc .mv-bar { background: var(--orange); }
.mv.proy .mv-bar { background: repeating-linear-gradient(180deg, var(--gray) 0 4px, transparent 4px 7px); }
.mv.sel { background: rgba(10, 132, 255, .12); }
.mv-main { flex: 1; min-width: 0; }
.mv-t { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mv-s { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mv-r { text-align: right; flex: none; }
.mv-amt { font-weight: 700; font-size: 15px; }
.mv.proy .mv-amt, .mv.venc .mv-amt { opacity: .8; }
.mv-est { font-size: 11px; color: var(--muted); }
.mv.venc .mv-est { color: var(--orange); font-weight: 600; }
.mv-acts { display: flex; gap: 6px; flex: none; }
.ck { width: 26px; height: 26px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--sep); display: inline-flex; align-items: center; justify-content: center; color: transparent; }
.ck svg { width: 16px; height: 16px; }
.ck.on { background: var(--blue); color: #fff; box-shadow: none; }
.venc-row { border-bottom: .5px solid var(--sep); padding-left: 0; }
.venc-row .mv { border-bottom: 0; }
.venc-row .btn-row { padding: 0 12px; }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: .5px solid var(--sep); width: 100%; text-align: left; }
.li:last-child { border-bottom: 0; }
.li-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.li-main small { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cuadre-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: .5px solid var(--sep); }
details.cats, details.arch { background: var(--card2); border-radius: 12px; padding: 8px 12px; margin-bottom: 12px; }
details.arch { background: transparent; padding: 4px 0; }
details summary { cursor: pointer; font-size: 14px; color: var(--blue); font-weight: 600; padding: 4px 0; }
.filter-row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.filter-row .inp { flex: 1; min-width: 0; }

/* ---------- Menu (Mas) ---------- */
.menu { background: var(--card); border-radius: var(--r); overflow: hidden; margin: 12px 0 18px; box-shadow: var(--shadow); }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; border-bottom: .5px solid var(--sep); min-height: 54px; }
.menu-item:last-child { border-bottom: 0; }
.mi-ico { font-size: 22px; width: 30px; text-align: center; }
.mi-body { flex: 1; display: flex; flex-direction: column; }
.mi-body small { color: var(--muted); font-size: 13px; }
.mi-chev { color: var(--muted); } .mi-chev svg { width: 16px; height: 16px; }

/* ---------- Ahorro / metas ---------- */
.acct { border-top: 5px solid var(--c); }
.acct-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.acct-name { font-size: 18px; font-weight: 700; }
.acct-bal { font-size: 22px; font-weight: 750; white-space: nowrap; }
.meta { display: block; width: 100%; text-align: left; background: var(--card2); border-radius: 14px; padding: 12px; margin: 10px 0; }
.meta.archived { opacity: .6; }
.meta-top { display: flex; align-items: center; gap: 8px; }
.meta-ico { font-size: 22px; }
.meta-name { font-weight: 650; flex: 1; min-width: 0; line-height: 1.2; }
.meta-amt { font-size: 13px; color: var(--muted); white-space: nowrap; }
.meta-amt b { color: var(--text); font-size: 15px; }
.meta-sub { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-top: 6px; }
.meta-sub b { color: var(--text); }
.meta-date { margin-top: 2px; }
.prog { position: relative; height: 10px; border-radius: 10px; background: var(--gray-bg); overflow: hidden; margin-top: 8px; }
.prog i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 10px; }
.p-real { background: var(--c); }
.p-proy { background: repeating-linear-gradient(135deg, var(--c) 0 4px, transparent 4px 8px); opacity: .45; }
.meta-mini { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 8px 0; }
.mm-ico { font-size: 22px; }
.mm-body { flex: 1; min-width: 0; }
.mm-t { display: flex; justify-content: space-between; font-size: 14px; font-weight: 600; }
.mm-t b { color: var(--muted); font-weight: 600; }
.meta-mini .prog { margin-top: 5px; height: 8px; }
.meta-hero { display: flex; align-items: center; gap: 16px; margin: 4px 0 8px; }
.ring { width: 84px; height: 84px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; background: conic-gradient(var(--c) var(--p), var(--gray-bg) 0); position: relative; }
.ring::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--card); }
.ring span { position: relative; font-weight: 750; font-size: 18px; }

/* ---------- Calendario ---------- */
.cal-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.month-nav { display: flex; align-items: center; gap: 6px; }
.month-title { font-size: 22px !important; min-width: 170px; text-align: center; }
.cal-actions { display: flex; gap: 8px; align-items: center; }
.chips-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.chips-row::-webkit-scrollbar { display: none; }
.fchip { padding: 7px 13px; border-radius: 99px; background: var(--card); font-size: 14px; font-weight: 600; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; box-shadow: var(--shadow); }
.fchip i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.fchip.on { background: var(--text); color: var(--bg); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); margin: 4px 0 8px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend b { color: var(--text); }
.legend b.pos { color: var(--green); } .legend b.neg { color: var(--red); }
.lg { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.lg.real { background: var(--green); } .lg.realneg { background: var(--red); } .lg.proy { background: var(--gray); } .lg.dim { opacity: .5; } .lg.venc { background: var(--orange); }

.cal { background: var(--card); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); font-size: 11px; text-transform: uppercase; color: var(--muted); font-weight: 600; text-align: center; padding: 8px 0 4px; }
.wk { border-top: .5px solid var(--sep); }
.wk-bar { display: flex; align-items: center; gap: 8px; padding: 5px 8px; font-size: 11px; color: var(--muted); background: var(--card2); }
.wk-bar b { color: var(--text); font-weight: 650; }
.wk-bar b.neg { color: var(--red); }
.wk-ini { font-size: 11px; color: var(--muted); }
.wk-fin { flex: 1; text-align: right; }
.wk-lock { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--muted); padding: 3px 8px; border-radius: 99px; background: var(--card); }
.wk-lock svg { width: 12px; height: 12px; }
.wk.locked .wk-lock { background: var(--orange); color: #fff; }
.wk.locked .wk-days { background: repeating-linear-gradient(135deg, transparent 0 10px, rgba(255, 149, 0, .05) 10px 20px); }
.wk-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.day { min-height: 70px; padding: 4px 3px 5px; border-right: .5px solid var(--sep); display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; position: relative; min-width: 0; }
.day:last-child { border-right: 0; }
.day.wkend { background: rgba(127, 127, 127, .035); }
.day.other { opacity: .38; }
.day.neg { background: var(--red-bg); }
.dn { font-size: 14px; font-weight: 600; width: 26px; height: 26px; line-height: 26px; text-align: center; border-radius: 50%; }
.day.today .dn { background: var(--red); color: #fff; }
.dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; max-width: 42px; min-height: 6px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--gray); }
.dots i.real { background: var(--green); } .dots i.real.out { background: var(--red); } .dots i.venc { background: var(--orange); }
.dots i.proy { background: transparent; box-shadow: inset 0 0 0 1.5px var(--gray); }
.dots em { font-size: 9px; font-style: normal; color: var(--muted); line-height: 6px; }
.dnet { font-size: 11px; font-weight: 700; line-height: 1.1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dbal { font-size: 10px; color: var(--blue); line-height: 1.1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dbal.neg { color: var(--red); font-weight: 700; }
.chips { display: none; }
.drag-over { outline: 2px dashed var(--blue); outline-offset: -3px; background: rgba(10, 132, 255, .08) !important; }

.summary .sum-grid { display: grid; gap: 12px; }
.summary h4 { font-size: 14px; margin: 4px 0; }
.sum-box { background: var(--card2); border-radius: 12px; padding: 6px 12px; }

/* Pantallas grandes (iPad horizontal / computadora): chips con arrastrar y soltar, como la intranet */
@media (min-width: 900px) {
  #view { padding: 0 24px; }
  .day { min-height: 118px; align-items: stretch; padding: 5px; }
  .dn { align-self: flex-end; width: 24px; height: 24px; line-height: 24px; font-size: 13px; }
  .dots { display: none; }
  .chips { display: flex; flex-direction: column; gap: 3px; margin-top: 2px; }
  .dnet { display: none; }
  .dbal { text-align: right; font-size: 11px; margin-top: auto; padding-top: 3px; }
  .chip { display: flex; align-items: center; gap: 4px; font-size: 11.5px; background: var(--card); border: .5px solid var(--sep); border-left: 3px solid var(--gray); border-radius: 6px; padding: 3px 5px; cursor: grab; position: relative; }
  .chip.real { border-left-color: var(--green); } .chip.real.out { border-left-color: var(--red); } .chip.venc { border-left-color: var(--orange); background: var(--orange-bg); }
  .chip.proy { border-left-style: dashed; }
  .chip.sel { box-shadow: 0 0 0 2px var(--blue); }
  .chip-cat { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
  .chip-amt { font-weight: 700; white-space: nowrap; }
  .chip.real .chip-amt { color: var(--green); } .chip.real.out .chip-amt { color: var(--red); }
  .chip-x, .chip-ok { display: none; width: 18px; height: 18px; border-radius: 50%; align-items: center; justify-content: center; flex: none; }
  .chip-x svg, .chip-ok svg { width: 11px; height: 11px; stroke-width: 3; }
  .chip-x { background: var(--red-bg); color: var(--red); }
  .chip-ok { background: var(--green-bg); color: var(--green); }
  .chip:hover .chip-x, .chip:hover .chip-ok { display: inline-flex; }
  .wk-bar { font-size: 12px; } .wk-ini { font-size: 12px; }
  .summary .sum-grid { grid-template-columns: 1fr 1fr 1fr; }
  .sheet { max-width: 560px; }
}

/* ---------- Barra de pestanas ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; align-items: center; justify-content: space-around; height: calc(var(--tabh) + var(--safe-b)); padding-bottom: var(--safe-b); background: var(--tab-bg); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-top: .5px solid var(--sep); }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; font-weight: 600; color: var(--muted); padding: 6px 0; }
.tab svg { width: 25px; height: 25px; }
.tab.on { color: var(--blue); }
.tab-add { width: 50px; height: 50px; border-radius: 50%; background: var(--blue); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 16px rgba(0, 122, 255, .4); margin: 0 6px; transform: translateY(-6px); flex: none; }
.tab-add svg { width: 26px; height: 26px; stroke-width: 2.6; }

/* ---------- Seleccion multiple ---------- */
.selbar { position: fixed; left: 12px; right: 12px; bottom: calc(var(--tabh) + var(--safe-b) + 10px); z-index: 90; background: #1c1c1e; color: #fff; border-radius: 18px; padding: 10px 12px 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); max-width: 560px; margin: 0 auto; }
body.sheet-open .selbar { bottom: calc(var(--safe-b) + 12px); }
.sb-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.sb-top b { flex: 1; }
.sb-top .pos { color: #30d158; } .sb-top .neg { color: #ff453a; }
.sb-top .mini { background: rgba(255, 255, 255, .12); color: #fff; }
.sb-acts { display: flex; gap: 6px; }
.sb-acts button { flex: 1; padding: 9px 4px; border-radius: 10px; background: rgba(255, 255, 255, .12); font-size: 13px; font-weight: 600; }
.sb-acts button.danger { background: rgba(255, 69, 58, .25); color: #ff6961; }

/* ---------- Hojas (bottom sheets) ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .35); opacity: 0; transition: opacity .25s; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; max-height: calc(100% - var(--safe-t) - 28px); background: var(--card); border-radius: 18px 18px 0 0; display: flex; flex-direction: column; transform: translateY(100%); transition: transform .3s cubic-bezier(.2, .8, .2, 1); box-shadow: 0 -8px 30px rgba(0, 0, 0, .18); }
.sheet.tall { height: calc(100% - var(--safe-t) - 28px); }
.sheet-wrap.open .sheet { transform: none; }
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-head { position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 16px 14px 10px; border-bottom: .5px solid var(--sep); flex: none; touch-action: none; }
.grab { position: absolute; top: 6px; left: 50%; width: 38px; height: 5px; margin-left: -19px; border-radius: 5px; background: var(--sep); }
.sh-title { font-size: 17px; font-weight: 700; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60vw; text-transform: none; }
.sh-title::first-letter { text-transform: uppercase; }
.sh-btn { color: var(--blue); font-size: 16px; justify-self: start; padding: 4px 0; }
.sh-right { justify-self: end; }
.sh-btn.strong { font-weight: 650; }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px 16px calc(24px + var(--safe-b)); overscroll-behavior: contain; }
body.has-sel .sheet-body { padding-bottom: calc(140px + var(--safe-b)); }

/* ---------- Dialogos ---------- */
.dlg-wrap { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .4); display: flex; align-items: center; justify-content: center; padding: 24px; opacity: 0; transition: opacity .18s; }
.dlg-wrap.open { opacity: 1; }
.dlg { background: var(--card); border-radius: 16px; width: 100%; max-width: 340px; padding: 18px 16px 12px; text-align: center; transform: scale(.95); transition: transform .18s; max-height: 80vh; display: flex; flex-direction: column; }
.dlg-wrap.open .dlg { transform: none; }
.dlg h4 { font-size: 17px; margin-bottom: 6px; }
.dlg p { color: var(--muted); font-size: 14px; margin: 0 0 12px; }
.dlg .inp { margin: 8px 0 12px; text-align: left; }
.dlg-btns { display: flex; gap: 8px; margin-top: 6px; }
.dlg-btns button { flex: 1; padding: 11px; border-radius: 11px; background: var(--card2); color: var(--blue); font-weight: 600; }
.dlg-btns button.primary { background: var(--blue); color: #fff; }
.dlg-btns button.danger { background: var(--red); color: #fff; }
.dlg-list { overflow-y: auto; margin: 6px -4px; text-align: left; }
.dlg-list button { display: block; width: 100%; text-align: left; padding: 11px 12px; border-bottom: .5px solid var(--sep); }

/* ---------- Toasts ---------- */
#toasts { position: fixed; top: calc(var(--safe-t) + 10px); left: 0; right: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 12px; }
.toast { pointer-events: auto; max-width: 480px; width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; font-size: 14px; font-weight: 600; color: #fff; background: rgba(40, 40, 44, .96); box-shadow: 0 8px 24px rgba(0, 0, 0, .25); opacity: 0; transform: translateY(-12px); transition: all .22s; }
.toast span { flex: 1; }
.toast.show { opacity: 1; transform: none; }
.toast.ok { background: rgba(28, 130, 64, .97); }
.toast.error { background: rgba(200, 40, 32, .97); }
.toast button { color: #fff; font-weight: 700; padding: 5px 10px; border-radius: 8px; background: rgba(255, 255, 255, .2); white-space: nowrap; }

/* ---------- Login ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: calc(var(--safe-t) + 24px) 20px calc(var(--safe-b) + 24px); }
.login-card { width: 100%; max-width: 380px; text-align: center; }
.login-logo { width: 84px; height: 84px; border-radius: 20px; box-shadow: 0 8px 24px rgba(0, 0, 0, .15); }
.login h1 { font-size: 30px; margin: 14px 0 4px; }
.login form { text-align: left; margin-top: 22px; }
.login .fld input { background: var(--card); }
.login-err { background: var(--red-bg); color: var(--red); border-radius: 12px; padding: 10px 12px; font-size: 14px; font-weight: 600; margin-top: 4px; }
.login-foot { margin-top: 30px; font-size: 12px; }

/* ===== v1.1: calendario con parte fija, vista semana, gestos ===== */
html { touch-action: manipulation; }
html, body { overscroll-behavior-x: none; }
#app { overflow-x: clip; }
#view { touch-action: pan-y; }                 /* el navegador solo desplaza en vertical: el lateral es para cambiar de pestaña */
.chips-row, .acc-scroll, .alert-row { touch-action: pan-x pan-y; }

.cal-sticky { position: sticky; top: 0; z-index: 25; background: var(--bg); margin: 0 -16px; padding: var(--safe-t) 16px 0; }
.cal-sticky .top { position: static; padding: 10px 2px 6px; }
.cal-sticky .chips-row { padding-bottom: 6px; }
.cal-sticky .cal-dow { background: var(--card); border-radius: var(--r) var(--r) 0 0; border-bottom: .5px solid var(--sep); box-shadow: var(--shadow); }
.cal-sticky + .cal { border-radius: 0 0 var(--r) var(--r); }
.cal-sticky + .cal .wk:first-child { border-top: 0; }
.cal-actions { gap: 6px; }
.view-seg { flex: none; }
.view-seg button { min-height: 32px; padding: 5px 9px; }
.month-title.wk-title { font-size: 18px !important; min-width: 190px; }
.alert-row { display: flex; gap: 6px; overflow-x: auto; padding: 0 0 8px; scrollbar-width: none; }
.alert-row::-webkit-scrollbar { display: none; }
.apill { padding: 6px 11px; border-radius: 99px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.apill.warn { background: var(--orange-bg); color: var(--orange); }
.apill.danger { background: var(--red-bg); color: var(--red); }

.zoomable { transform-origin: center top; will-change: transform; }
.sum-btn { margin: 14px 0 6px; }
.sum-btn svg { width: 18px; height: 18px; }
.legend { margin: 10px 2px 4px; justify-content: center; }
.pinch-hint { margin: 8px 0 0; }
@media (hover: hover) and (pointer: fine) { .pinch-hint { display: none; } }

.wk-view .card { margin: 8px 0; padding: 0; overflow: hidden; }
.wk-card .wk-bar { background: transparent; padding: 10px 12px; font-size: 13px; }
.wk-card .wk-ini { font-size: 13px; }
.wday-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 14px; text-align: left; }
.wd-n { flex: 1; font-size: 15px; color: var(--muted); }
.wd-n b { font-size: 21px; color: var(--text); margin-right: 4px; }
.wday.today .wd-n b { color: var(--red); }
.wd-net { font-weight: 700; font-size: 14px; }
.wd-bal { font-size: 13px; color: var(--blue); min-width: 86px; text-align: right; }
.wd-bal.neg { color: var(--red); font-weight: 700; }
.wday.neg { box-shadow: inset 0 0 0 2px var(--red); }
.wday .list { border-top: .5px solid var(--sep); border-radius: 0; background: transparent; }
.wd-add { display: block; width: 100%; padding: 0 14px 12px; text-align: left; color: var(--blue); font-size: 14px; font-weight: 600; }
.wk-view.locked .wday { opacity: .92; }

/* ===== Pantalla de entrada y animacion de aparicion ===== */
#splash { position: fixed; inset: 0; z-index: 500; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: linear-gradient(160deg, #053d2e 0%, #0b6f53 45%, #1faa78 100%); color: #fff; overflow: hidden;
  transition: opacity .6s ease, filter .6s ease, transform .6s ease; }
#splash.hide { opacity: 0; filter: blur(16px); transform: scale(1.08); pointer-events: none; }
.sp-glow { position: absolute; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(circle, rgba(120, 255, 200, .35), transparent 65%); animation: sp-breathe 2.4s ease-in-out infinite; }
.sp-logo { position: relative; width: 112px; height: 112px; border-radius: 26px; box-shadow: 0 18px 40px rgba(0, 0, 0, .35); animation: sp-pop .75s cubic-bezier(.2, 1.4, .4, 1) both; }
.sp-name { position: relative; font-size: 30px; font-weight: 750; letter-spacing: -.5px; animation: sp-fade .6s ease .2s both; }
.sp-bar { position: relative; width: 120px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .22); overflow: hidden; animation: sp-fade .5s ease .35s both; }
.sp-bar i { position: absolute; top: 0; bottom: 0; width: 40%; border-radius: 4px; background: #fff; animation: sp-load 1.1s ease-in-out infinite; }
@keyframes sp-pop { from { opacity: 0; transform: scale(.6) translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes sp-fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes sp-breathe { 0%, 100% { transform: scale(.9); opacity: .7; } 50% { transform: scale(1.1); opacity: 1; } }
@keyframes sp-load { from { left: -40%; } to { left: 100%; } }

@keyframes rise { from { opacity: 0; transform: translateY(18px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes rise-bar { from { transform: translateY(100%); } to { transform: none; } }
body.reveal #view > *, body.reveal .login-card > *, body.reveal .acc-scroll > * { animation: rise .6s cubic-bezier(.2, .8, .2, 1) both; }
body.reveal #view > :nth-child(2), body.reveal .login-card > :nth-child(2), body.reveal .acc-scroll > :nth-child(2) { animation-delay: .06s; }
body.reveal #view > :nth-child(3), body.reveal .login-card > :nth-child(3), body.reveal .acc-scroll > :nth-child(3) { animation-delay: .12s; }
body.reveal #view > :nth-child(4), body.reveal .login-card > :nth-child(4), body.reveal .acc-scroll > :nth-child(4) { animation-delay: .18s; }
body.reveal #view > :nth-child(5), body.reveal .login-card > :nth-child(5) { animation-delay: .24s; }
body.reveal #view > :nth-child(6) { animation-delay: .30s; }
body.reveal #view > :nth-child(n+7) { animation-delay: .36s; }
body.reveal .tabbar { animation: rise-bar .5s cubic-bezier(.2, .8, .2, 1) .1s both; }
@media (prefers-reduced-motion: reduce) {
  #splash, #splash *, body.reveal * { animation: none !important; transition: opacity .2s !important; }
}
.view-inicio .top h1 { font-size: clamp(22px, 6.6vw, 30px); }

/* ===== v2: ahorro separado, presupuestos, monedas, comprobantes, gestos, bloqueo ===== */
.tab-add { box-shadow: 0 6px 16px color-mix(in srgb, var(--blue) 45%, transparent); }
.toast.warn { background: rgba(200, 110, 10, .97); }
.icon-btn.eye { width: 34px; height: 34px; }
.icon-btn.eye svg { width: 19px; height: 19px; }
.top-right { display: flex; align-items: center; gap: 8px; }
.hero-row.usd small { font-weight: 500; opacity: .85; }

.quad { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quad div { background: var(--card2); border-radius: var(--r-sm); padding: 10px; min-width: 0; }
.quad span { display: block; font-size: 12px; color: var(--muted); }
.quad b { font-size: 15px; display: block; overflow-wrap: anywhere; }

.cta-card { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; }
.card.flat { box-shadow: none; background: var(--card2); margin: 8px 0; }
.presup { padding: 8px 0; border-bottom: .5px solid var(--sep); }
.presup:last-child { border-bottom: 0; }
.pr-top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.pr-top span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pr-sub { margin-top: 4px; }

.cur-seg { flex: none; }
.cur-seg button { min-width: 44px; }
.cur-seg.wide { margin-bottom: 12px; }
.chips-row .cur-seg { margin-right: 4px; align-self: center; }

.cat-ico { width: 38px; height: 38px; border-radius: 11px; background: var(--card2); font-size: 20px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.sheet .cat-ico { background: var(--card); }
.cat-ico.static { cursor: default; }
.emoji-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; max-height: 50vh; overflow-y: auto; margin: 8px 0; }
.emoji-grid button { font-size: 24px; height: 44px; border-radius: 10px; background: var(--card2); }

/* Filas: icono + estructura para deslizar */
.mv-ico { font-size: 18px; width: 26px; text-align: center; flex: none; margin-left: -2px; }
.mvw { position: relative; overflow: hidden; border-bottom: .5px solid var(--sep); }
.mvw:last-child { border-bottom: 0; }
.mvw .mv { border-bottom: 0; background: var(--card); position: relative; z-index: 1; touch-action: pan-y; }
.sheet .mvw .mv, .card.flat .mvw .mv { background: var(--card2); }
.mvw .mv.sel { background: color-mix(in srgb, var(--blue) 14%, var(--card)); }
.sw-bg { position: absolute; inset: 0; display: flex; justify-content: space-between; align-items: center; padding: 0 18px; font-weight: 700; font-size: 14px; color: #fff; }
.sw-bg span { display: inline-flex; align-items: center; gap: 6px; opacity: 0; transition: opacity .15s, transform .15s; }
.sw-bg svg { width: 18px; height: 18px; stroke-width: 2.6; }
.mvw.sw-r .sw-bg { background: var(--green); } .mvw.sw-r .sw-ok { opacity: .75; }
.mvw.sw-l .sw-bg { background: var(--red); } .mvw.sw-l .sw-del { opacity: .75; }
.mvw.armed .sw-bg span { opacity: 1; transform: scale(1.08); }
.mvw:not([data-exec="1"]).sw-r .sw-bg { background: var(--gray); }
.mvw:not([data-exec="1"]).sw-r .sw-ok { opacity: 0; }

/* Comprobantes */
.attach-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 12px 0 4px; }
.attach-row .btn { flex: 1 1 auto; }
.attach-row .wide-l { width: 100%; }
.attach-thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; }
.adj-img { display: block; width: 100%; height: auto; border-radius: 12px; }
.amount.sm input { font-size: 26px; }
.amount.sm span { font-size: 18px; }

/* Apariencia */
.accents { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.acc-sw { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 8px 0; border-radius: 12px; }
.acc-sw i { width: 34px; height: 34px; border-radius: 50%; background: var(--c); }
.acc-sw.on { background: var(--card2); color: var(--text); font-weight: 600; }
.acc-sw.on i { box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--c); }
.preview { display: flex; align-items: center; gap: 12px; padding: 14px; margin-top: 14px; }
.menu.flat { box-shadow: none; background: var(--card2); }

/* Bloqueo */
body.locked #app { filter: blur(18px); }
.lock-wrap { position: fixed; inset: 0; z-index: 450; display: flex; align-items: center; justify-content: center; padding: calc(var(--safe-t) + 20px) 20px calc(var(--safe-b) + 20px);
  background: color-mix(in srgb, var(--bg) 82%, transparent); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); opacity: 0; transition: opacity .25s; }
.lock-wrap.open { opacity: 1; }
.lock-box { width: 100%; max-width: 320px; text-align: center; }
.lock-logo { width: 64px; height: 64px; border-radius: 16px; margin-bottom: 10px; }
.lock-title { font-size: 20px; margin-bottom: 4px; }
.lock-sub { color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.pin-dots { display: flex; justify-content: center; gap: 16px; margin-bottom: 8px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--text); transition: background .1s; }
.pin-dots i.on { background: var(--text); }
.pin-err { min-height: 20px; font-size: 13px; color: var(--red); margin-bottom: 14px; }
.lock-wrap.shake .pin-dots { animation: shake .35s; }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-10px); } 75% { transform: translateX(10px); } }
.pin-pad { display: grid; grid-template-columns: repeat(3, 76px); gap: 16px 22px; justify-content: center; }
.pin-k { width: 76px; height: 76px; border-radius: 50%; background: var(--card2); font-size: 30px; font-weight: 500; display: flex; align-items: center; justify-content: center; }
.pin-k:active { background: var(--sep); }
.pin-k.fn { background: transparent; color: var(--blue); }
.pin-k svg { width: 30px; height: 30px; }
.lock-foot { margin-top: 22px; font-size: 14px; }
.dlg-wrap { z-index: 600; }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 700; }
.sync-chip { white-space: nowrap; }
.view-inicio .top h1 { font-size: clamp(20px, 6vw, 30px); }

/* ===== Tarjetas de credito ===== */
.tc-row { display: block; width: 100%; text-align: left; background: var(--card2); border-radius: 14px; padding: 12px; margin: 8px 0; border-left: 4px solid var(--c); }
.tc-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.tc-name { font-weight: 650; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-debt { font-weight: 700; color: var(--red); white-space: nowrap; }
.tc-debt small { color: var(--muted); font-weight: 600; }
.tc-sub { margin-top: 6px; }
.tc-block { background: var(--card2); border-radius: 14px; padding: 4px 12px; margin: 10px 0; }

/* ===== Correo del banco ===== */
.alert.info { background: color-mix(in srgb, var(--blue) 12%, transparent); }
.alert.info b { color: var(--blue); }
.banner.info { background: color-mix(in srgb, var(--blue) 12%, transparent); }
.tag.rev { background: color-mix(in srgb, var(--blue) 15%, transparent); color: var(--blue); }
.day.rev .dn { box-shadow: 0 0 0 2px var(--blue); }
.bandeja { padding: 10px 12px; }
.bandeja .fld { margin: 8px 0 4px; }
.chk { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); margin: 6px 0; }
.chk input { width: 18px; height: 18px; }
textarea.inp { resize: vertical; font-size: 15px; margin: 6px 0; }

/* Calendario: barra superior minima */
.cal-top.slim { flex-wrap: nowrap; }
.cal-top.slim .month-title { text-align: left; min-width: 0; font-size: 26px !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-top.slim .month-title.wk-title { font-size: 20px !important; }
.cal-bottom { margin-top: 12px; }
.cal-bottom .chips-row { padding: 0 0 8px; }
.cal-tools { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 4px 0 0; }
.daybox.sm { flex-direction: column; line-height: 1; font-size: 15px; width: 40px; height: 40px; }
.daybox.sm small { font-size: 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; }
.map-card { padding: 10px 12px; }
.map-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: .5px solid var(--sep); font-size: 14px; }
.map-row:last-child { border-bottom: 0; }
.map-row select { width: 58%; flex: none; min-height: 38px; }
.map-row.recibe span { color: var(--muted); font-size: 13px; }
/* Calendario: una sola marca por dia */
.dots i.mk { width: 7px; height: 7px; border-radius: 50%; box-shadow: none; }
.dots i.mk.real { background: var(--blue); }
.dots i.mk.proy { background: var(--gray); }
.dots i.mk.venc { background: var(--orange); }
.cal-top.slim .month-title { font-size: clamp(20px, 6.2vw, 26px) !important; }
.cal-top.slim .cal-actions { flex: none; }

/* =====================================================================
 * v3 (3.0): diseño más sobrio y profesional. Menos color de fondo, más aire,
 * jerarquía por tipografía; el color queda para lo que importa (montos, avisos).
 * El acento sigue siendo var(--blue) (se cambia en Más → Apariencia).
 * ===================================================================== */
:root {
  --bg: #f4f4f6; --card: #ffffff; --card2: #f3f3f6; --text: #111114; --muted: #7c7c84; --sep: rgba(17, 17, 20, .08);
  --line: rgba(17, 17, 20, .06);
  --green: #178a4c; --red: #d4372c; --orange: #c46a00;
  --shadow: 0 1px 1px rgba(17, 17, 20, .03), 0 6px 24px -8px rgba(17, 17, 20, .08);
  --shadow-lg: 0 20px 50px -12px rgba(17, 17, 20, .22);
  --r: 20px; --r-sm: 12px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.3, .64, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #09090b; --card: #151518; --card2: #1f1f23; --text: #f4f4f5; --muted: #8b8b94; --sep: rgba(255, 255, 255, .08);
    --line: rgba(255, 255, 255, .06); --green: #34c77b; --red: #ff5c52; --orange: #ffa53d;
    --shadow: 0 0 0 1px rgba(255, 255, 255, .05); --shadow-lg: 0 20px 50px -10px rgba(0, 0, 0, .7);
    --tab-bg: rgba(12, 12, 14, .82);
  }
}
:root[data-theme="dark"] {
  --bg: #09090b; --card: #151518; --card2: #1f1f23; --text: #f4f4f5; --muted: #8b8b94; --sep: rgba(255, 255, 255, .08);
  --line: rgba(255, 255, 255, .06); --green: #34c77b; --red: #ff5c52; --orange: #ffa53d;
  --shadow: 0 0 0 1px rgba(255, 255, 255, .05); --shadow-lg: 0 20px 50px -10px rgba(0, 0, 0, .7);
  --tab-bg: rgba(12, 12, 14, .82);
}
body { font-feature-settings: "tnum" 1, "cv11" 1; letter-spacing: -.01em; -webkit-font-smoothing: antialiased; }
b { font-weight: 600; }
.eyebrow { display: block; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* Barra superior */
.top { padding: calc(var(--safe-t) + 16px) 2px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent); -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px); }
.top h1 { font-size: 28px; font-weight: 700; letter-spacing: -.035em; }
.home-top .hello h1 { font-size: 26px; line-height: 1.1; margin-top: 2px; }
.icon-btn, .sync-chip, .pill { box-shadow: none; background: var(--card); border: 1px solid var(--line); }
.icon-btn { color: var(--text); }
.sync-chip { font-weight: 500; }
.pill { color: var(--text); font-weight: 600; }
.pill.accent { background: var(--blue); border-color: transparent; color: #fff; }
.pill.done { color: var(--green); }

/* Tarjetas: blancas, borde fino, sombra apenas */
.card { border-radius: var(--r); padding: 18px; margin: 14px 0; border: 1px solid var(--line); box-shadow: var(--shadow); }
.card-head { margin-bottom: 12px; }
.card-head h2 { font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.head-num { font-weight: 650; font-size: 15px; }
.link { font-weight: 600; font-size: 14px; }
.link.more { display: block; margin: 10px auto 0; }
.kv { font-size: 15px; border-bottom-color: var(--line); padding: 9px 0; }
.kv.big { padding-top: 12px; }
.kv.big b { font-size: 17px; }
.sec { font-size: 12px; letter-spacing: .06em; font-weight: 650; margin: 22px 2px 8px; }
.sec small { margin-left: 6px; text-transform: none; letter-spacing: 0; font-weight: 500; }
.sec-row { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 2px 8px; }
.sec-row .sec { margin: 0; }

/* Saldo (Inicio) */
.balance { padding: 8px 2px 6px; }
.bal-amt { font-size: clamp(38px, 11vw, 48px); font-weight: 700; letter-spacing: -.045em; line-height: 1.05; margin: 6px 0 8px; }
.bal-amt.neg { color: var(--red); }
.bal-sub { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: var(--muted); text-align: left; }
.bal-sub b { color: var(--text); }
.bal-sub b.neg { color: var(--red); }
.bal-sub svg { width: 14px; height: 14px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.kpis > div { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px; min-width: 0; box-shadow: var(--shadow); }
.kpis > div > span { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.kpis b { display: block; font-size: 15px; font-weight: 650; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.02em; }
.bal-usd { margin-top: 10px; font-size: 13px; color: var(--muted); }
.bal-usd b { color: var(--text); margin-left: 4px; }

/* Avisos compactos */
.notices { display: grid; gap: 8px; margin: 14px 0 0; }
.notice { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 12px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); font-size: 14px; color: var(--text); }
.notice > span { flex: 1; min-width: 0; }
.notice > i { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--muted); }
.notice.warn > i { background: var(--orange); } .notice.danger > i { background: var(--red); } .notice.info > i { background: var(--blue); }
.notice.danger { border-color: color-mix(in srgb, var(--red) 30%, transparent); }
.notice svg { width: 15px; height: 15px; color: var(--muted); }

/* Ingresos vs gastos */
.flow2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.flow2 > div { background: var(--card2); border-radius: 14px; padding: 12px; position: relative; overflow: hidden; min-width: 0; }
.flow2 span { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.flow2 b { display: block; font-size: 17px; font-weight: 650; margin-top: 2px; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flow2 i { display: block; height: 4px; border-radius: 4px; margin-top: 10px; background: var(--c); width: var(--w); opacity: .75; transition: width .6s var(--ease); }
.bars { gap: 9px; margin-top: 14px; }
.barrow { font-size: 13px; }
.bt { height: 6px; }
.bt i { background: var(--text); opacity: .18; }

/* Cuentas */
.acc { border: 1px solid var(--line); border-top: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 16px; min-width: 156px; padding: 13px 14px; gap: 3px; }
.acc-tipo { display: flex; align-items: center; gap: 6px; text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 500; }
.acc-tipo i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.acc-name { font-weight: 600; font-size: 15px; }
.acc-bal { font-size: 17px; font-weight: 650; letter-spacing: -.02em; }
.acc.add { border-style: dashed; box-shadow: none; background: transparent; color: var(--muted); }

/* Listas de movimientos */
.list { border-radius: 16px; }
.card .list { margin: 0; }
.mv { gap: 12px; padding: 11px 12px 11px 0; }
.mv-bar { width: 3px; opacity: .9; }
.mv-ico { width: 36px; height: 36px; border-radius: 11px; background: var(--card2); display: inline-flex; align-items: center; justify-content: center; font-size: 17px; margin-left: 0; }
.sheet .mv-ico, .card.flat .mv-ico { background: var(--card); }
.mv-t { font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.mv-amt { font-weight: 650; letter-spacing: -.02em; }
.mv-est { font-size: 11.5px; }
.mv-nota { display: block; font-size: 12px; color: var(--blue); font-weight: 600; margin-top: 1px; }
.list.nf .mv-amt { color: var(--muted) !important; }
.list.nf .mv-bar { opacity: .35; }
.day-sec { display: flex; flex-direction: column; gap: 1px; margin-top: 18px; }
.day-sec small { text-transform: none; letter-spacing: 0; font-weight: 500; margin: 0; font-size: 12px; }
.mini { background: var(--card); border: 1px solid var(--line); }
.sheet .mini { background: var(--card); }
.mini.ok { border-color: transparent; }

/* Botones y controles */
.btn { border-radius: 14px; font-weight: 600; background: var(--card2); color: var(--text); transition: transform .15s var(--ease), background .2s, opacity .2s; }
.btn.primary { background: var(--blue); color: #fff; box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--blue) 60%, transparent); }
.btn.ghost { box-shadow: inset 0 0 0 1px var(--sep); color: var(--text); }
.btn.danger-ghost { color: var(--red); }
.btn.big { border-radius: 16px; }
.seg { border-radius: 12px; }
.seg button { border-radius: 10px; transition: background .2s, color .2s, box-shadow .2s; }
.seg button.on { box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 2px 8px rgba(0, 0, 0, .06); }
.fld input, .fld select, .inp { border-radius: 13px; border: 1px solid transparent; transition: border-color .15s, box-shadow .15s; }
.fld input:focus, .fld select:focus, .inp:focus { box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 18%, transparent); border-color: var(--blue); }
.amount { border-radius: 18px; }
.banner { border-radius: 14px; }
.tag { font-weight: 600; letter-spacing: .01em; }
.btn:active, .tab:active, .acc:active, .mv:active, .li:active, .menu-item:active, .meta:active, .notice:active, .tc-row:active { transform: scale(.975); }

/* Barra de pestañas */
.tabbar { border-top: 1px solid var(--line); }
.tab { font-size: 10.5px; font-weight: 600; position: relative; transition: color .2s; }
.tab svg { width: 24px; height: 24px; stroke-width: 1.9; transition: transform .25s var(--spring); }
.tab.on svg { transform: translateY(-1px) scale(1.06); }
.tab.on::after { content: ""; position: absolute; top: 0; width: 18px; height: 3px; border-radius: 0 0 3px 3px; background: var(--blue); }
.tab-add { width: 48px; height: 48px; border-radius: 16px; transform: translateY(-4px); box-shadow: 0 8px 20px -6px color-mix(in srgb, var(--blue) 70%, transparent); transition: transform .2s var(--spring); }
.tab-add:active { transform: translateY(-4px) scale(.92); }

/* Hojas y menús */
.sheet { border-radius: 24px 24px 0 0; box-shadow: var(--shadow-lg); transition: transform .42s var(--spring); }
.sheet-head { border-bottom-color: var(--line); padding: 18px 16px 12px; }
.sh-title { font-weight: 650; letter-spacing: -.01em; }
.sheet-backdrop { background: rgba(10, 10, 12, .4); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.menu { border: 1px solid var(--line); border-radius: 18px; }
.menu-item { border-bottom-color: var(--line); }
.mi-ico { width: 34px; height: 34px; border-radius: 10px; background: var(--card2); font-size: 18px; display: inline-flex; align-items: center; justify-content: center; }
.dlg { border-radius: 20px; box-shadow: var(--shadow-lg); }
.toast { border-radius: 16px; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }

/* Calendario */
.cal { border: 1px solid var(--line); border-top: 0; }
.cal-sticky .cal-dow { border: 1px solid var(--line); box-shadow: none; letter-spacing: .06em; }
.wk { border-top-color: var(--line); }
.wk-bar { background: transparent; border-bottom: 1px solid var(--line); }
.wk-lock { background: var(--card2); }
.day { border-right-color: var(--line); transition: background .15s; }
.day:active { background: var(--card2); }
.day.wkend { background: transparent; }
.day.today .dn { background: var(--blue); }
.day.neg { background: color-mix(in srgb, var(--red) 8%, transparent); }
.dnet { font-weight: 650; }
.dnet.zero { color: var(--muted); }
.dbal { color: var(--muted); font-weight: 500; }
.dots i.mk.real { background: var(--blue); }
.dots i.mk.tc { background: transparent; box-shadow: inset 0 0 0 1.5px var(--muted); }

/* Tarjetas de crédito: resumen en Inicio */
.tc-row { display: flex; gap: 12px; align-items: center; background: var(--card2); border: 0; border-radius: 16px; padding: 12px 14px; margin: 8px 0; }
.tc-chip { width: 36px; height: 26px; border-radius: 6px; flex: none; background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 55%, #000)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15); }
.tc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.tc-name small { color: var(--muted); font-weight: 500; }
.tc-debt { color: var(--text); font-weight: 650; }
.tc-sub { margin: 0; font-size: 12.5px; color: var(--muted); }
.prog.thin { height: 4px; margin: 0; }

/* Tarjeta de crédito: detalle */
.ccard { position: relative; overflow: hidden; border-radius: 22px; padding: 18px 18px 16px; color: #fff; margin: 4px 0 14px;
  background: radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--c) 70%, #fff) 0%, var(--c) 38%, color-mix(in srgb, var(--c) 45%, #000) 100%);
  box-shadow: 0 18px 40px -16px color-mix(in srgb, var(--c) 80%, #000); }
.ccard::after { content: ""; position: absolute; right: -40px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.cc-top { display: flex; justify-content: space-between; align-items: center; font-size: 14px; font-weight: 600; position: relative; }
.cc-num { letter-spacing: .12em; opacity: .85; font-size: 13px; }
.cc-lbl { margin-top: 22px; font-size: 12px; opacity: .8; font-weight: 500; }
.cc-amt { font-size: 32px; font-weight: 700; letter-spacing: -.04em; line-height: 1.1; }
.cc-line { height: 5px; border-radius: 5px; background: rgba(255, 255, 255, .22); margin-top: 14px; overflow: hidden; }
.cc-line i { display: block; height: 100%; background: #fff; border-radius: 5px; transition: width .7s var(--ease); }
.cc-foot { display: flex; justify-content: space-between; font-size: 12px; opacity: .85; margin-top: 8px; font-weight: 500; }
.tc-modo { margin: 0 0 6px; }
.tc-pay { background: var(--card2); border-radius: 18px; padding: 16px; margin: 14px 0 10px; }
.tc-pay-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.tc-pay-top .lbl { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.tc-pay-date { display: block; font-size: 18px; font-weight: 650; letter-spacing: -.02em; text-transform: capitalize; }
.tc-pay-amt { text-align: right; font-size: 24px; font-weight: 700; letter-spacing: -.03em; white-space: nowrap; }
.tc-pay-amt small { display: block; font-size: 12px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.tc-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 4px; }
.tc-opt { background: var(--card); border-radius: 12px; padding: 10px 12px; border: 1px solid transparent; }
.tc-opt span { display: block; font-size: 12px; color: var(--muted); }
.tc-opt b { font-size: 15px; }
.tc-opt.on { border-color: var(--blue); }
.tc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; margin: 10px 0; }
.tc-stat { background: var(--card2); border-radius: 14px; padding: 12px; min-width: 0; }
.tc-stat span { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.tc-stat b { display: block; font-size: 17px; font-weight: 650; letter-spacing: -.02em; margin: 2px 0; }
.tc-stat small { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.3; }
.tc-months { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; align-items: end; background: var(--card2); border-radius: 16px; padding: 14px 10px 10px; }
.tcm { display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; }
.tcm-bar { position: relative; width: 70%; max-width: 26px; height: 84px; display: flex; align-items: flex-end; }
.tcm-bar i { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 6px 6px 3px 3px; background: color-mix(in srgb, var(--blue) 30%, transparent); transition: height .6s var(--ease); }
.tcm-bar i.q { background: var(--blue); }
.tcm-m { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: capitalize; }
.tcm-v { font-size: 11px; font-weight: 650; white-space: nowrap; }
.key { display: inline-block; width: 9px; height: 9px; border-radius: 3px; background: color-mix(in srgb, var(--blue) 30%, transparent); vertical-align: -1px; }
.key.q { background: var(--blue); }
.li.plan .li-main { gap: 3px; }
.li.plan .prog { margin: 3px 0 1px; }

/* Movimiento: aparicion al cambiar de pestaña y al abrir una hoja */
@keyframes v3-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
#view.enter > * { animation: v3-in .42s var(--ease) both; }
#view.enter > :nth-child(2) { animation-delay: .03s; } #view.enter > :nth-child(3) { animation-delay: .06s; }
#view.enter > :nth-child(4) { animation-delay: .09s; } #view.enter > :nth-child(5) { animation-delay: .12s; }
#view.enter > :nth-child(n+6) { animation-delay: .15s; }
@media (hover: hover) and (pointer: fine) {
  .acc, .tc-row, .notice { transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
  .acc:hover, .tc-row:hover, .notice:hover { transform: translateY(-1px); box-shadow: 0 10px 28px -12px rgba(0, 0, 0, .2); }
}
@media (prefers-reduced-motion: reduce) {
  #view.enter > * { animation: none !important; }
  .sheet { transition: transform .2s ease; }
}

/* Pantalla de entrada y bloques antiguos, con la misma sobriedad */
#splash { background: radial-gradient(120% 90% at 50% 0%, #1b1b22 0%, #09090b 70%); }
.sp-glow { background: radial-gradient(circle, color-mix(in srgb, var(--blue) 35%, transparent), transparent 65%); }
.hero { background: var(--card); color: var(--text); border: 1px solid var(--line); box-shadow: var(--shadow); }
.hero.savings { background: var(--card); box-shadow: var(--shadow); }
.hero-row { border-top-color: var(--line); }
.hero-row span { color: var(--muted); opacity: 1; }
.hero-lbl { color: var(--muted); opacity: 1; font-weight: 500; }
.hero-amt { letter-spacing: -.045em; font-weight: 700; }
.hero-amt.neg, .hero-row b.neg { color: var(--red); }
.acc-scroll { scroll-padding: 0 16px; }

/* =====================================================================
 * v3.1: más color (cada sección con su tono), indicador de carga y
 * animación de entrada "futurista pero amable".
 * ===================================================================== */
:root { --violet: #7c5cff; --teal: #12b3a6; --pink: #ff4d8d; }

/* ---------- Indicador de carga ---------- */
#busy { position: fixed; inset: 0 0 auto 0; z-index: 300; pointer-events: none; }
.busy-bar { position: absolute; top: 0; left: 0; right: 0; height: 3px; overflow: hidden; opacity: 0; transition: opacity .2s; }
.busy-bar::before { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; border-radius: 3px;
  background: linear-gradient(90deg, transparent, var(--blue), var(--violet), transparent); animation: busy-slide 1s ease-in-out infinite; }
#busy.on .busy-bar { opacity: 1; }
#busy.done .busy-bar { opacity: 0; }
.busy-pill { position: absolute; top: calc(var(--safe-t) + 10px); left: 50%; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px 8px 10px;
  border-radius: 99px; font-size: 13px; font-weight: 600; color: var(--text); background: color-mix(in srgb, var(--card) 86%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(180%); backdrop-filter: blur(16px) saturate(180%); border: 1px solid var(--line);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .3); transform: translate(-50%, -16px) scale(.9); opacity: 0; transition: transform .35s var(--spring), opacity .2s; }
#busy.on .busy-pill { transform: translate(-50%, 0) scale(1); opacity: 1; }
.busy-spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--blue) 25%, transparent); border-top-color: var(--blue); animation: spin .7s linear infinite; }
.busy-ok { display: none; width: 18px; height: 18px; border-radius: 50%; background: var(--green); color: #fff; align-items: center; justify-content: center; }
.busy-ok svg { width: 12px; height: 12px; stroke-width: 3.2; }
#busy.done .busy-spin { display: none; }
#busy.done .busy-ok { display: inline-flex; animation: pop-in .35s var(--spring); }
@keyframes busy-slide { from { left: -40%; } to { left: 100%; } }
@keyframes pop-in { from { transform: scale(.3); } to { transform: none; } }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: spin .7s linear infinite; }

/* ---------- Saldo de Inicio: tarjeta con degradado vivo ---------- */
.balance { position: relative; overflow: hidden; isolation: isolate; color: #fff; border-radius: 26px; padding: 20px 20px 18px; margin: 4px 0 6px;
  background: linear-gradient(125deg, color-mix(in srgb, var(--blue) 92%, #000) 0%, var(--blue) 35%, var(--violet) 75%, var(--pink) 130%);
  background-size: 180% 180%; animation: mesh 14s ease-in-out infinite alternate;
  box-shadow: 0 22px 44px -18px color-mix(in srgb, var(--blue) 75%, #000); }
.balance::before { content: ""; position: absolute; inset: 0; z-index: -1; opacity: .5;
  background-image: linear-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .07) 1px, transparent 1px);
  background-size: 22px 22px; -webkit-mask-image: radial-gradient(120% 90% at 100% 0%, #000, transparent 70%); mask-image: radial-gradient(120% 90% at 100% 0%, #000, transparent 70%); }
.balance::after { content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 45%; z-index: -1; transform: skewX(-18deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .28), transparent); opacity: 0; }
.bal-glow { position: absolute; z-index: -1; width: 220px; height: 220px; right: -70px; top: -90px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .35), transparent 65%); animation: float 7s ease-in-out infinite; }
.balance .eyebrow { color: rgba(255, 255, 255, .78); }
.balance .bal-amt { color: #fff; margin: 8px 0 14px; text-shadow: 0 2px 20px rgba(0, 0, 0, .12); }
.balance .bal-amt.neg { color: #ffd6d2; }
.balance .kpis { margin-top: 0; }
.balance .kpis > * { background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .18); box-shadow: none; color: #fff; text-align: left;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-radius: 16px; padding: 11px 12px; min-width: 0; }
.balance .kpis > * > span { color: rgba(255, 255, 255, .78); display: block; font-size: 12px; font-weight: 500; }
.balance .kpis b { color: #fff; display: block; font-size: 16px; font-weight: 650; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.balance .kpis b.neg { color: #ffd6d2; }
.balance .bal-usd { color: rgba(255, 255, 255, .8); }
.balance .bal-usd b { color: #fff; }
@keyframes mesh { from { background-position: 0% 30%; } to { background-position: 100% 70%; } }
@keyframes float { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-18px, 14px); } }
@keyframes sweep { 0% { left: -60%; opacity: 0; } 20% { opacity: 1; } 100% { left: 130%; opacity: 0; } }

/* ---------- Resumen de Ahorro: su propio color (verde agua) ---------- */
.hero.savings { position: relative; overflow: hidden; color: #fff; border: 0; border-radius: 26px;
  background: linear-gradient(135deg, #0b7f6f 0%, var(--teal) 45%, #37d39a 100%); box-shadow: 0 22px 44px -18px rgba(14, 150, 130, .7); }
.hero.savings::after { content: ""; position: absolute; width: 220px; height: 220px; right: -70px; top: -90px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .3), transparent 65%); animation: float 8s ease-in-out infinite; }
.hero.savings .hero-lbl, .hero.savings .hero-row span { color: rgba(255, 255, 255, .8); }
.hero.savings .hero-row { border-top-color: rgba(255, 255, 255, .22); }
.view-ahorro .acct { border-top: 0; position: relative; overflow: hidden; }
.view-ahorro .acct::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: linear-gradient(90deg, var(--c), color-mix(in srgb, var(--c) 40%, var(--teal))); }
.view-ahorro .pill.accent { background: var(--teal); }

/* ---------- Color en el resto ---------- */
.mv-ico { background: color-mix(in srgb, var(--c, var(--gray)) 15%, var(--card)) !important; }
.bt i { background: var(--c, var(--text)); opacity: .85; }
.flow2 .in { background: color-mix(in srgb, var(--green) 11%, var(--card)); }
.flow2 .out { background: color-mix(in srgb, var(--red) 9%, var(--card)); }
.flow2 .in b { color: var(--green); } .flow2 .out b { color: var(--red); }
.flow2 .in i { background: var(--green); } .flow2 .out i { background: var(--red); }
.month-card { background: linear-gradient(180deg, color-mix(in srgb, var(--blue) 5%, var(--card)), var(--card) 40%); }
.tab.on::after { display: none; }
.tab.on svg { background: color-mix(in srgb, var(--blue) 14%, transparent); border-radius: 12px; padding: 3px 12px; width: 50px; height: 30px; box-sizing: border-box; transform: none; }
.tab-add { background: linear-gradient(135deg, var(--blue), var(--violet)); }
.menu-item:nth-child(6n+1) .mi-ico { background: color-mix(in srgb, #0a84ff 14%, var(--card)); }
.menu-item:nth-child(6n+2) .mi-ico { background: color-mix(in srgb, #ff9f0a 16%, var(--card)); }
.menu-item:nth-child(6n+3) .mi-ico { background: color-mix(in srgb, #30b158 15%, var(--card)); }
.menu-item:nth-child(6n+4) .mi-ico { background: color-mix(in srgb, #bf5af2 14%, var(--card)); }
.menu-item:nth-child(6n+5) .mi-ico { background: color-mix(in srgb, #ff375f 13%, var(--card)); }
.menu-item:nth-child(6n) .mi-ico { background: color-mix(in srgb, #12b3a6 15%, var(--card)); }
.acc { background: linear-gradient(160deg, color-mix(in srgb, var(--c) 10%, var(--card)), var(--card) 60%); }
.acc.add { background: transparent; }
.notice.warn { background: color-mix(in srgb, var(--orange) 9%, var(--card)); }
.notice.danger { background: color-mix(in srgb, var(--red) 8%, var(--card)); }
.notice.info { background: color-mix(in srgb, var(--blue) 8%, var(--card)); }
.wk-bar { background: color-mix(in srgb, var(--blue) 5%, var(--card)); }
.dnet { padding: 1px 5px; border-radius: 6px; margin-top: 2px; }
.dnet.pos { background: color-mix(in srgb, var(--green) 13%, transparent); }
.dnet.neg { background: color-mix(in srgb, var(--red) 11%, transparent); }
.dnet.zero { background: none; }
.day.today .dn { background: linear-gradient(135deg, var(--blue), var(--violet)); }
@media (min-width: 900px) {
  .dnet { display: block; align-self: flex-end; margin-top: auto; font-size: 12px; }
}

/* ---------- Próximos 7 días: plegable ---------- */
.fold-head { cursor: pointer; margin-bottom: 0; }
.fold-head h2 small { font-weight: 600; margin-left: 4px; }
.fold-r { display: inline-flex; align-items: center; gap: 8px; }
.fold-chev { display: inline-flex; color: var(--muted); transition: transform .3s var(--ease); }
.fold-chev svg { width: 18px; height: 18px; }
.fold.open .fold-chev { transform: rotate(180deg); }
.fold-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .35s var(--ease), margin .35s var(--ease); }
.fold-body > div { overflow: hidden; min-height: 0; }
.fold.open .fold-body { grid-template-rows: 1fr; margin-top: 12px; }

/* ---------- Entrada de la app (y al volver a Inicio) ---------- */
@keyframes rise-in { from { opacity: 0; transform: translateY(26px) scale(.97); filter: blur(8px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes card-in { from { opacity: 0; transform: translateY(18px) scale(.94) rotateX(8deg); filter: blur(10px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes grow-x { from { transform: scaleX(0); } to { transform: none; } }
@keyframes chip-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
body.reveal #view.view-inicio > *, #view.view-inicio.enter > * { animation: rise-in .7s var(--ease) both; }
body.reveal #view.view-inicio > .balance, #view.view-inicio.enter > .balance { animation: card-in .9s var(--ease) both, mesh 14s ease-in-out infinite alternate; transform-origin: 50% 100%; }
body.reveal #view.view-inicio > .balance::after, #view.view-inicio.enter > .balance::after { animation: sweep 1.3s ease .55s both; }
body.reveal #view.view-inicio .kpis > *, #view.view-inicio.enter .kpis > * { animation: chip-in .5s var(--ease) both; }
body.reveal #view.view-inicio .kpis > :nth-child(1), #view.view-inicio.enter .kpis > :nth-child(1) { animation-delay: .45s; }
body.reveal #view.view-inicio .kpis > :nth-child(2), #view.view-inicio.enter .kpis > :nth-child(2) { animation-delay: .55s; }
body.reveal #view.view-inicio .flow2 i, #view.view-inicio.enter .flow2 i,
body.reveal #view.view-inicio .bt i, #view.view-inicio.enter .bt i { transform-origin: left; animation: grow-x .9s var(--ease) both; animation-delay: calc(.5s + var(--i, 0) * .08s); }
body.reveal #view.view-inicio .acc, #view.view-inicio.enter .acc { animation: chip-in .5s var(--ease) both; }
body.reveal #view.view-inicio .acc:nth-child(2), #view.view-inicio.enter .acc:nth-child(2) { animation-delay: .08s; }
body.reveal #view.view-inicio .acc:nth-child(n+3), #view.view-inicio.enter .acc:nth-child(n+3) { animation-delay: .16s; }
body.reveal #view.view-inicio > :nth-child(2) { animation-delay: .12s; }
body.reveal #view.view-inicio > :nth-child(3) { animation-delay: .22s; }
body.reveal #view.view-inicio > :nth-child(4) { animation-delay: .32s; }
body.reveal #view.view-inicio > :nth-child(5) { animation-delay: .4s; }
body.reveal #view.view-inicio > :nth-child(6) { animation-delay: .48s; }
body.reveal #view.view-inicio > :nth-child(n+7) { animation-delay: .56s; }
body.reveal #view.view-ahorro .hero.savings, #view.view-ahorro.enter .hero.savings { animation: card-in .8s var(--ease) both; }

/* Pantalla de entrada */
#splash { background: radial-gradient(90% 60% at 50% 40%, color-mix(in srgb, var(--blue) 22%, #0b0b12) 0%, #07070b 70%); }
.sp-mark { position: relative; width: 150px; height: 150px; display: flex; align-items: center; justify-content: center; }
.sp-ring { position: absolute; inset: 0; border-radius: 50%; padding: 2px;
  background: conic-gradient(from 0deg, transparent 0 55%, var(--blue), var(--violet), var(--pink), transparent 95%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1px)); mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1px));
  animation: spin 1.6s linear infinite, sp-fade .6s ease both; filter: drop-shadow(0 0 8px color-mix(in srgb, var(--blue) 70%, transparent)); }
.sp-mark::after { content: ""; position: absolute; inset: 18px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .08); }
.sp-mark .sp-logo { width: 96px; height: 96px; border-radius: 24px; }
.sp-name { background: linear-gradient(90deg, #fff 0%, #fff 40%, color-mix(in srgb, var(--blue) 60%, #fff) 50%, #fff 60%, #fff 100%); background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: sp-fade .6s ease .2s both, shimmer 1.8s linear .4s infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -150% 0; } }

@media (prefers-reduced-motion: reduce) {
  .balance, .bal-glow, .hero.savings::after, .sp-ring, .sp-name { animation: none !important; }
  body.reveal #view.view-inicio *, #view.view-inicio.enter * { animation: none !important; }
  .fold-body { transition: none; }
}
@media (min-width: 900px) { .chip.nf { opacity: .5; border-left-style: dotted; } }
/* v3.2: aviso de ahorro del mes y cuadre con el banco en Inicio */
.notice.save { background: linear-gradient(120deg, color-mix(in srgb, var(--teal) 16%, var(--card)), var(--card)); border-color: color-mix(in srgb, var(--teal) 35%, transparent); }
.notice.save > i { background: var(--teal); box-shadow: 0 0 0 4px color-mix(in srgb, var(--teal) 22%, transparent); animation: pulse 2s ease-in-out infinite; }
.notice.save small { color: var(--muted); }
.notice.in-aho { margin: 4px 0 12px; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 25%, transparent); } 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--teal) 8%, transparent); } }
.cuadre-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cuadre-grid > div { background: var(--card2); border-radius: 14px; padding: 11px 12px; min-width: 0; }
.cuadre-grid span { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.cuadre-grid b { display: block; font-size: 16px; font-weight: 650; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cuadre-dif { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; padding: 11px 12px; border-radius: 14px; font-size: 14px; font-weight: 600; }
.cuadre-dif b { font-size: 16px; }
.cuadre-dif.ok { background: color-mix(in srgb, var(--green) 12%, var(--card)); color: var(--green); }
.cuadre-dif.mas { background: color-mix(in srgb, var(--blue) 10%, var(--card)); color: var(--blue); }
.cuadre-dif.menos { background: color-mix(in srgb, var(--red) 10%, var(--card)); color: var(--red); }
@media (prefers-reduced-motion: reduce) { .notice.save > i { animation: none; } }
/* v3.2: pestaña Más con perfil y cuadros */
.profile { display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: 22px; margin: 6px 0 4px; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(125deg, color-mix(in srgb, var(--blue) 90%, #000), var(--violet)); box-shadow: 0 16px 36px -18px color-mix(in srgb, var(--blue) 80%, #000); }
.profile::after { content: ""; position: absolute; width: 160px; height: 160px; right: -50px; top: -70px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .3), transparent 65%); pointer-events: none; }
.avatar { width: 48px; height: 48px; border-radius: 16px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; background: rgba(255, 255, 255, .2); border: 1px solid rgba(255, 255, 255, .3); }
.pf-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pf-body b { font-size: 17px; }
.pf-body small { font-size: 12.5px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-sync { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 7px 10px; border-radius: 99px; background: rgba(255, 255, 255, .18); color: #fff; }
.pf-sync svg { width: 14px; height: 14px; }
body.busy .pf-sync svg { animation: spin 1s linear infinite; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 14px; min-height: 112px; border-radius: 20px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 12%, var(--card)), var(--card) 70%); border: 1px solid var(--line); box-shadow: var(--shadow);
  transition: transform .15s var(--ease); }
.tile:active { transform: scale(.96); }
.tile-ico { width: 40px; height: 40px; border-radius: 13px; display: flex; align-items: center; justify-content: center; font-size: 20px; margin-bottom: auto;
  background: color-mix(in srgb, var(--c) 18%, var(--card)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 25%, transparent); }
.tile-t { font-weight: 650; font-size: 15px; margin-top: 12px; line-height: 1.2; }
.tile-s { font-size: 12px; color: var(--muted); line-height: 1.25; }
.tile .badge { position: absolute; top: 12px; right: 12px; }
.switch { width: 44px; height: 26px; border-radius: 99px; background: var(--gray-bg); position: relative; flex: none; transition: background .2s; }
.switch i { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .25s var(--spring); }
.switch.on { background: var(--green); }
.switch.on i { transform: translateX(18px); }
#view.view-mas.enter .tile { animation: chip-in .45s var(--ease) both; }
#view.view-mas.enter .tile:nth-child(2) { animation-delay: .04s; } #view.view-mas.enter .tile:nth-child(3) { animation-delay: .08s; }
#view.view-mas.enter .tile:nth-child(4) { animation-delay: .12s; } #view.view-mas.enter .tile:nth-child(n+5) { animation-delay: .16s; }
@media (prefers-reduced-motion: reduce) { #view.view-mas.enter .tile { animation: none; } }
