<!doctype html>
{% set show_back_link = render_back_link|default(true) %}
{% set show_user_menu = render_user_menu|default(true) %}
<div class="app-header-actions">
  {% if show_back_link and back_href %}
    <a href="{{ back_href }}" class="ui-button ui-button--secondary">{{ back_label|default("Volver") }}</a>
  {% endif %}

  {% if show_user_menu and user %}
    <div class="dashboard-header__user" data-user-menu-root>
      <button
        type="button"
        class="dashboard-header__user-button"
        data-user-menu-button
        aria-expanded="false"
      >
        <span class="dashboard-header__user-badge">{{ user.username[:1]|upper }}</span>
        <span class="dashboard-header__user-meta">
          <strong>{{ user.username }}</strong>
          <small>{{ "Administrador" if user.role == "admin" else "Auditor" }}</small>
        </span>
        <svg viewBox="0 0 24 24" aria-hidden="true">
          <path d="m7 10 5 5 5-5" />
        </svg>
      </button>
      <div class="dashboard-header__dropdown ui-card ui-hidden" data-user-menu-panel>
        {% if user.role == "admin" %}
          <a href="/panel-admin">Panel admin</a>
        {% endif %}
        <a href="/perfil">Mi perfil</a>
        <a href="/logout">Cerrar sesión</a>
      </div>
    </div>
  {% endif %}
</div>
