{% extends "base.html" %}
{% block title %}Users - Admin{% endblock %}
{% block content %}
<h1 style="margin-bottom:20px;">Users ({{ users|length }})</h1>
<div class="card">
{% if users %}
<div class="table-wrap">
<table>
<thead>
<tr>
<th>User</th>
<th>Email</th>
<th>Tier</th>
<th>Sites</th>
<th>Submissions</th>
<th>Joined</th>
</tr>
</thead>
<tbody>
{% for u in users %}
<tr>
<td>{{ u.name or '-' }}</td>
<td class="text-trunc" title="{{ u.email }}">{{ u.email }}</td>
<td><span class="badge badge-{{ u.tier }}">{{ u.tier_name }}</span></td>
<td>
{% if u.max_sites > 0 %}
{{ u.site_count }}/{{ u.max_sites }}
{% if u.site_count >= u.max_sites %}
<span style="color:#dc3545;font-size:11px;" title="At site limit — needs upgrade">⚠️ LIMIT</span>
{% endif %}
{% else %}
{{ u.site_count }} / ∞
{% endif %}
</td>
<td>
{% if u.max_subs > 0 %}
{{ u.sub_count }}/{{ u.max_subs }}
{% if u.sub_count >= u.max_subs %}
<span style="color:#dc3545;font-size:11px;" title="At submission limit — needs upgrade">⚠️ LIMIT</span>
{% endif %}
{% else %}
{{ u.sub_count }} / ∞
{% endif %}
</td>
<td>{{ u.created_at[:10] }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<p style="color:#888;text-align:center;padding:40px;">No users yet</p>
{% endif %}
</div>
{% endblock %}