<div class="node-result">
  <h5>{{ result.metadata.name }}</h5>
  <p class="text-muted">Type: <code>Filter</code> (mode: <code>{{ result.metadata.mode }}</code>)</p>

  {% if result.metadata.expression %}
  <p><strong>Expression:</strong> <code>{{ result.metadata.expression }}</code></p>
  {% endif %}

  {% if result.metadata.template %}
  <details class="mb-3">
    <summary><strong>LLM Template</strong> (click to expand)</summary>
    <pre class="mt-2"><code>{{ result.metadata.template }}</code></pre>
  </details>
  {% endif %}

  {% if result.stats_df is defined and not result.stats_df.empty %}
  <div class="card card-body mb-3">
    <h6>Filter Statistics</h6>
    {{ result.stats_df|df_to_html|safe }}
  </div>
  {% endif %}

  {% if result.included_items_df is defined and not result.included_items_df.empty %}
  <details class="mb-3">
    <summary><strong>Included Items</strong> - {{ result.metadata.included_count }} items (click to expand)</summary>
    <div class="mt-2">
      {{ result.included_items_df|df_to_html|safe }}
    </div>
  </details>
  {% else %}
  <p><em>No items passed the filter</em></p>
  {% endif %}
</div>
