<?php $pageTitle = 'Notifications'; ?>
<div class="page-heading"><div><p class="eyebrow">Activity Center</p><h2>Notifications</h2><p>Operational, accounting, border, and team alerts.</p></div><form method="post" action="<?= url('/notifications/read-all') ?>"><?= csrf_field() ?><button class="btn btn-light">Mark all read</button></form></div>
<section class="card notification-list">
<?php foreach ($notifications as $notification): ?>
    <article class="notification-item <?= $notification['read_at'] ? '' : 'is-unread' ?>">
        <div class="notification-level level-<?= e($notification['level']) ?>"></div>
        <div><strong><?= e($notification['title']) ?></strong><p><?= e($notification['message'] ?: '') ?></p><small><?= e(datetime_display($notification['created_at'])) ?></small></div>
        <form method="post" action="<?= url('/notifications/read') ?>"><?= csrf_field() ?><input type="hidden" name="id" value="<?= (int)$notification['id'] ?>"><input type="hidden" name="link" value="<?= e($notification['link'] ?: '/notifications') ?>"><button class="btn btn-light btn-sm"><?= $notification['link'] ? 'Open' : 'Mark read' ?></button></form>
    </article>
<?php endforeach; ?>
<?php if (!$notifications): ?><div class="empty-state">No notifications yet.</div><?php endif; ?>
</section>
