Instead, the <style> or whatever appears inside a custom tag, and they don't seem to work there.
Partial example:
sc.page_dashboard(
ui.tags.head(
ui.tags.style(
"""
body > shiny-dashboard > shiny-tab:nth-child(1) > shiny-grid > shiny-card:nth-child(2) {
--card-bg: red;
border: 1px solid blue !important;
}
"""
),