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

  {% if result.metadata.inputs %}
  <p><strong>Inputs:</strong> {{ result.metadata.inputs|join(', ') }}</p>
  {% endif %}

  {% if result.error %}
  <div class="alert alert-warning">
    <strong>Error:</strong> {{ result.error }}
  </div>
  {% else %}
  <p><strong>Clusters:</strong> {{ result.metadata.num_clusters }} clusters from {{ result.metadata.total_items }} items</p>

  {% if result.metadata.cluster_sizes %}
  <p><strong>Cluster sizes:</strong>
    min={{ result.metadata.cluster_sizes.min }},
    max={{ result.metadata.cluster_sizes.max }},
    mean={{ "%.1f"|format(result.metadata.cluster_sizes.mean) }}
  </p>
  {% endif %}
  {% endif %}
</div>
