A Causal Inference Framework for Leveraging External Controls in Hybrid Trials