:root {
  color-scheme: light;
  --page: #f7f3fc;
  --surface: #fff;
  --text: #2c2042;
  --muted: #625471;
  --brand: #5f3993;
  --line: #e8def3;
  --bar-in: #814cb8;
  --bar-out: #b76486;
  --rad: 23px;
  --max: 550px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--page);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, p, dl, dd { margin: 0; }
a { color: inherit; text-decoration: none; }
a, button, input, select, summary { touch-action: manipulation; }
button, input, select { font: inherit; }
button, summary { cursor: pointer; }
h1 { font-size: clamp(1.43rem, 6vw, 2rem); line-height: 1.1; letter-spacing: -.043em; }
h2 { font-size: 1.02rem; line-height: 1.25; letter-spacing: -.023em; }
p { line-height: 1.5; }
small { font-size: .75rem; color: var(--muted); line-height: 1.3; }
:focus-visible { outline: 2px solid #8356b2; outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ico { display: inline-block; width: 21px; height: 21px; flex: 0 0 auto; vertical-align: middle; }
.shell {
  width: min(100%, var(--max));
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--page);
  padding: env(safe-area-inset-top, 0px) max(15px, env(safe-area-inset-right, 0px))
      calc(100px + env(safe-area-inset-bottom, 0px)) max(15px, env(safe-area-inset-left, 0px));
}
.shell.no-nav { padding-bottom: 28px; }
.topbar { min-height: 69px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 11px; min-height: 44px; }
.brand-copy { display: grid; gap: 3px; }
.brand-copy strong { font-size: 1.16rem; font-weight: 800; line-height: 1.1; letter-spacing: -.045em; white-space: nowrap; }
.brand-copy small { color: var(--brand); font-size: .71rem; font-weight: 650; line-height: 1.15; }
.brand-mark, .avatar { display: grid; place-items: center; flex: 0 0 auto; }
.brand-mark {
  width: 41px; height: 41px; border: 1px solid #be9de4; border-radius: 14px;
  color: #fff9ff; background: radial-gradient(circle at 10% 0%, #b98ae7, transparent 68%), linear-gradient(145deg, #9462c3, #633898);
  box-shadow: 0 3px 8px #7341a335;
}
.avatar { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; color: var(--brand); background: #fff; }
.main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.greeting, .page-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.greeting h1 { overflow-wrap: anywhere; }
.greeting p { font-size: .77rem; color: var(--muted); margin-bottom: 4px; }
.period { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; font-weight: 690; color: var(--brand); font-size: .73rem; border: 1px solid #e4d6f4; background: #f1e6fb; padding: 7px 8px; border-radius: 20px; }
.period .ico { width: 14px; height: 14px; }
.page-heading { min-height: 38px; }
.page-heading a, .section-heading a, .lead a, .feedback a { font-size: .8rem; font-weight: 740; color: var(--brand); }
.page-heading a { display: inline-flex; align-items: center; gap: 2px; flex-shrink: 0; }
.page-heading a .ico, .section-heading a .ico { width: 15px; height: 15px; }
.balance {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid #e4d3f3;
  border-radius: var(--rad);
  padding: 19px;
  color: #311b4a;
  background: radial-gradient(ellipse at 95% -5%, #f5e7ff, transparent 55%), linear-gradient(132deg, #eadbfa 6%, #c9acef 100%);
  box-shadow: 0 11px 24px #72449930;
}
.balance::before, .balance::after {
  content: "";
  z-index: -1;
  position: absolute;
  top: -75px;
  right: -85px;
  width: 220px;
  height: 169px;
  border: 1px solid #ffffff9e;
  border-radius: 50%;
  transform: rotate(-31deg);
}
.balance::after { width: 248px; height: 206px; top: -80px; right: -102px; border-color: #ffffff68; }
.balance-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.balance h2 { font-size: .83rem; font-weight: 640; color: #573876; letter-spacing: 0; }
.hero-money { font-size: clamp(1.8rem, 9vw, 3rem); font-weight: 780; letter-spacing: -.07em; line-height: 1.1; margin-top: 3px; overflow-wrap: anywhere; }
.balance-link { display: inline-flex; align-items: center; gap: 2px; flex: 0 0 auto; min-height: 38px; border-radius: 13px; padding: 6px 10px; color: #52316f; background: #ffffff62; border: 1px solid #ffffffa3; }
.balance-link .ico + .ico { width: 13px; height: 13px; }
.balance-meta { border-top: 1px solid #69419735; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); margin-top: 15px; padding-top: 10px; }
.balance-meta > div { display: grid; gap: 2px; }
.balance-meta > div + div { padding-left: 13px; border-left: 1px solid #69419735; }
.balance-meta span { display: flex; align-items: center; gap: 3px; color: #533572; font-size: .73rem; }
.balance-meta span .ico { width: 14px; height: 14px; }
.balance-meta strong { font-size: clamp(.84rem, 4vw, 1.06rem); overflow-wrap: anywhere; }
.wallet-balance { min-height: 108px; }
.quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.action-card, .small-insight { display: flex; align-items: center; min-width: 0; gap: 8px; padding: 10px; border: 1px solid var(--line); background: var(--surface); border-radius: 17px; }
.action-card strong, .small-insight strong, .transaction strong { font-size: .88rem; line-height: 1.22; }
.action-card small, .small-insight small { display: block; margin-top: 3px; }
.small-insight { background: #fff9eb; border-color: #f0e5cd; }
.small-insight > .ico:last-child { margin-left: auto; width: 17px; height: 17px; color: #7e4e2a; }
.tile { display: grid; place-items: center; width: 41px; height: 41px; border-radius: 14px; flex: 0 0 auto; }
.green { color: #653995; background: #efdefb; }
.gold { color: #795a14; background: #f9efcf; }
.peach { color: #90471f; background: #fcebdd; }
.blue { color: #245681; background: #e7effa; }
.purple { color: #624889; background: #eee8f9; }
.rose { color: #934564; background: #f9e8ee; }
.slate { color: #435869; background: #e9eff1; }
.section { padding: 15px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--rad); min-width: 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 11px; }
.section-heading a { display: inline-flex; align-items: center; gap: 2px; flex-shrink: 0; }
.rows-section { padding-block: 13px 5px; }
.rows-section .section-heading { margin-block: 1px 5px; }
.transaction { display: flex; gap: 9px; align-items: center; min-height: 62px; padding-block: 8px; }
.transaction + .transaction, .wallet-line + .wallet-line { border-top: 1px solid #f0eaf6; }
.transaction .tile { width: 37px; height: 37px; border-radius: 12px; }
.transaction .tile .ico { width: 19px; height: 19px; }
.transaction-copy { flex: 1; min-width: 0; }
.transaction-copy strong { display: block; overflow-wrap: anywhere; }
.transaction-copy small, .transaction-value small { display: block; margin-top: 3px; }
.transaction-value { min-width: 0; max-width: 46%; text-align: right; overflow-wrap: anywhere; }
.income { color: #634095; }
.transfer { color: #315c82; }
.day-label { color: var(--muted); font-size: .73rem; font-weight: 720; margin-top: 6px; padding-block: 8px 3px; border-top: 1px solid var(--line); }
.empty { text-align: center; color: var(--muted); display: grid; justify-items: center; gap: 5px; padding: 21px 6px; font-size: .88rem; }

.bottom {
  position: fixed; z-index: 10; bottom: 0; left: 50%; transform: translateX(-50%);
  width: min(100%, var(--max)); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: end;
  padding: 4px max(9px, env(safe-area-inset-right, 0px)) calc(5px + env(safe-area-inset-bottom, 0px)) max(9px, env(safe-area-inset-left, 0px));
  border-top: 1px solid var(--line); border-radius: 19px 19px 0 0; background: #fffffff5;
  box-shadow: 0 -7px 25px #3f205b0b;
}
.bottom a { display: grid; justify-items: center; gap: 3px; min-height: 53px; align-content: center; text-align: center; color: #655675; }
.bottom a > span { display: grid; place-items: center; border-radius: 11px; min-width: 37px; min-height: 27px; }
.bottom small { font-size: .66rem; font-weight: 680; color: inherit; }
.bottom a.active { color: #613592; }
.bottom a.active:not(.nav-add) > span { background: #f0e4fc; }
.bottom .nav-add > span { width: 45px; height: 43px; margin-top: -14px; color: #fff; background: linear-gradient(145deg, #9866c4, #633999); border-radius: 15px; box-shadow: 0 4px 10px #733fa43b; }
.bottom .nav-add .ico { width: 25px; height: 25px; }

.notice { border-radius: 13px; padding: 10px 13px; border: 1px solid #e3d3f4; background: #f2e8fb; color: #57377d; font-size: .88rem; }
.notice.error { color: #852f2f; border-color: #f1d2ca; background: #fff1eb; }
.auth, .lead { display: grid; gap: 10px; }
.auth { margin-top: 21px; }
.auth p, .lead p, .muted { color: var(--muted); font-size: .88rem; }
.form-stack { display: grid; gap: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.filter-last { align-items: end; }
label { display: grid; gap: 5px; min-width: 0; font-size: .78rem; font-weight: 720; }
input, select {
  min-width: 0; width: 100%; min-height: 44px; box-sizing: border-box; color: var(--text); background: #fbf8fd;
  border: 1px solid #e2d5ee; border-radius: 11px; padding: 8px 9px; font-size: 16px;
}
input[type="date"], input[type="month"] { appearance: none; text-align: left; }
input::-webkit-date-and-time-value { text-align: left; }
input:focus, select:focus { background: #fff; }
input::placeholder { color: #756581; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 11px;
  padding: 8px 12px; min-height: 44px; font-size: .84rem; font-weight: 760; line-height: 1.22; text-align: center;
}
.button .ico { width: 18px; height: 18px; }
.button.primary { color: #fff; background: #673c9b; }
.button.secondary { color: #5c3888; background: #f1e8fa; border-color: #e6d8f1; }
.button.danger { color: #8d392d; background: #fff2ec; border-color: #f1d8cd; }
.button:disabled { opacity: .6; cursor: wait; }
.button.full { width: 100%; }
.inline-search { display: grid; align-items: center; position: relative; }
.inline-search .ico { position: absolute; left: 10px; width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.inline-search input { padding-left: 33px; }
.pagination, .detail-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-block: 10px; }
.capture { background: linear-gradient(120deg, #eddef8, #fcf7ff); border-color: #e9d8f4; }
.capture-heading { display: flex; align-items: center; gap: 8px; }
.capture-heading p, .feedback { color: var(--muted); font-size: .79rem; margin-top: 3px; }
.capture-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 11px; }
.quick-row { display: flex; gap: 8px; margin-top: 5px; }
.quick-row input { flex: 1; }
#scan-progress { width: 100%; height: 9px; margin-top: 6px; accent-color: #8451b5; }
#entry-area { scroll-margin-top: 9px; }
#preview { max-width: 60px; height: 46px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; }
#review-note { margin-bottom: 9px; padding: 7px 9px; border-radius: 8px; background: #f4eafa; }
.segmented { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 3px; margin: 0; min-width: 0; border-radius: 12px; background: #f2eaf9; border: 1px solid var(--line); }
.segmented label { gap: 0; }
.segmented input { position: absolute; width: 1px; min-height: 1px; opacity: 0; }
.segmented span { display: grid; place-items: center; min-height: 41px; border-radius: 9px; color: #645075; cursor: pointer; }
.segmented input:checked + span { background: #fff; color: #5d348e; box-shadow: 0 1px 4px #5631741c; }
.segmented input:focus-visible + span { outline: 2px solid #8356b2; }
.amount-input { font-size: 1.34rem; font-weight: 760; }
.detail-hero { display: grid; justify-items: center; text-align: center; gap: 5px; padding: 12px 0 9px; }
.detail-hero .tile { width: 47px; height: 47px; margin-bottom: 2px; }
.detail-hero h2 { overflow-wrap: anywhere; }
.detail-hero p { font-size: 1.6rem; font-weight: 780; letter-spacing: -.04em; }
.details div { display: grid; grid-template-columns: 1fr 1.3fr; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line); font-size: .87rem; }
.details dt { color: var(--muted); }
.details dd { text-align: right; font-weight: 630; overflow-wrap: anywhere; }
.detail-actions > *, .detail-actions form button { flex: 1; width: 100%; }
.account-heading { display: flex; align-items: center; gap: 10px; }
.account-heading h2 { overflow-wrap: anywhere; }
.account-heading p { color: var(--muted); font-size: .82rem; }
.member-line { display: flex; justify-content: space-between; gap: 8px; padding-block: 8px; border-bottom: 1px solid var(--line); font-size: .87rem; overflow-wrap: anywhere; }
summary { font-size: .84rem; font-weight: 720; color: var(--brand); padding: 5px 0; }
details > form { margin-top: 7px; }
.wallet-line { display: flex; align-items: center; gap: 8px; padding: 8px 0; min-height: 54px; }
.wallet-line > div { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.wallet-line small { display: block; margin-top: 2px; }
.wallet-line strong { font-size: .88rem; }
.wallet-line > strong { max-width: 45%; overflow-wrap: anywhere; }
.edit-link { display: grid; align-items: center; justify-items: end; min-height: 42px; width: 28px; color: var(--brand); }
.edit-link .ico { width: 16px; height: 16px; }
.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.summary-grid > div { min-width: 0; display: grid; gap: 5px; padding: 10px; border-radius: 12px; }
.summary-grid span { font-size: .75rem; }
.summary-grid strong { font-size: clamp(.91rem, 5vw, 1.12rem); overflow-wrap: anywhere; }
.summary-grid .ico { width: 14px; height: 14px; }
.net { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: .86rem; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 5px; color: var(--muted); font-size: .74rem; }
.legend > span::before { content: ""; background: var(--bar-in); border-radius: 3px; display: inline-block; width: 9px; height: 9px; margin-right: 4px; }
.legend > span + span::before { background: var(--bar-out); }
.chart { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 3px; }
.chart-month { display: grid; gap: 3px; text-align: center; padding: 5px 3px 3px; border-radius: 8px; }
.chart-month.current { background: #f2e9fa; }
.bar-pair {
  height: 107px; display: flex; align-items: flex-end; justify-content: center; gap: 3px; border-bottom: 1px solid #e8d9f2;
  background: repeating-linear-gradient(to top, transparent 0, transparent 23px, #eee5f6 24px, transparent 25px);
}
.bar { width: 34%; max-width: 16px; height: var(--height); border-radius: 4px 4px 0 0; }
.bar.in { background: var(--bar-in); }
.bar.out { background: var(--bar-out); }
.chart-table { margin-top: 8px; }
table { width: 100%; border-collapse: collapse; font-size: .72rem; table-layout: fixed; }
td, th { padding: 5px 2px; border-bottom: 1px solid var(--line); text-align: right; overflow-wrap: anywhere; }
td:first-child, th:first-child { text-align: left; }
.category-line { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid #f0eaf6; font-size: .85rem; }
.category-line > div { flex: 1; min-width: 0; }
.category-line small { display: block; margin-top: 2px; }
.category-line progress { width: 100%; height: 6px; margin-top: 4px; display: block; accent-color: var(--bar-in); }
.category-line > strong { overflow-wrap: anywhere; max-width: 40%; }
@media (min-width: 650px) {
  body { background: radial-gradient(ellipse at 20% 0%, #ece0f9, #f6f0fb 55%, #efe1f8); }
  .shell { padding-inline: 22px; box-shadow: 0 0 0 1px #ebdff3, 0 6px 30px #572b7610; }
  .balance { padding: 22px; }
}
@media (max-width: 365px) {
  .shell { padding-inline: max(11px, env(safe-area-inset-left, 0px)) max(11px, env(safe-area-inset-right, 0px)); }
  .topbar { min-height: 62px; }
  .balance { padding: 15px; }
  .tile { width: 34px; height: 34px; border-radius: 11px; }
  .action-card { gap: 5px; padding: 8px; }
  .action-card small { font-size: .69rem; }
}
