@unless ($hasData) @else {{-- Headline KPIs --}}
{{-- Income vs Expense trend --}}

{{ __('Income vs Expenses') }}

{{ __('Monthly, in') }} {{ $base }}

{{-- Per-person comparison --}}

{{ __('Per-person comparison') }}

{{ __('Net income, spending and savings rate') }} ({{ $base }})

@foreach ($perPerson as $p) @endforeach
{{ __('Member') }} {{ __('Earned') }} {{ __('Spent') }} {{ __('Net') }} {{ __('Savings') }}
{{ $p['name'] }} {{ number_format($p['earned'], 2) }} {{ number_format($p['spent'], 2) }} {{ number_format($p['net'], 2) }} {{ $p['savings_rate'] }}%
{{-- Beneficiary donut --}}

{{ __('Where money goes') }}

@if (empty($beneficiary))

{{ __('No spending in range.') }}

@else
@foreach ($beneficiary as $b)
{{ $b['label'] }} {{ $base }} {{ number_format($b['amount'], 2) }}
@endforeach
@endif
{{-- Contribution fairness --}}

{{ __('Contribution fairness') }}

{{ __('Shared costs:') }} {{ $base }} {{ number_format($totalShared, 2) }} · {{ __('who carried their share') }}

@if ($settleUp)

{{ __('To settle up, :ower should pay :owed', ['ower' => $settleUp['ower'], 'owed' => $settleUp['owed']]) }} {{ $base }} {{ number_format($settleUp['amount'], 2) }}.

@elseif ($totalShared > 0)

{{ __('Contributions are balanced, nobody owes anybody.') }}

@endif
@foreach ($fairness as $f)
{{ $f['name'] }} @if ($f['balance'] >= 0.01) +{{ number_format($f['balance'], 2) }} @elseif ($f['balance'] <= -0.01) {{ number_format($f['balance'], 2) }} @else {{ __('Even') }} @endif
{{ __('Paid') }}
{{ $base }} {{ number_format($f['paid'], 2) }}
{{ __('Fair share') }}
{{ $base }} {{ number_format($f['fair_share'], 2) }}
@endforeach
{{-- Deduction waterfall --}}

{{ __('Gross to net') }}

{{ __('What came off the salaries') }} ({{ $base }})

{{ __('Gross') }} {{ $base }} {{ number_format($totalGross, 2) }}
@foreach ($deductionRows as $d)
{{ $d['label'] }} − {{ number_format($d['amount'], 2) }}
@endforeach
{{ __('Net (take-home)') }} {{ $base }} {{ number_format($totalGross - $totalDeductions, 2) }}
{{-- Loans + pots --}}

{{ __('Loans & pots') }}

{{ __('Pot balances') }}

@if ($potTotals->isEmpty())

{{ __('No accounts.') }}

@else
@foreach ($potTotals as $code => $sum) {{ $code }} {{ number_format($sum, 2) }} @endforeach
@endif

{{ __('Loans') }}

@if ($loans->isEmpty())

{{ __('No loans.') }}

@else
@foreach ($loans as $loan) @php $total = (float) $loan->installments->sum('amount'); $paid = (float) $loan->installments->where('status', 'paid')->sum('amount'); $pct = $total > 0 ? (int) round($paid / $total * 100) : 0; @endphp
{{ $loan->lender }} · {{ $loan->member->name ?? '' }} {{ $pct }}%
@endforeach
@endif
@endunless