While I sympathize with what is going on here, I can't help but be dismayed by the language used here. This child apparently thinks it is okay not only to use this type of language but use it while speaking to YOU, an adult. I'm quite sure my teen cusses occasionally, but it certainly wouldn't be to ME, or any other adult, that is quite disrespectful. And I think your husband keeping the child against court order is an extremely bad idea.
Normally she would NEVER use that language with Dad or I. Mom is the only one who allows it. The fact that she sent me a text using that language shows me how upset she is. Her and I have heart to hearts quite frequently when she's ar our house and I have only heard that language once before. Completely agreed on hubby not keeping kiddo.