:root {
    --admin-menu-bg: var(--ak-brand, #0b2f16);
    --admin-menu-bg-strong: var(--ak-brand-strong, #08250f);
    --admin-menu-text: #f3f7f4;
    --admin-menu-muted: #b8c9bc;
    --admin-menu-accent: var(--ak-brand-accent, #8fd6a0);
    --admin-menu-border: rgba(255, 255, 255, 0.12);
    --admin-menu-shadow: 0 8px 24px rgba(8, 37, 15, 0.18);
}

body.ak-body {
    margin-top: 0;
}

.admin-menu-shell,
.admin-menu-shell * {
    box-sizing: border-box;
}

.admin-menu-shell {
    position: relative;
    z-index: 2147482000;
    width: 100%;
    margin-bottom: 20px;
    background: linear-gradient(105deg, var(--admin-menu-bg-strong), var(--admin-menu-bg));
    color: var(--admin-menu-text);
    box-shadow: var(--admin-menu-shadow);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    text-align: left;
}

.admin-menu-inner {
    display: flex;
    align-items: center;
    width: min(1440px, 100%);
    min-height: 64px;
    margin: 0 auto;
    padding: 0 18px;
    gap: 16px;
}

.admin-menu-brand {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 9px;
    color: var(--admin-menu-text);
    font-size: 1rem;
    font-weight: 750;
    letter-spacing: 0.01em;
    text-decoration: none;
    white-space: nowrap;
}

.admin-menu-brand:hover {
    color: #fff;
    text-decoration: none;
}

.admin-menu-brand__mark {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(143, 214, 160, 0.4);
    border-radius: 10px;
    background: rgba(143, 214, 160, 0.13);
    color: var(--admin-menu-accent);
    font-size: 1.2rem;
}

.admin-menu-content {
    flex: 1 1 auto;
    min-width: 0;
}

.admin-menu-nav {
    display: flex;
    align-items: center;
    gap: 3px;
    min-width: 0;
    padding: 5px 0;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

.admin-menu-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 6px;
    min-height: 40px;
    padding: 8px 9px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--admin-menu-muted);
    font-size: 0.82rem;
    font-weight: 650;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.admin-menu-link:hover {
    border-color: var(--admin-menu-border);
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
    text-decoration: none;
}

.admin-menu-link.is-active {
    border-color: rgba(143, 214, 160, 0.34);
    background: rgba(143, 214, 160, 0.14);
    color: #fff;
}

.admin-menu-link.is-active::after {
    position: absolute;
    right: 10px;
    bottom: 3px;
    left: 10px;
    height: 2px;
    border-radius: 999px;
    background: var(--admin-menu-accent);
    content: "";
}

.admin-menu-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    font-size: 1.05rem;
}

.admin-menu-icon .ti {
    font-size: inherit;
    line-height: 1;
}

.admin-menu-toggle {
    display: none;
    place-items: center;
    width: 42px;
    height: 42px;
    margin-left: auto;
    border: 1px solid var(--admin-menu-border);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-size: 1.35rem;
    cursor: pointer;
}

.admin-user {
    position: relative;
    flex: 0 0 auto;
}

.admin-user-trigger {
    display: flex;
    align-items: center;
    max-width: 240px;
    min-height: 46px;
    padding: 5px 7px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--admin-menu-text);
    cursor: pointer;
    text-align: left;
}

.admin-user-trigger:hover,
.admin-user-trigger[aria-expanded="true"] {
    border-color: var(--admin-menu-border);
    background: rgba(255, 255, 255, 0.07);
}

.admin-user-avatar {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border: 1px solid rgba(143, 214, 160, 0.5);
    border-radius: 50%;
    background: rgba(143, 214, 160, 0.16);
    color: #dff7e5;
    font-size: 0.75rem;
    font-weight: 750;
}

.admin-user-avatar--large {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
    font-size: 0.86rem;
}

.admin-user-summary {
    display: grid;
    min-width: 0;
    margin: 0 8px;
}

.admin-user-summary strong,
.admin-user-summary small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-user-summary strong {
    color: #fff;
    font-size: 0.84rem;
    font-weight: 700;
}

.admin-user-summary small {
    margin-top: 2px;
    color: var(--admin-menu-muted);
    font-size: 0.71rem;
}

.admin-user-chevron {
    color: var(--admin-menu-muted);
    font-size: 0.9rem;
}

.admin-user-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: min(360px, calc(100vw - 24px));
    padding: 14px;
    border: 1px solid var(--ak-border, #dfe3e6);
    border-radius: 12px;
    background: var(--ak-bg-surface, #fff);
    color: var(--ak-text, #2f3437);
    box-shadow: 0 18px 45px rgba(9, 30, 15, 0.22);
}

.admin-user-panel__identity {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
}

.admin-user-panel__identity > span:last-child {
    display: grid;
    min-width: 0;
}

.admin-user-panel__identity strong {
    color: var(--ak-text-strong, #22272a);
    font-size: 0.95rem;
}

.admin-user-panel__identity small {
    margin-top: 2px;
    color: var(--ak-text-muted, #687076);
    font-size: 0.8rem;
}

.admin-user-roles {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 0 0 12px 52px;
}

.admin-user-roles span {
    padding: 3px 7px;
    border: 1px solid #b9cce0;
    border-radius: 999px;
    background: #f0f5fb;
    color: #235790;
    font-size: 0.7rem;
    font-weight: 650;
}

.admin-simulator {
    margin: 0 -2px 12px;
    padding: 12px;
    border: 1px solid #c8dccd;
    border-radius: 9px;
    background: #f4faf5;
}

.admin-simulator label {
    display: block;
    margin-bottom: 7px;
    color: #24472d;
    font-size: 0.78rem;
    font-weight: 700;
}

.admin-simulator__controls {
    display: flex;
    gap: 7px;
}

.admin-simulator select {
    min-width: 0;
    height: 38px;
    flex: 1 1 auto;
    border: 1px solid #b8c8bc;
    border-radius: 7px;
    background: #fff;
    color: #26372a;
    padding: 0 9px;
}

.admin-simulator button,
.admin-simulation-banner button {
    min-height: 38px;
    border: 1px solid #2f6940;
    border-radius: 7px;
    background: #2f6940;
    color: #fff;
    padding: 0 11px;
    font-weight: 700;
    cursor: pointer;
}

.admin-simulator button:disabled,
.admin-simulation-banner button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.admin-simulator__status {
    min-height: 1em;
    margin: 6px 0 0;
    color: #8b3d2f;
    font-size: 0.75rem;
}

.admin-user-action {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 40px;
    gap: 8px;
    padding: 8px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #8d3030;
    font-weight: 650;
    cursor: pointer;
}

.admin-user-action:hover {
    background: #fff2f2;
}

.admin-simulation-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    gap: 16px;
    padding: 6px 18px;
    border-top: 1px solid #e1b951;
    background: #fff5cf;
    color: #684b08;
    font-size: 0.84rem;
}

.admin-simulation-banner span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.admin-simulation-banner button {
    min-height: 30px;
    border-color: #8a6510;
    background: transparent;
    color: #684b08;
}

@media screen and (max-width: 1120px) {
    .admin-menu-toggle {
        display: grid;
    }

    .admin-menu-content {
        position: absolute;
        top: 64px;
        right: 0;
        left: 0;
        display: none;
        padding: 10px 14px 14px;
        border-top: 1px solid var(--admin-menu-border);
        background: var(--admin-menu-bg-strong);
        box-shadow: 0 12px 22px rgba(8, 37, 15, 0.2);
    }

    .admin-menu-shell.is-menu-open .admin-menu-content {
        display: block;
    }

    .admin-menu-nav {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 5px;
        overflow: visible;
    }

    .admin-menu-link {
        width: 100%;
    }
}

@media screen and (max-width: 680px) {
    .admin-menu-inner {
        padding: 0 10px;
        gap: 8px;
    }

    .admin-menu-brand > span:last-child {
        display: none;
    }

    .admin-user-summary {
        display: none;
    }

    .admin-user-trigger {
        padding: 5px;
    }

    .admin-user-chevron {
        margin-left: 4px;
    }

    .admin-menu-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        max-height: calc(100vh - 92px);
        overflow-y: auto;
    }

    .admin-user-panel {
        position: fixed;
        top: 70px;
        right: 10px;
    }

    .admin-simulation-banner {
        align-items: stretch;
        flex-direction: column;
        gap: 7px;
        padding: 9px 12px;
        text-align: center;
    }
}

@media (display-mode: standalone) {
    body.ak-body {
        padding-top: env(safe-area-inset-top);
    }

    body.ak-body::before {
        position: fixed;
        top: 0;
        right: 0;
        left: 0;
        z-index: 2147483000;
        height: env(safe-area-inset-top);
        background: var(--ak-brand, #0b2f16);
        content: "";
        pointer-events: none;
    }
}
