.debts-page {
  width:min(960px,100%);
  margin:auto;
  padding:20px 18px 90px
}
.debts-page[hidden] {
  display:none
}
.debts-page > header > .hero-kicker {
  width: max-content;
  padding: 7px 5px;
}
.debts-page>.card {
  margin-bottom:18px
}
.debt-overview {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
  margin-bottom:20px
}
.debt-overview>div, .debt-overview>button {
  min-width:0;
  background:#edf5f8;
  padding:16px;
  border-radius:14px
}
.debt-overview span {
  display:block;
  font-size:.78rem;
  color:var(--muted)
}
.debt-overview strong {
  display:block;
  font-size:clamp(1.1rem,4vw,1.7rem);
  margin-top:8px;
  overflow-wrap:anywhere;
  font-variant-numeric:tabular-nums
}
.debt-filters {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
  margin-bottom:12px
}
.debt-filters label {
  min-width:0;
  font-size:.8rem;
  color:var(--muted)
}
.debt-filters select {
  margin-top:6px
}
.debt-record {
  border-top:1px solid var(--line)
}
.debt-person {
  border-top: 1px solid var(--line);
}
.debt-person > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 0;
  cursor: pointer;
  list-style: none;
}
.debt-person > summary::-webkit-details-marker { display: none; }
.debt-person-name { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.debt-person-totals { display: grid; gap: 5px; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.debt-person-total { font-size: .8rem; font-variant-numeric: tabular-nums; }
.debt-person-chevron { color: var(--muted); flex-shrink: 0; }
.debt-person[open] > summary .debt-person-chevron { transform: rotate(90deg); }
.debt-person-records { padding: 0 10px; border-radius: 12px; background: #f5f8fb; }
.debt-person-records .debt-record:first-child { border-top: 0; }
.debt-record>summary {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:18px 0;
  cursor:pointer
}
.debt-record>summary>span {
  min-width:0;
  overflow-wrap:anywhere
}
.debt-meta {
  display:block;
  color:var(--muted);
  font-size:.76rem;
  margin-top:5px
}
.debt-balance {
  flex-shrink:0;
  text-align:right
}
.debt-balance strong {
  font-variant-numeric:tabular-nums
}
.debt-body {
  padding:0 0 16px;
  font-size:.85rem
}
.debt-body h3 {
  font-size:.9rem;
  margin-top:20px
}
.debt-actions {
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap
}
.debt-payment {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;
  border-top:1px solid var(--line);
  padding:12px 0
}
.debt-payment>span {
  min-width:0;
  overflow-wrap:anywhere
}
.debt-payment strong {
  display:block;
  margin-top:4px
}
.debt-payment small {
  display:block;
  color:var(--muted);
  white-space:pre-wrap
}
.debt-payment>div {
  flex-shrink:0
}
.debt-note {
  white-space:pre-wrap;
  overflow-wrap:anywhere
}
.debt-error {
  color:var(--danger);
  font-size:.8rem
}
.debt-error:empty {
  display:none
}
#debtDialog,#debtPaymentDialog {
  max-height:90dvh;
  overflow-y:auto
}
#debtDialog .field,#debtPaymentDialog .field {
  font-size:1rem
}
#debtDialog textarea {
  min-height:70px;
  padding:10px;
  resize:vertical
}
.debts-page .header-actions .soft {
  padding:8px 12px
}
.debts-page #debtNew {
  width:100%
}
@media(max-width:620px) {
  .debts-page {
    padding:18px 13px 76px
  }
}
@media(max-width:380px) {
  .debt-overview>div {
    padding:12px
  }
  .debt-payment {
    flex-wrap:wrap
  }
  header .header-actions {
    flex-wrap:wrap;
    justify-content:flex-end
  }
}
body.debts-view {
  --ink: #2d3d4a;
  --muted: #657888;
  --brand: #526d85;
  --brand2: #6b87a1;
  --line: #dee6ed;
  --good: #087e5b;
  --danger: #b42318;
  background: linear-gradient(180deg, #edf2f6 0, #fafcfd 42%, #eaf0f5 100%);
}
body.debts-view .debt-overview > div, body.debts-view .debt-overview > button {
  background: #eaf0f5;
}
body.debts-view #debtReceivable {
  color: var(--good);
}
body.debts-view .field {
  background-color: #fbfcfe;
}
body.debts-view .soft {
  background: #e5edf3;
}
body header .app-section-nav {
  --brand: #164e63;
  --muted: #6b7b83;
  --line: #dbe5ea;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}
body header .app-section-nav button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 0 0 76px;
  width: 76px;
  min-width: 0;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--brand);
  font-size: .82rem;
  font-weight: 700;
  box-shadow: none;
}
body header .app-section-nav button svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
}
body header .app-section-nav button.active {
  color: #fff;
  border-color: var(--brand);
  background: var(--brand);
}
body header .section-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  padding: 4px 0;
  margin-right: 6px;
  background: transparent;
  color: var(--brand);
  font-size: .76rem;
  cursor: pointer;
}
body header .section-back svg {
  width: 15px;
  height: 15px;
}
@media (max-width: 620px) {
  body header .app-section-nav {
    grid-column: 2;
    gap: 6px;
  }
}
@media (max-width: 380px) {
  body header .app-section-nav button {
    flex-basis: 60px;
    width: 60px;
  }
}
body header .app-section-nav .page-segments {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 1px 2px;
  border-radius: 10px;
  background: #e5edf0;
}
body header .app-section-nav .page-segments button {
  width: 48px;
  height: 32px;
  border: 0;
  border-radius: 7px;
  font-size: .78rem;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
}
body header .app-section-nav .page-segments button.active {
  background: #fff;
  color: var(--brand);
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(30, 40, 55, .06);
}
body header .app-section-nav > button[data-section="backup"] {
  width: 56px;
  flex-basis: 56px;
  height: 34px;
  gap: 3px;
  font-size: .78rem;
  border-radius: 10px;
  border-color: transparent;
  background: #e5edf0;
}
@media (max-width: 380px) {
  body header .app-section-nav .page-segments button {
    width: 48px;
  }
  body header .app-section-nav > button[data-section="backup"] {
    width: 56px;
    flex-basis: 56px;
  }
}
.debt-overview > button {
  border: 1px solid transparent;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.debt-overview > button[aria-pressed="true"] {
  border-color: var(--brand2);
}
.debt-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px 12px;
}
.debt-form-grid > .label {
  min-width: 0;
}
.debt-form-grid .field {
  min-width: 0;
}
#debtDialog .date-button, #debtPaymentDialog .date-button {
  gap: 4px;
  padding: 0 8px;
}
#debtDialog .date-button span, #debtPaymentDialog .date-button span {
  font-size: .85rem;
}
#debtDialog .date-button svg, #debtPaymentDialog .date-button svg {
  width: 18px;
  height: 18px;
}
.debt-clear-date {
  border: 0;
  background: transparent;
  color: var(--brand);
  font: inherit;
  margin-left: 6px;
  padding: 4px 0;
}
.debt-date-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-bottom: 10px;
}
.debt-date-actions > .hint {
  margin: 0;
}
.debt-date-actions .debt-actions {
  flex-wrap: nowrap;
  margin-left: auto;
  gap: 6px;
}
.debt-date-actions .debt-actions button {
  background: transparent;
  border: 0;
  box-shadow: none;
  white-space: nowrap;
}

#debtTitle:focus {
  outline: none;
}
.picker-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}
.picker-arrow svg {
  display: block;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}

.debt-balance > strong {
  display: block;
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.debt-balance .debt-status {
  display: flex;
  margin: 5px 0 0 auto;
  align-items: center;
  align-self: flex-end;
  width: max-content;
  padding: 3px 8px;
  border-radius: 7px;
  font-size: .72rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}
.debt-status-open { color: #526777; background: #edf1f4; }
.debt-status-today { color: #856331; background: #f5efdf; }
.debt-status-overdue { color: #945650; background: #f5e9e6; }
.debt-status-closed { color: #497367; background: #e8f1ed; }

@media (max-width: 540px) {
  body main > header {
    column-gap: 6px;
  }
  body main > header > .app-section-nav {
    grid-column: 2;
    grid-row: 1;
  }
  body main > header > .hero-kicker,
  body main > header > .investment-brand {
    min-width: 0;
    width: max-content;
    gap: 5px;
    padding: 7px 0;
    font-size: .82rem;
    letter-spacing: 0;
    white-space: nowrap;
  }
}
@media (max-width: 340px) {
  body main > header {
    column-gap: 4px;
  }
  body main > header > .hero-kicker,
  body main > header > .investment-brand {
    gap: 4px;
    font-size: .78rem;
  }
  body main > header > .hero-kicker::before,
  body main > header > .investment-brand::before {
    width: 4px;
    height: 4px;
    flex-shrink: 0;
  }
  body header .app-section-nav {
    gap: 4px;
  }
  body header .app-section-nav > button[data-section="backup"] {
    width: 56px;
    flex-basis: 56px;
  }
}
