It is okay to turn off water to the toilet overnight.
While it's okay to turn off water to your toilet overnight it's not really needed unless your toilet flapper is leaking or your toilet keeps running.
As long as your toilet fill valve and toilet flapper are in good shape then turning the water off to the toilet overnight could be more hassle than it's worth.
But if your toilet flapper is not sealing properly or your toilet tank valve won't shut off then shutting the water off to the toilet overnight or when not in use is a good thing.
Toilets that constantly run or have a leaky toilet flapper can raise water bills up into the hundreds of dollars a month.
But if your toilet is not shutting off you should as soon as possible replace the toilet fill valve and toilet flapper as it can save you money in the long run.
I replace my toilet flapper after 5 years regardless if it's still sealing or not as it's much cheaper than a high water bill, especially when you replace the toilet flapper yourself which is easy to do.
I also replace the toilet fill valve at the same time which costs around $10.00 and my time.
Well worth it for peace of mind that the toilet will continue to work properly and shut off as it should.
I do however always shut the toilet valve off when away from the house longer than a few days.
But if gone from my house longer than a week I shut the water off to the house and turn the water heater off as well.