When users click on one of the tab labels, the background color of the selected tab label should change to white to match the content’s background, and the label text should be white. I thought the last selector should do the job but it does not.
There is no parent, or previous sibling selector in CSS.
The general sibling selector (~) matches elements that are siblings of a given element, that come after it in the markup. It can’t go backwards/up the DOM.
To achieve what you’re describing you would either need to change the markup so that the label comes after the radio, or use JavaScript.