<!-- Pipeline Query Results Partial: swapped into #query-results after POST -->
{% if error %}
<div class="query-error">
  <strong style="display:block;margin-bottom:4px">Query error</strong>
  {{ error }}
</div>
{% elif columns %}
<div class="results-meta">
  <span>{{ row_count | default(0) }} row{{ 's' if row_count != 1 }}</span>
  <span style="color:#CBD5E1">·</span>
  <span>{{ "%.1f" | format(elapsed_ms) }} ms</span>
  {% if truncated %}
  <span class="results-truncated">Result truncated at {{ row_count }} rows</span>
  {% endif %}
</div>
<div class="results-table-wrap">
  <table class="table">
    <thead>
      <tr>
        {% for col in columns %}
        <th>{{ col }}</th>
        {% endfor %}
      </tr>
    </thead>
    <tbody>
      {% for row in rows %}
      <tr>
        {% for val in row %}
        <td class="mono" title="{{ val if val is not none else 'null' }}">
          {% if val is none %}
          <span style="color:#CBD5E1">null</span>
          {% else %}
          {{ val | string | truncate(60, true) }}
          {% endif %}
        </td>
        {% endfor %}
      </tr>
      {% endfor %}
    </tbody>
  </table>
</div>
{% else %}
<div style="padding:1.5rem;text-align:center">
  <p class="text-sm text-slate">Query returned no rows.</p>
</div>
{% endif %}
