/* ═══════════════════════════════════════════════════════════════════════════
   PropertyDesk — Contractor Payments   (pd-pay-*)
   Mirrors pd-sc-* (Recurring Schedules) / pd-vp-* (Vendor Directory) identity.
   ═══════════════════════════════════════════════════════════════════════════ */

.pd-pay-wrap { max-width: 100%; margin: 0 0 40px; font-family: inherit; }

/* ── Sub-header ───────────────────────────────────────────────────────────── */
.pd-pay-subhdr {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; flex-wrap: wrap; gap: 8px;
}
.pd-pay-subhdr__meta { font-size: 13px; color: #64748b; font-weight: 500; }
.pd-pay-subhdr__acts { display: flex; gap: 8px; align-items: center; }

.pd-pay-btn-secondary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 6px; font-size: 12px; font-weight: 500;
  text-decoration: none !important; white-space: nowrap;
  background: #fff; color: #374151 !important; border: 1px solid #d1d5db;
  cursor: pointer; transition: background .15s, border-color .15s;
}
.pd-pay-btn-secondary:hover { background: #f3f4f6; border-color: #9ca3af; }

/* ── KPI strip ────────────────────────────────────────────────────────────── */
.pd-pay-kpis {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  margin-bottom: 16px;
}
.pd-pay-kpi {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 8px;
  padding: 14px 16px; position: relative; overflow: hidden;
}
.pd-pay-kpi::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: #cbd5e1;
}
.pd-pay-kpi--good::before    { background: #2e8b57; }
.pd-pay-kpi--bad::before     { background: #dc2626; }
.pd-pay-kpi--warn::before    { background: #d97706; }
.pd-pay-kpi--info::before    { background: #0ea5e9; }
.pd-pay-kpi--neutral::before { background: #cbd5e1; }
.pd-pay-kpi__label { font-size: 11px; color: #6b7280; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.pd-pay-kpi__value { font-size: 26px; font-weight: 700; color: #111827; margin-top: 4px; font-variant-numeric: tabular-nums; }
.pd-pay-kpi__sub   { font-size: 12px; color: #6b7280; margin-top: 2px; }

/* ── Notes above the table ────────────────────────────────────────────────── */
.pd-pay-note {
  margin-bottom: 12px; padding: 10px 14px; border-radius: 6px;
  font-size: 12.5px; line-height: 1.55; border: 1px solid transparent;
}
.pd-pay-note--info { background: #f0f9ff; border-color: #bae6fd; color: #075985; }
.pd-pay-note--warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }

/* ── Filter bar ───────────────────────────────────────────────────────────── */
.pd-pay-filters {
  display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
  padding: 12px 14px; background: #f8fafc;
  border: 1px solid #e5e7eb; border-radius: 8px 8px 0 0; border-bottom: none;
}
.pd-pay-fg { display: flex; flex-direction: column; gap: 3px; }
.pd-pay-fg label { font-size: 11px; color: #6b7280; font-weight: 500; }
.pd-pay-finput {
  padding: 7px 10px; border: 1px solid #d1d5db; border-radius: 5px;
  font-size: 13px; background: #fff; color: #374151; min-width: 220px;
}
.pd-pay-finput:focus {
  outline: none; border-color: #2e8b57; box-shadow: 0 0 0 2px rgba(46,139,87,.12);
}
.pd-pay-apply-btn {
  padding: 7px 16px; background: #2e8b57; color: #fff;
  border: 1px solid #2e8b57; border-radius: 5px;
  font-size: 13px; font-weight: 500; cursor: pointer;
}
.pd-pay-apply-btn:hover { background: #267a4c; }
.pd-pay-reset-btn {
  padding: 7px 12px; color: #6b7280 !important; font-size: 12px;
  text-decoration: none !important;
}
.pd-pay-reset-btn:hover { color: #374151 !important; }

/* ── Shell ────────────────────────────────────────────────────────────────── */
.pd-pay-main {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 0 0 8px 8px;
  overflow: hidden;
}

/* ── By-contractor summary ────────────────────────────────────────────────── */
.pd-pay-vendors { padding: 14px 14px 4px; border-bottom: 1px solid #f1f5f9; }
.pd-pay-vendors__hd {
  font-size: 11px; color: #6b7280; text-transform: uppercase;
  letter-spacing: .04em; font-weight: 600; margin-bottom: 10px;
}
.pd-pay-vendors__grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px; margin-bottom: 12px;
}
.pd-pay-vendor {
  background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 6px;
  padding: 10px 12px;
}
.pd-pay-vendor__name {
  font-size: 12.5px; font-weight: 600; color: #374151;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pd-pay-vendor__amt {
  font-size: 17px; font-weight: 700; color: #92400e; margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.pd-pay-vendor__jobs { font-size: 11.5px; color: #6b7280; margin-top: 1px; }

/* ── Table ────────────────────────────────────────────────────────────────── */
.pd-pay-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.pd-pay-tbl thead th {
  background: #f8fafc; color: #374151; font-weight: 600; text-align: left;
  padding: 10px 12px; border-bottom: 1px solid #e5e7eb;
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
}
.pd-pay-tbl tbody tr:nth-child(odd)  { background: #fff; }
.pd-pay-tbl tbody tr:nth-child(even) { background: #f9fafb; }
.pd-pay-tbl tbody tr:hover           { background: #f1f5f9; }
.pd-pay-tbl tbody td {
  padding: 10px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle;
  color: #374151;
}
.pd-pay-tbl tfoot td {
  padding: 12px; background: #f8fafc; border-top: 1px solid #e5e7eb;
  font-weight: 700; color: #111827;
}
.pd-pay-total-lbl { text-align: right; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: #6b7280 !important; }
.pd-pay-total { font-size: 15px; font-variant-numeric: tabular-nums; }

.pd-pay-num { text-align: right; }
.pd-pay-amt { font-weight: 600; font-variant-numeric: tabular-nums; color: #92400e; }
.pd-pay-link { color: #2e8b57; text-decoration: none; }
.pd-pay-link:hover { text-decoration: underline; }
.pd-pay-link-strong { font-weight: 600; }
.pd-pay-muted { color: #94a3b8; }

/* Waiting-time cue */
.pd-pay-age { font-variant-numeric: tabular-nums; }
.pd-pay-age--soon { color: #b45309; font-weight: 600; }
.pd-pay-age--over { color: #b91c1c; font-weight: 600; }

/* Recorded as paid, still open in the books */
.pd-pay-row--stuck, .pd-pay-tbl tbody tr.pd-pay-row--stuck:nth-child(even) { background: #fffbeb; }
.pd-pay-tbl tbody tr.pd-pay-row--stuck:hover { background: #fef3c7; }
.pd-pay-flag {
  margin-top: 3px; font-size: 11px; color: #92400e; font-weight: 500;
}

/* ── Row action ───────────────────────────────────────────────────────────── */
.pd-pay-actions { display: flex; gap: 6px; align-items: center; }
.pd-pay-date {
  padding: 4px 8px; border: 1px solid #d1d5db; border-radius: 4px;
  font-size: 12px; background: #fff; color: #374151; width: 140px;
}
.pd-pay-date:focus {
  outline: none; border-color: #2e8b57; box-shadow: 0 0 0 2px rgba(46,139,87,.12);
}
.pd-pay-act {
  display: inline-block; padding: 5px 12px; border-radius: 4px;
  font-size: 11px; font-weight: 600; cursor: pointer; white-space: nowrap;
  background: #2e8b57; color: #fff; border: 1px solid #2e8b57;
}
.pd-pay-act:hover:not(:disabled) { background: #267a4c; border-color: #267a4c; }
.pd-pay-act:disabled { opacity: .6; cursor: default; }

/* ── Empty state ──────────────────────────────────────────────────────────── */
.pd-pay-empty { text-align: center; padding: 48px 24px; background: #fff; }
.pd-pay-empty__icon { font-size: 32px; margin-bottom: 8px; }
.pd-pay-empty__msg  { color: #6b7280; font-size: 14px; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .pd-pay-kpis { grid-template-columns: 1fr; }
  .pd-pay-main { overflow-x: auto; }
  .pd-pay-tbl { min-width: 760px; }
}

/* ── RTL ──────────────────────────────────────────────────────────────────── */
html[dir="rtl"] .pd-pay-kpi::before { left: auto; right: 0; }
html[dir="rtl"] .pd-pay-tbl thead th { text-align: right; }
html[dir="rtl"] .pd-pay-num { text-align: left; }
html[dir="rtl"] .pd-pay-total-lbl { text-align: left; }
