:root {
  --green: #1f9d4a;
  --green-dark: #157a36;
  --ink: #173024;
  --muted: #6d7a73;
  --line: #e5eee8;
  --bg: #f4f7f5;
  --card: #ffffff;
  --red: #d64545;
  --soft: #e8f6ee;
  --shadow: 0 10px 30px rgba(23, 48, 36, 0.06);
  font-family: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: #dfe8e2; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, p { margin: 0; }

.stage {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px 12px;
}

.phone {
  width: min(420px, 100%);
  height: min(900px, calc(100vh - 48px));
  background: var(--bg);
  border-radius: 32px;
  box-shadow: 0 24px 60px rgba(23, 48, 36, 0.16);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.screen {
  flex: 1;
  overflow: auto;
  padding: 18px 18px 28px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 8px 6px calc(10px + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid var(--line);
}

.tab {
  border: 0;
  background: transparent;
  color: #8b978f;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 0;
  font-size: 10px;
  font-weight: 600;
}
.tab svg { width: 22px; height: 22px; }
.tab.is-on { color: var(--green); }

svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.top strong { font-size: 16px; }
.title-top { align-items: flex-start; }
.title-top h1 { font-size: 28px; letter-spacing: -0.04em; line-height: 1.1; }
.title-top p { color: var(--muted); margin-top: 4px; font-size: 14px; }
.eyebrow { color: var(--muted); font-size: 13px; font-weight: 600; }

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 0;
  background: #fff;
  color: var(--green);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
  position: relative;
  flex: none;
}
.icon-btn.solid { background: var(--green); color: #fff; }
.icon-btn .dot {
  position: absolute;
  top: 4px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  border-radius: 99px;
  background: var(--red);
  color: #fff;
  font-style: normal;
  font-size: 10px;
  display: grid;
  place-items: center;
  padding: 0 4px;
}

.hero { margin: 6px 0 16px; }
.hero p { color: var(--muted); font-size: 15px; }
.hero h1 {
  font-size: 64px;
  line-height: 1;
  letter-spacing: -0.05em;
  color: var(--green);
  margin: 4px 0;
}
.hero h1.is-neg { color: var(--red); }
.fine { color: var(--muted); font-size: 13px; line-height: 1.4; }

.banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.banner p { font-weight: 600; flex: 1; }
.banner-btn {
  width: 100%;
  border: 0;
  text-align: left;
  font-weight: 600;
  color: var(--green-dark);
}
.banner-btn span { flex: 1; }
.banner-btn svg { width: 18px; height: 18px; }

.block, .card {
  background: #fff;
  border-radius: 20px;
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.block-head, .card .block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.block-head h2, .card h2 { font-size: 16px; }
.block-head .text-btn { margin: 0; }
.pad { padding: 4px 2px 8px; }
.block > .text-btn { margin: 8px 0 0; }

.cats, .bills, .tx, .budget-list, .goal-list, .plain { list-style: none; margin: 0; padding: 0; }
.cats li, .bills li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}
.cats li > div, .tx-main { flex: 1; min-width: 0; }
.row-top, .tx-main b, .bills b { display: flex; justify-content: space-between; gap: 8px; }
.row-top span, .tx-main small, .bills small, .tx-side small { color: var(--muted); font-size: 12px; }
.blob {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--soft);
  color: var(--green);
  display: grid;
  place-items: center;
  flex: none;
}
.blob svg { width: 18px; height: 18px; }
.bar { height: 8px; background: #e7eeea; border-radius: 99px; overflow: hidden; margin-top: 6px; }
.bar > span { display: block; height: 100%; background: var(--green); border-radius: 99px; }

.bills strong { margin-left: auto; font-size: 16px; }
.balances { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.balance {
  border: 0;
  background: var(--bg);
  border-radius: 16px;
  padding: 12px;
  text-align: left;
  display: grid;
  gap: 4px;
}
.balance small { color: var(--muted); }
.balance b { font-size: 22px; letter-spacing: -0.03em; }

.import-line { color: var(--muted); font-size: 12px; text-align: center; margin: 8px 0 18px; }
.import-line .text-btn { display: inline; margin: 0; font-size: 12px; }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border-radius: 14px;
  padding: 0 12px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.search svg { width: 18px; height: 18px; color: var(--muted); }
.search input { border: 0; background: transparent; width: 100%; padding: 12px 0; outline: none; }

.chips { display: flex; gap: 8px; margin-bottom: 8px; overflow: auto; }
.chip {
  border: 0;
  background: #fff;
  border-radius: 99px;
  padding: 8px 12px;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}
.chip.is-on { background: var(--soft); color: var(--green-dark); }

.tx li + li, .budget-list li + li, .goal-list li + li { border-top: 1px solid var(--line); }
.tx button, .budget-list button, .goal-list button {
  width: 100%;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  text-align: left;
}
.tx-main b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-side { text-align: right; display: grid; }
.tx-side b { font-size: 15px; }
.in { color: var(--green); }
.out { color: var(--red); }
.tx svg:last-child, .budget-list svg:last-child { width: 16px; height: 16px; color: #b7c2bb; flex: none; }

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.split > div { background: #fff; border-radius: 18px; padding: 14px; box-shadow: var(--shadow); }
.split small, .split span { display: block; color: var(--muted); font-size: 12px; }
.split b { display: block; font-size: 26px; letter-spacing: -0.04em; color: var(--green); margin: 4px 0; }
.pager { display: flex; gap: 8px; }
.pager button {
  width: 36px; height: 36px; border-radius: 50%; border: 0; background: #fff; color: var(--ink);
  display: grid; place-items: center; box-shadow: var(--shadow);
}
.pager .flip svg { transform: rotate(180deg); }

.goal-list { background: #fff; border-radius: 20px; padding: 4px 14px; box-shadow: var(--shadow); margin-bottom: 14px; }
.goal-list strong { color: var(--green); }
.goal-list .static { display: flex; align-items: center; gap: 10px; padding: 14px 0; }
.goal-list .static + .static { border-top: 1px solid var(--line); }

.report-top { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.donut {
  width: 132px; height: 132px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
}
.donut div {
  width: 86px; height: 86px; border-radius: 50%; background: var(--bg);
  display: grid; place-items: center; text-align: center;
}
.donut small { color: var(--muted); font-size: 12px; }
.donut b { font-size: 16px; }
.legend { list-style: none; margin: 0; padding: 0; flex: 1; }
.legend li { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 14px; }
.legend i { width: 8px; height: 8px; border-radius: 50%; display: block; }
.legend b { margin-left: auto; }
.trend { display: flex; align-items: flex-end; gap: 8px; height: 150px; margin-top: 12px; }
.trend div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.trend span { display: block; width: 100%; max-width: 28px; background: var(--green); border-radius: 8px 8px 4px 4px; }
.trend small { color: var(--muted); font-size: 11px; }

.btn {
  border: 0;
  background: #fff;
  color: var(--ink);
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 600;
  box-shadow: var(--shadow);
}
.btn.primary { background: var(--green); color: #fff; }
.btn.ghost { background: transparent; box-shadow: none; color: var(--green-dark); }
.btn.danger { background: #fdecec; color: var(--red); box-shadow: none; }
.btn.small { padding: 8px 10px; border-radius: 12px; }
.btn.wide, .wide { width: 100%; margin-top: 8px; }
.text-btn { border: 0; background: transparent; color: var(--green); font-weight: 600; padding: 0; }

.stack { display: grid; gap: 10px; }
.stack h2 { margin-bottom: 2px; }
.plain li { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.plain button { border: 0; background: transparent; color: var(--red); font-weight: 600; }

.gate { min-height: 70%; padding-top: 28px; }
.gate .btn.primary { width: 100%; margin-top: 12px; }
.gate > p { color: var(--muted); margin-bottom: 16px; }
.mark {
  width: 64px; height: 64px; border-radius: 20px; background: var(--green); color: #fff;
  display: grid; place-items: center;
}
.mark svg { width: 32px; height: 32px; }
.dots { display: flex; gap: 6px; margin-bottom: 14px; }
.dots span { width: 28px; height: 6px; border-radius: 99px; background: #d5e0d9; }
.dots .is-on { background: var(--green); }
.dots .is-done { background: #8dccA3; }

label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); margin: 10px 0; }
input, select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  outline: none;
}
input:focus, select:focus { border-color: #8dccA3; }
.form-error { color: var(--red); font-weight: 600; margin-bottom: 8px; }
.setup-list { list-style: none; padding: 0; margin: 0 0 12px; }
.setup-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: #fff; border-radius: 14px; padding: 8px 10px; margin-bottom: 8px;
}
.setup-list label { margin: 0; }
.mini { width: 110px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 15px; font-weight: 600; }
.check input { width: auto; }
.check svg { width: 16px; height: 16px; }
.choice-row { display: grid; gap: 10px; }
.choice {
  text-align: left; border: 1px solid transparent; background: #fff; border-radius: 16px; padding: 14px;
  box-shadow: var(--shadow); display: grid; gap: 4px;
}
.choice.is-on { border-color: var(--green); background: var(--soft); }
.choice span { color: var(--muted); font-size: 13px; }
.source-line { margin: 10px 0; color: var(--muted); }
.goal-draft { background: #fff; border-radius: 16px; padding: 10px 12px; margin-bottom: 10px; }

.overlay { position: absolute; inset: 0; z-index: 5; }
.backdrop { position: absolute; inset: 0; border: 0; background: rgba(23, 48, 36, 0.35); }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: #fff; border-radius: 24px 24px 0 0;
  padding: 16px 16px calc(18px + env(safe-area-inset-bottom));
  max-height: 86%; overflow: auto;
  box-shadow: 0 -12px 40px rgba(23, 48, 36, 0.12);
}
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.sheet-head h2 { font-size: 22px; letter-spacing: -0.03em; }
.sheet-copy { color: var(--muted); margin: 6px 0 10px; }
.pick { display: grid; gap: 8px; }
.pick label {
  display: flex; align-items: center; gap: 8px; margin: 0; color: var(--ink); font-size: 15px;
  background: var(--bg); border-radius: 12px; padding: 10px 12px;
}
.pick input { width: auto; }
.pick label:has(input:checked),
.pick .is-on { outline: 2px solid var(--green); background: var(--soft); }
.remember { margin: 12px 0; color: var(--ink); }
.ready { font-size: 28px; font-weight: 700; color: var(--green); letter-spacing: -0.04em; }
.assign-row { grid-template-columns: 1fr 110px; align-items: center; }
.assign-row span { color: var(--ink); font-size: 15px; }
.assign-row small { display: block; font-weight: 500; }
.radio { display: flex; gap: 8px; align-items: flex-start; color: var(--ink); font-size: 15px; }
.radio input { width: auto; margin-top: 3px; }
.empty { color: var(--muted); padding: 8px 0 12px; }
.toast {
  position: absolute; left: 16px; right: 16px; top: 14px; z-index: 6;
  background: var(--ink); color: #fff; border-radius: 14px; padding: 12px 14px;
  font-weight: 600; text-align: center;
}

@media (max-width: 520px) {
  body { background: var(--bg); }
  .stage { padding: 0; display: block; }
  .phone { width: 100%; height: 100vh; height: 100dvh; border-radius: 0; border: 0; box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; }
}
