:root {
  color-scheme: light;
  --ink: #172c25;
  --muted: #51645b;
  --paper: #f5f6ef;
  --line: #dce1d7;
  --plant: #234f3d;
  --white: #fff;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2.1rem, 5vw, 3.25rem); letter-spacing: -.055em; line-height: 1.08; font-weight: 750; }
h2 { font-size: 1.2rem; letter-spacing: -.025em; line-height: 1.25; }
button, input, select { font: inherit; }
button, select, nav a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { opacity: .6; cursor: default; }
:focus-visible { outline: 3px solid #568c72; outline-offset: 3px; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1200px; min-height: 72px; padding: 10px 24px; margin: auto; display: flex; align-items: center; gap: 30px; }
.brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; font-size: 1rem; font-weight: 750; letter-spacing: -.025em; }
.brand-mark { display: inline-grid; place-items: center; width: 35px; height: 35px; border-radius: 11px; background: var(--plant); color: white; font-size: 1.2rem; font-weight: 700; }
nav { display: flex; align-items: center; gap: 4px; }
nav a { color: var(--muted); text-decoration: none; font-weight: 650; font-size: .9rem; padding: 10px 13px; border-radius: 9px; white-space: nowrap; }
nav a:hover, nav a[aria-current] { background: #e8eee6; color: var(--plant); }
.account { display: flex; gap: 10px; align-items: center; margin-left: auto; }
.person { color: var(--plant); font-size: .9rem; font-weight: 700; }
.quiet, .close { border: 0; border-radius: 8px; color: var(--muted); background: transparent; padding: 8px 10px; }
.quiet:hover, .close:hover { background: #eef1eb; }
main { width: min(1200px, 100%); margin: auto; padding: 48px 24px 64px; }
.page-heading { margin-bottom: 30px; }
.page-heading p, .login-panel > p { margin-top: 12px; }
.muted { color: var(--muted); line-height: 1.5; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: 18px; padding: 24px; }
.calc-grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.55fr); gap: 20px; align-items: start; }
.calc-settings h2 { margin-bottom: 24px; }
label, legend { display: block; font-size: .875rem; font-weight: 650; }
input, select { min-width: 0; width: 100%; color: var(--ink); background: white; border: 1px solid #c6d0c6; border-radius: 10px; padding: 12px 13px; }
input[aria-invalid="true"] { border-color: #9c4540; }
.money-field { position: relative; margin-top: 7px; }
.money-field input { padding-right: 43px; font-size: 1.15rem; font-weight: 650; }
.money-field span { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
fieldset { padding: 0; margin: 22px 0 0; border: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; border-radius: 12px; background: #edf0e9; padding: 4px; }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.segmented span { display: block; text-align: center; border-radius: 8px; padding: 9px 5px; color: var(--muted); }
.segmented input:checked + span { background: white; color: var(--plant); box-shadow: 0 1px 3px #14281e1b; }
.segmented input:focus-visible + span { outline: 3px solid #568c72; }
.section-title { display: flex; gap: 14px; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.section-title strong { white-space: nowrap; color: var(--plant); font-size: 1.18rem; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 12px 10px; border-bottom: 1px solid #e8ebe4; text-align: left; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
thead th { color: var(--muted); font-size: .875rem; font-weight: 650; }
tbody th { font-weight: 550; }
.allocation th:not(:first-child), .allocation td, .history-table :is(th,td):last-child, .annual-table :is(th,td):not(:first-child) { text-align: right; white-space: nowrap; }
.allocation tbody td:last-child, .history-table tbody td:last-child { font-weight: 720; }
.allocation tbody tr:nth-last-child(-n+2) th { color: var(--plant); }
tbody tr:last-child > * { border-bottom: 0; }
.savings-heading { display: flex; align-items: end; justify-content: space-between; gap: 14px; }
.primary { display: inline-flex; gap: 7px; align-items: center; justify-content: center; border: 0; border-radius: 10px; min-height: 44px; padding: 10px 18px; background: var(--plant); color: white; font-weight: 650; }
.primary:hover { background: #193d2f; }
.goal-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.goal-card { border-radius: 18px; padding: 22px 24px; display: grid; align-content: start; justify-items: start; gap: 9px; }
.goal-card.travel { background: #dcebe1; color: #234b39; }
.goal-card.home { background: #ede6d7; color: #493927; }
.goal-card.improvements { background: #e7e5f3; color: #403759; }
.goal-icon { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 10px; background: #ffffffa6; font-size: 1.45rem; line-height: 1; }
.goal-card strong { font-size: clamp(1.55rem, 4vw, 2.45rem); overflow-wrap: anywhere; letter-spacing: -.045em; }
.goal-card p { font-size: .875rem; }
.reports { display: grid; gap: 20px; margin-top: 20px; }
.period-controls { display: flex; gap: 8px; }
select { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, #435c50 50%), linear-gradient(135deg, #435c50 50%, transparent 50%); background-position: calc(100% - 15px) center, calc(100% - 10px) center; background-size: 5px 5px; background-repeat: no-repeat; }
.empty { padding: 18px 0 8px; color: var(--muted); }
.table-scroll { overflow-x: auto; }
.annual-table { min-width: 780px; }
.annual-table thead th[scope="colgroup"] { text-align: center; }
.annual-table tfoot { font-weight: 750; color: var(--plant); }
.annual-table tfoot > tr > * { border-top: 1px solid var(--line); border-bottom: 0; }
.annual-summary { margin-top: 14px; color: var(--muted); font-size: .875rem; }
.login-panel { max-width: 425px; margin: 45px auto; padding: 32px; }
.login-mark { width: 47px; height: 47px; margin-bottom: 18px; }
.login-panel h1 { font-size: 2rem; }
.login-panel form { margin-top: 24px; }
.login-panel input, dialog select { margin-top: 7px; }
.login-panel button, dialog .primary { width: 100%; margin-top: 15px; }
.status { color: var(--muted); margin-top: 10px; font-size: .9rem; }
.status:empty { display: none; }
dialog { width: min(430px, calc(100% - 32px)); padding: 24px; border: 1px solid var(--line); border-radius: 18px; color: var(--ink); }
dialog::backdrop { background: #1d3129a6; }
dialog .section-title { margin-bottom: 5px; }
dialog label { margin-top: 17px; }
.close { font-size: 1.4rem; line-height: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (max-width: 720px) {
  .topbar-inner { flex-wrap: wrap; gap: 8px; padding: 10px 16px; }
  nav { order: 3; width: 100%; }
  main { padding: 32px 16px 48px; }
  .calc-grid { grid-template-columns: 1fr; gap: 14px; }
  .panel, .goal-card { padding: 16px; }
  .goal-grid { gap: 10px; }
  .report-heading { flex-wrap: wrap; }
  .history-table { min-width: 470px; }
}
@media (max-width: 560px) {
  .goal-grid { grid-template-columns: 1fr; }
}
@media (max-width: 400px) {
  .savings-heading { align-items: start; flex-direction: column; }
  .goal-card h2 { font-size: 1.04rem; }
  .allocation th, .allocation td { padding-inline: 5px; }
}
