OK, I fixed it myself. When I came back to it clear-headed in the morning I found that all the menus, sidebars and widgets were still there, they just weren’t joined up. All I had to do was match up the sidebars with the widgets and hey presto! (almost) everything is back to normal.