Task to rework decade old webpage, how to begin?

I’m trying to rework decade old webpage that is still actively developed. It is loosely based on certain design but coders had lot of freedom when doing CSS sizing, colors, naming and formatting.

Problem is that for example in certain pages certain CSS class for input page may work, but on another it goes over text in page. If I add margin in that page it works, but then other pages have too much margin around the input.

I’m trying to create a style guide with strict rules to standardize sizing, naming, typography, etc. However the task feels enormous and right now if I try to fix something it seems to break something else.

Have you done similar tasks and how did you begin / progress with it?