.app-header {
    --ah-accent: #2d7389;
    --ah-accent-dark: #1f5566;
    --ah-text: #ffffff;
    --ah-text-muted: rgba(255, 255, 255, 0.82);
    --ah-border: rgba(255, 255, 255, 0.18);
    --ah-shadow: 0 4px 18px rgba(18, 38, 63, 0.12);
    position: sticky;
    top: 0;
    z-index: 1030;
    background: linear-gradient(135deg, var(--ah-accent) 0%, var(--ah-accent-dark) 100%);
    box-shadow: var(--ah-shadow);
}

.app-header__inner {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 3.35rem;
    padding: 0.35rem 1rem;
}

.app-header__brand {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--ah-text);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.02rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.app-header__brand:hover {
    color: var(--ah-text);
    text-decoration: none;
    opacity: 0.95;
}

.app-header__brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.14);
}

.app-header__page {
    display: none;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid var(--ah-border);
    color: var(--ah-text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.app-header__toggle {
    display: none;
    margin-left: auto;
    border: 1px solid var(--ah-border);
    background: rgba(255, 255, 255, 0.1);
    color: var(--ah-text);
    border-radius: 8px;
    padding: 0.35rem 0.55rem;
    line-height: 1;
}

.app-header__toggle-icon {
    display: block;
    width: 1.25rem;
    height: 1.25rem;
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(255,255,255,1)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 8h24M4 16h24M4 24h24'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.app-header__nav {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: auto;
}

.app-header__links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.app-header__link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.42rem 0.8rem;
    border-radius: 999px;
    color: var(--ah-text-muted);
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.app-header__link:hover {
    color: var(--ah-text);
    background: rgba(255, 255, 255, 0.14);
    text-decoration: none;
}

.app-header__link.is-active {
    color: var(--ah-accent-dark);
    background: #fff;
}

.app-header__divider {
    width: 1px;
    height: 1.4rem;
    background: var(--ah-border);
    margin: 0 0.15rem;
}

.app-header__user {
    position: relative;
}

.app-header__user-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    max-width: 14rem;
    padding: 0.35rem 0.55rem 0.35rem 0.35rem;
    border: 1px solid var(--ah-border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--ah-text);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
}

.app-header__user-toggle:hover,
.app-header__user-toggle:focus {
    background: rgba(255, 255, 255, 0.18);
    color: var(--ah-text);
    outline: none;
}

.app-header__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: #fff;
    color: var(--ah-accent-dark);
    font-size: 0.72rem;
    font-weight: 800;
    flex-shrink: 0;
}

.app-header__user-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-header__menu {
    position: absolute;
    right: 0;
    top: calc(100% + 0.45rem);
    min-width: 12.5rem;
    padding: 0.35rem 0;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #e8edf2;
    box-shadow: 0 10px 28px rgba(18, 38, 63, 0.14);
    display: none;
    z-index: 1050;
}

.app-header__menu.is-open {
    display: block;
}

.app-header__menu-item {
    display: block;
    padding: 0.5rem 0.9rem;
    color: #1f2937;
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
}

.app-header__menu-item:hover {
    background: #f3f7fa;
    color: var(--ah-accent-dark);
    text-decoration: none;
}

.app-header__menu-item--danger {
    color: #b42318;
}

.app-header__menu-label {
    padding: 0.45rem 0.9rem 0.25rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
}

@media (min-width: 768px) {
    .app-header__page {
        display: inline-flex;
    }
}

@media (max-width: 991.98px) {
    body.app-header-nav-open {
        overflow: hidden;
    }

    .app-header__toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
    }

    .app-header__nav {
        display: none;
        position: absolute;
        left: 0;
        right: 0;
        top: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0.65rem;
        background: linear-gradient(180deg, var(--ah-accent-dark) 0%, #184452 100%);
        border-top: 1px solid var(--ah-border);
        box-shadow: var(--ah-shadow);
        max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 56px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .app-header__nav.is-open {
        display: flex;
    }

    .app-header__links {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        min-height: 0;
    }

    .app-header__link {
        width: 100%;
        border-radius: 8px;
        min-height: 44px;
    }

    .app-header__link:focus-visible,
    .app-header__menu-item:focus-visible,
    .app-header__user-toggle:focus-visible {
        outline: 3px solid #fff;
        outline-offset: 2px;
    }

    .app-header__divider {
        display: none;
    }

    .app-header__user {
        width: 100%;
    }

    .app-header__user-toggle {
        width: 100%;
        max-width: none;
        justify-content: space-between;
        min-height: 44px;
    }

    .app-header__menu {
        position: static;
        margin-top: 0.35rem;
        width: 100%;
        box-shadow: none;
    }

    .app-header__menu-item {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}
