/* Payments Received — layout + action-row overlay. Does not change React data. */
body.ams-pay-page .ams-pay-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100050;
  max-width: min(420px, calc(100vw - 24px));
  padding: 12px 16px;
  border-radius: 10px;
  font: 650 13px/1.45 Inter, Manrope, "Segoe UI", sans-serif;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
  color: #fff;
  background: #161C34;
}
body.ams-pay-page .ams-pay-toast.err { background: #AE2129; }

body.ams-pay-page th.ams-row-delete-head,
body.ams-pay-page thead th[class*="ams-row-delete"] { display: none !important; }

body.ams-pay-page .overflow-x-auto {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
body.ams-pay-page table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}
body.ams-pay-page thead th {
  white-space: nowrap;
  vertical-align: bottom;
  text-align: left;
  padding: 10px 12px 10px 0;
}
body.ams-pay-page tbody td {
  vertical-align: middle;
  padding: 12px 12px 12px 0;
  overflow-wrap: anywhere;
}
body.ams-pay-page tbody td:nth-child(2) {
  min-width: 148px;
  white-space: normal;
  word-break: normal;
}
body.ams-pay-page tbody td.font-mono,
body.ams-pay-page tbody td:nth-child(1),
body.ams-pay-page tbody td:nth-child(3),
body.ams-pay-page tbody td:nth-child(4) {
  white-space: nowrap;
}
body.ams-pay-page tbody td:last-child {
  white-space: nowrap;
  text-align: right;
  width: 1%;
  padding-right: 0;
}

.ams-pay-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  position: relative;
  max-width: 100%;
  vertical-align: middle;
}
.ams-pay-actions .ams-row-menu {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
}
.ams-pay-actions > button,
.ams-pay-actions .ams-row-menu > button,
.ams-pay-actions .ams-row-menu > a,
.ams-pay-actions .ams-row-actions,
.ams-pay-actions .ams-row-delete-wrap {
  display: inline-flex;
  align-items: center;
}
.ams-pay-actions button,
.ams-pay-actions .ams-row-btn,
.ams-pay-actions .ams-row-delete {
  height: 32px !important;
  min-height: 32px !important;
  padding: 0 10px !important;
  font-size: 12px !important;
  font-weight: 650 !important;
  line-height: 1 !important;
  border-radius: 8px !important;
  white-space: nowrap !important;
  margin: 0 !important;
  flex: 0 0 auto;
  box-sizing: border-box;
}
.ams-pay-actions button:disabled,
.ams-pay-actions .ams-pay-btn-disabled {
  opacity: 0.45;
  cursor: not-allowed !important;
}
.ams-pay-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font: 700 10px/1 Inter, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.ams-pay-badge-paid { background: #dcfce7; color: #166534; }
.ams-pay-badge-approved { background: #d1fae5; color: #065f46; }
.ams-pay-badge-pending { background: #fef3c7; color: #92400e; }
.ams-pay-badge-rejected { background: #fee2e2; color: #991b1b; }
.ams-pay-badge-draft { background: #f1f5f9; color: #475569; }
.ams-pay-badge-partial { background: #dbeafe; color: #1e40af; }
.ams-pay-badge-approval { background: #ede9fe; color: #5b21b6; }

.ams-pay-modal {
  position: fixed;
  inset: 0;
  z-index: 100040;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.ams-pay-modal .box {
  width: min(720px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: #fff;
  border-radius: 16px;
  border: 1px solid #dbe3ee;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
  padding: 20px 22px 16px;
  color: #0f172a;
  font-family: Inter, Manrope, "Segoe UI", sans-serif;
  display: flex;
  flex-direction: column;
}
.ams-pay-modal h2 {
  margin: 0 0 14px;
  font: 800 18px/1.3 Inter, Manrope, sans-serif;
  color: #161C34;
}
.ams-pay-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  margin-bottom: 14px;
}
.ams-pay-grid .wide { grid-column: 1 / -1; }
.ams-pay-field span {
  display: block;
  font: 700 10px/1 Inter, sans-serif;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 4px;
}
.ams-pay-field strong { font: 650 13px/1.4 Inter, sans-serif; color: #161C34; }
.ams-pay-empty {
  padding: 28px 16px;
  text-align: center;
  color: #64748b;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  font: 500 13px/1.5 Inter, sans-serif;
}
.ams-pay-viewer {
  min-height: 240px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  background: #f8fafc;
}
.ams-pay-viewer img,
.ams-pay-viewer iframe,
.ams-pay-viewer embed {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  max-height: 56vh;
  margin: 0 auto;
  border: 0;
  background: #fff;
  object-fit: contain;
}
.ams-pay-viewer iframe,
.ams-pay-viewer embed {
  width: 100%;
  min-height: 420px;
}
.ams-pay-modal .foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  position: sticky;
  bottom: 0;
  background: #fff;
  padding-top: 12px;
}
.ams-pay-filter-help {
  white-space: normal !important;
  max-width: 100%;
  overflow: visible !important;
  line-height: 1.45;
}
.ams-pay-date-label {
  display: block;
  font: 700 10px/1 Inter, sans-serif;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #64748b;
  margin: 0 0 4px;
}
.ams-pay-ccy-note {
  margin: 0 0 10px;
  color: #64748b;
  font: 600 12px/1.4 Inter, sans-serif;
}
.ams-pay-proof-current {
  margin: 0 0 8px;
  color: #64748b;
  font: 500 12px/1.4 Inter, sans-serif;
}
.ams-pay-modal input,
.ams-pay-modal select,
.ams-pay-modal textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font: 500 13px/1.4 Inter, sans-serif;
  box-sizing: border-box;
}
.ams-pay-modal .btn {
  appearance: none;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #161C34;
  border-radius: 8px;
  padding: 8px 13px;
  cursor: pointer;
  font: 750 12px/1 Inter, sans-serif;
  text-decoration: none;
}
.ams-pay-modal .btn.primary { background: #AF2127; border-color: #AF2127; color: #fff; }

@media (max-width: 900px) {
  .ams-pay-actions .ams-row-menu-toggle { display: inline-flex !important; }
  .ams-pay-actions .ams-row-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    z-index: 40;
    background: #fff;
    border: 1px solid #d9dde6;
    padding: 8px;
    min-width: 168px;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
  }
  .ams-pay-actions.is-open .ams-row-menu { display: flex; }
  .ams-pay-actions:not(.is-open) > :not(.ams-row-menu-toggle) { display: none !important; }
  .ams-pay-grid { grid-template-columns: 1fr; }
  body.ams-pay-page table { min-width: 980px; }
}
@media (min-width: 901px) {
  .ams-pay-actions .ams-row-menu-toggle { display: none !important; }
}
