.receivable-metrics {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.receivable-metrics-six {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.receivable-tabs,
.receivable-subtabs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid #dbe5ef;
  border-radius: 11px;
  background: #edf2f7;
  margin-bottom: 14px;
}

.receivable-tabs a,
.receivable-subtabs a {
  padding: 9px 18px;
  border-radius: 8px;
  color: #52677f;
  font-weight: 650;
  text-decoration: none;
}

.receivable-tabs a.active,
.receivable-subtabs a.active {
  color: #155da9;
  background: #fff;
  box-shadow: 0 1px 4px rgba(23, 58, 99, .1);
}

.receivable-subtabs {
  width: fit-content;
  margin-top: 14px;
}

.receivable-history-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.receivable-history-notice div {
  display: grid;
  gap: 4px;
}

.receivable-history-notice span {
  color: #66758a;
}

.compact-form label {
  display: grid;
  gap: 6px;
  color: var(--text-secondary, #5a6b82);
  font-size: 13px;
}

.receivable-history-toggle {
  display: flex;
  min-height: 36px;
  align-items: center;
  gap: 7px;
}

.filter-row .receivable-history-toggle input {
  width: 14px;
  min-width: 14px;
  height: 14px;
  min-height: 0;
  padding: 0;
  accent-color: #2563eb;
}

.receivable-filter-actions {
  display: grid;
  grid-column: span 2;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.receivable-filter-actions .button {
  width: 100%;
}

.receivable-table-wrap {
  overflow-x: auto;
}

.receivable-table {
  min-width: 1840px;
}

.unified-receivable-table {
  min-width: 2050px;
}

.online-project-table,
.adjustment-table {
  min-width: 1450px;
}

.status.source-offline_order {
  color: #40556c;
  background: #edf2f7;
}

.status.source-online_sales {
  color: #155da9;
  background: #e7f2ff;
}

.receivable-heading-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.receivable-detail-grid dd small {
  display: block;
  margin-top: 3px;
  color: #73839a;
  font-weight: 400;
  font-size: 10px;
}

.project-payment-row td {
  padding: 0 14px 12px;
  background: #f8fbff;
}

.project-payment-panel {
  border: 1px solid #d8e5f2;
  border-radius: 10px;
  background: #fff;
}

.project-payment-panel > summary {
  padding: 10px 13px;
  color: #1768c8;
  cursor: pointer;
  font-weight: 650;
}

.project-payment-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
  padding: 0 13px 13px;
}

.project-payment-form > label,
.project-manual-allocations label {
  display: grid;
  gap: 5px;
  color: #5a6b82;
  font-size: 12px;
}

.project-manual-allocations {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid #e0e8f1;
  border-radius: 9px;
  background: #f8fafc;
}

.project-manual-allocations[hidden] {
  display: none;
}

.project-manual-allocations > strong {
  grid-column: 1 / -1;
  color: #173a63;
}

.adjustment-review-form {
  display: grid;
  min-width: 220px;
  gap: 7px;
}

.receivable-bulk-form {
  margin: 0 0 14px;
}

.receivable-bulk-toolbar {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border: 1px solid #dbe5ef;
  border-radius: 10px;
  background: #f8fbff;
}

.receivable-bulk-toolbar > strong {
  color: #173a63;
  margin-right: 2px;
}

.receivable-selection-clear {
  padding: 0;
  border: 0;
  color: #1768c8;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
}

.receivable-selection-clear:hover {
  text-decoration: underline;
}

.receivable-bulk-toolbar > label {
  display: grid;
  gap: 5px;
  color: var(--text-secondary, #5a6b82);
  font-size: 12px;
}

.receivable-bulk-toolbar select,
.receivable-bulk-toolbar input {
  min-width: 150px;
}

.receivable-bulk-help {
  flex-basis: 100%;
  margin-top: -2px;
}

.receivable-bulk-help.is-error {
  color: #b42335;
  font-weight: 650;
}

.bulk-payment-amount,
.bulk-invoice-amount {
  width: 130px;
  min-width: 130px;
}

.status.uninvoiced {
  color: #66758a;
  background: #eef2f6;
}

.status.partially_invoiced {
  color: #8b620c;
  background: #fff3d8;
}

.status.invoiced {
  color: #23644f;
  background: #e7f5ef;
}

.select-cell {
  width: 42px;
  min-width: 42px;
  text-align: center;
}

.select-cell input {
  width: 16px;
  height: 16px;
  accent-color: #2563eb;
}

.receivable-table td,
.receivable-table th {
  vertical-align: middle;
}

.receivable-row-overdue {
  background: #fff7f7;
}

.receivable-inline-action {
  display: grid;
  gap: 6px;
  min-width: 150px;
}

.receivable-inline-action input,
.receivable-inline-action select {
  min-width: 138px;
}

.receivable-status-stack {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: flex-start;
}

.receivable-order-memory {
  position: relative;
  display: inline-flex;
  max-width: 260px;
  flex-direction: column;
  gap: 3px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: help;
  transition: background .14s ease, border-color .14s ease;
}

.receivable-order-memory:hover {
  background: #edf5ff;
  border-color: #c9def5;
}

.receivable-order-memory > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.receivable-order-memory:focus-visible {
  outline: 2px solid rgba(29, 111, 210, .32);
  outline-offset: 3px;
}

.receivable-item-tooltip {
  width: min(400px, calc(100vw - 40px));
  padding: 14px 15px;
  text-align: left;
  color: #1d3451;
  background: #fff;
  border: 1px solid #d6e2ef;
  border-radius: 11px;
  box-shadow: 0 16px 36px rgba(33, 69, 105, .18);
}

.receivable-item-tooltip.is-portaled-tooltip.is-visible {
  pointer-events: auto;
}

.receivable-item-tooltip > strong,
.receivable-item-tooltip > small {
  display: block;
}

.receivable-item-tooltip > strong {
  color: #173d67;
}

.receivable-item-tooltip ul {
  display: grid;
  max-height: 240px;
  gap: 0;
  overflow: auto;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
  margin: 9px 0;
  padding: 0;
  list-style: none;
}

.receivable-item-tooltip li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 0;
  border-top: 1px solid #e7edf4;
}

.receivable-item-tooltip li:first-child {
  border-top: 0;
}

.receivable-item-tooltip li span,
.receivable-item-tooltip li span small {
  display: block;
  min-width: 0;
}

.receivable-item-tooltip li span {
  color: #233c59;
}

.receivable-item-tooltip li span small,
.receivable-item-tooltip > small {
  color: #71839a;
  font-size: 10px;
}

.receivable-item-tooltip li b {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 999px;
  color: #1768c8;
  background: #e9f3ff;
  font-size: 12px;
}

.receivable-item-tooltip .receivable-item-empty {
  color: #71839a;
}

.receivable-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
  gap: 18px;
}

.receivable-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.receivable-detail-grid div {
  padding: 12px;
  border: 1px solid #e5eaf0;
  border-radius: 10px;
  background: #f8fafc;
}

.receivable-detail-grid dt {
  color: #6b7a90;
  font-size: 12px;
  margin-bottom: 5px;
}

.receivable-detail-grid dd {
  margin: 0;
  font-weight: 650;
  color: #173a63;
}

.compact-form {
  display: grid;
  gap: 12px;
}

.payment-dialog {
  width: min(560px, calc(100vw - 32px));
  border: 0;
  border-radius: 16px;
  padding: 0;
  box-shadow: 0 24px 70px rgba(18, 43, 72, .28);
}

.payment-dialog::backdrop {
  background: rgba(13, 29, 48, .55);
}

.payment-dialog-card {
  padding: 24px;
  display: grid;
  gap: 16px;
}

.payment-dialog-actions,
.pagination-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.summary-table td,
.summary-table th {
  white-space: nowrap;
}

@media (max-width: 1380px) {
  .receivable-metrics-six {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .receivable-layout {
    grid-template-columns: 1fr;
  }

  .receivable-bulk-toolbar > strong {
    width: 100%;
  }

  .project-payment-form {
    grid-template-columns: 1fr 1fr;
  }

  .receivable-history-notice {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 680px) {
  .receivable-metrics-six {
    grid-template-columns: 1fr;
  }
}
