Yes to both.
Heck, fly into a cloud on accident, you log it as PIC as well. IMC or VMC you log it if you are the solo manipulator of a SEL aircraft (unless a type rating is required, and I'm not aware of any 172 that requires a type

).
You are rated, SEL.
An endorsement is not a rating.