.topbar {
    position: sticky;
    top: 12px;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    width: calc(100vw - 56px);
    margin-inline: calc((100% - (100vw - 56px)) / 2);
    margin-bottom: 34px;
    padding: 6px 12px;
    border: 1px solid rgba(18, 50, 74, .12);
    border-radius: 8px;
    background: rgba(255, 255, 255, .84);
    box-shadow: 0 20px 60px rgba(17, 24, 39, .08);
    backdrop-filter: blur(16px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.brand img {
    width: 144px;
    height: auto;
    max-height: 68px;
    object-fit: contain;
    filter:
        drop-shadow(1px 0 0 rgba(255, 255, 255, .95))
        drop-shadow(-1px 0 0 rgba(255, 255, 255, .95))
        drop-shadow(0 1px 0 rgba(255, 255, 255, .95))
        drop-shadow(0 -1px 0 rgba(255, 255, 255, .95))
        drop-shadow(0 12px 18px rgba(2, 22, 34, .14));
}

.brand strong {
    display: block;
    color: #111827;
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 0;
}

.brand span span {
    display: block;
    margin-top: 1px;
    color: #4b5563;
    font-size: 13px;
    font-weight: 500;
}

.main-menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-inline: auto;
    padding: 0;
}

.main-menu a,
.main-menu summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 0 12px;
    border-radius: 7px;
    color: #4b5563;
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
    transition: background .2s ease, color .2s ease, transform .2s ease;
}

.main-menu a:hover,
.main-menu summary:hover,
.menu-group[open] > summary {
    background: #eef1f3;
    color: #111827;
    transform: translateY(-1px);
}

.menu-group {
    position: relative;
}

.menu-group summary {
    cursor: pointer;
    list-style: none;
}

.menu-group summary::-webkit-details-marker {
    display: none;
}

.menu-group summary::after {
    content: "";
    width: 7px;
    height: 7px;
    margin-right: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transition: transform .2s ease;
}

.menu-group[open] > summary::after {
    transform: rotate(-135deg) translateY(-1px);
}

.submenu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 20;
    display: grid;
    min-width: 210px;
    padding: 8px;
    border: 1px solid rgba(18, 50, 74, .12);
    border-radius: 8px;
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 18px 38px rgba(17, 24, 39, .14);
}

.submenu a {
    justify-content: flex-start;
    color: #46586d;
}

.submenu a:hover {
    background: #eef1f3;
    color: #111827;
    transform: none;
}

.nav-toggle {
    display: none;
}

.mobile-menu-button {
    display: none;
}

.top-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.topbar .button {
    min-height: 36px;
    padding-inline: 16px;
    font-size: 13px;
}

.button.primary {
    border-color: #12324a;
    background: #12324a;
    color: #fff;
}

@media (max-width: 920px) {
    .topbar {
        flex-wrap: wrap;
    }

    .main-menu {
        order: 3;
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 560px) {
    .topbar {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 0 12px;
        top: 8px;
        width: calc(100vw - 24px);
        margin-inline: calc((100% - (100vw - 24px)) / 2);
        margin-bottom: 24px;
        padding: 0;
        border-color: rgba(18, 50, 74, .12);
        border-radius: 8px;
        background: #fff;
        backdrop-filter: none;
    }

    .brand {
        flex: 1 1 0;
        width: auto;
        justify-content: flex-start;
        gap: 10px;
        padding: 8px 10px;
        text-align: right;
    }

    .brand img {
        width: 86px;
        max-height: 46px;
    }

    .brand strong {
        color: #24324a;
        font-size: 15px;
    }

    .brand span span {
        color: #647084;
        font-size: 11px;
        line-height: 1.5;
    }

    .mobile-menu-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        order: -1;
        width: 48px;
        height: 50px;
        margin-right: auto;
        border: 0;
        border-radius: 0;
        background: transparent;
        color: #46586d;
        cursor: pointer;
        flex-direction: column;
        gap: 5px;
    }

    .mobile-menu-button span,
    .mobile-menu-button::before,
    .mobile-menu-button::after {
        content: "";
        display: block;
        width: 22px;
        height: 2px;
        border-radius: 999px;
        background: currentColor;
    }

    .main-menu {
        display: none;
        grid-template-columns: 1fr;
        gap: 2px;
        width: 100%;
        justify-content: stretch;
        overflow: visible;
        order: 3;
        padding: 12px;
        border-top: 1px solid #eef2f7;
        background: #fff;
    }

    .main-menu a,
    .main-menu summary {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        width: 100%;
        min-height: 50px;
        padding: 0 46px 0 42px;
        border: 0;
        border-bottom: 1px solid #eef2f7;
        border-radius: 8px;
        background: transparent;
        color: #46586d;
        font-size: 15px;
        text-align: right;
    }

    .main-menu > a:first-child {
        background: #eef3ff;
        color: #24324a;
        font-weight: 900;
    }

    .main-menu a::before,
    .main-menu summary::before {
        content: "▣";
        position: absolute;
        right: 14px;
        top: 50%;
        color: #46586d;
        font-size: 15px;
        line-height: 1;
        transform: translateY(-50%);
    }

    .main-menu a::after,
    .main-menu summary::after {
        content: "‹";
        position: absolute;
        left: 18px;
        top: 50%;
        margin: 0;
        width: auto;
        height: auto;
        border: 0;
        color: #46586d;
        font-size: 22px;
        font-weight: 700;
        line-height: 1;
        box-shadow: none;
        transform: translateY(-50%);
    }

    .menu-group[open] > summary::after {
        transform: translateY(-50%) rotate(-90deg);
    }

    .menu-group {
        width: 100%;
        border-bottom: 1px solid #eef2f7;
    }

    .menu-group[open] > summary {
        background: #f4f7fb;
        color: #24324a;
        transform: none;
    }

    .submenu {
        position: static;
        min-width: 0;
        width: 100%;
        padding: 6px 46px 10px 14px;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    .submenu a {
        width: 100%;
        min-height: 34px;
        padding: 0 12px;
        border: 0;
        border-radius: 7px;
        color: #647084;
        font-size: 13px;
    }

    .submenu a::before,
    .submenu a::after {
        content: none;
    }

    .main-menu a:hover,
    .main-menu summary:hover {
        background: #f4f7fb;
        color: #24324a;
        transform: none;
    }

    .top-actions,
    .nav-toggle:checked ~ .main-menu {
        display: grid;
    }

    .top-actions {
        display: none;
        width: 100%;
        order: 4;
        padding: 0 12px 12px;
    }

    .nav-toggle:checked ~ .top-actions {
        display: grid;
    }
}
