.home-budget {
  display: grid;
  gap: 24px;
  min-width: 0;
  color: var(--tx, #f2f4f7);
}

.home-header,
.home-overview,
.home-filters,
.home-actions,
.home-row-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.home-header,
.home-overview {
  justify-content: space-between;
}

.home-header h2 {
  margin: 0 0 4px;
  font-size: clamp(26px, 4vw, 34px);
  font-weight: 650;
  letter-spacing: -.03em;
}

.home-header p,
.home-caption,
.home-expense-meta,
.home-expense-note,
.home-empty {
  color: var(--mt, #abb4c2);
  font-size: .875rem;
}

.home-overview {
  padding: 22px 24px;
  border: 1px solid var(--br, #39414c);
  border-radius: 12px;
  background: var(--s, #1e2228);
}

.home-total {
  margin-top: 3px;
  font-size: clamp(26px, 4vw, 37px);
  line-height: 1.1;
  font-weight: 650;
  letter-spacing: -.035em;
  overflow-wrap: anywhere;
}

.home-total,
.home-amount {
  font-variant-numeric: tabular-nums;
}

.home-filters {
  align-items: end;
  flex-wrap: wrap;
}

.home-field {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--mt, #abb4c2);
  font-size: .875rem;
  font-weight: 550;
}

.home-field :is(input, select, textarea) {
  width: 100%;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--br, #39414c);
  border-radius: 8px;
  background: var(--bg, #14171b);
  color: var(--tx, #f2f4f7);
  color-scheme: dark;
  font: inherit;
  font-weight: 450;
}

.home-field textarea {
  min-height: 64px;
  resize: vertical;
}

.home-field select {
  max-width: 100%;
}

.home-button {
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--br, #39414c);
  border-radius: 8px;
  background: var(--s2, #272d35);
  color: var(--tx, #f2f4f7);
  font: inherit;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
}

.home-button:hover {
  border-color: var(--ac, #a5beea);
}

.home-button:disabled,
.home-button[aria-disabled="true"] {
  cursor: default;
  opacity: .55;
}

.home-button-primary {
  border-color: var(--ac, #a5beea);
  background: var(--ac, #a5beea);
  color: #161e2b;
}

.home-button-primary:hover:not(:disabled) {
  filter: brightness(1.08);
}

.home-budget :is(button, input, select, textarea):focus-visible {
  outline: 2px solid var(--ac, #a5beea);
  outline-offset: 2px;
}

.home-form,
.home-confirm,
.home-load-error {
  padding: 18px 20px;
  border: 1px solid var(--br, #39414c);
  border-radius: 10px;
  background: var(--s, #1e2228);
}

.home-form h3,
.home-history h3 {
  margin: 0 0 12px;
  font-size: 1.1rem;
  font-weight: 650;
}

.home-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.home-field-wide {
  grid-column: 1 / -1;
}

.home-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 13px;
}

.home-error {
  margin-top: 10px;
  color: var(--exp, #f39f98);
  font-size: .875rem;
  overflow-wrap: anywhere;
}

.home-load-error .home-error {
  margin: 0 0 12px;
}

.home-status {
  margin: 0;
  color: var(--inc, #7bcba8);
  font-size: .875rem;
}

.home-status:empty {
  height: 0;
  margin-block: -12px;
}

.home-button-danger {
  color: var(--exp, #f39f98);
}

.home-expenses {
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--br, #39414c);
  list-style: none;
}

.home-expense {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--br, #39414c);
}

.home-expense-title {
  font-size: .975rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.home-expense-meta {
  display: flex;
  flex-wrap: wrap;
  column-gap: 10px;
  row-gap: 3px;
  margin-top: 3px;
}

.home-expense-note {
  margin-top: 5px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.home-amount {
  margin: 0;
  color: var(--exp, #f39f98);
  font-weight: 600;
  white-space: nowrap;
}

.home-row-actions {
  justify-content: flex-end;
  gap: 2px;
}

.home-button-quiet {
  min-height: 32px;
  padding: 5px 8px;
  border-color: transparent;
  background: transparent;
  color: var(--mt, #abb4c2);
}

.home-button-delete:hover:not(:disabled) {
  color: var(--exp, #f39f98);
}

.home-empty {
  margin: 0;
  padding: 12px 0;
  line-height: 1.45;
}

@media (max-width: 800px) {
  .home-overview {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
  }
}

@media (max-width: 540px) {
  .home-budget { gap: 18px; }
  .home-header { align-items: flex-start; }
  .home-header .home-button { min-height: 44px; }
  .home-overview, .home-form, .home-confirm { padding: 13px 14px; }
  .home-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .home-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-expense { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; }
  .home-row-actions { grid-column: 1 / -1; }
  .home-status:empty { margin-block: -9px; }
}

.home-header-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.home-spaces {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 12px;
}

.home-spaces .home-field {
  width: min(100%, 260px);
}

.home-expense-readonly {
  grid-template-columns: minmax(0, 1fr) auto;
}

@media (max-width: 540px) {
  .home-header {
    flex-direction: column;
    align-items: stretch;
  }

  .home-header-actions {
    justify-content: flex-start;
  }
}
