Dashboard got its knickers in a twist - how do I access the code?

I have had a number of problems with my dashboard (Lovelace + Mushroom) that I cannot fix though the UI, so I would like to access the code. However, I cannot find it despite info from other postings here and elsewhere. Is it hidden and if so how do I unhide it?

Some of the problems are

  1. I have two views called “lights” one of which is genuine, the other of which is a copy of the home dashboard (default view). I have no idea how that came about but if I delete the false “lights” view it deletes the home dashboard as well.

  2. When logging in on a phone through the app, only one view (“TV”) is displayed and there is no way of navigating to the home dashboard. I tried deleting that view but now the user just sees a blank page.

  3. When I deleted the problematic “TV” view, a random chunk of the home dashboard (a grid within a vertical stack) disappeared. I restored the system from a backup taken before the deletion but it did not fix the problem.

Other than rebuild my entire dashboard set, what can I do to fix these problems and avoid their recurrence?