{% for log in logs %}
<tr class="hover:bg-gray-50 transition-colors {% if log.status >= 500 %}bg-red-50{% elif log.status >= 400 %}bg-amber-50/60{% endif %}">
  <td class="px-3 py-1.5 font-mono text-gray-500 whitespace-nowrap">{{ log.timestamp|date:"m/d H:i:s" }}</td>
  <td class="px-3 py-1.5 font-mono">
    <button class="text-indigo-600 hover:underline" onclick="setFilter('ip','{{ log.remote_addr }}')">{{ log.remote_addr }}</button>
  </td>
  <td class="px-3 py-1.5 text-gray-500 hidden sm:table-cell whitespace-nowrap">{{ log.geo_display }}</td>
  <td class="px-3 py-1.5">
    <span class="font-mono font-medium
      {% if log.method == 'GET' %}text-green-700{% elif log.method == 'POST' %}text-blue-700
      {% elif log.method == 'DELETE' %}text-red-700{% else %}text-gray-600{% endif %}">{{ log.method }}</span>
  </td>
  <td class="px-3 py-1.5 font-mono text-gray-700 max-w-xs truncate" title="{{ log.request_uri }}">
    <button class="text-left hover:text-indigo-600 hover:underline truncate max-w-full" onclick="setFilter('path','{{ log.request_uri|escapejs }}')">{{ log.request_uri }}</button>
  </td>
  <td class="px-3 py-1.5 hidden md:table-cell font-mono">
    {% if log.service %}<button class="text-indigo-600 hover:underline" onclick="setFilter('service','{{ log.service|escapejs }}')">{{ log.service }}</button>{% else %}—{% endif %}
  </td>
  <td class="px-3 py-1.5 text-right">
    <button onclick="setFilter('status','{{ log.status }}')"
            class="inline-block px-1.5 py-0.5 rounded font-mono font-semibold text-xs hover:opacity-75
      {% if log.status < 300 %}bg-green-100 text-green-800{% elif log.status < 400 %}bg-blue-100 text-blue-800
      {% elif log.status < 500 %}bg-amber-100 text-amber-800{% else %}bg-red-100 text-red-800{% endif %}">
      {{ log.status }}
    </button>
  </td>
  <td class="px-3 py-1.5 text-right font-mono text-gray-500 hidden lg:table-cell">{{ log.request_time|floatformat:3 }}s</td>
  <td class="px-3 py-1.5 hidden xl:table-cell">
    {% if log.note %}<span class="inline-flex items-center gap-1 px-2 py-0.5 rounded bg-red-50 text-red-700 text-xs font-medium" title="{{ log.note }}"><i class="fas fa-ban text-red-500"></i> {{ log.note }}</span>{% endif %}
  </td>
</tr>
{% empty %}
<tr><td colspan="8" class="px-3 py-8 text-center text-gray-400">No logs yet — use "Fetch Now" or wait for the scheduler.</td></tr>
{% endfor %}
