:root {
  color-scheme: light;
  --paper: #f7f5ed;
  --ink: #232b24;
  --muted: #515d50;
  --rule: #c8cfc0;
  --forest: #203e35;
  --forest-light: #dbe8dc;
  --wine: #552b2b;
  --negative: #913927;
  --focus: #286951;
  font: 100% / 1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
}

h1, h2, h3, p, dl, dd, ul { margin: 0; }
ul { padding: 0; list-style: none; }
h1, h2, h3, p, dt, dd, span, b { overflow-wrap: anywhere; }
button, input { font: inherit; }
a { color: inherit; }
.amount { font-variant-numeric: tabular-nums; }
.negative { color: var(--negative); }
.muted { color: var(--muted); }

.shell {
  width: min(100% - 2rem, 42rem);
  margin-inline: auto;
  padding-bottom: 3rem;
}

.shell--login { max-width: 29rem; }

.mast {
  min-height: 4.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--rule);
}

.brand {
  color: var(--forest);
  font-size: .75rem;
  font-weight: 750;
  letter-spacing: .085em;
  text-transform: uppercase;
}

.text-button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: .35rem .15rem;
  color: var(--forest);
  background: transparent;
  border: 0;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
  font-size: .875rem;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.month, .login h1 {
  margin-block: 1.5rem .875rem;
  font-weight: 600;
  font-size: clamp(1.65rem, 7vw, 2.4rem);
  line-height: 1.13;
  letter-spacing: -.045em;
}

.balance {
  padding: 1.25rem clamp(1rem, 5vw, 1.75rem) 1.15rem;
  background: var(--forest);
  color: #fffefa;
  border-radius: .7rem;
}

.balance--over { background: var(--wine); }

.balance h2 {
  font-size: .875rem;
  font-weight: 650;
}

.balance-amount {
  margin-block: .15rem .7rem;
  font: 400 clamp(2.15rem, 13vw, 4.4rem) / 1.06 Georgia, "Times New Roman", serif;
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: -.055em;
}

.balance-status {
  margin: -.25rem 0 .65rem;
  font-size: .875rem;
  font-weight: 700;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .65rem;
}

.balance .metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding-top: .75rem;
  border-top: 1px solid #ffffff47;
}

.metrics dt { color: var(--muted); font-size: .75rem; }
.metrics dd { font-size: .9rem; font-weight: 650; }
.balance .metrics dt { color: var(--forest-light); }
.balance--over .metrics dt { color: #f2ddd9; }
.balance .metrics dd { font-size: 1.05rem; }

.freshness {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  color: var(--muted);
  font-size: .75rem;
  line-height: 1.4;
  padding-top: .15rem;
}

time { display: block; }

.section { margin-top: 1.45rem; }
.section h2, .empty h2 { font-size: 1.15rem; line-height: 1.25; }
.section h2 { margin-bottom: .55rem; }
.section p, .empty p { font-size: .9rem; }

.overbudget {
  padding-left: .85rem;
  border-left: 3px solid var(--negative);
}

.overbudget h2 { color: var(--negative); }

.line-list li, .reconciliation > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .65rem;
  padding-block: .45rem;
  font-size: .9rem;
}

.line-list li + li, .reconciliation { border-top: 1px solid var(--rule); }
.line-list .amount, .reconciliation dd { text-align: right; }
.entries { margin-left: auto; color: var(--muted); white-space: nowrap; font-size: .8rem; }
.reconciliation { margin-top: .4rem; padding-top: .3rem; }
.reconciliation > div:last-child { font-weight: 750; }

.group { border-top: 1px solid var(--rule); }
.group:last-child { border-bottom: 1px solid var(--rule); }
.group summary {
  display: grid;
  grid-template-columns: .52rem minmax(0, 1fr) minmax(4.8rem, auto);
  align-items: center;
  gap: .75rem;
  min-height: 3.6rem;
  padding: .6rem .2rem;
  list-style: none;
  cursor: pointer;
}
.group summary::-webkit-details-marker { display: none; }

.group summary::before {
  content: "";
  width: .43rem;
  height: .43rem;
  border-right: 2px solid var(--forest);
  border-bottom: 2px solid var(--forest);
  transform: rotate(-45deg);
}

.group[open] summary::before { transform: translateY(-.1rem) rotate(45deg); }
.group-name { font-size: .94rem; font-weight: 650; line-height: 1.15; }
.group-total { text-align: right; font-size: .8rem; }
.group-total span { display: block; }

.group-body { padding: .2rem 0 .5rem .95rem; }
.group-body > .metrics { padding: .55rem .65rem; background: #e9ece2; }
.details-list li { padding: .7rem .25rem; }
.details-list li + li { border-top: 1px solid var(--rule); }
.details-list h3 { margin-bottom: .25rem; font-size: .9rem; }

.notice {
  padding: .65rem .75rem;
  margin-bottom: .75rem;
  border-left: 3px solid #927036;
  background: #f1ead6;
  font-size: .875rem;
}

.notice--error {
  border-color: var(--negative);
  background: #f4e6e0;
  color: #702a1d;
}

.empty, .login { margin-top: 1.75rem; }
.empty p, .login p { margin-top: .65rem; }
.login form { margin-top: 1.25rem; }
.login label { display: block; margin-bottom: .35rem; font-weight: 650; }

.login input[type="password"] {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: .6rem .75rem;
  border: 1px solid #7d897b;
  border-radius: .4rem;
  color: var(--ink);
  background: #fffefa;
}

.primary-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 46px;
  padding: .55rem 1rem;
  margin-top: .8rem;
  color: #fffefa;
  background: var(--forest);
  border: 1px solid transparent;
  border-radius: .4rem;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

@media (hover: hover) {
  .primary-button:hover { background: #2d5446; }
  .group summary:hover { background: #e9ece2; }
}
