@php
    $req = $pathologyRequest?->payload ?? [];
    $rep = $pathologyReport?->payload ?? [];
    $ver = $pathologyVerification?->payload ?? [];
@endphp

<section class="rounded-2xl border border-slate-200 bg-white p-5">
    <div class="flex flex-wrap items-start justify-between gap-3">
        <div>
            <h3 class="text-sm font-semibold text-slate-900">Pathology overview</h3>
            <p class="mt-0.5 text-xs text-slate-500">Clinic pathology request through verification — complementary to the Lab app queue.</p>
        </div>
        <div class="flex flex-wrap gap-3 text-sm">
            <a href="{{ route('care.specialty.pathology.print', $workspaceVisit) }}" target="_blank" class="font-medium text-indigo-600">Print summary</a>
            <a href="{{ route('care.specialty.pathology.reports') }}" class="font-medium text-indigo-600">Pathology reports</a>
        </div>
    </div>

    <div class="mt-4 grid gap-3 sm:grid-cols-3">
        <div class="rounded-xl border border-slate-100 bg-slate-50 px-3 py-3">
            <p class="text-xs font-semibold uppercase tracking-wide text-slate-500">Specimen</p>
            <p class="mt-1 text-sm font-semibold text-slate-900">{{ $req['specimen_type'] ?? '—' }}</p>
            <p class="mt-1 text-xs text-slate-500">{{ $req['site'] ?? '—' }}</p>
        </div>
        <div class="rounded-xl border border-slate-100 bg-slate-50 px-3 py-3">
            <p class="text-xs font-semibold uppercase tracking-wide text-slate-500">Urgency</p>
            <p class="mt-1 text-sm font-semibold text-slate-900">{{ $req['urgency'] ?? '—' }}</p>
            <p class="mt-1 text-xs text-slate-500">{{ \Illuminate\Support\Str::limit($req['clinical_history'] ?? '—', 40) }}</p>
        </div>
        <div class="rounded-xl border border-slate-100 bg-slate-50 px-3 py-3">
            <p class="text-xs font-semibold uppercase tracking-wide text-slate-500">Diagnosis</p>
            <p class="mt-1 text-sm font-semibold text-slate-900">{{ \Illuminate\Support\Str::limit($rep['diagnosis'] ?? '—', 40) }}</p>
            <p class="mt-1 text-xs text-slate-500">{{ $ver['outcome'] ?? (! empty($ver['verified']) ? 'Verified' : '—') }}</p>
        </div>
    </div>

    @if (! empty($clinicalAlerts))
        <div class="mt-4 space-y-1.5 border-t border-slate-100 pt-4">
            <p class="text-xs font-semibold uppercase tracking-wide text-slate-500">Alerts</p>
            @foreach ($clinicalAlerts as $alert)
                <p class="text-sm {{ ($alert['severity'] ?? '') === 'critical' ? 'text-rose-700' : 'text-amber-800' }}">
                    {{ $alert['message'] ?? '' }}
                </p>
            @endforeach
        </div>
    @endif
</section>
