Your question is Refactor Legacy Code to Modularity. Take a moment with it on the right.
Talk me through your thinking if you like. When you're confident, submit your answer and I'll grade it like a real screen (7/10 or better passes).
Walk through how you would refactor a legacy, tightly coupled codebase to make it highly testable and modular.
Explain how you would identify architectural seams, define module and layer boundaries, introduce dependency injection, isolate external systems, and migrate incrementally without stopping delivery. Include the dependency direction, testing strategy, and trade-offs behind your proposed structure.