/* 手机端通用顶栏 + 头像下拉菜单（子页面共用） */

.m-topbar,
.m-topbar-back,
.m-avatar-menu,
.m-avatar-backdrop,
.m-sub-header {
    display: none;
}

@media (max-width: 768px) {
    .m-topbar {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        padding: 10px 14px;
        background: #fff;
        border-bottom: 1px solid #e7e5e5;
        position: sticky;
        top: 0;
        z-index: 100;
    }

    .m-topbar-back {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        border: none;
        background: #f5f6fa;
        color: #385EE2;
        font-size: 18px;
        font-weight: 700;
        border-radius: 8px;
        cursor: pointer;
        flex-shrink: 0;
        line-height: 1;
        padding: 0;
        text-decoration: none;
    }

    .m-topbar-brand {
        display: flex;
        align-items: center;
        gap: 8px;
        min-width: 0;
        flex: 1;
    }

    .m-topbar-title {
        font-size: 16px;
        font-weight: 700;
        color: #333;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .m-topbar-actions {
        display: flex;
        align-items: center;
        gap: 10px;
        flex-shrink: 0;
        position: relative;
    }

    .m-avatar-btn {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        border: 2px solid #385EE2;
        background: linear-gradient(135deg, #385EE2, #5b7cf0);
        color: #fff;
        font-size: 14px;
        font-weight: 700;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
        position: relative;
        z-index: 162;
        -webkit-tap-highlight-color: transparent;
    }

    .m-topbar-actions .m-avatar-menu {
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        z-index: 161;
        min-width: 108px;
        padding: 6px;
        background: #fff;
        border: 1px solid #e7e5e5;
        border-radius: 12px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    }

    .m-topbar-actions .m-avatar-menu.open {
        display: flex !important;
    }

    .m-avatar-backdrop {
        position: fixed !important;
        inset: 0;
        z-index: 150;
        background: transparent;
    }

    body.m-avatar-open .m-avatar-backdrop {
        display: block !important;
    }

    .m-float-btn {
        border: none;
        background: #f7f8fa;
        color: #333;
        font-size: 13px;
        padding: 10px 12px;
        border-radius: 8px;
        cursor: pointer;
        white-space: nowrap;
        text-align: left;
        width: 100%;
    }

    .m-float-btn:active {
        background: #eef0f5;
    }

    .m-float-logout {
        color: #e53935;
        background: rgba(229, 57, 53, 0.06);
    }

    body.m-has-mobile-topbar > .header {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .m-topbar,
    .m-avatar-menu,
    .m-avatar-backdrop {
        display: none !important;
    }
}
