What is the ruling regarding joking with the opposite gender if they are within legal bounds and will not lead to haram?

Scholars have ruled that joking with the opposite gender is haram.

Yes, some have said that if it’s a professional joke and no lustful intentions are involved then it’s ok