:root{
  --bg0:#0b1220;
  --bg1:#0f1a32;
  --card:rgba(255,255,255,.08);
  --card2:rgba(255,255,255,.06);
  --stroke:rgba(255,255,255,.14);
  --text:rgba(255,255,255,.92);
  --muted:rgba(255,255,255,.68);
  --shadow:0 24px 60px rgba(0,0,0,.35);
  --shadow2:0 10px 28px rgba(0,0,0,.25);
  --radius:18px;
  --radius2:14px;
  --pos:#22c55e;
  --neg:#f43f5e;
  --brand:#7c3aed;
  --brand2:#22d3ee;
  --focus:rgba(34,211,238,.5);
  --mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --font:Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

html[data-theme="light"]{
  --bg0:#f6f7fb;
  --bg1:#eef2ff;
  --card:rgba(255,255,255,.86);
  --card2:rgba(255,255,255,.72);
  --stroke:rgba(15,23,42,.10);
  --text:rgba(15,23,42,.92);
  --muted:rgba(15,23,42,.66);
  --shadow:0 18px 40px rgba(15,23,42,.12);
  --shadow2:0 10px 22px rgba(15,23,42,.10);
}

*{box-sizing:border-box}
body{
  margin:0;
  min-height:100vh;
  font-family:var(--font);
  color:var(--text);
  background:radial-gradient(1200px 700px at 10% -10%, rgba(124,58,237,.35), transparent 60%),
             radial-gradient(900px 600px at 90% 0%, rgba(34,211,238,.28), transparent 55%),
             linear-gradient(180deg, var(--bg0), var(--bg1));
  overflow-x:hidden;
}

.bg{position:fixed; inset:0; pointer-events:none; z-index:-1}
.bg__blob{
  position:absolute;
  width:560px; height:560px;
  filter:blur(40px);
  opacity:.35;
  border-radius:999px;
}
.bg__blob--a{left:-160px; top:-200px; background:radial-gradient(circle at 30% 30%, var(--brand), transparent 70%)}
.bg__blob--b{right:-220px; top:-220px; background:radial-gradient(circle at 30% 30%, var(--brand2), transparent 70%)}

.topbar{
  position:sticky;
  top:0;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:18px 22px;
  backdrop-filter:blur(16px);
  background:linear-gradient(180deg, rgba(0,0,0,.18), rgba(0,0,0,0));
  border-bottom:1px solid rgba(255,255,255,.06);
}
html[data-theme="light"] .topbar{
  background:linear-gradient(180deg, rgba(255,255,255,.75), rgba(255,255,255,0));
  border-bottom:1px solid rgba(15,23,42,.08);
}

.brand{display:flex; align-items:center; gap:12px}
.brand__mark{
  width:44px; height:44px;
  display:grid; place-items:center;
  border-radius:14px;
  color:rgba(255,255,255,.92);
  background:linear-gradient(135deg, rgba(124,58,237,.9), rgba(34,211,238,.7));
  box-shadow:var(--shadow2);
}
html[data-theme="light"] .brand__mark{color:white}
.brand__title{font-weight:700; letter-spacing:.2px}
.brand__sub{font-size:12px; color:var(--muted); margin-top:2px}

.topbar__right{display:flex; align-items:center; gap:10px}
.sep{width:1px; height:18px; background:var(--stroke)}
.iconbtn{
  width:40px; height:40px;
  border-radius:14px;
  border:1px solid var(--stroke);
  background:var(--card2);
  color:var(--text);
  display:grid; place-items:center;
  box-shadow:var(--shadow2);
  cursor:pointer;
  transition:transform .12s ease, background .12s ease, border-color .12s ease;
}
.iconbtn:hover{transform:translateY(-1px); background:var(--card)}
.iconbtn:active{transform:translateY(0)}

.container{max-width:1180px; margin:0 auto; padding:18px 22px 40px}
.grid{
  display:grid;
  grid-template-columns:1.15fr .85fr;
  gap:18px;
}

.card{
  border-radius:var(--radius);
  background:linear-gradient(180deg, var(--card), rgba(255,255,255,.04));
  border:1px solid var(--stroke);
  box-shadow:var(--shadow);
}

.hero{padding:18px 18px 16px}
.hero__head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  padding-bottom:14px;
  border-bottom:1px solid rgba(255,255,255,.08);
}
html[data-theme="light"] .hero__head{border-bottom:1px solid rgba(15,23,42,.08)}

.muted{color:var(--muted)}
.money{
  font-size:34px;
  font-weight:700;
  letter-spacing:-.4px;
  margin-top:4px;
}
.pillrow{display:flex; gap:10px; flex-wrap:wrap; justify-content:flex-end}
.pill{
  font-size:12px;
  padding:8px 10px;
  border-radius:999px;
  border:1px solid var(--stroke);
  background:rgba(255,255,255,.06);
  white-space:nowrap;
}
.pill--pos{color:rgba(34,197,94,.92); border-color:rgba(34,197,94,.28); background:rgba(34,197,94,.08)}
.pill--neg{color:rgba(244,63,94,.92); border-color:rgba(244,63,94,.30); background:rgba(244,63,94,.08)}

.hero__body{padding-top:12px}
.chart{display:flex; flex-direction:column; gap:8px}
.chart__title{display:flex; align-items:center; justify-content:space-between; font-size:12px}
canvas{width:100%; height:auto; border-radius:14px; background:rgba(255,255,255,.04); border:1px solid rgba(255,255,255,.08)}
html[data-theme="light"] canvas{background:rgba(15,23,42,.03); border-color:rgba(15,23,42,.08)}

.card__title{padding:16px 16px 12px; font-weight:700}
.formcard{padding-bottom:14px}
.form{padding:0 16px 16px; display:flex; flex-direction:column; gap:14px}

.seg{
  display:flex;
  background:rgba(255,255,255,.06);
  border:1px solid var(--stroke);
  border-radius:999px;
  padding:4px;
}
.seg__btn{
  flex:1;
  border:0;
  border-radius:999px;
  background:transparent;
  color:var(--muted);
  padding:10px 12px;
  cursor:pointer;
  transition:background .12s ease, color .12s ease, transform .12s ease;
  font-weight:600;
}
.seg__btn.is-active{
  background:linear-gradient(135deg, rgba(124,58,237,.95), rgba(34,211,238,.75));
  color:white;
  box-shadow:var(--shadow2);
}
.seg__btn:active{transform:scale(.99)}

.row{display:grid; gap:12px}
.row--2{grid-template-columns:1fr 1fr}
.row--3{grid-template-columns:1fr 1fr 1fr}
.row--actions{grid-template-columns:1fr 1fr}

.field{display:flex; flex-direction:column; gap:8px}
.field__label{font-size:12px; color:var(--muted)}
.field__control{
  display:flex; align-items:center; gap:8px;
  padding:12px 12px;
  border-radius:var(--radius2);
  border:1px solid var(--stroke);
  background:rgba(255,255,255,.06);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.06);
}
input, select{
  width:100%;
  border:0;
  outline:none;
  background:transparent;
  color:var(--text);
  font:inherit;
}
select{appearance:none}
input::placeholder{color:rgba(255,255,255,.45)}
html[data-theme="light"] input::placeholder{color:rgba(15,23,42,.40)}
.field__prefix{font-family:var(--mono); color:var(--muted)}
.field__control:focus-within{
  border-color:rgba(34,211,238,.55);
  box-shadow:0 0 0 4px rgba(34,211,238,.14);
}

.selectwrap{
  position:relative;
  width:100%;
  display:flex;
  align-items:center;
}
.selectwrap select{
  cursor:pointer;
  padding-right:34px;
}
.selectwrap__icon{
  position:absolute;
  right:10px;
  top:50%;
  transform:translateY(-50%);
  color:var(--muted);
  pointer-events:none;
}
.selectwrap--chip select{
  padding-right:32px;
}

.btn{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  padding:12px 14px;
  border-radius:14px;
  border:1px solid var(--stroke);
  background:rgba(255,255,255,.06);
  color:var(--text);
  cursor:pointer;
  font-weight:700;
  transition:transform .12s ease, background .12s ease;
}
.btn:hover{background:rgba(255,255,255,.10); transform:translateY(-1px)}
.btn:active{transform:translateY(0)}
.btn--primary{
  border-color:rgba(124,58,237,.30);
  background:linear-gradient(135deg, rgba(124,58,237,.95), rgba(34,211,238,.78));
  color:white;
}
.btn--danger{
  border-color:rgba(244,63,94,.34);
  background:rgba(244,63,94,.10);
  color:rgba(244,63,94,.92);
}
.btn__kbd{
  font-family:var(--mono);
  font-size:11px;
  font-weight:700;
  padding:4px 6px;
  border-radius:8px;
  background:rgba(255,255,255,.16);
  border:1px solid rgba(255,255,255,.18);
}

.listcard{grid-column:1 / -1}
.listhead{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  padding:16px 16px 10px;
  border-bottom:1px solid rgba(255,255,255,.08);
}
html[data-theme="light"] .listhead{border-bottom:1px solid rgba(15,23,42,.08)}
.filters{display:flex; gap:10px; flex-wrap:wrap; justify-content:flex-end}
.chip{
  display:flex; align-items:center; gap:10px;
  padding:8px 10px;
  border-radius:999px;
  border:1px solid var(--stroke);
  background:rgba(255,255,255,.06);
}
.chip__label{font-size:12px; color:var(--muted)}
.chip--search{min-width:220px}

.list{padding:10px 10px 14px}
.item{
  display:grid;
  grid-template-columns:1fr auto;
  gap:10px;
  padding:12px 12px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.05);
  margin:10px 6px;
  box-shadow:var(--shadow2);
}
html[data-theme="light"] .item{border-color:rgba(15,23,42,.08); background:rgba(255,255,255,.70)}
.item__meta{display:flex; flex-direction:column; gap:8px}
.item__top{display:flex; align-items:center; gap:10px; flex-wrap:wrap}
.badge{
  font-size:12px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--stroke);
  background:rgba(255,255,255,.06);
}
.badge--pos{border-color:rgba(34,197,94,.28); background:rgba(34,197,94,.08); color:rgba(34,197,94,.92)}
.badge--neg{border-color:rgba(244,63,94,.30); background:rgba(244,63,94,.08); color:rgba(244,63,94,.92)}
.item__note{font-weight:700}
.item__sub{font-size:12px; color:var(--muted)}
.item__right{display:flex; align-items:center; gap:10px}
.item__amount{
  font-family:var(--mono);
  font-weight:800;
  letter-spacing:.1px;
}
.item__amount.is-pos{color:rgba(34,197,94,.92)}
.item__amount.is-neg{color:rgba(244,63,94,.92)}
.mini{
  width:36px; height:36px;
  border-radius:12px;
  border:1px solid var(--stroke);
  background:rgba(255,255,255,.06);
  display:grid; place-items:center;
  cursor:pointer;
  transition:transform .12s ease, background .12s ease;
}
.mini:hover{background:rgba(255,255,255,.10); transform:translateY(-1px)}
.mini:active{transform:translateY(0)}
.mini svg{opacity:.9}

.empty{padding:40px 16px 46px; text-align:center}
.empty__title{font-weight:800; font-size:18px}
.empty__sub{margin-top:8px; color:var(--muted)}

.toast{
  position:fixed;
  left:50%;
  bottom:18px;
  z-index:9999;
  transform:translateX(-50%);
  background:rgba(0,0,0,.58);
  color:white;
  padding:12px 14px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.16);
  box-shadow:var(--shadow2);
  opacity:0;
  pointer-events:none;
  transition:opacity .14s ease, transform .14s ease;
}
html[data-theme="light"] .toast{background:rgba(15,23,42,.78)}
.toast.is-show{opacity:1; transform:translateX(-50%) translateY(-6px)}

.dialog{border:0; background:transparent; padding:0}
.dialog::backdrop{background:rgba(0,0,0,.40); backdrop-filter:blur(6px)}
.dialog__inner{
  width:min(520px, calc(100vw - 28px));
  background:linear-gradient(180deg, var(--card), rgba(255,255,255,.04));
  border:1px solid var(--stroke);
  border-radius:18px;
  box-shadow:var(--shadow);
  padding:14px;
}
.dialog__title{font-weight:800; padding:6px 8px 10px}
.dialog__body{padding:0 8px 8px}
.form--dialog{padding:10px 0 0}
.form--dialog .row--actions{margin-top:4px}
.exportbox{
  margin-top:10px;
  padding:12px 12px;
  border-radius:16px;
  border:1px solid var(--stroke);
  background:rgba(255,255,255,.06);
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px 14px;
}
.exportbox__row{display:flex; align-items:baseline; justify-content:space-between; gap:12px}
.exportbox__k{font-size:12px; color:var(--muted)}
.exportbox__v{font-family:var(--mono); font-weight:800}
.dialog__actions{display:flex; justify-content:flex-end; gap:10px; margin-top:14px; flex-wrap:wrap}
.dialog p{margin:0; line-height:1.6}

@media (max-width: 980px){
  .grid{grid-template-columns:1fr}
  .row--actions{grid-template-columns:1fr}
  .chip--search{min-width:180px}
}

@media (max-width: 520px){
  .topbar{padding:14px 14px}
  .container{padding:14px 14px 34px}
  .money{font-size:30px}
  .row--2{grid-template-columns:1fr}
  .row--3{grid-template-columns:1fr}
  .brand__sub{display:none}
}

[hidden]{display:none !important}

