{% if patterns %}
  <table class="mc-table w-100">
    <thead>
      <tr>
        <th>ERROR TYPE</th>
        <th class="text-center">COUNT</th>
        <th class="text-center">CORRECTED</th>
        <th class="text-center">FAILED</th>
        <th>LAST SEEN</th>
      </tr>
    </thead>
    <tbody>
      {% for p in patterns %}
      <tr>
        <td class="sc-pattern-type">{{ p.error_type }}</td>
        <td class="text-center">
          <span class="badge {% if p.count >= 5 %}badge-error{% elif p.count >= 3 %}badge-warning{% else %}badge-info{% endif %}">{{ p.count }}</span>
        </td>
        <td class="text-center text-success">{{ p.success_count }}</td>
        <td class="text-center {% if p.failed_count > 0 %}text-danger{% else %}text-muted{% endif %}">{{ p.failed_count }}</td>
        <td class="sc-event-time">{{ p.last_seen[:16] if p.last_seen else '—' }}</td>
      </tr>
      {% endfor %}
    </tbody>
  </table>
{% else %}
  <div class="text-center text-muted py-3">No patterns detected yet.</div>
{% endif %}
