/**
 * Auto-submit: submits the parent form when a [data-auto-submit] element changes.
 * Replaces inline onchange="this.form.submit()" handlers for CSP compliance.
 */
document.querySelectorAll('[data-auto-submit]').forEach((element) => {
  element.addEventListener('change', () => {
    const form = element.closest('form');
    if (form) {
      form.submit();
    }
  });
});
