庙堂 was the hall of the imperial ancestral temple, where the emperor made sacrifices and held council, so it came to stand for the court and high office. Its opposite is
江湖 (rivers and lakes), life far from court, as in Fan Zhongyan's
居庙堂之高则忧其民,
处江湖之远则忧其君.