<div class="card border-0 shadow-sm">
    <div class="card-body">
        <h4 class="fw-bold mb-4">Estimated Value by Funding Tranche</h4>

        <table class="table table-sm table-hover align-middle">
            <thead>
                <tr>
                    <th>Funding Tranche</th>
                    <th>Clients</th>
                    <th>Total Estimated Value</th>
                    <th>16% Fee Valuation</th>
                    <th>Average Estimated Value</th>
                </tr>
            </thead>

            <tbody>
                @forelse($rows as $row)
                    <tr>
                        <td>{{ $row->tranche_name }}</td>
                        <td>{{ number_format($row->client_count) }}</td>
                        <td>
                            £{{ number_format($row->total_min) }}
                            @if($row->total_max != $row->total_min)
                                - £{{ number_format($row->total_max) }}
                            @endif
                        </td>
                        <td>
                            £{{ number_format($row->fee_min, 2) }}
                            @if($row->fee_max != $row->fee_min)
                                - £{{ number_format($row->fee_max, 2) }}
                            @endif
                        </td>
                        <td>
                            £{{ number_format($row->average_min) }}
                            @if($row->average_max != $row->average_min)
                                - £{{ number_format($row->average_max) }}
                            @endif
                        </td>
                    </tr>
                @empty
                    <tr>
                        <td colspan="5" class="text-center text-muted py-4">
                            No estimated values found.
                        </td>
                    </tr>
                @endforelse
            </tbody>
        </table>
    </div>
</div>
