She doesn’t do the work? Fail her and boor her out of school! Where do they think they get the right to incarcerate her?
I wouldn't rule out the possibility that "the court" figured out that a juvenile detention center might provide a better environment for her than her home does.