An interesting fact about caffeine: it's half-life is about six hours. This means that six hours later, your body still contains about half the caffeine level you ingested with that cup of tea or coffee. And twelve hours later, still a quarter remains! This may explain why an innocent espresso with dinner is causing you to count sheep many an hour later.
Stan