OP I can appreciate this is an awful, concerning situation, and I think that it's great that, as a step parent, you clearly care so much for your husbands daughter.
But your posts are filled with barbs at her mother and I find this concerning too. You don't approve of the way she lets her daughter dye her hair clearly, and everything you say points to the fact that you consider her to be slack.
My heart goes out to this girls mother. I cannot imagine what it must be like to be parenting a child so challenging, all on your own. If it was my daughter self harming, attempting suicide, being sexually exploited, then my heart would be breaking. But you don't sad - you just sound angry and down on her mother. If her mother is struggling this is understandable. What she needs is support.
Do you honestly believe it would be in your dsd's best interests to be separated from the woman who has been her main carer all her life to come and live with you? You have never cared for her full time - only for short periods - and so even though you clearly think you could do a much better job, you cannot know this for sure. You've never tried. A court will only change the status quo for a child so radically if the child is considered to be at risk of immediate harm by staying with the resident parent. You might think there's a case to be presented for this but I would imagine it to be far more likely the courts would rather your dsd avoid disruption (especially considering her issues) and her mother be given more support with monitoring her online behaviour. Her mother does not physically or sexually abuse her? I assume she is fed, clothed, kept warm, shown love and given appropriate affection? If so then her mothers parenting is good enough.
My last point is that is actually very very difficult to monitor entirely a childs online activity. You can keep internet use to family areas for small children, but once they are teenagers it isn't appropriate to be breathing down their necks all the time. You have to give them a certain amount of freedom and responsibility after having discussions with them about safe behaviour. You can check internet history but it can be deleted. You can put parental controls in but they are actually quite easy to get around. And ultimately you have to make decisions about just how invasive and intrusive you are prepared to be.
I have three children. When my teenage son was just eleven years old his father and I discovered that he had been accessing online porn, sharing pictures with his friends and having discussions about them that I found distasteful, and that he had sent a picture of his genitals to someone as part of an online discussion. This person was pretending to be a girl of a similar age but who knows. His father and I live apart and were both horrified. It turned out he had been staying up late into the night on his ipod touch doing all this stuff. I just had no clue. It had never even occurred to me that at his age any of this stuff might be an issue. I thought he was going to bed and going straight to sleep 
It was a wake up call. We called the police and took advice. We confiscated his ipod touch and talked to him a great deal about porn and about internet safety. I felt absolutely dreadful. I knew it was my bad - I should have monitored his internet usage more closely, I should have checked he was asleep after I tucked him in.... I went through all the self flagellation.
You know what his father didn't do? He didn't call me a shit parent. He didn't get angry with me. He didn't try to imply in any way that it was all my fault. He saw how devastated I was and how guilty I felt and he offered support and comfort. We discussed appropriate boundaries together. He knew I was a loving mother, doing her best, who had dropped a ball, and decided that it was best for our son for us to be presenting a united front. He had my back.
You seem to lack empathy for the mother, is all I'm saying. Your dsd needs all the adults in her life to be singing from the same hymn sheet if at all possible. Not fighting each other.