:root {
    --uc-primary: var(--primary-color, #FFB800);
    --uc-primary-dark: var(--primary-color-dark, #FF8F00);
    --uc-bg: var(--bg-primary, #0f1115);
    --uc-sidebar-bg: var(--bg-secondary, #1a1d24);
    --uc-card-bg: var(--bg-card, #1a1d24);
    --uc-text-primary: var(--text-primary, #ffffff);
    --uc-text-secondary: var(--text-secondary, #a0aec0);
    --uc-text-muted: var(--text-muted, #718096);
    --uc-border: var(--border-color, rgba(255,255,255,0.08));
    --uc-radius-lg: 20px;
    --uc-radius-md: 12px;
}

/* 【顶部导航遮挡修复 2026-10-23】
   public.css 给 html/body 设了 overflow-x:hidden，body 因此成为「不可滚动的 overflow 容器」；
   position:sticky 的包含块被定为 body 后永远没有可滚动距离 → 本页 .uc-sub-nav-container
   的 sticky 完全失效，滚动时子导航条整条滑进固定头部（.global-header，z-index:900）下方，
   表现为「顶部导航被遮挡」。
   改用 overflow-x:clip：仍然裁剪横向溢出，但不创建滚动容器 → sticky 恢复正常。
   旧内核不支持 clip 时该声明会被丢弃，自动回退 public.css 的 overflow-x:hidden（等同于现状，无回归）。 */
body {
    overflow-x: clip;
}

[data-theme="light"] {
    --uc-primary: #c9a227;
    --uc-primary-dark: #a68521;
    --uc-bg: #FFFFFF;
    --uc-sidebar-bg: #f5f6f7;
    --uc-card-bg: #ffffff;
    --uc-text-primary: #1a1a1a;
    --uc-text-secondary: #555555;
    --uc-text-muted: #888888;
    --uc-border: #e0e0e0;
}

.user-center-page {
    min-height: 100vh;
    background: var(--uc-bg);
}

.uc-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 20px 60px;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
}

/* 全站下线：金色"工作台"悬浮按钮（移动端侧边栏开关）。
   用户总入口统一由头像抽屉（uc_workbench）承担，此按钮属重复入口；
   !important 压制下方 ≤768px / ≤480px 媒体查询中的 display:flex 恢复规则 */
.uc-mobile-toggle {
    display: none !important;
}

.uc-sidebar-overlay {
    display: none;
}

.uc-sidebar {
    background: var(--uc-sidebar-bg);
    border-radius: var(--uc-radius-lg);
    padding: 20px;
    border: 1px solid var(--uc-border);
    height: fit-content;
    position: sticky;
    /* sticky 修复后真正生效：top 必须避开固定全局头部（70px + 16px 间距），
       否则侧边栏吸顶时会藏在头部下面 */
    top: 86px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    z-index: 60;
}

.uc-sidebar-header {
    position: relative;
    width: 100%;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--uc-border);
    margin-bottom: 20px;
}

.uc-sidebar-close {
    display: none;
}

.uc-user-card {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255, 184, 0, 0.3);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--uc-primary), var(--uc-primary-dark));
    font-size: 24px;
    font-weight: 700;
    color: #fff;
}

.user-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--uc-text-primary);
    max-width: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.uc-group-tag {
    display: inline-block;
    padding: 3px 10px;
    background: rgba(255, 184, 0, 0.15);
    color: var(--uc-primary);
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-top: 4px;
}

.uc-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.uc-nav-group {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    color: var(--uc-text-secondary);
    background: none;
    border: none;
    border-radius: var(--uc-radius-md);
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    width: 100%;
    text-decoration: none;
}

.uc-nav-group:hover {
    background: rgba(255, 184, 0, 0.08);
    color: var(--uc-text-primary);
}

.uc-nav-group.active {
    background: rgba(255, 184, 0, 0.15);
    color: var(--uc-primary);
}

.uc-nav-group:active {
    transform: scale(0.98);
}

.nav-group-icon {
    font-size: 18px;
    width: 22px;
    text-align: center;
}

.nav-group-title {
    font-size: 14px;
    font-weight: 500;
    flex: 1;
}

.nav-group-arrow {
    display: none;
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    font-weight: bold;
}

.uc-sidebar-footer {
    padding-top: 20px;
    border-top: 1px solid var(--uc-border);
    width: 100%;
    display: flex;
    justify-content: flex-start;
}

.uc-logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    color: #F56C6C;
    text-decoration: none;
    border-radius: var(--uc-radius-md);
    transition: all 0.2s;
    font-size: 14px;
    width: 100%;
}

.uc-logout-btn:hover {
    background: rgba(245, 108, 108, 0.15);
}

.uc-logout-btn span:first-child {
    font-size: 18px;
}

.uc-main {
    min-width: 0; /* grid 子项默认 min-width:auto，防内容把主列撑破出横向滚动 */
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.uc-sub-nav-container {
    background: var(--uc-card-bg);
    border-radius: var(--uc-radius-lg);
    padding: 0;
    border: 1px solid var(--uc-border);
    overflow: hidden;
    position: sticky;
    /* top 需避开固定全局头部（PC 70px / ≤768px 52px / ≤480px 48px），否则被遮挡 */
    top: 86px;
    z-index: 50;
}

.uc-sub-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    padding: 4px;
    background: var(--uc-bg);
}

.sub-nav-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    color: var(--uc-text-secondary);
    text-decoration: none;
    border-radius: var(--uc-radius-md);
    font-size: 13px;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
}

.sub-nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--uc-text-primary);
}

.sub-nav-item.active {
    background: rgba(255, 184, 0, 0.15);
    color: var(--uc-primary);
    font-weight: 500;
}

.sub-nav-icon {
    font-size: 14px;
}

.sub-nav-text {
    font-size: 13px;
}

.sub-nav-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 4px;
}

.sub-nav-badge--success {
    background: rgba(46, 204, 113, 0.15);
    color: #2ECC71;
}

.sub-nav-badge--warning {
    background: rgba(251, 146, 60, 0.15);
    color: #FFA940;
}

.sub-nav-badge--muted {
    background: rgba(160, 174, 192, 0.15);
    color: var(--uc-text-muted);
}

.uc-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--uc-text-primary);
    margin: 0;
}

.page-desc {
    font-size: 14px;
    color: var(--uc-text-secondary);
    margin: 4px 0 0;
}

.page-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.uc-content-section {
    background: var(--uc-card-bg);
    border-radius: var(--uc-radius-lg);
    padding: 24px;
    border: 1px solid var(--uc-border);
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--uc-text-primary);
    margin: 0 0 20px;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--uc-primary) 0%, var(--uc-primary-dark) 100%);
    color: #000;
    border: none;
    border-radius: var(--uc-radius-md);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 184, 0, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--uc-text-primary);
    border: 1px solid var(--uc-border);
    border-radius: var(--uc-radius-md);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

.btn-secondary:active {
    transform: scale(0.98);
}

@media (max-width: 1024px) {
    .uc-wrapper {
        grid-template-columns: 1fr;
        padding: 16px 16px 40px;
        gap: 16px;
    }

    .uc-mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
        width: auto;
        min-width: 44px;
        max-width: 120px;
        padding: 8px 12px;
        background: var(--uc-primary);
        color: #000;
        border: none;
        border-radius: 22px;
        font-size: 12px;
        font-weight: 600;
        cursor: pointer;
        margin-bottom: 16px;
        position: sticky;
        /* top 需避开固定全局头部：769-1024px 头部高 70px */
        top: 86px;
        z-index: 950;
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
        -webkit-tap-highlight-color: transparent;
        align-self: center;
    }

    .toggle-icon {
        font-size: 14px;
        flex-shrink: 0;
    }

    .toggle-text {
        font-size: 12px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 60px;
    }

    .uc-mobile-toggle:active {
        opacity: 0.85;
    }

    .uc-sidebar-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s, visibility 0.3s;
    }

    .uc-sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
    }

    .uc-sidebar {
        position: fixed;
        top: 80px;
        left: 0;
        width: 280px;
        height: calc(100vh - 80px);
        border-radius: 0;
        z-index: 1000;
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        padding: 20px;
        align-items: flex-start;
    }

    .uc-sidebar.show {
        transform: translateX(0);
    }

    .uc-sidebar-close {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
        border: none;
        background: var(--uc-border);
        color: var(--uc-text-primary);
        border-radius: 50%;
        font-size: 18px;
        cursor: pointer;
        z-index: 10;
        -webkit-tap-highlight-color: transparent;
    }

    .uc-sidebar-close:active {
        background: rgba(255, 184, 0, 0.3);
    }
}

@media (max-width: 768px) {
    .uc-sub-nav-container {
        /* ≤768px 全局头部实测高 56px，+8px 间距 */
        top: 64px;
    }

    .uc-mobile-toggle {
        /* ≤768px 头部 52px + 12px 间距 */
        top: 64px;
    }

    /* H5 标准形态：子导航横向滚动（480-768 区间原先 wrap 两行，占空间不 App） */
    .uc-sub-nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .uc-sub-nav::-webkit-scrollbar {
        display: none;
    }

    .sub-nav-item {
        flex-shrink: 0;
        /* 紧凑 App 密度：项更窄，一屏露出更多 tab */
        padding: 9px 12px;
        font-size: 12px;
        gap: 5px;
    }

    .sub-nav-item .sub-nav-icon {
        font-size: 14px;
    }

    /* 右侧渐隐遮罩：提示可横滑 */
    .uc-sub-nav-container {
        position: sticky;
        -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
        mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
    }

    /* 页面级标题/App 密度统一（各 uc 页面 .uc-page-title/.section-title 受益） */
    .uc-page-title {
        font-size: 18px;
        font-weight: 700;
        color: var(--uc-text-primary);
        margin: 0 0 14px;
    }

    .section-title {
        font-size: 15px;
        margin: 0 0 12px;
    }

    .uc-content-section {
        padding: 14px 12px;
    }

    /* 移动端纵向节奏收紧（用户偏好紧凑，24px 偏松散） */
    .uc-main {
        gap: 14px;
    }

    /* 底部 tab 栏已由 body 预留 50px+safe-area，wrapper 不再叠加 40px 双倍空白 */
    .uc-wrapper {
        padding-bottom: 20px;
    }
}

@media (max-width: 480px) {
    .uc-wrapper {
        padding: 12px 12px 20px;
        gap: 12px;
    }

    .uc-sub-nav-container {
        /* ≤480px 全局头部高 48px */
        top: 56px;
    }

    .uc-mobile-toggle {
        padding: 8px;
        font-size: 11px;
        min-width: 40px;
        max-width: 40px;
        border-radius: 50%;
        margin-bottom: 12px;
        gap: 0;
        /* ≤480px 头部 48px + 8px 间距 */
        top: 56px;
    }

    .toggle-text {
        display: none;
    }

    .toggle-icon {
        font-size: 16px;
    }

    .uc-sub-nav {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding: 4px 4px;
    }

    .sub-nav-item {
        padding: 10px 12px;
        font-size: 13px;
        flex-shrink: 0;
    }

    .uc-content-section {
        padding: 16px;
    }
}

/* ============================================================
   批次 5：PC 侧栏图标胶囊化（仅 ≥1025px 生效）
   - 侧栏列 280px → 96px，主内容多得 184px 横向空间
   - 用户卡折叠为纯头像；5 组入口改纵向图标胶囊
   - 组内导航仍由 renderSubNav 横排承载，点击行为零变化
   - 移动端 ≤1024px 由上方既有媒体查询接管，完全不受本块影响
   ============================================================ */
@media (min-width: 1025px) {

    .uc-wrapper {
        grid-template-columns: 96px 1fr;
    }

    .uc-sidebar {
        padding: 14px 10px;
        align-items: center;
    }

    /* 用户卡折叠为纯头像（姓名/身份标签在 96px 栏宽内放不下） */
    .uc-sidebar-header {
        padding-bottom: 14px;
        margin-bottom: 14px;
        display: flex;
        justify-content: center;
    }

    .uc-user-card {
        gap: 0;
    }

    .user-avatar {
        width: 48px;
        height: 48px;
    }

    .user-name,
    .uc-group-tag {
        display: none;
    }

    /* 5 组入口：图标在上、文字在下的纵向胶囊 */
    .uc-nav {
        gap: 8px;
    }

    .uc-nav-group {
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        padding: 12px 4px;
        min-height: 64px;
        border-radius: 16px;
    }

    .nav-group-icon {
        font-size: 20px;
        width: auto;
    }

    .nav-group-title {
        font-size: 11px;
        flex: none;
        white-space: nowrap;
    }

    /* 退出按钮图标化：font-size:0 隐藏裸文本，仅保留 🚪 图标 */
    .uc-sidebar-footer {
        padding-top: 14px;
        justify-content: center;
    }

    .uc-logout-btn {
        width: auto;
        padding: 10px;
        font-size: 0;
        gap: 0;
        border-radius: 50%;
    }

    .uc-logout-btn span:first-child {
        font-size: 18px;
    }
}

/* ============================================================
   【2026-10-26 全站导航收敛】页面级侧栏 / 顶部子导航下线
   ------------------------------------------------------------
   用户中心唯一入口已收敛为 header 头像点击弹出的工作台抽屉
   （app/common/uc_workbench.inc.php）。
   renderUserSidebar() / renderSubNav() 在 PHP 侧已提前 return，
   本块只做配套布局收敛，不改上方既有规则以降低回归面：
   1. .uc-wrapper 由「280px + 1fr」双列还原单列，回收空白列
   2. ≥1025px 的「96px + 1fr」图标胶囊列同步还原为 1fr
   3. .uc-mobile-toggle 永久隐藏（移动端改走头像抽屉）
   4. 新增页头「← 工作台」返回链接样式
   ============================================================ */
.uc-wrapper {
    grid-template-columns: 1fr;
}

.uc-mobile-toggle {
    display: none !important;
}

.uc-ds-page-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 6px;
    padding: 4px 10px 4px 8px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.6;
    color: var(--uc-primary);
    background: rgba(255, 184, 0, 0.10);
    border: 1px solid rgba(255, 184, 0, 0.28);
    border-radius: 999px;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.uc-ds-page-back:hover {
    background: rgba(255, 184, 0, 0.18);
    color: var(--uc-primary-dark);
}

[data-theme="light"] .uc-ds-page-back {
    color: #8a6d1f;
    background: rgba(201, 162, 39, 0.10);
    border-color: rgba(201, 162, 39, 0.30);
}

@media (min-width: 1025px) {
    .uc-wrapper {
        grid-template-columns: 1fr;
    }
}