12:20 PM PT -- According to R. Kelly's attorney Melvin L. Sims III ... despite the violations, the judge sided with the singer and rejected the City of Chicago's motion to shut the building down completely.
Kelly's legal team argued the problems with the studio did not mount to an "Emergency" situation, so instead, repairs were ordered along with the removal of personal items. Sims says the studio is still open for business as a studio during normal working hours.
R. Kelly is in serious trouble with Chicago officials because the city is going after him for a laundry list of building violations at his studio ... and it could end up costing the singer a ton of cash!!!
The Chicago studio, heavily featured in "Surviving R. Kelly" was slammed with 66 building code violations, most notably for using the place as a residence and not obtaining permits to build a sauna, steam room and a bar ... this according to legal docs.
In the docs, each violation comes with a fine ranging between $500 to $1,000 for each day the violation goes unaddressed ... and with 66 violations, R. Kelly could be looking at a fine between $33k to $66k per day!
The court has already ordered R. Kelly to remove all personal items from the premises and he can only use the space as a recording studio from 9 AM to 5 PM.
Fox 32 Chicago
As you know ... R. Kelly's studio was swarmed last week by Chicago cops and the Cook County Building and Zoning Department -- and they ended up filing a complaint against R. Kelly.
Sources close to R. Kelly deny he's ever lived in the studio and R. Kelly believes the space is exactly as it was when he first started renting it 3-4 years ago.