<div class="card">
  <div class="table-wrap">
    <table class="table">
      <thead><tr><th>Code</th><th>Name</th><th>Definition</th><th>Color</th><th></th></tr></thead>
      <tbody>
      <?php foreach ($priorities as $p) : $fid = 'pri-form-' . $p['id']; ?>
        <tr>
          <td><?= priority_badge($p) ?></td>
          <td><input type="text" name="name" form="<?= $fid ?>" value="<?= e($p['name']) ?>" style="min-width:120px"></td>
          <td><input type="text" name="definition" form="<?= $fid ?>" value="<?= e($p['definition']) ?>" style="min-width:260px"></td>
          <td><input type="text" name="color" form="<?= $fid ?>" value="<?= e($p['color']) ?>" style="width:90px"></td>
          <td>
            <form method="post" id="<?= $fid ?>" action="<?= url('/admin/priorities/' . $p['id']) ?>"><?= csrf_field() ?></form>
            <button class="btn btn-sm" form="<?= $fid ?>">Save</button>
          </td>
        </tr>
      <?php endforeach; ?>
      </tbody>
    </table>
  </div>
</div>
<p class="text-faint text-sm mt-3">The four-level priority scale (P1–P4) is fixed by the system so SLA arithmetic and reporting stay consistent (FR-SUP-013). Only the wording and colour shown to users are editable here.</p>
