How to hide empty callouts

Hi all!

What I’m trying to do

I use callouts in which I have dataview and task queries.
However, I want to hide the callouts when the rendered list is empty.

Things I have tried

I found this bit of CSS code that hides H6 without lists:

I rewrote it to callouts:

div.HyperMD-callout:not(:has(+ div>div.block-language-tasks>div>ul>li)),              
div:has(> .callout):not(:has(+ div>div.block-language-tasks>div>ul>li)) {
 display: none !important;
}

div:has(> div.block-language-tasks):not(:has(li)) {
 display: none !important;
}

This however will hide all callouts that have text in stead of lists in them. Worse, it seems to hide even callouts that DO contain lists.

Anybody any ideas please?