Help with code pleae

Hey,

Why wont this code work together, please? When i remove the style portion the icon changes, if i remove the :host portion, the color changes fine, together only the icon change works.

type: entities
entities:
  - entity: input_number.brightnessfirebl
    icon: mdi:account-group
    card_mod:
      style: |
        ha-card {
          background-color: 
            {% set vol = states('input_number.brightnessfirebl') | int %}
            {% if vol == 1 %} pink
            {% elif vol == 2 %} yellow
            {% elif vol == 3 %} green
            {% elif vol == 4 %} red
            {% endif %};
        }
        :host {
          --card-mod-icon: 
            {% set vol = states('input_number.brightnessfirebl')|float(0) %}
            {% if vol == 1 %} mdi:volume-off
            {% elif vol <= 2 %} mdi:volume-low
            {% elif vol <= 3 %} mdi:volume-medium
            {% else %} mdi:volume-high
            {% endif %};
        }

Similar questions better to ask in the main card-mod thread.

Sorry? Don’t understand

Also, the 1st post of this thread has a link at the bottom titled “fantastic” which contains useful examples.