/** * Computes months of runway from cash, reserves, and burn rate * Formula: (cash + savings) ÷ average monthly burn in scenario */ export const useRunway = () => { const calculateRunway = (cash: number, savings: number, monthlyBurn: number): number => { if (monthlyBurn <= 0) return Infinity return (cash + savings) / monthlyBurn } const getRunwayStatus = (months: number): 'green' | 'yellow' | 'red' => { if (months >= 3) return 'green' if (months >= 2) return 'yellow' return 'red' } const formatRunway = (months: number): string => { if (months === Infinity) return '∞ months' return `${months.toFixed(1)} months` } return { calculateRunway, getRunwayStatus, formatRunway } }