<div>
    <div class="d-flex justify-content-between align-items-center mb-3">
        <h5 class="fw-bold mb-0">My Claims</h5>
        <span class="badge bg-primary">{{ $total }}</span>
    </div>

    @forelse($grouped as $statusName => $claims)
        @php $status = $claims->first()->status; @endphp
        <div class="mb-3">
            <div class="d-flex align-items-center mb-2">
                <span class="badge me-2" style="background-color: {{ $status->colour ?? '#6c757d' }}">
                    {{ $statusName }}
                </span>
                <span class="text-muted small">{{ $claims->count() }}</span>
            </div>
            <ul class="list-group list-group-flush">
                @foreach($claims as $claim)
                    <li class="list-group-item px-0 py-2 d-flex justify-content-between align-items-center">
                        <a href="{{ route('ha-claims.show', $claim->client) }}" class="text-body text-decoration-none small">
                            <i class="mdi mdi-account me-1"></i>
                            {{ $claim->client?->name_first }} {{ $claim->client?->name_last }}
                        </a>
                        <span class="text-muted extra-small">{{ $claim->case_number ?: '#' . $claim->id }}</span>
                    </li>
                @endforeach
            </ul>
        </div>
    @empty
        <p class="text-muted small mb-0">No claims are currently assigned to you.</p>
    @endforelse
</div>
