{% extends "ui/templates/base/layout.html" %}
{% block content %}
<div class="rounded-2xl bg-white p-6 shadow-card ring-1 ring-slate-200">
  <div class="flex items-center justify-between gap-3"><div><h2 class="text-xl font-semibold text-slate-900">Email Logs</h2><p class="mt-1 text-sm text-slate-500">Last 100 outgoing email attempts.</p></div><a href="/email/settings" class="rounded-xl border border-slate-300 px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50">Settings</a></div>
  <div class="mt-6 overflow-x-auto"><table class="min-w-full divide-y divide-slate-200 text-sm"><thead><tr class="text-left text-xs uppercase tracking-wide text-slate-500"><th class="py-2">Created</th><th>Sent</th><th>To</th><th>Template</th><th>Subject</th><th>Status</th><th>Error</th></tr></thead><tbody class="divide-y divide-slate-100">{% for log in logs %}<tr><td class="py-2 text-slate-500">{{ log.created_at_utc }}</td><td class="text-slate-500">{{ log.sent_at or '-' }}</td><td>{{ log.recipient_email }}</td><td>{{ log.template_code or '-' }}</td><td class="max-w-sm truncate">{{ log.subject }}</td><td><span class="rounded-full bg-slate-100 px-2 py-1 text-xs font-semibold">{{ log.status }}</span></td><td class="max-w-sm truncate text-red-600">{{ log.error_message or '' }}</td></tr>{% else %}<tr><td colspan="7" class="py-8 text-center text-slate-500">No email logs found.</td></tr>{% endfor %}</tbody></table></div>
</div>
{% endblock %}
