:root {
  color-scheme: dark;
  --base: #111216;
  --panel: #1c1e24;
  --field: #14161b;
  --line: #363a44;
  --ink: #f5f5f6;
  --muted: #b7bbc7;
  --accent: #64e6bd;
  --danger: #ff9eac;
  --purple: #ad9afc;
  --edge: clamp(16px, 4vw, 56px);
  font-family: Geist, "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--base);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100svh; }
p, h1, h2, ul { margin: 0; }
h1 { font-size: clamp(2.45rem, 6.2vw, 5rem); font-weight: 620; line-height: .97; letter-spacing: -.066em; }
h2 { font-size: 1.13rem; font-weight: 620; letter-spacing: -.018em; line-height: 1.2; }
p, li, label { line-height: 1.5; }
a { color: inherit; text-underline-offset: .24em; }
a:hover { color: var(--accent); }
button, input, select { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.wrap { width: min(1160px, calc(100% - 2 * var(--edge))); margin-inline: auto; }
.quiet { color: var(--muted); }
.skip { position: absolute; left: -100vw; }
.skip:focus { left: var(--edge); top: 10px; z-index: 2; padding: 10px; background: var(--base); }
.bar { border-bottom: 1px solid var(--line); }
.masthead { min-height: 69px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 630; text-decoration: none; }
.brand span { display: grid; place-items: center; width: 34px; height: 34px; background: var(--accent); color: #142720; border-radius: 12px; font-size: .83rem; letter-spacing: -.03em; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 12px; }
.tabs a { display: inline-flex; gap: 8px; align-items: center; min-height: 44px; padding: 7px 16px; border-radius: 100px; color: var(--muted); text-decoration: none; font-size: .94rem; }
.tabs a:hover { background: var(--panel); color: var(--ink); }
.tabs a[aria-current] { background: #263b34; color: var(--accent); }
.tab-icon { min-width: 15px; font-size: 1.19rem; font-weight: 650; text-align: center; line-height: 1; }
main { padding-block: clamp(27px, 6vw, 80px) 70px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 14px 26px; flex-wrap: wrap; margin-bottom: clamp(20px, 4vw, 40px); }
.page-heading p { margin-top: 10px; color: var(--muted); }
.page-heading .date-line { margin: 0 0 12px; font-size: .91rem; font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 10px; margin-bottom: 23px; }
.stat { min-width: 0; padding: clamp(14px, 2.6vw, 26px); border-radius: 18px; background: var(--panel); }
.stat.featured { background: #203830; }
.stat h2 { color: var(--muted); font-size: .91rem; font-weight: 500; }
.stat p { margin-top: 9px; font-size: clamp(1.35rem, 3.2vw, 2.4rem); line-height: 1.15; font-weight: 650; letter-spacing: -.045em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat.featured p, .positive { color: var(--accent); }
.negative { color: var(--danger); }
.wallet { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 12px; margin-bottom: 14px; }
.wallet-balance { display: grid; align-content: space-between; gap: 14px; min-width: 0; padding: clamp(18px, 3.6vw, 37px); border: 1px solid #36554d; border-radius: 27px; background: radial-gradient(ellipse at top right, #294e43, transparent 74%), #1c2b28; }
.wallet-balance h2 { color: #c8dfd7; font-size: 1rem; }
.wallet-total { color: #effff9; font-size: clamp(2.15rem, 5.3vw, 4rem); line-height: 1.1; letter-spacing: -.066em; font-weight: 665; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.wallet-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.wallet-pair .stat { background: #15221f; padding: clamp(12px, 1.6vw, 17px); }
.wallet-pair .stat p { font-size: clamp(1.14rem, 2.1vw, 1.58rem); }
.allocation { min-width: 0; display: grid; grid-template-columns: minmax(95px, 142px) minmax(0, 1fr); align-items: center; gap: clamp(12px, 2.1vw, 23px); padding: clamp(16px, 2.2vw, 24px); background: var(--panel); border-radius: 27px; border: 1px solid var(--line); }
.allocation h2 { margin-bottom: 8px; }
.allocation-ring { position: relative; width: 100%; aspect-ratio: 1; }
.allocation-ring svg { display: block; width: 100%; height: 100%; overflow: visible; rotate: -90deg; }
.allocation-ring circle { fill: none; stroke-width: 12; }
.ring-track { stroke: #343944; }
.ring-segment { stroke: var(--tone); }
.allocation-ring > div { position: absolute; inset: 0; display: grid; align-content: center; text-align: center; }
.allocation-ring strong { font-size: clamp(1.33rem, 3vw, 2rem); line-height: 1; }
.allocation-ring span { margin-top: 3px; color: var(--muted); font-size: .75rem; }
.tone-0 { --tone: var(--accent); }
.tone-1 { --tone: var(--purple); }
.tone-2 { --tone: #f3c291; }
.tone-3 { --tone: #84caff; }
.tone-4 { --tone: #f59ab4; }
.legend { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; font-size: .82rem; }
.legend li { display: grid; grid-template-columns: 8px minmax(0, 1fr); align-items: center; column-gap: 7px; min-width: 0; }
.legend strong { grid-column: 2; line-height: 1.2; overflow-wrap: anywhere; }
.legend-dot { width: 7px; height: 7px; background: var(--tone); border-radius: 100%; }
.overview-grid, .edit-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.edit-layout { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
.panel { min-width: 0; padding: clamp(15px, 2.8vw, 29px); background: var(--panel); border: 1px solid var(--line); border-radius: 23px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; }
.panel-heading a { display: inline-flex; align-items: center; gap: 5px; min-height: 38px; font-size: .91rem; }
.source-panel { grid-column: 1 / -1; }
.empty { margin-top: 16px; color: var(--muted); }
.rows { list-style: none; padding: 0; margin-top: 13px; }
.rows li { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 14px; padding: 11px 0; border-top: 1px solid var(--line); }
.rows li > div { display: grid; overflow-wrap: anywhere; min-width: 0; }
.rows li .quiet { font-size: .89rem; }
.rows strong { overflow-wrap: anywhere; }
.row-end { justify-items: end; text-align: right; }
.goal { margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--line); }
.goal-detail { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.goal-detail > div { display: grid; min-width: 0; overflow-wrap: anywhere; }
.goal-detail span { font-size: .9rem; color: var(--muted); }
.amount-note { font-size: .89rem; font-variant-numeric: tabular-nums; }
progress { display: block; width: 100%; height: 8px; accent-color: var(--accent); margin-block: 11px 4px; }
.edit { display: inline-flex; align-items: center; min-height: 36px; font-size: .9rem; }
.record-form { display: grid; gap: 12px; margin-top: 16px; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.fields-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
label { display: grid; min-width: 0; gap: 5px; font-weight: 530; font-size: .93rem; }
input:not([type=checkbox]), select {
  width: 100%;
  min-width: 0;
  min-height: 43px;
  padding: 8px 10px;
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 12px;
}
input::placeholder { color: var(--muted); }
.check { display: flex; align-items: center; min-height: 36px; }
input[type=checkbox] { accent-color: var(--accent); width: 18px; height: 18px; }
.primary, .outline, .plain, .danger { display: inline-flex; align-items: center; justify-content: center; min-height: 43px; gap: 12px; padding: 7px 15px; border: 1px solid var(--line); border-radius: 12px; font-weight: 640; text-decoration: none; color: var(--ink); background: transparent; }
.pill { border-radius: 100px; }
.primary { background: var(--accent); border-color: var(--accent); color: #10231e; }
.primary:hover { background: #c1f3e5; }
.outline:hover, .plain:hover { border-color: var(--muted); }
.danger { color: var(--danger); }
.danger:hover { border-color: var(--danger); }
.remove-form { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 12px; }
.notice { color: var(--danger); }
.filter { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 16px; }
.filter label { min-width: min(100%, 180px); }
.panel .filter { margin-top: 13px; }
.transfer-tip { margin-block: 13px; }
code { font-size: .9em; overflow-wrap: anywhere; }
.entry { background: radial-gradient(ellipse at 20% 38%, #213b34, var(--base) 58%); }
.entry-layout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 360px); gap: clamp(25px, 6vw, 85px); align-items: center; min-height: 52svh; }
.entry-title p { color: var(--muted); margin-bottom: 13px; }
.entry-title h1 { font-size: clamp(3rem, 8vw, 7rem); }
.login { display: grid; gap: 12px; }
.login h2 { margin-bottom: 3px; font-size: 1.6rem; }
.login .primary { justify-content: space-between; margin-top: 4px; }

@media (max-width: 730px) {
  .edit-layout, .entry-layout, .wallet { grid-template-columns: 1fr; }
  .allocation { grid-template-columns: minmax(86px, 116px) minmax(0, 1fr); }
  .entry-layout { min-height: auto; padding-top: 16px; }
  .login { width: min(100%, 420px); }
}
@media (max-width: 510px) {
  .masthead { min-height: 57px; }
  .tabs { position: fixed; z-index: 2; inset: auto 0 0; width: 100%; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; padding: 7px 5px max(7px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #17191e; }
  .tabs a { display: grid; justify-items: center; align-content: center; gap: 3px; padding: 5px 2px; font-size: .74rem; border-radius: 14px; }
  .dashboard main { padding-bottom: calc(93px + env(safe-area-inset-bottom)); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat.featured { grid-column: 1 / -1; }
  .overview-grid { grid-template-columns: 1fr; }
}
@media (max-width: 360px) {
  .fields-row { grid-template-columns: 1fr; }
}
