.receivable-page-head {
  align-items: start;
  margin-bottom: 14px;
}

.source-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 14px;
  border-bottom: 1px solid var(--line);
}

.source-tab {
  appearance: none;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 600;
}

.source-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.xingchenyun-panel {
  display: grid;
  gap: 12px;
}

.xingchenyun-panel.hidden,
.receivable-local-only.hidden,
.inventory-local-only.hidden {
  display: none !important;
}

.xingchenyun-toolbar {
  margin: 0;
}

.xingchenyun-toolbar .field {
  min-width: 150px;
}

.xingchenyun-toolbar .segmented {
  white-space: nowrap;
}

.xingchenyun-inventory-search {
  padding: 12px 12px 0;
  max-width: 360px;
}

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

.xingchenyun-record {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
}

.xingchenyun-record-head,
.xingchenyun-metrics,
.xingchenyun-subtable-head,
.xingchenyun-subtable-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.5fr) repeat(4, minmax(80px, 1fr));
  gap: 8px;
  align-items: center;
}

.xingchenyun-record-head {
  grid-template-columns: 1fr auto;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.xingchenyun-record-head span,
.xingchenyun-subtable-head,
.xingchenyun-subtable-row span {
  color: var(--muted);
  font-size: 12px;
}

.xingchenyun-metrics {
  grid-template-columns: repeat(3, 1fr);
  padding: 10px 0;
}

.xingchenyun-metrics span {
  color: var(--muted);
  font-size: 12px;
}

.xingchenyun-metrics strong {
  display: block;
  color: var(--text);
  font-size: 15px;
}

.xingchenyun-subtable {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.xingchenyun-subtable-head,
.xingchenyun-subtable-row {
  grid-template-columns: 1.5fr 1fr repeat(3, 1fr);
  min-height: 30px;
}

.xingchenyun-subtable-row {
  border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

@media (max-width: 720px) {
  .xingchenyun-record {
    padding: 10px;
  }

  .xingchenyun-subtable {
    overflow-x: auto;
  }

  .xingchenyun-subtable-head,
  .xingchenyun-subtable-row {
    min-width: 560px;
  }
}

.receivable-head-main {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.receivable-head-copy {
  display: grid;
  gap: 2px;
}

.receivable-head-copy h2 {
  margin: 0;
}

.receivable-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 10px 12px;
  margin: 0 0 14px;
}

.receivable-import-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: -2px 0 12px;
}

.receivable-file-label {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.receivable-file-label input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.receivable-finance-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0 1px;
}

.receivable-finance-head > div {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.receivable-finance-head strong {
  font-size: 15px;
  line-height: 1.25;
}

.receivable-finance-head span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.receivable-finance-reset {
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
}

.receivable-finance-reset.active {
  border-color: rgba(15, 118, 110, 0.35);
  color: var(--primary-dark);
  background: rgba(240, 253, 250, 0.76);
}

.receivable-finance-card {
  display: grid;
  gap: 9px;
  min-width: 0;
  padding: 14px 15px 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.receivable-finance-card:hover,
.receivable-finance-card.active {
  border-color: rgba(15, 118, 110, 0.45);
  background: rgba(240, 253, 250, 0.54);
}

.receivable-finance-card-head,
.receivable-finance-breakdown,
.receivable-finance-progress,
.receivable-finance-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.receivable-finance-card-head strong {
  color: var(--primary-dark);
  font-size: 13px;
  line-height: 1.2;
}

.receivable-finance-card-head span,
.receivable-finance-main small,
.receivable-finance-breakdown,
.receivable-finance-progress em,
.receivable-finance-risk {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.receivable-finance-main {
  justify-content: flex-start;
  gap: 7px;
}

.receivable-finance-main strong {
  color: var(--ink);
  font-size: 25px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.receivable-finance-main em {
  color: var(--primary-dark);
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}

.receivable-finance-breakdown {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.receivable-finance-breakdown strong {
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.receivable-finance-progress {
  align-items: center;
}

.receivable-finance-progress > span {
  flex: 1 1 auto;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5ebe8;
}

.receivable-finance-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.receivable-finance-progress em {
  flex: 0 0 auto;
  font-style: normal;
}

.receivable-finance-risk {
  color: var(--danger);
}

.receivable-tabs {
  display: inline-flex;
  gap: 8px;
  margin: 0;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(235, 243, 239, 0.82);
  width: auto;
  max-width: 100%;
}

.receivable-tab {
  flex: 0 0 auto;
  min-width: 148px;
  display: grid;
  gap: 2px;
  padding: 7px 12px;
  border: 0;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: 160ms ease;
}

.receivable-tab strong {
  color: inherit;
  font-size: 13px;
  line-height: 1.22;
}

.receivable-tab span {
  font-size: 11px;
  line-height: 1.25;
}

.receivable-tab:hover {
  color: var(--primary-dark);
}

.receivable-tab.active {
  color: var(--primary-dark);
  background: #fff;
  box-shadow: 0 5px 14px rgba(20, 32, 28, 0.08);
}

.receivable-tab-panel {
  min-width: 0;
}

.receivable-tab-panel.hidden {
  display: none;
}

.receivable-dashboard-shell {
  display: grid;
  gap: 12px;
  margin-top: 0;
}

.receivable-dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  padding: 2px 0 10px;
  border-bottom: 1px solid var(--line);
}

.receivable-dashboard-eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

.receivable-dashboard-header h3 {
  margin: 0;
  font-size: 19px;
  line-height: 1.2;
}

.receivable-dashboard-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.receivable-dashboard-scope-field {
  width: 204px;
  flex: 0 0 204px;
  gap: 4px;
}

.receivable-dashboard-scope-field > span,
.receivable-dashboard-scope-note > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.receivable-dashboard-scope-field select {
  min-height: 34px;
  padding: 6px 9px;
  border-radius: 6px;
  font-size: 12px;
}

.receivable-dashboard-scope-note {
  display: grid;
  gap: 3px;
  min-width: 164px;
  padding: 7px 10px;
  border-left: 3px solid var(--primary);
  background: var(--panel-soft);
}

.receivable-dashboard-scope-note strong {
  font-size: 13px;
}

.receivable-risk-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}

.receivable-risk-metric {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 11px 13px;
  border-right: 1px solid var(--line);
}

.receivable-risk-metric:last-child {
  border-right: 0;
}

.receivable-risk-metric span,
.receivable-risk-metric small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.receivable-risk-metric strong {
  font-size: 21px;
  line-height: 1.1;
  color: var(--primary-dark);
}

.receivable-risk-metric-danger strong { color: var(--danger); }
.receivable-risk-metric-warning strong { color: #b45309; }
.receivable-risk-metric-settled strong { color: var(--success); }

.receivable-dashboard-panel {
  display: grid;
  gap: 9px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.receivable-dashboard-panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.receivable-dashboard-panel-head > div {
  display: grid;
  gap: 3px;
}

.receivable-dashboard-panel-head strong {
  font-size: 14px;
  line-height: 1.25;
}

.receivable-dashboard-panel-head span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
  text-align: right;
}

.receivable-dashboard-panel-head > div > span {
  text-align: left;
}

.receivable-dashboard-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(330px, 1fr);
  align-items: start;
  gap: 12px;
}

.receivable-dashboard-workspace-wide {
  grid-template-columns: 1fr;
}

.receivable-owner-board {
  display: grid;
  gap: 6px;
}

.receivable-owner-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(126px, 1fr) 76px;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.receivable-owner-row:hover {
  border-color: rgba(15, 118, 110, 0.48);
  background: rgba(240, 253, 250, 0.6);
}

.receivable-owner-name,
.receivable-owner-money {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.receivable-owner-name strong,
.receivable-owner-money strong {
  overflow: hidden;
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.receivable-owner-name small,
.receivable-owner-money small,
.receivable-owner-risk {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
}

.receivable-owner-money strong { color: var(--primary-dark); }
.receivable-owner-risk { color: var(--danger); text-align: right; }

.receivable-focus-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.receivable-focus-item {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
}

.receivable-focus-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.receivable-focus-title strong {
  overflow: hidden;
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.receivable-focus-title .status-pill {
  flex: 0 0 auto;
  min-height: 20px;
  padding: 3px 6px;
  font-size: 10px;
}

.receivable-focus-amount {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 7px;
}

.receivable-focus-amount span,
.receivable-focus-amount small,
.receivable-focus-meta,
.receivable-priority-line {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.32;
}

.receivable-focus-amount strong {
  color: var(--primary-dark);
  font-size: 14px;
}

.receivable-focus-meta {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 8px;
}

.receivable-priority-panel,
.receivable-priority-panel-full {
  grid-column: auto;
}

.receivable-priority-table {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.receivable-priority-table-head,
.receivable-priority-table-row {
  display: grid;
  grid-template-columns: minmax(170px, 1.55fr) minmax(72px, 0.7fr) 86px minmax(112px, 0.85fr);
  gap: 10px;
  align-items: center;
}

.receivable-priority-table-head {
  padding: 7px 9px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.25;
}

.receivable-priority-table-row {
  min-width: 0;
  padding: 8px 9px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  line-height: 1.3;
}

.receivable-priority-table-row > span {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.receivable-priority-table-primary {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.receivable-priority-table-primary .link-button {
  justify-self: start;
  font-size: 12px;
  line-height: 1.25;
}

.receivable-priority-table-primary span {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.receivable-priority-table-row > strong {
  color: var(--primary-dark);
  font-size: 12px;
  line-height: 1.25;
  text-align: right;
  white-space: nowrap;
}

.receivable-priority-date.overdue {
  color: var(--danger);
  font-weight: 700;
}

.receivable-summary-card-scope {
  background: var(--panel-soft);
}

.receivable-summary-card .receivable-summary-detail {
  color: var(--muted);
  font-size: 11px;
}

.receivable-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px 12px;
  margin-bottom: 12px;
  padding: 10px 14px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: none;
}

.receivable-toolbar-main {
  display: flex;
  flex: 1 1 100%;
  gap: 12px;
  align-items: end;
  min-width: 0;
  padding-bottom: 2px;
  border-bottom: 1px solid rgba(15, 118, 110, 0.08);
}

.receivable-toolbar-filters {
  display: flex;
  flex: 1 1 100%;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
  min-width: 0;
}

.receivable-search-field {
  min-width: 0;
  flex: 1 1 560px;
}

.receivable-search-field input {
  min-height: 38px;
  padding-inline: 12px;
}

.receivable-view-field {
  flex: 0 0 210px;
  min-width: 210px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.receivable-view-toggle {
  width: 100%;
}

.receivable-toolbar .field {
  gap: 4px;
}

.receivable-toolbar-filters .field.compact {
  flex: 1 1 190px;
  min-width: 180px;
}

.receivable-toolbar .field > span {
  white-space: nowrap;
  font-size: 11px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.receivable-toolbar select,
.receivable-toolbar input {
  min-height: 38px;
  border-radius: 12px;
  padding: 8px 11px;
}

.receivable-list-block .section-title {
  padding: 14px 16px;
}

.receivable-list-block {
  margin-top: 10px;
}

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

.receivable-table-wrap table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.receivable-table-wrap th,
.receivable-table-wrap td {
  padding: 6px;
  vertical-align: top;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* PI and customer rows have different density needs, so their columns size independently. */
.receivable-table-pi-view th:nth-child(1) { width: 17%; }
.receivable-table-pi-view th:nth-child(2) { width: 20%; }
.receivable-table-pi-view th:nth-child(3) { width: 17%; }
.receivable-table-pi-view th:nth-child(4) { width: 16%; }
.receivable-table-pi-view th:nth-child(5) { width: 8%; }
.receivable-table-pi-view th:nth-child(6) { width: 22%; }

.receivable-table-customer-view th:nth-child(1) { width: 21%; }
.receivable-table-customer-view th:nth-child(2) { width: 13%; }
.receivable-table-customer-view th:nth-child(3) { width: 22%; }
.receivable-table-customer-view th:nth-child(4) { width: 19%; }
.receivable-table-customer-view th:nth-child(5) { width: 8%; }
.receivable-table-customer-view th:nth-child(6) { width: 17%; }

.receivable-cell-stack {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.receivable-id-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}

.receivable-inline-chip {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.08);
  color: var(--primary-dark);
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}

.receivable-cell-stack strong {
  font-size: 12px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.receivable-cell-stack span,
.table-subtext {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.receivable-amount-stack {
  display: grid;
  gap: 2px;
}

.receivable-amount-stack strong {
  font-size: 12px;
  line-height: 1.25;
}

.receivable-amount-stack span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
}

.receivable-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.receivable-expand-inline-btn {
  border-color: rgba(15, 118, 110, 0.18);
  color: var(--primary-dark);
  background: rgba(15, 118, 110, 0.06);
}

.receivable-expand-inline-btn.expanded {
  background: rgba(15, 118, 110, 0.12);
}

.receivable-row-actions .btn {
  min-height: 26px;
  padding: 3px 6px;
  border-radius: 8px;
  font-size: 10px;
}

.receivable-table-wrap .status-pill {
  min-height: 22px;
  padding: 3px 6px;
  font-size: 10px;
  line-height: 1.2;
}

.receivable-delete-btn {
  color: var(--danger) !important;
  border-color: #fecdd3 !important;
  background: #fff8f8 !important;
}

.receivable-delete-btn:hover:not(:disabled) {
  background: #fff1f2 !important;
  border-color: #fda4af !important;
}

.receivable-customer-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.receivable-customer-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.receivable-customer-panel-head strong {
  font-size: 13px;
}

.receivable-customer-panel-head span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.receivable-customer-pi-list {
  display: grid;
  gap: 8px;
}

.receivable-customer-pi-item {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
}

.receivable-customer-pi-main,
.receivable-customer-pi-money,
.receivable-customer-pi-side {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.receivable-customer-pi-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.receivable-customer-pi-main button {
  justify-self: start;
}

.receivable-customer-pi-main span,
.receivable-customer-pi-money span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.receivable-customer-pi-money strong {
  font-size: 13px;
  line-height: 1.28;
}

.receivable-customer-pi-side {
  justify-items: end;
}

.receivable-customer-pi-side .receivable-row-actions {
  justify-content: flex-end;
}

.receivable-customer-pi-side-total {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  white-space: nowrap;
}

.receivable-customer-pi-receipts {
  grid-column: 1 / -1;
}

.receivable-customer-pi-empty {
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  font-size: 12px;
  background: rgba(247, 250, 248, 0.8);
}

.receivable-customer-card {
  gap: 12px;
}

.xingchenyun-data-list .receivable-table-wrap {
  margin-top: 0;
}

.xingchenyun-data-list .receivable-table-wrap table {
  min-width: 900px;
}

.xingchenyun-data-list .receivable-table-pi-view th:nth-child(1) { width: 17%; }
.xingchenyun-data-list .receivable-table-pi-view th:nth-child(2) { width: 20%; }
.xingchenyun-data-list .receivable-table-pi-view th:nth-child(3) { width: 22%; }
.xingchenyun-data-list .receivable-table-pi-view th:nth-child(4) { width: 14%; }
.xingchenyun-data-list .receivable-table-pi-view th:nth-child(5) { width: 10%; }
.xingchenyun-data-list .receivable-table-pi-view th:nth-child(6) { width: 17%; }

.xingchenyun-data-list .receivable-table-customer-view th:nth-child(1) { width: 21%; }
.xingchenyun-data-list .receivable-table-customer-view th:nth-child(2) { width: 13%; }
.xingchenyun-data-list .receivable-table-customer-view th:nth-child(3) { width: 22%; }
.xingchenyun-data-list .receivable-table-customer-view th:nth-child(4) { width: 19%; }
.xingchenyun-data-list .receivable-table-customer-view th:nth-child(5) { width: 8%; }
.xingchenyun-data-list .receivable-table-customer-view th:nth-child(6) { width: 17%; }

.xingchenyun-data-list .receivable-expand-row.collapsed {
  display: none;
}

.receivable-expand-row td {
  padding-top: 0;
  border-bottom: 0;
}

.receivable-expand-row.collapsed {
  display: none;
}

.receivable-expand-panel {
  margin-top: 6px;
  border: 1px solid rgba(15, 118, 110, 0.12);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(244, 250, 248, 0.96), rgba(255, 255, 255, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  overflow: hidden;
}

.receivable-expand-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.receivable-expand-toggle:hover {
  background: rgba(15, 118, 110, 0.04);
}

.receivable-expand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: var(--primary-dark);
  transition: transform 160ms ease;
}

.receivable-expand-toggle.expanded .receivable-expand-icon {
  transform: rotate(180deg);
}

.receivable-expand-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-dark);
}

.receivable-expand-summary {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.receivable-expand-head {
  display: grid;
  grid-template-columns: 112px repeat(3, minmax(108px, 1fr)) minmax(116px, 1fr) minmax(0, 1.35fr);
  gap: 12px;
  padding: 0 12px 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.receivable-expand-list {
  display: grid;
  gap: 6px;
  padding: 0 12px 12px;
}

.receivable-expand-item {
  display: grid;
  grid-template-columns: 112px repeat(3, minmax(108px, 1fr)) minmax(116px, 1fr) minmax(0, 1.35fr);
  gap: 12px;
  align-items: start;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
}

.receivable-expand-cell {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.receivable-expand-cell strong {
  font-size: 13px;
  line-height: 1.3;
}

.receivable-expand-key {
  display: none;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.receivable-expand-date strong {
  color: var(--ink);
}

.receivable-expand-note {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  word-break: break-word;
}

.receivable-card {
  gap: 10px;
}

.receivable-meta {
  gap: 6px;
}

.receivable-mobile-lines {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.receivable-mobile-lines div {
  display: grid;
  gap: 2px;
}

.receivable-mobile-lines span {
  color: var(--muted);
  font-size: 11px;
}

.receivable-mobile-lines strong {
  font-size: 13px;
  line-height: 1.35;
}

.receivable-pagination-inner {
  align-items: center;
  gap: 10px;
}

.receivable-modal-panel {
  width: min(1180px, calc(100vw - 22px));
  max-width: 1180px;
  padding: 12px;
  gap: 8px;
}

.receivable-modal-body {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 144px);
  overflow: auto;
  padding-right: 2px;
}

.receivable-modal-body .inline-note {
  min-height: 34px;
  padding: 7px 10px;
}

.admin-form-grid.receivable-form-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px 8px;
}

.receivable-form-grid .field {
  gap: 2px;
  font-size: 11px;
}

.receivable-form-grid input,
.receivable-form-grid select,
.receivable-form-grid textarea {
  min-height: 34px;
  padding: 6px 8px;
  border-radius: 10px;
  font-size: 12px;
}

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

.receivable-notes-field textarea {
  min-height: 48px;
  padding: 6px 8px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.4;
}

.receivable-milestone-head,
.receivable-receipt-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.receivable-milestone-head strong,
.receivable-receipt-head strong {
  font-size: 14px;
}

.receivable-milestone-head span,
.receivable-receipt-head span {
  color: var(--muted);
  font-size: 11px;
  margin-left: 8px;
}

.receivable-milestone-list {
  display: grid;
  gap: 5px;
}

.receivable-milestone-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 6px 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(247, 250, 248, 0.96);
  transition: 160ms ease;
}

.receivable-milestone-row:hover {
  border-color: rgba(15, 118, 110, 0.36);
  background: #fff;
}

.receivable-milestone-row.is-dragging {
  opacity: 0.45;
  border-style: dashed;
}

.receivable-milestone-drag {
  display: grid;
  place-items: center;
  min-height: 28px;
  color: var(--primary);
  font-size: 16px;
  letter-spacing: -5px;
  cursor: grab;
  user-select: none;
}

.receivable-milestone-drag:active {
  cursor: grabbing;
}

.receivable-milestone-grid {
  display: grid;
  grid-template-columns: minmax(150px, 1.3fr) minmax(116px, 0.78fr) minmax(104px, 0.7fr) minmax(150px, 1.1fr);
  gap: 6px;
  align-items: end;
}

.receivable-milestone-grid .field {
  gap: 2px;
  font-size: 11px;
}

.receivable-milestone-grid input {
  min-height: 32px;
  padding: 5px 7px;
  border-radius: 9px;
  font-size: 12px;
}

.receivable-milestone-wide,
.receivable-milestone-notes {
  min-width: 0;
}

.receivable-milestone-actions {
  align-self: end;
}

.receivable-milestone-actions .btn,
.receivable-receipt-actions .btn {
  min-height: 28px;
  padding: 4px 7px;
  border-radius: 9px;
  font-size: 11px;
}

.receivable-receipt-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.receivable-receipt-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(247, 250, 248, 0.82);
}

.receivable-receipt-topline {
  display: grid;
  gap: 2px;
  white-space: nowrap;
}

.receivable-receipt-topline strong,
.receivable-receipt-topline span {
  font-size: 12px;
}

.receivable-receipt-line {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.receivable-receipt-actions {
  display: flex;
  gap: 4px;
}

.receivable-receipt-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 10px;
}

.receivable-receipt-live-summary {
  display: grid;
  grid-template-columns: minmax(146px, auto) minmax(0, 1fr);
  gap: 8px 14px;
  align-items: center;
  padding: 10px 12px;
  border-left: 3px solid var(--primary);
  background: var(--panel-soft);
}

.receivable-receipt-live-total {
  display: grid;
  gap: 2px;
}

.receivable-receipt-live-total span,
.receivable-receipt-live-metrics span,
.receivable-receipt-live-summary p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.receivable-receipt-live-total strong {
  color: var(--primary-dark);
  font-size: 18px;
  line-height: 1.15;
}

.receivable-receipt-live-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 11px;
}

.receivable-receipt-live-metrics strong {
  color: var(--ink);
  font-weight: 700;
}

.receivable-receipt-live-summary p {
  grid-column: 1 / -1;
  margin: 0;
}

.receivable-receipt-live-summary.has-excess {
  border-left-color: var(--danger);
  background: #fff7f7;
}

.receivable-receipt-live-summary.has-excess .receivable-receipt-live-total strong,
.receivable-receipt-live-summary.has-excess p {
  color: var(--danger);
}

@media (max-width: 1200px) {
  .admin-form-grid.receivable-form-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .receivable-dashboard-header {
    flex-direction: column;
    align-items: stretch;
  }

  .receivable-dashboard-scope-field {
    width: min(280px, 100%);
    flex-basis: auto;
  }

  .receivable-dashboard-scope-note {
    width: min(280px, 100%);
  }

  .receivable-dashboard-workspace {
    width: 100%;
    grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  }
}

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

  .receivable-page-head {
    align-items: stretch;
  }

  .receivable-import-bar {
    align-items: stretch;
  }

  .receivable-toolbar-main,
  .receivable-toolbar-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .receivable-search-field,
  .receivable-view-field,
  .receivable-toolbar-filters .field.compact {
    flex: 1 1 auto;
    min-width: 0;
  }

  .receivable-milestone-grid {
    grid-template-columns: minmax(150px, 1.2fr) repeat(2, minmax(110px, 0.8fr));
  }

  .receivable-milestone-grid .receivable-milestone-notes {
    grid-column: 1 / -1;
  }

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

  .receivable-dashboard-workspace {
    grid-template-columns: 1fr;
  }

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

  .receivable-customer-pi-item {
    grid-template-columns: minmax(0, 1fr);
  }

  .receivable-customer-pi-side {
    justify-items: start;
  }

  .receivable-customer-pi-side .receivable-row-actions {
    justify-content: flex-start;
  }

  .receivable-customer-pi-side-total {
    white-space: normal;
  }
}

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

  .receivable-finance-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .receivable-finance-main strong {
    font-size: 22px;
  }

  .receivable-tabs {
    width: 100%;
  }

  .receivable-tab {
    flex: 1 1 0;
    min-width: 0;
    padding: 8px 10px;
  }

  .receivable-modal-panel {
    width: min(100vw, calc(100vw - 8px));
    max-width: 100vw;
    padding: 10px;
  }

  .receivable-modal-body {
    max-height: calc(100vh - 128px);
    gap: 7px;
  }

  .receivable-head-main {
    width: 100%;
  }

  .receivable-tabs {
    width: 100%;
  }

  .receivable-tab {
    flex: 1 1 0;
  }

  .receivable-toolbar {
    padding: 10px;
  }

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

  .receivable-risk-metric:nth-child(2) {
    border-right: 0;
  }

  .receivable-risk-metric:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .receivable-focus-list {
    grid-template-columns: 1fr;
  }

  .receivable-dashboard-panel-head,
  .receivable-focus-meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .receivable-dashboard-panel-head > span {
    text-align: left;
  }

  .receivable-priority-table-head {
    display: none;
  }

  .receivable-priority-table-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 10px;
  }

  .receivable-priority-table-primary {
    grid-column: 1 / -1;
  }

  .receivable-priority-table-row > strong {
    grid-column: 2;
    grid-row: 2;
  }

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

  .receivable-receipt-form-grid,
  .receivable-receipt-list,
  .receivable-mobile-lines,
  .receivable-focus-list { grid-template-columns: 1fr; }

  .receivable-receipt-live-summary {
    grid-template-columns: 1fr;
  }

  .receivable-milestone-grid {
    grid-template-columns: minmax(0, 1fr) minmax(110px, 0.9fr);
  }

  .receivable-milestone-grid .receivable-milestone-wide,
  .receivable-milestone-grid .receivable-milestone-notes {
    grid-column: 1 / -1;
  }

  .receivable-table-wrap thead {
    display: none;
  }

  .receivable-table-wrap tbody {
    display: grid;
    gap: 8px;
  }

  .receivable-table-wrap tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(247, 250, 248, 0.92);
  }

  .receivable-table-wrap td {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 6px;
    padding: 0;
    border-bottom: 0;
    align-items: start;
  }

  .receivable-table-wrap td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    line-height: 1.3;
  }

  .receivable-table-wrap td:last-child,
  .receivable-table-wrap td[colspan] {
    grid-column: 1 / -1;
  }

  .receivable-table-wrap td[colspan] {
    display: block;
    padding: 0;
  }

  .receivable-table-wrap td[colspan]::before {
    content: none;
  }

  .receivable-milestone-row {
    grid-template-columns: 18px minmax(0, 1fr);
  }

  .receivable-milestone-actions {
    grid-column: 2;
    justify-content: flex-start;
  }

  .receivable-receipt-item {
    grid-template-columns: auto 1fr;
  }

  .receivable-receipt-actions {
    grid-column: 1 / -1;
  }

  .receivable-row-actions {
    justify-content: flex-start;
  }

  .receivable-expand-panel {
    margin-top: 8px;
  }

  .receivable-expand-head {
    display: none;
  }

  .receivable-expand-list {
    gap: 8px;
  }

  .receivable-expand-item,
  .receivable-expand-grid,
  .receivable-expand-metrics {
    grid-template-columns: 1fr;
  }

  .receivable-expand-key {
    display: block;
  }

  .receivable-expand-summary {
    margin-left: 0;
  }

  .receivable-expand-toggle {
    align-items: flex-start;
    flex-direction: column;
  }

  .receivable-milestone-head,
  .receivable-receipt-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .receivable-customer-panel-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 520px) {
  .admin-form-grid.receivable-form-grid,
  .receivable-milestone-grid {
    grid-template-columns: 1fr;
  }

  .receivable-table-wrap tr {
    grid-template-columns: 1fr;
  }
}
