<table>
    <thead>
        <tr>
            <th>Workflow</th>
            <th>File Path</th>
            <th>Status</th>
            <th>Current Step</th>
            <th>Error</th>
            <th>Updated</th>
        </tr>
    </thead>
    <tbody>
        {% for f in files %}
        <tr>
            <td>{{ f.workflow_name }}</td>
            <td class="truncate" title="{{ f.file_path }}">{{ f.file_path }}</td>
            <td><span class="badge badge-{{ f.status }}">{{ f.status }}</span></td>
            <td>{{ f.current_step or "-" }}</td>
            <td class="truncate" title="{{ f.error or '' }}">{{ f.error or "-" }}</td>
            <td class="text-sm">{{ f.updated_at }}</td>
        </tr>
        {% else %}
        <tr><td colspan="6" class="text-muted">No files found.</td></tr>
        {% endfor %}
    </tbody>
</table>

<div class="pagination">
    {% if offset > 0 %}
    <a class="btn" href="/files?offset={{ offset - limit }}&limit={{ limit }}&workflow={{ current_workflow or '' }}&status={{ current_status or '' }}">Prev</a>
    {% endif %}
    {% if has_next %}
    <a class="btn" href="/files?offset={{ offset + limit }}&limit={{ limit }}&workflow={{ current_workflow or '' }}&status={{ current_status or '' }}">Next</a>
    {% endif %}
</div>
