I tried to install the latest MacOS and the installation failed because there was no enough space. From there on every time I try log in to my account a status bar appears and then the whole system shuts down. Same thing happens in Safe mode.
In recovery mode I tried a clean OS install but the wizard said that there is 0kB free on my disk. I imagine the installer from the previous upgrade attempt is still somewhere on my disk, taking up a lot of space.
So I tried launching a terminal and deleting random unneeded files.
After having deleted probably between 500 and 1000 MB of data, I tried restarting and logging in, but the system shuts down at the same point in that login status bar.
FileVault is enabled on my laptop.
How can I recover my laptop?