please try first, and present us with the outcome of your results? scroll down to the end of this post 🔹 Card-mod - Add css styles to any lovelace card - #1188 by Ildar_Gabdullin and see all options.
to get you on track:
- entity: sensor.backup_state
card_mod:
style: |
:host {
--card-mod-icon:
{% if states(config.entity) == 'backed_up' %} mdi:check-circle
{% else %} mdi:alert-circle
{% endif %};
--paper-item-icon-color:
{% if states(config.entity) == 'backed_up' %} green
{% else %} red
{% endif %};
}
adapt to your liking ofc.