.billing-shell { width: min(1320px, calc(100% - 32px)); }
.billing-topbar { align-items: flex-end; }
.billing-subtitle { margin: 8px 0 0; color: var(--muted); }
.billing-identity { flex-wrap: wrap; justify-content: flex-end; }

.billing-summary {
  display: grid;
  grid-template-columns: 1.35fr repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.summary-card {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: 0 5px 18px var(--list-shadow);
}
.summary-card > span { color: var(--muted); font-size: 13px; font-weight: 750; }
.summary-card strong { display: block; margin: 10px 0 7px; font-size: clamp(28px, 3vw, 40px); letter-spacing: -.04em; }
.summary-card strong small { color: var(--muted); font-size: 14px; letter-spacing: 0; }
.summary-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.summary-card-primary { color: white; border-color: transparent; background: var(--primary); }
.summary-card-primary > span,
.summary-card-primary p,
.summary-card-primary strong small { color: rgba(255, 255, 255, .76); }

.withdrawal-card,
.transactions-card {
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--paper);
  box-shadow: 0 5px 18px var(--list-shadow);
}
.withdrawal-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 18px;
  padding: 22px 24px;
}
.withdrawal-card h2 { margin-bottom: 7px; }
.withdrawal-card p:last-child { max-width: 900px; margin-bottom: 0; color: var(--muted); line-height: 1.55; }
.withdrawal-card strong { color: var(--ink); }
.withdrawal-card .button { flex: none; }

.transactions-card { overflow: hidden; }
.transactions-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
}
.transactions-heading h2 { margin-bottom: 5px; }
.billing-meta { margin: 0; color: var(--muted); font-size: 12px; }
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--green);
  background: var(--assignee-bg);
  font-size: 12px;
  font-weight: 800;
}
.live-badge > span { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px var(--focus-ring); }

.transaction-table-wrap { overflow-x: auto; }
.transaction-table { width: 100%; min-width: 1080px; border-collapse: collapse; }
.transaction-table th,
.transaction-table td { padding: 14px 15px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.transaction-table th { color: var(--muted); background: var(--wash); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.transaction-table td { font-size: 13px; }
.transaction-table tbody tr:hover { background: var(--wash); }
.transaction-table time,
.transaction-table code { color: var(--muted); font-size: 12px; }
.transaction-table code { white-space: nowrap; }
.amount { font-size: 15px !important; font-weight: 850; white-space: nowrap; }
.amount.incoming { color: var(--green); }
.amount.outgoing { color: var(--red); }
.flow-badge,
.reconciliation {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--status-bg);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.flow-badge.incoming,
.reconciliation.matched { color: var(--green); background: var(--resolved-bg); }
.flow-badge.outgoing,
.reconciliation.mismatch,
.reconciliation.unmatched,
.reconciliation.external_adjustment { color: var(--rejected-ink); background: var(--rejected-bg); }
.reconciliation.order_only { color: var(--active-ink); background: var(--active-bg); }
.order-cell strong,
.order-cell span,
.transaction-detail { display: block; }
.order-cell span,
.transaction-detail,
.muted-cell { margin-top: 3px; color: var(--muted); font-size: 11px; }

.transaction-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 20px;
}
.transaction-pagination > div { display: flex; gap: 9px; }

@media (max-width: 980px) {
  .billing-summary { grid-template-columns: repeat(2, 1fr); }
  .withdrawal-card { align-items: flex-start; flex-direction: column; gap: 18px; }
}

@media (max-width: 720px) {
  .billing-shell { width: min(100% - 20px, 1320px); }
  .billing-topbar { align-items: flex-start; }
  .billing-identity { align-items: flex-end; flex-direction: row; }
  .billing-summary { grid-template-columns: 1fr; }
  .transactions-heading { align-items: flex-start; flex-direction: column; }
  .transaction-pagination { align-items: flex-start; flex-direction: column; }
}
