@php $canManage = $canConsult ?? false; @endphp

<section class="rounded-2xl border border-slate-200 bg-white p-5">
    <h3 class="text-sm font-semibold text-slate-900">Dental visit notes</h3>
    <p class="mt-0.5 text-xs text-slate-500">Short clinical notes for this visit — not a GP SOAP form.</p>

    @if ($canManage)
        <form method="POST" action="{{ route('care.specialty.dentistry.notes', $workspaceVisit) }}" class="mt-4 space-y-3">
            @csrf
            <div>
                <label class="block text-xs font-medium text-slate-600">Chief complaint</label>
                <textarea name="chief_complaint" rows="2" class="mt-1 w-full rounded-xl border border-slate-200 px-3 py-2 text-sm">{{ old('chief_complaint', $dentalVisitNote?->chief_complaint) }}</textarea>
            </div>
            <div>
                <label class="block text-xs font-medium text-slate-600">Soft tissue</label>
                <textarea name="soft_tissue" rows="2" class="mt-1 w-full rounded-xl border border-slate-200 px-3 py-2 text-sm">{{ old('soft_tissue', $dentalVisitNote?->soft_tissue) }}</textarea>
            </div>
            <div>
                <label class="block text-xs font-medium text-slate-600">Occlusion / bite</label>
                <textarea name="occlusion" rows="2" class="mt-1 w-full rounded-xl border border-slate-200 px-3 py-2 text-sm">{{ old('occlusion', $dentalVisitNote?->occlusion) }}</textarea>
            </div>
            <div>
                <label class="block text-xs font-medium text-slate-600">Other notes</label>
                <textarea name="notes" rows="3" class="mt-1 w-full rounded-xl border border-slate-200 px-3 py-2 text-sm">{{ old('notes', $dentalVisitNote?->notes) }}</textarea>
            </div>
            <button type="submit" class="btn-primary">Save notes</button>
        </form>
    @else
        <dl class="mt-4 grid gap-3 text-sm">
            <div>
                <dt class="text-slate-500">Chief complaint</dt>
                <dd class="mt-0.5 font-medium text-slate-900 whitespace-pre-wrap">{{ $dentalVisitNote?->chief_complaint ?: '—' }}</dd>
            </div>
            <div>
                <dt class="text-slate-500">Soft tissue</dt>
                <dd class="mt-0.5 font-medium text-slate-900 whitespace-pre-wrap">{{ $dentalVisitNote?->soft_tissue ?: '—' }}</dd>
            </div>
            <div>
                <dt class="text-slate-500">Occlusion / bite</dt>
                <dd class="mt-0.5 font-medium text-slate-900 whitespace-pre-wrap">{{ $dentalVisitNote?->occlusion ?: '—' }}</dd>
            </div>
            <div>
                <dt class="text-slate-500">Other notes</dt>
                <dd class="mt-0.5 font-medium text-slate-900 whitespace-pre-wrap">{{ $dentalVisitNote?->notes ?: '—' }}</dd>
            </div>
        </dl>
    @endif
</section>
