/* layout.css — 核心布局入口（聚合子组件） */


.running-spinner {
    animation: runningPulse 1.2s ease-in-out infinite;
    transform-origin: 50% 50%;
}
#minimized-icons,
#toolbar {
    display: flex;
    align-items: center;
}
#toolbar {
    height: var(--toolbar-height);
    background: var(--toolbar-bg);
    padding: 0 10px;
    gap: 8px;
    position: relative;
    z-index: var(--z-toolbar);
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,.06);
    user-select: none;
    -webkit-user-select: none;
}
#toolbar .logo,
#toolbar .logo .icon {
    display: flex;
    align-items: center;
    font-size:  var(--fs-base);
}
#toolbar .logo {
    font-weight: 700;
    color: var(--toolbar-text);
    gap: 6px;
}
#toolbar .logo .icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: linear-gradient(135deg,var(--accent),var(--logo-gradient-end));
    justify-content: center;
    color: #fff;
}
#minimized-icons {
    gap: 6px;
    flex: 1;
    overflow-x: auto;
    padding: 6px 0;
}
#minimized-icons::-webkit-scrollbar {
    width: 3px;  /* 仅横向滚动，但仍两轴写全：避免另一轴回退 UA 默认尺寸 */
    height: 3px;
}
#minimized-icons::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.15);
    border-radius: 3px;
}
/* 标准属性彭底：仅 Firefox 等【不支持 ::-webkit-scrollbar】的引擎生效。
   Chromium 121+ 读到非 auto 的 scrollbar-width/color 会整体忽略上面的精调，故做引擎分流。 */
@supports (not selector(::-webkit-scrollbar)) or (-moz-appearance: none) {
    #minimized-icons {
        scrollbar-width: thin;
    }
}
#toolbar button,
.minimized-icon {
    border-radius: 6px;
    cursor: pointer;
    background: rgba(255,255,255,.08);
    transition: background .15s, color .15s, border-color .15s;
}
#toolbar .actions,
.minimized-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.minimized-icon {
    gap: 3px;
    padding: 4px 8px;
    font-size:  var(--fs-xs);
    color: var(--toolbar-text-soft);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    border: 1.5px solid transparent;
    touch-action: none; /* 防止移动端拖拽时触发页面滚动 */
    /* 长按是「拖拽排序」的起手式（见 Toolbar.js 触摸路径）：iOS 长按 callout
       （拷贝/分享）会打断手势，标题文字本身也不可选，这里直接关掉 */
    -webkit-touch-callout: none;
}
/* 按钮文字（会话标题可能很长）：必须成单行、超出走省略号——
   否则长标题会被 flex 换行堆成多行（按钮被撑得比工具栏还高）、
   不可断行的标题（无空格）则直接向右溢出（实测 +144px）。
   min-width:0 是关键：flex 项默认 min-width:auto（不收缩），不归零就撑破 max-width。 */
.minimized-icon .minimized-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.minimized-icon:hover {
    background: rgba(255,255,255,.14);
    color: var(--toolbar-text);
    border-color: color-mix(in srgb, var(--accent) 50%, transparent);
}
.minimized-icon.dragging {
    opacity: .4;
    transform: scale(.9);
    transition: none; /* 拖拽时禁用过渡，避免位移卡顿 */
    z-index: var(--z-drag-ghost);      /* 拖拽图标浮于其他图标之上 */
    border-color: var(--accent);
    border-style: dashed;
}
.minimized-icon.drag-over {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 15%, transparent);
    transform: scale(1.08);
}
.minimized-icon {
    cursor: grab;
}
.minimized-icon:active {
    cursor: grabbing;
}

.minimized-icon.ghost {
    cursor: grabbing;
}
.minimized-icon.ghost .minimized-title {
    color: var(--toolbar-text);
}
.minimized-icon .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--toolbar-text-soft);
}


.minimized-icon.busy .dot {
    animation: minimized-icon-pulse 1.1s ease-in-out infinite;
}

.minimized-icon.busy {
    border-color: color-mix(in srgb, var(--accent) 55%, transparent);
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    color: var(--toolbar-text);
}
.minimized-icon.busy .minimized-title {
    color: var(--toolbar-text);
}
@keyframes minimized-icon-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .35; transform: scale(.72); }
}
@media (prefers-reduced-motion: reduce) {
    .minimized-icon.busy .dot {
        animation: none;
    }
}
#toolbar .actions {
    gap: 6px;
}
#toolbar button {
    padding: 6px 10px;
    border: 0;
    font-size:  var(--fs-md);
    font-weight: 500;
    color: var(--toolbar-text);
    white-space: nowrap;
    font-family: var(--font-sans);
}
#toolbar button:hover,
#toolbar button.is-pressed {
    background: rgba(255,255,255,.16);
}


#toolbar #btn-main-menu,
#toolbar #btn-arrange,
#toolbar #btn-settings {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
}
#toolbar button.primary {
    background: var(--accent);
    color: #fff;
}
#toolbar button.primary:hover,
#toolbar button.primary.is-pressed {
    background: var(--accent-hover);
    box-shadow: 0 2px 12px var(--accent-glow);
}
#toolbar .dropdown {
    position: relative;
}
#toolbar .dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 6px;
    background: var(--toolbar-bg);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 8px;
    padding: 6px 0;
    min-width: 150px;
    z-index: var(--z-dropdown);
    box-shadow: var(--shadow-pop);
    /* 菜单内容超高（如代理/工作区数量多）时允许纵向滚动，避免底部菜单项被裁剪不可见；
       底部预留输入栏+状态栏高度，避免最后一项被底部固定栏遮挡（打开时 JS 会按实际布局再修正） */
    max-height: calc(100vh - var(--toolbar-height, 40px) - var(--inputbar-height, 72px) - var(--statusbar-height, 28px) - 12px);
    overflow-y: auto;
    overflow-x: hidden;
}

#toolbar #main-menu-dropdown {
    right: auto;
    left: 0;
    z-index: var(--z-dropdown);
    box-shadow: var(--shadow-pop);
    /* 长代理名/长工作区路径时限制主菜单最大宽度，避免撑破布局或超出视口 */
    max-width: min(320px, calc(100vw - 24px));
    /* 防御：裁剪横向残留溢出，确保文本绝不超出菜单边界 */
    overflow-x: hidden;
    /* 纵向滚动收进「列表区」（.main-menu-scroll）：
       代理/预设再多也只滚列表，底部动作项常驻；
       外层保留 auto 仅做兜底：极矮视口下 footer 自身就超过 max-height 时
       还能整体滚动，不至于把动作项裁掉又无法到达 */
    overflow-y: auto;
}
/* 分区布局：上下两段（可滚动列表 + 常驻动作区），代理数量再多菜单高度也不增长 */
#toolbar #main-menu-dropdown.show {
    display: flex;
    flex-direction: column;
}
#toolbar #main-menu-dropdown .main-menu-scroll {
    /* 可收缩：矮视口下先压缩列表区（内部滚动），不挤掉底部动作项 */
    flex: 0 1 auto;
    /* 必须为 0：flex 子项默认 min-height:auto 会撑到内容高度，内部滚动条就永远不会出现 */
    min-height: 0;
    max-height: var(--main-menu-list-max-h);
    overflow-y: auto;
    overflow-x: hidden;
}
#toolbar #main-menu-dropdown .main-menu-footer {
    /* 常驻动作区：永不被压缩，代理再多也一屏可达 */
    flex: 0 0 auto;
}
#toolbar .dropdown-menu.show {
    display: block;
}
#toolbar .dropdown-menu button {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border-radius: 0;
    padding: 8px 16px;
    font-size:  var(--fs-md-lg);
}
#toolbar .dropdown-menu button:hover,
#toolbar .dropdown-menu button.is-pressed {
    background: rgba(255,255,255,.08);
}


#toolbar #main-menu-dropdown .main-menu-header {
    padding: 8px 16px 4px;
    font-size:  var(--fs-xs);
    font-weight: 600;
    color: rgba(255,255,255,.5);
    text-transform: uppercase;
    letter-spacing: .5px;
    /* 列表区滚动时标题吸顶：滚到列表中部也知道自己在看哪一组 */
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--toolbar-bg);
}
#toolbar #main-menu-dropdown .main-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    border: 0;
    border-radius: 0;
    background: none;
    color: var(--toolbar-text);
    font-size:  var(--fs-md-lg);
    font-family: var(--font-sans);
    text-align: left;
    cursor: pointer;
    transition: background .12s;
}
#toolbar #main-menu-dropdown .main-menu-item:hover,
#toolbar #main-menu-dropdown .main-menu-item.is-pressed {
    background: rgba(255,255,255,.08);
}
#toolbar #main-menu-dropdown .main-menu-item.active {
    background: color-mix(in srgb, var(--accent) 15%, transparent);
    color: #fff;
}
#toolbar #main-menu-dropdown .main-menu-item-disabled {
    opacity: .5;
    cursor: default;
}
#toolbar #main-menu-dropdown .menu-item-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--success); /* 活动/未最小化 → 绿色（唯一状态指示） */
    box-shadow: 0 0 4px rgba(76,175,80,.4);
}
#toolbar #main-menu-dropdown .menu-item-dot.idle {
    background: var(--text-muted); /* 最小化 → 灰色 */
    box-shadow: none;
}
#toolbar #main-menu-dropdown .menu-item-name {
    flex: 1;
    min-width: 0; /* 允许收缩：长代理名时正确省略号截断，避免溢出菜单 */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#toolbar #main-menu-dropdown .main-menu-divider {
    height: 1px;
    background: rgba(255,255,255,.08);
    margin: 4px 0;
}
#toolbar #main-menu-dropdown .main-menu-action {
    display: block;
    width: 100%;
    padding: 8px 16px;
    border: 0;
    border-radius: 0;
    background: none;
    color: var(--toolbar-text);
    font-size:  var(--fs-md);
    font-family: var(--font-sans);
    text-align: left;
    cursor: pointer;
    transition: background .12s;
}
#toolbar #main-menu-dropdown .main-menu-action:hover,
#toolbar #main-menu-dropdown .main-menu-action.is-pressed {
    background: rgba(255,255,255,.08);
}

#new-agent-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    border-radius: 50%;
    background: transparent;
}
#new-agent-dropdown #btn-new-agent {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 50%;
}
#new-agent-dropdown #btn-new-agent-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border-radius: 50%;
    min-width: 22px;
    font-size:  var(--fs-xs);
    background: rgba(255,255,255,.14);
}
#new-agent-dropdown:hover {
    background: transparent;
}
#new-agent-menu {
    display: none;
    position: absolute;
    /* 右对齐向左展开：避免按钮右侧空间不足时菜单超出窗口右缘被裁切 */
    right: 0;
    left: auto;
    top: 100%;
    margin-top: 6px;
    background: var(--toolbar-bg);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 8px;
    padding: 6px 0;
    min-width: 160px;
    max-width: calc(100vw - 16px);
    z-index: var(--z-dropdown);
    box-shadow: var(--shadow-pop);
    /* 内容超高时纵向滚动，避免底部菜单项被裁剪不可见（预留输入栏+状态栏高度） */
    max-height: calc(100vh - var(--toolbar-height, 40px) - var(--inputbar-height, 72px) - var(--statusbar-height, 28px) - 12px);
    overflow-y: auto;
    overflow-x: hidden;
}
#new-agent-menu.show {
    display: block;
}


#toolbar .dropdown-menu::-webkit-scrollbar,
#toolbar #main-menu-dropdown::-webkit-scrollbar,
#toolbar #main-menu-dropdown .main-menu-scroll::-webkit-scrollbar,
#toolbar .workspace-menu .workspace-menu-scroll::-webkit-scrollbar,
#new-agent-menu::-webkit-scrollbar,
#toolbar .workspace-menu::-webkit-scrollbar {
    width: 4px;
    height: 4px; /* 两轴都要写：只写一轴时另一轴回退 UA 默认厚度（见 window.css .messages-container 注释） */
}
#toolbar .dropdown-menu::-webkit-scrollbar-track,
#toolbar #main-menu-dropdown::-webkit-scrollbar-track,
#toolbar #main-menu-dropdown .main-menu-scroll::-webkit-scrollbar-track,
#toolbar .workspace-menu .workspace-menu-scroll::-webkit-scrollbar-track,
#new-agent-menu::-webkit-scrollbar-track,
#toolbar .workspace-menu::-webkit-scrollbar-track {
    background: transparent;
}
#toolbar .dropdown-menu::-webkit-scrollbar-thumb,
#toolbar #main-menu-dropdown::-webkit-scrollbar-thumb,
#toolbar #main-menu-dropdown .main-menu-scroll::-webkit-scrollbar-thumb,
#toolbar .workspace-menu .workspace-menu-scroll::-webkit-scrollbar-thumb,
#new-agent-menu::-webkit-scrollbar-thumb,
#toolbar .workspace-menu::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.2);
    border-radius: 2px;
}
#toolbar .dropdown-menu::-webkit-scrollbar-thumb:hover,
#toolbar #main-menu-dropdown::-webkit-scrollbar-thumb:hover,
#toolbar #main-menu-dropdown .main-menu-scroll::-webkit-scrollbar-thumb:hover,
#toolbar .workspace-menu .workspace-menu-scroll::-webkit-scrollbar-thumb:hover,
#new-agent-menu::-webkit-scrollbar-thumb:hover,
#toolbar .workspace-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,.4);
}
/* 标准属性兜底：仅 Firefox 等【不支持 ::-webkit-scrollbar】的引擎生效。
   Chromium 121+ 一旦读到非 auto 的 scrollbar-width / scrollbar-color 会【整体忽略】
   ::-webkit-scrollbar 精调，故这两条必须包在能力探测内，不得裸声明。 */
@supports (not selector(::-webkit-scrollbar)) or (-moz-appearance: none) {
    #toolbar .dropdown-menu,
    #toolbar #main-menu-dropdown,
    #toolbar .main-menu-scroll,
    #toolbar .workspace-menu-scroll,
    #new-agent-menu,
    #toolbar .workspace-menu {
        scrollbar-width: thin;
        scrollbar-color: rgba(255,255,255,.2) transparent;
    }
}
#new-agent-menu button {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border-radius: 0;
    padding: 8px 16px;
    font-size:  var(--fs-md-lg);
    color: var(--toolbar-text);
    border: 0;
    cursor: pointer;
    font-family: var(--font-sans);
    font-weight: 500;
}
#new-agent-menu button:hover {
    background: rgba(255,255,255,.08);
}
#desktop {
    flex: 1;
    background: var(--desktop-bg);
    position: relative;
    overflow: hidden;
    background-image: radial-gradient(ellipse at 15% 25%,color-mix(in srgb, var(--logo-gradient-end) 4%, transparent) 0,transparent 55%),
                      radial-gradient(ellipse at 78% 55%,color-mix(in srgb, var(--warning) 3%, transparent) 0,transparent 50%),
                      radial-gradient(ellipse at 40% 80%,color-mix(in srgb, var(--success) 3%, transparent) 0,transparent 50%);
}



.img-placeholder {
    display: inline-block;
    vertical-align: middle;
    margin: 10px 0;
    border-radius: 8px;
    overflow: hidden;
    line-height: 0;
}
.img-placeholder .pl-text {
    fill: var(--text-secondary);
    font-size: var(--fs-xs);
    font-family: var(--font-sans);
}
/* 占位图配色：SVG 图形不写 fill 会落到 UA 默认黑色（黑底黑字不可读），随主题显式着色 */
.img-placeholder .pl-bg {
    fill: var(--bg-subtle);
}
.img-placeholder .pl-icon {
    fill: var(--text-muted);
}
.img-placeholder-error .pl-bg {
    fill: color-mix(in srgb, var(--danger) 10%, var(--bg-subtle));
}
.img-placeholder-error .pl-icon,
.img-placeholder-error .pl-icon-error {
    fill: var(--danger);
}
/* 加载失败后的重试按钮：此前无任何样式，落回 UA 裸按钮（灰底黑框、无内边距） */
.img-placeholder-retry-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 8px 0 2px;
    padding: 4px 10px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: var(--fs-sm);
    line-height: 1.4;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.img-placeholder-retry-btn:hover {
    background: var(--bg-hover);
    color: var(--accent);
    border-color: var(--accent);
}
.scroll-to-bottom {
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}
.scroll-to-bottom {
    position: absolute;
    bottom: 16px;
    right: 16px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--toolbar-bg);
    color: var(--toolbar-text);
    border: 0;
    font-size:  var(--fs-md-lg);
    display: none;
    z-index: var(--z-float-btn);
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
    transition: filter .15s, transform .15s, box-shadow .15s;
}
#input-bar.has-attachments .attachment-preview,
.scroll-to-bottom.visible {
    display: flex;
}
.scroll-to-bottom:hover,
.scroll-to-bottom.is-pressed {
    /* 修复：使用 brightness 替代 --bg-hover（light 主题下 #f5f1eb 近白色），
       保持深色基调不变，仅做微妙提亮。避免从深棕直接跳白的突兀感。 */
    filter: brightness(1.15);
    transform: scale(1.08);
    box-shadow: 0 4px 16px rgba(0,0,0,.22);
}
#input-bar,
.attachment-preview {
    flex-shrink: 0;
    user-select: none;
    -webkit-user-select: none;
}
#input-bar {
    height: auto;
    min-height: 56px;
    background: var(--bg-subtle);
    border-top: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    padding: 0 14px 4px;
    gap: 4px;
    z-index: var(--z-inputbar);
    position: relative;
}

.input-bar-resize-handle {
    position: relative;
    width: 100%;
    height: 6px;
    cursor: ns-resize;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    transition: background .15s ease;
}
.input-bar-resize-handle::before {
    content: '';
    display: block;
    width: 40px;
    height: 3px;
    border-radius: 2px;
    background: var(--border-strong);
    opacity: 0.4;
    transition: opacity .15s ease, background .15s ease;
}
.input-bar-resize-handle:hover::before,
.input-bar-resize-handle:active::before {
    opacity: 0.8;
    background: var(--accent);
}
.input-bar-resize-handle:hover,
.input-bar-resize-handle:active {
    background: var(--accent-soft);
}
#input-bar.disabled {
    opacity: .5;
    pointer-events: none;
}
.attachment-preview {
    display: none;
    gap: 8px;
    overflow-x: auto;
    padding: 6px 0;
    width: 100%;
}

.attachment-preview::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.attachment-preview::-webkit-scrollbar-track {
    background: transparent;
}
.attachment-preview::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 3px;
}
.attachment-preview::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}
@supports (not selector(::-webkit-scrollbar)) or (-moz-appearance: none) {
    .attachment-preview {
        scrollbar-width: thin;
        scrollbar-color: var(--scrollbar-thumb) transparent;
    }
}
.input-row {
    display: flex;
    align-items: stretch;
    gap: 10px;
    width: 100%;
    flex: 1;
    min-height: 0;
}
#input-bar > button,
.input-row button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 16px;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    font-size:  var(--fs-md-lg);
    font-weight: 500;
    transition: background .15s, box-shadow .15s;
    font-family: var(--font-sans);
    white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
    align-self: center;
}
#btn-send {
    background: var(--accent);
    color: #fff;
}
#btn-send:hover,
#btn-send.is-pressed {
    background: var(--accent-hover);
    box-shadow: 0 2px 12px var(--accent-glow);
}
#btn-attach,
.attachment-card {
    background: var(--bg-hover);
    position: relative;
    overflow: hidden;
}
#btn-attach,
#btn-shortcut {
    color: var(--text-secondary);
}

.input-row button svg {
    display: inline-block;
    width: 16px;
    height: 16px;
}
#btn-attach:hover,
#btn-shortcut:hover,
.attachment-card:hover,
#btn-attach.is-pressed,
#btn-shortcut.is-pressed {
    background: var(--bg-active);
}
#btn-attach input[type=file] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}
#btn-shortcut {
    background: var(--bg-hover);
}
.attachment-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 80px;
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s,border-color .15s;
    user-select: none;
    -webkit-user-select: none;
}
.attachment-card:hover {
    border-color: var(--accent);
}
.attach-thumb,
.attachment-card .remove-attach {
    display: flex;
    align-items: center;
    justify-content: center;
}
.attach-info,
.attach-thumb {
    overflow: hidden;
    margin-bottom: 2px;
}
.attach-thumb {
    width: 42px;
    height: 42px;
    background: var(--bg-subtle);
    border-radius: 6px;
    font-size:  var(--fs-xs);
    color: var(--text-muted);
    font-family: var(--font-mono);
}
.attach-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.attach-info {
    width: 100%;
    font-size:  var(--fs-2xs);
    color: var(--text-secondary);
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
}
.attachment-card .remove-attach {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--danger);
    color: #fff;
    border: 0;
    cursor: pointer;
    font-size:  var(--fs-2xs);
    padding: 0;
    line-height: 1;
    transition: transform .12s;
    z-index: var(--z-hover-ctrl);
}
.attachment-card .remove-attach:hover {
    transform: scale(1.15);
}


.attachment-card.uploading {
    border-color: var(--accent-soft);
    cursor: default;
    pointer-events: none;
}
.attachment-card.uploading .attach-thumb {
    opacity: 0.6;
}
.attachment-card.uploading .remove-attach {
    pointer-events: auto;
}
.attach-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--bg-subtle);
    overflow: hidden;
}
.attach-progress-fill {
    height: 100%;
    background: var(--accent);
    transition: width .2s ease;
    border-radius: 0 0 0 8px;
    min-width: 0;
}
#status-bar,
.shortcut-popup {
    user-select: none;
    -webkit-user-select: none;
}
.shortcut-popup {
    display: none;
    position: absolute;
    bottom: 100%;
    right: 14px;
    margin-bottom: 8px;
    background: var(--popup-bg);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.1);
    padding: 6px 0;
    z-index: var(--z-decorative);
    min-width: 180px;
    /* 向上展开时内容超高（快捷短语多）允许纵向滚动，避免顶部菜单项被裁剪不可见 */
    max-height: calc(100vh - var(--inputbar-height, 72px) - var(--statusbar-height, 28px) - 32px);
    overflow-y: auto;
    overflow-x: hidden;
}
.shortcut-popup.show {
    display: block;
}
.shortcut-popup .item {
    padding: 8px 14px;
    cursor: pointer;
    font-size:  var(--fs-md-lg);
    color: var(--text-secondary);
    transition: background .1s;
}
.shortcut-popup .item:hover,
.shortcut-popup .item.is-pressed {
    background: var(--bg-hover);
}
#status-bar {
    height: var(--statusbar-height);
    background: var(--toolbar-bg);
    display: flex;
    align-items: center;
    padding: 0 14px;
    gap: 16px;
    font-size:  var(--fs-sm);
    color: var(--toolbar-text-soft);
    flex-shrink: 0;
    position: relative;
    z-index: var(--z-statusbar);
    border-top: 1px solid rgba(255,255,255,.06);
}
#status-bar .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.status-dot.connected {
    background: var(--success);
    box-shadow: 0 0 6px color-mix(in srgb, var(--success) 50%, transparent);
}
.status-dot.disconnected {
    background: var(--danger);
    box-shadow: 0 0 6px color-mix(in srgb, var(--danger) 50%, transparent);
}
#status-bar .spacer {
    flex: 1;
}
#status-bar .status-item {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

#status-bar #workspace-status {
    position: relative;
    min-width: 0;
    max-width: 42%;
}
#status-bar #workspace-status-text {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#status-bar #workspace-status:hover::after {
    content: attr(data-full-path);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-toast);
    /* 关键：宽度按内容计算（max-content），避免被窄的包含块（workspace-status）约束而把短路径硬拆行 */
    width: max-content;
    max-width: min(70vw, 560px);
    padding: 6px 10px;
    background: var(--popup-bg);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    color: var(--text-body);
    font-size:  var(--fs-sm);
    line-height: 1.5;
    white-space: normal;
    /* 仅在内容超过 max-width 时才断行；短路径保持一行 */
    overflow-wrap: anywhere;
    word-break: normal;
    text-align: left;
    pointer-events: none;
}

















.code-block-wrapper {
    position: relative;
    margin: 8px 0;
    border-radius: 8px;
    background: var(--pre-bg);
    box-shadow: 0 1px 6px rgba(0,0,0,.08);
}
.code-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    background: var(--pre-scrollbar);
    border-radius: 8px 8px 0 0;
    user-select: none;
    color: rgba(255,255,255,.72);
    font-size:  var(--fs-sm);
}
.code-toolbar .code-lang {
    font-weight: 600;
    font-size:  var(--fs-xs);
    color: rgba(255,255,255,.92);
    letter-spacing: .03em;
}
.code-toolbar .code-actions {
    display: flex;
    gap: 2px;
}
.code-toolbar button {
    background: none;
    border: 0;
    cursor: pointer;
    padding: 3px 7px;
    border-radius: 4px;
    font-family: var(--font-sans);
    color: rgba(255,255,255,.45);
    font-size:  var(--fs-sm);
    display: inline-flex;
    align-items: center;
    gap: 3px;
    transition: background .15s, color .15s;
}
.code-toolbar button:hover,
.code-toolbar button.is-pressed {
    background: rgba(255,255,255,.1);
    color: #fff;
}
.cancel-btn,
.reset-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--bg-subtle);
    cursor: pointer;
    color: var(--text-body);
}
.save-btn {
    padding: 8px 20px;
    border: 0;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    font-weight: 500;
    font-family: var(--font-sans);
}
.action-btns {
    display: flex;
    gap: 8px;
}

.dialog-overlay,
.input-dialog-overlay,
.change-pwd-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn .2s ease-out;
}

.dialog-input,
.change-pwd-field input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--input-border);
    border-radius: 8px;
    font-size:  var(--fs-md-lg);
    outline: 0;
    transition: border-color .2s,box-shadow .2s;
    background: var(--input-bg);
    color: var(--text-primary);
}

.user-info-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 10px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-light);
}
.user-info-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.user-info-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size:  var(--fs-base);
    font-weight: 600;
    flex-shrink: 0;
}
.user-info-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.user-info-name {
    font-size:  var(--fs-base);
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-info-sub {
    font-size:  var(--fs-sm);
    color: var(--text-muted);
}
button.user-info-logout {
    background: none;
    border: 0;
    padding: 4px 12px;
    font-size:  var(--fs-md-lg);
    color: var(--text-muted);
    cursor: pointer;
    font-family: var(--font-sans);
    border-radius: 6px;
    transition: color .1s,background .1s;
}
button.user-info-logout:hover {
    color: var(--danger);
    background: var(--danger-soft);
}
button.user-info-logout:active {
    background: color-mix(in srgb, var(--danger) 25%, transparent);
}

.card-test-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 0;
}
.test-result {
    font-size:  var(--fs-md-lg);
    font-weight: 500;
    font-family: var(--font-mono);
}
.test-result.success {
    color: var(--success);
}
.test-result.fail {
    color: var(--danger);
}
.test-btn:disabled {
    opacity: .6;
    cursor: not-allowed;
}
.sig-key-row .settings-btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.session-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn .2s ease-out;
}

.security-dir-list {
    margin-bottom: 4px;
}

.security-dir-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    transition: background .15s;
    margin-bottom: 2px;
}


.security-add-dir-form {
    padding-top: 10px;
    border-top: 1px solid var(--border-light);
    margin-top: 8px;
}

#shell-validation-card {
    margin-top: 0;
}

/* ── Shell 命令规则（自定义名单） ── */
.shell-rules-desc {
    font-size: var(--fs-sm);
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 6px;
}

.shell-rules-hint {
    font-size: var(--fs-sm);
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.shell-rules-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.shell-rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
}

.shell-rule-field label {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: var(--fs-base);
    color: var(--text-primary);
    margin-bottom: 2px;
}

.shell-rule-lines-hint {
    font-size: var(--fs-sm);
    color: var(--text-secondary);
    font-weight: normal;
}

.shell-rule-desc {
    font-size: var(--fs-sm);
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 4px;
}

.shell-rule-input {
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    line-height: 1.45;
    padding: 6px 8px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--bg-subtle);
    color: var(--text-primary);
}

.shell-rule-input:focus {
    outline: none;
    border-color: var(--accent);
}

.dir-browser-dialog {
    width: 540px;
    max-width: 92vw;
    max-height: 75vh;
    display: flex;
    flex-direction: column;
    background: var(--dialog-bg);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3), 0 1px 3px rgba(0,0,0,.08);
    overflow: hidden;
}

.dir-browser-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px 0;
    flex-shrink: 0;
}
.dir-browser-nav-btn {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--bg-subtle);
    color: var(--text-secondary);
    font-size:  var(--fs-md-lg);
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .12s, color .12s;
}
.dir-browser-nav-btn:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.dir-browser-nav-btn:disabled {
    opacity: .4;
    cursor: default;
}
.dir-browser-breadcrumb {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 2px;
    overflow-x: auto;
    white-space: nowrap;
}
.dir-browser-breadcrumb::-webkit-scrollbar {
    width: 4px;  /* 仅横向滚动，但仍两轴写全：避免另一轴回退 UA 默认尺寸 */
    height: 4px;
}
.dir-browser-breadcrumb::-webkit-scrollbar-track {
    background: transparent;
}
.dir-browser-breadcrumb::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 2px;
}
@supports (not selector(::-webkit-scrollbar)) or (-moz-appearance: none) {
    .dir-browser-breadcrumb {
        scrollbar-width: thin;
        scrollbar-color: var(--scrollbar-thumb) transparent;
    }
}
.dir-browser-crumb {
    border: 0;
    background: none;
    padding: 4px 6px;
    border-radius: 5px;
    font-size:  var(--fs-md);
    font-family: var(--font-mono);
    color: var(--text-secondary);
    cursor: pointer;
    flex-shrink: 0;
    transition: background .12s, color .12s;
}
.dir-browser-crumb:hover {
    background: var(--bg-hover);
    color: var(--accent);
}
.dir-browser-crumb-current {
    color: var(--text-primary);
    font-weight: 600;
    cursor: default;
}
.dir-browser-crumb-current:hover {
    background: none;
    color: var(--text-primary);
}
.dir-browser-crumb-sep {
    color: var(--text-muted);
    font-size:  var(--fs-md-lg);
    flex-shrink: 0;
}
.dir-browser-current {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    margin: 8px 12px 0;
    background: var(--bg-subtle);
    border-radius: 8px;
    font-size:  var(--fs-md);
    font-family: var(--font-mono);
    color: var(--text-body);
    min-height: 36px;
    overflow: hidden;
}
/* 裸输入框（border:0 + 全局 input:focus-visible{outline:none}）需要容器提供键盘焦点提示 */
.dir-browser-current:focus-within {
    box-shadow: 0 0 0 3px var(--input-focus-ring);
}
.dir-browser-path-input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    font-family: var(--font-mono);
    font-size:  var(--fs-md);
    color: var(--text-body);
}
.dir-browser-path-input::placeholder {
    color: var(--text-muted);
    opacity: .7;
}

.dir-browser-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 4px;
    margin: 4px 8px;
    min-height: 200px;
    max-height: 380px;
    border-radius: 10px;
    background: var(--bg-card);
}

.dir-browser-list::-webkit-scrollbar {
    width: 5px;
    height: 5px; /* 横向条同粗：缺 height 时横向会回退 UA 默认厚度 */
}

.dir-browser-loading,
.dir-browser-error,
.dir-browser-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size:  var(--fs-md-lg);
}

.dir-browser-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    margin: 1px 0;
    cursor: pointer;
    font-size:  var(--fs-md-lg);
    color: var(--text-body);
    border-radius: 6px;
    transition: background .12s;
    user-select: none;
}
.dir-item-icon {
    flex-shrink: 0;
    font-size:  var(--fs-base);
    width: 22px;
    text-align: center;
    opacity: .7;
}
.dir-item-arrow {
    flex-shrink: 0;
    font-size:  var(--fs-md);
    width: 22px;
    text-align: center;
    color: var(--text-muted);
}
.dir-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dir-browser-up {
    margin-bottom: 6px;
    border-radius: 6px;
}

.dir-browser-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    background: var(--bg-subtle);
}
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--toolbar-bg);
    color: var(--toolbar-text);
    padding: 10px 24px;
    border-radius: 8px;
    font-size:  var(--fs-md-lg);
    z-index: var(--z-toast);
    transition: opacity .3s;
    white-space: nowrap;
    font-family: var(--font-sans);
}
.toast-error {
    background: var(--danger);
    color: #fff;
}
.toast-success {
    background: var(--success);
    color: #fff;
}
.toast-warning {
    background: var(--warning);
    color: var(--text-primary);
}

.status-badge .status-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background .25s var(--transition-ease);
}
.status-badge[data-status="idle"] .status-dot {
    background: var(--text-muted);
}
.status-badge[data-status="paused"] .status-dot {
    background: #6e665c;
}
[data-theme="dark"] .status-badge[data-status="paused"] .status-dot {
    background: #a29a90;
}
.status-badge[data-status="thinking"] .status-dot {
    background: var(--accent);
}
.status-badge[data-status="working"] .status-dot {
    background: var(--info);
}
.status-badge[data-status="awaiting"] .status-dot {
    background: var(--warning);
}
/* 忙碌态统一呼吸：与 Toolbar.BUSY_STATUSES / Desktop.busyStates
   （thinking | working | awaiting）同一口径。此前只有「思考中」有 statusPulse，
   刷新后服务端算出的权威状态是 working（工具执行中 / 等模型返回）——用户看到
   点从「呼吸」变成静止蓝点，读成任务停了；工具执行期间也一直是 working。 */
.status-badge[data-status="thinking"] .status-dot,
.status-badge[data-status="working"] .status-dot,
.status-badge[data-status="awaiting"] .status-dot {
    animation: statusPulse 1.5s ease-in-out infinite;
}
.status-badge[data-status="error"] .status-dot {
    background: var(--danger);
}
.status-badge[data-status="finished"] .status-dot {
    background: var(--success);
}

.messages-container .empty-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 160px;
    padding: 40px 24px;
    text-align: center;
    user-select: none;
    -webkit-user-select: none;
    transition: opacity .3s var(--transition-ease);
}

.messages-container .empty-placeholder.hidden {
    display: none;
}





.shortcut-popup::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}
.shortcut-popup::-webkit-scrollbar-track {
    background: transparent;
}
.shortcut-popup::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 2px;
}
.shortcut-popup::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}
@supports (not selector(::-webkit-scrollbar)) or (-moz-appearance: none) {
    .shortcut-popup {
        scrollbar-width: thin;
        scrollbar-color: var(--scrollbar-thumb) transparent;
    }
}


#toolbar .workspace-menu {
    min-width: 280px;
    /* 长名称/长路径时限制菜单最大宽度，避免撑破布局或超出视口 */
    max-width: min(420px, calc(100vw - 24px));
    /* 防御：裁剪横向残留溢出，确保文本绝不超出菜单边界 */
    overflow-x: hidden;
    /* 纵向滚动收进预设列表区（.workspace-menu-scroll）：
       预设再多也只滚列表，「管理工作区」入口常驻底部；
       外层保留 auto 仅做极矮视口兜底 */
    overflow-y: auto;
}
/* 分区布局：可滚动预设列表 + 常驻底部动作（与主菜单同构） */
#toolbar .dropdown-menu.workspace-menu.show {
    display: flex;
    flex-direction: column;
}
#toolbar .workspace-menu .workspace-menu-scroll {
    flex: 0 1 auto;
    /* 必须为 0：否则 flex 子项按内容撑高，内部滚动条永不出现 */
    min-height: 0;
    max-height: var(--workspace-menu-list-max-h);
    overflow-y: auto;
    overflow-x: hidden;
}
#toolbar .workspace-menu .workspace-menu-footer {
    /* 常驻动作区：预设再多也一屏可达 */
    flex: 0 0 auto;
    border-top: 1px solid rgba(255,255,255,.08);
}

#toolbar .workspace-menu .workspace-menu-item {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 8px 16px;
    border: 0;
    background: none;
    color: var(--toolbar-text);
    font-size:  var(--fs-md-lg);
    font-family: var(--font-sans);
    text-align: left;
    cursor: pointer;
    transition: background .12s;
}
#toolbar .workspace-menu .workspace-menu-item:hover,
#toolbar .workspace-menu .workspace-menu-item.is-pressed {
    background: rgba(255,255,255,.08);
}
#toolbar .workspace-menu .workspace-menu-item.active {
    background: color-mix(in srgb, var(--accent) 15%, transparent);
    color: #fff;
}
#toolbar .workspace-menu .workspace-menu-item.ws-disabled {
    opacity: .55;
    cursor: default;
    color: rgba(255,255,255,.6);
}

#toolbar .workspace-menu .ws-item-icon {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: rgba(255,255,255,.35);
}
#toolbar .workspace-menu .workspace-menu-item.active .ws-item-icon {
    background: var(--accent);
}
#toolbar .workspace-menu .ws-item-name {
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 0; /* 允许收缩：长名称时正确省略号截断，避免溢出菜单 */
    max-width: 40%;
    overflow: hidden;
    text-overflow: ellipsis;
}
#toolbar .workspace-menu .ws-item-path {
    font-size:  var(--fs-sm);
    color: rgba(255,255,255,.45);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1 1 auto; /* 占满剩余空间；空间不足时收缩并省略号截断 */
}

#toolbar .workspace-menu .workspace-menu-item.ws-action {
    gap: 6px;
}
#toolbar .workspace-menu .workspace-menu-item.ws-action .ws-action-icon {
    width: 14px;
    text-align: center;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size:  var(--fs-md);
}



.ws-mgr-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal-overlay);
}
.ws-mgr-dialog {
    width: 520px;
    max-width: 92vw;
    max-height: 70vh;
    background: var(--dialog-bg);
    border-radius: 12px;
    box-shadow: var(--shadow-modal);
    animation: slideUp .25s ease-out;
    padding: 14px 16px;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.ws-mgr-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--session-header-border);
}
.ws-mgr-header h3 {
    margin: 0;
    font-size:  var(--fs-base);
    font-weight: 600;
    color: var(--session-header-color);
}
.ws-mgr-close {
    background: none;
    border: 0;
    color: var(--session-close-color);
    font-size:  var(--fs-lg);
    cursor: pointer;
    opacity: .8;
    padding: 0 4px;
    border-radius: 6px;
    transition: background .15s,color .15s;
}
.ws-mgr-close:hover {
    opacity: 1;
    background: var(--session-close-hover-bg);
    color: var(--session-close-hover-color);
}
.ws-mgr-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 50vh;
    overflow-y: auto;
}
.ws-mgr-list::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.ws-mgr-list::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}
.ws-mgr-list::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 3px;
}
.ws-mgr-list::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}
@supports (not selector(::-webkit-scrollbar)) or (-moz-appearance: none) {
    .ws-mgr-list {
        scrollbar-width: thin;
        scrollbar-color: var(--scrollbar-thumb) transparent;
    }
}
.ws-mgr-empty {
    padding: 12px;
    text-align: center;
    font-size:  var(--fs-md-lg);
    color: var(--session-empty-color);
}
.ws-mgr-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    background: var(--session-item-bg);
    cursor: pointer;
}
.ws-mgr-row:hover {
    background: var(--session-item-hover);
}
.ws-mgr-row.active {
    border-color: var(--session-item-current-border);
    background: var(--session-item-current-bg);
}
.ws-mgr-row.selected {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px var(--accent);
}
.ws-mgr-row.selected .ws-mgr-dot { color: var(--accent); }
.ws-mgr-dot {
    flex-shrink: 0;
    color: var(--session-close-color);
}
.ws-mgr-row.active .ws-mgr-dot { color: var(--accent); }
.ws-mgr-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}
.ws-mgr-name {
    font-weight: 600;
    font-size:  var(--fs-md-lg);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}
.ws-mgr-path {
    font-size:  var(--fs-sm);
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ws-mgr-actions {
    display: inline-flex;
    gap: 4px;
    flex-shrink: 0;
}
.ws-mgr-btn {
    background: var(--dialog-btn-cancel-bg);
    border: 0;
    color: var(--dialog-btn-cancel-color);
    font-size:  var(--fs-md);
    padding: 3px 8px;
    border-radius: 5px;
    cursor: pointer;
    transition: background .15s;
}
.ws-mgr-btn:hover { background: var(--dialog-btn-cancel-hover); }
.ws-mgr-btn.ws-mgr-del:hover {
    background: var(--danger-soft);
    color: var(--danger);
}
.ws-mgr-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.ws-mgr-footer-right {
    display: inline-flex;
    gap: 8px;
    flex-shrink: 0;
}
.ws-mgr-add {
    background: var(--dialog-btn-cancel-bg);
    border: 0;
    color: var(--dialog-btn-cancel-color);
    font-size:  var(--fs-md-lg);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background .15s;
}
.ws-mgr-add:hover {
    background: var(--dialog-btn-cancel-hover);
}
.ws-mgr-ok {
    background: var(--accent);
    border: 0;
    color: #fff;
    font-size:  var(--fs-md-lg);
    padding: 6px 18px;
    border-radius: 6px;
    cursor: pointer;
    transition: background .15s;
}
.ws-mgr-ok:hover { background: var(--accent-hover); }
.ws-mgr-cancel {
    background: var(--dialog-btn-cancel-bg);
    border: 0;
    color: var(--dialog-btn-cancel-color);
    font-size:  var(--fs-md-lg);
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: background .15s;
}
.ws-mgr-cancel:hover { background: var(--dialog-btn-cancel-hover); }

/* ═══════════════════════════════════════════
   空桌面提示（无任何窗口时显示）
   原先样式内联在 Desktop.js 里，无法随主题/断点调整；
   另修正：按钮背景曾引用未定义的 var(--bg-surface)（背景失效）
   引导按钮定为「文字链接」观感：透明底 + 主题色文字，悬停/按下仅加深文字色并加下划线，
   不再在桌面上压出一块实心底（底色随桌面）。
   ═══════════════════════════════════════════ */
#empty-desk-hint .empty-desk-inner {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    user-select: none;
    -webkit-user-select: none;
}
#empty-desk-hint .empty-desk-icon {
    font-size: var(--fs-icon-3xl);
    margin-bottom: 16px;
}
#empty-desk-hint .empty-desk-title {
    margin: 0 0 8px;
    font-weight: 500;
    color: var(--text-primary);
}
#empty-desk-hint .empty-desk-desc {
    margin: 0 0 8px;
    font-size: var(--fs-md-lg);
    line-height: 1.8;
    color: var(--text-secondary);
}
#empty-desk-hint .empty-desk-create-btn {
    padding: 8px 24px;
    cursor: pointer;
    border: none;
    border-radius: 6px;
    background: transparent;
    font-size: var(--fs-md-lg);
    color: var(--accent);
    transition: color .15s;
}
/* 悬停与触屏按下同款观感（触屏粘滞 hover 由 mobile.css 中和） */
#empty-desk-hint .empty-desk-create-btn:hover,
#empty-desk-hint .empty-desk-create-btn.is-pressed {
    color: var(--accent-hover);
    text-decoration: underline;
}
