/* 顶部导航：优先显示主入口，溢出收进「更多」；窄屏切换为汉堡抽屉 */
.header-inner { position: relative; }
.header-menu { display: contents; }
.nav-toggle { display: none; }

.site-nav {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1 1 0;
    min-width: 0;
    gap: 6px;
}

.nav-items {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex-wrap: wrap;
}

.nav-enhanced .nav-items {
    flex-wrap: nowrap;
    overflow: hidden;
}

.nav-items > .nav-link {
    flex: 0 0 auto;
    white-space: nowrap;
}

.nav-more {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text, #334155);
    font: inherit;
    font-size: 15px;
    cursor: pointer;
    white-space: nowrap;
}

.nav-more:hover {
    background: var(--blue-soft, #eef4ff);
    color: var(--blue-dark, #1e3a8a);
}

.nav-more[hidden] { display: none; }

.nav-more-caret {
    font-size: 11px;
    line-height: 1;
    opacity: .65;
}

.nav-more-dot {
    display: none;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--blue, #1d4ed8);
}

.nav-more.has-active .nav-more-dot { display: inline-block; }

.nav-more-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 70;
    min-width: 190px;
    max-width: min(320px, 80vw);
    max-height: min(70vh, 520px);
    overflow-y: auto;
    padding: 8px;
    border: 1px solid var(--line, #e2e8f0);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .16);
}

.nav-more-panel[hidden] { display: none; }

.nav-more-panel .nav-link {
    display: block;
    padding: 9px 12px;
    border-radius: 9px;
    white-space: nowrap;
}

.nav-more-panel .nav-link:hover {
    background: var(--blue-soft, #eef4ff);
    color: var(--blue-dark, #1e3a8a);
}

.nav-more-panel .nav-link.active {
    background: var(--blue-soft, #eef4ff);
    color: var(--blue, #1d4ed8);
    font-weight: 600;
}

@media (max-width: 1100px) {
    .header-inner {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        gap: 12px;
        min-height: 64px;
        padding: 10px 0;
    }

    .header-inner .brand {
        min-width: 0;
    }

    .brand-text {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .nav-toggle {
        display: inline-flex;
        flex-direction: column;
        justify-content: center;
        gap: 4px;
        width: 42px;
        height: 42px;
        margin-left: auto;
        padding: 0 10px;
        border: 1px solid var(--line, #e2e8f0);
        border-radius: 10px;
        background: #fff;
        cursor: pointer;
    }

    .nav-toggle-bar {
        display: block;
        width: 20px;
        height: 2px;
        border-radius: 2px;
        background: var(--ink, #0f172a);
        transition: transform .2s ease, opacity .2s ease;
    }

    body.nav-open .nav-toggle-bar:nth-child(1) { transform: translateY(6px) rotate(45deg); }
    body.nav-open .nav-toggle-bar:nth-child(2) { opacity: 0; }
    body.nav-open .nav-toggle-bar:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

    .header-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        z-index: 60;
        padding: 14px 18px 18px;
        border-top: 1px solid var(--line, #e2e8f0);
        background: #fff;
        box-shadow: 0 24px 40px rgba(15, 23, 42, .14);
        max-height: calc(100vh - 64px);
        overflow-y: auto;
    }

    body.nav-open .header-menu {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .header-menu .site-nav {
        flex: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
    }

    .header-menu .nav-items {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        flex-wrap: nowrap;
        overflow: visible;
    }

    .header-menu .nav-items > .nav-link,
    .header-menu .member-nav .nav-link {
        width: 100%;
        padding: 10px 12px;
    }

    .header-menu .lang-switch,
    .header-menu .member-nav {
        width: 100%;
        flex-wrap: wrap;
        gap: 4px;
    }

    .header-menu .header-search {
        display: flex;
        width: 100%;
    }

    .header-menu .header-search input {
        flex: 1 1 auto;
        min-width: 0;
    }

    .header-menu .header-actions,
    .header-menu .mall-header-actions {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .header-menu .header-cta {
        text-align: center;
    }

    .nav-more,
    .nav-more-panel {
        display: none !important;
    }

    body.nav-open {
        overflow: hidden;
    }
}
