How I built the AI chat widget in CitizenApp — a floating React component that sends natural language questions to Claude, optionally executes safe live SQL queries, and renders the results inline. Architecture decisions, pitfalls, and patterns that generalize.