I can think of at least three things that will cause chocolate to seize - which refers to when melted or melting chocolate suddenly becomes hard again:
Using too high a heat. Double-boiler is the safest, but you can use a saucepan on very low heat.
Sugar bloom and other impurities. You shouldn't get this with baker's chocolate, but if you use any lower-quality chocolate, this can seep into the melting chocolate and cause it to seize.
Contact with moisture! Even a tiny amount will cause it to immediately seize, and it's difficult to recover at that point.
Sounds like you fell into traps #2 and #3 and possibly #1. I would not melt chocolate in margarine; I'd even be wary of melting it in butter, and find it strange that a recipe would call for that, because both butter and margarine contain water!
Melting chocolate in a liquid can actually help prevent seizing, but you have to use a lot of liquid and the liquid has to be completely melted before you start trying to melt the chocolate. It's better to use something like a vegetable oil which has no water content if this is what you're trying to do.
So, in summary:
Definitely stay away from the margarine. Even if you need to use butter, make sure it's completely melted first and try to use only the fat (clarify it).
If you can, melt the chocolate and clarify the butter separately and then whisk them together gradually afterward; not only will this help to prevent seizing, but if commenter @roux is correct and the problem isn't one of seizing, this will still help to guarantee that the chocolate melts evenly.
Use the best quality chocolate you can find. Chipits are generally OK to melt on their own, but if they've been sweetened then this may contribute to seizing if other factors are present.
Melt in a double-boiler or on very low heat.
Very simple: don't store your chocolate in the fridge. The ideal temperature for setting chocolate is 20°C. You can store it at less or more than that, but not too much. Setting in the fridge results in bad chocolate. Remember, when you work with chocolate, exact temperatures are extremely important.
Here a loose translation from a good article on chocolate/couverture coating:
This is the usual case. You only want a temperature difference of 12° to 13° between the chocolate and its environment as well as between the chocolate and the confect interior.
If the interior is colder than the room, the setting will happen "inside out". The cocoa butter film which gives a confect its shine will build on the inside, leaving the outside looking dull.
This is a really good case for some types of confect, but you can't do it with most types of filling (definitely not with strawberries). Cooling from the outside gives you a beautiful shine.
If you want to achieve a good shine, it is possible to put the confects in the fridge for a short time, but only after they have cooled to 20°C at room temperature. Don't let them fall to fridge temperature, take them out at 15°C. The continued cooling from the outside is beneficial.
This shouldn't happen. The temperature difference is too small, and the confect doesn't set quick enough. In this case, cocoa butter pools on the surface and creates a yellowish layer after it hardens.
When you make your confect, you should time the first piece. The setting should need 10 minutes. If it is less, you don't get all the possible shine. If it needs more, it will get grey or whitish yellow.
Best Answer
Chocolate is a sol, consisting of solid particles suspended in cocoa butter. It is something similar to a hard emulsion. And it can separate just the way a liquid emulsion does (think mayonnaise). This happens when you melt the cocoa butter completely, so the solid particles separate from the fat. If it happens to a chocolate bar, your chocolate looks grey. If it happens to a bowl of melted chocolate, the chocolate seizes the way you describe it. This happens with both milk and dark chocolate. If you haven't experienced it with milk chocolate before, you either had luck, or your milk chocolate was of a lesser quality than the dark one and contained non-cocoa fats and/or emulsifiers, which change the behavior of the sol.
The only way to prevent seizing is to work within the correct temperature zone, which is extremely narrow (2-3°C). Even as an experienced confiseur, it is extremely hard to judge it intuitively. If you insist on trying to watch the chocolate and guess when it is OK, you will have inconsistent results, with a seizing once every few tries.
What you need is to get a candy thermometer. Keep it in the chocolate and, whenever the temperature nears the danger zone, put the inner bain marie vessel in a basin of cold water you keep near the stove for this purpose. It will cool rapidly and stay tempered. It isn't a problem if you cool it off so much it hardens again; you can remelt chocolate as often as you want as long as you never exceed the seizing temerature.
And now for the numbers. All kinds of chocolate (milk, white, bitter) harden at 27°C. Between 27°C and 30°C, they are soft, but unworkable, because they are too viscous (hold unpacked chocolate pieces in your hand for a while to see what I mean). The workable zone is 30°C to 32°C for milk (and white) chocolate, and 30°C to 33°C for dark chocolate. Above this, your cocoa fat melts and the chocolate seizes. So, keep an eye at the thermometer, as you see, the zones are narrow.
Edit: I just noticed that you call 40% "bitter". This is a very low cocoa percentage, and I wouldn't let it go up to 33°C. The numbers for "bitter" are probably safe for 70% cocoa and above.