{# Project-level token overrides for the admin chrome.
#
# IMPORTANT: this partial is included AFTER `<link rel="stylesheet"
# href="/static/admin.css">` in `_base.html`. That ordering is the
# whole point — the framework stylesheet ships with `:root`, light,
# and dark token blocks, and a project override here wins ties on
# source order without needing `!important`.
#
# The selector list `html, html[data-rio-theme="light"],
# html[data-rio-theme="dark"]` is deliberate: it gives the override
# the same specificity as admin.css's per-mode blocks (0,0,1,1) so
# an override applies regardless of which theme state is active.
#
# When no fields are set on `AdminTheme`, no markup is emitted at
# all and admin.css is the single source of truth. #}
{% if has_theme_overrides %}
<style>
html,
html[data-rio-theme="light"],
html[data-rio-theme="dark"] {
{%- if accent_hex %}
--rio-accent: {{ accent_hex }};
--rio-accent-rgb: {{ accent_rgb }};
{%- endif %}
{%- if theme_bg %}
--rio-bg: {{ theme_bg }};
{%- endif %}
{%- if theme_surface %}
--rio-surface: {{ theme_surface }};
{%- endif %}
{%- if theme_text %}
--rio-text: {{ theme_text }};
{%- endif %}
{%- if theme_text_muted %}
--rio-text-muted: {{ theme_text_muted }};
{%- endif %}
{%- if theme_border %}
--rio-border: {{ theme_border }};
{%- endif %}
}
</style>
{% endif %}