{{define "tags_editor"}}
<div id="tags-editor">
  {{if .Tags}}
  <div style="display:flex;flex-wrap:wrap;gap:.3rem;margin-bottom:.75rem">
    {{range .Tags}}
    <span style="font-size:.8rem;background:#f1f5f9;padding:.2rem .5rem;border-radius:3px;font-family:monospace">{{.}}</span>
    {{end}}
  </div>
  {{else}}
  <p class="text-muted text-small" style="margin-bottom:.75rem">No tags assigned.</p>
  {{end}}
  <form hx-put="/accounts/{{.Account.UUID}}/tags"
        hx-target="#tags-editor" hx-swap="outerHTML">
    <textarea class="form-control" name="tags_text" rows="3"
              style="font-family:monospace;font-size:.85rem;margin-bottom:.5rem"
              placeholder="One tag per line, e.g.&#10;env:production&#10;svc:payments-api">{{range .Tags}}{{.}}
{{end}}</textarea>
    <button class="btn btn-sm btn-secondary" type="submit">Save Tags</button>
  </form>
</div>
{{end}}
