Place your drinks on a week and watch how much caffeine is in your blood at every hour. The page flags the nights where caffeine is still high at bedtime and the moments where a peak gets jittery.
One-compartment pharmacokinetics with first-order absorption, the standard textbook model for caffeine:
C(t) = ฮฃ Dยทka / (Vยท(kaโke)) ยท (eโkeยทฯ โ eโkaยทฯ)
ฯ = time since each drink ยท ka = 4 /h (peak โ 45 to 60 min after drinking) ยท ke = ln2 / half-life ยท V = 0.6 L/kg ร body weight ยท bioavailability โ 100 %. The week repeats, so Sunday evening caffeine carries into Monday morning.
The sleep line uses the EFSA (2015) opinion that about 100 mg (โ1.4 mg/kg) close to bedtime can lengthen time to fall asleep and shorten sleep. 1.4 mg/kg spread in 0.6 L/kg gives โ2.3 mg/L, independent of weight. The same opinion considers single doses up to 200 mg (โ3 mg/kg, so โ5 mg/L here) and 400 mg per day as no safety concern for healthy adults, which sets the โก line and the daily bar on the cards. Drake et al. (2013) found that 400 mg taken even 6 hours before bed cut total sleep by more than an hour.
Caffeine content varies a lot between cups (an espresso can be 40 to 100 mg) and half-life varies between people from ~2 h to over 10 h. Treat this as an intuition tool, not medical advice.
EFSA 2015, Scientific opinion on the safety of caffeine ยท Drake et al. 2013, J Clin Sleep Med