:root {
    --gptc-header-bg: rgba(255,255,255,.98);
    --gptc-header-line: rgba(15,23,42,.08);
    --gptc-header-text: #172033;
    --gptc-header-soft: #66748a;
    --gptc-header-primary: #2563eb;
    --gptc-header-primary-dark: #1d4ed8;
    --gptc-header-shadow: 0 10px 32px rgba(15,23,42,.06);
}

.gptc-header-v5 {
    position: sticky;
    top: 0;
    z-index: 90;
    width: 100%;
    border-bottom: 1px solid var(--gptc-header-line);
    background: var(--gptc-header-bg);
    backdrop-filter: saturate(160%) blur(10px);
}

.gptc-header-v5__bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,.98) 0%, rgba(248,251,255,.96) 100%);
    pointer-events: none;
}

.gptc-header-v5 .gptc-shell {
    width: min(1320px, calc(100% - 32px));
    margin: 0 auto;
}

.gptc-header-v5__inner {
    position: relative;
    display: grid;
    grid-template-columns: minmax(180px, 20%) 1fr auto;
    align-items: center;
    gap: 20px;
    min-height: 78px;
    padding: 10px 0;
}

.gptc-header-v5__left,
.gptc-header-v5__right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.gptc-header-v5__burger {
    display: none;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--gptc-header-line);
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
}

.gptc-header-v5__burger span {
    display: block;
    width: 18px;
    height: 2px;
    margin: 4px auto;
    border-radius: 999px;
    background: var(--gptc-header-text);
}

.gptc-header-v5__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    text-decoration: none;
    color: inherit;
}

.gptc-header-v5__logo-wrap {
    flex: 0 0 auto;
    width: min(100%, 160px);
    max-width: 20%;
    min-width: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-style: preserve-3d;
    transition: transform .22s ease;
}

.gptc-header-v5__brand:hover .gptc-header-v5__logo-wrap {
    transform: perspective(500px) rotateX(4deg) rotateY(-5deg);
}

.gptc-header-v5__logo-wrap .custom-logo-link,
.gptc-header-v5__mobile-logo .custom-logo-link {
    display: flex;
    align-items: center;
}

.gptc-header-v5__logo-wrap .custom-logo,
.gptc-header-v5__mobile-logo .custom-logo {
    width: 100%;
    height: auto;
    max-height: 54px;
    object-fit: contain;
}

.gptc-header-v5__brand-text {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.gptc-header-v5__brand-text strong {
    font-size: 18px;
    line-height: 1.05;
    letter-spacing: -.02em;
    color: var(--gptc-header-text);
}

.gptc-header-v5__brand-text small {
    color: var(--gptc-header-soft);
    font-size: 12px;
    line-height: 1.3;
}

.gptc-header-v5__logo-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 18px;
    background: rgba(37,99,235,.08);
    color: var(--gptc-header-primary);
    font-weight: 800;
    font-size: 18px;
}

.gptc-header-v5__nav {
    min-width: 0;
}

.gptc-header-v5__menu,
.gptc-header-v5__menu ul {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.gptc-header-v5__menu > li {
    position: relative;
}

.gptc-header-v5__menu > li > a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 12px;
    color: var(--gptc-header-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    transition: background .18s ease, color .18s ease;
}

.gptc-header-v5__menu > li > a:hover,
.gptc-header-v5__menu > li.current-menu-item > a,
.gptc-header-v5__menu > li.current-menu-ancestor > a {
    background: rgba(15,23,42,.05);
    color: var(--gptc-header-primary);
}

.gptc-header-v5__menu li.menu-item-has-children > a::after {
    content: '';
    width: 7px;
    height: 7px;
    margin-left: 8px;
    border-right: 1.8px solid currentColor;
    border-bottom: 1.8px solid currentColor;
    transform: rotate(45deg) translateY(-1px);
}

.gptc-header-v5__menu li.menu-item-has-children > ul {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    min-width: 230px;
    display: grid;
    gap: 6px;
    padding: 10px;
    border: 1px solid var(--gptc-header-line);
    border-radius: 18px;
    background: rgba(255,255,255,.98);
    box-shadow: 0 18px 44px rgba(15,23,42,.10);
    opacity: 0;
    pointer-events: none;
    transform: translateY(6px);
    transition: opacity .18s ease, transform .18s ease;
}

.gptc-header-v5__menu li:hover > ul,
.gptc-header-v5__menu li:focus-within > ul {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.gptc-header-v5__menu li.menu-item-has-children > ul a {
    display: flex;
    align-items: center;
    min-height: 40px;
    padding: 0 12px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--gptc-header-text);
    font-size: 14px;
    font-weight: 600;
}

.gptc-header-v5__menu li.menu-item-has-children > ul a:hover {
    background: rgba(37,99,235,.07);
    color: var(--gptc-header-primary);
}

.gptc-header-v5__right {
    justify-content: flex-end;
    position: relative;
}

.gptc-header-v5__link {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 12px;
    border-radius: 12px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    color: var(--gptc-header-soft);
}

.gptc-header-v5__link:hover {
    color: var(--gptc-header-primary);
    background: rgba(37,99,235,.06);
}

.gptc-header-v5__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 14px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 800;
    white-space: nowrap;
    transition: transform .18s ease, background .18s ease, color .18s ease, border-color .18s ease;
}

.gptc-header-v5__button:hover {
    transform: translateY(-1px);
}

.gptc-header-v5__button--ghost {
    border: 1px solid var(--gptc-header-line);
    background: #fff;
    color: var(--gptc-header-text);
}

.gptc-header-v5__button--ghost:hover {
    border-color: rgba(37,99,235,.18);
    color: var(--gptc-header-primary);
}

.gptc-header-v5__button--primary {
    background: var(--gptc-header-primary);
    color: #fff;
    box-shadow: 0 10px 24px rgba(37,99,235,.18);
}

.gptc-header-v5__button--primary:hover {
    background: var(--gptc-header-primary-dark);
    color: #fff;
}

.gptc-header-v5__profile-toggle {
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--gptc-header-line);
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
}

.gptc-header-v5__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: rgba(37,99,235,.08);
    color: var(--gptc-header-primary);
    font-weight: 800;
}

.gptc-header-v5__avatar--large {
    width: 46px;
    height: 46px;
    border-radius: 16px;
}

.gptc-header-v5__profile-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 290px;
    z-index: 5;
}

.gptc-header-v5__profile-card {
    padding: 14px;
    border: 1px solid var(--gptc-header-line);
    border-radius: 20px;
    background: rgba(255,255,255,.99);
    box-shadow: 0 18px 44px rgba(15,23,42,.10);
}

.gptc-header-v5__profile-head {
    display: grid;
    grid-template-columns: 46px 1fr;
    gap: 12px;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gptc-header-line);
}

.gptc-header-v5__profile-head strong {
    display: block;
    font-size: 15px;
    line-height: 1.2;
    color: var(--gptc-header-text);
}

.gptc-header-v5__profile-head span {
    display: block;
    margin-top: 4px;
    font-size: 13px;
    color: var(--gptc-header-soft);
    word-break: break-word;
}

.gptc-header-v5__profile-links {
    display: grid;
    gap: 6px;
    padding-top: 12px;
}

.gptc-header-v5__profile-links a {
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 0 12px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--gptc-header-text);
    font-size: 14px;
    font-weight: 700;
}

.gptc-header-v5__profile-links a:hover {
    background: rgba(37,99,235,.07);
    color: var(--gptc-header-primary);
}

.gptc-header-v5__mobile {
    display: none;
}

@media (max-width: 1100px) {
    .gptc-header-v5__inner {
        grid-template-columns: minmax(160px, 1fr) auto auto;
        gap: 12px;
    }

    .gptc-header-v5__nav,
    .gptc-header-v5__link--utility,
    .gptc-header-v5__button--desktop,
    .gptc-header-v5__profile-toggle,
    .gptc-header-v5__profile-dropdown {
        display: none;
    }

    .gptc-header-v5__burger {
        display: inline-block;
    }

    .gptc-header-v5__left {
        gap: 10px;
    }

    .gptc-header-v5__logo-wrap {
        min-width: 52px;
        width: auto;
        max-width: 82px;
    }

    .gptc-header-v5__brand-text strong {
        font-size: 16px;
    }

    .gptc-header-v5__brand-text small {
        font-size: 11px;
    }

    .gptc-header-v5__mobile[hidden] {
        display: none;
    }

    .gptc-header-v5__mobile {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 110;
    }

    .gptc-header-v5__mobile-backdrop {
        position: absolute;
        inset: 0;
        background: rgba(15,23,42,.42);
        backdrop-filter: blur(4px);
    }

    .gptc-header-v5__mobile-panel {
        position: absolute;
        top: 0;
        left: 0;
        display: grid;
        gap: 18px;
        width: min(380px, 100%);
        height: 100%;
        padding: 20px;
        background: rgba(255,255,255,.99);
        box-shadow: 0 16px 40px rgba(15,23,42,.12);
        overflow-y: auto;
    }

    .gptc-header-v5__mobile-head,
    .gptc-header-v5__mobile-brand,
    .gptc-header-v5__mobile-user {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .gptc-header-v5__mobile-brand,
    .gptc-header-v5__mobile-user {
        text-decoration: none;
        color: inherit;
    }

    .gptc-header-v5__mobile-brand strong,
    .gptc-header-v5__mobile-user strong {
        display: block;
        font-size: 16px;
    }

    .gptc-header-v5__mobile-brand span,
    .gptc-header-v5__mobile-user span {
        display: block;
        font-size: 12px;
        color: var(--gptc-header-soft);
    }

    .gptc-header-v5__mobile-logo {
        width: 70px;
        min-width: 70px;
        display: flex;
        align-items: center;
    }

    .gptc-header-v5__mobile-close {
        margin-left: auto;
        width: 42px;
        height: 42px;
        border: 1px solid var(--gptc-header-line);
        border-radius: 14px;
        background: #fff;
        font-size: 28px;
        line-height: 1;
        cursor: pointer;
    }

    .gptc-header-v5__mobile-nav,
    .gptc-header-v5__mobile-menu {
        display: grid;
        gap: 6px;
    }

    .gptc-header-v5__mobile-menu,
    .gptc-header-v5__mobile-menu ul {
        margin: 0;
        padding: 0;
        list-style: none;
    }

    .gptc-header-v5__mobile-menu a,
    .gptc-header-v5__mobile-nav > a {
        display: flex;
        align-items: center;
        min-height: 46px;
        padding: 0 14px;
        border-radius: 14px;
        color: var(--gptc-header-text);
        text-decoration: none;
        font-size: 15px;
        font-weight: 700;
        background: rgba(15,23,42,.03);
    }

    .gptc-header-v5__mobile-menu .sub-menu {
        margin-top: 6px;
        padding-left: 10px;
    }

    .gptc-header-v5__mobile-menu .sub-menu a {
        font-size: 14px;
        font-weight: 600;
        min-height: 42px;
        background: rgba(37,99,235,.05);
    }

    .gptc-header-v5__mobile-auth {
        background: var(--gptc-header-primary) !important;
        color: #fff !important;
    }
}

@media (max-width: 640px) {
    .gptc-header-v5 .gptc-shell {
        width: min(100% - 20px, 1320px);
    }

    .gptc-header-v5__inner {
        min-height: 68px;
        padding: 8px 0;
    }

    .gptc-header-v5__button--auth {
        min-height: 40px;
        padding: 0 14px;
        font-size: 13px;
    }

    .gptc-header-v5__brand-text small {
        display: none;
    }

    .gptc-header-v5__brand-text strong {
        font-size: 15px;
    }

    .gptc-header-v5__logo-wrap {
        min-width: 46px;
        max-width: 64px;
    }
}
