diff --git a/src/routes/admin/pets/[id]/+layout.server.ts b/src/routes/admin/pets/[id]/+layout.server.ts
new file mode 100644
index 0000000..34e2e94
--- /dev/null
+++ b/src/routes/admin/pets/[id]/+layout.server.ts
@@ -0,0 +1,31 @@
+import type { LayoutServerLoad } from './$types';
+import { db } from '$lib/server/db';
+import { pets, petPhotos, petMedical, fosterAssignments } from '$lib/server/schema';
+import { eq, count } from 'drizzle-orm';
+import { error } from '@sveltejs/kit';
+import { hasPermission, canViewPets } from '$lib/roles';
+
+export const load: LayoutServerLoad = async ({ params, locals }) => {
+ if (!canViewPets(locals.user!.role)) error(403, 'Access denied');
+ const id = parseInt(params.id, 10);
+ if (isNaN(id)) error(404, 'Pet not found');
+
+ const [pet] = await db.select().from(pets).where(eq(pets.id, id));
+ if (!pet) error(404, 'Pet not found');
+
+ const [photosCount, medicalCount, fostersCount] = await Promise.all([
+ db.select({ total: count() }).from(petPhotos).where(eq(petPhotos.petId, id)),
+ db.select({ total: count() }).from(petMedical).where(eq(petMedical.petId, id)),
+ db.select({ total: count() }).from(fosterAssignments).where(eq(fosterAssignments.petId, id))
+ ]);
+
+ return {
+ pet,
+ canEditPets: hasPermission(locals.user!.role, 'pets'),
+ counts: {
+ photos: photosCount[0]?.total ?? 0,
+ medical: medicalCount[0]?.total ?? 0,
+ fosters: fostersCount[0]?.total ?? 0
+ }
+ };
+};
diff --git a/src/routes/admin/pets/[id]/+layout.svelte b/src/routes/admin/pets/[id]/+layout.svelte
new file mode 100644
index 0000000..14fbdb3
--- /dev/null
+++ b/src/routes/admin/pets/[id]/+layout.svelte
@@ -0,0 +1,63 @@
+
+
+
Species
+{pet.species}
+Sex
+{pet.sex}
+Breed
+{pet.breed ?? '—'}
+Age
+{pet.age ?? '—'}
+{pet.description}
+No foster placements yet
+Add the first placement using the form above.
+{assignment.notes}
+ {/if} +No medical records yet
+Add the first record using the form above.
+{record.notes}
+ {/if} +No photos yet
+ {#if canEdit}Upload the first photo using the form above.
{/if} +