CREATE TABLE IF NOT EXISTS leads (
  id INT AUTO_INCREMENT PRIMARY KEY,
  name VARCHAR(255),
  email VARCHAR(255),
  phone VARCHAR(50),
  partner_id VARCHAR(255),
  user_id INT,
  source ENUM('manual','registration','landing','referral','import') DEFAULT 'manual',
  status ENUM('new','contacted','qualified','converted','lost') DEFAULT 'new',
  notes TEXT,
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  INDEX idx_lead_partner (partner_id),
  INDEX idx_lead_status (status),
  INDEX idx_lead_email (email)
)
