.plx-cbp-card {
  margin-top: var(--space-5);
  padding: var(--space-5);
}

.plx-cbp-card-header {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.plx-cbp-card-heading {
  align-items: center;
  display: flex;
  gap: var(--space-3);
}

.plx-cbp-card-icon {
  align-items: center;
  background: var(--pm-accent-soft);
  border-radius: var(--radius-md);
  color: var(--pm-primary);
  display: inline-flex;
  height: 32px;
  justify-content: center;
  width: 32px;
}

.plx-cbp-card-title {
  color: var(--pm-primary);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  margin: 0;
}

.plx-cbp-card-subtitle {
  color: var(--text-muted);
  font-size: var(--text-xs);
  margin: 0;
}

.plx-cbp-card-range {
  color: var(--text-primary);
  font-size: var(--text-xs);
}

.plx-cbp-total-balance {
  color: var(--text-primary);
  font-size: var(--text-sm);
  margin: 0;
}

.plx-cbp-total-balance strong {
  color: var(--pm-primary);
  margin-left: var(--space-2);
}

/* Tables reuse the Settings list look (.plx-settings-table-wrap: grey thead,
   column dividers, rounded border). Cells wrap and headers break only at
   spaces, so the table fits its card with no horizontal scroll; the wrap's
   own overflow-x stays as a narrow-screen fallback. */
.plx-cbp-table {
  table-layout: auto;
  width: 100%;
}

.plx-settings-table-wrap .plx-cbp-table thead th,
.plx-settings-table-wrap .plx-cbp-table tbody td {
  overflow-wrap: break-word;
  white-space: normal;
}

.plx-settings-table-wrap .plx-cbp-table thead th {
  text-align: left;
}

.plx-cbp-th-sub {
  color: var(--text-muted);
  display: block;
  font-size: var(--text-xs);
  font-weight: var(--weight-regular);
}

.plx-cbp-total-row td {
  background: var(--pm-accent-soft);
  color: var(--pm-primary);
  font-weight: var(--weight-bold);
}

.plx-cbp-country {
  align-items: center;
  display: inline-flex;
  gap: var(--space-2);
}

.plx-cbp-flag {
  height: 10px;
  width: 14px;
}

.plx-cbp-grid-2 {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(2, 1fr);
}

/* Cash Flow Summary tiles */
.plx-cbp-flow-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(2, 1fr);
}

.plx-cbp-flow-tile {
  align-items: center;
  background: var(--bg-hover);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3);
}

.plx-cbp-flow-icon {
  align-items: center;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  display: inline-flex;
  flex-shrink: 0;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.plx-cbp-flow-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.plx-cbp-flow-label {
  color: var(--pm-primary);
  font-size: var(--text-xs);
}

.plx-cbp-flow-value {
  color: var(--text-primary);
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
}

.plx-cbp-flow-change {
  color: var(--text-muted);
  font-size: var(--text-xs);
}

/* Currency-wise donut */
.plx-cbp-donut-card {
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
  padding: var(--space-4);
}

.plx-cbp-donut-wrap {
  flex-shrink: 0;
  height: 150px;
  position: relative;
  width: 150px;
}

.plx-cbp-donut-center {
  align-items: center;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  left: 0;
  position: absolute;
  right: 0;
  text-align: center;
  top: 0;
}

.plx-cbp-donut-label {
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.plx-cbp-donut-total {
  color: var(--text-primary);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
}

.plx-cbp-legend {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: var(--space-2);
  list-style: none;
  margin: 0;
  min-width: 200px;
  padding: 0;
}

.plx-cbp-legend li {
  align-items: center;
  display: grid;
  font-size: var(--text-xs);
  gap: var(--space-2);
  grid-template-columns: 8px 36px 1fr auto;
}

.plx-cbp-legend-dot {
  border-radius: var(--radius-full);
  height: 8px;
  width: 8px;
}

.plx-cbp-legend-label {
  color: var(--text-primary);
}

.plx-cbp-legend-amount {
  color: var(--text-primary);
  text-align: right;
}

.plx-cbp-legend-pct {
  color: var(--text-muted);
  min-width: 40px;
  text-align: right;
}

@media (max-width: 991.98px) {
  .plx-cbp-grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 575.98px) {
  .plx-cbp-flow-grid {
    grid-template-columns: 1fr;
  }
}

.plx-settings-table-wrap .plx-cbp-table tbody tr.plx-cbp-total-row td {
  color: var(--pm-primary);
  font-weight: var(--weight-bold);
}

/* Column alignment per Figma — text columns left, Account Number / Currency
   / Type centered, amount columns right (headers follow their column). */
.plx-settings-table-wrap #plxCbpBalancesTableJs th:nth-child(n+4):nth-child(-n+5),
.plx-settings-table-wrap #plxCbpBalancesTableJs td:nth-child(n+4):nth-child(-n+5) {
  text-align: center;
}

.plx-settings-table-wrap #plxCbpBalancesTableJs th:nth-child(n+6),
.plx-settings-table-wrap #plxCbpBalancesTableJs td:nth-child(n+6) {
  text-align: right;
}

.plx-settings-table-wrap #plxCbpTransactionsTableJs th:nth-child(4),
.plx-settings-table-wrap #plxCbpTransactionsTableJs td:nth-child(4),
.plx-settings-table-wrap #plxCbpTransactionsTableJs th:nth-child(6),
.plx-settings-table-wrap #plxCbpTransactionsTableJs td:nth-child(6) {
  text-align: center;
}

.plx-settings-table-wrap #plxCbpTransactionsTableJs th:nth-child(7),
.plx-settings-table-wrap #plxCbpTransactionsTableJs td:nth-child(7) {
  text-align: right;
}

.plx-cbp-table td {
  vertical-align: middle;
}

/* Bank Balances: amount headers stay centered over their right-aligned values. */
.plx-settings-table-wrap #plxCbpBalancesTableJs thead th:nth-child(n+6) {
  text-align: center;
}

/* Dates stay on one line (Figma); other cells wrap. */
.plx-settings-table-wrap #plxCbpTransactionsTableJs tbody td:first-child {
  white-space: nowrap;
}

/* Outer table frame per theme/Figma: 1px rounded border around the table
   (header + rows), inside the card. */
.plx-settings-table-wrap.plx-cbp-table-wrap {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
}

.plx-settings-table-wrap.plx-cbp-table-wrap .plx-cbp-table tbody tr:last-child td {
  border-bottom: 0;
}

/* Cash Flow Summary tiles — same spec as the Bank Reconciliation stat tiles:
   rounded-square white icon chip, fixed 9px gaps, even line rhythm. */
.plx-cbp-flow-grid {
  gap: 9px;
}

.plx-cbp-flow-tile {
  gap: 9px;
  min-width: 0;
  padding: 14px 9px;
}

.plx-cbp-flow-icon {
  background: var(--bg-surface);
  border-radius: 6px;
  font-size: 14px;
  height: 24px;
  line-height: 1;
  width: 24px;
}

.plx-cbp-flow-icon .plx-icon,
.plx-cbp-flow-icon svg {
  height: 14px;
  width: 14px;
}

.plx-cbp-flow-body {
  gap: var(--space-1);
}

.plx-cbp-flow-label,
.plx-cbp-flow-change {
  font-size: var(--text-xs);
  line-height: 1.3;
}

.plx-cbp-flow-value {
  line-height: 1.25;
}

/* ==========================================================================
   RESPONSIVE — below 992px the wide tables stack into one card per row
   (label : value pairs, labels from the header cells via data-label set in
   JS) instead of scrolling sideways.
   ========================================================================== */
@media (max-width: 991.98px) {
.plx-settings-table-wrap #plxCbpBalancesTableJs thead,
.plx-settings-table-wrap #plxCbpTransactionsTableJs thead {
    left: -9999px;
    position: absolute;
  }

.plx-settings-table-wrap #plxCbpBalancesTableJs tbody tr,
.plx-settings-table-wrap #plxCbpTransactionsTableJs tbody tr {
    border-bottom: 1px solid var(--border-default);
    display: block;
    padding: var(--space-2) var(--space-3);
  }

.plx-settings-table-wrap #plxCbpBalancesTableJs tbody tr:last-child,
.plx-settings-table-wrap #plxCbpTransactionsTableJs tbody tr:last-child {
    border-bottom: 0;
  }

.plx-settings-table-wrap #plxCbpBalancesTableJs tbody td,
.plx-settings-table-wrap #plxCbpTransactionsTableJs tbody td {
    align-items: center;
    border: 0;
    display: flex;
    gap: var(--space-3);
    justify-content: space-between;
    padding: var(--space-1) 0;
    text-align: right;
    white-space: normal;
  }

.plx-settings-table-wrap #plxCbpBalancesTableJs tbody td::before,
.plx-settings-table-wrap #plxCbpTransactionsTableJs tbody td::before {
    background: none;
    color: var(--pm-primary);
    content: attr(data-label);
    flex-shrink: 0;
    font-weight: var(--weight-semibold);
    inset: auto;
    position: static;
    text-align: left;
    width: auto;
  }

.plx-settings-table-wrap #plxCbpBalancesTableJs tbody td:first-child,
.plx-settings-table-wrap #plxCbpTransactionsTableJs tbody td:first-child {
    white-space: normal;
  }

  .plx-cbp-flow-grid {
    grid-template-columns: 1fr;
  }

  .plx-cbp-donut-label {
    font-size: 10px;
  }

  .plx-cbp-donut-center {
    padding: 0 var(--space-5);
  }
}

@media (max-width: 991.98px) {
  .plx-settings-table-wrap #plxCbpBalancesTableJs tbody td,
  .plx-settings-table-wrap #plxCbpTransactionsTableJs tbody td {
    flex-wrap: nowrap;
    white-space: nowrap;
  }

  .plx-settings-table-wrap #plxCbpTransactionsTableJs tbody td:nth-child(5) {
    white-space: normal;
  }
}

/* Mid widths (sidebar + two side-by-side cards leaves each card too narrow):
   stack the two cards below 1200px, let the tiles reflow by available width
   instead of a fixed 2-up, and let grid children shrink so the page never
   overflows sideways. */
.plx-cbp-grid-2 > * {
  min-width: 0;
}

.plx-cbp-flow-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

@media (max-width: 1399.98px) {
  .plx-cbp-flow-value {
    font-size: var(--text-lg);
  }
}

@media (max-width: 1199.98px) {
  .plx-cbp-grid-2 {
    grid-template-columns: 1fr;
  }
}

/* The shared .plx-page-has-sticky-footer reserves 96px (140px on mobile) for
   the fixed Back/Print/Export bar, on top of .plx-content's own 32px bottom
   padding — more empty space than the ~65px bar needs. Trimmed here (this
   page only) to just clear the bar plus a small gap. */
.plx-page-has-sticky-footer {
  padding-bottom: 72px;
}

@media (min-width: 992px) and (max-width: 1199.98px) {
  .plx-page-has-sticky-footer {
    padding-bottom: 88px;
  }
}
