Character rotation/lean/tilt

I’m making a 3D top-down game, my character moves around with “WASD”,
and rotates on Z-axis to look at the cursor.
I’m trying to make my character tilt slightly towards the direction it’s moving
no matter which way it’s looking,
for example, if I’m moving to the right and looking right, the character’s face should tilt downwards,
and if I’m moving to the right and looking left the character should tilt backward, since its back is facing the direction I’m moving to.
this is what I tried, it tilts the character but it’s all messed up.