/* ============================================================
   0. Reset
   ============================================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body.u-body {
    height: 100%;
    overflow: hidden;
}
body.u-body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    background: #ffffff;
    color: #111111;
    font-size: 15px;
    line-height: 1.6;
    overscroll-behavior: none;
    -webkit-tap-highlight-color: transparent;
}
a { color: #111111; text-decoration: none; }

:root {
    --u-color-text:        #111111;
    --u-color-text-2:      #444444;
    --u-color-text-3:      #888888;
    --u-color-border:      #e5e5e5;
    --u-color-border-2:    #eeeeee;
    --u-color-bg:          #fafafa;
    --u-color-bg-panel:    #ffffff;
    --u-color-bg-soft:     #f5f5f5;
    --u-color-bg-hover:    #f0f0f0;
    --u-color-bg-active:   #eeeeee;
    --u-color-primary:     #111111;
    --u-color-danger:      #d32f2f;
    --u-r-md: 6px;
    --u-r-pill: 999px;
    --u-nav-width: 220px;
}

/* 左侧导航 */
.u-nav-panel {
    position: relative;
    width: var(--u-nav-width);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #111111;
    border-right: none;
    z-index: 9000;
}
.u-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--u-color-border-2);
    flex-shrink: 0;
}
.u-nav-title {
    font-size: 15px;
    font-weight: 800;
    color: #111111;
}
.u-nav-close { display: none; }

.u-nav-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 8px;
}
.u-nav-group { margin-bottom: 4px; }
.u-nav-group:last-child { margin-bottom: 0; }

.u-nav-l1 {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: none;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    color: var(--u-color-text);
    text-align: left;
    cursor: pointer;
    border-radius: var(--u-r-md);
    transition: background .15s ease;
    white-space: nowrap;
}
.u-nav-l1:hover { background: #ffffff; }
.u-nav-l1 .ico { width: 16px; height: 16px; flex-shrink: 0; color: #111111; }
.u-nav-l1 .arrow {
    margin-left: auto; width: 11px; height: 11px;
    color: var(--u-color-text-3); transition: transform .2s ease;
}
.u-nav-group.collapsed .u-nav-l1 .arrow { transform: rotate(-90deg); }
.u-nav-group.collapsed .u-nav-l2-wrap { display: none; }

.u-nav-l2-wrap { padding: 2px 0 8px 0; }
.u-nav-l2 {
    display: flex;
    align-items: center;
    padding: 9px 12px 9px 36px;
    font-size: 15px;
    font-weight: 500;
    color: var(--u-color-text-2);
    border-radius: var(--u-r-md);
    cursor: pointer;
    border: none;
    background: none;
    text-align: left;
    width: 100%;
    transition: background .15s ease;
}
.u-nav-l2:hover { background: #ffffff; color: #111111; }
.u-nav-l2.active {
    background: #eeeeee;
    color: #111111;
    font-weight: 700;
}

.u-nav-footer {
    margin-top: 12px;
    padding: 16px 16px 20px;
    border-top: 1px solid var(--u-color-border-2);
}
.u-nav-footer-name {
    font-size: 15px; font-weight: 700;
    color: var(--u-color-text); margin-bottom: 12px;
}
.u-nav-footer-logout {
    display: block; width: 100%; padding: 11px 12px;
    font-size: 15px; font-weight: 600; text-align: center;
    color: #fff; background: #111111;
    border-radius: 6px; transition: background .18s ease;
}
.u-nav-footer-logout:hover { background: #333333; }

/* ============================================================
   左菜单底部 - 账户入口（登录 / 头像+用户名+昵称 / 展开菜单）
   ============================================================ */
.u-nav-footer {
    position: relative;
    margin-top: 12px;
    padding: 12px 12px 16px;
    border-top: 1px solid var(--u-color-border-2);
}

/* 未登录：登录按钮 */
.u-nav-login-btn {
    display: block;
    width: 100%;
    padding: 12px;
    background: #111111;
    color: #ffffff;
    font-weight: 700;
    font-size: 15px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s ease;
}
.u-nav-login-btn:hover { background: #333333; }

/* 已登录：账户入口行 */
.u-account-entry {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s ease;
}
.u-account-entry:hover { background: var(--u-color-bg-hover); }

.u-account-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: #eeeeee;
    border: 1px solid var(--u-color-border);
}
.u-account-avatar.sm {
    width: 32px;
    height: 32px;
}

.u-account-info {
    flex: 1;
    min-width: 0;
}
.u-account-name {
    font-size: 14px;
    font-weight: 700;
    color: #111111;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.u-account-handle {
    font-size: 12px;
    color: #888888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.u-account-more {
    font-size: 18px;
    color: #111111;
    font-weight: 800;
    flex-shrink: 0;
    line-height: 1;
}

/* 展开菜单 */
.u-account-menu {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 100%;
    margin-bottom: 8px;
    background: #ffffff;
    border: 1px solid #111111;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,.14);
    overflow: hidden;
    z-index: 9500;
}

.u-account-switcher {
    padding: 8px;
    border-bottom: 1px solid var(--u-color-border-2);
    max-height: 200px;
    overflow-y: auto;
}
.u-account-switcher .u-account-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s ease;
}
.u-account-switcher .u-account-row:hover { background: var(--u-color-bg-hover); }
.u-account-empty {
    padding: 10px 12px;
    font-size: 13px;
    color: #888888;
}

.u-account-menu-list {
    padding: 4px 0;
}
.u-account-menu-item {
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #111111;
    cursor: pointer;
    transition: background .15s ease;
}
.u-account-menu-item:hover { background: var(--u-color-bg-hover); }
.u-account-menu-item-logout {
    color: #dc2626;
    border-top: 1px solid var(--u-color-border-2);
    margin-top: 4px;
    padding-top: 12px;
}

/* 移动端：底部菜单不超出屏幕，footer 强制显示 */
@media (max-width: 820px) {
    .u-nav-footer { display: block !important; padding: 8px 8px 12px; }
    /* 移动端：账户入口只显示头像，不撑爆布局 */
    .u-account-entry {
        justify-content: flex-start;
        padding: 4px 8px;
        gap: 0;
    }
    .u-account-entry .u-account-info,
    .u-account-entry .u-account-more {
        display: none !important;
    }
    .u-account-entry .u-account-avatar {
        width: 32px;
        height: 32px;
    }
    .u-account-menu {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    }
}


.u-nav-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.3);
    backdrop-filter: blur(2px); z-index: 8900;
    opacity: 0; pointer-events: none; transition: opacity 0.22s;
}
.u-nav-overlay.open { opacity: 1; pointer-events: auto; }

/* 主布局 */
.u-container {
    display: grid;
    grid-template-columns: 220px minmax(0, 640px) 300px;
    justify-content: center;
    gap: 0;
    height: 100vh;
    overflow: hidden;
    margin: 0 auto;
    max-width: 1160px;
}
.u-content {
    height: 100vh; overflow-y: auto;
    background: #ffffff;
    border: 1px solid #111111;
    border-right: none;
}
.u-aside {
    height: 100vh; overflow-y: auto;
    display: flex; flex-direction: column;
    border: 1px solid #111111;
    background: #ffffff;
}

.u-aside-empty {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    height: 100%; padding: 60px 24px;
    text-align: center; color: var(--u-color-text-3);
}

/* 移动端 */
@media (max-width: 820px) {
    html, body.u-body { overflow: auto; }

    .u-nav-panel {
        position: fixed; top: 0; left: 0; right: 0; bottom: auto;
        width: 100%; height: auto;
        border: none; border-bottom: 1px solid #111111;
        background: #ffffff; overflow: visible;
    }
    .u-nav-header { display: none; }
    .u-nav-body {
        display: flex; flex-direction: row; overflow-x: auto;
        padding: 0 4px; height: 56px; background: #ffffff;
    }
    .u-nav-group {
        display: inline-flex; flex-direction: column;
        flex-shrink: 0; height: 56px; margin: 0 2px;
    }
    .u-nav-l1 { justify-content: center; padding: 0 16px; height: 56px; border-radius: 0; }
    .u-nav-l1 .arrow { display: none; }
    .u-nav-l2-wrap {
        display: none; position: fixed; top: 56px; left: 0; right: 0; z-index: 8950;
        background: #ffffff; border-bottom: 1px solid #111111;
        padding: 12px 16px; z-index: 9001; max-height: 60vh; overflow-y: auto;
    }
    .u-nav-overlay {
        top: 56px; left: 0; right: 0; bottom: 0;
        inset: auto;
        z-index: 8900;
    }
    .u-nav-group.mobile-expanded .u-nav-l2-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
    .u-nav-group.mobile-expanded .u-nav-l1 { background: #f0f0f0; }
    .u-nav-l2 { display: inline-flex; justify-content: center; padding: 8px 16px; width: auto; }
    .u-nav-l2.active { background: #111111; color: #fff; }

    .u-container {
        display: block; margin-left: 0; height: auto;
        min-height: 100vh; padding-top: 56px; padding-bottom: 76px;
    }
    .u-content {
        height: auto; overflow: visible; padding: 16px;
        border: none; border-bottom: 1px solid #111111;
    }

    /* 右侧操作区变底部胶囊，不使用 !important */
    .u-aside {
        display: flex; position: fixed; left: 0; right: 0; bottom: 0;
        height: 60px; background: #ffffff; border: none;
        border-top: 1px solid #111111; z-index: 8000;
        padding: 0; padding-bottom: env(safe-area-inset-bottom, 0px);
        overflow-x: auto; flex-direction: row;
    }
    .u-aside > div {
        display: flex; flex-direction: row;
        align-items: center; height: 100%;
        margin: 0; padding: 0 8px;
        background: transparent; border: none;
    }
    .u-aside > div > div:first-child { display: none; }
    .u-aside > div > div:not(:first-child) {
        display: inline-flex; align-items: center;
        justify-content: center; padding: 6px 14px;
        border-radius: 999px; border: 1px solid #111111;
        background: #fff; font-size: 13px;
        height: 32px; margin: 0 4px;
        white-space: nowrap; color: #111;
    }
    .u-aside > div:last-child { display: none; }
}

/* 公共组件 */
.u-btn {
    display: inline-block; padding: 10px 20px;
    background: #fff; color: #111111; border: 1px solid #111111;
    border-radius: 6px; cursor: pointer; font-size: 15px;
    font-weight: 600; transition: all .2s ease;
}
.u-btn:hover { background: #ffffff; }
.u-btn-primary { background: #111111; color: #fff; }
.u-btn-primary:hover { background: #333333; }
.u-btn-danger { background: #fff; color: #d32f2f; border-color: #d32f2f; }
.u-btn-danger:hover { background: #fef2f2; }

.u-card {
    background: #fff; border: 1px solid #eee;
    border-radius: 6px; padding: 20px; margin-bottom: 20px;
}
.u-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 12px; color: #111; }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #111111; border-radius: 2px; }


/* ============================================================
   右侧边栏 - setAside 动态操作项组件
   ============================================================ */
.u-aside-head {
    padding: 16px;
    border-bottom: 1px solid #eee;
}
.u-ah-context {
    font-size: 13px;
    color: #888;
    margin-bottom: 4px;
}
.u-ah-context .flow {
    background: #ffffff;
    color: #444;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    margin-left: 6px;
}
.u-ah-title {
    font-size: 16px;
    font-weight: 700;
    color: #111;
}
.u-ah-desc {
    font-size: 13px;
    color: #666;
    margin-top: 6px;
    line-height: 1.5;
}
.u-aside-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.u-op-group-label {
    font-size: 13px;
    font-weight: 700;
    color: #888;
    margin-bottom: 8px;
}
.u-op-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.u-op-item {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #111;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}
.u-op-item:hover {
    background: #ffffff;
}
.u-oi-icon {
    font-size: 16px;
    margin-right: 10px;
}
.u-oi-body {
    flex: 1;
}
.u-oi-label {
    font-size: 15px;
    font-weight: 600;
    color: #111;
}
.u-oi-desc {
    font-size: 13px;
    color: #666;
    margin-top: 2px;
}
/* 隐藏旧版的箭头 */
.u-oi-arrow {
    display: none;
}




/* ============================================================
   移动端右侧操作区 (极简纯净版)
   ============================================================ */


/* ============================================================
   移动端右侧操作区 (极简纯净版)
   ============================================================ */


/* ============================================================
   移动端右侧操作区 (极简纯净版)
   ============================================================ */
@media (max-width: 820px) {
    .u-aside {
        display: flex;
        position: fixed;
        left: 0; right: 0; bottom: 0;
        height: 60px;
        background: #ffffff;
        border: none;
        border-top: 1px solid #111111;
        z-index: 8000;
        padding: 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        overflow-x: auto;
        overflow-y: hidden;
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }

    /* 隐藏所有非按钮文本和卡片容器（标题、描述等） */
    .u-aside-head,
    .u-widget-title,
    .u-op-group-label,
    .u-aside-empty,
    .u-aside-body > div:not(.u-op-list),
    .u-widget-card {
        display: none;
    }

    /* 针对原生 button 和 a 标签变成胶囊 */
    .u-aside button,
    .u-aside a.u-btn,
    .u-op-item {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 6px 14px;
        border-radius: 999px;
        border: 1px solid #111111;
        background: #fff;
        font-size: 13px;
        height: 32px;
        min-height: 32px;
        white-space: nowrap;
        color: #111;
        margin: 0;
        cursor: pointer;
        flex-shrink: 0;
    }

    /* 内部图标和文字去掉多余排版 */
    .u-op-item .u-oi-icon {
        margin-right: 4px;
        font-size: 14px;
    }
    .u-op-item .u-oi-body {
        display: inline;
    }
    .u-op-item .u-oi-desc,
    .u-op-item .u-oi-arrow {
        display: none;
    }
    
    /* 列表容器横向排布 */
    .u-op-list {
        display: flex;
        flex-direction: row;
        gap: 8px;
        align-items: center;
        padding: 0 12px;
        margin: 0;
        background: transparent;
        border: none;
    }
}


/* ============================================================
   移动端右侧操作区 (绝对精准胶囊版 - 仅针对真正的按钮)
   ============================================================ */
@media (max-width: 820px) {
    .u-aside {
        display: flex;
        position: fixed;
        left: 0; right: 0; bottom: 0;
        height: 60px;
        background: #ffffff;
        border: none;
        border-top: 1px solid #111111;
        z-index: 8000;
        padding: 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        overflow-x: auto;
        overflow-y: hidden;
        flex-direction: row;
        align-items: center;
    }

    /* 【关键】隐藏所有非按钮的顶层容器、标题、描述 */
    .u-aside-head, 
    .u-ah-context, 
    .u-ah-title, 
    .u-ah-desc,
    .u-op-group-label,
    .u-widget-title,
    .u-aside-empty {
        display: none !important;
    }

    /* 让中间包裹的 div 变成无边框透明行 */
    .u-aside-body, 
    .u-aside-body > div, 
    .u-op-list {
        display: flex !important;
        flex-direction: row !important;
        height: 100% !important;
        margin: 0 !important;
        padding: 0 12px !important;
        gap: 8px !important;
        background: transparent !important;
        border: none !important;
    }

    /* 【唯一被变成胶囊的元素】：真正的操作按钮 .u-op-item */
    .u-op-item {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 6px 14px !important;
        border-radius: 999px !important; /* 胶囊形状 */
        border: 1px solid #111111 !important; /* 黑边 */
        background: #fff !important;
        font-size: 13px !important;
        height: 32px !important;
        min-height: 32px !important;
        white-space: nowrap !important;
        color: #111 !important;
        margin: 0 !important;
        box-shadow: none !important;
    }

    /* 内部细节排版 */
    .u-op-item .u-oi-icon {
        margin-right: 6px !important;
        font-size: 14px !important;
    }
    .u-op-item .u-oi-body {
        display: inline-block !important;
    }
    .u-op-item .u-oi-label {
        display: inline !important;
        font-size: 13px !important;
    }
    
    /* 隐藏按钮内部的描述文字和箭头，胶囊里只留文字 */
    .u-op-item .u-oi-desc,
    .u-op-item .u-oi-arrow {
        display: none !important;
    }
}

/* [MOBILE-ACCOUNT-ABS] 移动端账户入口绝对定位 */
@media (max-width: 820px) {
    /* 1) footer 脱离文档流，钉在导航栏右上角，不再撑高、不再出滚动条 */
    .u-nav-panel {
        overflow: visible !important;
    }
    .u-nav-panel .u-nav-footer {
        position: absolute !important;
        top: 0 !important;
        right: 8px !important;
        height: 56px !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        background: transparent !important;
        display: flex !important;
        align-items: center !important;
        z-index: 9100 !important;
        width: auto !important;
    }

    /* 2) 账户入口只显示头像（32px），点击弹菜单 */
    .u-nav-panel .u-account-entry {
        padding: 0 !important;
        margin: 0 !important;
        gap: 0 !important;
        background: transparent !important;
        border-radius: 50% !important;
    }
    .u-nav-panel .u-account-entry .u-account-info,
    .u-nav-panel .u-account-entry .u-account-more {
        display: none !important;
    }
    .u-nav-panel .u-account-entry .u-account-avatar {
        width: 32px !important;
        height: 32px !important;
        border: 1px solid #111 !important;
        background: #fff !important;
    }

    /* 3) 未登录时的"登录"按钮：压缩为小胶囊，钉右上 */
    .u-nav-panel .u-nav-login-btn {
        width: auto !important;
        padding: 6px 14px !important;
        height: 32px !important;
        font-size: 13px !important;
        border-radius: 999px !important;
    }

    /* 4) 导航横向滚动区右侧留白，避免头像盖住最后一项 */
    .u-nav-panel .u-nav-body {
        padding-right: 52px !important;
    }

    /* 5) 弹出的账户菜单固定到底部胶囊上方，不超出屏幕 */
    .u-nav-panel .u-account-menu {
        position: fixed !important;
        left: 12px !important;
        right: 12px !important;
        top: auto !important;
        bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
        margin: 0 !important;
    }
}
