I think I figured it out myself and will share it here in case someone is trying to do the same. Inspired by this thread: Dashboard element css classes - #13 by Steve-Mcl
To target an individual node, use its node id (found in the sidebar under the Info tab), e.g.
<style>
[node-id="00000x00.x000x0"] {border: {{((msg.payload === "something")) ? 'red' : 'transparent'}} 1px dashed;}
</style>
Hope it helps~