You are correct that CSS doesn't support conditions on it's own. That would have to be handled by adding or removing CSS classes using Javascript and JQuery.
As an example, you could have global function in a custom JS file that can be called as needed based on some UI event or EXEC_SCRIPT should work as well. I'm showing as a button click for illustration purposes.
****Render Script of your queries, forms or whatever****
$( "mybutton" ).click(function() {
var myElements = $("widgetid").find("elementtocheck");
colorMyNumbers (myElements);
});
*****Function in custom JS file*****
function colorMyNumbers( myElements ) {
$ ("myElements ").each(function() {
if ($(this).value() < 0 ) {
$(this).addClass("negative-number-class").removeClass("positive-number-class");
} else {
$(this).removeClass("negative-number-class").addClass("positive-number-class");
}
}
}
****Custom classes in custom CSS file****
.negative-number-class {
color: red;
}
.positive-number-class {
color: black;
}