TOKYO - A court ordered the government on Thursday to pay damages to a transgender official, ruling that it was illegal for her workplace to impose restrictions on her use of women's toilets.