Style formatting title works in preview but not once saved. Why?

I use the style formatting on all my cards to reduce the size of the title and the dead space above/below it, but for some reason once I added the section divider, the style no longer works once I save the changes (preview is correct though).

Preview

Once saved (see difference between two sizes):

type: custom:auto-entities
card:
  title: Water Leak Sensors
  style: |
    .card-header {
    font-size: 18px;
    padding: 2px 15px 2px 15px
    }
  type: entities
filter:
  include:
    - type: section
    - entity_id: sensor.*_leak_sensor_battery
      sort:
        method: state
        numeric: true
        reverse: true