Some comments on it though.
1. when applying the css style to a template it gives some kind of session id to indicate that it is applied to a particular template. This should be changed to the name of the template if possible... or maybe a better notification that it was successful. I applied it a couple times because I thought that sessid was an error.
2. somehow I managed to duplicate the css styles in the database. I was trying to figure out how to unapply a style to a template and in the end I had 2 of the same css in there. And when I made a change to one of them it would occur on both. I looked in the sql file and it showed 2 of the same css items with the same name and some "???s" in the tables. So I deleted them and the associations and recreated the one I need.
3. some way of removing the association of a css style. Say you have a css style attached to a template but then you decide you want something completely different and only want the css in the template (I don't know why... I just might

That aside, I keep getting more and more impressed with this script!