.debt-list-card {
  overflow: visible;
}

.debt-list-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.debt-list-heading h3 {
  margin-bottom: 0;
}

.debt-list-heading p {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  text-align: right;
}

.debt-list {
  display: grid;
  gap: 10px;
}

.debt-card {
  position: relative;
  overflow: hidden;
  padding: 14px 15px 13px 17px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(7, 10, 20, 0.72);
}

.debt-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--gold-2);
  content: '';
}

.debt-card--paid::before {
  background: #34d399;
}

.debt-card--inactive::before {
  background: #fb7185;
}

.debt-card-head,
.debt-card-identity,
.debt-card-title-row,
.debt-card-actions {
  display: flex;
  align-items: center;
}

.debt-card-head {
  justify-content: space-between;
  gap: 12px;
}

.debt-card-identity {
  flex: 1 1 auto;
  min-width: 0;
  gap: 10px;
}

.debt-card-title-row {
  flex-wrap: wrap;
  gap: 8px;
}

.debt-card-title-row h4 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.28;
}

.debt-card-identity p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.debt-card-amount {
  min-width: 150px;
  display: grid;
  gap: 3px;
  text-align: right;
}

.debt-card-amount span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.debt-card-amount strong {
  color: var(--gold-2);
  font-size: 16px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.debt-card-actions {
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.debt-compact-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.debt-compact-meta .money,
.debt-compact-meta strong {
  color: #dbe2ee;
  font-weight: 850;
}

.debt-compact-progress {
  margin-top: 9px;
}

.debt-compact-progress .progress-track {
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
}

body.page-hutang .progress-fill,
.debt-compact-progress .progress-fill {
  background: linear-gradient(90deg, #22c55e, #34d399);
  box-shadow: 0 0 14px rgba(52, 211, 153, 0.24);
}

.debt-empty {
  min-height: 150px;
  padding: 24px;
  display: grid;
  place-content: center;
  gap: 7px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  color: var(--muted);
  text-align: center;
}

.debt-empty strong {
  color: var(--text);
}

.debt-create-dialog {
  width: min(660px, 100%);
  padding: 24px;
}

.debt-create-dialog .modal-head {
  margin-bottom: 20px;
}

#debtForm {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-areas:
    'name lender'
    'currency monthly'
    'tenor due'
    'principal principal'
    'actions actions';
  gap: 15px 16px;
  align-items: start;
}

#debtForm .field {
  min-width: 0;
}

#debtForm .debt-create-name {
  grid-area: name;
}

#debtForm .debt-create-lender {
  grid-area: lender;
}

#debtForm .debt-create-currency {
  grid-area: currency;
}

#debtForm .debt-create-monthly {
  grid-area: monthly;
}

#debtForm .debt-create-tenor {
  grid-area: tenor;
}

#debtForm .debt-create-due {
  grid-area: due;
}

#debtForm .debt-create-principal {
  grid-area: principal;
}

#debtForm .modal-actions {
  grid-area: actions;
  margin-top: 2px;
}

#debtForm .input,
#debtForm .select {
  min-height: 48px;
}

#debtForm .support-text {
  min-height: 32px;
  margin-top: -1px;
  font-size: 12px;
  line-height: 1.42;
}

#debtForm .debt-create-tenor .support-text {
  display: none;
}

#debtForm input[type='number'] {
  appearance: textfield;
  -moz-appearance: textfield;
}

#debtForm input[type='number']::-webkit-outer-spin-button,
#debtForm input[type='number']::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

#debtForm [name='principal_display'][readonly] {
  cursor: not-allowed;
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.045);
}

.debt-receipt-preview {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
}

.debt-receipt-preview img {
  width: 72px;
  height: 54px;
  border-radius: 10px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.08);
}

.debt-receipt-preview strong {
  display: block;
  color: var(--text);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.debt-receipt-preview span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

@media (max-width: 980px) {
  body.page-hutang section[data-page-root] > .card.pad.debt-list-card {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .debt-list-heading {
    padding: 0 2px;
  }

  .debt-list-heading p {
    display: none;
  }

  .debt-card {
    padding: 13px 14px;
    border-radius: 16px;
  }

  .debt-card-head {
    align-items: flex-start;
  }

  .debt-card-actions {
    flex: 0 0 auto;
  }
}

@media (max-width: 640px) {
  #debtForm {
    grid-template-columns: 1fr;
    grid-template-areas:
      'name'
      'lender'
      'currency'
      'monthly'
      'tenor'
      'due'
      'principal'
      'actions';
    gap: 13px;
  }

  .debt-create-dialog {
    padding: 18px;
  }

  #debtForm .support-text {
    min-height: 0;
  }

  .debt-card {
    padding: 12px 13px;
  }

  .debt-card-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 10px;
  }

  .debt-card-identity {
    grid-column: 1 / 2;
    align-items: flex-start;
  }

  .debt-card-title-row h4 {
    font-size: 15px;
  }

  .debt-card-identity p {
    font-size: 11px;
  }

  .debt-card-amount {
    grid-column: 1 / 2;
    min-width: 0;
    text-align: left;
  }

  .debt-card-amount strong {
    font-size: 15px;
  }

  .debt-card-actions {
    grid-column: 2 / 3;
    grid-row: 1 / 3;
    align-self: start;
  }

  .debt-compact-meta {
    margin-top: 8px;
    gap: 4px 10px;
    font-size: 11px;
  }

  .debt-receipt-preview {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .debt-receipt-preview img {
    width: 56px;
    height: 44px;
  }

  .debt-receipt-preview .btn {
    grid-column: 1 / -1;
    justify-content: center;
  }
}
