header.main-header .topbar-left {
    --account-text: #1f2328;
    --account-subtle: #f5f6f8;
    --account-accent: var(--primary-color, #434eb0);
    --account-ease: cubic-bezier(.25, .65, .35, 1);
}

.site-account {
    --account-muted: #6b7280;
    --account-line: #e8eaee;
    position: relative;
    flex-shrink: 0;
    direction: rtl;
}

header.main-header :is(.site-account__toggle, .site-search-toggle) {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 12px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: transparent;
    color: var(--account-text);
    font: inherit;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .16s var(--account-ease);
}

header.main-header :is(.site-account__toggle, .site-search-toggle):is(:hover, [aria-expanded="true"]) {
    background: var(--account-subtle);
}

header.main-header :is(.site-account__toggle, .site-search-toggle):focus-visible {
    outline: 2px solid var(--account-accent);
    outline-offset: 2px;
}

.site-account__icon {
    font-size: 24px;
}

header.main-header .site-search-toggle {
    justify-content: center;
    width: 44px;
    padding: 0;
}

@media (min-width: 992px) and (prefers-reduced-motion: no-preference) {
    header.main-header .site-search-toggle {
        animation: headerActionRise 620ms var(--account-ease) 100ms backwards;
    }

    header.main-header .site-account__toggle {
        animation: headerActionRise 620ms var(--account-ease) 280ms backwards;
    }

    header.main-header :is(.site-search-toggle, .site-account__toggle):focus-visible {
        animation: none;
    }
}

@media (max-width: 992px) and (prefers-reduced-motion: no-preference) {
    header.main-header .mobile-date-and-search-icon-line {
        --header-entry-y: -16px;
    }

    header.main-header :is(
        .mobile-date-and-search-icon-line .date-time-group > time,
        .mobile-date-and-search-icon-line .date-time-group > span,
        .mobile-date-and-search-icon-line .seach-modal-btn,
        .mobile-menu-toggle,
        .site-account__toggle
    ) {
        animation: headerActionRise 620ms cubic-bezier(.25, .65, .35, 1)
            var(--mobile-header-delay, 80ms) backwards;
    }

    .mobile-date-and-search-icon-line .date-time-group > span { --mobile-header-delay: 150ms; }
    .mobile-date-and-search-icon-line .seach-modal-btn { --mobile-header-delay: 220ms; }
    .mobile-menu-toggle { --mobile-header-delay: 320ms; }
    .site-account__toggle { --mobile-header-delay: 460ms; }

    header.main-header :is(.mobile-date-and-search-icon-line .seach-modal-btn, .mobile-menu-toggle, .site-account__toggle):focus-visible,
    header.main-header .mobile-menu-toggle[aria-expanded="true"] {
        animation: none;
    }
}

@keyframes headerActionRise {
    from {
        opacity: .25;
        translate: 0 var(--header-entry-y, 16px);
    }

    to {
        opacity: 1;
        translate: 0 0;
    }
}

.site-account__label {
    max-width: 120px;
    overflow: hidden;
    padding: 2px 0;
    line-height: 1.7;
    text-overflow: ellipsis;
}

.site-account__chevron {
    color: var(--account-muted);
    font-size: 18px;
    transition: transform .3s var(--account-ease);
}

.site-account__toggle[aria-expanded="true"] .site-account__chevron {
    transform: rotate(180deg);
}

.site-account__menu {
    position: absolute;
    z-index: 1001;
    top: calc(100% + 8px);
    left: 0;
    width: 240px;
    max-width: calc(100vw - 32px);
    padding: 6px;
    border: 1px solid var(--account-line);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 12px 32px rgb(17 24 39 / 10%);
    text-align: right;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity .45s ease, transform .52s var(--account-ease), visibility 0s .45s;
}

.site-account__menu::before {
    content: "";
    position: absolute;
    inset: auto 0 100%;
    height: 10px;
}

.site-account__toggle[aria-expanded="true"] + .site-account__menu {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition-delay: 0s;
}

.site-account__head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    padding: 10px 12px 12px;
    border-bottom: 1px solid var(--account-line);
}

.site-account__avatar {
    display: grid;
    place-items: center;
    flex: 0 0 40px;
    height: 40px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--account-accent) 10%, white);
    color: var(--account-accent);
    font-size: 22px;
}

.site-account__who {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.6;
}

.site-account__who strong,
.site-account__who span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-account__who strong {
    color: var(--account-text);
    font-size: 14px;
    font-weight: 600;
}

.site-account__who span {
    color: var(--account-muted);
    font-size: 12px;
}

header.main-header .site-account__item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--account-text);
    font-size: 14px;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity .38s ease, transform .46s var(--account-ease), background-color .14s ease;
}

header.main-header .site-account__toggle[aria-expanded="true"] + .site-account__menu .site-account__item {
    opacity: 1;
    transform: none;
    transition-delay: var(--account-item-delay, 100ms), var(--account-item-delay, 100ms), 0s;
}

.site-account__item:nth-of-type(2) { --account-item-delay: 200ms; }
.site-account__item:nth-of-type(3) { --account-item-delay: 300ms; }

header.main-header .site-account__item:is(:hover, :focus-visible) {
    background: var(--account-subtle);
}

.site-account__item i {
    color: var(--account-muted);
    font-size: 20px;
    line-height: 1;
}

header.main-header .site-account__item--danger,
.site-account__item--danger i {
    color: #dc2626;
}

header.main-header .site-account__item--danger:is(:hover, :focus-visible) {
    background: #fef2f2;
}

.site-account__divider {
    height: 1px;
    margin: 6px 4px;
    background: var(--account-line);
}

@media (max-width: 991.98px) {
    header.main-header .site-account__toggle {
        justify-content: center;
        width: 44px;
        padding: 0;
    }

    .site-account__label,
    .site-account__chevron {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    header.main-header .site-account__toggle,
    header.main-header .site-search-toggle,
    .site-account__chevron,
    .site-account__menu,
    .site-account__toggle[aria-expanded="true"] + .site-account__menu,
    header.main-header .site-account__item,
    header.main-header .site-account__toggle[aria-expanded="true"] + .site-account__menu .site-account__item {
        transition: none;
    }
}
