{% if dlux_is_public_index and APP_CONFIG.security.public_root_meta_description %}{% endif %}
{% if dlux_is_public_index and APP_CONFIG.security.public_root_title %}
{{ APP_CONFIG.security.public_root_title }}
{% else %}
{{ APP_CONFIG.identity.display_name|default:"DjangoLux" }} | {% block title %}{% endblock %}
{% endif %}
{{ user_preferences|json_script:"user-prefs-data" }}
{{ DLUX_STRINGS|json_script:"dlux-strings-data" }}
{{ DLUX_THEME_NAMES|json_script:"dlux-theme-names" }}
{{ config|json_script:"dlux-config-data" }}
{{ font_families|json_script:"dlux-font-families" }}
{% if CURRENT_DIR == 'ltr' %}
{% else %}
{% endif %}
{% for theme in DLUX_THEMES %}
{% endfor %}
{% load dlux_tags %}
{% include_if_exists 'dlux/includes/custom_head.html' %}
{# Form-field CSS is loaded globally (once) so forms opened in the dynamic #}
{# modal from any page โ not just dlux/form_base.html pages โ are styled. #}
{% include_once 'dlux/forms/assets_head.html' %}
{% block extra_head %}{% endblock %}
{% block titlebar %}
{% if not hide_titlebar_for_public_index %}
{% include 'dlux/includes/titlebar.html' %}
{% endif %}
{% if user.is_authenticated and titlebar.user_hub_style != 'titlebar_actions' %}
{% include 'dlux/users/user_hub.html' %}
{% endif %}
{% endblock %}
{% block layout %}
{# Use the sidebar+main chrome for authenticated users and for anonymous #}
{# public-root visitors when the sidebar is explicitly shown there. #}
{% if request.user.is_authenticated or dlux_show_sidebar %}
{% if dlux_show_sidebar %}
{% include 'dlux/includes/sidebar_items.html' %}
{% endif %}
{% if request.user.is_authenticated %}{% dlux_navbar %}{% endif %}
{% else %}
{% endif %}
{% include 'dlux/includes/messages.html' %}
{% block content %}{% endblock %}
{% if request.user.is_authenticated or dlux_show_sidebar %}
{% else %}
{% endif %}
{% endblock %}
{# Global footer: faint copyright/credit strip pinned to the bottom of the #}
{# viewport. Override this `footer` block per page, drop a custom_footer.html #}
{# partial, or set DLUX_STRINGS.footer_text to customise. See footer.html. #}
{% block footer %}
{% include 'dlux/includes/footer.html' %}
{% endblock %}
{% include_if_exists 'dlux/includes/custom_scripts.html' %}
{# Form-field JS (scan button, file widget) loaded globally (once), after #}
{# Bootstrap, so dynamic-modal forms work on any page. Initializers are #}
{# idempotent / MutationObserver-based and no-op when no form is present. #}
{% include_once 'dlux/forms/assets_scripts.html' %}
{% block scripts %}{% endblock %}
{% if request.resolver_match.url_name != 'login' %}
{% include 'dlux/includes/tutorial.html' %}
{% endif %}
{% include 'dlux/helpers/dlux_context_menu.html' %}
{% include 'dlux/helpers/dynamic_modal.html' %}
{% if DLUX_SHOW_INITIAL_USER_SETUP %}
{# First-login Initial User Setup: auto-opens the dlux dynamic modal once per user. #}
{% endif %}