Why plural days and nights in Spanish greetings?

Language Log 2013-04-29

R.R. points out that many European languages have a greeting that means "good day" — German "guten tag", Dutch "goeden dag", Swedish "god dag", French "bonjour", Italian "buon giorno", Portuguese "bom dia", Catalan "bon dia", etc. — and asks why (only?) in Spanish, the corresponding phrase is plural: "buenos dias". And also "buenas noches", "buenas tardes".

A related question might be where all of these greetings came from — they certainly seem to be post-classical, replacing Latin "ave", "salve" etc. Was there a greeting based on dies in vulgar Latin? Did all the "good day" forms come from Germanic? When did the Castilian forms become plural? Were there ever plural variants in other Romance dialects?