@Fab3r I have successfully compiled a method using my original idea of data-index.
Basically I use an array method to derive the index of each message, then use an If-Then-Else column and a template column to derive the CSS for each message. Styling things one by one, which generates a much longer code compared to yours, but until :has is supported this would do.
You can find the copyable app here:
@Robert_Petitto @Jeff_Hager @Darren_Murphy though you would be interested in this for your Chat functions. It’s an inline list, so you can edit/delete at will.