<div class="rounded-3xl border border-slate-200 bg-white p-5 shadow-soft">
  <div class="flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between">
    <div><h2 class="text-lg font-semibold text-slate-900">Branch Work Status</h2><p class="text-sm text-slate-500">Due dates, assignment and status for the current partner scope.</p></div>
    <a href="/work" class="rounded-2xl border border-slate-200 px-4 py-2 text-sm font-semibold text-slate-700 hover:bg-slate-50">Open Work Tracker</a>
  </div>
  <div class="mt-5 overflow-x-auto">
    <table class="min-w-full text-left text-sm">
      <thead class="text-xs uppercase tracking-wide text-slate-400"><tr><th class="px-3 py-2">Client</th><th class="px-3 py-2">Service / Task</th><th class="px-3 py-2">Due</th><th class="px-3 py-2">Assigned</th><th class="px-3 py-2">Status</th><th class="px-3 py-2">Action</th></tr></thead>
      <tbody class="divide-y divide-slate-100">
      {% for item in branch_work %}
        <tr class="hover:bg-slate-50"><td class="px-3 py-3"><div class="font-semibold text-slate-900">{{ item.client_name }}</div><div class="text-xs text-slate-500">{{ item.client_code }}</div></td><td class="px-3 py-3"><div>{{ item.service_name }}</div><div class="text-xs text-slate-500">{{ item.task_name }}</div></td><td class="px-3 py-3">{{ item.due_date or '-' }}{% if item.is_overdue %}<span class="ml-2 rounded-full bg-red-100 px-2 py-1 text-xs font-semibold text-red-700">Overdue</span>{% endif %}</td><td class="px-3 py-3">{{ item.assigned_to }}</td><td class="px-3 py-3"><span class="rounded-full bg-slate-100 px-2.5 py-1 text-xs font-semibold text-slate-700">{{ item.status_label }}</span></td><td class="px-3 py-3"><a href="{{ item.href }}" class="font-semibold text-brand-700">Open</a></td></tr>
      {% else %}
        <tr><td colspan="6" class="px-3 py-8 text-center text-slate-500">No branch tasks found.</td></tr>
      {% endfor %}
      </tbody>
    </table>
  </div>
</div>
