{# Filter bar #}
<div class="flex items-center gap-3 mb-4">
  <select class="text-sm px-2 py-1 rounded"
          style="background: var(--bg-surface); border: 1px solid var(--border-default); color: var(--text-primary);"
          hx-get="/dashboard/partials/findings/{{ project_id }}"
          hx-target="#tab-content"
          hx-include="[name='framework_filter'],[name='status_filter']"
          name="severity">
    <option value="all" {% if severity == "all" %}selected{% endif %}>All Severities</option>
    <option value="critical" {% if severity == "critical" %}selected{% endif %}>Critical</option>
    <option value="high" {% if severity == "high" %}selected{% endif %}>High</option>
    <option value="medium" {% if severity == "medium" %}selected{% endif %}>Medium</option>
    <option value="low" {% if severity == "low" %}selected{% endif %}>Low</option>
  </select>

  <select class="text-sm px-2 py-1 rounded"
          style="background: var(--bg-surface); border: 1px solid var(--border-default); color: var(--text-primary);"
          hx-get="/dashboard/partials/findings/{{ project_id }}"
          hx-target="#tab-content"
          hx-include="[name='severity'],[name='status_filter']"
          name="framework_filter">
    <option value="all" {% if framework == "all" %}selected{% endif %}>All Frameworks</option>
    {% for fw in frameworks_available %}
    <option value="{{ fw }}" {% if framework == fw %}selected{% endif %}>{{ fw }}</option>
    {% endfor %}
  </select>

  <select class="text-sm px-2 py-1 rounded"
          style="background: var(--bg-surface); border: 1px solid var(--border-default); color: var(--text-primary);"
          hx-get="/dashboard/partials/findings/{{ project_id }}"
          hx-target="#tab-content"
          hx-include="[name='severity'],[name='framework_filter']"
          name="status_filter">
    <option value="fail" {% if status == "fail" %}selected{% endif %}>Fail</option>
    <option value="manual" {% if status == "manual" %}selected{% endif %}>Manual Review</option>
    <option value="all" {% if status == "all" %}selected{% endif %}>All</option>
  </select>
</div>

{# Findings list #}
{% if error_message %}
<div class="p-4 rounded text-sm" style="background: var(--bg-surface); color: var(--text-muted);">
  {{ error_message }}
</div>
{% elif findings %}
<div class="space-y-3">
  {% for finding in findings %}
    {% include "partials/_finding_card.html" %}
  {% endfor %}
</div>

{% if has_more %}
<div class="mt-4 text-center">
  <button hx-get="/dashboard/partials/findings/{{ project_id }}?severity={{ severity }}&framework={{ framework }}&status={{ status }}&page={{ page + 1 }}&per_page={{ per_page }}"
          hx-target="#tab-content"
          hx-swap="innerHTML"
          class="px-4 py-2 text-sm rounded"
          style="background: var(--bg-surface-hover); color: var(--text-primary); border: 1px solid var(--border-default);">
    Load more
  </button>
</div>
{% endif %}

{% else %}
<div class="p-4 text-center text-sm" style="color: var(--text-muted);">
  No findings match the current filters.
</div>
{% endif %}
