tag.trim();
                if (tag && !selectedTags.has(tag)) {
                    selectedTags.add(tag);
                    const pill = document.createElement('div');
                    pill.className = 'tag-pill';
                    pill.textContent = tag;
                    const removeBtn = document.createElement('span');
                    removeBtn.className = 'remove-tag';
                    removeBtn.textContent = 'Ã—';
                    removeBtn.onclick = () => {
                    