:root {
  font: 16px/1.5 system-ui, sans-serif;
  color: #192d27;
  background: #f2f6f3;
  --accent: #175f4c;
  --border: #d6e2db;
  --cash: #895316;
  --increase: #b13732;
  --decrease: #21734f;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
header { background: white; border-bottom: 1px solid var(--border); }
nav, main { width: min(100% - 2rem, 60rem); margin: auto; }
nav { display: flex; align-items: center; flex-wrap: wrap; gap: .15rem .5rem; padding: .5rem 0; }
nav a, nav button { padding: .55rem .6rem; }
nav a[aria-current="page"] { background: #e1efe8; border-radius: .45rem; text-decoration: none; }
nav form { margin-left: auto; }
a { color: var(--accent); }
main { padding: 1.1rem 0 3rem; }
h1 { margin: 0 0 1rem; font-size: 1.8rem; }
h2 { font-size: 1.125rem; margin: 0 0 .75rem; }
.panel { background: white; border: 1px solid var(--border); border-radius: .8rem; padding: 1rem; }
.total { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: 1rem; }
.total strong { display: block; font-size: 2rem; font-variant-numeric: tabular-nums; }
.sync-dialog { width: min(100% - 2rem, 28rem); color: inherit; }
.sync-dialog::backdrop { background: rgb(25 45 39 / .55); }
.sync-dialog .notice { margin: 0; }
.stack { display: grid; gap: .55rem; }
summary { cursor: pointer; }
summary span { float: right; font-variant-numeric: tabular-nums; }
details[open] summary { margin-bottom: .8rem; }
.account-row { display: grid; padding-block: .5rem; }
.account-row > * { grid-area: 1 / 1; }
.account-row summary { min-height: 44px; padding: 10px 3.5rem 10px 0; overflow-wrap: anywhere; }
.account-row details[open] { padding-bottom: .5rem; }
.cash-toggle { justify-self: end; align-self: start; }
.cash-toggle button { min-width: 44px; padding: 0; background: transparent; color: var(--accent); }
.cash-toggle span { display: inline-block; padding: .15rem .35rem; border: 1px solid var(--border); border-radius: 1rem; font-size: .85rem; }
.cash-toggle button[aria-pressed="true"] span { background: var(--accent); border-color: var(--accent); color: white; }
.cash-toggle button:disabled { cursor: wait; }
.account-row > .cash-toggle-error { grid-area: 2 / 1; margin: 0; color: var(--increase); font-size: .85rem; }
.cash-toggle-error:empty { height: 0; }
.add, .table-scroll, .month-edit { margin-top: 1rem; }
.add summary { font-weight: 700; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.login { max-width: 28rem; margin: 8vh auto 0; }
.login .fields { grid-template-columns: 1fr; }
label { display: grid; gap: .25rem; }
label.check { display: flex; align-items: center; }
.wide { grid-column: 1 / -1; }
input, textarea, button { font: inherit; border-radius: .45rem; }
input, textarea { width: 100%; border: 1px solid #a5baae; padding: .5rem .6rem; color: inherit; background: white; }
input[type="checkbox"] { width: 1.15rem; height: 1.15rem; }
textarea { resize: vertical; }
button { border: 1px solid transparent; background: var(--accent); color: white; padding: .55rem .85rem; min-height: 44px; cursor: pointer; width: fit-content; }
.secondary { background: #e1efe8; color: #194b3d; }
.danger { background: #f9e8e7; color: #8c2a24; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.notice { background: #fff3d9; padding: .75rem; border-radius: .5rem; }
.table-scroll, .chart-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: .6rem .5rem; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: #edf4ef; }
td.note { text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; min-width: 10rem; }
.legend { display: flex; gap: 1rem; font-size: .9rem; }
.legend span::before { content: ''; display: inline-block; vertical-align: middle; width: 1rem; height: 3px; margin-right: .35rem; background: var(--accent); }
.legend span + span::before { background: var(--cash); }
.chart-plot { position: relative; }
.chart-plot svg { display: block; }
.chart-plot svg text { fill: #41584e; font-size: 12px; }
.chart-plot svg .chart-year { font-size: 10px; }
.chart-plot .grid { stroke: var(--border); }
.chart-plot .baseline { stroke: #677f74; stroke-width: 1.5; }
.chart-hit { fill: transparent; }
.chart-guide { visibility: hidden; stroke: #677f74; stroke-dasharray: 4 3; }
.chart-column.active .chart-guide { visibility: visible; }
.chart-tooltip {
  position: absolute;
  top: .5rem;
  z-index: 1;
  width: max-content;
  max-width: 100%;
  pointer-events: none;
  padding: .4rem .6rem;
  border: 1px solid var(--border);
  border-radius: .45rem;
  background: white;
  box-shadow: 0 2px 8px rgb(25 45 39 / .12);
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.balance-line { color: var(--accent); }
.cash-line { color: var(--cash); }
polyline { stroke: currentColor; stroke-width: 3; fill: none; }
circle { fill: currentColor; }
.chart-toggle { margin-bottom: .75rem; }
.chart-toggle button[aria-pressed="true"] { background: var(--accent); color: white; }
.chart + .chart { margin-top: .75rem; }
.positive { color: var(--increase); }
.negative { color: var(--decrease); }
.diff-chart .positive, .diff-chart .negative { fill: currentColor; }
.diff-chart .zero { fill: #677f74; }
.diff-chart .cash-diff { opacity: .58; }
.diff-legend { display: flex; flex-wrap: wrap; gap: .25rem 1rem; font-size: .9rem; }
.diff-legend span::before { content: ''; display: inline-block; vertical-align: middle; width: .7rem; height: .7rem; margin-right: .35rem; background: currentColor; }
.diff-legend .cash-diff::before { opacity: .58; }
