@font-face { font-family: SystemFallback; src: local("Segoe UI"); font-display: swap; }
:root {
  color-scheme: light;
  font-family: SystemFallback, system-ui, sans-serif;
  color: #172e26;
  background: #f4f6f1;
  --green: #113b32;
  --leaf: #23674d;
  --mint: #dbece0;
  --muted: #4f655a;
  --line: #d8e2d8;
  --danger: #963d35;
  --white: #fff;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 3px solid #a55a06; outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.9rem, 4vw, 3rem); letter-spacing: -.055em; line-height: 1.04; }
h2 { font-size: 1.25rem; letter-spacing: -.025em; }
a { color: var(--leaf); }
.top {
  min-height: 72px; padding: .65rem max(1rem, calc((100% - 1140px) / 2));
  display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  border-bottom: 1px solid var(--line); background: var(--white);
}
.brand { display: inline-flex; align-items: center; gap: .65rem; text-decoration: none; color: var(--green); font-size: 1.25rem; font-weight: 760; letter-spacing: -.045em; }
.brand img { border-radius: .8rem; }
.brand b { color: var(--leaf); font-weight: 700; }
.auth-layout { padding: clamp(1rem, 6vw, 5rem) 1rem; }
.welcome {
  display: grid; grid-template-columns: 1.16fr 1fr; max-width: 980px; margin: 0 auto;
  border-radius: 1.65rem; overflow: hidden; box-shadow: 0 22px 65px #193d2721; background: var(--white);
}
.welcome-hero, .welcome-auth { padding: clamp(1.45rem, 5vw, 3.5rem); }
.welcome-hero { position: relative; isolation: isolate; overflow: hidden; background: var(--green); color: #f6fcf2; display: grid; gap: 1.2rem; }
.welcome-hero > img { border-radius: 1.15rem; }
.welcome-hero h1 { font-size: clamp(2.4rem, 6.6vw, 4.65rem); font-weight: 740; }
.welcome-hero em { font-family: Georgia, serif; color: #d2efa5; font-weight: normal; }
.welcome-hero p { color: #d3e6da; line-height: 1.5; }
.rings { position: absolute; z-index: -1; inset: auto -5rem -7rem auto; width: 23rem; height: 23rem; }
.rings i { position: absolute; border: 1px solid #d2efa533; border-radius: 100%; inset: 0; }
.rings i:nth-child(2) { inset: 2.3rem; }
.rings i:nth-child(3) { inset: 4.6rem; }
.hero-list { display: grid; gap: .55rem; list-style: none; padding: .55rem 0 0; margin: 0; color: #e0eee3; }
.hero-list li { display: flex; gap: .6rem; align-items: center; }
.hero-list span { color: #d2efa5; }
.welcome-auth { display: grid; align-content: center; gap: 1.15rem; }
.welcome-auth h2 { font-size: clamp(1.45rem, 4vw, 2rem); line-height: 1; }
.muted, .empty { color: var(--muted); line-height: 1.55; overflow-wrap: anywhere; }
.empty { padding: 1.15rem; background: #eff4ee; border-radius: .9rem; }
.primary, .quiet, .navigation button, .subnav button {
  min-height: 44px; padding: .65rem .95rem; border-radius: .7rem; border: 1px solid transparent;
  font-weight: 660; text-align: center;
}
.primary { background: var(--leaf); color: var(--white); }
.primary:hover:not(:disabled) { background: var(--green); }
.quiet { color: var(--leaf); background: transparent; }
.quiet:hover:not(:disabled) { background: var(--mint); }
.danger, .danger-text { color: var(--danger); }
.positive { color: var(--leaf); }
.form, .related { display: grid; gap: .95rem; }
.field { display: grid; gap: .4rem; min-width: 0; color: var(--muted); font-size: .9rem; font-weight: 650; }
.field input, .field select, .field textarea {
  border: 1px solid #aec2b3; border-radius: .65rem; padding: .65rem .7rem; background: var(--white);
  color: #172e26; font-weight: 430; width: 100%; font-size: 1rem; min-height: 44px;
}
.field textarea { resize: vertical; }
.field input[type=file] { padding: .45rem; }
.app-layout {
  max-width: 1140px; margin: 0 auto; padding: 2rem 1rem 3rem; display: grid;
  grid-template-columns: 188px minmax(0, 1fr); gap: clamp(1rem, 4vw, 2.5rem); align-items: start;
}
.navigation { display: grid; gap: .4rem; padding: .45rem; background: var(--white); border: 1px solid var(--line); border-radius: 1.05rem; }
.navigation button {
  display: flex; gap: .65rem; align-items: center; text-align: left; background: transparent;
  color: var(--muted); white-space: nowrap;
}
.navigation button span { font-size: 1.15rem; line-height: 1; }
.navigation button[aria-current], .subnav button[aria-current] { background: var(--mint); color: var(--green); }
.flow { display: grid; gap: clamp(.85rem, 2vw, 1.35rem); }
.content { min-width: 0; }
.page-heading { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: .85rem; }
.page-heading h1 + p { margin-top: .48rem; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
.metric { min-width: 0; display: grid; align-content: start; gap: .5rem; border-radius: 1.05rem; background: var(--white); border: 1px solid var(--line); padding: clamp(.7rem, 2vw, 1.2rem); }
.metric span { color: var(--muted); font-size: .92rem; }
.metric strong { font-size: clamp(1.1rem, 2.65vw, 1.85rem); letter-spacing: -.04em; overflow-wrap: anywhere; }
.metric.balance { grid-column: 1 / -1; padding: clamp(1rem, 3vw, 1.6rem); background: var(--green); color: #f1f9ec; }
.metric.balance strong { font-size: clamp(2rem, 6vw, 3.75rem); }
.metric.balance span { color: #d2e8d9; }
.panel { display: grid; justify-items: start; gap: .85rem; padding: clamp(.85rem, 3vw, 1.5rem); background: var(--white); border-radius: 1.05rem; border: 1px solid var(--line); }
.panel > .empty, .rows { width: 100%; }
.rows { list-style: none; padding: 0; margin: 0; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .85rem; border-bottom: 1px solid var(--line); padding: .7rem 0; }
.row:last-child { border-bottom: 0; }
.row-description { flex: 1 1 13rem; min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.row-description small { display: block; margin-top: .22rem; color: var(--muted); font-size: .85rem; }
.row-value { font-weight: 720; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.row-actions button { padding-inline: .5rem; }
.toolbar, .actions, .subnav { display: flex; gap: .35rem .65rem; flex-wrap: wrap; align-items: center; }
.toolbar { align-items: end; }
.subnav button { padding-inline: .7rem; background: var(--white); color: var(--muted); border-color: var(--line); }
.prompt, .access-banner { border-radius: 1rem; background: var(--mint); padding: 1rem; }
.prompt p { font-family: Georgia, serif; color: var(--green); font-size: 1.25rem; margin-top: .35rem; }
.access-banner { display: flex; gap: .45rem; justify-content: space-between; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.identifier { color: var(--green); overflow-wrap: anywhere; user-select: all; }
progress { display: block; accent-color: var(--leaf); margin: .35rem 0; max-width: 100%; }
dialog { border: 1px solid var(--line); border-radius: 1rem; color: inherit; background: var(--white); width: min(34rem, calc(100% - 1.4rem)); max-height: 90dvh; padding: 1.25rem; }
dialog::backdrop { background: #102d24a0; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .75rem; }
#notice {
  position: fixed; z-index: 3; bottom: 1rem; left: 50%; transform: translateX(-50%); width: max-content;
  max-width: min(92%, 40rem); background: var(--green); color: white; border-radius: .75rem; padding: .8rem 1rem;
  box-shadow: 0 4px 20px #0003; overflow-wrap: anywhere;
}
@media (max-width: 700px) {
  .app-layout { display: block; padding: 1.1rem .85rem calc(5.45rem + env(safe-area-inset-bottom)); }
  .navigation {
    position: fixed; z-index: 2; bottom: 0; left: 0; right: 0; border-radius: 0; grid-template-columns: minmax(0, 1fr) minmax(0, 1.32fr) repeat(3, minmax(0, 1fr));
    gap: .12rem; padding: .25rem .15rem calc(.25rem + env(safe-area-inset-bottom)); box-shadow: 0 -6px 25px #193d2712;
  }
  .navigation button { flex-direction: column; align-items: center; justify-content: center; gap: .21rem; padding: .3rem .1rem; font-size: clamp(.63rem, 2.5vw, .82rem); }
  body:has(.app-layout) #notice { bottom: calc(4rem + env(safe-area-inset-bottom)); }
  .welcome { grid-template-columns: 1fr; max-width: 480px; }
  .welcome-hero h1 { max-width: 10ch; }
  .hero-list { display: none; }
  .row { align-items: start; }
}
@media (max-width: 430px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
  .metric:last-child { grid-column: 1 / -1; }
}


.form-problem { color: var(--danger); overflow-wrap: anywhere; }

.field input[type=checkbox] { width: 1.35rem; min-height: 1.35rem; accent-color: var(--leaf); }

.report-controls { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; }
.report-controls .field { min-width: 6.5rem; }
.report-controls input[name="report-year"] { width: 7.3rem; }
.report-controls button[aria-pressed="true"] { background: var(--green); color: var(--white); }
.report-figure { width: 100%; margin: 0; min-width: 0; }
.report-legend { display: flex; flex-wrap: wrap; column-gap: 1.25rem; row-gap: .45rem; margin: 0 0 1rem; padding: 0; list-style: none; color: var(--muted); font-size: .9rem; }
.report-legend li { display: flex; align-items: center; gap: .45rem; }
.series-income { --series: #237160; }
.series-expense { --series: #96521d; }
.report-dot { display: inline-block; width: .7rem; height: .7rem; border-radius: .2rem; background: var(--series); flex: none; }
.report-chart { width: 100%; list-style: none; margin: 0; padding: 0; }
.report-chart > li { display: flex; gap: .65rem; align-items: center; padding: .38rem 0; border-top: 1px solid var(--line); }
.chart-period { flex: 0 0 2.65rem; font-size: .88rem; text-transform: capitalize; }
.chart-bars { display: grid; gap: .25rem; flex: 1; min-width: 0; }
.chart-line { display: grid; grid-template-columns: minmax(0, 1fr) minmax(6rem, min(35%, 9rem)); align-items: center; gap: .5rem; }
.chart-amount { font-size: .88rem; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.report-bar { width: 100%; height: .55rem; margin: 0; border: 0; border-radius: 1rem; overflow: hidden; appearance: none; background: #e9eeeb; accent-color: var(--series); }
.report-bar::-webkit-progress-bar { background: #e9eeeb; }
.report-bar::-webkit-progress-value { background: var(--series); border-radius: 1rem; }
.report-bar::-moz-progress-bar { background: var(--series); border-radius: 1rem; }
.report-budget-metrics { display: grid; width: 100%; grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); gap: .65rem; }
.report-remaining { background: #e6f2ea; }
.report-over { background: #fff0e7; }
.report-table-wrap { width: 100%; overflow-x: auto; }
.report-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.report-table th, .report-table td { padding: .65rem .35rem; border-bottom: 1px solid var(--line); text-align: right; overflow-wrap: anywhere; }
.report-table th:first-child { text-align: left; }
.report-table td { font-variant-numeric: tabular-nums; }
.report-table thead th { color: var(--muted); font-size: .85rem; vertical-align: bottom; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 430px) {
  .report-totals .metric:last-child { grid-column: auto; }
  .report-table th, .report-table td { padding-inline: .24rem; }
}


.metric-note { font-size: .9rem; line-height: 1.4; margin: 0; }
.metric.balance.report-negative { background: #8e2c35; color: #fff; }
.metric.balance.report-negative span { color: #ffe9ec; }
.report-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.report-totals .metric.report-credit { grid-column: 1 / -1; background: #fff1bf; border-color: #e3bd4e; color: #412a0c; }
.report-credit span { color: #66440b; }
.cash-breakdown { width: 100%; margin: 0; }
.cash-breakdown > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(5rem, 40%); gap: .8rem; border-top: 1px solid var(--line); padding: .7rem 0; align-items: baseline; }
.cash-breakdown dd { margin: 0; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.report-totals .metric.report-spending-balance { grid-column: 1 / -1; }
.report-balance-comparison { display: grid; width: 100%; gap: .65rem; padding: .85rem 0; border-top: 1px solid var(--line); }
.report-balance-comparison h3 { margin: 0; font-size: 1rem; }

.panel > .metric.balance { width: 100%; }

.spending-need { --spend-ink: #10503d; --spend-bg: #e4f4ec; --spend-border: #92c6ae; --spend-icon: #1f614b; }
.spending-want { --spend-ink: #66410b; --spend-bg: #fff2c3; --spend-border: #dec068; --spend-icon: #78500c; }
.spending-impulse { --spend-ink: #7d2630; --spend-bg: #fce8ea; --spend-border: #e7a1aa; --spend-icon: #942e3a; }
.spending-overview { display: grid; width: 100%; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(.38rem, 2vw, .8rem); }
.spending-tile { display: grid; align-content: start; justify-items: start; gap: .48rem; min-width: 0; padding: clamp(.45rem, 2.3vw, .9rem); border-radius: .8rem; border: 1px solid var(--spend-border); color: var(--spend-ink); background: var(--spend-bg); }
.spending-badge { display: inline-flex; align-items: center; gap: .36rem; color: var(--spend-ink); background: var(--spend-bg); border-radius: 999px; padding: .18rem .44rem .18rem .2rem; font-size: .83rem; line-height: 1.2; white-space: nowrap; font-weight: 700; }
.spending-icon { display: inline-grid; place-items: center; width: 1.12rem; height: 1.12rem; flex: none; border-radius: 50%; background: var(--spend-icon); color: white; font-size: .74rem; line-height: 1; }
.spending-tile .spending-badge { padding: 0; }
.spending-amount { max-width: 100%; font-size: clamp(.83rem, 3.4vw, 1.3rem); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.spending-percent { font-size: .77rem; }
.spending-row-title { display: inline-flex; align-items: center; flex-wrap: wrap; gap: .35rem .52rem; max-width: 100%; }
@media (max-width: 430px) {
  .spending-tile .spending-badge { flex-direction: column; align-items: flex-start; gap: .25rem; font-size: .78rem; }
}

.top-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: .25rem; }
.top-actions .quiet { padding-inline: .55rem; }
.guide-panel { display: grid; width: 100%; gap: .6rem; margin: 0 0 .7rem; padding: clamp(.75rem, 3vw, 1.2rem); border: 1px solid #95b9a2; border-left: .28rem solid #227358; border-radius: .95rem; background: #edf7ef; color: #153c2d; scroll-margin-top: .8rem; }
.guide-panel h2, .guide-panel p { margin: 0; }
.guide-panel p { line-height: 1.45; }
.guide-heading, .guide-navigation, .guide-actions { display: flex; align-items: center; gap: .38rem; flex-wrap: wrap; }
.guide-heading, .guide-actions { justify-content: space-between; }
.guide-progress { font-weight: 700; font-size: .82rem; color: #285e49; }
.guide-highlight { outline: .17rem solid #287a59; outline-offset: .22rem; }
@media (max-width: 365px) {
  .top-actions { gap: 0; }
  .top-actions .quiet { padding-inline: .34rem; font-size: .82rem; }
}

.transaction-metric { width: 100%; min-height: 44px; text-align: left; font: inherit; color: inherit; }
.transaction-metric:hover { background: #eff7f1; border-color: #39775e; }
.transaction-metric .transaction-metric-link { color: #28634c; font-size: .82rem; font-weight: 650; text-decoration: underline; text-underline-offset: .2em; }
.movement-filters button[aria-pressed="true"] { background: var(--green); color: var(--white); }

.reflection-carousel { display: grid; gap: .65rem; width: 100%; }
.reflection-card {
  display: grid; gap: .65rem; padding: clamp(1.05rem, 4vw, 2.15rem);
  background: var(--white); border: 1px solid var(--line); border-top: .3rem solid var(--green); border-radius: 1.05rem;
}
.reflection-card h2, .reflection-card p, .reflection-card blockquote { margin: 0; overflow-wrap: anywhere; }
.reflection-card h2 { color: #28634c; font-size: 1.08rem; }
.reflection-card blockquote { font-family: Georgia, serif; font-size: clamp(1.3rem, 4.5vw, 2rem); line-height: 1.45; color: var(--green); }
.reflection-translation { font-size: .86rem; color: var(--muted); }
.reflection-note { display: grid; gap: .35rem; margin-top: .55rem; padding: .85rem 1rem; background: #edf6ef; border-radius: .7rem; }
.reflection-note h3 { margin: 0; color: #245641; font-size: .96rem; }
.reflection-note p { line-height: 1.55; }
.reflection-controls { display: grid; grid-template-columns: 1fr auto 1fr; gap: .35rem; align-items: center; }
.reflection-controls button:first-child { justify-self: start; }
.reflection-controls button:last-child { justify-self: end; }
.reflection-position { color: var(--muted); font-size: .84rem; font-variant-numeric: tabular-nums; }

.category-label { display: inline-flex; align-items: center; gap: .32rem; max-width: 100%; vertical-align: middle; }
.category-label > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.category-icon { display: inline-grid; flex: 0 0 1.5em; width: 1.5em; height: 1.5em; place-items: center; border-radius: .4em; background: #eaf3ed; font-size: 1em; line-height: 1; }
