:root {
  font: 16px/1.5 system-ui,sans-serif;
  color: #142f2b;
  background: #f3f5ef;
  --green: #164b40;
  --line: #d5ddd3;
  --muted: #52665e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

header {
  background: #123d35;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px max(5vw,calc((100vw - 1200px)/2));
  gap: 16px;
}

.brand {
  font-weight: 750;
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}

.mark {
  background: #d7f39a;
  color: #153a2d;
  font: italic bold 27px Georgia;
  padding: 0 10px;
  border-radius: 4px;
}

#account {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: .88rem;
}

button,input,textarea,select {
  font: inherit;
}

button {
  cursor: pointer;
  background: var(--green);
  color: white;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 650;
  padding: 9px 16px;
}

button:hover {
  filter: brightness(1.13);
}

button:disabled {
  opacity: .55;
  cursor: wait;
}

.quiet {
  background: transparent;
  color: inherit;
  border-color: var(--line);
}

header .quiet {
  border-color: #81a198;
}

main {
  max-width: 1260px;
  margin: auto;
  padding: 32px clamp(16px,4vw,48px) 60px;
}

h1,h2,h3,p {
  margin: 0;
}

h1 {
  font: 500 clamp(2.4rem,5vw,4rem)/1.08 Georgia,serif;
  letter-spacing: -.045em;
}

h2 {
  font: 500 1.65rem Georgia,serif;
}

h3 {
  font-size: 1.04rem;
}

nav {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 38px;
}

nav button {
  background: transparent;
  color: var(--muted);
  border-radius: 0;
  padding: 9px 12px;
  border-bottom: 3px solid transparent;
}

nav button[aria-current=page] {
  border-bottom-color: var(--green);
  color: var(--green);
}

.heading,.between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.heading {
  margin-bottom: 26px;
}

.card,dialog {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: clamp(18px,3vw,32px);
}

.card+.card {
  margin-top: 20px;
}

.stats,.filters,.grid {
  display: grid;
  gap: 16px;
}

.stats {
  grid-template-columns: repeat(3,1fr);
  margin: 0 0 24px;
}

.stat {
  padding: 18px 22px;
  background: #e6ecdf;
  border-radius: 12px;
}

.stat:first-child {
  background: #d9e8d6;
}

.stat span,small,dt {
  color: var(--muted);
}

.stat strong {
  display: block;
  font: 500 2.25rem Georgia,serif;
}

.filters {
  grid-template-columns: 2fr 1fr 1fr;
  margin: 18px 0;
}

.grid {
  grid-template-columns: repeat(2,minmax(0,1fr));
}

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

label {
  display: grid;
  align-content: start;
  gap: 5px;
  font-weight: 620;
  font-size: .92rem;
}

input,select,textarea {
  width: 100%;
  min-width: 0;
  background: #fafbf8;
  color: inherit;
  border: 1px solid #aebfb4;
  border-radius: 7px;
  padding: 10px 12px;
}

textarea {
  resize: vertical;
}

button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible {
  outline: 3px solid #498662;
  outline-offset: 2px;
}

.actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 22px;
}

.row {
  display: grid;
  align-items: center;
  grid-template-columns: minmax(0,2fr) minmax(0,1.3fr) 1fr auto;
  gap: 16px;
  border-top: 1px solid var(--line);
  padding: 16px 0;
}

.row small {
  display: block;
}

.row button {
  background: transparent;
  color: var(--green);
  text-align: left;
  padding: 4px 0;
  overflow-wrap: anywhere;
}

.amount {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.badge {
  display: inline-block;
  background: #fcf0cf;
  color: #765008;
  border-radius: 20px;
  padding: 4px 11px;
  font-size: .8rem;
  font-weight: 650;
}

.done {
  background: #e2f1e4;
  color: #235d39;
}

.empty {
  padding: 28px 8px;
  text-align: center;
  color: var(--muted);
}

.login {
  max-width: 460px;
  margin: 9vh auto;
}

.login h1 {
  font-size: 2.7rem;
  margin-bottom: 24px;
}

.stack {
  display: grid;
  gap: 15px;
}

.formcard {
  max-width: 820px;
}

.hint {
  color: var(--muted);
  font-size: .92rem;
  margin: 8px 0 18px;
}

dialog {
  width: min(660px,94vw);
  max-height: 90vh;
  color: inherit;
}

dialog::backdrop {
  background: #0b211c99;
}

dialog img {
  max-width: 100%;
  max-height: 320px;
  object-fit: contain;
  display: block;
  margin: 12px 0;
}

dl {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 8px;
}

dd {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

dialog section {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

#message,.error {
  background: #fff0d9;
  color: #623607;
  padding: 10px 14px;
  border-radius: 8px;
}

#message {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 3px 14px #0002;
  z-index: 5;
}

.error:empty {
  display: none;
}

[hidden] {
  display: none!important;
}

@media(max-width:680px) {
  header {
    padding: 12px 16px;
  }

  #account span {
    display: none;
  }

  main {
    padding-top: 18px;
  }

  nav {
    margin-bottom: 22px;
  }

  .stats {
    gap: 7px;
  }

  .stat {
    padding: 12px 9px;
  }

  .stat span {
    font-size: .8rem;
  }

  .stat strong {
    font-size: 1.8rem;
  }

  .filters,.grid {
    grid-template-columns: 1fr;
  }

  .row {
    grid-template-columns: 1fr auto;
    gap: 6px;
  }

  .row .amount {
    text-align: left;
  }

  .heading {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .heading button {
    font-size: .9rem;
  }

  .card {
    padding: 16px;
  }

  .login {
    margin: 6vh auto;
  }

  dl {
    grid-template-columns: 1fr 1.5fr;
  }

}

