SettingsCenterDialog.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  1. <script setup lang="ts">
  2. import { computed, nextTick, reactive, ref, watch } from 'vue'
  3. import type { Profile } from '@shared/types'
  4. import AccountSecurityPanel from '@/components/app/AccountSecurityPanel.vue'
  5. import AgentIdentityPanel from '@/components/app/AgentIdentityPanel.vue'
  6. import DuplexVoicePanel from '@/components/app/DuplexVoicePanel.vue'
  7. import ModelServicesPanel from '@/components/app/ModelServicesPanel.vue'
  8. import NodePairingPanel from '@/components/app/NodePairingPanel.vue'
  9. import SystemManagementPanel from '@/components/app/SystemManagementPanel.vue'
  10. import SystemOverviewPanel from '@/components/app/SystemOverviewPanel.vue'
  11. import SystemUpdatePanel from '@/components/app/SystemUpdatePanel.vue'
  12. import AgentAvatar from '@/components/common/AgentAvatar.vue'
  13. import type { ProfileIdentityInput } from '@/api/profiles'
  14. import AppIcon from '@/components/common/AppIcon.vue'
  15. type SettingsPage =
  16. | 'agent-identity'
  17. | 'agent-models'
  18. | 'account-security'
  19. | 'account-mobile'
  20. | 'appearance'
  21. | 'system-overview'
  22. | 'system-users'
  23. | 'system-connection'
  24. | 'system-push'
  25. | 'system-nodes'
  26. | 'system-voice'
  27. | 'system-update'
  28. type SettingsIcon = 'users' | 'model' | 'settings' | 'panel' | 'sun' | 'link' | 'bell' | 'audio' | 'refresh'
  29. type ThemePreference = 'light' | 'dark' | 'system'
  30. interface NavigationItem {
  31. key: SettingsPage
  32. label: string
  33. icon: SettingsIcon
  34. }
  35. const props = withDefaults(defineProps<{
  36. open: boolean
  37. initialPage?: SettingsPage
  38. userName?: string
  39. pairingUserName?: string
  40. activeProfile?: Profile
  41. profiles?: Profile[]
  42. theme?: 'light' | 'dark'
  43. themePreference?: ThemePreference
  44. insecureTransport?: boolean
  45. isAdmin?: boolean
  46. upstreamReady?: boolean
  47. upstreamError?: string
  48. identityBusy?: boolean
  49. identityError?: string
  50. identityResetVersion?: number
  51. }>(), {
  52. initialPage: 'agent-identity',
  53. userName: '',
  54. pairingUserName: '',
  55. activeProfile: undefined,
  56. profiles: () => [],
  57. theme: 'light',
  58. themePreference: 'system',
  59. insecureTransport: false,
  60. isAdmin: false,
  61. upstreamReady: false,
  62. upstreamError: '',
  63. identityBusy: false,
  64. identityError: '',
  65. identityResetVersion: 0,
  66. })
  67. const emit = defineEmits<{
  68. close: []
  69. logout: []
  70. 'select-profile': [profile: string]
  71. 'save-identity': [input: ProfileIdentityInput]
  72. 'set-theme': [theme: ThemePreference]
  73. }>()
  74. const dialog = ref<HTMLElement>()
  75. const contentTitle = ref<HTMLElement>()
  76. const settingsAgentTrigger = ref<HTMLButtonElement>()
  77. const activePage = ref<SettingsPage>('agent-identity')
  78. const profileMenuOpen = ref(false)
  79. const mobileDetailOpen = ref(false)
  80. const updateLocked = ref(false)
  81. const accountCanSave = ref(false)
  82. const dirtyPages = reactive<Partial<Record<SettingsPage, boolean>>>({})
  83. const agentItems = computed<NavigationItem[]>(() => [
  84. { key: 'agent-identity', label: '身份与头像', icon: 'users' },
  85. ...(props.isAdmin ? [{ key: 'agent-models', label: '模型与 Provider', icon: 'model' } satisfies NavigationItem] : []),
  86. ])
  87. const accountItems: NavigationItem[] = [
  88. { key: 'account-security', label: '登录与安全', icon: 'settings' },
  89. { key: 'account-mobile', label: '手机登录', icon: 'panel' },
  90. { key: 'appearance', label: '外观', icon: 'sun' },
  91. ]
  92. const systemItems: NavigationItem[] = [
  93. { key: 'system-overview', label: '系统概览', icon: 'panel' },
  94. { key: 'system-users', label: '用户与权限', icon: 'users' },
  95. { key: 'system-connection', label: 'Hermes 连接', icon: 'link' },
  96. { key: 'system-push', label: '消息推送', icon: 'bell' },
  97. { key: 'system-nodes', label: '节点与设备', icon: 'panel' },
  98. { key: 'system-voice', label: '双流语音', icon: 'audio' },
  99. { key: 'system-update', label: '更新与回滚', icon: 'refresh' },
  100. ]
  101. const allAllowedPages = computed(() => new Set<SettingsPage>([
  102. ...agentItems.value.map(item => item.key),
  103. ...accountItems.map(item => item.key),
  104. ...(props.isAdmin ? systemItems.map(item => item.key) : []),
  105. ]))
  106. const activeDirty = computed(() => Boolean(dirtyPages[activePage.value]))
  107. const showFixedFooter = computed(() => activePage.value === 'agent-identity' || activePage.value === 'account-security')
  108. const activeTitle = computed(() => ({
  109. 'agent-identity': '身份与头像',
  110. 'agent-models': '模型与 Provider',
  111. 'account-security': '登录与安全',
  112. 'account-mobile': '手机登录',
  113. appearance: '外观',
  114. 'system-overview': '系统概览',
  115. 'system-users': '用户与权限',
  116. 'system-connection': 'Hermes 连接',
  117. 'system-push': '消息推送',
  118. 'system-nodes': '节点与设备',
  119. 'system-voice': '双流语音',
  120. 'system-update': '更新与回滚',
  121. })[activePage.value])
  122. const accountName = computed(() => props.pairingUserName || props.userName || '当前账号')
  123. const activeScope = computed(() => {
  124. if (activePage.value.startsWith('agent-')) return `正在设置:${profileTitle(props.activeProfile)} / ${props.activeProfile?.name || '未选择'}`
  125. if (activePage.value.startsWith('account-')) return `当前账号:${accountName.value}${props.isAdmin ? ' · 管理员' : ''}`
  126. if (activePage.value === 'appearance') return '仅影响当前浏览器'
  127. return '全局设置 · 仅管理员'
  128. })
  129. function profileTitle(profile?: Profile): string {
  130. return profile?.agentName || profile?.displayName || profile?.name || '未选择 Agent'
  131. }
  132. function setDirty(page: SettingsPage, dirty: boolean) {
  133. dirtyPages[page] = dirty
  134. }
  135. function confirmDiscard(): boolean {
  136. return !activeDirty.value || window.confirm('放弃当前页面未保存的更改?')
  137. }
  138. function selectPage(page: SettingsPage) {
  139. if (page === activePage.value) {
  140. mobileDetailOpen.value = true
  141. void nextTick(() => {
  142. if (window.innerWidth < 768) contentTitle.value?.focus()
  143. })
  144. return
  145. }
  146. if (updateLocked.value || !allAllowedPages.value.has(page) || !confirmDiscard()) return
  147. dirtyPages[activePage.value] = false
  148. activePage.value = page
  149. accountCanSave.value = false
  150. mobileDetailOpen.value = true
  151. profileMenuOpen.value = false
  152. void nextTick(() => {
  153. if (window.innerWidth < 768) contentTitle.value?.focus()
  154. })
  155. }
  156. function requestClose() {
  157. if (updateLocked.value || !confirmDiscard()) return
  158. dirtyPages[activePage.value] = false
  159. emit('close')
  160. }
  161. function backToMenu() {
  162. if (updateLocked.value || !confirmDiscard()) return
  163. dirtyPages[activePage.value] = false
  164. mobileDetailOpen.value = false
  165. void nextTick(() => {
  166. dialog.value?.querySelector<HTMLButtonElement>('.settings-sidebar nav button[aria-current="page"]')?.focus()
  167. })
  168. }
  169. function selectProfile(profile: string) {
  170. if (updateLocked.value || !confirmDiscard()) return
  171. dirtyPages[activePage.value] = false
  172. profileMenuOpen.value = false
  173. emit('select-profile', profile)
  174. void nextTick(() => settingsAgentTrigger.value?.focus())
  175. }
  176. function toggleAgentMenu() {
  177. profileMenuOpen.value = !profileMenuOpen.value
  178. if (!profileMenuOpen.value) return
  179. void nextTick(() => {
  180. dialog.value?.querySelector<HTMLButtonElement>('.settings-agent-menu [role="option"][aria-selected="true"]')?.focus()
  181. })
  182. }
  183. function handleAgentMenuKeydown(event: KeyboardEvent) {
  184. const options = [...(event.currentTarget as HTMLElement).querySelectorAll<HTMLButtonElement>('[role="option"]')]
  185. if (!options.length) return
  186. const current = Math.max(0, options.indexOf(document.activeElement as HTMLButtonElement))
  187. let next: number | undefined
  188. if (event.key === 'ArrowDown') next = (current + 1) % options.length
  189. else if (event.key === 'ArrowUp') next = (current - 1 + options.length) % options.length
  190. else if (event.key === 'Home') next = 0
  191. else if (event.key === 'End') next = options.length - 1
  192. else if (event.key === 'Escape') {
  193. event.preventDefault()
  194. profileMenuOpen.value = false
  195. void nextTick(() => settingsAgentTrigger.value?.focus())
  196. return
  197. }
  198. if (next === undefined) return
  199. event.preventDefault()
  200. options[next]?.focus()
  201. }
  202. function handleEscape() {
  203. if (profileMenuOpen.value) {
  204. profileMenuOpen.value = false
  205. void nextTick(() => settingsAgentTrigger.value?.focus())
  206. return
  207. }
  208. if (window.innerWidth < 768 && mobileDetailOpen.value) { backToMenu(); return }
  209. requestClose()
  210. }
  211. watch(() => [props.open, props.initialPage] as const, ([open, initialPage]) => {
  212. if (!open) {
  213. profileMenuOpen.value = false
  214. updateLocked.value = false
  215. return
  216. }
  217. activePage.value = allAllowedPages.value.has(initialPage)
  218. ? initialPage
  219. : props.activeProfile ? 'agent-identity' : 'account-security'
  220. for (const key of Object.keys(dirtyPages) as SettingsPage[]) dirtyPages[key] = false
  221. profileMenuOpen.value = false
  222. mobileDetailOpen.value = false
  223. void nextTick(() => dialog.value?.focus())
  224. }, { immediate: true })
  225. </script>
  226. <template>
  227. <Teleport to="body">
  228. <Transition name="settings-center-fade">
  229. <div v-if="open" class="settings-center-layer" role="presentation" @mousedown.self="requestClose">
  230. <section
  231. ref="dialog"
  232. class="settings-center"
  233. :class="{ 'settings-center--mobile-detail': mobileDetailOpen }"
  234. role="dialog"
  235. aria-modal="true"
  236. aria-label="设置中心"
  237. tabindex="-1"
  238. @keydown.esc.capture.prevent.stop="handleEscape"
  239. >
  240. <div class="settings-center__body">
  241. <aside class="settings-sidebar" aria-label="设置分类">
  242. <header class="settings-sidebar__header">
  243. <h2 id="settings-center-title">设置中心</h2>
  244. <button class="settings-center__close" type="button" aria-label="关闭设置中心" :disabled="updateLocked" @click="requestClose"><AppIcon name="close" :size="18" /></button>
  245. </header>
  246. <div class="settings-sidebar__scroll">
  247. <div class="settings-agent-selector">
  248. <button ref="settingsAgentTrigger" type="button" aria-haspopup="listbox" :aria-expanded="profileMenuOpen" @click="toggleAgentMenu">
  249. <AgentAvatar :name="profileTitle(activeProfile)" :avatar="activeProfile?.agentAvatar || ''" :size="34" />
  250. <span><strong>{{ profileTitle(activeProfile) }}</strong><small>{{ activeProfile?.name || '未选择 Agent' }}</small></span>
  251. <AppIcon name="chevron-down" :size="14" />
  252. </button>
  253. <div v-if="profileMenuOpen" class="settings-agent-menu" role="listbox" aria-label="切换正在设置的 Agent" @keydown="handleAgentMenuKeydown">
  254. <button v-for="profile in profiles" :key="profile.name" type="button" role="option" :aria-selected="profile.name === activeProfile?.name" @click="selectProfile(profile.name)">
  255. <AgentAvatar :name="profileTitle(profile)" :avatar="profile.agentAvatar || ''" :size="24" />
  256. <span><strong>{{ profileTitle(profile) }}</strong><small>{{ profile.name }}</small></span>
  257. <AppIcon v-if="profile.name === activeProfile?.name" name="check" :size="14" />
  258. </button>
  259. </div>
  260. </div>
  261. <nav>
  262. <section>
  263. <h3>当前 Agent</h3>
  264. <button v-for="item in agentItems" :key="item.key" type="button" :class="{ active: activePage === item.key }" :aria-current="activePage === item.key ? 'page' : undefined" @click="selectPage(item.key)"><AppIcon :name="item.icon" :size="20" /><span>{{ item.label }}</span></button>
  265. </section>
  266. <section>
  267. <h3>账号</h3>
  268. <button v-for="item in accountItems" :key="item.key" type="button" :class="{ active: activePage === item.key }" :aria-current="activePage === item.key ? 'page' : undefined" @click="selectPage(item.key)"><AppIcon :name="item.icon" :size="20" /><span>{{ item.label }}</span></button>
  269. </section>
  270. <section v-if="isAdmin">
  271. <h3>系统 · 仅管理员</h3>
  272. <button v-for="item in systemItems" :key="item.key" type="button" :class="{ active: activePage === item.key }" :aria-current="activePage === item.key ? 'page' : undefined" @click="selectPage(item.key)"><AppIcon :name="item.icon" :size="20" /><span>{{ item.label }}</span><em v-if="item.key === 'system-voice'">全局</em></button>
  273. </section>
  274. </nav>
  275. </div>
  276. </aside>
  277. <main class="settings-content" :class="{ 'settings-content--with-footer': showFixedFooter }">
  278. <header class="settings-content__header">
  279. <button v-if="mobileDetailOpen" class="mobile-back" type="button" aria-label="返回设置分类" :disabled="updateLocked" @click="backToMenu"><AppIcon name="chevron-left" :size="20" /></button>
  280. <div class="settings-content__heading"><h3 ref="contentTitle" tabindex="-1">{{ activeTitle }}</h3><p>{{ activeScope }}</p></div>
  281. <button class="settings-center__close" type="button" aria-label="关闭设置中心" :disabled="updateLocked" @click="requestClose"><AppIcon name="close" :size="18" /></button>
  282. </header>
  283. <div class="settings-content__scroll">
  284. <AgentIdentityPanel
  285. v-if="activePage === 'agent-identity' && activeProfile"
  286. :key="activeProfile.name"
  287. :profile="activeProfile"
  288. :busy="identityBusy"
  289. :error="identityError"
  290. :reset-version="identityResetVersion"
  291. form-id="settings-agent-identity-form"
  292. :show-actions="false"
  293. @dirty-change="setDirty('agent-identity', $event)"
  294. @save="emit('save-identity', $event)"
  295. />
  296. <p v-else-if="activePage === 'agent-identity'" class="settings-empty">尚未选择 Agent。</p>
  297. <ModelServicesPanel v-else-if="activePage === 'agent-models' && activeProfile && isAdmin" :key="activeProfile.name" :profile="activeProfile.name" @dirty-change="setDirty('agent-models', $event)" />
  298. <AccountSecurityPanel
  299. v-else-if="activePage === 'account-security'"
  300. :active="true"
  301. form-id="settings-account-security-form"
  302. :show-actions="false"
  303. @dirty-change="setDirty('account-security', $event)"
  304. @can-save-change="accountCanSave = $event"
  305. @saved="setDirty('account-security', false)"
  306. @logout="emit('logout')"
  307. />
  308. <NodePairingPanel v-else-if="activePage === 'account-mobile'" mode="account" :active="true" :insecure-transport="insecureTransport" :user-name="accountName" />
  309. <section v-else-if="activePage === 'appearance'" class="appearance-panel" aria-label="外观">
  310. <p>选择当前浏览器使用的界面主题。</p>
  311. <div class="theme-options" role="radiogroup" aria-label="界面主题">
  312. <button v-for="option in ([['system', '跟随系统', '自动匹配设备外观'], ['light', '浅色', '始终使用浅色界面'], ['dark', '深色', '始终使用深色界面']] as const)" :key="option[0]" type="button" role="radio" :aria-checked="themePreference === option[0]" :class="{ active: themePreference === option[0] }" @click="emit('set-theme', option[0])">
  313. <AppIcon :name="option[0] === 'dark' ? 'moon' : 'sun'" :size="22" />
  314. <span><strong>{{ option[1] }}</strong><small>{{ option[2] }}</small></span>
  315. <AppIcon v-if="themePreference === option[0]" name="check" :size="18" />
  316. </button>
  317. </div>
  318. </section>
  319. <SystemOverviewPanel v-else-if="activePage === 'system-overview' && isAdmin" :active="true" :upstream-ready="upstreamReady" :upstream-error="upstreamError" @navigate="selectPage" />
  320. <SystemManagementPanel v-else-if="activePage === 'system-users' && isAdmin" section="users" :active="true" @dirty-change="setDirty('system-users', $event)" />
  321. <SystemManagementPanel v-else-if="activePage === 'system-connection' && isAdmin" section="connection" :active="true" :upstream-ready="upstreamReady" :upstream-error="upstreamError" @dirty-change="setDirty('system-connection', $event)" />
  322. <SystemManagementPanel v-else-if="activePage === 'system-push' && isAdmin" section="push" :active="true" @dirty-change="setDirty('system-push', $event)" />
  323. <NodePairingPanel v-else-if="activePage === 'system-nodes' && isAdmin" mode="nodes" :active="true" :is-admin="true" @dirty-change="setDirty('system-nodes', $event)" />
  324. <DuplexVoicePanel v-else-if="activePage === 'system-voice' && isAdmin" @dirty-change="setDirty('system-voice', $event)" />
  325. <SystemUpdatePanel v-else-if="activePage === 'system-update' && isAdmin" :active="true" @lock-change="updateLocked = $event" />
  326. </div>
  327. <footer v-if="showFixedFooter" class="settings-content__footer">
  328. <button class="settings-footer__cancel" type="button" :disabled="identityBusy" @click="requestClose">取消</button>
  329. <button
  330. v-if="activePage === 'agent-identity'"
  331. class="settings-footer__save"
  332. type="submit"
  333. form="settings-agent-identity-form"
  334. :disabled="identityBusy || !activeDirty"
  335. >{{ identityBusy ? '正在同步…' : '保存更改' }}</button>
  336. <button
  337. v-else
  338. class="settings-footer__save"
  339. type="submit"
  340. form="settings-account-security-form"
  341. :disabled="!accountCanSave"
  342. >保存更改</button>
  343. </footer>
  344. </main>
  345. </div>
  346. </section>
  347. </div>
  348. </Transition>
  349. </Teleport>
  350. </template>
  351. <style scoped>
  352. .settings-center-layer { position: fixed; z-index: 300; inset: 0; display: grid; place-items: center; padding: 64px; background: color-mix(in srgb, #000 24%, transparent); backdrop-filter: blur(4px); }
  353. .settings-center { display: block; width: min(820px, calc(100vw - 128px)); height: min(600px, calc(100dvh - 128px)); overflow: hidden; border: 1px solid var(--line); border-radius: 16px; outline: 0; background: var(--surface-raised); box-shadow: 0 20px 60px rgba(0,0,0,.18); color: var(--text-primary); }
  354. .settings-center__close,.mobile-back { display: grid; width: 44px; height: 44px; place-items: center; padding: 0; border: 0; border-radius: 10px; background: transparent; color: var(--text-primary); cursor: pointer; }
  355. .settings-center__close:hover,.mobile-back:hover { background: var(--surface-soft); }
  356. .settings-center__close:disabled,.mobile-back:disabled { cursor: not-allowed; opacity: .45; }
  357. .mobile-back { display: none; }
  358. .settings-center__body { display: grid; height: 100%; min-height: 0; grid-template-columns: 220px minmax(0, 1fr); }
  359. .settings-sidebar { position: relative; min-height: 0; overflow-y: auto; padding: 12px 14px 14px; border-right: 1px solid var(--line); background: color-mix(in srgb, var(--surface-soft) 42%, var(--surface-raised)); overscroll-behavior: contain; }
  360. .settings-sidebar__header { display: none; }.settings-sidebar__header h2 { margin: 0; font-size: 14px; letter-spacing: -.01em; }
  361. .settings-sidebar__scroll { min-height: 0; }
  362. .settings-agent-selector { position: sticky; z-index: 3; top: -12px; margin: -12px 0 8px; padding: 12px 0 8px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface-soft) 42%, var(--surface-raised)); }
  363. .settings-agent-selector > button { display: grid; width: 100%; min-height: 42px; grid-template-columns: 34px minmax(0, 1fr) 16px; align-items: center; gap: 8px; padding: 2px 4px; border: 0; border-radius: 9px; background: transparent; color: var(--text-primary); cursor: pointer; text-align: left; }
  364. .settings-agent-selector > button:hover { background: var(--surface-hover); }
  365. .settings-agent-selector span,.settings-agent-menu span { display: grid; min-width: 0; gap: 2px; }
  366. .settings-agent-selector strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
  367. .settings-agent-selector small,.settings-agent-menu small { overflow: hidden; color: var(--text-muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
  368. .settings-agent-menu { position: absolute; z-index: 5; top: calc(100% - 8px); right: 0; left: 0; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-raised); box-shadow: var(--shadow-float); }
  369. .settings-agent-menu button { display: grid; width: 100%; min-height: 38px; grid-template-columns: 24px minmax(0, 1fr) 16px; align-items: center; gap: 8px; padding: 4px 6px; border: 0; border-radius: 8px; background: transparent; color: var(--text-primary); cursor: pointer; text-align: left; }
  370. .settings-agent-menu button:hover,.settings-agent-menu button[aria-selected="true"] { background: var(--surface-hover); }
  371. .settings-agent-menu strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
  372. .settings-sidebar nav { display: grid; gap: 6px; }
  373. .settings-sidebar nav section { display: grid; gap: 1px; padding-bottom: 7px; border-bottom: 1px solid var(--line); }
  374. .settings-sidebar nav section:last-child { padding-bottom: 0; border-bottom: 0; }
  375. .settings-sidebar h3 { margin: 0 6px 3px; color: var(--text-muted); font-size: 12px; font-weight: 560; }
  376. .settings-sidebar nav button { display: flex; width: 100%; min-height: 40px; align-items: center; gap: 14px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; color: var(--text-primary); cursor: pointer; text-align: left; font: 600 14px var(--font-ui); }
  377. .settings-sidebar nav button:hover { background: var(--surface-hover); }
  378. .settings-sidebar nav button.active { background: var(--surface-soft); }
  379. .settings-sidebar nav button:focus-visible { outline: 0; box-shadow: inset 0 0 0 2px color-mix(in srgb, #7c4dff 72%, var(--line-strong)); }
  380. .settings-sidebar nav button span { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  381. .settings-sidebar nav button em { padding: 2px 6px; border: 1px solid var(--line); border-radius: 999px; color: var(--text-muted); font: normal 10px var(--font-ui); }
  382. .settings-content { display: grid; min-width: 0; min-height: 0; grid-template-rows: auto minmax(0, 1fr); background: var(--surface-raised); }
  383. .settings-content--with-footer { grid-template-rows: auto minmax(0, 1fr) 68px; }
  384. .settings-content__header { display: grid; min-height: 52px; box-sizing: border-box; grid-template-columns: minmax(0, 1fr) 44px; align-items: center; gap: 8px; padding: 7px 8px 7px 18px; border-bottom: 1px solid var(--line); }
  385. .settings-content__heading { min-width: 0; }
  386. .settings-content__header h3 { margin: 0; font-size: 14px; letter-spacing: -.01em; }
  387. .settings-content__header p { overflow: hidden; margin: 3px 0 0; color: var(--text-secondary); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
  388. .settings-content__scroll { min-height: 0; overflow-y: auto; padding: 16px 24px 18px; overscroll-behavior: contain; }
  389. .settings-content__footer { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 0 20px; border-top: 1px solid var(--line); background: var(--surface-raised); }
  390. .settings-content__footer button { display: inline-flex; min-width: 104px; min-height: 40px; align-items: center; justify-content: center; padding: 0 16px; border-radius: 9px; cursor: pointer; font: 650 13px var(--font-ui); }
  391. .settings-footer__cancel { border: 1px solid var(--line); background: var(--surface-raised); color: var(--text-primary); }
  392. .settings-footer__save { border: 0; background: var(--accent); color: var(--text-on-solid); }
  393. .settings-content__footer button:disabled { cursor: not-allowed; opacity: .45; }
  394. .settings-empty { margin: 0; padding: 24px; border-radius: 12px; background: var(--surface-soft); color: var(--text-muted); font-size: 14px; text-align: center; }
  395. .appearance-panel { display: grid; gap: 18px; }
  396. .appearance-panel > p { margin: 0; color: var(--text-secondary); font-size: 14px; }
  397. .theme-options { display: grid; border-top: 1px solid var(--line); }
  398. .theme-options button { display: grid; min-height: 72px; grid-template-columns: 28px minmax(0, 1fr) 20px; align-items: center; gap: 14px; padding: 10px 8px; border: 0; border-bottom: 1px solid var(--line); border-radius: 9px; background: transparent; color: var(--text-primary); cursor: pointer; text-align: left; }
  399. .theme-options button:hover,.theme-options button.active { background: var(--surface-soft); }
  400. .theme-options button:focus-visible { outline: 0; box-shadow: inset 0 0 0 2px color-mix(in srgb, #7c4dff 72%, var(--line-strong)); }
  401. .theme-options span { display: grid; gap: 5px; }
  402. .theme-options strong { font-size: 15px; }
  403. .theme-options small { color: var(--text-muted); font-size: 13px; }
  404. .settings-content__scroll :deep(.account-security-panel > .panel-heading) { display: none; }
  405. .settings-center-fade-enter-active,.settings-center-fade-leave-active { transition: opacity 150ms ease; }
  406. .settings-center-fade-enter-active .settings-center,.settings-center-fade-leave-active .settings-center { transition: transform 180ms var(--ease-out); }
  407. .settings-center-fade-enter-from,.settings-center-fade-leave-to { opacity: 0; }
  408. .settings-center-fade-enter-from .settings-center,.settings-center-fade-leave-to .settings-center { transform: translateY(8px) scale(.99); }
  409. @media (max-width: 1023px) {
  410. .settings-center-layer { padding: 32px; }
  411. .settings-center { width: min(820px, calc(100vw - 64px)); height: min(600px, calc(100dvh - 64px)); }
  412. .settings-center__body { grid-template-columns: 220px minmax(0, 1fr); }
  413. .settings-content__scroll { padding-inline: 24px; }
  414. }
  415. @media (max-width: 767px) {
  416. .settings-center-layer { padding: 0; }
  417. .settings-center { width: 100vw; height: 100dvh; border: 0; border-radius: 0; }
  418. .settings-center__body { display: block; height: 100%; }
  419. .settings-sidebar { display: grid; width: 100%; height: 100%; box-sizing: border-box; grid-template-rows: 56px minmax(0, 1fr); overflow: hidden; padding: 0; border-right: 0; }
  420. .settings-sidebar__header { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 0 16px; border-bottom: 1px solid var(--line); }.settings-sidebar__header .settings-center__close { display: grid; }
  421. .settings-sidebar__scroll { min-height: 0; overflow-y: auto; padding: 18px 20px max(24px, env(safe-area-inset-bottom)); overscroll-behavior: contain; }
  422. .settings-center--mobile-detail .settings-sidebar { display: none; }
  423. .settings-content { display: none; width: 100%; height: 100%; }
  424. .settings-center--mobile-detail .settings-content { display: grid; }
  425. .settings-content__header { min-height: 56px; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 4px; padding: 6px 8px 6px 6px; }
  426. .settings-center--mobile-detail .mobile-back { display: grid; }
  427. .settings-content__scroll { padding: 22px 20px max(28px, env(safe-area-inset-bottom)); }
  428. .settings-content--with-footer { grid-template-rows: auto minmax(0, 1fr) calc(68px + env(safe-area-inset-bottom)); }
  429. .settings-content__footer { padding: 0 20px env(safe-area-inset-bottom); }
  430. .settings-content__footer button { flex: 1; }
  431. .settings-agent-selector { top: -18px; margin-top: -18px; padding-top: 18px; }
  432. }
  433. </style>