EU power to cut funds over rule-of-law concerns is legal, top EU court adviser says