the laws of yichud get quoted all the time, but where do they actually come from and what do they really cover?

1. the source: is yichud d’oraisa or d’rabbanan, and what is the underlying reason, a safeguard against arayos or something broader about how men and women interact?

2. the actual rules: when does being in a room together become yichud? does a locked door matter, an open door to the street, other people nearby, cameras, an office with glass walls? and how do the common heterim work, like a wife in the city or children present?

3. mixed spaces that are not secluded at all: is there any issue with men and women simply being in the same room, at work or at a simcha, when there is no seclusion, or is yichud only about being alone together?

side question: pirkei avos says ואל תרבה שיחה עם האשה, do not engage in too much conversation with women, and the mishna says this was said even about one’s own wife, kal vachomer another’s (avos 1:5). how literally is that meant, what counts as too much, and how does it fit with normal marriage and normal life today?