@font-face {
  font-family: "DM Sans";
  src: url("/dm-sans-latin.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #152526;
  --muted: #526262;
  --paper: #f3f2ed;
  --surface: #fffefa;
  --rule: #dcded5;
  --gold: #f6ce6d;
  --focus: #196f77;
  --teal: #dceee9;
  --error: #8d2823;
}

*,*::before,*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "DM Sans","Segoe UI",sans-serif;
  font-size: 16px;
  line-height: 1.4;
}

button,input,select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

[hidden] {
  display: none!important;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

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

.wrap {
  width: min(100% - 48px,960px);
  margin-inline: auto;
}

.topbar {
  background: var(--ink);
  color: #fffefa;
}

.bar-inner {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: -.02em;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 38px;
  border-radius: 10px;
  background: var(--gold);
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.07em;
}

.sign-out {
  color: #fffefa;
  background: transparent;
  border: 1px solid #61706e;
  border-radius: 8px;
  min-height: 40px;
  padding: 0 12px;
  font-weight: 700;
  font-size: .86rem;
}

.sign-out:hover {
  border-color: #fffefa;
}

.topbar :focus-visible {
  outline-color: var(--gold);
}

main.wrap {
  padding-block: 38px 55px;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

h1 {
  font-size: clamp(2.1rem,5.3vw,3.25rem);
  line-height: 1.04;
  letter-spacing: -.065em;
  font-weight: 800;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 46px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--ink);
  font-weight: 800;
  white-space: nowrap;
}

.primary {
  background: var(--gold);
  border-color: #e2b349;
}

.primary:hover:enabled {
  background: #f9d984;
}

.secondary {
  background: var(--surface);
  border-color: var(--rule);
}

.plus {
  font: 400 1.4rem / 1 Arial,sans-serif;
}

.totals {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 13px;
}

.total-card {
  position: relative;
  grid-column: 1/-1;
  background: var(--ink);
  color: #fffdf5;
  border-radius: 17px;
  padding: 24px 28px 26px;
  border-top: 4px solid var(--gold);
  overflow: hidden;
}

.total-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 23px;
}

.total-head h2 {
  font-size: 1.2rem;
  letter-spacing: -.022em;
}

.total-head > span {
  font-size: .85rem;
  color: #c2d1ce;
  white-space: nowrap;
}

.total-amounts {
  display: grid;
  grid-template-columns: minmax(0,1.35fr) minmax(0,1fr);
  gap: 25px;
}

.total-amounts > div+div {
  padding-inline-start: 26px;
  border-inline-start: 1px solid #5c726f;
}

.money-label {
  display: block;
  font-size: .82rem;
  color: #cbd9d6;
  font-weight: 600;
  margin-bottom: 4px;
}

.grand-number {
  display: block;
  color: #fff5d9;
  font-size: clamp(1.55rem,5.25vw,3.25rem);
  letter-spacing: -.035em;
  line-height: 1.08;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.partner-card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 16px 19px 17px;
}

.partner-card h2 {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: clamp(.92rem,2.55vw,1.2rem);
  font-weight: 750;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.memo-initial {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--teal);
  color: #285653;
  font-size: .92rem;
  font-weight: 800;
}

.partner-card[data-partner="jamshidbek"] .memo-initial {
  background: #f9eccd;
  color: #634922;
}

.partner-amounts {
  display: grid;
  gap: 2px;
  margin-top: 12px;
  color: var(--muted);
  font-size: .96rem;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.partner-amounts strong {
  color: var(--ink);
  font-size: clamp(1.14rem,2.65vw,1.75rem);
  letter-spacing: -.02em;
  line-height: 1.16;
}

.history {
  margin-top: 33px;
}

.history > h2 {
  font-size: 1.55rem;
  margin-bottom: 13px;
  letter-spacing: -.048em;
}

.history-state {
  min-height: 85px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  border: 1px dashed #c5cec2;
  border-radius: 12px;
  color: var(--muted);
  background: #f8f7f1;
}

.history-day+.history-day {
  margin-top: 20px;
}

.history-day h3 {
  color: var(--muted);
  font-size: .86rem;
  margin-bottom: 7px;
  font-weight: 750;
}

.history-day ul {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 12px;
  overflow: hidden;
}

.expense {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,auto);
  gap: 14px;
  padding: 13px 16px;
  align-items: center;
}

.expense+.expense {
  border-top: 1px solid var(--rule);
}

.expense-title {
  font-weight: 750;
  overflow-wrap: anywhere;
}

.expense-person {
  font-size: .82rem;
  color: var(--muted);
  margin-top: 2px;
}

.expense-amount {
  text-align: right;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

dialog {
  width: min(100% - 28px,480px);
  max-height: calc(100% - 24px);
  overflow: auto;
  border: 1px solid var(--rule);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  padding: 22px;
  box-shadow: 0 22px 75px #10242538;
}

dialog::backdrop {
  background: #15252698;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 17px;
}

.dialog-head h2 {
  font-size: 1.45rem;
  letter-spacing: -.04em;
}

.close {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 9px;
  background: #f0f1eb;
  color: var(--ink);
  font: 400 25px / 1 Arial,sans-serif;
  border: 1px solid var(--rule);
}

.field {
  min-width: 0;
  display: grid;
  gap: 6px;
  font-size: .9rem;
  font-weight: 750;
}

.field input,.field select {
  color: var(--ink);
  background: #fff;
  min-width: 0;
  width: 100%;
  height: 46px;
  border: 1px solid #bcc8c3;
  border-radius: 9px;
  padding: 0 10px;
}

.field input::placeholder {
  color: #65746e;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 12px;
  margin-top: 13px;
}

.submit {
  margin-top: 19px;
  width: 100%;
  justify-content: center;
}

.form-error {
  margin-top: 10px;
  color: var(--error);
  font-weight: 650;
  font-size: .87rem;
}

.login-error:empty {
  display: none;
}

.login-body {
  min-height: 100svh;
  display: grid;
  place-items: center;
  background: var(--ink);
  padding: 20px;
}

.login-panel {
  width: min(100%,430px);
  padding: 30px;
  background: var(--surface);
  border-radius: 16px;
  border-top: 4px solid var(--gold);
}

.login-panel h1 {
  font-size: 2rem;
  margin-top: 16px;
}

.login-panel > p {
  color: var(--muted);
  margin-top: 8px;
}

.login-panel form {
  display: grid;
  gap: 12px;
  margin-top: 23px;
}

.login-panel .submit {
  margin-top: 2px;
}

@media(max-width:600px) {
  .wrap {
    width: min(100% - 30px,960px);
  }
  .bar-inner {
    min-height: 60px;
  }
  .brand {
    gap: 8px;
  }
  .brand-mark {
    width: 36px;
    height: 34px;
  }
  .sign-out {
    min-height: 36px;
    padding-inline: 8px;
  }
  .page-heading {
    gap: 6px;
    margin-bottom: 15px;
  }
  .page-heading .button {
    padding-inline: 9px;
    font-size: .86rem;
    min-height: 43px;
  }
  .plus {
    font-size: 1.15rem;
  }
  main.wrap {
    padding-block: 25px 40px;
  }
  .totals {
    gap: 8px;
  }
  .total-card {
    padding: 17px 14px 21px;
  }
  .total-head {
    margin-bottom: 16px;
  }
  .total-head h2 {
    font-size: 1.09rem;
  }
  .total-amounts {
    gap: 10px;
    grid-template-columns: minmax(0,1.25fr) minmax(0,1fr);
  }
  .total-amounts > div+div {
    padding-inline-start: 10px;
  }
  .partner-card {
    padding: 12px 9px;
  }
  .partner-card h2 {
    gap: 5px;
  }
  .memo-initial {
    width: 24px;
    height: 24px;
    font-size: .77rem;
  }
  .history {
    margin-top: 26px;
  }
  .history-state {
    padding: 13px;
  }
  .login-panel {
    padding: 23px;
  }
}

@media(max-width:360px) {
  .memo-initial {
    display: none;
  }
  .page-heading h1 {
    font-size: 1.85rem;
  }
  .total-card {
    padding-inline: 11px;
  }
  .grand-number {
    font-size: 1.39rem;
  }
  .form-meta {
    grid-template-columns: minmax(0,1fr);
  }
}
