<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="robots" content="noindex, nofollow">
<script>(function(){var t=localStorage.getItem('aegisone_service_theme')||'system';if(t==='dark'||(t==='system'&&matchMedia('(prefers-color-scheme:dark)').matches))document.documentElement.setAttribute('data-theme','dark');else if(t==='light'||(t==='system'&&matchMedia('(prefers-color-scheme:light)').matches))document.documentElement.setAttribute('data-theme','light');})();</script>
<title>{% block title %}Service Portal — AegisOne Engineering{% endblock %}</title>
<link rel="stylesheet" href="/service/static/css/service.css">
<link rel="stylesheet" href="/service/static/css/service-theme.css">
<link rel="icon" type="image/x-icon" href="/service/static/img/favicons/favicon.ico">
<link rel="icon" type="image/svg+xml" href="/service/static/img/favicon.svg">
<link rel="icon" type="image/png" sizes="32x32" href="/service/static/img/favicons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/service/static/img/favicons/favicon-16x16.png">
<link rel="apple-touch-icon" sizes="180x180" href="/service/static/img/favicons/apple-touch-icon.png">
<link rel="manifest" href="/service/static/img/favicons/site.webmanifest">
{% block extra_head %}{% endblock %}
</head>
<body class="{% block body_class %}{% endblock %}">
{% if user %}
<nav class="navbar">
    <div class="navbar__brand">
        <a href="/service/dashboard">AegisOne Service</a>
    </div>
    <ul class="navbar__menu">
        {% if available_roles|length > 1 %}
        <li class="role-switcher">
            <button class="role-btn" onclick="document.querySelector('.role-dropdown').classList.toggle('open')">
                <span class="role-btn-label">{{ role_override_active and '⚡' or '' }} {{ user.role }}</span>
                <span class="role-btn-arrow">▾</span>
            </button>
            <div class="role-dropdown">
                {% for r in available_roles %}
                <a href="#" class="role-dropdown-item {% if r == user.role %}active{% endif %}" onclick="event.preventDefault(); roleSwitcher.switchRole('{{ r }}')">
                    {{ r }}
                </a>
                {% endfor %}
                {% if role_override_active %}
                <div class="role-dropdown-divider"></div>
                <a href="#" class="role-dropdown-item role-dropdown-reset" onclick="event.preventDefault(); roleSwitcher.resetRole()">
                    ← Сбросить ({{ original_role }})
                </a>
                {% endif %}
            </div>
        </li>
        {% endif %}
        <li class="theme-switcher">
            <button id="theme-btn" onclick="toggleTheme()" title="Авто">🖥</button>
        </li>
        
    </ul>
</nav>
{% endif %}
{% block content %}{% endblock %}
<div class="toast-container" id="toast-container"></div>
<script src="/service/static/js/theme.js"></script>
<script src="/service/static/js/role-switcher.js"></script>
<script>
function showNotification(msg, type){
    type = type || 'success';
    var container = document.getElementById('toast-container');
    if(!container){ container = document.createElement('div'); container.className='toast-container'; container.id='toast-container'; document.body.appendChild(container); }
    var t = document.createElement('div');
    t.className = 'toast toast-' + type;
    t.textContent = msg;
    container.appendChild(t);
    setTimeout(function(){ t.style.opacity='0'; t.style.transition='opacity 0.3s'; setTimeout(function(){ t.remove() },300) }, 3000);
}
</script>
{% block extra_scripts %}{% endblock %}
</body>
</html>
