There are two things here.
First, maybe ad hominem was historically born for using with individuals (I don't know about its history). But since its purpose is to point to a logical error, I don't see why one could not use it to refer to the same error, only applied to institutions. I don't know of a fallacy specific to insitutions, so I don't see a problem in referring to ad hominem.
Well, that said, there's the second thing. A fallacy is usually an error in argument. In this case, if one says "A because of B", I'm commiting ad hominem if I argue that it is wrong because the person saying is ugly. That is because the ugliness of a person is irrelevant to the argument's truth and validity.
Even if we use "stupid" instead of "ugly", it would still be a fallacy. Even though "stupidity" may hinder someone's capability of argumentation, their argument should be considered on its own merits.
But that doesn't mean that anything citing someone's characteristic is an ad hominem.
For example, if I say "A because of B", there is the premise B and the conclusion A. You could challenge my conclusion by saying that A logically does not follow B. Or you might challenge my premise B.
If you know I'm a pathological liar, and you don't know if B is true, then you have all the right to question my premise B based on my history of lying. So you can't say that my logic is wrong because I'm a regular liar, but you can doubt the truthness of B.
Yes, it is "against the person" in a way, but not necessarily irrelevant to the argument. Hence an ad hominem fallacy does not necessarily apply.