+ {/* 品牌色 */}
+
+
品牌色
+
+ {BRAND_OPTIONS.map((c) => (
+
set('brand', c)}
+ title={c}
+ />
+ ))}
+
+
+
+ {/* 深色模式 */}
+
+ 深色模式
+
+
+ {/* 信息密度 */}
+
+
信息密度
+
+ {(['normal', 'compact'] as const).map((v) => (
+
+ ))}
+
+
+
+ {/* 侧栏风格 */}
+
+
侧栏风格
+
+ {(['dark', 'light'] as const).map((v) => (
+
+ ))}
+
+
+
+
+ );
+}
diff --git a/src/shell/SideMenu.tsx b/src/shell/SideMenu.tsx
new file mode 100644
index 0000000..b4fa42c
--- /dev/null
+++ b/src/shell/SideMenu.tsx
@@ -0,0 +1,247 @@
+// SideMenu — 三级可折叠侧栏 + 折叠态浮出菜单
+// 从原型 frame.jsx SideMenu 迁移,数据改为从 /api/menu 加载(含 404 降级)
+import { useEffect, useRef, useState } from 'react';
+import { Icon } from '../components/ui/Icon';
+import { collectLeaves, fetchMenu } from '../api/menu';
+import type { MenuRoot, MenuItem } from '../api/menu';
+
+interface SideMenuProps {
+ collapsed: boolean;
+ /** 当前激活的路由路径,如 /page/xxx 或 /todo */
+ activePath: string;
+ /** 点击叶子菜单时回调,传 templateId(或 '__todo__' 代表待办) */
+ onOpen: (templateId: string) => void;
+ onToggle: () => void;
+}
+
+// 判断 menuItem 或其子孙是否在激活路径下
+function containsActive(m: MenuItem | MenuRoot, activePath: string): boolean {
+ if ('templateId' in m && m.templateId && activePath === `/page/${m.templateId}`) return true;
+ return (m.children ?? []).some((c) => containsActive(c, activePath));
+}
+
+// 递归渲染菜单项(展开态)
+function RenderItem({
+ m,
+ lv,
+ open,
+ activePath,
+ onOpen,
+ onToggle,
+}: {
+ m: MenuItem | MenuRoot;
+ lv: number;
+ open: Set
;
+ activePath: string;
+ onOpen: (templateId: string) => void;
+ onToggle: (id: string) => void;
+}) {
+ const isLeaf = 'templateId' in m && !!m.templateId;
+ const isGroup = !!(m.children?.length);
+ const isOn = isLeaf && activePath === `/page/${(m as MenuItem).templateId}`;
+ const isOpen = open.has(m.id);
+ const inPath = containsActive(m, activePath);
+
+ const handleClick = () => {
+ if (isLeaf) {
+ onOpen((m as MenuItem).templateId!);
+ } else {
+ onToggle(m.id);
+ }
+ };
+
+ return (
+
+
+ {lv === 0 ? (
+
+ ) : (
+
+ )}
+ {m.name}
+ {isGroup ? (
+
+
+
+ ) : null}
+
+ {isGroup && isOpen
+ ? (m.children ?? []).map((c) => (
+
+ ))
+ : null}
+
+ );
+}
+
+// 根节点取 icon 映射(后端不传 icon,按 id 前缀猜测)
+function getMenuIcon(m: MenuRoot): string {
+ const id = m.id.toUpperCase();
+ if (id.includes('MESSAGE') || id.includes('TODO') || id.includes('APPROVE')) return 'todo';
+ if (id.includes('PROJ') || id.includes('EQUIP') || id.includes('CONTRACT')) return 'crane';
+ if (id.includes('HR') || id.includes('PERSON') || id.includes('STAFF')) return 'team';
+ if (id.includes('REPORT') || id.includes('QUERY') || id.includes('STAT')) return 'chart';
+ if (id.includes('SYS') || id.includes('PERM') || id.includes('ROLE')) return 'gear';
+ if (id.includes('PLATFORM') || id.includes('META') || id.includes('DESIGN')) return 'db';
+ if (id.includes('ORG')) return 'org';
+ return 'list';
+}
+
+export function SideMenu({ collapsed, activePath, onOpen, onToggle }: SideMenuProps) {
+ const [roots, setRoots] = useState([]);
+ const [loadError, setLoadError] = useState(false);
+ const [openSet, setOpenSet] = useState>(() => new Set());
+ const [flyout, setFlyout] = useState(null);
+ const flyoutRef = useRef(null);
+ flyoutRef.current = flyout;
+
+ // 加载菜单,404/失败时降级
+ useEffect(() => {
+ let alive = true;
+ fetchMenu()
+ .then((data) => {
+ if (!alive) return;
+ setRoots(data.roots ?? []);
+ setLoadError(false);
+ // 默认展开第一个根节点
+ if (data.roots?.length) {
+ setOpenSet(new Set([data.roots[0].id]));
+ }
+ })
+ .catch(() => {
+ if (alive) setLoadError(true);
+ });
+ return () => {
+ alive = false;
+ };
+ }, []);
+
+ const toggleGroup = (id: string) =>
+ setOpenSet((s) => {
+ const x = new Set(s);
+ x.has(id) ? x.delete(id) : x.add(id);
+ return x;
+ });
+
+ // 折叠态:图标列 + 浮出菜单
+ if (collapsed) {
+ return (
+
+ );
+ }
+
+ // 展开态
+ return (
+
+ );
+}
diff --git a/src/shell/TabBar.tsx b/src/shell/TabBar.tsx
new file mode 100644
index 0000000..a7b6c7c
--- /dev/null
+++ b/src/shell/TabBar.tsx
@@ -0,0 +1,48 @@
+// TabBar — 多 Tab 页签条,从原型 frame.jsx TabBar 迁移
+import { Icon } from '../components/ui/Icon';
+
+export interface Tab {
+ key: string; // 路由路径,如 /todo 或 /page/xxx
+ title: string;
+}
+
+interface TabBarProps {
+ tabs: Tab[];
+ activeKey: string;
+ onActive: (key: string) => void;
+ onClose: (key: string) => void;
+}
+
+// 「待办」tab 固定显示 todo 图标
+const TODO_PATH = '/todo';
+
+export function TabBar({ tabs, activeKey, onActive, onClose }: TabBarProps) {
+ return (
+
+ {tabs.map((t) => (
+
onActive(t.key)}
+ >
+ {t.key === TODO_PATH ? : null}
+ {t.title}
+ {/* 待办 tab 不可关闭(保底 tab) */}
+ {t.key !== TODO_PATH ? (
+ {
+ e.stopPropagation();
+ onClose(t.key);
+ }}
+ >
+
+
+ ) : null}
+
+ ))}
+
+ );
+}
diff --git a/src/shell/Topbar.tsx b/src/shell/Topbar.tsx
new file mode 100644
index 0000000..7b05cb6
--- /dev/null
+++ b/src/shell/Topbar.tsx
@@ -0,0 +1,69 @@
+// Topbar — 顶栏:品牌 + 搜索 + 待办入口 + 用户信息 + 设置入口
+// 从原型 frame.jsx Topbar 迁移,待办 badge 数由父层传入(后续可接真实 API)
+import { Icon } from '../components/ui/Icon';
+import { GlobalSearch } from './GlobalSearch';
+import type { MenuLeaf } from '../api/menu';
+import type { UserProfile } from '../auth/token';
+
+interface TopbarProps {
+ leaves: MenuLeaf[];
+ profile: UserProfile | null;
+ todoBadge?: number;
+ onOpenTodo: () => void;
+ onOpenTemplate: (templateId: string) => void;
+ onOpenSettings: () => void;
+}
+
+export function Topbar({
+ leaves,
+ profile,
+ todoBadge,
+ onOpenTodo,
+ onOpenTemplate,
+ onOpenSettings,
+}: TopbarProps) {
+ // 用户名显示:取 name 首字作头像
+ const avatarChar = profile?.name?.[0] ?? '?';
+
+ return (
+
+ {/* 品牌 */}
+
+ E4
+
+ EIP4{' '}
+
+ 企业管理平台
+
+
+
+
+
+
+ {/* 全局搜索 */}
+
+
+ {/* 待办铃铛 */}
+
+
+ {/* 设置 */}
+
+
+ {/* 用户信息 */}
+
+ {avatarChar}
+
+ {profile?.name ?? '未登录'}
+ {profile?.account ?? ''}
+
+
+
+ );
+}
diff --git a/src/shell/theme.css b/src/shell/theme.css
new file mode 100644
index 0000000..92f5d13
--- /dev/null
+++ b/src/shell/theme.css
@@ -0,0 +1,420 @@
+/* ============================================================================
+ EIP4 设计系统 CSS 变量 — 从原型 EIP4 平台原型.html 完整迁移
+ 品牌色/文字/背景/线条/圆角/阴影/框架尺寸,支持深色/紧凑/浅色侧栏/思源字体
+ ============================================================================ */
+
+:root {
+ /* 品牌色(JS 可覆盖 --brand 实现四选一切换) */
+ --brand: #2B5CE6;
+ --brand-strong: color-mix(in oklch, var(--brand), black 16%);
+ --brand-soft: color-mix(in srgb, var(--brand), transparent 90%);
+ --brand-softer: color-mix(in srgb, var(--brand), transparent 95%);
+ --on-brand: #ffffff;
+
+ /* 功能色 */
+ --ok: #1f9e62;
+ --ok-soft: #e2f5ec;
+ --warn: #d8860b;
+ --warn-soft: #faf0dc;
+ --err: #d1453b;
+ --err-soft: #fbe9e7;
+ --info-soft: var(--brand-soft);
+
+ /* 中性色 */
+ --bg: #eef0f3;
+ --surface: #ffffff;
+ --surface-2: #f6f7f9;
+ --line: #e2e5ea;
+ --line-strong: #cdd2d9;
+ --text: #1c2128;
+ --text-2: #555c66;
+ --text-3: #8b929c;
+
+ /* 侧栏色(深色默认) */
+ --sidebar-bg: #1b2330;
+ --sidebar-text: #aeb6c2;
+ --sidebar-text-active: #ffffff;
+
+ /* 顶栏色 */
+ --topbar-bg: var(--surface);
+
+ /* 字体 */
+ --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
+ --font-num: "SF Pro Text", -apple-system, var(--font);
+
+ /* 字号 */
+ --fs: 14px;
+ --fs-sm: 12.5px;
+ --fs-lg: 16px;
+
+ /* 控件/行高 */
+ --ctl-h: 34px;
+ --row-h: 42px;
+
+ /* 间距 */
+ --pad: 16px;
+ --pad-lg: 20px;
+
+ /* 圆角 */
+ --radius: 6px;
+ --radius-lg: 10px;
+
+ /* 阴影 */
+ --shadow-1: 0 1px 2px rgba(28,33,40,.05), 0 1px 6px rgba(28,33,40,.04);
+ --shadow-2: 0 4px 14px rgba(28,33,40,.10), 0 1px 4px rgba(28,33,40,.06);
+ --shadow-3: 0 12px 40px rgba(28,33,40,.18);
+
+ /* 框架尺寸 */
+ --topbar-h: 50px;
+ --tabbar-h: 38px;
+ --sidebar-w: 216px;
+ --sidebar-w-min: 56px;
+}
+
+/* 紧凑密度 */
+[data-density="compact"] {
+ --fs: 13px;
+ --fs-sm: 12px;
+ --fs-lg: 15px;
+ --ctl-h: 28px;
+ --row-h: 34px;
+ --pad: 12px;
+ --pad-lg: 16px;
+ --tabbar-h: 34px;
+ --topbar-h: 46px;
+}
+
+/* 浅色侧栏 */
+[data-sidebar="light"] {
+ --sidebar-bg: #ffffff;
+ --sidebar-text: #555c66;
+ --sidebar-text-active: var(--brand);
+}
+
+/* 深色模式 */
+[data-dark="1"] {
+ --bg: #15181d;
+ --surface: #1e232b;
+ --surface-2: #262c36;
+ --line: #323945;
+ --line-strong: #424b59;
+ --text: #e8eaee;
+ --text-2: #a3aab5;
+ --text-3: #6d7480;
+ --sidebar-bg: #181d25;
+ --sidebar-text: #9099a6;
+ --sidebar-text-active: #ffffff;
+ --ok-soft: #18352a;
+ --warn-soft: #3a2e15;
+ --err-soft: #3c211f;
+ --shadow-1: 0 1px 2px rgba(0,0,0,.3);
+ --shadow-2: 0 4px 14px rgba(0,0,0,.4);
+ --shadow-3: 0 12px 40px rgba(0,0,0,.55);
+}
+[data-dark="1"][data-sidebar="light"] {
+ --sidebar-bg: #1e232b;
+ --sidebar-text: #a3aab5;
+ --sidebar-text-active: #fff;
+}
+
+/* 思源字体 */
+[data-font="noto"] {
+ --font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
+}
+
+/* ============================================================================
+ 基础重置
+ ============================================================================ */
+*, *::before, *::after { box-sizing: border-box; }
+
+body {
+ font-family: var(--font);
+ font-size: var(--fs);
+ color: var(--text);
+ background: var(--bg);
+ overflow: hidden;
+ margin: 0;
+}
+
+/* 滚动条 */
+::-webkit-scrollbar { width: 6px; height: 6px; }
+::-webkit-scrollbar-track { background: transparent; }
+::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }
+
+/* ============================================================================
+ 通用工具类(全局可用)
+ ============================================================================ */
+
+/* 按钮 */
+.btn {
+ display: inline-flex; align-items: center; justify-content: center; gap: 5px;
+ height: var(--ctl-h); padding: 0 14px; border-radius: var(--radius);
+ border: 1px solid var(--line-strong); background: var(--surface);
+ color: var(--text); font-size: var(--fs); cursor: pointer; white-space: nowrap;
+ transition: all .12s; font-family: inherit;
+}
+.btn:hover { border-color: var(--brand); color: var(--brand); }
+.btn:disabled { opacity: .5; cursor: not-allowed; }
+.btn-pri { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
+.btn-pri:hover { background: var(--brand-strong); border-color: var(--brand-strong); color: var(--on-brand); }
+.btn-danger-ghost { color: var(--err); border-color: color-mix(in srgb, var(--err), transparent 55%); }
+.btn-danger-ghost:hover { background: var(--err-soft); border-color: var(--err); color: var(--err); }
+.btn-text { border-color: transparent; background: transparent; color: var(--brand); padding: 0 6px; height: auto; }
+.btn-sm { height: calc(var(--ctl-h) - 8px); padding: 0 10px; font-size: var(--fs-sm); }
+
+/* 输入框 */
+.input,
+.select-like {
+ height: var(--ctl-h); padding: 0 10px; border: 1px solid var(--line-strong);
+ border-radius: var(--radius); background: var(--surface); color: var(--text);
+ font-size: var(--fs); font-family: inherit; outline: none; min-width: 0;
+ transition: border-color .12s, box-shadow .12s;
+}
+.input:focus,
+.select-like:focus-within { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
+.input::placeholder { color: var(--text-3); }
+.select-like { display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
+.select-like .ph { color: var(--text-3); }
+
+/* 标签 */
+.tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 4px; font-size: var(--fs-sm); white-space: nowrap; }
+.tag .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
+.tag-ok { background: var(--ok-soft); color: var(--ok); }
+.tag-warn { background: var(--warn-soft); color: var(--warn); }
+.tag-err { background: var(--err-soft); color: var(--err); }
+.tag-info { background: var(--brand-soft); color: var(--brand); }
+.tag-gray { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); }
+
+/* 卡片 */
+.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); }
+
+/* 表格 */
+.tbl-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
+table.tbl { border-collapse: separate; border-spacing: 0; width: 100%; font-size: var(--fs); }
+.tbl th, .tbl td { height: var(--row-h); padding: 0 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
+.tbl th { background: var(--surface-2); color: var(--text-2); font-weight: 500; font-size: var(--fs-sm); position: sticky; top: 0; z-index: 2; user-select: none; }
+.tbl tbody tr:hover td { background: var(--brand-softer); }
+.tbl tbody tr.sel td { background: var(--brand-soft); }
+.cb { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; }
+
+/* 表单字段 */
+.field { display: flex; flex-direction: column; gap: 4px; }
+.field > label { font-size: var(--fs-sm); color: var(--text-2); }
+.field > label .req { color: var(--err); margin-right: 2px; }
+.field .err-msg { font-size: var(--fs-sm); color: var(--err); }
+.field.has-err .input { border-color: var(--err); }
+.field.span2 { grid-column: span 2; }
+
+/* 弹层公共 */
+.mask {
+ position: fixed; inset: 0; background: rgba(0,0,0,.35);
+ display: flex; align-items: center; justify-content: center; z-index: 200;
+}
+.dlg {
+ background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-3);
+ display: flex; flex-direction: column; max-height: 86vh;
+ animation: popIn .18s cubic-bezier(.2,.9,.3,1.2); min-width: 420px;
+}
+@keyframes popIn {
+ from { opacity: 0; transform: scale(.92); }
+ to { opacity: 1; transform: scale(1); }
+}
+.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 14px var(--pad-lg); border-bottom: 1px solid var(--line); }
+.dlg-head h3 { font-size: var(--fs-lg); font-weight: 600; margin: 0; }
+.dlg-body { padding: var(--pad-lg); overflow: auto; }
+.dlg-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px var(--pad-lg); border-top: 1px solid var(--line); }
+.x-btn { width: 28px; height: 28px; border: none; background: transparent; border-radius: 6px; cursor: pointer; color: var(--text-3); display: flex; align-items: center; justify-content: center; }
+.x-btn:hover { background: var(--surface-2); color: var(--text); }
+
+/* 抽屉 */
+.drawer {
+ background: var(--surface); box-shadow: var(--shadow-3); z-index: 200;
+ display: flex; flex-direction: column;
+ animation: slideIn .2s cubic-bezier(.2,.9,.3,1);
+}
+@keyframes slideIn {
+ from { transform: translateX(100%); }
+ to { transform: translateX(0); }
+}
+
+/* Toast */
+.toast-wrap { position: fixed; bottom: 24px; right: 24px; z-index: 300; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
+.toast {
+ display: flex; align-items: center; gap: 8px;
+ background: var(--surface); border: 1px solid var(--line);
+ box-shadow: var(--shadow-2); border-radius: 8px; padding: 9px 16px;
+ font-size: var(--fs);
+ animation: toastIn .25s cubic-bezier(.2,.9,.3,1.3);
+}
+@keyframes toastIn {
+ from { opacity: 0; transform: translateY(12px) scale(.95); }
+ to { opacity: 1; transform: translateY(0) scale(1); }
+}
+
+/* 分页 */
+.pagination { display: flex; align-items: center; gap: 6px; justify-content: flex-end; font-size: var(--fs-sm); color: var(--text-2); }
+.pg-btn { min-width: 26px; height: 26px; padding: 0 6px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface); color: var(--text-2); cursor: pointer; font-size: var(--fs-sm); font-family: inherit; }
+.pg-btn:hover { border-color: var(--brand); color: var(--brand); }
+.pg-btn.on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
+.pg-btn:disabled { opacity: .4; cursor: not-allowed; }
+
+/* 树节点 */
+.tree-node { display: flex; align-items: center; gap: 6px; height: calc(var(--ctl-h) - 2px); padding: 0 8px; border-radius: var(--radius); cursor: pointer; color: var(--text-2); white-space: nowrap; }
+.tree-node:hover { background: var(--surface-2); color: var(--text); }
+.tree-node.on { background: var(--brand-soft); color: var(--brand); font-weight: 500; }
+.tree-toggle { width: 16px; height: 16px; display: flex; align-items: center; justify-content: center; color: var(--text-3); flex: 0 0 auto; transition: transform .15s; }
+.tree-toggle.open { transform: rotate(90deg); }
+
+/* 辅助 */
+.muted { color: var(--text-3); }
+.sub-text { color: var(--text-2); font-size: var(--fs-sm); }
+.link { color: var(--brand); cursor: pointer; }
+.link:hover { text-decoration: underline; }
+.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; flex: 0 0 auto; }
+.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 48px 0; color: var(--text-3); font-size: var(--fs-sm); }
+.hr { border: none; border-top: 1px solid var(--line); margin: var(--pad) 0; }
+
+/* ============================================================================
+ 壳层布局
+ ============================================================================ */
+
+/* 应用根 */
+.app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
+
+/* 顶栏 */
+.topbar {
+ height: var(--topbar-h); background: var(--topbar-bg);
+ border-bottom: 1px solid var(--line);
+ display: flex; align-items: center; gap: 14px;
+ padding: 0 16px; flex: 0 0 auto; z-index: 60;
+}
+.brand { display: flex; align-items: center; gap: 9px; cursor: pointer; text-decoration: none; color: inherit; }
+.brand-mark {
+ width: 28px; height: 28px; border-radius: 7px;
+ background: var(--brand); color: var(--on-brand);
+ display: flex; align-items: center; justify-content: center;
+ font-weight: 700; font-size: 13px; letter-spacing: -.5px;
+}
+.brand-name { font-weight: 600; font-size: var(--fs); white-space: nowrap; }
+.tb-icon {
+ position: relative; width: 34px; height: 34px; border: none;
+ background: transparent; border-radius: 8px; color: var(--text-2);
+ cursor: pointer; display: flex; align-items: center; justify-content: center;
+}
+.tb-icon:hover { background: var(--surface-2); color: var(--text); }
+.tb-badge {
+ position: absolute; top: 2px; right: 0; min-width: 16px; height: 16px;
+ padding: 0 4px; border-radius: 8px; background: var(--err); color: #fff;
+ font-size: 10px; font-weight: 600; display: flex; align-items: center; justify-content: center;
+}
+.tb-user { display: flex; align-items: center; gap: 8px; padding-left: 10px; border-left: 1px solid var(--line); white-space: nowrap; cursor: pointer; }
+.tb-user-name { display: flex; flex-direction: column; line-height: 1.25; font-size: var(--fs-sm); }
+
+/* 全局搜索 */
+.gsearch {
+ position: relative; display: flex; align-items: center; gap: 7px;
+ width: 240px; height: 32px; padding: 0 10px;
+ background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px;
+}
+.gsearch:focus-within { border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 2px var(--brand-soft); }
+.gsearch input { border: none; outline: none; background: transparent; flex: 1; min-width: 0; font-size: var(--fs-sm); color: var(--text); font-family: inherit; }
+.gsearch-drop {
+ position: absolute; top: calc(100% + 6px); left: 0; width: 300px;
+ z-index: 80; padding: 4px; box-shadow: var(--shadow-2);
+ max-height: 320px; overflow: auto;
+}
+
+/* 主区域(侧栏 + 工作区) */
+.app-main { display: flex; flex: 1 1 0; overflow: hidden; }
+
+/* 侧栏 */
+.sidebar {
+ width: var(--sidebar-w); background: var(--sidebar-bg);
+ display: flex; flex-direction: column; flex: 0 0 auto;
+ transition: width .18s; border-right: 1px solid var(--line);
+ overflow: hidden;
+}
+.sidebar.collapsed { width: var(--sidebar-w-min); }
+.sm-list { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px 6px 0; }
+.sm-item {
+ display: flex; align-items: center; gap: 9px; height: 36px;
+ padding-right: 10px; border-radius: 7px; color: var(--sidebar-text);
+ cursor: pointer; font-size: var(--fs); white-space: nowrap; user-select: none;
+}
+.sm-item:hover { background: color-mix(in srgb, var(--sidebar-text), transparent 90%); color: var(--sidebar-text-active); }
+.sm-item.on { background: var(--brand); color: #fff; font-weight: 500; }
+[data-sidebar="light"] .sm-item.on { background: var(--brand-soft); color: var(--brand); }
+.sm-item.in-path { color: var(--sidebar-text-active); }
+.sm-item.icon-only { justify-content: center; padding: 0; height: 40px; width: 44px; }
+.sm-name { flex: 1; overflow: hidden; text-overflow: ellipsis; }
+.sm-badge { min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--err); color: #fff; font-size: 10.5px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
+.sm-badge.mini { width: 7px; height: 7px; min-width: 0; padding: 0; border-radius: 50%; position: absolute; top: 4px; right: 4px; }
+.sm-flyout {
+ position: absolute; left: calc(100% + 6px); top: 0; min-width: 180px;
+ z-index: 90; padding: 4px; box-shadow: var(--shadow-2);
+}
+.sm-flyout-title { padding: 7px 10px 5px; font-size: 11px; color: var(--text-3); }
+.sm-collapse {
+ display: flex; align-items: center; justify-content: center; gap: 7px;
+ height: 40px; margin: 8px; border: none; border-radius: 7px;
+ background: transparent; color: var(--sidebar-text); cursor: pointer; font-size: var(--fs-sm);
+ font-family: inherit;
+}
+.sm-collapse:hover { background: color-mix(in srgb, var(--sidebar-text), transparent 90%); color: var(--sidebar-text-active); }
+
+/* 工作区(Tab条 + 内容) */
+.app-work { display: flex; flex-direction: column; flex: 1 1 0; overflow: hidden; }
+
+/* Tab 条 */
+.tabbar {
+ height: var(--tabbar-h); display: flex; align-items: flex-end; gap: 3px;
+ padding: 0 10px; background: var(--surface); border-bottom: 1px solid var(--line);
+ overflow-x: auto; flex: 0 0 auto;
+}
+.wtab {
+ display: flex; align-items: center; gap: 6px;
+ height: calc(var(--tabbar-h) - 6px); padding: 0 12px;
+ border-radius: 7px 7px 0 0; border: 1px solid transparent; border-bottom: none;
+ color: var(--text-2); font-size: var(--fs-sm); cursor: pointer; white-space: nowrap;
+ user-select: none; background: transparent;
+}
+.wtab:hover { background: var(--surface-2); color: var(--text); }
+.wtab.on {
+ background: var(--bg); border-color: var(--line); color: var(--text);
+ font-weight: 500; position: relative;
+}
+.wtab.on::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--bg); }
+.wtab.on::before { content: ''; position: absolute; left: 10px; right: 10px; top: 0; height: 2px; border-radius: 0 0 2px 2px; background: var(--brand); }
+.wtab-x { display: flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 4px; color: var(--text-3); }
+.wtab-x:hover { background: var(--line); color: var(--text); }
+
+/* 内容区 */
+.app-pages { flex: 1 1 0; overflow: auto; background: var(--bg); }
+
+/* SettingsDrawer 面板 */
+.settings-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
+.settings-row:last-child { border-bottom: none; }
+.settings-label { font-size: var(--fs-sm); color: var(--text-2); }
+.color-swatches { display: flex; gap: 6px; }
+.color-swatch {
+ width: 22px; height: 22px; border-radius: 50%; cursor: pointer;
+ border: 2px solid transparent; transition: transform .1s;
+}
+.color-swatch.active { border-color: var(--text); transform: scale(1.15); }
+.toggle-btn {
+ width: 40px; height: 22px; border-radius: 11px; border: none; cursor: pointer;
+ background: var(--line-strong); position: relative; transition: background .15s;
+}
+.toggle-btn.on { background: var(--brand); }
+.toggle-btn::after {
+ content: ''; position: absolute; top: 3px; left: 3px;
+ width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s;
+}
+.toggle-btn.on::after { transform: translateX(18px); }
+.radio-group { display: flex; gap: 6px; }
+.radio-option {
+ padding: 3px 10px; border-radius: 5px; border: 1px solid var(--line-strong);
+ background: var(--surface); color: var(--text-2); font-size: var(--fs-sm);
+ cursor: pointer; transition: all .12s; font-family: inherit;
+}
+.radio-option.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); font-weight: 500; }