Quantum phase transitions in heavy fermion metals and Kondo insulators