/** Format Fineract USD balance strings for dashboard display */
export function formatUsd(value: string | number | undefined | null): string {
  if (value === undefined || value === null || value === '') return '—';
  const n = typeof value === 'number' ? value : parseFloat(String(value));
  if (!Number.isFinite(n)) return '—';
  return new Intl.NumberFormat('en-US', {
    style: 'currency',
    currency: 'USD',
    maximumFractionDigits: 2,
  }).format(n);
}
