The dress code in Nicaragua will depend on where you are.
Here in San Juan Del Sur, the dress code is very casual for foreigners. In fact, we look very sloppy compared to Nicaraguans because we're in vacation and in a relaxed mode.
My typical dress day-to-day consists of simple clothing such as cotton shorts, a cotton tank top, flip-flops, and a little sundress; nothing fancy.
If you do put on a nicer blouse or dress and you go out for just happy hour or you're walking around in the afternoon, it's not uncommon for someone to ask you where you're going or what you're doing and say, "Are you going to a wedding? Why are you so dressed up?"
Locals, on the other hand, when they go into a bank, they're always wearing long pants for men, closed shoes, taking their hats off when they enter and also when they go into any government office. Locals take more pride in their appearance than most of us foreigners who are living here in San Juan Del Sur.
On the rare occasion that we travel to Managua, we wear long pants and put on our nicer clothes because that is more acceptable and common in the city to be more properly dressed. I would feel out of place if I were to show up at a restaurant or a shopping mall in Managua with my beach attire on.
Granada is not as casual as San Juan Del Sur, but definitely not as dressed up as Managua.
If you're a fashionista and you want to go to Nicaragua, you will fit right in in Managua or some of the bigger cities. When I've been in the shopping malls or restaurants in Managua, men are dressed well, as are women, with heels, designer handbags, designer watches, hair done nice, and with full make up on. They're dressed very similar how I would dress if I were in the city of Calgary where I used to live.
(US expats with Nicaragua shopkeepers and friends, San Juan del Sur, Nicaragua, pictured.)