All at sea
In a state of confusion and disorder.
This is an extension of the nautical phrase 'at sea'. It dates from the days of sail when accurate navigational aids weren't available. Any ship that was out of sight of land was in an uncertain position and in danger of becoming lost.
'At sea' has been in use since the 18th century, as here, in Sir William Blackstone's Commentaries on the laws of England, 1768:
"If a court of equity were still at sea, and floated upon the occasional opinion which the judge who happened to preside might entertain of conscience in every particular case."
The earliest reference to 'all at sea' in print that I can find is from Travel and adventure in south-east Africa, 1893, by Frederick C. Selous:
"I was rather surprised to find that he seemed all at sea, and had no one ready to go with me."
See other Nautical Phrases.