Inspectors found a number of children were being held in custody for long periods despite being charged with “minor offences”.