High-resolution spectroscopy of flat-spectrum quasars I. Redshifted emission and absorption in PKS 2145+067