<div class="mx-auto max-w-7xl"><div class="mb-6 flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between"><div><p class="text-sm text-slate-500">Today’s overview</p><h2 class="font-display text-2xl font-extrabold">Welcome, <?= esc($authUser['full_name']) ?></h2></div><span class="inline-flex items-center gap-2 rounded-full px-3 py-2 text-xs font-bold <?= $profile['is_online']?'bg-emerald-50 text-emerald-700':'bg-slate-100 text-slate-500' ?>"><span class="status-dot <?= $profile['is_online']?'bg-emerald-500':'bg-slate-400' ?>"></span><?= $profile['is_online']?'Available for requests':'Offline' ?></span></div>
<div class="grid gap-4 sm:grid-cols-2 xl:grid-cols-4"><?php foreach([['Today’s Visits',$stats['today'],'calendar-check'],['New Requests',$stats['requests'],'radio'],['Today’s Earnings',money($stats['earnings']),'wallet-cards'],['Rating',number_format((float)$stats['rating'],1).' ★','star']] as $s): ?><div class="rounded-2xl border border-slate-100 bg-white p-5 shadow-card"><div class="flex justify-between"><div><p class="text-xs font-semibold text-slate-400"><?= $s[0] ?></p><div class="mt-2 font-display text-2xl font-extrabold"><?= $s[1] ?></div></div><span class="grid h-10 w-10 place-items-center rounded-xl bg-teal-50 text-teal-600"><i data-lucide="<?= $s[2] ?>" class="h-4 w-4"></i></span></div></div><?php endforeach; ?></div>
<div class="mt-6 grid gap-6 xl:grid-cols-[.75fr_1.25fr]"><section class="rounded-2xl border border-slate-100 bg-white p-5 shadow-card"><div class="flex items-center justify-between"><h3 class="font-display text-lg font-extrabold">New Requests</h3><a href="/practitioner/requests" class="text-xs font-bold text-teal-600">View all</a></div><div class="mt-4 space-y-4"><?php if(!$requests): ?><div class="rounded-xl bg-slate-50 py-10 text-center text-sm text-slate-400">No new requests right now.</div><?php endif; ?><?php foreach($requests as $r): ?><div class="rounded-xl border border-slate-100 p-4"><div class="flex items-start justify-between gap-3"><div><div class="text-sm font-bold"><?= esc($r['service_name']) ?></div><div class="mt-1 text-xs text-slate-400"><?= esc($r['address_text']) ?></div></div><span class="rounded-full bg-amber-50 px-2 py-1 text-[10px] font-bold text-amber-700"><?= esc(ucfirst($r['urgency'])) ?></span></div><p class="mt-3 line-clamp-2 text-xs leading-5 text-slate-500"><?= esc($r['chief_complaint']) ?></p><div class="mt-4 flex gap-2"><form action="/practitioner/requests/<?= $r['id'] ?>/accept" method="post"><?= csrf_field() ?><button class="rounded-lg bg-teal-600 px-4 py-2 text-xs font-bold text-white">Accept</button></form><form action="/practitioner/requests/<?= $r['id'] ?>/decline" method="post"><?= csrf_field() ?><button class="rounded-lg border border-slate-200 px-4 py-2 text-xs font-bold">Decline</button></form></div></div><?php endforeach; ?></div></section>
<section class="rounded-2xl border border-slate-100 bg-white p-5 shadow-card"><div class="flex items-center justify-between"><h3 class="font-display text-lg font-extrabold">Today’s schedule</h3><a href="/practitioner/visits" class="text-xs font-bold text-teal-600">Full schedule</a></div><div class="mt-4 divide-y divide-slate-100"><?php if(!$schedule): ?><div class="py-10 text-center text-sm text-slate-400">Accepted visits will appear here.</div><?php endif; ?><?php foreach($schedule as $v): ?><div class="flex items-center gap-4 py-4"><div class="w-20 text-xs font-bold text-slate-500"><?= $v['scheduled_for']?date('g:i A',strtotime($v['scheduled_for'])):'ASAP' ?></div><span class="grid h-10 w-10 place-items-center rounded-full bg-teal-50 text-xs font-extrabold text-teal-700"><?= initials($v['service_name']) ?></span><div class="min-w-0 flex-1"><a href="/practitioner/visits/<?= $v['id'] ?>" class="truncate text-sm font-bold text-navy hover:text-teal-600"><?= esc($v['service_name']) ?></a><div class="mt-1 truncate text-xs text-slate-400"><?= esc($v['address_text']) ?></div></div><span class="rounded-full bg-slate-100 px-2.5 py-1 text-[10px] font-bold text-slate-500"><?= esc(ucwords(str_replace('_',' ',$v['status']))) ?></span></div><?php endforeach; ?></div></section></div>
<div class="mt-6 grid gap-6 lg:grid-cols-3"><div class="rounded-2xl border border-slate-100 bg-white p-5 shadow-card"><h3 class="font-display font-extrabold">Availability</h3><p class="mt-2 text-sm text-slate-500">Service radius: <?= esc($profile['service_radius_km']) ?> km</p><p class="mt-1 text-xs text-slate-400">Update your availability and service area to improve request matching.</p><a href="/practitioner/availability" class="mt-4 inline-flex text-xs font-bold text-teal-600">Edit availability →</a></div><div class="rounded-2xl border border-slate-100 bg-white p-5 shadow-card"><h3 class="font-display font-extrabold">Credentials</h3><p class="mt-2 text-sm text-emerald-700">Verification status: <?= esc(ucfirst($profile['verification_status'])) ?></p><p class="mt-1 text-xs text-slate-400">Keep licenses and credentials current to stay eligible for dispatch.</p><a href="/practitioner/profile" class="mt-4 inline-flex text-xs font-bold text-teal-600">Professional profile →</a></div><div class="rounded-2xl bg-navy p-5 text-white shadow-card"><h3 class="font-display font-extrabold">Clinical workspace</h3><p class="mt-2 text-sm text-white/65">Document visits, prescriptions and lab requests from one secure workflow.</p><a href="/practitioner/records" class="mt-4 inline-flex text-xs font-bold text-teal-200">Open clinical notes →</a></div></div></div>
