<div class="mx-auto max-w-7xl"><div class="mb-6"><h2 class="font-display text-2xl font-extrabold">Health Records</h2><p class="mt-2 text-sm text-slate-500">Encounter notes, prescriptions and laboratory requests from your TibaLeta care journey.</p></div><div class="grid gap-6 xl:grid-cols-3"><section class="rounded-2xl border border-slate-100 bg-white p-5 shadow-card"><h3 class="font-display text-lg font-extrabold">Clinical notes</h3><div class="mt-4 space-y-3"><?php if(!$notes): ?><p class="text-sm text-slate-400">No clinical notes yet.</p><?php endif; ?><?php foreach($notes as $n): ?><div class="rounded-xl bg-slate-50 p-4"><div class="text-xs font-bold">Assessment</div><p class="mt-1 line-clamp-3 text-xs leading-5 text-slate-500"><?= esc($n['assessment']) ?></p><div class="mt-2 text-[10px] text-slate-300"><?= date('M j, Y',strtotime($n['created_at'])) ?></div></div><?php endforeach; ?></div></section><section class="rounded-2xl border border-slate-100 bg-white p-5 shadow-card"><h3 class="font-display text-lg font-extrabold">Prescriptions</h3><div class="mt-4 space-y-3"><?php if(!$prescriptions): ?><p class="text-sm text-slate-400">No prescriptions yet.</p><?php endif; ?><?php foreach($prescriptions as $r): ?><div class="rounded-xl border border-slate-100 p-4"><div class="flex justify-between gap-2"><div><div class="text-sm font-bold"><?= esc($r['medication_name'] ?: 'Prescription') ?></div><p class="mt-1 text-xs text-slate-400"><?= esc(trim(($r['dose'] ?? '').' '.($r['frequency'] ?? '').' '.($r['duration'] ?? ''))) ?></p></div><span class="text-[10px] font-bold text-emerald-600"><?= esc(ucfirst($r['status'])) ?></span></div><?php if($r['status']==='issued'): ?><form action="/patient/prescriptions/<?= $r['id'] ?>/order" method="post" class="mt-3"><?= csrf_field() ?><button class="rounded-lg bg-teal-600 px-3 py-2 text-xs font-bold text-white">Send to pharmacy</button></form><?php endif; ?></div><?php endforeach; ?></div></section><section class="rounded-2xl border border-slate-100 bg-white p-5 shadow-card"><h3 class="font-display text-lg font-extrabold">Lab requests</h3><div class="mt-4 space-y-3"><?php if(!$labs): ?><p class="text-sm text-slate-400">No lab requests yet.</p><?php endif; ?><?php foreach($labs as $l): ?><div class="rounded-xl bg-slate-50 p-4"><div class="flex justify-between gap-2"><span class="text-xs font-bold">Tests requested</span><span class="text-[10px] font-bold text-teal-600"><?= esc(ucwords($l['status'])) ?></span></div><p class="mt-2 text-xs leading-5 text-slate-500"><?= esc($l['tests']) ?></p><p class="mt-2 text-[10px] text-slate-300"><?= esc(ucfirst($l['collection_type'])) ?> collection</p></div><?php endforeach; ?></div></section></div></div>
