:root {
  --bg: #f5f6f4;
  --surface: #fff;
  --ink: #233b35;
  --muted: #76817c;
  --green: #286457;
  --green-dark: #204e44;
  --green-light: #eaf2ed;
  --line: #e4e9e5;
  --expense: #b3673d;
  --expense-light: #fbf0e8;
  --danger: #bc403b;
  --radius: 14px;
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--ink);
  font-size: 14px;
  font-synthesis: none;
}
.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(100%, 440px);
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 12px 50px #233b350a;
}
.login-card h1 { font-size: 26px; margin: 8px 0; }
.login-card form { display: grid; gap: 18px; margin-top: 26px; }
.login-card label { display: grid; gap: 7px; }
.login-card input { width: 100%; min-height: 44px; }
.server-backup-download { display: inline-flex; margin-top: 12px; }
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  line-height: 1.6;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  outline-offset: 4px;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #65a18a;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: wait;
  opacity: 0.55;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  border: 0;
}
button.primary,
.secondary,
.ghost,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 18px;
  border-radius: 8px;
  font-weight: 600;
  white-space: nowrap;
}
button.primary {
  background: var(--green);
  color: white;
  border: 1px solid var(--green);
}
button.primary:hover {
  background: var(--green-dark);
}
.secondary {
  background: #fff;
  border: 1px solid #d5dfd9;
  color: var(--ink);
}
.secondary:hover {
  background: #f1f6f2;
  border-color: #aec3b7;
}
.ghost {
  background: transparent;
  color: var(--muted);
}
.ghost:hover {
  background: #edf1ed;
  color: var(--ink);
}
.danger-button {
  background: var(--danger) !important;
  border-color: var(--danger) !important;
}
.actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.wrap {
  flex-wrap: wrap;
}
[hidden] {
  display: none !important;
}
.sidebar {
  width: 222px;
  position: fixed;
  inset: 0 auto 0 0;
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 36px 22px;
  display: flex;
  flex-direction: column;
  z-index: 5;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0 8px 45px;
}
.brand > span {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 2px;
}
.brand small {
  display: block;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 1.8px;
  color: var(--muted);
  margin-top: 1px;
}
.nav-caption {
  color: #a0aaa5;
  font-size: 11px;
  letter-spacing: 2px;
  margin: 0 14px 12px;
}
nav {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
nav a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  border-radius: 8px;
  font-weight: 500;
  color: #6d7b73;
}
nav a.active {
  background: var(--green-light);
  color: var(--green-dark);
  font-weight: 700;
}
nav a:hover {
  background: #f3f6f3;
}
.nav-icon {
  font-size: 22px;
  line-height: 1;
  width: 22px;
  text-align: center;
}
.sidebar-bottom {
  margin-top: auto;
  padding: 20px 12px 0;
  color: #677c70;
  font-size: 11px;
}
.sidebar-bottom small {
  display: block;
  color: #9ba69f;
  margin-top: 10px;
}
.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4b9876;
  margin-right: 4px;
  vertical-align: middle;
}
.version {
  display: block;
  font-size: 10px;
  letter-spacing: 1px;
  color: #b0b8b2;
  margin-top: 23px;
}
main {
  margin-left: 222px;
  padding: 38px 46px 30px;
  max-width: 1700px;
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 30px;
}
.eyebrow {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1.5px;
  margin-bottom: 9px;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 28px;
  font-weight: 650;
  letter-spacing: 0.6px;
  line-height: 1.4;
}
h2 {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: 0.25px;
}
h3 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: #8b9890;
}
p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}
.page-header .actions button {
  min-width: 108px;
}
.page-header .actions button span {
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
}
.account-panel {
  color: #fff;
  background: var(--green-dark);
  border-radius: var(--radius);
  padding: 25px 29px 27px;
  margin-bottom: 32px;
}
.account-heading {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 23px;
}
.account-heading h2 {
  font-size: 14px;
}
.account-settings-button {
  margin-left: auto;
  border: 1px solid #ffffff50;
  border-radius: 6px;
  color: #e5f1e9;
  background: #ffffff0e;
  padding: 6px 11px;
  font-size: 11px;
  white-space: nowrap;
}
.account-settings-button:hover {
  background: #ffffff20;
}
.initial-field {
  margin-top: 24px;
}
#initial-amount {
  font-size: 23px;
  font-variant-numeric: tabular-nums;
}
#initial-error {
  margin-top: 16px;
}
.initial-preview {
  margin-top: 20px;
  padding: 18px;
  border-radius: 9px;
  background: #eef4ed;
}
.initial-preview span {
  color: #71806b;
  font-size: 12px;
}
.initial-preview strong {
  display: block;
  font-size: 28px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.initial-preview small {
  color: #90a18a;
  font-size: 10px;
}
.portable-welcome { margin: 0 0 24px; }
.portable-welcome .text-link { display: inline; font-size: inherit; text-decoration: underline; }
.range-tag {
  font-size: 10px;
  letter-spacing: 0.35px;
  color: #c6d9d0;
  background: #ffffff0d;
  border: 1px solid #ffffff20;
  padding: 3px 9px;
  border-radius: 5px;
}
.account-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr 1fr 1fr;
  gap: 24px;
  align-items: center;
}
.account-grid span {
  display: block;
  font-size: 11px;
  color: #bed0c7;
}
.account-grid strong {
  display: block;
  font-variant-numeric: tabular-nums;
  font-weight: 550;
  letter-spacing: 0.2px;
  overflow-wrap: anywhere;
}
.balance-block {
  padding-right: 23px;
  border-right: 1px solid #ffffff25;
  min-width: 0;
}
.balance-block strong {
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.3;
  margin: 9px 0 12px;
  letter-spacing: 0.6px;
}
.account-stat strong {
  font-size: clamp(18px, 1.8vw, 25px);
  margin: 8px 0 11px;
}
.account-grid small {
  font-size: 10px;
  color: #9eb9ad;
}
.balance-alert {
  font-size: 12px;
  background: #fff0e8;
  color: #a12e29;
  padding: 6px 10px;
  border-radius: 6px;
  margin-bottom: 8px;
}
.negative-balance {
  color: #ffd7ce;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 17px;
}
.muted {
  color: var(--muted);
  font-size: 12px;
}
.section-header p {
  margin-top: 3px;
  font-size: 11px;
}
.segmented {
  display: flex;
  gap: 3px;
  padding: 4px;
  background: #eaece8;
  border-radius: 8px;
}
.segmented button {
  padding: 6px 16px;
  background: transparent;
  color: #7e8881;
  border-radius: 5px;
  font-size: 12px;
}
.segmented button.active {
  background: #fff;
  color: var(--green-dark);
  box-shadow: 0 1px 3px #233b350d;
  font-weight: 650;
}
.period-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 17px;
}
.metric-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  text-align: left;
  padding: 20px 23px;
  color: var(--ink);
}
.metric-card:hover {
  border-color: #9fb9a9;
  background: #fcfdfb;
}
.metric-label {
  display: flex;
  gap: 7px;
  align-items: center;
  color: #6a776f;
  font-size: 12px;
}
.metric-dot {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.income-bg {
  background: var(--green);
}
.expense-bg {
  background: var(--expense);
}
.net-bg {
  background: #718180;
}
.arrow {
  margin-left: auto;
  color: #9fac9f;
  font-size: 16px;
}
.metric-card strong {
  display: block;
  font-variant-numeric: tabular-nums;
  font-size: 30px;
  font-weight: 600;
  margin: 10px 0 4px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.metric-card small {
  color: #96a097;
  font-size: 10px;
}
.income {
  color: var(--green);
}
.expense {
  color: var(--expense);
}
.category-panel {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 30px;
  margin: 19px 0 32px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius);
  padding: 20px 24px;
}
.category-group + div {
  padding-left: 30px;
  border-left: 1px solid var(--line);
}
.category-group h3 {
  margin-bottom: 9px;
}
.category-row {
  display: flex;
  align-items: center;
  gap: 15px;
  width: 100%;
  background: transparent;
  padding: 8px 0;
  font-size: 12px;
  color: #65736a;
  text-align: left;
}
.category-row:hover {
  color: var(--green);
  text-decoration: underline;
}
.category-row strong {
  font-size: 13px;
  margin-left: auto;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  max-width: 65%;
  text-align: right;
}
.category-row .mini-arrow {
  color: #bbc5be;
  font-size: 10px;
}
.text-link {
  font-size: 12px;
  color: var(--green);
  display: flex;
  gap: 10px;
}
.text-link:hover {
  text-decoration: underline;
}
.table-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  overflow: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
  text-align: left;
}
th {
  background: #fafbf9;
  color: #8a978d;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  padding: 13px 19px;
  border-bottom: 1px solid var(--line);
}
td {
  padding: 14px 19px;
  border-bottom: 1px solid #eff2ed;
  vertical-align: middle;
}
tbody tr:last-child td {
  border-bottom: 0;
}
tbody tr:hover {
  background: #fcfdfb;
}
td.date-cell {
  color: #7a887e;
  white-space: nowrap;
  width: 120px;
}
td.kind-cell {
  width: 85px;
}
.amount-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-weight: 600;
}
.amount-head {
  text-align: right;
}
.category-cell {
  white-space: nowrap;
  width: 150px;
}
.note-cell {
  color: #849087;
  min-width: 100px;
  max-width: 420px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.record-actions {
  white-space: nowrap;
  text-align: right;
  width: 170px;
}
.record-actions button {
  font-size: 11px;
  color: #678674;
  padding: 3px 5px;
  margin-left: 3px;
  background: transparent;
  border-radius: 4px;
}
.record-actions button:hover {
  background: var(--green-light);
}
.record-actions button.delete {
  color: #9a7a66;
}
.badge {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-block;
  white-space: nowrap;
}
.badge.income {
  background: #edf4ef;
}
.badge.expense {
  background: var(--expense-light);
}
.empty-state {
  text-align: center;
  padding: 44px 22px;
}
.empty-state .empty-icon {
  display: flex;
  width: 45px;
  height: 45px;
  margin: 0 auto 14px;
  align-items: center;
  justify-content: center;
  font-size: 23px;
  background: #f0f4ef;
  border-radius: 12px;
  color: #849d8b;
}
.empty-state strong {
  font-size: 14px;
  font-weight: 550;
}
.empty-state p {
  font-size: 12px;
  margin-top: 7px;
}
.empty-state button {
  margin-top: 17px;
}
.hint {
  margin-top: 22px;
  background: #eef1ea;
  border-radius: 8px;
  padding: 12px 17px;
  color: #8a967f;
  font-size: 11px;
}
.hint > span {
  font-weight: 650;
  color: #77866f;
  margin-right: 12px;
}
.custom-range {
  display: flex;
  align-items: flex-end;
  gap: 15px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 15px;
  margin-bottom: 17px;
}
.custom-range > span {
  padding-bottom: 9px;
  color: var(--muted);
}
label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #5b7063;
}
input,
select,
textarea {
  display: block;
  width: 100%;
  border: 1px solid #dbe3dc;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  min-height: 42px;
  padding: 9px 11px;
  margin-top: 6px;
  font-size: 13px;
}
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #a2c1ad;
  border-color: #709e80;
}
input::placeholder,
textarea::placeholder {
  color: #a8b2aa;
}
input[aria-invalid="true"],
select[aria-invalid="true"] {
  border-color: var(--danger);
  outline-color: #e5bbb8;
}
textarea {
  resize: vertical;
  min-height: 85px;
}
label small {
  display: block;
  font-size: 11px;
  color: #9aa69b;
  font-weight: 400;
  margin-top: 6px;
}
.filter-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 23px;
  margin-bottom: 20px;
}
.filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 0.8fr 1.1fr 1.5fr;
  gap: 15px;
}
.filter-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 19px;
}
.filter-bottom .muted {
  font-size: 11px;
}
.filtered-totals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  background: #edf2ed;
  border-radius: var(--radius);
  padding: 21px 25px;
  margin-bottom: 25px;
}
.filtered-totals span {
  display: block;
  color: #7d8b80;
  font-size: 11px;
}
.filtered-totals strong {
  font-size: 24px;
  display: block;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
  margin-top: 6px;
  overflow-wrap: anywhere;
}
.tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}
.tabs button {
  font-size: 14px;
  color: #8b988e;
  padding: 12px 2px;
  background: transparent;
  border-bottom: 2px solid transparent;
}
.tabs button.active {
  color: var(--green-dark);
  font-weight: 600;
  border-color: var(--green-dark);
}
.table-toolbar {
  margin-bottom: 10px;
}
.result-description {
  margin-bottom: 14px;
}
.monthly-table {
  min-width: 1120px;
}
.monthly-table th {
  padding: 12px 14px;
}
.monthly-table td {
  padding: 15px 14px;
}
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 13px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--muted);
}
.pagination button {
  min-height: 32px;
  padding: 5px 12px;
}
.footnote {
  font-size: 11px;
  color: #8e9b91;
  margin-top: 14px;
}
.pill {
  background: #eaf0e9;
  color: #71816f;
  border-radius: 6px;
  display: inline-block;
  padding: 5px 10px;
  font-size: 11px;
  white-space: nowrap;
}
.settings-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 21px;
  margin-bottom: 22px;
}
.settings-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 25px;
}
.settings-card h2 {
  margin-bottom: 8px;
}
.settings-card > label {
  margin-top: 22px;
}
.path-box {
  font-weight: 400;
  overflow-wrap: anywhere;
  font-size: 11px;
  background: #f4f6f2;
  border-radius: 6px;
  padding: 11px;
  margin-top: 7px;
  color: #6e8071;
}
.directory-input {
  display: flex;
  align-items: flex-end;
  gap: 9px;
}
.directory-input input {
  flex: 1;
  min-width: 0;
}
.directory-input button {
  flex-shrink: 0;
}
.settings-card form {
  margin-top: 20px;
}
.settings-card form > button {
  margin-top: 15px;
}
.backup-status {
  background: #f5f7f3;
  border-radius: 8px;
  padding: 16px;
  margin: 23px 0;
}
.backup-status strong {
  display: block;
  font-size: 13px;
  font-weight: 550;
}
.backup-status p {
  font-size: 11px;
  overflow-wrap: anywhere;
}
.backup-status .warning {
  color: var(--danger);
}
.restore-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 25px;
  margin-bottom: 31px;
}
.file-button {
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  cursor: pointer;
}
.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  padding: 0;
  margin: 0;
  height: 100%;
}
.file-button:focus-within {
  outline: 3px solid #65a18a;
  outline-offset: 3px;
}
.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  margin-top: 30px;
  padding-top: 15px;
  font-size: 11px;
  color: #a0aba1;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 28px 30px;
  width: 510px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 40px);
  color: var(--ink);
  box-shadow: 0 20px 85px #17312730;
}
dialog::backdrop {
  background: #15271d66;
  backdrop-filter: blur(2px);
}
.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}
.dialog-heading h2 {
  font-size: 22px;
}
.dialog-heading .eyebrow {
  font-size: 10px;
  margin-bottom: 4px;
}
.icon-button {
  background: #f4f6f3;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 21px;
  line-height: 1;
  color: #8b978e;
}
.form-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 17px;
  margin-top: 23px;
}
#entry-form > label {
  margin-top: 17px;
}
.required {
  color: #b26b54;
}
.optional {
  font-weight: 400;
  font-size: 10px;
  color: #9ba69e;
  margin-left: 4px;
}
#entry-amount {
  font-size: 23px;
  font-weight: 550;
  padding: 10px 12px;
  letter-spacing: 0.4px;
}
.entry-hint {
  font-size: 11px;
  background: #f3f5ee;
  color: #8c967e;
  padding: 10px 12px;
  border-radius: 6px;
  margin-top: 18px;
}
.dialog-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.alert {
  padding: 12px 15px;
  border-radius: 8px;
  font-size: 12px;
  margin-bottom: 17px;
  white-space: pre-wrap;
}
.alert.error {
  background: #fbeeed;
  color: #a63c36;
  border: 1px solid #f0d2cf;
}
#entry-error {
  margin-top: 16px;
  margin-bottom: 0;
}
.toast {
  position: fixed;
  bottom: 25px;
  left: calc(50% + 100px);
  transform: translateX(-50%);
  background: #234e3f;
  color: white;
  box-shadow: 0 6px 30px #24453625;
  border: 1px solid #ffffff30;
  border-radius: 10px;
  padding: 13px 24px;
  font-size: 13px;
  z-index: 100;
  max-width: 80vw;
}
.confirm-content {
  color: #738173;
  font-size: 13px;
  margin-top: 18px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.confirm-summary {
  background: #f1f5ef;
  padding: 14px 18px;
  border-radius: 8px;
  margin-top: 17px;
  font-size: 13px;
  line-height: 2;
}
.confirm-summary strong {
  font-variant-numeric: tabular-nums;
}
.backup-result {
  margin-top: 15px;
  font-size: 11px;
  overflow-wrap: anywhere;
}
.quit-state {
  margin: 100px auto;
  text-align: center;
}
.quit-state h1 {
  margin-bottom: 15px;
}
@media (min-width: 1600px) {
  main {
    padding-left: 60px;
    padding-right: 60px;
  }
  .account-panel {
    padding: 30px 35px;
  }
  .period-cards {
    gap: 22px;
  }
  .metric-card {
    padding: 24px 27px;
  }
}
@media (max-width: 1200px) {
  .sidebar {
    width: 190px;
    padding: 30px 14px;
  }
  main {
    margin-left: 190px;
    padding: 30px 28px;
  }
  .account-grid {
    gap: 17px;
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
  }
  .account-grid small {
    font-size: 9px;
  }
  .balance-block {
    padding-right: 15px;
  }
  .account-panel {
    padding: 23px;
  }
  .filter-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .search-label {
    grid-column: span 4;
  }
  .metric-card {
    padding: 18px;
  }
  .category-panel {
    gap: 20px;
  }
  th,
  td {
    padding-left: 13px;
    padding-right: 13px;
  }
  .settings-grid {
    grid-template-columns: 1fr 1fr;
  }
  .directory-input {
    flex-wrap: wrap;
  }
  .directory-input input {
    flex-basis: 100%;
  }
}
@media (max-width: 940px) {
  .sidebar {
    width: 170px;
    padding: 25px 12px;
  }
  .brand {
    padding: 0 6px 35px;
    gap: 8px;
  }
  .brand > span {
    font-size: 20px;
  }
  .brand img {
    width: 35px;
    height: 35px;
  }
  nav a {
    padding: 12px;
    gap: 10px;
  }
  main {
    margin-left: 170px;
    padding: 26px 22px;
  }
  .page-header {
    align-items: flex-start;
  }
  .page-header .actions {
    flex-direction: column;
    gap: 7px;
  }
  .page-header h1 {
    font-size: 25px;
  }
  .account-grid {
    grid-template-columns: 1.2fr 1fr;
  }
  .balance-block {
    grid-row: span 3;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .account-stat {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 5px;
    align-items: center;
  }
  .account-stat strong {
    font-size: 20px;
    margin: 0;
  }
  .account-stat small {
    grid-column: span 2;
  }
  .period-cards {
    gap: 10px;
  }
  .metric-card strong {
    font-size: 26px;
  }
  .category-panel {
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 18px;
  }
  .category-group + div {
    padding-left: 20px;
  }
  .section-header {
    flex-wrap: wrap;
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .restore-card {
    align-items: flex-start;
    flex-direction: column;
  }
  .toast {
    left: calc(50% + 70px);
  }
  table {
    min-width: 730px;
  }
  .filter-grid {
    grid-template-columns: 1fr 1fr;
  }
  .search-label {
    grid-column: span 2;
  }
}
@media (max-width: 640px) {
  .sidebar {
    position: sticky;
    top: 0;
    width: 100%;
    padding: 9px 16px;
    flex-direction: row;
    align-items: center;
    border-bottom: 1px solid var(--line);
    border-right: 0;
    gap: 16px;
  }
  .brand {
    padding: 0;
  }
  .brand img {
    width: 30px;
    height: 30px;
  }
  .brand > span {
    font-size: 16px;
    white-space: nowrap;
  }
  .brand small,
  .nav-caption,
  .sidebar-bottom,
  .nav-icon {
    display: none;
  }
  nav {
    flex-direction: row;
    gap: 2px;
    margin-left: auto;
  }
  nav a {
    font-size: 11px;
    padding: 9px 8px;
  }
  main {
    margin-left: 0;
    padding: 24px 16px;
  }
  .page-header {
    gap: 12px;
    margin-bottom: 23px;
  }
  .page-header h1 {
    font-size: 22px;
  }
  .page-header p {
    max-width: 220px;
    font-size: 11px;
  }
  .page-header .actions button {
    min-width: 90px;
    min-height: 36px;
    padding: 6px 12px;
  }
  .account-heading {
    flex-wrap: wrap;
    gap: 8px;
  }
  .range-tag {
    font-size: 9px;
  }
  .account-panel {
    padding: 20px;
  }
  .balance-block strong {
    font-size: 26px;
  }
  .account-stat strong {
    font-size: 17px;
  }
  .account-grid {
    gap: 16px;
  }
  .account-stat {
    display: block;
  }
  .account-stat small {
    display: none;
  }
  .account-stat span {
    font-size: 10px;
  }
  .account-stat strong {
    margin-top: 3px;
  }
  .period-cards {
    grid-template-columns: 1fr;
  }
  .metric-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    padding: 15px 18px;
  }
  .metric-card strong {
    font-size: 27px;
    text-align: right;
    grid-column: 2;
    grid-row: span 2;
    margin: 0;
  }
  .metric-card small {
    grid-column: 1;
    grid-row: 2;
    font-size: 9px;
  }
  .metric-label .arrow {
    display: none;
  }
  .category-panel {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  .category-group + div {
    padding: 14px 0 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .category-row {
    padding: 7px 0;
  }
  .segmented {
    width: 100%;
  }
  .segmented button {
    flex: 1;
    padding: 7px 12px;
  }
  .custom-range {
    flex-wrap: wrap;
    gap: 10px;
  }
  .custom-range label {
    flex: 1;
    min-width: 100px;
  }
  .custom-range button {
    width: 100%;
  }
  .filter-panel {
    padding: 17px;
  }
  .filter-grid {
    gap: 12px;
  }
  .filter-bottom {
    align-items: flex-start;
    flex-direction: column;
  }
  .filter-bottom .actions {
    align-self: flex-end;
  }
  .filtered-totals {
    gap: 10px;
    padding: 17px 14px;
  }
  .filtered-totals strong {
    font-size: 20px;
  }
  .filtered-totals span {
    font-size: 10px;
  }
  .settings-card {
    padding: 21px;
  }
  .page-header > .pill {
    display: none;
  }
  .hint {
    font-size: 10px;
  }
  .hint > span {
    display: block;
    margin-bottom: 4px;
  }
  .toast {
    left: 50%;
    max-width: 90vw;
    width: max-content;
  }
  .table-toolbar {
    gap: 10px;
  }
  .table-toolbar .secondary {
    font-size: 11px;
    padding: 8px 12px;
  }
  .tabs {
    gap: 18px;
  }
  dialog {
    padding: 23px;
  }
  .dialog-footer {
    gap: 8px;
  }
  .dialog-footer button {
    padding: 9px 14px;
  }
  #entry-dialog {
    margin: 20px auto;
  }
  .directory-input {
    flex-wrap: nowrap;
  }
  .directory-input input {
    flex-basis: auto;
  }
}

.relay-section {
  margin: 0 0 32px;
}
.relay-basis {
  display: inline-block;
  margin-left: 9px;
  padding: 2px 8px;
  border: 1px solid #dce6de;
  border-radius: 5px;
  color: #6a8373;
  font-size: 10px;
  font-weight: 500;
  vertical-align: middle;
}
.relay-empty {
  padding: 26px;
  border: 1px dashed #d2ded3;
  border-radius: 12px;
  background: #f9fbf7;
  color: #81917f;
  font-size: 12px;
}
#relay-content {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
}
.relay-overview {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 1.2fr;
  gap: 24px;
  align-items: center;
  padding: 25px 27px;
  background: #f0f5ef;
  border-bottom: 1px solid #e5ece2;
}
.relay-total-block > span,
.relay-stat > span {
  font-size: 12px;
  color: #6f8374;
}
.relay-total-block > strong {
  display: block;
  font-size: 32px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--green-dark);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.relay-total-block > small,
.relay-stat > small {
  display: block;
  color: #91a08d;
  font-size: 10px;
}
.relay-stat > strong {
  display: block;
  font-size: 27px;
  line-height: 1.7;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
}
.relay-snapshot {
  justify-self: end;
}
.relay-snapshot .pill {
  background: #e1eadd;
  font-size: 10px;
}
.relay-snapshot p {
  font-size: 10px;
  margin-top: 5px;
}
#relay-stale {
  color: #aa713f;
}
.relay-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 26px 4px;
}
.relay-tabs {
  display: flex;
  gap: 5px;
  padding: 3px;
  border-radius: 7px;
  background: #f0f3ed;
}
.relay-tabs button {
  min-height: 33px;
  padding: 5px 15px;
  font-size: 12px;
  border-radius: 5px;
  background: transparent;
  color: #7c8b7b;
}
.relay-tabs button.active {
  background: #fff;
  color: var(--green-dark);
  font-weight: 600;
  box-shadow: 0 1px 3px #203b2810;
}
.relay-visual-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  padding: 21px 26px 0;
  gap: 30px;
}
.relay-chart {
  margin: 0;
  min-width: 0;
}
.relay-chart figcaption,
.relay-data h3 {
  font-size: 12px;
  letter-spacing: 0.4px;
  color: #637865;
  font-weight: 600;
  margin: 0 0 17px;
}
.relay-bar-row {
  margin: 0 0 17px;
}
.relay-bar-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  margin-bottom: 7px;
}
.relay-bar-label > span {
  color: #70826e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.relay-bar-label > strong {
  flex-shrink: 0;
  font-weight: 550;
  color: #34513d;
  font-variant-numeric: tabular-nums;
}
.relay-bar-row svg {
  display: block;
  width: 100%;
  height: 7px;
}
.relay-chart .footnote {
  margin: 0 0 16px;
  font-size: 10px;
}
.relay-data {
  min-width: 0;
}
.relay-table-scroll {
  max-height: 398px;
  overflow: auto;
  border: 1px solid #e9eee6;
  border-radius: 8px;
}
.relay-table-scroll table {
  min-width: 0;
  table-layout: fixed;
  width: 100%;
  font-size: 11px;
}
.relay-table-scroll th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 11px 12px;
  font-size: 10px;
}
.relay-table-scroll td {
  padding: 11px 12px;
  font-size: 11px;
}
.relay-table-scroll th:first-child {
  width: 49%;
}
.relay-table-scroll th:nth-child(2) {
  width: 22%;
}
.relay-table-scroll th:last-child {
  width: 29%;
}
.relay-table-scroll td:first-child {
  color: #788872;
  overflow-wrap: anywhere;
}
.relay-request-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #8a9782;
}
.relay-table-scroll .amount-cell {
  white-space: normal;
  overflow-wrap: anywhere;
}
.relay-precision {
  margin: 10px 26px 20px;
  color: #96a28c;
  font-size: 10px;
}
.relay-no-distribution {
  padding: 20px 0;
  font-size: 12px;
  color: var(--muted);
}
@media (max-width: 1100px) {
  .relay-overview {
    grid-template-columns: 1fr 1fr;
    gap: 15px;
  }
  .relay-snapshot {
    grid-column: span 2;
    justify-self: stretch;
    border-top: 1px solid #e0e8dc;
    padding-top: 12px;
  }
  .relay-snapshot p {
    display: inline-block;
    margin-left: 10px;
  }
  .relay-visual-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  .relay-table-scroll {
    max-height: 300px;
  }
}
@media (max-width: 640px) {
  .relay-overview {
    padding: 19px;
  }
  .relay-total-block > strong {
    font-size: 28px;
  }
  .relay-stat > strong {
    font-size: 25px;
  }
  .relay-snapshot p {
    display: block;
    margin-left: 0;
  }
  .relay-toolbar {
    padding: 15px 18px 0;
  }
  .relay-visual-grid {
    padding: 18px 18px 0;
  }
  .relay-precision {
    margin: 10px 18px 18px;
  }
}
