export function hexToRgba(hex: string, alpha: number): string | null { const clean = hex.replace('#', ''); if (!/^[0-9a-fA-F]{6}$/.test(clean)) return null; const r = parseInt(clean.substring(0, 2), 16); const g = parseInt(clean.substring(2, 4), 16); const b = parseInt(clean.substring(4, 6), 16); return `rgba(${r}, ${g}, ${b}, ${Math.max(0, Math.min(1, alpha))})`; }