<div id="activity-panel" class="card" style="padding:1.5rem">
  <h2 class="text-sm font-bold text-slate mb-4" style="text-transform:uppercase;letter-spacing:.06em">Recent Activity</h2>
  {% if events %}
  <div style="display:flex;flex-direction:column;gap:10px">
    {% for ev in events %}
    <div class="flex gap-3 items-start">
      <span class="activity-dot activity-dot-{{ ev.event_type }}"></span>
      <div style="flex:1;font-size:0.8125rem">
        {% if ev.event_type == 'lead' %}
          <span class="font-semibold"><a href="{{ url_for('admin.lead_detail', lead_id=ev.ref_id) }}">New lead</a></span>
          {% if ev.actor %} from {{ ev.actor }}{% endif %}
          {% if ev.extra %} — {{ ev.extra }}{% endif %}
          {% if ev.detail %} <span class="text-slate">({{ ev.detail }})</span>{% endif %}
        {% elif ev.event_type == 'unlock' %}
          <a href="{{ url_for('admin.supplier_detail', supplier_id=ev.ref2_id) }}" class="font-semibold">{{ ev.actor }}</a>
          unlocked <a href="{{ url_for('admin.lead_detail', lead_id=ev.ref_id) }}">lead #{{ ev.ref_id }}</a>
          {% if ev.extra %} — {{ ev.extra }} credits{% endif %}
          {% if ev.detail and ev.detail != 'sent' %} <span class="text-slate">({{ ev.detail }})</span>{% endif %}
        {% elif ev.event_type == 'credit' %}
          <a href="{{ url_for('admin.supplier_detail', supplier_id=ev.ref2_id) }}">{{ ev.actor }}</a>
          {% if ev.extra and ev.extra | int > 0 %}<span class="text-slate">+{{ ev.extra }}</span>
          {% elif ev.extra %}<span class="text-slate">{{ ev.extra }}</span>{% endif %}
          {% if ev.detail %} <span class="text-xs text-slate">({{ ev.detail }})</span>{% endif %}
        {% endif %}
      </div>
      <span class="mono text-xs text-slate" style="flex-shrink:0">{{ (ev.created_at or '')[:10] }}</span>
    </div>
    {% endfor %}
  </div>
  {% else %}
  <p class="text-slate text-sm">No activity yet.</p>
  {% endif %}
</div>
