Fundamental limits to the optical response of lossy media