tePalette(count, 'vibrant', state.baseColor);
    }

    
    function rebuildColumnSelectors() {
      const headers = state.headers.length ? state.headers : state.rows[0].map((_, i) => `Column ${i+1}`);
      const labelSel = $('#labelColumn');
      labelSel.innerHTML = headers.map((h, i) => `<option value="${i}">${escapeHtml(h)}</option>`).join('');
      labelSel.value = String(Math.min(state.labelColumn, headers.length - 1));

      const valueSel = $('#valueColumn');
      valueSel.innerHTML = header