/** API base URL from Vercel env; empty uses same-origin paths (Vercel rewrites → Render). */ export const API_BASE = (import.meta.env.VITE_API_URL ?? "").replace(/\/$/, ""); export function apiUrl(path) { const normalized = path.startsWith("/") ? path : `/${path}`; return `${API_BASE}${normalized}`; }