<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Child Welfare summary · {{ $patient->fullName() }}</title>
    <style>
        body { font-family: system-ui, sans-serif; color: #0f172a; margin: 2rem; }
        h1 { font-size: 1.25rem; margin: 0 0 .25rem; }
        h2 { font-size: .95rem; margin: 1.25rem 0 .5rem; border-bottom: 1px solid #e2e8f0; padding-bottom: .25rem; }
        .meta { color: #64748b; font-size: .875rem; }
        dl { display: grid; grid-template-columns: 10rem 1fr; gap: .35rem .75rem; font-size: .875rem; }
        dt { color: #64748b; }
        dd { margin: 0; font-weight: 500; }
        @media print { .no-print { display: none; } }
    </style>
</head>
<body>
    <p class="no-print"><a href="{{ route('care.specialty.workspace', ['module' => 'child_welfare', 'visit' => $visit]) }}">Back</a></p>

    <h1>{{ $patient->fullName() }}</h1>
    <p class="meta">
        {{ $patient->patient_number }}
        · Visit #{{ $visit->id }}
        · Stage {{ $visit->specialty_stage ?? '—' }}
        · {{ $visit->checked_in_at?->format('d M Y H:i') ?? '—' }}
    </p>

    <h2>Intake / history</h2>
    @if ($intake)
        <dl>
            <dt>Visit reason</dt><dd>{{ $intake->payload['visit_reason'] ?? '—' }}</dd>
            <dt>Caregiver</dt><dd>{{ $intake->payload['caregiver'] ?? '—' }}</dd>
            <dt>History</dt><dd>{{ $intake->payload['history'] ?? '—' }}</dd>
            <dt>Immunization</dt><dd>{{ $intake->payload['immunization_status'] ?? '—' }}</dd>
            <dt>Feeding</dt><dd>{{ $intake->payload['feeding'] ?? '—' }}</dd>
            <dt>Safeguarding</dt><dd>{{ $intake->payload['safeguarding_notes'] ?? '—' }}</dd>
        </dl>
    @else
        <p class="meta">No intake recorded.</p>
    @endif

    <h2>Assessment</h2>
    @if ($assessment)
        <dl>
            <dt>Age (months)</dt><dd>{{ $assessment->payload['age_months'] ?? '—' }}</dd>
            <dt>Weight (kg)</dt><dd>{{ $assessment->payload['weight_kg'] ?? '—' }}</dd>
            <dt>Growth status</dt><dd>{{ $assessment->payload['growth_status'] ?? '—' }}</dd>
            <dt>Nutrition risk</dt><dd>{{ $assessment->payload['nutrition_risk'] ?? '—' }}</dd>
            <dt>Safeguarding</dt><dd>{{ $assessment->payload['safeguarding_flag'] ?? '—' }}</dd>
            <dt>Exam</dt><dd>{{ $assessment->payload['exam_findings'] ?? '—' }}</dd>
            <dt>Summary</dt><dd>{{ $assessment->payload['assessment_summary'] ?? '—' }}</dd>
        </dl>
    @else
        <p class="meta">No assessment recorded.</p>
    @endif

    <h2>Care plan</h2>
    @if ($plan)
        <dl>
            <dt>Goals</dt><dd>{{ $plan->payload['goals'] ?? '—' }}</dd>
            <dt>Interventions</dt><dd>{{ $plan->payload['interventions'] ?? '—' }}</dd>
            <dt>Counseling</dt><dd>{{ $plan->payload['counseling'] ?? '—' }}</dd>
            <dt>Follow-up</dt><dd>{{ $plan->payload['follow_up'] ?? '—' }}</dd>
        </dl>
    @else
        <p class="meta">No care plan recorded.</p>
    @endif

    <h2>Intervention / follow-up</h2>
    @if ($followup)
        <dl>
            <dt>Review type</dt><dd>{{ $followup->payload['review_type'] ?? '—' }}</dd>
            <dt>Interventions</dt><dd>{{ $followup->payload['interventions_delivered'] ?? '—' }}</dd>
            <dt>Outcome</dt><dd>{{ $followup->payload['outcome'] ?? '—' }}</dd>
            <dt>Next visit</dt><dd>{{ $followup->payload['next_visit'] ?? '—' }}</dd>
        </dl>
    @else
        <p class="meta">No follow-up recorded.</p>
    @endif

    <script>window.print();</script>
</body>
</html>
