/* Facility owner Payments (payments.js), from Daniel's Payment UI mockup 2026-10-21. KPI tiles use the shared .cp-kpi sizes from
   facility-ui.css; the line chart reuses the dashboard's .fx-chart styles (app.css); the rest builds on ui-kit.css. */
.pm { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; color: #0b0f17; font-size: 14px; }   /* one shrinkable column: without it the grid sized itself to its widest card and ran off the right edge */
.cw-main .pm.fill { gap: 0; }   /* the header's own margin (facility-ui.css) is the gap to the KPI row; the grid/flex gap would add to it */
.pm-range {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--ctl-h, 40px);
  padding: 0 8px 0 12px;
  border: 1px solid #d9dde3;
  border-radius: var(--ctl-r, 10px);
  background: #fff;
}
.pm-range .ic { width: 16px; height: 16px; color: #6b7280; }
.pm-range select { border: 0; background: none; font: inherit; font-size: 14px; color: #0b0f17; padding: 0 4px; min-height: 36px; }
.pm-link:focus-visible,
.pm-pb:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }
.pm-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
.pm-kpis small.up { color: #15803d; }
.pm-kpis small.down { color: #dc2626; }
.pm-kpis .cp-kpi-ic.red { background: #fee2e2; color: #dc2626; }
.pm-card { padding: 16px 18px; min-width: 0; }
.pm-card h2 { font-size: 17px; }
.pm-ch { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px; margin-bottom: 10px; }
.pm-ctl { display: flex; gap: 8px; }
.pm-ctl select,
.pm-filters select,
.pm-pn select { min-height: 36px; border: 1px solid #d9dde3; border-radius: 8px; background: #fff; font: inherit; font-size: 13.5px; padding: 0 8px; }
.pm-mid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 14px; align-items: stretch; }
.pm-trend { width: 100%; height: auto; }
.pm-bd { display: flex; align-items: center; gap: 22px; margin-top: 12px; flex-wrap: wrap; }
.pm-dn { --dn: 150px; position: relative; width: var(--dn); flex-shrink: 0; }   /* --dn sizes the ring and its centre text together */
.pm-donut { width: var(--dn); height: var(--dn); display: block; }
.pm-dn-c { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.pm-dn-c { padding: 0 calc(var(--dn) * .16); }   /* stay inside the hole (it is 69% of the ring box) */
.pm-dn-c b { font-size: calc(var(--dn) * .135); line-height: 1.1; white-space: nowrap; }
.pm-dn-c span { font-size: max(9px, calc(var(--dn) * .078)); color: #6b7280; white-space: nowrap; line-height: 1.2; }
.pm-lg { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; flex: 1; min-width: 190px; }
.pm-lg li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 40px; gap: 8px; align-items: center; font-size: 13.5px; }
.pm-lg i { width: 12px; height: 12px; border-radius: 3px; }
.pm-lg em { font-style: normal; color: #6b7280; text-align: right; }
.pm-filters { display: grid; grid-template-columns: minmax(200px, 1.8fr) repeat(3, minmax(120px, 1fr)); gap: 10px; margin-bottom: 12px; }
.pm-search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid #d9dde3;
  border-radius: 10px;
  background: #fff;
  color: #6b7280;
}
.pm-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: inherit; color: #0b0f17; }
.pm-search:focus-within { outline: 2px solid #93c5fd; outline-offset: 1px; border-color: #2563eb; }
.pm-search .ic { width: 16px; height: 16px; }
.pm-tw { overflow-x: auto; position: relative; }   /* relative: the hidden .sr header label is absolute (ui-kit) and otherwise escapes the scroll box and widens the page */
.pm-tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.pm-tbl th {
  padding: 8px 10px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  border-bottom: 1px solid var(--line, #e8eaee);
  white-space: nowrap;
}
.pm-tbl td { padding: 9px 10px; border-bottom: 1px solid #f1f2f4; vertical-align: middle; white-space: nowrap; }
.pm-tbl td.muted,
.muted { color: #6b7280; }
.pm-tbl td.neg { color: #b91c1c; }
.pm-empty { padding: 28px 10px !important; text-align: center; color: #6b7280; }
.pm-who { display: inline-flex; align-items: center; gap: 10px; }
.pm-who b { display: block; font-weight: 600; }
.pm-who small { display: block; font-size: 12px; color: #6b7280; }
.pm-chip { display: inline-block; padding: 2px 9px; border-radius: 6px; font-size: 12.5px; font-weight: 600; }
.pm-chip.t-payment,
.pm-chip.s-paid { background: #dcfce7; color: #15803d; }
.pm-chip.t-invoice { background: #dbeafe; color: #1d4ed8; }
.pm-chip.t-refund,
.pm-chip.s-pending { background: #fef3c7; color: #b45309; }
.pm-chip.s-pastdue,
.pm-chip.s-failed { background: #fee2e2; color: #b91c1c; }
.pm-chip.s-refunded { background: #f3f4f6; color: #4b5563; }
.pm-link { border: 0; background: none; padding: 0; color: #2563eb; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.pm-pg { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; }
.pm-pn { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pm-pb { min-width: 34px; height: 34px; border: 1px solid #d9dde3; border-radius: 8px; background: #fff; font: inherit; font-size: 13.5px; cursor: pointer; }
.pm-pb.on { background: #eff6ff; border-color: #2563eb; color: #1d4ed8; font-weight: 600; }
.pm-pb:disabled { opacity: .4; cursor: not-allowed; }
.pm-pn label { margin-left: 10px; display: inline-flex; align-items: center; gap: 6px; }
.pm-none { text-align: center; padding: 48px 20px; }
.pm-none-ic { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: #eff6ff; color: #2563eb; margin-bottom: 10px; }
.pm-none-ic .ic { width: 24px; height: 24px; }
.pm-inv { display: grid; gap: 2px; margin: 8px 0 4px; }
@media (max-width: 1300px) {
  .pm-mid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1200px) {
  .pm-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .pm-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .pm-filters { grid-template-columns: minmax(0, 1fr) !important; }
}
@media (max-width: 480px) { .pm-kpis { grid-template-columns: minmax(0, 1fr) !important; } }

/* A range too big to load completely, and the custom date range in the header */
.pm-note { margin: 0 0 14px; padding: 12px 14px; border: 1px solid #fcd34d; background: #fffbeb; border-radius: 10px; font-size: 14px; color: #92400e; }
/* Invoices (0080): list chips, the New invoice line editor and the detail actions */
.pm-chip.s-draft,
.pm-chip.s-canceled { background: #f3f4f6; color: #4b5563; }
.pm-chip.s-sent { background: #dbeafe; color: #1d4ed8; }
.pm-ivf { grid-template-columns: minmax(200px, 2fr) minmax(140px, 1fr); }
.pm-ivl { display: grid; gap: 8px; margin: 16px 0 8px; }
.pm-ivh,
.pm-ivr { display: grid; grid-template-columns: minmax(0, 1fr) 70px 110px 34px; gap: 8px; align-items: center; }
.pm-ivh { font-size: 12.5px; font-weight: 600; color: #6b7280; }
.pm-ivr input { min-height: 36px; min-width: 0; padding: 0 8px; border: 1px solid #d9dde3; border-radius: 8px; font: inherit; font-size: 14px; }
.pm-ivt { display: flex; justify-content: space-between; margin: 12px 0 0; padding-top: 10px; border-top: 1px solid #e8eaee; font-size: 15px; }
.pm-ivx { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.pm-ivlines { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13.5px; }
.pm-ivlines td { padding: 5px 0; border-top: 1px solid #f0f1f3; }
.pm-ivlines td:last-child { text-align: right; }
.pm-iverr { margin: 10px 0 0; color: #b91c1c; font-size: 13.5px; }
@media (max-width: 480px) { .pm-ivh, .pm-ivr { grid-template-columns: minmax(0, 1fr) 56px 90px 34px; } .pm-ivf { grid-template-columns: minmax(0, 1fr); } }
.pm-custom { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: #6b7280; }
.pm-custom[hidden] { display: none; }
.pm-custom input { min-height: 36px; padding: 0 8px; border: 1px solid #d9dde3; border-radius: 8px; background: #fff; font: inherit; font-size: 14px; color: #0b0f17; }

/* Desktop app-style fit: the overview's chart row shares the leftover height with Recent Transactions; each scrolls inside its own card */
@media (min-width: 1100px) {
  .pm-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
  .pm-mid { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
  .pm-kpis .cp-kpi { height: 64px; }
  .pm-mid { flex: 1.6 1 0 !important; min-height: 235px; }
  .pm-mid .pm-card { display: flex; flex-direction: column; min-height: 0; padding: 12px 16px; }
  .pm-mid .pm-ch { margin-bottom: 4px; flex-wrap: nowrap; flex: none; }
  .pm-mid .pm-ch .st-sub { margin: 2px 0 0; }
  .pm-trendw { flex: 1 1 0; min-height: 110px; position: relative; }
  .pm-trendw .pm-trend { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
  .pm-mid .pm-bd { margin-top: 6px; flex: 1; min-height: 0; flex-wrap: nowrap; gap: 18px; }
  .pm-mid .pm-dn { --dn: clamp(108px, 18vh, 144px); }
  .pm-mid .pm-lg li span:nth-child(2) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pm-mid .pm-lg { gap: 5px; min-width: 0; }
  .pm-mid .pm-lg li { font-size: 13px; grid-template-columns: 10px minmax(0, 1fr) auto 32px; gap: 6px; font-size: 12.5px; }
  .pm-card.pm-none { flex: none; }
}
