<h1>Platform Roles</h1>

<% if (forbidden) { %>
  <div class="alert alert-danger">Your role does not have permission to view platform roles.</div>
<% } else { %>

<div class="card">
  <p style="color:var(--muted);font-size:12px;margin:0 0 12px">
    These roles (lawyer, paralegal, staff, admin, ...) and the permissions each one grants are shared across every
    firm on the platform — a firm has no way to customize its own set, and changing one here changes it everywhere.
    Moved here from the firm-facing Settings &gt; Roles page for exactly that reason.
  </p>
  <table>
    <thead><tr><th>Role</th><th>Description</th><th>Permissions</th><th></th></tr></thead>
    <tbody>
      <% for (const r of roles) { %>
      <tr>
        <td><code class="mono"><%= r.name %></code></td>
        <td><%= r.description || '—' %></td>
        <td><%= (r.permissions || []).length %></td>
        <td><a href="/platform-roles/<%= r.id %>">View / edit</a></td>
      </tr>
      <% } %>
      <% if (!roles.length) { %><tr><td colspan="4" style="color:var(--muted)">No roles found.</td></tr><% } %>
    </tbody>
  </table>
</div>

<% } %>
