Here’s some further reading on intent as it relates to criminal law if you’re interested.
Any legal problems regarding sexual harassment at the workplace would, for one, be in civil proceedings, not criminal, which typically don’t require intent, and most importantly, almost certainly be the (legal) problem of the company and not you. You probably aren’t going to personally get sued because you made an off-color joke in front of the wrong person, but the company can absolutely get sued for having a hostile workplace under a variety of laws, for which your personal intent is entirely irrelevant.
Here’s some further reading on intent as it relates to criminal law if you’re interested.
Any legal problems regarding sexual harassment at the workplace would, for one, be in civil proceedings, not criminal, which typically don’t require intent, and most importantly, almost certainly be the (legal) problem of the company and not you. You probably aren’t going to personally get sued because you made an off-color joke in front of the wrong person, but the company can absolutely get sued for having a hostile workplace under a variety of laws, for which your personal intent is entirely irrelevant.