:root {
  color-scheme: light;
  font: 16px/1.5 "Aptos", "Segoe UI", system-ui, sans-serif;
  --ink: #223e61;
  --muted: #526a84;
  --blue: #235b9d;
  --paper: #fff;
  --line: #dce9f5;
  --light: #f3f8fe;
  --shadow: 0 8px 30px #31588009;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; background: var(--light); color: var(--ink); }
a { color: var(--blue); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .62; cursor: wait; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid #417bce;
  outline-offset: 3px;
}
p { margin: 0 0 .65rem; }
h1, h2 { margin: 0; line-height: 1.08; }
h1 { letter-spacing: -.045em; }
h2 { font-size: 1.12rem; letter-spacing: -.015em; }
small { display: block; color: var(--muted); }
.loading { display: grid; min-height: 100vh; place-content: center; }
.layout { display: grid; grid-template-columns: 235px minmax(0, 1fr); min-height: 100vh; }
.sidebar { display: flex; flex-direction: column; min-height: 100vh; padding: 30px 19px 20px; background: #fafdff; border-right: 1px solid var(--line); position: sticky; top: 0; max-height: 100vh; }
.brand { color: var(--ink); display: inline-flex; align-items: center; gap: 11px; text-decoration: none; line-height: 1.2; }
.sidebar .brand { padding: 0 8px 25px; }
.brand strong { font-size: 1.22rem; letter-spacing: -.04em; }
.brand small { margin-top: 4px; font-size: .78rem; }
.brand-mark { display: grid; place-items: center; min-width: 43px; min-height: 43px; background: #dceeff; color: #2f63a5; border-radius: 16px; font-size: 1.7rem; font-weight: 800; }
.sidebar nav { display: grid; gap: 5px; }
.nav-link { color: var(--muted); text-decoration: none; padding: 10px 12px; border-radius: 12px; font-size: .92rem; font-weight: 650; display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.nav-link span { text-align: center; width: 20px; font-size: 1.16rem; line-height: 1; color: #376ba8; }
.nav-link:hover, .nav-link.active { background: #e4f1ff; color: #24588f; }
.sidebar-bottom { margin-top: auto; display: flex; align-items: center; flex-wrap: wrap; gap: 9px; padding: 12px 8px 0; }
.sidebar-bottom strong { font-size: .88rem; }
.sidebar-bottom small { font-size: .74rem; }
.heart { display: grid; place-items: center; height: 35px; width: 35px; border-radius: 50%; background: #e9f2ff; color: #315f99; font-weight: 800; font-size: 1.1rem; }
.main { margin: 0 auto; padding: 20px 34px 40px; width: min(100%, 1310px); }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 45px; margin-bottom: 15px; font-size: .9rem; font-weight: 700; color: #46627e; }
.topbar label { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin: 0; }
.topbar input, .topbar select, .period select { background: white; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); padding: 5px 8px; }
.hero { position: relative; overflow: hidden; background: linear-gradient(108deg, #dcecff 0%, #e9f5ff 70%, #d8edff 100%); border: 1px solid #d4e7fa; border-radius: 27px; min-height: 272px; display: flex; align-items: center; padding: 29px 34px; }
.hero-copy { position: relative; z-index: 1; }
.hero-kicker { color: #35638d; font-weight: 680; font-size: .89rem; margin-bottom: 9px; }
.hero-kicker span { color: #386bb0; margin-right: 5px; }
.hero h1 { font-size: clamp(2.65rem, 5vw, 4.65rem); line-height: .98; color: #224879; }
.hero p { margin: 15px 0; color: #405d79; max-width: 34ch; }
.hero-art { position: absolute; width: 290px; height: 245px; right: 8%; bottom: 4px; pointer-events: none; }
.orb { position: absolute; width: 207px; height: 207px; bottom: 16px; left: 48px; border-radius: 50%; background: #f5faff; box-shadow: inset 0 -9px 0 #d5e9ff; }
.cloud { position: absolute; width: 72px; height: 20px; border-radius: 20px; background: #fff; }
.cloud::before, .cloud::after { content: ""; position: absolute; border-radius: 50%; background: #fff; bottom: 4px; }
.cloud::before { width: 31px; height: 30px; left: 12px; }
.cloud::after { width: 23px; height: 25px; left: 34px; }
.cloud-a { left: 15px; top: 52px; }
.cloud-b { width: 64px; right: 0; top: 105px; transform: scale(.86); }
.spark { position: absolute; color: #6592cc; font-size: 24px; }
.spark-a { left: 80px; top: 77px; }
.spark-b { right: 24px; top: 41px; }
.spark-c { right: 18px; bottom: 44px; font-size: 16px; }
.house { position: absolute; display: block; width: 105px; height: 119px; left: 101px; bottom: 48px; z-index: 1; }
.roof { display: block; position: absolute; inset: 0 0 auto; background: #638fc4; height: 71px; border-radius: 15px; transform: rotate(45deg) scale(.78); }
.house-body { position: absolute; bottom: 0; left: 10px; right: 10px; height: 81px; background: #a9cceb; border-radius: 16px 16px 19px 19px; display: grid; justify-items: center; }
.house-body i { font-style: normal; color: #477ab6; font-size: 28px; }
.house-body b { position: absolute; bottom: 0; height: 31px; width: 23px; border-radius: 13px 13px 0 0; background: #edf7ff; }
.ground { position: absolute; bottom: 42px; left: 75px; width: 168px; height: 17px; border-radius: 50%; background: #d7e9fa; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.button { border: 1px solid #cadff3; border-radius: 10px; background: #fafdff; color: #285b93; padding: 7px 11px; font-size: .84rem; font-weight: 680; }
.button:hover { background: #e9f4ff; }
.primary { background: #285fa1; color: white; border-color: #285fa1; }
.primary:hover { background: #1f508d; }
.subtle { background: transparent; border-color: transparent; }
.danger { color: #982f42; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; margin: 16px 0; }
.stat { display: flex; align-items: center; gap: 12px; padding: 15px 16px; min-width: 0; background: white; border: 1px solid var(--line); border-radius: 17px; box-shadow: var(--shadow); }
.stat p { font-size: .82rem; color: var(--muted); margin-bottom: 2px; }
.stat strong { font-size: clamp(1.02rem, 2vw, 1.55rem); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; line-height: 1.2; }
.stat-icon, .line-icon { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 13px; background: #e9f4ff; color: #3267a2; font-size: 1.22rem; font-weight: 750; }
.stat-icon.mint { background: #e4f6f1; color: #286b63; }
.stat-icon.lavender { background: #efecff; color: #655191; }
.stat-icon.sky { background: #e6f1ff; color: #2d62a3; }
.grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 15px; align-items: start; }
.grid.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stack { display: grid; gap: 15px; }
.card { padding: 18px 19px; border: 1px solid var(--line); border-radius: 18px; background: white; box-shadow: var(--shadow); min-width: 0; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 5px; margin-bottom: 9px; }
.funding { background: linear-gradient(135deg, #fff 40%, #eaf6ff); }
.fund-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.fund-amount { font-size: 1.8rem; letter-spacing: -.04em; font-weight: 780; overflow-wrap: anywhere; }
.fund-foot { display: flex; justify-content: space-between; align-items: center; font-size: .83rem; color: #456586; }
.muted, .empty { color: var(--muted); font-size: .9rem; }
.empty { padding: 14px 0; }
progress { display: block; width: 100%; height: 9px; border: none; overflow: hidden; border-radius: 10px; background: #dfecf8; accent-color: #477fbe; }
progress::-webkit-progress-bar { background: #dfecf8; border-radius: 10px; }
progress::-webkit-progress-value { background: #568bc9; border-radius: 10px; }
progress::-moz-progress-bar { background: #568bc9; border-radius: 10px; }
.line { display: flex; min-height: 60px; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid #eaf1f7; }
.line:last-child, .goal-line .line, .budget-row .line { border-bottom: 0; }
.line-main { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: .92rem; }
.line small { font-size: .76rem; }
.line-right { text-align: right; font-size: .89rem; overflow-wrap: anywhere; }
.line-right .button { display: block; margin-left: auto; padding: 1px 6px; }
.positive { color: #247363; }
.over { color: #a13348; }
.goal-line { margin-bottom: 12px; }
.section-head { padding: 14px 0 20px; display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 12px; }
.section-head h1 { font-size: clamp(2rem, 4vw, 3.1rem); }
.section-head p { color: var(--muted); margin: 7px 0 0; }
.budget-row { margin: 0 0 12px; }
.detail { margin: 15px 0 0; }
.debt-block { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.debt-block:last-child { border-bottom: 0; padding-bottom: 0; }
.goal-caption { color: var(--muted); margin-bottom: 8px; }
.goal-caption ~ p:not(.muted) { margin: 12px 0; }
details { font-size: .86rem; color: var(--muted); margin: 10px 0 0; }
summary { cursor: pointer; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; background: #edf5ff; padding: 10px; max-height: 190px; overflow: auto; }
.period { margin-bottom: 15px; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.month-fields { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.statement-account:not(:last-of-type) { margin-bottom: 8px; }
.statement-detail { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 0 8px 48px; overflow-wrap: anywhere; }
.statement-detail small { font-size: .8rem; }
.pill { padding: 3px 8px; border-radius: 10px; background: #eaf3ff; color: #2e5e94; font-weight: 650; }
.login { display: grid; min-height: 100vh; padding: 18px; place-items: center; }
.login-card { width: min(100%, 420px); padding: 27px; }
.login-card h1 { margin: 18px 0 6px; font-size: 2rem; }
.login-card p { color: var(--muted); }
dialog { width: min(calc(100% - 25px), 560px); padding: 18px 21px; max-height: 92vh; overflow: auto; border: 1px solid #d4e6f7; border-radius: 18px; background: white; color: var(--ink); box-shadow: 0 18px 55px #1b365640; }
dialog::backdrop { background: #203a5b77; }
.modal-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
form label { display: grid; gap: 4px; margin: 0 0 10px; min-width: 0; }
form label span, .field-label { font-size: .9rem; font-weight: 650; }
form input, form select, form textarea { width: 100%; border: 1px solid #cbdff1; padding: 8px 9px; border-radius: 9px; color: var(--ink); background: #f9fcff; min-width: 0; }
form .month-fields { margin: 4px 0 10px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.modal-actions { display: flex; justify-content: end; }
.form-error { color: #8e293b !important; font-size: .87rem; }
#notice:not(:empty) { position: fixed; z-index: 2; bottom: 16px; right: 16px; max-width: min(430px, calc(100% - 32px)); padding: 12px 15px; border-radius: 10px; background: #244d7d; color: white; box-shadow: 0 6px 18px #10294833; }
@media (max-width: 1050px) {
  .layout { grid-template-columns: 190px minmax(0, 1fr); }
  .main { padding: 17px 21px 35px; }
  .sidebar { padding-inline: 13px; }
  .hero-art { right: 4%; }
}
@media (max-width: 780px) {
  .layout { display: block; }
  .sidebar { position: static; min-height: 0; max-height: none; padding: 11px 15px; display: grid; grid-template-columns: minmax(0, 1fr) auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar .brand { padding: 0; }
  .sidebar nav { display: flex; overflow-x: auto; grid-column: 1 / -1; grid-row: 2; margin-top: 9px; padding: 1px; }
  .sidebar-bottom { margin: 0; padding: 0; grid-column: 2; grid-row: 1; }
  .nav-link { gap: 4px; padding: 7px 9px; font-size: .83rem; }
  .main { padding: 11px 15px 26px; }
  .topbar { margin-bottom: 8px; }
  .hero { padding: 20px 18px; }
  .hero-art { transform: scale(.73); transform-origin: right bottom; right: 0; }
  .stat { padding: 10px; gap: 7px; }
  .stat-icon { width: 26px; height: 29px; font-size: 1rem; }
}
@media (max-width: 540px) {
  .sidebar-bottom .heart, .stat-icon { display: none; }
  .sidebar-bottom { gap: 3px; }
  .brand-mark { min-width: 34px; min-height: 34px; font-size: 1.25rem; }
  .brand strong { font-size: 1rem; }
  .hero-art { right: -9px; bottom: 50px; transform: scale(.42); }
  .hero { min-height: 0; }
  .hero h1 { font-size: clamp(2rem, 10vw, 2.7rem); }
  .hero p { max-width: min(28ch, 72%); }
  .hero .button { font-size: .77rem; }
  .grid, .grid.even { grid-template-columns: 1fr; }
  .stats { gap: 6px; }
  .stat { padding: 9px 7px; border-radius: 12px; }
  .stat p { font-size: .74rem; }
  .stat strong { font-size: .96rem; }
  .card { padding: 13px; }
  .statement-detail { padding-left: 0; }
}

.record-period { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 5px 9px; }
@media (max-width: 540px) {
  .sidebar nav { flex-wrap: wrap; gap: 3px; overflow: visible; }
  .nav-link { font-size: .77rem; padding: 5px 8px; }
  .topbar { gap: 6px; font-size: .79rem; }
  .record-period .month-fields { gap: 4px; }
  .record-period select { max-width: 101px; padding-inline: 4px; }
}
