Caffeine has a half-life of roughly five to six hours in a healthy adult, longer in older people, in pregnancy, and with certain medicines. A cup at three in the afternoon leaves half its caffeine at nine and a quarter at midnight. That quarter is enough to shorten deep sleep in many people who insist coffee never affects them.
What it feels like from inside
Falling asleep normally but waking at two or three, lighter sleep, more dreaming, an unrefreshed morning that is fixed with coffee, and the loop continues. Because the first hours of sleep are fine, caffeine is rarely suspected.
Where it hides
Tea, including green tea, cola, energy drinks, chocolate, some painkillers and cold remedies, and decaf, which is not caffeine-free. A large coffee-shop cup can hold two or three times what a home mug does.
Why it changes with age
The liver clears it more slowly, sleep becomes lighter anyway, and several common medicines slow the clearance further. The cup that was harmless at thirty can be the problem at sixty without any change in habit.
A simple experiment
Two weeks with nothing caffeinated after midday. Same amount in the morning, so there is no withdrawal headache. Note sleep on a phone or paper. If the two-in-the-morning waking eases, the answer was cheap. If it does not, caffeine can be ruled out and the search moves on.
What to raise, and what not to wait on
Worth mentioning at a routine appointment: poor sleep that has not responded to the midday cut-off, or a racing or irregular heartbeat after caffeine. Worth raising promptly: palpitations with chest pain, faintness or breathlessness, caffeine or not.