What tool should I use to remove a screw from cramped spaces?
Assuming you are okay with the nut falling once removed, you could try an offset ratchet wrench similar to these



There are a wide variety of types, styles and price points.

 Images and links for reference only. Not an endorsement of any goods or sources.