/* 与控制台壳 index 对齐：顶栏高 56px、侧栏 220px；断点 1024 / 768 / 767（壳顶栏折叠与 FAB 为 <768） */
:root, [data-theme="light"] {
    --nav-height: 56px;
    --docs-topnav-h: 56px;
    --docs-platform-bar-h: var(--nav-height);
    --docs-chrome-top: calc(var(--docs-platform-bar-h) + var(--docs-topnav-h));
    --docs-sidebar-w: 220px;
    --bg: #f8fafc; --card: #ffffff; --border: #e2e8f0; --text: #1e293b; --text-muted: #64748b;
    --primary: #2563eb; --primary-hover: #1d4ed8; --danger: #dc2626; --radius: 12px; --radius-sm: 8px;
    --hover-bg: rgba(0,0,0,0.04); --active-bg: rgba(37, 99, 235, 0.1);
    --dropdown-bg: #ffffff; --dropdown-text: #0f172a; --dropdown-text-muted: #475569; --dropdown-hover: rgba(0,0,0,0.06);
    --exit-hover: rgba(220, 38, 38, 0.1);
    --code-panel-bg: #ffffff; --code-panel-body-bg: #ffffff; --code-panel-text: #333333; --code-panel-title: #4A89F9; --code-panel-border: #e5e7eb; --code-panel-shadow: 0 1px 3px rgba(0,0,0,0.08);
    --bg-elevated: #ffffff; --portal-dd-bg: #ffffff; --portal-dd-hover: rgba(0,0,0,0.06); --portal-dd-active: rgba(37, 99, 235, 0.1);
    --portal-nav-h: 56px; --portal-top-radius: 8px; --hero-from: #1e3a8a; --hero-to: #3b82f6;
}
[data-theme="dark"] { --bg: #0f0f12; --card: #18181c; --border: #2a2a2e; --text: #e4e4e7; --text-muted: #71717a; --primary: #3b82f6; --primary-hover: #2563eb; --danger: #ef4444; --hover-bg: rgba(255,255,255,0.04); --active-bg: rgba(59, 130, 246, 0.12); --dropdown-bg: #222226; --dropdown-text: #f4f4f5; --dropdown-text-muted: #a1a1aa; --dropdown-hover: rgba(255,255,255,0.08); --exit-hover: rgba(248, 113, 113, 0.1); --code-panel-bg: #18181c; --code-panel-body-bg: #18181c; --code-panel-text: #e4e4e7; --code-panel-title: #93c5fd; --code-panel-border: #2a2a2e; --code-panel-shadow: 0 1px 3px rgba(0,0,0,0.2); --bg-elevated: #141418; --portal-dd-bg: #222226; --portal-dd-hover: rgba(255,255,255,0.08); --portal-dd-active: rgba(59, 130, 246, 0.18); --portal-nav-h: 56px; --portal-top-radius: 8px; --hero-from: #172554; --hero-to: #1d4ed8; }
[data-theme="warm"] { --bg: #faf6f1; --card: #fffdf9; --border: #e8dcd2; --text: #2d2520; --text-muted: #7a6b63; --primary: #c2410c; --danger: #b91c1c; --hover-bg: rgba(0,0,0,0.03); --active-bg: rgba(194, 65, 12, 0.12); --dropdown-bg: #ffffff; --dropdown-text: #1c1917; --dropdown-text-muted: #57534e; --dropdown-hover: rgba(0,0,0,0.05); --exit-hover: rgba(185, 28, 28, 0.1); --code-panel-bg: #ffffff; --code-panel-body-bg: #fffdf9; --code-panel-text: #1c1917; --code-panel-title: #c2410c; --code-panel-border: #e8dcd2; --code-panel-shadow: 0 1px 3px rgba(0,0,0,0.06); --bg-elevated: #fffdf9; --portal-dd-bg: #fffdf9; --portal-dd-hover: rgba(0,0,0,0.05); --portal-dd-active: rgba(194, 65, 12, 0.12); --portal-nav-h: 56px; --portal-top-radius: 8px; --hero-from: #7c2d12; --hero-to: #ea580c; }
[data-theme="ocean"] { --bg: #0c1929; --card: #132f4c; --border: #1e4976; --text: #e3f2fd; --text-muted: #90caf9; --primary: #29b6f6; --danger: #ef5350; --hover-bg: rgba(255,255,255,0.06); --active-bg: rgba(41, 182, 246, 0.2); --dropdown-bg: #1a3a5c; --dropdown-text: #e3f2fd; --dropdown-text-muted: #90caf9; --dropdown-hover: rgba(255,255,255,0.1); --exit-hover: rgba(239, 83, 80, 0.2); --code-panel-bg: #132f4c; --code-panel-body-bg: #0d2137; --code-panel-text: #e3f2fd; --code-panel-title: #90caf9; --code-panel-border: #1e4976; --code-panel-shadow: 0 1px 3px rgba(0,0,0,0.15); --bg-elevated: #132f4c; --portal-dd-bg: #1a3a5c; --portal-dd-hover: rgba(255,255,255,0.1); --portal-dd-active: rgba(41, 182, 246, 0.2); --portal-nav-h: 56px; --portal-top-radius: 8px; --hero-from: #0d47a1; --hero-to: #0277bd; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
/* 平板/移动端：去掉顶栏与抽屉内点击高亮与按压背景 */
@media (max-width: 1023px) {
    html { -webkit-tap-highlight-color: transparent; }
    .topbar button:active,
    .topbar a:active,
    .portal-hamburger:active,
    .portal-sidebar-fab:active,
    .theme-toggle-portal:active,
    .portal-nav-action:active,
    .portal-avatar-btn:active,
    .portal-drawer-scroll a.portal-drawer-item:active,
    .portal-theme-option:active,
    .portal-user-panel a:active,
    .portal-copy:active {
        background-color: transparent !important;
        -webkit-tap-highlight-color: transparent;
    }
}
body {
    margin: 0;
    padding-top: var(--portal-nav-h);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}
/* 门户壳被 portal.html 以 iframe(bmFrame=1) 内嵌时，隐藏壳层本体避免“壳中套壳” */
html.portal-embed-in-frame body {
    padding-top: 0 !important;
}
html.portal-embed-in-frame .topbar,
html.portal-embed-in-frame .portal-drawer,
html.portal-embed-in-frame .portal-drawer-backdrop {
    display: none !important;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; }

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: var(--nav-height);
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
}
.topbar-inner.portal-topbar-inner {
    max-width: 1400px; margin: 0 auto; padding: 0 24px;
    min-height: var(--portal-nav-h);
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: nowrap; gap: 16px;
}
.portal-nav-left {
    display: flex; align-items: center; gap: 24px; min-width: 0; flex: 1;
}
.portal-logo {
    display: flex; align-items: center; gap: 8px; flex-shrink: 0;
    font-size: 1.25rem; font-weight: 600; color: var(--text);
    text-decoration: none; letter-spacing: -0.02em;
}
.portal-logo:hover { text-decoration: none; color: var(--text); }
.portal-logo .logo-svg { width: 24px; height: 24px; color: var(--primary); flex-shrink: 0; }
.portal-top-links {
    display: flex; align-items: center; gap: 4px; flex-wrap: nowrap;
    min-width: 0;
}
.portal-top-link {
    font-size: 0.875rem; color: var(--text-muted); text-decoration: none;
    padding: 8px 12px; border-radius: var(--portal-top-radius);
    border-bottom: 2px solid transparent; white-space: nowrap; flex-shrink: 0;
}
.portal-top-link:hover { color: var(--primary); background: transparent; text-decoration: none; }
.portal-top-link.portal-top-active {
    color: var(--primary); font-weight: 500; border-bottom-color: var(--primary);
}
.portal-nav-right {
    display: flex; align-items: center; gap: 2px; flex-shrink: 0; flex-wrap: nowrap;
}

/* 控制台入口左侧：全站搜索（展开后输入框在图标左侧） */
.portal-top-search {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.portal-search-panel[hidden] {
    display: none !important;
}
.portal-search-panel:not([hidden]) {
    display: flex;
    align-items: center;
}
.portal-search-form {
    display: flex;
    align-items: stretch;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-elevated);
}
.portal-search-form input[type="search"] {
    width: min(36vw, 240px);
    min-width: 120px;
    border: none;
    padding: 6px 10px;
    font-size: 0.8125rem;
    background: transparent;
    color: var(--text);
    outline: none;
    font-family: inherit;
}
.portal-search-form button[type="submit"] {
    border: none;
    padding: 0 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    font-family: inherit;
}
.portal-search-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 0;
    border: none;
    border-radius: var(--portal-top-radius);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}
.portal-search-toggle:hover {
    color: var(--primary);
    background: var(--hover-bg, rgba(0, 0, 0, 0.06));
}
.portal-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
    white-space: nowrap;
}

.nav-actions { display: contents; }
.nav-action-pad { padding: 6px 12px; font-size: 0.875rem; font-weight: 500; border-radius: var(--radius-sm); }
.nav-actions .btn { padding: 6px 12px; font-size: 0.875rem; }
.portal-hamburger {
    display: none; align-items: center; justify-content: center;
    width: 44px; height: 44px; margin: 0; padding: 0; border: none;
    background: transparent; color: var(--text); border-radius: var(--radius-sm);
    cursor: pointer; flex-shrink: 0;
    position: relative;
    z-index: 1004;
    -webkit-tap-highlight-color: transparent;
}
.portal-hamburger:hover { background: var(--hover-bg, rgba(0,0,0,0.06)); }
.portal-hamburger svg { width: 22px; height: 22px; }
body.portal-nav-collapsed .portal-hamburger { display: inline-flex !important; }
/* 出现汉堡时：左侧与抽屉入口一排收紧 */
body.portal-nav-collapsed .portal-topbar-inner { gap: 8px; }
body.portal-nav-collapsed .portal-nav-left { gap: 2px; }
body.portal-nav-collapsed .portal-hamburger {
    width: 40px; height: 40px; min-width: 40px;
}
body.portal-nav-collapsed .portal-top-links {
    position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important;
    margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; border: 0 !important;
}
.portal-drawer-backdrop {
    display: none; position: fixed; inset: 0; background: rgba(15,23,42,0.4); z-index: 1200;
}
body.portal-drawer-open .portal-drawer-backdrop { display: block; }
/* 关闭动画期间保持遮罩（对齐控制台壳 drawer-closing） */
body.portal-drawer-closing .portal-drawer-backdrop { display: block !important; }
.portal-drawer {
    position: fixed; top: 0; left: 0; bottom: 0; width: min(300px, 88vw); max-width: 320px;
    background: var(--bg-elevated); border-right: 1px solid var(--border); z-index: 1201;
    transform: translateX(-100%); transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
    box-shadow: 8px 0 32px rgba(0,0,0,0.1);
    pointer-events: none;
    display: flex; flex-direction: column; overflow: hidden;
    padding: 0;
}
.portal-drawer-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    height: var(--portal-nav-h);
    min-height: var(--portal-nav-h);
    box-sizing: border-box;
    padding: 0 max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
}
.portal-drawer-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.02em;
    line-height: 1;
}
.portal-drawer-logo:hover { color: var(--text); text-decoration: none; }
.portal-drawer-logo .logo-svg {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    color: var(--primary);
    display: block;
}
.portal-drawer-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: 0;
    padding-top: 8px;
    padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
}
.portal-drawer-section-label {
    margin: 12px 0 4px 16px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.portal-drawer-item.portal-drawer-link {
    display: flex;
    align-items: center;
    gap: 10px;
    width: calc(100% - 8px);
    max-width: 100%;
    box-sizing: border-box;
    margin: 0 0 0 8px;
    padding: 16px 20px;
    border-radius: 0 var(--radius-sm, 6px) var(--radius-sm, 6px) 0;
    /*border-left: 2px solid transparent;*/
    border-bottom: none;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s, background 0.15s;
}
.portal-drawer-scroll .portal-drawer-item.portal-drawer-link + .portal-drawer-item.portal-drawer-link { margin-top: 2px; }
.portal-drawer-scroll .portal-drawer-section-label + .portal-drawer-item.portal-drawer-link { margin-top: 4px; }
.portal-drawer-item.portal-drawer-link:hover {
    color: var(--text);
    background: var(--hover-bg);
    text-decoration: none;
}
.portal-drawer-item.portal-drawer-link .menu-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.portal-drawer-item.portal-drawer-link .menu-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
}
.portal-drawer-item.portal-drawer-link.portal-drawer-active {
    color: var(--primary);
    font-weight: 600;
    border-left-color: var(--primary);
    background: var(--active-bg);
}
.portal-drawer-item.portal-drawer-link.portal-drawer-current-site {
    color: var(--primary);
    font-weight: 600;
    border-left-color: var(--primary);
    background: var(--active-bg);
}
.portal-drawer-item.portal-drawer-link.portal-drawer-sublink {
    padding-top: 12px;
    padding-bottom: 12px;
    font-size: 0.875rem;
}
.portal-drawer-item.portal-drawer-link.cp-drawer-sublink {
    padding-left: 36px;
    font-weight: 450;
}
/* 门户/控制台壳统一左侧竖向菜单语义（panel + menu-group/menu-item），
 * 用于 FAB 展开的左侧菜单面板，视觉对齐控制台 admin-sidebar。 */
.portal-fab-menu-panel.portal-left-menu .menu-group { margin-top: 2px; }
.portal-fab-menu-panel.portal-left-menu .menu-group-app { margin-top: 20px; }
.portal-fab-menu-panel.portal-left-menu .menu-title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 0 20px 8px;
}
.portal-fab-menu-panel.portal-left-menu .menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: calc(100% - 8px);
    box-sizing: border-box;
    margin: 0 0 0 8px;
    padding: 10px 20px;
    border-radius: 0 var(--radius-sm, 6px) var(--radius-sm, 6px) 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s, background 0.15s;
}
.portal-fab-menu-panel.portal-left-menu .menu-item:hover {
    color: var(--text);
    background: var(--hover-bg);
    text-decoration: none;
}
.portal-fab-menu-panel.portal-left-menu .menu-item.active {
    color: var(--primary);
    background: var(--active-bg);
    font-weight: 600;
}
.portal-fab-menu-panel.portal-left-menu .menu-item + .menu-item { margin-top: 2px; }
.portal-fab-menu-panel.portal-left-menu .menu-item .menu-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.portal-fab-menu-panel.portal-left-menu .menu-item .menu-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
}
body.portal-drawer-open .portal-drawer,
body.portal-drawer-closing .portal-drawer { pointer-events: auto; }
body.portal-drawer-open .portal-drawer { transform: translateX(0); }
.theme-dropdown-portal { position: relative; z-index: 5; }
/* 悬停/键盘焦点时展开，间隙桥接避免移入菜单时闪关 */
.theme-dropdown-portal::after {
    content: ''; position: absolute; left: -6px; right: -6px; top: 100%;
    height: 18px; z-index: 209;
}
.theme-dropdown-portal:hover .portal-theme-menu,
.theme-dropdown-portal:focus-within .portal-theme-menu {
    display: block;
}
.theme-dropdown-portal.theme-dd-picked .portal-theme-menu {
    display: none !important;
}
.theme-toggle-portal {
    width: 36px; height: 36px; min-width: 36px; padding: 0;
    border: none; border-radius: var(--portal-top-radius);
    background: transparent; color: var(--text-muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.theme-toggle-portal:hover { color: var(--primary); background: transparent; }
.theme-toggle-portal svg { width: 18px; height: 18px; }
/* 与主题键同规格：36px 高、圆角、透明底、次要色文字 */
.portal-nav-action {
    display: inline-flex; align-items: center; justify-content: center;
    height: 36px; min-height: 36px; padding: 0 6px;
    border: none; border-radius: var(--portal-top-radius);
    background: transparent; color: var(--text-muted);
    font-size: 0.875rem; font-family: inherit;
    text-decoration: none; white-space: nowrap; cursor: pointer;
    box-sizing: border-box; transition: color 0.15s, background 0.15s;
}
.portal-nav-action:hover {
    color: var(--primary); background: transparent; text-decoration: none;
}
/* 主题下拉：浅色 / 深色 / 暖色 / 海洋 独立配色（与控制台一致） */
.portal-theme-menu {
    display: none; position: absolute; top: calc(100% + 10px); right: 0;
    width: min(204px, calc(100vw - 20px));
    max-width: calc(100vw - 20px);
    box-sizing: border-box;
    padding: 8px 10px 10px; z-index: 210;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 40px rgba(15, 23, 42, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
}
.portal-theme-menu::before {
    content: ''; position: absolute; top: -5px; right: 14px;
    width: 9px; height: 9px; background: #fff;
    border-left: 1px solid #e2e8f0; border-top: 1px solid #e2e8f0;
    transform: rotate(45deg);
}
.portal-theme-option {
    display: block; width: 100%; text-align: left; padding: 8px 8px; font-size: 0.8125rem;
    border: none; background: none; cursor: pointer; font-family: inherit;
    color: #334155; border-radius: 6px;
}
.portal-theme-option:hover { background: #f1f5f9; color: #334155; }
.portal-theme-option.active { color: #2563eb; font-weight: 600; background: #eff6ff; }
[data-theme="dark"] .portal-theme-menu {
    background: #27272a;
    border-color: #3f3f46;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] .portal-theme-menu::before {
    background: #27272a;
    border-color: #3f3f46;
}
[data-theme="dark"] .portal-theme-option { color: #e4e4e7; }
[data-theme="dark"] .portal-theme-option:hover { background: #3f3f46; color: #fafafa; }
[data-theme="dark"] .portal-theme-option.active { color: #93c5fd; font-weight: 600; background: rgba(59, 130, 246, 0.22); }
[data-theme="warm"] .portal-theme-menu {
    background: #fffdf9;
    border-color: #e8dcd2;
    box-shadow: 0 10px 36px rgba(45, 37, 32, 0.12), 0 0 0 1px rgba(232, 220, 210, 0.85);
}
[data-theme="warm"] .portal-theme-menu::before {
    background: #fffdf9;
    border-color: #e8dcd2;
}
[data-theme="warm"] .portal-theme-option { color: #292524; }
[data-theme="warm"] .portal-theme-option:hover { background: #faf5f0; color: #1c1917; }
[data-theme="warm"] .portal-theme-option.active { color: #c2410c; font-weight: 600; background: #ffedd5; }
[data-theme="ocean"] .portal-theme-menu {
    background: #152a45;
    border-color: #2d5a8a;
    box-shadow: 0 14px 44px rgba(0, 10, 30, 0.5), 0 0 0 1px rgba(100, 180, 255, 0.14);
}
[data-theme="ocean"] .portal-theme-menu::before {
    background: #152a45;
    border-color: #2d5a8a;
}
[data-theme="ocean"] .portal-theme-option { color: #e0f4fc; }
[data-theme="ocean"] .portal-theme-option:hover { background: #1e3a5c; color: #ffffff; }
[data-theme="ocean"] .portal-theme-option.active { color: #7dd3fc; font-weight: 600; background: rgba(41, 182, 246, 0.28); }
.portal-user-wrap {
    position: relative; z-index: 5; display: inline-flex; align-items: center;
    min-height: 36px; /* 与 .theme-toggle-portal 同高，使 .portal-user-panel 与 .portal-theme-menu 的 top: calc(100%+10px) 对齐 */
}
.portal-user-wrap::after {
    content: ''; position: absolute; left: -10px; right: -10px; top: 100%;
    height: 16px; z-index: 209;
}
.portal-user-wrap:hover .portal-user-panel,
.portal-user-wrap:focus-within .portal-user-panel {
    display: block;
}
.portal-user-wrap.portal-dd-picked .portal-user-panel {
    display: none !important;
}
.portal-avatar-btn {
    width: 24px; height: 24px; border-radius: 50%; border: none;
    background: transparent; cursor: pointer; padding: 0; overflow: hidden;
    font-family: inherit; flex-shrink: 0;
}
.portal-avatar-btn:hover { filter: brightness(1.05); }
.portal-avatar-btn .portal-avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.portal-user-panel {
    display: none; position: absolute; top: calc(100% + 10px); right: 0;
    width: min(204px, calc(100vw - 20px));
    max-width: calc(100vw - 20px);
    box-sizing: border-box;
    background: var(--portal-dd-bg); border: 1px solid var(--border); border-radius: 10px;
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.12), 0 2px 8px rgba(15, 23, 42, 0.06);
    padding: 8px 10px 10px; z-index: 210;
}
.portal-user-panel::before {
    content: ''; position: absolute; top: -5px; right: 14px;
    width: 9px; height: 9px; background: var(--portal-dd-bg);
    border-left: 1px solid var(--border); border-top: 1px solid var(--border);
    transform: rotate(45deg);
}
.portal-user-panel .pu-head {
    padding: 8px 4px 12px; margin: 0 0 4px;
    border-bottom: 1px solid var(--border);
}
.portal-user-panel .pu-name { font-weight: 700; font-size: 0.9375rem; word-break: break-all; color: var(--text); }
.portal-user-panel .pu-id { margin-top: 10px; font-size: 0.8125rem; color: var(--text-muted); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.portal-user-panel code { font-size: 0.8125rem; background: none; padding: 0; font-family: ui-monospace, monospace; max-width: 120px; overflow: hidden; text-overflow: ellipsis; color: var(--text-muted); }
.portal-copy { padding: 2px 8px; font-size: 0.6875rem; border: 1px solid var(--border); border-radius: 4px; background: transparent; cursor: pointer; color: var(--text-muted); }
.portal-user-panel .pu-exit {
    display: block; padding: 10px 8px 4px; margin-top: 2px; color: #dc2626; text-decoration: none;
    font-size: 0.8125rem; border-radius: 6px;
}
.portal-user-panel .pu-exit:hover { background: rgba(220,38,38,0.08); }

.hidden { display: none !important; }

/* 移动端：顶栏左右 10px（与 bigmodel-responsive.css 一致，!important 防被其它规则覆盖）；主内容区左右 12px */
@media (max-width: 767px) {
    .portal-topbar-inner {
        padding-left: max(10px, env(safe-area-inset-left, 0px)) !important;
        padding-right: max(10px, env(safe-area-inset-right, 0px)) !important;
    }
}

@media (max-width: 767px) {
    .portal-drawer-item.portal-drawer-link.cp-drawer-sublink {
        padding-left: 30px;
    }
}

/* —— 首屏门禁（对齐控制台壳 shell-booting / shell-ready） —— */
body.has-portal-shell.shell-booting {
    overflow: hidden;
}
body.has-portal-shell.shell-booting .topbar,
body.has-portal-shell.shell-booting .portal-drawer,
body.has-portal-shell.shell-booting .portal-drawer-backdrop {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.portal-shell-boot-loader {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 15% 18%, rgba(37, 99, 235, 0.1), transparent 48%),
        radial-gradient(circle at 84% 82%, rgba(41, 182, 246, 0.12), transparent 52%),
        var(--bg, #f8fafc);
    transition: opacity 0.22s ease, visibility 0.22s ease;
}
body.has-portal-shell.shell-ready .portal-shell-boot-loader {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.portal-shell-boot-spinner {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2.5px solid color-mix(in srgb, var(--primary, #2563eb) 20%, transparent);
    border-top-color: var(--primary, #2563eb);
    animation: portal-shell-spin 0.85s linear infinite;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.14);
}
@keyframes portal-shell-spin {
    to { transform: rotate(360deg); }
}

/* FAB 打开的左侧菜单遮罩：统一结构类，具体页面只负责 open 态触发与 top 变量 */
.portal-fab-menu-backdrop {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: var(--portal-fab-backdrop-top, 0px);
    margin: 0;
    padding: 0;
    border: none;
    background: rgba(15, 23, 42, 0.4);
    z-index: 1000;
    cursor: pointer;
}
@media (max-width: 767px) {
    .portal-fab-menu-panel {
        position: fixed;
        left: 0;
        top: var(--portal-fab-backdrop-top, var(--portal-nav-h));
        width: min(300px, 88vw);
        max-width: 320px;
        height: calc(100dvh - var(--portal-fab-backdrop-top, var(--portal-nav-h)));
        z-index: var(--portal-fab-panel-z, 1002);
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
        border-right: 1px solid var(--border);
        padding-bottom: env(safe-area-inset-bottom, 0px);
        -webkit-overflow-scrolling: touch;
    }
    .portal-fab-menu-open .portal-fab-menu-panel {
        transform: translateX(0);
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.1);
    }
}

/*
 * 左下角 FAB：与控制台壳 admin-sidebar-fab 同款（凹面纽扣 + 四主题）
 * 默认仅移动端显示；页面需放置按钮（如 id="docsFabMenuBtn" / class="portal-sidebar-fab"）
 */
.portal-sidebar-fab {
    display: none;
    position: fixed;
    left: clamp(12px, var(--portal-fab-init-x, max(18px, env(safe-area-inset-left, 0px) + 10px)), calc(100vw - 57px));
    top: var(--portal-fab-init-y, auto);
    bottom: var(--portal-fab-init-bottom, max(22px, env(safe-area-inset-bottom, 0px) + 12px));
    z-index: 999;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: none;
    padding: 0;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    isolation: isolate;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    color: #3f3f46;
    background-color: #c5c5cd;
    background-image:
        radial-gradient(circle at 50% 50%,
            rgba(0, 0, 0, 0.14) 0%,
            rgba(0, 0, 0, 0.06) 28%,
            transparent 46%,
            rgba(255, 255, 255, 0.42) 62%,
            rgba(255, 255, 255, 0.2) 78%,
            rgba(255, 255, 255, 0.06) 100%),
        linear-gradient(160deg, #d4d4dc 0%, #e0e0e8 38%, #ebebf2 72%, #f2f2f8 100%);
    box-shadow:
        inset 0 8px 20px rgba(0, 0, 0, 0.2),
        inset 0 -5px 14px rgba(255, 255, 255, 0.55),
        inset 0 0 18px rgba(0, 0, 0, 0.06),
        2px 5px 10px rgba(0, 0, 0, 0.12),
        4px 12px 22px rgba(0, 0, 0, 0.1);
    transition: transform 0.22s cubic-bezier(0.34, 1.2, 0.64, 1), box-shadow 0.22s ease;
    touch-action: none;
    user-select: none;
}
.portal-sidebar-fab:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow:
        inset 0 8px 22px rgba(0, 0, 0, 0.18),
        inset 0 -5px 15px rgba(255, 255, 255, 0.58),
        inset 0 0 20px rgba(0, 0, 0, 0.05),
        2px 6px 12px rgba(0, 0, 0, 0.14),
        5px 16px 26px rgba(0, 0, 0, 0.12);
}
.portal-sidebar-fab:active {
    transform: translateY(0) scale(0.98);
    box-shadow:
        inset 0 11px 26px rgba(0, 0, 0, 0.22),
        inset 0 -3px 12px rgba(255, 255, 255, 0.4),
        inset 0 0 22px rgba(0, 0, 0, 0.08),
        1px 3px 8px rgba(0, 0, 0, 0.12);
}
.portal-sidebar-fab svg {
    position: relative;
    z-index: 1;
    width: 24px;
    height: 24px;
    filter: drop-shadow(0 -1px 1px rgba(255, 255, 255, 0.25));
}
[data-theme="dark"] .portal-sidebar-fab {
    color: #e4e4e7;
    background-color: #1c1c20;
    background-image:
        radial-gradient(circle at 50% 50%,
            rgba(0, 0, 0, 0.55) 0%,
            rgba(0, 0, 0, 0.28) 28%,
            transparent 46%,
            rgba(255, 255, 255, 0.12) 64%,
            rgba(255, 255, 255, 0.05) 82%,
            rgba(255, 255, 255, 0.02) 100%),
        linear-gradient(160deg, #3a3a42 0%, #323238 40%, #2a2a30 100%);
    box-shadow:
        inset 0 9px 22px rgba(0, 0, 0, 0.65),
        inset 0 -5px 14px rgba(255, 255, 255, 0.1),
        inset 0 0 20px rgba(0, 0, 0, 0.35),
        2px 5px 12px rgba(0, 0, 0, 0.5),
        4px 14px 26px rgba(0, 0, 0, 0.45);
}
[data-theme="dark"] .portal-sidebar-fab:hover {
    box-shadow:
        inset 0 9px 24px rgba(0, 0, 0, 0.6),
        inset 0 -5px 15px rgba(255, 255, 255, 0.12),
        inset 0 0 22px rgba(0, 0, 0, 0.32),
        2px 6px 14px rgba(0, 0, 0, 0.52),
        5px 18px 30px rgba(0, 0, 0, 0.48);
}
[data-theme="dark"] .portal-sidebar-fab:active {
    box-shadow:
        inset 0 12px 28px rgba(0, 0, 0, 0.72),
        inset 0 -3px 12px rgba(255, 255, 255, 0.08),
        inset 0 0 24px rgba(0, 0, 0, 0.45),
        1px 3px 10px rgba(0, 0, 0, 0.42);
}
[data-theme="dark"] .portal-sidebar-fab svg {
    filter: drop-shadow(0 -1px 1px rgba(255, 255, 255, 0.08));
}
[data-theme="warm"] .portal-sidebar-fab {
    color: #3d3632;
    background-color: #c9bfb4;
    background-image:
        radial-gradient(circle at 50% 50%,
            rgba(45, 37, 32, 0.2) 0%,
            rgba(45, 37, 32, 0.08) 28%,
            transparent 46%,
            rgba(255, 255, 255, 0.38) 62%,
            rgba(255, 255, 255, 0.16) 78%,
            rgba(255, 255, 255, 0.05) 100%),
        linear-gradient(160deg, #ddd2c8 0%, #e8dfd4 42%, #f0e8e0 100%);
    box-shadow:
        inset 0 8px 20px rgba(45, 37, 32, 0.18),
        inset 0 -5px 14px rgba(255, 255, 255, 0.48),
        inset 0 0 18px rgba(45, 37, 32, 0.06),
        2px 5px 10px rgba(45, 37, 32, 0.12),
        4px 12px 22px rgba(45, 37, 32, 0.1);
}
[data-theme="warm"] .portal-sidebar-fab:hover {
    box-shadow:
        inset 0 8px 22px rgba(45, 37, 32, 0.16),
        inset 0 -5px 15px rgba(255, 255, 255, 0.52),
        inset 0 0 20px rgba(45, 37, 32, 0.05),
        2px 6px 12px rgba(45, 37, 32, 0.14),
        5px 16px 26px rgba(45, 37, 32, 0.12);
}
[data-theme="warm"] .portal-sidebar-fab:active {
    box-shadow:
        inset 0 11px 26px rgba(45, 37, 32, 0.2),
        inset 0 -3px 12px rgba(255, 255, 255, 0.38),
        inset 0 0 22px rgba(45, 37, 32, 0.07),
        1px 3px 8px rgba(45, 37, 32, 0.12);
}
[data-theme="warm"] .portal-sidebar-fab svg {
    filter: drop-shadow(0 -1px 1px rgba(255, 255, 255, 0.22));
}
[data-theme="ocean"] .portal-sidebar-fab {
    color: #e3f2fd;
    background-color: #183a5c;
    background-image:
        radial-gradient(circle at 50% 50%,
            rgba(0, 0, 0, 0.45) 0%,
            rgba(0, 0, 0, 0.22) 28%,
            transparent 46%,
            rgba(180, 230, 255, 0.28) 62%,
            rgba(180, 230, 255, 0.1) 78%,
            rgba(100, 180, 255, 0.04) 100%),
        linear-gradient(160deg, #2d5a88 0%, #254d78 45%, #1e4568 100%);
    box-shadow:
        inset 0 8px 20px rgba(0, 0, 0, 0.45),
        inset 0 -5px 14px rgba(180, 230, 255, 0.22),
        inset 0 0 18px rgba(0, 0, 0, 0.28),
        0 0 14px rgba(100, 180, 255, 0.18),
        2px 5px 12px rgba(0, 0, 0, 0.4),
        4px 14px 26px rgba(0, 0, 0, 0.38);
}
[data-theme="ocean"] .portal-sidebar-fab:hover {
    box-shadow:
        inset 0 8px 22px rgba(0, 0, 0, 0.42),
        inset 0 -5px 15px rgba(200, 240, 255, 0.26),
        inset 0 0 20px rgba(0, 0, 0, 0.25),
        0 0 18px rgba(120, 200, 255, 0.24),
        2px 6px 14px rgba(0, 0, 0, 0.42),
        5px 18px 30px rgba(0, 0, 0, 0.4);
}
[data-theme="ocean"] .portal-sidebar-fab:active {
    box-shadow:
        inset 0 11px 26px rgba(0, 0, 0, 0.52),
        inset 0 -3px 12px rgba(180, 230, 255, 0.16),
        inset 0 0 22px rgba(0, 0, 0, 0.35),
        0 0 12px rgba(80, 160, 230, 0.14),
        1px 3px 10px rgba(0, 0, 0, 0.38);
}
[data-theme="ocean"] .portal-sidebar-fab svg {
    filter: drop-shadow(0 -1px 1px rgba(200, 240, 255, 0.15));
}
@media (min-width: 768px) {
    .portal-sidebar-fab { display: none !important; }
}
@media (max-width: 767px) {
    .portal-sidebar-fab { display: flex !important; }
}
