Globally optimized SVD compression of LLMs via Fermi-function-based rank selection and gauge fixing