When does a period officially end?

Hail

My periods start with light spotting, to light flow on the first day, then to medium flow for 2 days, then it becomes light for 1 day, and ends in brown spotting (old blood) 1 day after. But does the old blood spotting still count even if it's not a steady flow and I have no period symptoms anymore ? Does a period technically end once there is no longer any blood of any kind?