Two modes: audit your daily caffeine intake against the FDA 400 mg safe limit (200 mg if pregnant), and model how much caffeine remains in your bloodstream N hours after consumption using the 5-hour half-life.
Caffeine pharmacokinetics: oral absorption is ~99% within 45 minutes; peak blood concentration at 30-60 min; elimination follows first-order kinetics with a half-life of 5 hours (range 3-7, longer in pregnancy and liver disease). Remaining caffeine after t hours = initial × 0.5^(t / 5). FDA safe upper limit is 400 mg/day for adults, 200 mg/day for pregnant women (ACOG). The "sleep-safe" threshold is ~50 mg in the blood at bedtime.
Disclaimer: Half-life varies 3-7 hours by genetics (CYP1A2), smoking status, oral contraceptives, and liver function. Caffeine-sensitive individuals should cut off intake 8-12 hours before bed. Not medical advice.