/* ===== Runway design system — dual theme ===== */
:root {
  --bg: #f3f4fb; --bg2: #e8eaf7; --surface: #ffffff; --surface2: #f5f6fc; --text: #12142a; --muted: #6a6f92; --line: #e3e5f2;
  --accent: #6d4aff; --accent-soft: rgba(109, 74, 255, .11); --accent2: #19c39a; --on-accent: #fff;
  --income: #0fa97e; --expense: #ef4668; --warn: #e89a10; --crit: #ef4668; --info: #4a7bff;
  --shadow: 0 14px 34px -18px rgba(54, 40, 140, .35); --shadow-sm: 0 4px 14px -8px rgba(54, 40, 140, .3);
  --glass: rgba(255, 255, 255, .72);
  --hero: linear-gradient(135deg, #5b3df0 0%, #7a5cff 45%, #19c39a 120%);
  --r: 20px; --r-sm: 13px; --font: ui-rounded, "SF Pro Rounded", "Segoe UI Variable", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #090b14; --bg2: #0e1120; --surface: #141829; --surface2: #1b2037; --text: #eef0ff; --muted: #8e94b8; --line: #252b47;
  --accent: #8e72ff; --accent-soft: rgba(142, 114, 255, .16); --accent2: #2ee6a6;
  --income: #2ee6a6; --expense: #ff6b88; --warn: #ffb938; --crit: #ff6b88; --info: #6f9bff;
  --shadow: 0 18px 40px -20px rgba(0, 0, 0, .8); --shadow-sm: 0 6px 16px -10px rgba(0, 0, 0, .8);
  --glass: rgba(20, 24, 41, .72);
  --hero: linear-gradient(135deg, #3b2a9c 0%, #6a4df0 55%, #11a883 130%);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.45; -webkit-font-smoothing: antialiased; min-height: 100vh; min-height: 100dvh; transition: background .25s, color .25s; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; letter-spacing: -.02em; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
svg.i { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -.22em; }
.muted { color: var(--muted); } .small { font-size: .84rem; } .tiny { font-size: .74rem; } .bold { font-weight: 700; } .center { text-align: center; }
.income { color: var(--income); } .expense { color: var(--expense); }
.num { font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: .75rem; } .between { justify-content: space-between; } .wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: .9rem; } .stack-sm { display: flex; flex-direction: column; gap: .5rem; }
.grid { display: grid; gap: 1rem; } .g2 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 720px) { .g3, .g4 { grid-template-columns: repeat(2, 1fr); } .g2.keep { grid-template-columns: repeat(2, 1fr); } .g2:not(.keep) { grid-template-columns: 1fr; } }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ----- buttons & inputs ----- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .78rem 1.2rem; border-radius: 14px; font-weight: 700; background: var(--surface2); color: var(--text); border: 1px solid var(--line); transition: transform .12s, box-shadow .2s, background .2s, opacity .2s; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); } .btn:active { transform: translateY(0) scale(.98); }
.btn.primary { background: linear-gradient(135deg, var(--accent), #8a6bff); color: var(--on-accent); border-color: transparent; box-shadow: 0 10px 22px -10px var(--accent); }
.btn.mint { background: linear-gradient(135deg, #19c39a, #2ee6a6); color: #04281f; border-color: transparent; }
.btn.ghost { background: transparent; } .btn.danger { color: var(--crit); border-color: color-mix(in srgb, var(--crit) 40%, var(--line)); }
.btn.sm { padding: .5rem .85rem; font-size: .86rem; border-radius: 11px; } .btn.block { width: 100%; } .btn.lg { padding: 1rem 1.5rem; font-size: 1.05rem; border-radius: 16px; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.icon-btn { width: 42px; height: 42px; border-radius: 13px; display: inline-grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--text); position: relative; flex: none; }
.icon-btn:hover { background: var(--surface2); }
.dot { position: absolute; top: -4px; right: -4px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px; background: var(--expense); color: #fff; font-size: .7rem; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--bg); }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field > label, .lbl { font-size: .8rem; font-weight: 700; color: var(--muted); }
.input, select.input, textarea.input { width: 100%; padding: .8rem .95rem; border-radius: 13px; border: 1.5px solid var(--line); background: var(--surface2); outline: none; transition: border-color .15s, box-shadow .15s; min-width: 0; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.input::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
textarea.input { resize: vertical; min-height: 70px; }
.pw { position: relative; } .pw .input { padding-right: 3rem; } .pw button { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; color: var(--muted); border-radius: 10px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface2); border: 1px solid var(--line); }
.seg button { padding: .55rem .6rem; border-radius: 10px; font-weight: 700; font-size: .9rem; color: var(--muted); transition: .15s; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg button.on.exp { color: var(--expense); } .seg button.on.inc { color: var(--income); }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .75rem; border-radius: 99px; background: var(--surface2); border: 1px solid var(--line); font-size: .82rem; font-weight: 600; white-space: nowrap; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.chips { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; } .chips::-webkit-scrollbar { display: none; }
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .18rem .55rem; border-radius: 99px; font-size: .72rem; font-weight: 800; background: var(--accent-soft); color: var(--accent); }
.badge.ok { background: color-mix(in srgb, var(--income) 16%, transparent); color: var(--income); } .badge.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.badge.crit { background: color-mix(in srgb, var(--crit) 16%, transparent); color: var(--crit); } .badge.mute { background: var(--surface2); color: var(--muted); }
.switch { position: relative; width: 48px; height: 28px; flex: none; } .switch input { opacity: 0; position: absolute; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--line); transition: .2s; } .switch i::after { content: ""; position: absolute; width: 22px; height: 22px; top: 3px; left: 3px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); }
.switch input:checked + i { background: var(--accent); } .switch input:checked + i::after { transform: translateX(20px); }
.check { display: flex; gap: .6rem; align-items: flex-start; font-size: .9rem; cursor: pointer; } .check input { width: 20px; height: 20px; accent-color: var(--accent); margin-top: 1px; flex: none; }

/* ----- cards ----- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1.15rem; box-shadow: var(--shadow-sm); }
.card.flat { box-shadow: none; } .card.soft { background: var(--surface2); box-shadow: none; }
.card-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: .85rem; gap: .5rem; } .card-h h3 { font-size: 1.02rem; }
.link { color: var(--accent); font-weight: 700; font-size: .86rem; }
.progress { height: 9px; border-radius: 99px; background: var(--surface2); overflow: hidden; border: 1px solid var(--line); }
.progress > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.progress.warn > i { background: var(--warn); } .progress.crit > i { background: var(--crit); }
.avatar { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 1.3rem; flex: none; background: var(--surface2); }
.item { display: flex; align-items: center; gap: .85rem; padding: .7rem .2rem; border-bottom: 1px solid var(--line); cursor: pointer; } .item:last-child { border-bottom: 0; }
.item:hover .t { color: var(--accent); }
.day-h { font-size: .76rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin: 1rem 0 .1rem; }
.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); } .empty .big { font-size: 2.4rem; margin-bottom: .4rem; }
.skeleton { background: linear-gradient(100deg, var(--surface2) 30%, var(--line) 50%, var(--surface2) 70%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 12px; } @keyframes sk { to { background-position: -200% 0; } }

/* ----- sheet / modal ----- */
.overlay { position: fixed; inset: 0; background: rgba(8, 8, 24, .55); backdrop-filter: blur(6px); z-index: 80; display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.sheet { width: 100%; max-width: 560px; max-height: 92dvh; overflow: auto; background: var(--surface); border-radius: 26px 26px 0 0; padding: 1.2rem 1.2rem calc(1.4rem + env(safe-area-inset-bottom)); animation: up .28s cubic-bezier(.2, .8, .2, 1); border: 1px solid var(--line); }
.sheet .grab { width: 44px; height: 5px; border-radius: 9px; background: var(--line); margin: -.4rem auto .9rem; }
.sheet-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; } .sheet-h h3 { font-size: 1.25rem; }
@media (min-width: 720px) { .overlay { align-items: center; } .sheet { border-radius: 26px; padding-bottom: 1.4rem; } .sheet .grab { display: none; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } } @keyframes fade { from { opacity: 0; } }
.toasts { position: fixed; z-index: 120; left: 0; right: 0; bottom: calc(86px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: .5rem; pointer-events: none; padding: 0 1rem; }
@media (min-width: 900px) { .toasts { bottom: 24px; } }
.toast { pointer-events: auto; max-width: 440px; width: 100%; background: var(--text); color: var(--bg); padding: .85rem 1rem; border-radius: 16px; font-weight: 600; font-size: .92rem; box-shadow: var(--shadow); animation: up .25s; display: flex; gap: .7rem; align-items: flex-start; }
.toast.err { background: var(--crit); color: #fff; } .toast.alert { background: var(--surface); color: var(--text); border: 1px solid var(--line); } .toast b { display: block; }
.amount-in { font-size: 2.6rem; font-weight: 800; text-align: center; background: transparent; border: 0; width: 100%; outline: none; letter-spacing: -.03em; padding: .2rem 0; }
.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: .5rem; }
.cat { display: flex; flex-direction: column; align-items: center; gap: .25rem; padding: .6rem .3rem; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface2); font-size: .74rem; font-weight: 700; text-align: center; transition: .15s; }
.cat span { font-size: 1.4rem; } .cat.on { border-color: var(--accent); background: var(--accent-soft); }

/* ----- app shell ----- */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100dvh; }
.side { position: sticky; top: 0; height: 100dvh; padding: 1.3rem 1rem; border-right: 1px solid var(--line); background: var(--bg2); display: flex; flex-direction: column; gap: .25rem; }
.brand { display: flex; align-items: center; gap: .65rem; font-weight: 800; font-size: 1.3rem; letter-spacing: -.03em; padding: .2rem .5rem 1.1rem; } .brand img { width: 34px; height: 34px; border-radius: 10px; }
.nav a { display: flex; align-items: center; gap: .8rem; padding: .7rem .85rem; border-radius: 13px; color: var(--muted); font-weight: 700; position: relative; }
.nav a:hover { background: var(--surface); color: var(--text); } .nav a.on { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }
.nav a .badge { margin-left: auto; }
.side .me { margin-top: auto; display: flex; align-items: center; gap: .7rem; padding: .7rem; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.main { padding: 1.4rem clamp(1rem, 3vw, 2.4rem) 6rem; max-width: 1060px; width: 100%; margin: 0 auto; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.top h1 { font-size: clamp(1.5rem, 4vw, 2rem); } .top .sub { color: var(--muted); font-size: .92rem; margin-top: .2rem; }
.tabbar { display: none; }
@media (max-width: 899px) {
  .shell { grid-template-columns: 1fr; } .side { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 60; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); padding: 8px; border-radius: 24px; background: var(--glass); backdrop-filter: blur(18px) saturate(1.4); border: 1px solid var(--line); box-shadow: var(--shadow); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .68rem; font-weight: 700; color: var(--muted); padding: .35rem 0; border-radius: 16px; position: relative; } .tabbar a svg { width: 24px; height: 24px; }
  .tabbar a.on { color: var(--accent); }
  .tabbar .add { margin-top: -30px; } .tabbar .add i { width: 58px; height: 58px; border-radius: 20px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; box-shadow: 0 12px 24px -8px var(--accent); border: 4px solid var(--bg); } .tabbar .add span { display: none; }
  .main { padding-bottom: 8rem; }
}
.fab-d { display: none; } @media (min-width: 900px) { .fab-d { display: inline-flex; } }

/* ----- dashboard ----- */
.hero { position: relative; overflow: hidden; border-radius: 28px; padding: 1.5rem; color: #fff; background: var(--hero); box-shadow: 0 24px 50px -24px var(--accent); }
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .1); } .hero::before { width: 260px; height: 260px; right: -70px; top: -90px; } .hero::after { width: 170px; height: 170px; right: 80px; bottom: -110px; background: rgba(255, 255, 255, .07); }
.hero > * { position: relative; z-index: 1; }
.hero .lbl { color: rgba(255, 255, 255, .78); font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; }
.hero .big { font-size: clamp(3rem, 12vw, 4.6rem); font-weight: 800; letter-spacing: -.05em; line-height: 1; margin: .3rem 0 .15rem; } .hero .big small { font-size: .32em; letter-spacing: 0; font-weight: 700; opacity: .85; margin-left: .35rem; }
.hero .cap { color: rgba(255, 255, 255, .86); font-size: .95rem; max-width: 34ch; }
.hero .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin-top: 1.2rem; } .hero .stat { background: rgba(255, 255, 255, .14); border-radius: 16px; padding: .7rem .8rem; backdrop-filter: blur(8px); } .hero .stat b { display: block; font-size: 1.08rem; letter-spacing: -.02em; } .hero .stat span { font-size: .7rem; opacity: .8; font-weight: 700; }
.hero .meter { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .22); margin-top: 1rem; overflow: hidden; } .hero .meter i { display: block; height: 100%; background: #fff; border-radius: 99px; }
.wallets { display: flex; gap: .8rem; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x mandatory; scrollbar-width: none; } .wallets::-webkit-scrollbar { display: none; }
.wallet { scroll-snap-align: start; min-width: 190px; border-radius: 20px; padding: 1rem; color: #fff; position: relative; overflow: hidden; box-shadow: var(--shadow-sm); cursor: pointer; }
.wallet::after { content: ""; position: absolute; width: 110px; height: 110px; right: -30px; bottom: -40px; background: rgba(255, 255, 255, .16); border-radius: 50%; }
.wallet .n { font-weight: 700; font-size: .86rem; opacity: .92; } .wallet .b { font-size: 1.45rem; font-weight: 800; letter-spacing: -.03em; margin-top: .35rem; } .wallet .w { font-size: .72rem; font-weight: 800; background: rgba(0, 0, 0, .22); display: inline-block; padding: .15rem .5rem; border-radius: 99px; margin-top: .4rem; }
.wallet.add { background: var(--surface2); color: var(--muted); display: grid; place-items: center; border: 2px dashed var(--line); box-shadow: none; min-width: 120px; } .wallet.add::after { display: none; }
.donut-wrap { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; } .legend { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: .4rem; font-size: .88rem; } .legend div { display: flex; align-items: center; gap: .55rem; } .legend i { width: 10px; height: 10px; border-radius: 4px; flex: none; }
.chart text { fill: var(--muted); font-size: 10.5px; font-weight: 700; font-family: var(--font); }
a.alert-i { color: inherit; }
.alert-i { display: flex; gap: .8rem; padding: .85rem; border-radius: 16px; background: var(--surface2); border: 1px solid var(--line); border-left: 4px solid var(--info); } .alert-i.warning { border-left-color: var(--warn); } .alert-i.critical { border-left-color: var(--crit); } .alert-i.unread { background: var(--surface); box-shadow: var(--shadow-sm); }
.alert-i .em { font-size: 1.5rem; line-height: 1; }
.ring { --p: 0; width: 64px; height: 64px; border-radius: 50%; background: conic-gradient(var(--c, var(--accent)) calc(var(--p) * 1%), var(--surface2) 0); display: grid; place-items: center; flex: none; } .ring b { width: 50px; height: 50px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: .8rem; }
.kpi { padding: 1rem; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); } .kpi .l { font-size: .74rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; } .kpi .v { font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; margin-top: .15rem; }
.otp { display: flex; gap: .5rem; justify-content: center; } .otp input { width: 100%; max-width: 54px; height: 62px; text-align: center; font-size: 1.6rem; font-weight: 800; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface2); outline: none; } .otp input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); } .otp input.filled { border-color: var(--accent); }
.shake { animation: shake .35s; } @keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; } .tbl th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: .6rem .7rem; border-bottom: 1px solid var(--line); white-space: nowrap; } .tbl td { padding: .75rem .7rem; border-bottom: 1px solid var(--line); vertical-align: middle; } .tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: var(--surface2); }
.scroll-x { overflow-x: auto; }
.qr { width: 240px; height: 240px; border-radius: 18px; background: #fff; padding: 10px; margin: 0 auto; display: block; }
.spin { width: 18px; height: 18px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: rot .7s linear infinite; display: inline-block; } @keyframes rot { to { transform: rotate(360deg); } }
.page-loader { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 200; transition: opacity .3s; } .page-loader.off { opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
