:root{
  --bg:#f2f4f7; --card:#ffffff; --card-2:#f7f8fa; --text:#0f172a; --muted:#64748b; --line:#e5e8ee;
  --accent:#0f766e; --accent-ink:#ffffff; --accent-soft:#d9f3ef;
  --green:#15803d; --green-soft:#dcfce7; --red:#dc2626; --red-soft:#fee2e2; --blue:#2563eb; --blue-soft:#dbeafe; --amber:#b45309; --amber-soft:#fef3c7;
  --radius:18px; --radius-sm:12px; --shadow:0 1px 2px rgba(15,23,42,.06),0 4px 14px rgba(15,23,42,.04);
  --safe-b:env(safe-area-inset-bottom,0px); --safe-t:env(safe-area-inset-top,0px);
}
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]){ --bg:#0b1220; --card:#141d2e; --card-2:#1b2537; --text:#eef2f7; --muted:#94a3b8; --line:#26324a;
    --green:#4ade80; --green-soft:#0f2e1a; --red:#f87171; --red-soft:#3a1414; --blue:#60a5fa; --blue-soft:#12233f; --amber:#fbbf24; --amber-soft:#3a2a08;
    --shadow:0 1px 2px rgba(0,0,0,.4); }
}
:root[data-theme="dark"]{ --bg:#0b1220; --card:#141d2e; --card-2:#1b2537; --text:#eef2f7; --muted:#94a3b8; --line:#26324a;
  --green:#4ade80; --green-soft:#0f2e1a; --red:#f87171; --red-soft:#3a1414; --blue:#60a5fa; --blue-soft:#12233f; --amber:#fbbf24; --amber-soft:#3a2a08;
  --shadow:0 1px 2px rgba(0,0,0,.4); }
:root[data-theme="light"]{ --bg:#f2f4f7; --card:#ffffff; --card-2:#f7f8fa; --text:#0f172a; --muted:#64748b; --line:#e5e8ee;
  --green:#15803d; --green-soft:#dcfce7; --red:#dc2626; --red-soft:#fee2e2; --blue:#2563eb; --blue-soft:#dbeafe; --amber:#b45309; --amber-soft:#fef3c7;
  --shadow:0 1px 2px rgba(15,23,42,.06),0 4px 14px rgba(15,23,42,.04); }
*{box-sizing:border-box}
html,body{margin:0;background:var(--bg);color:var(--text);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Inter,system-ui,sans-serif;-webkit-font-smoothing:antialiased;font-size:16px;line-height:1.35}
body{padding-bottom:calc(84px + var(--safe-b));overscroll-behavior-y:none}
button,input,select,textarea{font:inherit;color:inherit}
button{cursor:pointer;border:0;background:none;padding:0}
a{color:inherit;text-decoration:none}
#app{max-width:640px;margin:0 auto;padding:calc(10px + var(--safe-t)) 16px 16px}
h1{font-size:26px;margin:8px 0 14px;letter-spacing:-.02em}
h2{font-size:18px;margin:22px 0 10px;letter-spacing:-.01em}
h3{font-size:15px;margin:0 0 6px}
.muted{color:var(--muted)} .small{font-size:13px} .xs{font-size:12px}
.green{color:var(--green)} .red{color:var(--red)} .blue{color:var(--blue)} .amber{color:var(--amber)}
.bold{font-weight:700} .semibold{font-weight:600}
.right{text-align:right} .center{text-align:center}
.row{display:flex;align-items:center;gap:10px} .row.between{justify-content:space-between} .row.wrap{flex-wrap:wrap}
.col{display:flex;flex-direction:column;gap:4px}
.grow{flex:1;min-width:0}
.mt{margin-top:12px} .mb{margin-bottom:12px}
.hide{display:none!important}
.ellipsis{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

.card{background:var(--card);border-radius:var(--radius);padding:16px;box-shadow:var(--shadow);margin-bottom:12px}
.card.flat{box-shadow:none;border:1px solid var(--line)}
.card.tight{padding:8px 0}
.card-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}
.card-head h3{margin:0;font-size:16px}
.link{color:var(--accent);font-weight:600;font-size:14px}

.topbar{display:flex;align-items:center;gap:10px;padding:4px 0 10px}
.topbar h1{margin:0;flex:1;font-size:22px}
.iconbtn{width:40px;height:40px;border-radius:50%;background:var(--card);box-shadow:var(--shadow);display:inline-flex;align-items:center;justify-content:center;color:var(--text);flex:none}
.iconbtn.ghost{background:transparent;box-shadow:none}
.iconbtn svg{width:20px;height:20px}
.iconbtn.spin svg{animation:spin 1s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}

.hero{background:linear-gradient(160deg,var(--accent) 0%,color-mix(in srgb,var(--accent) 55%,#0b1220) 100%);color:#fff;border-radius:22px;padding:20px 18px;margin-bottom:12px;box-shadow:0 8px 24px color-mix(in srgb,var(--accent) 30%,transparent)}
.hero .chip.active{background:#fff;color:var(--accent)}
.stat.flat{box-shadow:none;background:var(--card-2)}
.inline-ic{width:14px;height:14px;vertical-align:-2px;margin-right:2px}
#fab{box-shadow:0 8px 22px color-mix(in srgb,var(--accent) 40%,transparent)}
.hero .label{opacity:.85;font-size:13px}
.hero .big{font-size:36px;font-weight:800;letter-spacing:-.03em;margin:2px 0 4px;line-height:1.1}
.hero .sub{font-size:13px;opacity:.92}
.hero .chips{margin-top:12px}
.hero-tiles{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-top:14px}
.hero-tile{background:rgba(255,255,255,.13);border:1px solid rgba(255,255,255,.14);border-radius:14px;padding:9px 10px;color:#fff;text-align:left;min-width:0}
.hero-tile .t{font-size:11px;opacity:.85;display:flex;align-items:center;gap:4px;white-space:nowrap}
.hero-tile .t svg{width:13px;height:13px;flex:none}
.hero-tile .v{font-size:14px;font-weight:800;margin-top:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;letter-spacing:-.01em}
.hero-tile.pos .v{color:#86efac} .hero-tile.neg .v{color:#fca5a5}
.hero-tile.pos .t svg{color:#86efac} .hero-tile.neg .t svg{color:#fca5a5}
.chev svg{transition:transform .2s} .chev.open svg{transform:rotate(90deg)}
.sublist{background:var(--card-2);border-bottom:1px solid var(--line)}
.sublist .item{padding-left:28px}
.chips{display:flex;gap:8px;overflow-x:auto;padding-bottom:2px;scrollbar-width:none}
.chips::-webkit-scrollbar{display:none}
.chip{flex:none;padding:6px 12px;border-radius:999px;background:var(--card-2);border:1px solid var(--line);font-size:13px;font-weight:600;color:var(--text);white-space:nowrap}
.chip.active{background:var(--accent);color:var(--accent-ink);border-color:transparent}
.hero .chip{background:rgba(255,255,255,.14);border-color:rgba(255,255,255,.2);color:#fff}

.grid2{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-bottom:12px}
.stat{background:var(--card);border-radius:var(--radius);padding:14px;box-shadow:var(--shadow);text-align:left;width:100%}
.stat .t{font-size:13px;color:var(--muted);display:flex;align-items:center;gap:6px}
.stat .v{font-size:20px;font-weight:700;margin-top:4px;letter-spacing:-.01em}
.dot{width:22px;height:22px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;flex:none}
.dot svg{width:13px;height:13px}
.dot.g{background:var(--green);color:#fff} .dot.r{background:var(--red);color:#fff} .dot.b{background:var(--blue);color:#fff}

.list{display:flex;flex-direction:column}
.item{display:flex;align-items:center;gap:12px;padding:12px 16px;border-bottom:1px solid var(--line);background:transparent;width:100%;text-align:left}
.item:last-child{border-bottom:0}
.item.clickable:active{background:var(--card-2)}
.item .ic{width:40px;height:40px;border-radius:12px;display:flex;align-items:center;justify-content:center;flex:none;font-size:18px;background:var(--card-2)}
.item .ic svg{width:18px;height:18px}
.item .ic.g{background:var(--green-soft);color:var(--green)} .item .ic.r{background:var(--red-soft);color:var(--red)} .item .ic.b{background:var(--blue-soft);color:var(--blue)} .item .ic.a{background:var(--amber-soft);color:var(--amber)}
.item .body{flex:1;min-width:0}
.item .title{font-weight:600;font-size:15px}
.item .sub{font-size:13px;color:var(--muted);margin-top:1px}
.item .amt{font-weight:700;text-align:right;white-space:nowrap;font-size:15px}
.item .amt .sub{font-weight:500}
.item .chev{color:var(--muted);flex:none}
.item .chev svg{width:18px;height:18px}
.avatar{width:40px;height:40px;border-radius:12px;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:15px;flex:none;color:#fff}
.avatar.lg{width:56px;height:56px;border-radius:16px;font-size:20px}
.day-head{display:flex;justify-content:space-between;padding:14px 4px 6px;font-size:13px;color:var(--muted);font-weight:600}

.badge{display:inline-block;padding:2px 8px;border-radius:999px;font-size:12px;font-weight:600;background:var(--card-2);color:var(--muted)}
.badge.g{background:var(--green-soft);color:var(--green)} .badge.r{background:var(--red-soft);color:var(--red)} .badge.b{background:var(--blue-soft);color:var(--blue)} .badge.a{background:var(--amber-soft);color:var(--amber)}

.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:12px 18px;border-radius:14px;font-weight:700;font-size:15px;background:var(--accent);color:var(--accent-ink);width:100%}
.btn.secondary{background:var(--card-2);color:var(--text);border:1px solid var(--line)}
.btn.danger{background:var(--red-soft);color:var(--red)}
.btn.sm{padding:9px 14px;font-size:14px;width:auto;border-radius:12px}
.btn svg{width:18px;height:18px}
.btn:disabled{opacity:.5}
.btnrow{display:flex;gap:10px;margin-top:12px}
.btnrow .btn{flex:1}

.seg{display:flex;background:var(--card-2);border:1px solid var(--line);border-radius:12px;padding:3px;gap:3px}
.seg button{flex:1;padding:8px 6px;border-radius:9px;font-weight:600;font-size:14px;color:var(--muted)}
.seg button.active{background:var(--card);color:var(--text);box-shadow:var(--shadow)}
.seg button.active.g{color:var(--green)} .seg button.active.r{color:var(--red)}

.field{margin-bottom:14px}
.field label{display:block;font-size:13px;color:var(--muted);margin-bottom:6px;font-weight:600}
.field input,.field select,.field textarea{width:100%;background:var(--card-2);border:1px solid var(--line);border-radius:12px;padding:12px 14px;font-size:16px;outline:none;-webkit-appearance:none;appearance:none}
.field select{background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>");background-repeat:no-repeat;background-position:right 12px center;padding-right:36px}
.field input:focus,.field select:focus,.field textarea:focus{border-color:var(--accent)}
.field textarea{min-height:70px;resize:vertical}
.field .hint{font-size:12px;color:var(--muted);margin-top:5px}
.field.inline{display:flex;align-items:center;justify-content:space-between;gap:12px}
.field.inline label{margin:0}
.amount-wrap{text-align:center;margin:6px 0 16px}
.amount-wrap .cur{font-size:14px;color:var(--muted);font-weight:600;margin-bottom:4px}
.amount-wrap input{width:100%;text-align:center;font-size:40px;font-weight:800;letter-spacing:-.02em;background:transparent;border:0;outline:none;padding:4px}
.amount-wrap input::placeholder{color:var(--line)}
.two{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.switch{position:relative;width:46px;height:28px;border-radius:999px;background:var(--line);transition:.2s;flex:none}
.switch::after{content:"";position:absolute;top:3px;left:3px;width:22px;height:22px;border-radius:50%;background:#fff;transition:.2s;box-shadow:0 1px 3px rgba(0,0,0,.3)}
.switch.on{background:var(--accent)} .switch.on::after{left:21px}

.progress{height:6px;border-radius:999px;background:var(--line);overflow:hidden;margin-top:8px}
.progress > div{height:100%;background:var(--accent);border-radius:999px}
.progress > div.warn{background:var(--amber)} .progress > div.over{background:var(--red)}
.hero .hero-progress{background:rgba(255,255,255,.22);height:8px;margin-top:12px}
.hero .hero-progress > div.ok{background:#fff} .hero .hero-progress > div.warn{background:#fbbf24} .hero .hero-progress > div.over{background:#fca5a5}
.stat.sel{box-shadow:0 0 0 2px var(--accent)}

.search{display:flex;align-items:center;gap:8px;background:var(--card);border-radius:14px;padding:10px 14px;box-shadow:var(--shadow);margin-bottom:12px}
.search svg{width:18px;height:18px;color:var(--muted);flex:none}
.search input{flex:1;border:0;background:transparent;outline:none;font-size:15px;min-width:0}

.monthnav{display:flex;align-items:center;justify-content:space-between;background:var(--card);border-radius:14px;box-shadow:var(--shadow);padding:6px;margin-bottom:12px}
.monthnav .m{font-weight:700}
.monthnav button{width:38px;height:38px;border-radius:10px;display:flex;align-items:center;justify-content:center}
.monthnav button svg{width:18px;height:18px}

.empty{text-align:center;padding:28px 16px;color:var(--muted)}
.empty .big{font-size:34px;margin-bottom:8px}

.menu-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-bottom:8px}
.menu-grid button{display:flex;flex-direction:column;align-items:center;gap:8px;font-size:12px;color:var(--text);font-weight:600}
.menu-grid .ic{width:54px;height:54px;border-radius:16px;background:var(--card);box-shadow:var(--shadow);display:flex;align-items:center;justify-content:center;color:var(--accent)}
.menu-grid .ic svg{width:22px;height:22px}

#tabbar{position:fixed;left:0;right:0;bottom:0;background:var(--card);border-top:1px solid var(--line);display:flex;justify-content:space-around;padding:6px 0 calc(6px + var(--safe-b));z-index:20}
#tabbar a{display:flex;flex-direction:column;align-items:center;gap:2px;font-size:11px;font-weight:600;color:var(--muted);padding:4px 8px;min-width:56px}
#tabbar a svg{width:23px;height:23px}
#tabbar a.active{color:var(--accent)}
#fab{position:fixed;right:18px;bottom:calc(78px + var(--safe-b));width:58px;height:58px;border-radius:50%;background:var(--accent);color:var(--accent-ink);display:flex;align-items:center;justify-content:center;box-shadow:0 8px 22px rgba(15,118,110,.4);z-index:21}
#fab svg{width:26px;height:26px}
@media (min-width:660px){#fab{right:calc(50% - 320px + 18px)}}

#modal-root .overlay{position:fixed;inset:0;background:rgba(2,6,23,.5);z-index:30;display:flex;align-items:flex-end;justify-content:center;animation:fade .15s}
@keyframes fade{from{opacity:0}}
.sheet{background:var(--bg);width:100%;max-width:640px;max-height:92vh;border-radius:22px 22px 0 0;display:flex;flex-direction:column;animation:up .22s cubic-bezier(.2,.8,.2,1)}
@keyframes up{from{transform:translateY(40px);opacity:.6}}
.sheet-head{display:flex;align-items:center;gap:10px;padding:14px 16px 8px}
.sheet-head h3{flex:1;margin:0;font-size:18px}
.sheet-body{overflow-y:auto;padding:6px 16px calc(20px + var(--safe-b));-webkit-overflow-scrolling:touch}
.sheet .opt{display:flex;align-items:center;gap:14px;padding:14px 8px;border-bottom:1px solid var(--line);width:100%;text-align:left}
.sheet .opt:last-child{border-bottom:0}
.sheet .opt .ic{width:42px;height:42px;border-radius:12px;background:var(--card);display:flex;align-items:center;justify-content:center;box-shadow:var(--shadow);flex:none}
.sheet .opt .ic svg{width:20px;height:20px}
.sheet .opt .t{font-weight:700} .sheet .opt .s{font-size:13px;color:var(--muted)}
.sheet .opt .ic.g{color:var(--green)} .sheet .opt .ic.r{color:var(--red)} .sheet .opt .ic.b{color:var(--blue)} .sheet .opt .ic.a{color:var(--amber)}

#toast{position:fixed;left:50%;bottom:calc(150px + var(--safe-b));transform:translateX(-50%) translateY(20px);background:#0f172a;color:#fff;padding:10px 16px;border-radius:12px;font-size:14px;font-weight:600;opacity:0;pointer-events:none;transition:.2s;z-index:40;max-width:90vw;text-align:center}
#toast.show{opacity:1;transform:translateX(-50%)}
#toast.err{background:var(--red)}

.chart{width:100%;height:auto;display:block}
.legend{display:flex;gap:14px;font-size:12px;color:var(--muted);margin-top:6px;flex-wrap:wrap}
.legend i{display:inline-block;width:10px;height:10px;border-radius:3px;margin-right:5px;vertical-align:middle}
.section-title{display:flex;justify-content:space-between;align-items:baseline;margin:18px 4px 8px}
.section-title h2{margin:0}
.tl{position:relative;padding-left:18px}
.tl::before{content:"";position:absolute;left:5px;top:6px;bottom:6px;width:2px;background:var(--line)}
.tl .ev{position:relative;padding:8px 0 8px 10px}
.tl .ev::before{content:"";position:absolute;left:-17px;top:14px;width:8px;height:8px;border-radius:50%;background:var(--muted)}
.tl .ev.g::before{background:var(--green)} .tl .ev.r::before{background:var(--red)}
.install-hint{font-size:13px;color:var(--muted);line-height:1.55}
.install-hint b{color:var(--text)}
.payrow{display:flex;justify-content:space-between;align-items:center;width:100%;padding:7px 0;border-top:1px solid var(--line);text-align:left;font-size:13px}

/* cuentas */
.acc-ic{width:44px;height:44px;border-radius:13px;display:flex;align-items:center;justify-content:center;font-size:20px;flex:none;position:relative;overflow:hidden}
.acc-ic svg{width:20px;height:20px}
.acc-ic img{position:absolute;inset:0;margin:auto;width:62%;height:62%;object-fit:contain;border-radius:7px}
.acc-ic img ~ span{display:none}
.acc-ic.lg{width:64px;height:64px;border-radius:18px;font-size:30px}
.acc-ic.lg svg{width:28px;height:28px}
.acc-ic.sm{width:36px;height:36px;border-radius:10px;font-size:16px}
.tagb{display:inline-block;padding:1px 7px;border-radius:999px;font-size:11px;font-weight:600;background:var(--card-2);color:var(--muted);margin-left:6px;vertical-align:middle}
.starbtn{width:36px;height:36px;border-radius:50%;display:flex;align-items:center;justify-content:center;color:var(--line);flex:none}
.starbtn svg{width:22px;height:22px}
.starbtn.on{color:#f59e0b} .starbtn.on svg{fill:#f59e0b}
.donut-card{display:flex;align-items:center;gap:16px}
.donut{width:120px;height:120px;flex:none;transform:rotate(-90deg)}
.donut circle{transition:stroke-dasharray .3s}
.donut-info .label{font-size:13px;color:var(--muted)}
.donut-info .big{font-size:28px;font-weight:800;letter-spacing:-.02em;margin:2px 0 8px;line-height:1.1}
.palette{display:flex;gap:8px;flex-wrap:wrap}
.palette button{width:30px;height:30px;border-radius:50%;border:3px solid transparent}
.palette button.sel{border-color:var(--text)}
.icon-preview{display:flex;align-items:center;gap:12px;background:var(--card);border:1px solid var(--line);border-radius:12px;padding:10px 12px;margin-bottom:14px}
