From Optimization to Generalization: Fair Federated Learning against Quality Shift via Inter-Client Sharpness Matching