Sex after miscarriage

I had a missed miscarriage and waited for a natural and I believe I've passed all or most but I've been bleeding for two weeks... Is this normal? I wonder when it's safe to have sex too? Not that I want to while I'm bleeding but I don't know how long this is going to last.. 😔