/* Paybill settlement. Uses the shared tokens and admin-ui.css components (.page-head, .kpi-grid, .data-toolbar,
   .table-card, .filters-collapsible); only what is specific to this screen lives here. */

.st-muted{ color: var(--ink-faint); }
.st-chip{ text-transform: none; }
.st-code{ font-weight: 400; font-size: 14px; color: var(--ink-muted); font-variant-numeric: tabular-nums; margin-left: 4px; }
.st-amt{ font-variant-numeric: tabular-nums; white-space: nowrap; }
.st-neg{ color: var(--ink-muted); }
.st-sub{ margin-top: 2px; font-size: 13px; line-height: 18px; color: var(--ink-muted); white-space: normal; max-width: 46ch; }
.st-msg{ white-space: normal; max-width: 60ch; overflow-wrap: anywhere; }
.st-wrapname{ white-space: normal; font-weight: 500; display: inline-block; max-width: 34ch; overflow-wrap: anywhere; }
.st-opt{ font-weight: 400; color: var(--ink-faint); }
.st-badge{ display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: 6px; padding: 0 6px; border-radius: 10px; background: var(--warning-bg); color: var(--warning); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tab-btn.active .st-badge{ background: var(--surface); }
.st-updated{ font-size: 13px; color: var(--ink-faint); margin-right: var(--space-2); }
.st-note{ margin: var(--space-4) 0 0; }
.st-note a{ color: inherit; text-decoration: underline; text-underline-offset: 3px; font-weight: 500; }
.st-panel:focus{ outline: none; }

/* ---- banners above the strip ---- */
.st-banner{ display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-2) var(--space-4); margin-bottom: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); border: 1px solid transparent; font-size: 14px; line-height: 20px; }
.st-banner-text{ flex: 1 1 320px; min-width: 0; overflow-wrap: anywhere; }
.st-banner[data-tone="bad"]{ background: var(--critical-bg); color: var(--critical); border-color: color-mix(in srgb, var(--critical) 30%, transparent); }
.st-banner[data-tone="warn"]{ background: var(--warning-bg); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.st-banner .btn{ flex: none; }
.st-banner-actions{ display: flex; flex-wrap: wrap; gap: var(--space-2); }
.kpi-grid{ margin-top: var(--space-4); }
.kpi-grid .kpi-meta{ color: var(--ink-muted); }

/* ---- paybill cards ---- */
.st-grid{ display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: var(--space-4); align-items: start; margin-top: var(--space-4); }
.st-grid .st-pb{ margin: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.st-pb-head{ display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: var(--space-2) var(--space-3); }
.st-pb-head h3{ margin: 0; font-size: 18px; line-height: 26px; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.st-chips{ display: inline-flex; flex-wrap: wrap; gap: var(--space-2); }
.st-owner{ margin: calc(var(--space-2) * -1) 0 0; font-size: 13px; color: var(--ink-muted); }
.st-figs{ display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-3) var(--space-4); margin: 0; padding: var(--space-3) var(--space-4); background: var(--surface-2); border-radius: var(--radius-sm); }
.st-figs dt{ font-size: 12px; line-height: 16px; color: var(--ink-muted); margin-bottom: 2px; }
.st-figs dd{ margin: 0; font-size: 14px; line-height: 20px; color: var(--ink); overflow-wrap: anywhere; }
.st-figs .st-big{ font-size: 20px; line-height: 28px; font-weight: 500; font-variant-numeric: tabular-nums; }
.st-stale{ color: var(--warning); font-weight: 500; }
.st-hints{ margin: 0; padding-left: 18px; font-size: 13px; line-height: 19px; color: var(--ink-muted); }
.st-hints li + li{ margin-top: 2px; }
.st-rule{ font-size: 14px; line-height: 20px; }
.st-rule p{ margin: var(--space-2) 0 0; color: var(--ink); overflow-wrap: anywhere; }
.st-rule p.st-muted{ color: var(--ink-muted); font-size: 13px; }
.st-rule > strong{ display: inline-block; margin-right: var(--space-2); }
.st-why{ margin: 0; font-size: 13px; line-height: 19px; color: var(--ink-muted); padding: var(--space-2) var(--space-3); background: var(--surface-2); border-radius: var(--radius-sm); }
.st-actions{ display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: auto; padding-top: var(--space-1); }
.st-actions .btn{ min-height: 36px; }

/* ---- tables that become cards on a phone ---- */
.st-wrap{ border: 0; border-radius: 0; }
.table-card .st-table td{ white-space: normal; vertical-align: top; padding-top: 10px; padding-bottom: 10px; }
.table-card .st-table td.num{ text-align: right; }
.st-table td .st-amt, .st-table td time{ white-space: nowrap; }
.st-table td:last-child .btn{ white-space: nowrap; }
.table-card .data-toolbar{ border-bottom: 1px solid var(--line); }

/* ---- filters ---- */
.st-filters{ display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-4); align-items: flex-end; padding: var(--space-4); margin: 0; }
.st-filters .field{ margin: 0; flex: 1 1 180px; min-width: 0; }
.st-filters .field.st-clear{ flex: 0 0 auto; }
.st-filters-one{ margin-bottom: var(--space-4); }
.filters-collapsible{ margin-top: var(--space-1); }

/* ---- dialogs ---- */
.st-dlg .lead{ margin-bottom: var(--space-3); }
.st-dlg p{ margin: var(--space-3) 0; font-size: 14px; line-height: 20px; color: var(--text); }
.st-dlg p strong{ color: var(--ink); }
.st-facts{ margin: 0 0 var(--space-3); padding: var(--space-3) var(--space-4); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); display: grid; gap: var(--space-2); }
.st-facts > div{ display: grid; grid-template-columns: minmax(120px, 34%) minmax(0, 1fr); gap: var(--space-1) var(--space-3); }
.st-facts dt{ font-size: 13px; color: var(--ink-muted); }
.st-facts dd{ margin: 0; font-size: 14px; color: var(--ink); overflow-wrap: anywhere; }
.st-facts-wide{ margin-top: var(--space-3); }
.st-callout{ margin: var(--space-3) 0; padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); font-size: 14px; line-height: 20px; background: var(--info-bg); color: var(--ink); border: 1px solid var(--line-2); }
.st-callout[data-tone="bad"]{ border-color: var(--critical); background: var(--critical-bg); }
.st-callout[data-tone="warn"]{ border-color: var(--warning); background: var(--warning-bg); }
.st-callout[data-tone="good"]{ border-color: var(--good); background: var(--good-bg); }
.st-h{ margin: var(--space-5) 0 var(--space-2); font-size: 15px; font-weight: 500; }
.st-tech summary{ cursor: pointer; font-size: 13px; color: var(--ink-muted); padding: var(--space-2) 0; }
.modal-card:has(.st-wrap){ max-width: 880px; }
.modal-card .st-wrap{ margin: 0 calc(var(--space-2) * -1); }
.modal-card .st-table td:first-child, .modal-card .st-table th:first-child{ padding-left: var(--space-2); }
.modal-card .st-table td:last-child, .modal-card .st-table th:last-child{ padding-right: var(--space-2); }

/* ---- register form ---- */
.st-set{ margin: 0 0 var(--space-4); padding: var(--space-3) var(--space-4) var(--space-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm); min-width: 0; }
.st-set legend{ padding: 0 var(--space-2); font-size: 14px; font-weight: 600; color: var(--ink); }
.st-set:disabled{ opacity: .7; }
.st-two{ display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--space-4); }
.st-three{ display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 var(--space-3); }
.st-checks{ display: grid; gap: var(--space-1) var(--space-4); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.st-check{ display: flex; align-items: center; gap: var(--space-2); min-height: 36px; font-size: 14px; cursor: pointer; }
.st-check input{ width: 18px; height: 18px; flex: none; accent-color: var(--brand); }
.st-safe{ margin: 0 0 var(--space-3); padding: var(--space-2) var(--space-3); background: var(--info-bg); color: var(--ink); border-radius: var(--radius-sm); font-size: 13px; line-height: 18px; }
.st-err{ margin: 0; font-size: 13px; line-height: 18px; color: var(--critical); }
.st-err:empty, .st-err.hidden{ display: none; }
.field input[aria-invalid="true"]{ border-color: var(--critical); box-shadow: inset 0 0 0 1px var(--critical); }
.st-sticky{ position: sticky; bottom: calc(var(--space-4) * -1); z-index: 2; margin: var(--space-4) calc(var(--space-2) * -1) calc(var(--space-2) * -1); padding: var(--space-3) var(--space-2); background: var(--surface); border-top: 1px solid var(--line-2); }
#rgSummary, #stDlgMsg{ margin-top: var(--space-3); }
#rgSummary:focus, #stDlgMsg:focus{ outline: 2px solid var(--focus); outline-offset: 2px; }

@media (max-width: 760px){
  .st-three{ grid-template-columns: minmax(0, 1fr); }
}

/* ---- phone: tables become labelled cards, bars stick, targets reach 44px ---- */
@media (max-width: 640px){
  .st-two{ grid-template-columns: minmax(0, 1fr); }
  .st-grid{ grid-template-columns: minmax(0, 1fr); }
  .st-updated{ flex: 1 0 100%; margin: 0; }
  .st-table thead{ position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .st-table, .st-table tbody, .st-table tr, .st-table td{ display: block; width: 100%; }
  .st-table tr{ padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line); }
  .st-table tbody tr:last-child{ border-bottom: 0; }
  .table-card .st-table td, .modal-card .st-table td{ display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3); height: auto; padding: 4px 0; border: 0; text-align: right; }
  .st-table td::before{ content: attr(data-label); flex: none; max-width: 42%; text-align: left; font-size: 13px; font-weight: 500; color: var(--ink-muted); }
  .st-table td[data-label=""]::before{ content: none; }
  .st-table td > *{ min-width: 0; text-align: right; }
  .st-table td .st-sub, .st-table td .st-msg{ max-width: none; }
  .st-table td[data-label=""]{ justify-content: flex-end; padding-top: var(--space-2); }
  .st-table td:first-child, .st-table td:last-child, .modal-card .st-table td:first-child, .modal-card .st-table td:last-child{ padding-left: 0; padding-right: 0; }
  .st-facts > div{ grid-template-columns: minmax(0, 1fr); }
  .st-banner{ padding: var(--space-2) var(--space-3); font-size: 13px; line-height: 18px; }
  .st-note{ padding: var(--space-2) var(--space-3); font-size: 13px; line-height: 18px; margin-bottom: var(--space-3); }
  .st-filters{ flex-direction: column; align-items: stretch; }
  .st-filters .field.st-clear .btn{ width: 100%; }
  .st-sticky{ bottom: calc(var(--space-4) * -1); }
  .modal-card .st-sticky .btn{ width: 100%; }
}
@media (pointer: coarse), (max-width: 640px){
  .st-table .btn, .st-actions .btn, .st-banner .btn, .st-filters .btn, .data-actions .btn, .st-dlg .btn, .st-sticky .btn{ min-height: 44px; }
  .st-check{ min-height: 44px; }
  .st-check input{ width: 22px; height: 22px; }
  .st-filters input, .st-filters select, .st-dlg input, #stForm input, #stForm select{ min-height: 44px; }
}
@media (prefers-reduced-motion: reduce){
  .st-grid *{ transition: none !important; }
}
