﻿/* === 变量与全局设置 === */
:root {
    /* ===== 颜色变量 ===== */
    --primary-blue: #89CFF0;
    --primary-blue-hover: #75bce0;
    --primary-pink: #F8BBD0;
    --bg-light: #ffffff;
    --bg-tint: #f0f7fc;
    --sidebar-bg: #ffffff;
    --text-main: #4a4a4a;
    --text-sub: #888888;
    --border-radius: 14px;
    --shadow-sm: 0 4px 12px rgba(137, 207, 240, 0.1);
    --shadow-md: 0 8px 24px rgba(137, 207, 240, 0.15);
    --diff-add: #e6ffed;
    --diff-add-text: #22863a;
    --diff-del: #ffeef0;
    --diff-del-text: #b31d28;
    --card-border: #eef2f6;
    --white: #ffffff;

    /* ===== 文字选中高亮 ===== */
    --selection-bg: rgba(47, 111, 167, 0.45);        /* 全局选中背景:深一档蓝,白底/浅底/蓝气泡上均清晰可辨 */
    --selection-fg: inherit;                          /* 全局选中前景:沿用元素原色,浅底深字可读性不受影响 */
    --selection-bg-on-primary: rgba(0, 40, 80, 0.45); /* 蓝底白字气泡专用:同色相需更深底色才有对比 */

    /* ===== Layout Variables ===== */
    --sidebar-width: 280px;
    --header-height: 70px;
    --avatar-size: 42px;
    --avatar-size-sm: 36px;
    --ai-avatar-size: 36px;
    --ai-avatar-size-sm: 32px;
    --message-max-width: 75%;
    --panel-default-width: 360px;
    --panel-default-height: 400px;
    --panel-min-width: 280px;
    --panel-min-height: 200px;
    --main-panel-width: 400px;
    --main-panel-height: 500px;
    --input-height: 44px;
    --input-height-sm: 36px;
    --send-btn-size: 44px;
    --modal-width: 400px;
    --panel-top-offset: 80px;
    --panel-left-offset: 60px;
    --mobile-panel-height: 55vh;

    /* ===== z-index Management ===== */
    --z-sidebar: 10;
    --z-sidebar-overlay: 20;
    --z-panel-agent: 60;
    --z-panel-main: 80;
    --z-modal-overlay: 1000;
    --z-modal-content: 1001;
    --z-nav: 1;
    --z-main: 1;
    --z-menu-dropdown: 100;
    --z-tooltip: 99999;
    --z-global-loading: 10000;
    --z-slide-menu: 99;
    --z-message-input: 10;
    --z-panel-overlay: 55;
    --z-panel-top: 70;
    --z-status-dot: 2;
    --z-status-remove: 3;
    --z-fullscreen: 100000;

    /* ===== Transition Variables ===== */
    --transition-fast: 0.2s;
    --transition-normal: 0.3s;

    /* ===== Breakpoint Variables (Reference Only) ===== */
    /*
     * 注意: CSS 中不能将 var() 直接用于 @media 条件
     * 这些变量仅作为文档参考和 JS 读取使用
     *
     * 断点定义:
     * --bp-xs:  480px  - 超小屏幕 (更小移动设备)
     * --bp-sm:  640px  - 小屏幕 (大手机)
     * --bp-md:  768px  - 中等屏幕 (平板/移动端主断点)
     * --bp-lg:  992px  - 大屏幕 (桌面小屏)
     * --bp-xl:  1200px - 超大屏幕 (桌面大屏)
     *
     * 当前使用情况:
     * - 768px (bp-md): pwa.css 底部弹出层、xml-visualization.css 卡片
     * - 480px (bp-xs): pwa.css 更小屏幕侧边栏高度
     */
    --bp-xs: 480px;
    --bp-sm: 640px;
    --bp-md: 768px;
    --bp-lg: 992px;
    --bp-xl: 1200px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Nunito', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

html {
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    height: 100vh;
    height: 100dvh; /* 动态视口高度：平板/移动端浏览器地址栏自动适配 */
    background: linear-gradient(135deg, #ffffff 0%, #f0f7fc 50%, #e8f4fc 100%);
    display: flex;
    color: var(--text-main);
    overflow: hidden;
    max-width: 100vw;
    touch-action: manipulation;
}

/* === 背景动画Canvas === */
#mind-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

/* 朦胧泡泡形状 */
.session-blob {
    position: absolute;
    width: 30vw;
    height: 30vw;
    min-width: 250px;
    min-height: 250px;
    filter: blur(90px);
    opacity: 0;
    transform-origin: center center;
    transition: opacity 2.5s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, border-radius, opacity;
}

/* 流体游走动画 */
@keyframes morphWander1 {
    0% { border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%; transform: translate(-50%, -50%) rotate(0deg) translate(-8vw, -8vh); }
    33% { border-radius: 70% 30% 50% 50% / 30% 30% 70% 70%; transform: translate(-50%, -50%) rotate(120deg) translate(12vw, 4vh); }
    66% { border-radius: 100% 60% 60% 100% / 100% 100% 60% 60%; transform: translate(-50%, -50%) rotate(240deg) translate(-4vw, 16vh); }
    100% { border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%; transform: translate(-50%, -50%) rotate(360deg) translate(-8vw, -8vh); }
}

@keyframes morphWander2 {
    0% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; transform: translate(-50%, -50%) rotate(0deg) translate(8vw, 8vh); }
    33% { border-radius: 30% 70% 70% 30% / 30% 60% 40% 70%; transform: translate(-50%, -50%) rotate(-120deg) translate(-12vw, -4vh); }
    67% { border-radius: 50% 50% 20% 80% / 25% 80% 20% 75%; transform: translate(-50%, -50%) rotate(-240deg) translate(4vw, -16vh); }
    100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; transform: translate(-50%, -50%) rotate(-360deg) translate(8vw, 8vh); }
}

@keyframes morphWander3 {
    0% { border-radius: 50% 50% 40% 60% / 50% 60% 40% 50%; transform: translate(-50%, -50%) rotate(0deg) translate(0vw, 10vh); }
    50% { border-radius: 40% 60% 60% 40% / 60% 40% 60% 40%; transform: translate(-50%, -50%) rotate(180deg) translate(-10vw, -5vh); }
    100% { border-radius: 50% 50% 40% 60% / 50% 60% 40% 50%; transform: translate(-50%, -50%) rotate(360deg) translate(0vw, 10vh); }
}

/* === 移动端泡泡优化 === */
@media (max-width: 768px) {
    #mind-canvas {
        /* 移动端减少重绘 */
        transform: translateZ(0);
    }
    
    .session-blob {
        /* 移动端缩小尺寸 */
        width: 40vw;
        height: 40vw;
        min-width: 150px;
        min-height: 150px;
        /* 减少模糊节省性能 */
        filter: blur(60px);
        /* 缩短过渡时间 */
        transition: opacity 1.5s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    /* 移动端简化动画 */
    @keyframes morphWander1 {
        0% { border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%; transform: translate(-50%, -50%) rotate(0deg); }
        50% { border-radius: 70% 30% 50% 50% / 30% 30% 70% 70%; transform: translate(-50%, -50%) rotate(180deg); }
        100% { border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%; transform: translate(-50%, -50%) rotate(360deg); }
    }
    
    @keyframes morphWander2 {
        0% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; transform: translate(-50%, -50%) rotate(0deg); }
        50% { border-radius: 30% 70% 70% 30% / 30% 60% 40% 70%; transform: translate(-50%, -50%) rotate(-180deg); }
        100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; transform: translate(-50%, -50%) rotate(-360deg); }
    }
    
    @keyframes morphWander3 {
        0% { border-radius: 50% 50% 40% 60% / 50% 60% 40% 50%; transform: translate(-50%, -50%) rotate(0deg); }
        50% { border-radius: 40% 60% 60% 40% / 60% 40% 60% 40%; transform: translate(-50%, -50%) rotate(180deg); }
        100% { border-radius: 50% 50% 40% 60% / 50% 60% 40% 50%; transform: translate(-50%, -50%) rotate(360deg); }
    }
}

/* 文字选中样式（颜色取自 :root 的 --selection-* 变量，一处调全局） */
::selection { background: var(--selection-bg); color: var(--selection-fg); }
::-moz-selection { background: var(--selection-bg); color: var(--selection-fg); }
/* 蓝色用户气泡上的选中：与全局色同色相叠加会不可见，改用深蓝底白字强对比 */
.msg-user-bubble::selection { background: var(--selection-bg-on-primary); color: var(--white); }
.msg-user-bubble::-moz-selection { background: var(--selection-bg-on-primary); color: var(--white); }

/* 滚动条美化 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d0e5f2; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-blue); }

/* === 工具类 === */
.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-column {
    display: flex;
    flex-direction: column;
}

.max-w-full {
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
}

.transition-fast { transition: var(--transition-fast); }
.transition-normal { transition: var(--transition-normal); }

/* 路径显示行 */
.message-header-path-row {
    padding: 0 20px 8px;
    border-bottom: 1px solid #eef2f6;
    background: #fff;
    flex-shrink: 0;
    font-size: 12px;
    color: #888;
}
.session-path-display {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}
.session-path-display:hover {
    color: #555;
}

/* 菜单分隔线 */
.menu-divider {
    height: 1px;
    background: #eef2f6;
    margin: 4px 0;
}

/* === 左侧边栏 === */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid #e1e8f0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    box-shadow: 2px 0 10px rgba(0,0,0,0.02);
    z-index: var(--z-sidebar);
    will-change: transform;
    transform: translateX(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar.collapsed {
    transform: translateX(calc(-1 * var(--sidebar-width)));
    flex-basis: 0;
    flex-shrink: 1;
    border-right: none;
    overflow: hidden;
}

/* 侧边栏折叠时子元素透明度过渡 */
.sidebar-header, .session-list, .sidebar-bottom {
    transition: opacity 0.2s ease;
}

.sidebar.collapsed .sidebar-header,
.sidebar.collapsed .session-list,
.sidebar.collapsed .sidebar-bottom {
    opacity: 0;
    pointer-events: none;
}

/* 侧边栏拖拽手柄 */
.sidebar-resize-handle {
    position: absolute;
    right: -3px;
    top: 0;
    bottom: 0;
    width: 6px;
    cursor: col-resize;
    z-index: var(--z-sidebar-overlay);
    transition: background 0.15s;
}
.sidebar-resize-handle:hover,
.sidebar-resize-handle.dragging {
    background: var(--primary-blue);
}
.sidebar.collapsed .sidebar-resize-handle {
    pointer-events: none;
}

/* 顶部用户信息栏 */
.user-header {
    height: var(--header-height);
    padding: 0 20px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #f0f4f8;
}
.user-avatar {
    width: var(--avatar-size);
    height: var(--avatar-size);
    border-radius: 50%;
    border: 2px solid var(--primary-pink);
    object-fit: cover;
}
.user-name {
    flex: 1;
    margin-left: 12px;
    font-weight: bold;
    font-size: 15px;
    color: var(--text-main);
}
.settings-btn {
    background: #f5f8fb;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    color: var(--primary-blue);
    cursor: pointer;
    transition: var(--transition-normal);
}
.settings-btn:hover { background: var(--primary-blue); color: white; transform: rotate(45deg); }

/* 会话列表 */
.session-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 0;
}
.session-item {
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background var(--transition-fast);
    position: relative;
    display: flex;
    align-items: center;
    flex-direction: row;
}
.session-item:hover { background: #f5f7fa; }
.session-item.active { background: #e8f1fc; }

.session-header { flex: 1; display: flex; justify-content: space-between; align-items: center; gap: 8px; min-width: 0; }
.session-title { font-size: 13px; font-weight: 500; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; min-width: 0; flex-shrink: 1; }
.session-item.active .session-title { font-weight: 600; }
.session-time { font-size: 11px; color: #a0aab5; flex-shrink: 0; }

.session-delete {
    position: static; background: none; border: none;
    color: #ff9999; cursor: pointer; opacity: 0; transition: var(--transition-fast); font-size: 13px;
    padding: 4px; margin-left: 2px; flex-shrink: 0;
}
.session-item:hover .session-delete { opacity: 1; }
.session-delete:hover { color: #ff4d4d; transform: scale(1.1); }

/* 侧边栏头部 - Logo + 新建会话 */
.sidebar-header { padding: 16px; display: flex; flex-direction: column; gap: 12px; border-bottom: 1px solid #f0f4f8; }
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: bold;
    color: var(--text-main);
}
.sidebar-logo i { color: var(--primary-blue); font-size: 20px; }

/* IPv6 访问标识 */
.ipv6-badge {
    display: inline;
    font-size: 9px;
    font-weight: 600;
    color: rgba(100, 180, 255, 0.6);
    margin-left: 4px;
    letter-spacing: 0.5px;
    vertical-align: super;
    user-select: none;
}

/* 侧边栏底部 - 状态 + 用户 */
.sidebar-bottom {
    border-top: 1px solid #f0f4f8;
    flex-shrink: 0;
}

/* 紧凑状态条 */
.sidebar-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 6px 12px;
    background: #f8fafc;
    font-size: 11px;
    color: #888;
}
.sbar-item {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}
.sbar-divider {
    width: 1px;
    height: 12px;
    background: #e1e8f0;
    margin: 0 10px;
    flex-shrink: 0;
}
.sdot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.sdot.sdot-online { background: #10b981; box-shadow: 0 0 4px rgba(16,185,129,0.4); }
.sdot.sdot-offline { background: #ef4444; }
.sdot.sdot-loading { background: #f59e0b; animation: pulse 1.5s ease-in-out infinite; }

/* 底部新建按钮 - 旧版移除 */
.sidebar-footer { display: none; }

/* 侧边栏头部新建按钮 */
.sidebar-header .btn-new {
    width: 100%; padding: 8px; border-radius: var(--border-radius); border: none;
    background: linear-gradient(135deg, var(--primary-blue), #6db5f2); color: white;
    font-weight: 600; font-size: 13px; cursor: pointer; transition: var(--transition-normal);
    box-shadow: var(--shadow-sm); display: flex; align-items: center; justify-content: center; gap: 6px;
}
.sidebar-header .btn-new:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }

/* 侧边栏头部内部分隔线 */
.sidebar-header-divider { height: 1px; background: #e1e8f0; margin: 0; }

/* === 右侧主区域 === */
.main-area {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: var(--z-main);
    background: url('data:image/svg+xml;utf8,<svg width="20" height="20" xmlns="http://www.w3.org/2000/svg"><circle cx="2" cy="2" r="1.5" fill="%23e8eef5"/></svg>');
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 消息流区域 */
.message-flow {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    opacity: 0;
    transition: opacity 0.3s ease-in;
    contain: layout;
}
.message-flow.loaded {
    opacity: 1;
}
/* 消息流标题栏 */
.message-header {
    padding: 16px 20px 12px;
    border-bottom: 1px solid #eef2f6;
    background: #fff;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.message-header-left {
    overflow: visible;
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-toggle {
    width: 32px;
    height: 32px;
    border: none;
    background: #f5f8fb;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-blue);
    flex-shrink: 0;
    transition: var(--transition-fast);
}
.sidebar-toggle:hover {
    background: var(--primary-blue);
    color: white;
}
.message-header-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.message-header-sub {
    font-size: 12px;
    color: var(--text-sub);
    margin-top: 4px;
}
.message-header-menu {
    position: relative;
    margin-left: 16px;
    flex-shrink: 0;
}
.menu-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-sub);
    transition: var(--transition-fast);
}
.menu-btn:hover {
    background: #f0f4f8;
    color: var(--text-main);
}
.menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: #fff;
    border: 1px solid #e1e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    min-width: 180px;
    display: none;
    z-index: var(--z-menu-dropdown);
}
.menu-dropdown.show {
    display: block;
}
.menu-item {
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition-fast);
}
.menu-item:hover {
    background: #f5f7fa;
}
.menu-item:first-child {
    border-radius: 8px 8px 0 0;
}
.menu-item:last-child {
    border-radius: 0 0 8px 8px;
}
/* 消息流内容区 */
.message-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px clamp(16px, 5vw, 80px);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    min-width: 0;
    position: relative;
    user-select: text;
    -webkit-user-select: text;
    overscroll-behavior: contain;
    overscroll-behavior-y: contain;
    /* 关键：隔离布局上下文 + 禁用滚动锚定（auto-scroll时选择偏移的元凶） */
    contain: layout paint;
    overflow-anchor: none;
    isolation: isolate;
}
.message-content > * + * {
    margin-top: 24px;
}
.message-content > * {
    max-width: 100%;
    min-width: 0;
}

/* -- 用户消息 -- */
.msg-user-wrap { align-self: flex-end; max-width: 75%; display: flex; flex-direction: column; align-items: flex-end; min-width: 0; position: relative; }
.msg-user-bubble {
    background: var(--primary-blue); color: white; padding: 12px 18px;
    border-radius: 16px 16px 4px 16px; font-size: 14px; line-height: 1.6;
    box-shadow: 0 4px 10px rgba(137, 207, 240, 0.3);
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}
.msg-user-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    width: 100%;
    justify-content: space-between;
}
.msg-user-actions {
    display: none;
    gap: 4px;
    order: -1;
}
.msg-user-wrap:hover .msg-user-actions {
    display: flex;
}
.msg-action-btn {
    background: transparent;
    border: none;
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
    font-size: 12px;
    color: #9aa5b1;
    transition: all 0.2s;
}
.msg-action-btn:hover {
    color: var(--primary-blue);
}
.msg-user-info { font-size: 11px; color: #9aa5b1; }

/* -- AI回复区域 -- */
.msg-ai-wrap {
    align-self: flex-start;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    display: flex; align-items: flex-start; gap: 16px;
}
.ai-avatar {
    width: var(--ai-avatar-size); height: var(--ai-avatar-size); border-radius: 50%; border: 2px solid white;
    box-shadow: var(--shadow-sm); flex-shrink: 0; background: #fff;
}
.ai-content { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; max-width: 100%; }

/* AI消息底部操作栏（参考用户消息） */
.msg-ai-footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 4px; width: 100%; }
.msg-ai-actions { display: none; gap: 4px; }
.msg-ai-wrap:hover .msg-ai-actions { display: flex; }

/* 思考区块 */
.thought-block {
    border-left: 3px solid var(--primary-pink);
    padding-left: 12px;
    margin: 4px 0;
    font-size: 13px;
    color: #7a8694;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    max-width: 100%;
    overflow-wrap: break-word;
}

/* 思考区块简化模式：只显示最新一行，点击展开/收起 */
.thought-block.compact {
    cursor: pointer;
    user-select: none;
}
.thought-block.compact .thought-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.thought-block.compact.expanded .thought-text {
    white-space: pre-wrap;
    overflow: visible;
    text-overflow: clip;
}

/* AI纯文本内容 */
.ai-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-main);
    background: #ffffff;
    padding: 16px 20px;
    border-radius: 4px 16px 16px 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(137, 207, 240, 0.2);
    margin-top: 4px;
    min-width: 0;
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
}
.ai-text p { margin-bottom: 8px; }
.ai-text p:last-child { margin-bottom: 0; }
.ai-text code { background: #f0f4f8; padding: 2px 6px; border-radius: 4px; color: #d63384; font-family: monospace;}

/* AI加载指示器 */
.ai-loading {
    display: flex; gap: 4px; padding: 8px 0; align-items: center;
}
.ai-loading .dot {
    width: 8px; height: 8px; border-radius: 50%; background: #a8d8ff;
    animation: dot-bounce 1.4s infinite ease-in-out both;
    will-change: transform, opacity;
}
.ai-loading .dot:nth-child(1) { animation-delay: -0.32s; }
.ai-loading .dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes dot-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* AI加载骨架屏 - Shimmer效果 */
.ai-loading-shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
    will-change: background-position;
}
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Typing指示器 */
.typing-indicator {
    display: flex; gap: 4px; padding: 8px 12px;
}
.typing-indicator span {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--primary-blue);
    animation: typing 1.4s ease-in-out infinite;
    will-change: transform, opacity;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* AI思考中提示 */
.ai-thinking {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 16px; background: linear-gradient(135deg, #f0f7ff 0%, #e8f4fd 100%);
    border-radius: 12px; color: #4a90d9; font-size: 14px;
}
.ai-thinking .thinking-dots {
    display: flex; gap: 4px;
}
.ai-thinking .dot {
    width: 8px; height: 8px; border-radius: 50%; background: #4a90d9;
    animation: bounce 1.4s ease-in-out infinite;
    will-change: transform, opacity;
}
.ai-thinking .dot:nth-child(1) { animation-delay: 0s; }
.ai-thinking .dot:nth-child(2) { animation-delay: 0.2s; }
.ai-thinking .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}
.ai-thinking .thinking-text {
    font-weight: 500;
}
.ai-thinking .thinking-icon {
    animation: pulse 1.5s ease-in-out infinite;
    will-change: opacity;
}
@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* 思考区块Shimmer加载态 */
.thought-block.thinking-loading {
    background: linear-gradient(90deg, #f8fafc 25%, #e8f4fd 50%, #f8fafc 75%);
    background-size: 200% 100%;
    animation: shimmer 1.8s ease-in-out infinite;
    border-radius: 6px;
    will-change: background-position;
}

/* -- 工具卡片通用样式 -- */
.tool-card {
    border: 1px solid var(--card-border); border-radius: 12px; background: #fff;
    overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.02); margin-top: 6px;
    max-width: 100%; min-width: 0;
}
.tool-header {
    padding: 10px 14px; background: #fafbfc; display: flex; justify-content: space-between;
    align-items: center; cursor: pointer; font-size: 13px; font-weight: bold; color: var(--text-main);
    user-select: none; min-width: 0;
}
.tool-header > div { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-header:hover { background: #f5f7fa; }
.tool-icon { margin-right: 8px; color: var(--primary-blue); width: 16px; text-align: center; flex-shrink: 0; }
.tool-toggle-icon { transition: transform 0.3s; color: #b0bac5; flex-shrink: 0; }
.tool-body { padding: 14px; border-top: 1px solid var(--card-border); display: none; background: #fff; overflow-x: auto; max-width: 100%; }
.tool-card.expanded .tool-body { display: block; }
.tool-card.expanded .tool-toggle-icon { transform: rotate(180deg); }

/* Diff 特殊样式 */
.diff-container { font-family: monospace; font-size: 12px; line-height: 1.5; background: #fafbfc; border-radius: 6px; border: 1px solid #eaeef2; overflow-x: auto; max-width: 100%; }
.diff-line { display: flex; min-width: 0; }
.diff-line:hover { background: #f0f4f8; }
.diff-num { width: 35px; text-align: right; padding-right: 8px; color: #b0bac5; user-select: none; border-right: 1px solid #eaeef2; background: #f8fafc; flex-shrink: 0; }
.diff-code { padding-left: 12px; white-space: pre-wrap; word-break: break-all; flex: 1; min-width: 0; }
.diff-add { background: var(--diff-add); }
.diff-add .diff-code { color: var(--diff-add-text); }
.diff-del { background: var(--diff-del); }
.diff-del .diff-code { color: var(--diff-del-text); }

/* QQ 特殊卡片 */
.qq-card { border-color: #cce5ff; }
.qq-card .tool-header { background: #e8f4ff; color: #0056b3; }
.qq-icon { color: #12b7f5; }

/* Bash 等宽样式 */
.bash-cmd {
    background: #f8fafc;
    color: #475569;
    border: 1px solid #e2e8f0;
    padding: 12px;
    border-radius: 8px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-word;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
    line-height: 1.5;
    overflow-x: auto;
    overflow-y: auto;
    max-width: 100%;
    max-height: 320px;
}
.bash-status { margin-top: 8px; font-size: 12px; color: #28a745; font-weight: bold;}

/* === 消息输入区域 === */
.input-area {
    background: rgba(255,255,255,0.85); backdrop-filter: blur(10px);
    border-top: 1px solid #e1e8f0; padding: 16px clamp(12px, 5vw, 80px);
    display: flex; flex-direction: column; gap: 12px; z-index: var(--z-message-input);
    flex-shrink: 0; /* 防止视口较小时被压缩 */
}

/* 顶部栏 */
.input-top-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px;}

.work-path-box {
    display: flex; align-items: center; flex: 1; background: #fff;
    border: 1px solid #e1e8f0; border-radius: 8px; padding: 0 12px; height: 34px;
}
.work-path-box i { color: #f6c23e; margin-right: 8px; }
.work-path-input { border: none; outline: none; flex: 1; font-size: 13px; color: #666; background: transparent;}

.config-bar { display: flex; gap: 10px; }

/* 自定义下拉框样式 */
.custom-select { position: relative; }

.upload-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    border-radius: 8px;
    background: #f3f4f6;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    gap: 4px;
    padding: 0 8px;
}
.upload-trigger:hover {
    background: #e5e7eb;
    color: #333;
}
.upload-label {
    font-size: 13px;
}
@media (max-width: 768px) {
    .upload-label {
        display: none;
    }
    .upload-trigger {
        width: 34px;
        padding: 0;
    }
}
#modelSelect { min-width: 100px; max-width: 260px; }
#agentSelect { min-width: 100px; max-width: 260px; }
.select-selected {
    background: #fff; border: 1px solid #e1e8f0; border-radius: 8px; height: 34px;
    padding: 0 12px; display: flex; align-items: center; justify-content: space-between;
    font-size: 12px; cursor: pointer; color: var(--text-main); user-select: none;
}
.select-selected-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}
.select-selected:after { content: '\f0d8'; font-family: 'Font Awesome 6 Free'; font-weight: 900; color: #b0bac5; flex-shrink: 0; margin-left: 8px; }
.select-items {
    position: absolute; background-color: #fff; bottom: 100%; left: 0; min-width: 100%; width: max-content; z-index: var(--z-slide-menu);
    border: 1px solid #e1e8f0; border-radius: 8px; margin-bottom: 4px;
    box-shadow: var(--shadow-md); display: none;
    max-height: 200px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}
.select-items div { padding: 8px 12px; cursor: pointer; font-size: 12px; transition: var(--transition-fast); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-items div:hover { background-color: #f0f4f8; color: var(--primary-blue); }
/* 模型下拉分组组头：弱化标签，不可交互（color 沿用 --text-sub，与条目 hover 隔离） */
.select-items div.select-group-header { padding: 6px 12px; font-size: 11px; color: var(--text-sub); cursor: default; user-select: none; letter-spacing: 0.03em; }
.select-items div.select-group-header:hover { background-color: transparent; color: var(--text-sub); }
.select-show { display: block; }

/* 消息输入框行 */
.input-row { display: flex; gap: 16px; align-items: flex-end; }
.msg-input {
    flex: 1; height: var(--input-height); min-height: var(--input-height); max-height: 150px; overflow-y: hidden;
    border-radius: var(--border-radius); border: 1px solid #e1e8f0;
    padding: 12px 16px; font-size: 14px; outline: none; background: #fff;
    resize: none; line-height: 1.5; transition: border-color 0.3s, box-shadow 0.3s;
}
.msg-input:focus { border-color: var(--primary-blue); box-shadow: 0 0 0 3px rgba(137, 207, 240, 0.2); }

.send-btn {
    width: var(--send-btn-size); height: var(--send-btn-size); border-radius: var(--border-radius); border: none;
    background: var(--primary-blue); color: white; font-size: 16px; cursor: pointer;
    box-shadow: 0 4px 10px rgba(137, 207, 240, 0.4); transition: var(--transition-fast);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.send-btn:hover { background: var(--primary-blue-hover); transform: translateY(-2px); }
.send-btn:disabled { background: #ccc; cursor: not-allowed; transform: none; }

/* === 设置弹窗 === */
.modal-overlay {
    display: none;
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.3); backdrop-filter: blur(4px);
    justify-content: center; align-items: center; z-index: var(--z-modal-overlay);
}
.modal-overlay.visible {
    display: flex;
    animation: overlayFadeIn 0.2s ease-out;
}
.modal-overlay.closing {
    display: flex;
    animation: overlayFadeOut 0.2s ease-out forwards;
}

@keyframes overlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes overlayFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}
.modal-content {
    width: var(--modal-width); background: #fff; border-radius: 20px;
    display: flex; flex-direction: column; box-shadow: 0 15px 35px rgba(0,0,0,0.15);
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

.modal-header { padding: 20px 24px; border-bottom: 1px solid #f0f4f8; display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-size: 16px; font-weight: bold; color: var(--text-main); }
.close-btn { background: none; border: none; font-size: 20px; color: #b0bac5; cursor: pointer; }
.close-btn:hover { color: #ff9999; }

.modal-body { padding: 24px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; max-height: 85vh; }
.form-group label { display: block; font-size: 13px; color: #666; margin-bottom: 6px; }
.form-input { width: 100%; padding: 10px 12px; border: 1px solid #e1e8f0; border-radius: 8px; outline: none; font-size: 14px; background: #f8fafc;}
.form-input:focus { border-color: var(--primary-blue); background: #fff; }

.form-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e1e8f0;
    border-radius: 8px;
    outline: none;
    font-size: 14px;
    background: #f8fafc;
    color: #2c3e50;
    cursor: pointer;
    transition: border-color 0.15s ease;
    appearance: auto;
}
.form-select:focus {
    border-color: var(--primary-blue);
    background: #fff;
}

.system-status-list { display: flex; flex-direction: column; gap: 8px; }
.status-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #f8fafc; border-radius: 8px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.status-dot.status-online { background: #10b981; box-shadow: 0 0 6px rgba(16,185,129,0.4); }
.status-dot.status-offline { background: #ef4444; box-shadow: 0 0 6px rgba(239,68,68,0.3); }
.status-dot.status-loading { background: #f59e0b; animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:0.4;} }
.status-label { font-size: 13px; color: #666; min-width: 70px; }
.status-value { font-size: 13px; color: #333; font-weight: 500; margin-left: auto; }

.logout-btn {
    width: 100%; padding: 10px; margin-top: 10px; border-radius: 8px; border: 1px solid #ffcccc;
    background: #fff0f0; color: #d9534f; font-weight: bold; cursor: pointer; transition: var(--transition-fast);
}
.logout-btn:hover { background: #ffcccc; }

/* ============ 设置面板 (侧边栏 + 内容区) ============ */
.settings-modal-content {
    width: 680px;
    max-width: 90vw;
}

.settings-modal-body {
    display: flex;
    flex-direction: row;
    padding: 0;
    gap: 0;
    overflow: hidden;
    height: 65vh;
    min-height: 400px;
}

/* 左侧侧边栏 */
.settings-sidebar {
    width: 140px;
    flex-shrink: 0;
    background: #f8fafc;
    border-right: 1px solid #e8edf4;
    display: flex;
    flex-direction: column;
    padding: 12px 0;
    gap: 2px;
    overflow-y: auto;
}

.settings-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    font-size: 14px;
    color: #5a6a7a;
    border-right: 3px solid transparent;
    transition: all 0.15s ease;
    user-select: none;
}

.settings-nav-item:hover {
    background: #edf2f7;
    color: #3a4a5a;
}

.settings-nav-item.active {
    background: #e8f0fe;
    color: #2563eb;
    border-right-color: #2563eb;
    font-weight: 600;
}

.settings-nav-item i {
    width: 18px;
    text-align: center;
    font-size: 16px;
}

/* 右侧内容区 */
.settings-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    min-width: 0;
    min-height: 0;
}

.settings-tab-panel {
    display: none;
    flex-direction: column;
    gap: 16px;
}

.settings-tab-panel.active {
    display: flex;
}

.settings-section-title {
    font-size: 12px;
    font-weight: 700;
    color: #8a9aa8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
    padding-bottom: 6px;
    border-bottom: 1px solid #f0f2f5;
}

.settings-section-title:not(:first-child) {
    margin-top: 12px;
}

.settings-desc {
    font-size: 13px;
    color: #888;
    margin-bottom: 4px;
}

/* 设置行 (toggle 行) */
.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid #f0f2f5;
}

.settings-row-info {
    flex: 1;
    min-width: 0;
}

.settings-row-label {
    font-size: 14px;
    color: #2c3e50;
    font-weight: 500;
}

.settings-row-desc {
    font-size: 12px;
    color: #99a8b8;
    margin-top: 3px;
}

.settings-row-hint {
    font-size: 11px;
    color: #99a8b8;
    margin-top: 2px;
}

/* 模型显示 tab：提供商分组标题（弱化的 settings-section-title，仅收紧间距与下划线） */
.model-vis-group-title {
    margin-top: 16px;
    border-bottom-color: #eef1f4;
}

.model-vis-group-title:first-child {
    margin-top: 4px;
}

/* 设置操作按钮 */
.settings-action-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e8edf4;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 14px;
    color: #2c3e50;
}

.settings-action-btn:hover {
    background: #f8fafc;
    border-color: #d0d8e4;
}

.settings-action-btn i:first-child {
    width: 20px;
    text-align: center;
    font-size: 16px;
    color: #5a7a9a;
}

.settings-action-btn span {
    flex: 1;
    text-align: left;
}

.settings-action-arrow {
    color: #b0bac5;
    font-size: 12px;
}

/* 设置按钮组 */
.settings-btn-group {
    display: flex;
    gap: 10px;
}

.settings-btn-group .btn {
    flex: 1;
    padding: 10px 12px;
    font-size: 13px;
}

/* 快捷消息配置 */
.quick-message-config-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.quick-message-add-form {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.quick-message-add-form .form-input:first-child {
    flex: 1;
}

.quick-message-add-form .form-input:nth-child(2) {
    flex: 2;
}

.quick-message-add-form .btn {
    padding: 8px 16px;
}

/* 关于信息 */
.about-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #f8fafc;
    border-radius: 10px;
    padding: 4px;
}

.about-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-radius: 6px;
}

.about-item:hover {
    background: #edf2f7;
}

.about-label {
    font-size: 13px;
    color: #6a7a8a;
}

.about-value {
    font-size: 13px;
    color: #2c3e50;
    font-weight: 500;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .settings-modal-content {
        width: 95vw;
        max-width: 95vw;
    }

    .settings-modal-body {
        flex-direction: column;
        min-height: auto;
        max-height: 80vh;
    }

    .settings-sidebar {
        width: 100%;
        flex-direction: row;
        border-right: none;
        border-bottom: 1px solid #e8edf4;
        padding: 8px;
        gap: 4px;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .settings-nav-item {
        padding: 8px 14px;
        border-right: none;
        border-bottom: 2px solid transparent;
        white-space: nowrap;
        font-size: 13px;
    }

    .settings-nav-item.active {
        border-right-color: transparent;
        border-bottom-color: #2563eb;
    }

    .settings-nav-item i {
        font-size: 14px;
    }

    .settings-content {
        padding: 16px;
    }

    .settings-btn-group {
        flex-direction: column;
    }

    .quick-message-add-form {
        flex-direction: column;
    }

    .quick-message-add-form .form-input:first-child,
    .quick-message-add-form .form-input:nth-child(2) {
        flex: none;
        width: 100%;
    }
}

.modal-footer { padding: 16px 24px; border-top: 1px solid #f0f4f8; display: flex; justify-content: flex-end; gap: 12px; background: #fafbfc; border-radius: 0 0 20px 20px;}
.btn { padding: 8px 20px; border-radius: 8px; border: none; font-weight: bold; cursor: pointer; font-size: 13px; transition: var(--transition-fast); }
.btn-cancel { background: #e1e8f0; color: #666; }
.btn-cancel:hover { background: #d0d9e2; }
.btn-save { background: var(--primary-blue); color: white; }
.btn-save:hover { background: var(--primary-blue-hover); }

/* 加载状态 */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 空状态提示 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-sub);
    font-size: 14px;
    max-width: 100%;
}
.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    color: #d0e5f2;
}

/* 打字指示器 */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}
.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--primary-blue);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}
.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* === 移动端响应式布局 === */
@media (max-width: 1200px) {
    .ai-text, .msg-user-bubble, .thought-block {
        word-break: break-word;
        overflow-wrap: break-word;
    }
    pre, code {
        max-width: 100%;
        overflow-x: auto;
        white-space: pre-wrap;
        word-break: break-all;
    }
    .tool-card {
        max-width: 100%;
        overflow-x: auto;
    }
    .tool-output {
        max-width: 100%;
        overflow-x: auto;
    }
}

@media (max-width: 768px) {
    body {
        overflow: visible;
        height: auto;
        min-height: 100vh;
        align-items: flex-start;
    }

    .main-area {
        flex: none;
        width: 100%;
        min-height: 100vh;
        height: auto;
    }

    .message-flow {
        overflow: visible;
        flex: none;
        height: auto;
    }

    .message-content {
        overflow: visible;
        padding: 8px 8px;
        flex: none;
        height: auto;
        /* 移动端不需要 contain、overflow-anchor、overscroll-behavior */
        contain: none;
        overflow-anchor: auto;
        overscroll-behavior: auto;
    }

    .ai-text, .msg-user-bubble, .thought-block {
        word-break: break-word;
        overflow-wrap: break-word;
    }

    .tool-card {
        max-width: 100%;
        overflow-x: auto;
    }
    .tool-output {
        max-width: 100%;
        overflow-x: auto;
    }

    pre, code {
        max-width: 100%;
        overflow-x: auto;
        white-space: pre-wrap;
        word-break: break-all;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 100vw;
        z-index: var(--z-menu-dropdown);
        box-shadow: none;
        will-change: transform;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .sidebar.show {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0,0,0,0.15);
    }
    .sidebar.collapsed {
        transform: translateX(-100%);
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.3);
        z-index: var(--z-slide-menu);
    }
    .sidebar-overlay.show {
        display: block;
    }

    .message-header {
        padding: 10px 12px 8px;
        position: sticky;
        top: 0;
        z-index: 9;
        background: #fff;
    }
    .message-header-path-row {
        padding: 0 12px 6px;
    }
    .input-area {
        padding: 10px 12px;
        position: sticky;
        bottom: 0;
        z-index: 10;
        background: #f5f7fa;
        border-top: 1px solid #e8eaed;
    }

    .modal-content {
        width: 95%;
        max-width: 400px;
        margin: 0 auto;
    }

    .user-avatar {
        width: 36px;
        height: 36px;
    }
    .ai-avatar {
        width: 32px;
        height: 32px;
    }

    .msg-user-wrap {
        max-width: 92%;
    }
    .msg-user-bubble {
        padding: 10px 14px;
        font-size: 15px;
    }

    .ai-text {
        padding: 12px 14px;
        font-size: 15px;
        line-height: 1.6;
    }

    /* 移动端 SVG 图块：减小内边距、限制最大高度，让图显示更大且不撑爆屏幕 */
    .markdown-content .svg-diagram {
        padding: 8px;
    }
    .markdown-content .svg-diagram svg {
        max-height: 60vh;
    }

    .thought-block {
        font-size: 14px;
        line-height: 1.5;
    }

    #modelSelect {
        max-width: 180px;
    }
    #agentSelect {
        max-width: 180px;
    }
    .select-items {
        bottom: 100%;
        top: auto;
        margin-bottom: 4px;
        margin-top: 0;
        max-height: 40vh;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .message-header-title {
        font-size: 15px;
    }

    .work-path-box {
        height: 32px;
        font-size: 13px;
    }

    .send-btn {
        width: 40px;
        height: 40px;
    }

    .msg-input {
        min-height: 40px;
        font-size: 15px;
    }

    .session-title {
        max-width: none;
        font-size: 14px;
    }
    .session-item {
        padding: 7px 12px;
    }
    /* 移动端更紧凑的侧边栏头部 */
    .sidebar-header {
        padding: 10px 14px;
        gap: 8px;
    }
    .sidebar-header .btn-new {
        padding: 6px 8px;
        font-size: 12px;
        border-radius: 6px;
    }
    .sidebar-header .btn-new i {
        font-size: 11px;
    }
    /* 会话分组缩进加强 */
    .session-group-body {
        padding-left: 20px;
    }
    /* 减少 session-list padding（右侧贴边） */
    .session-list {
        padding: 8px 0 8px 8px;
        gap: 2px;
    }

    .sidebar-toggle {
        margin-left: 0;
    }

    .tool-card {
        font-size: 13px;
    }

    body {
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .user-avatar, .ai-avatar {
        width: 32px;
        height: 32px;
    }

    .msg-user-bubble, .ai-text {
        padding: 10px 12px;
        font-size: 15px;
        line-height: 1.5;
    }

    .thought-block {
        font-size: 14px;
    }

    #modelSelect {
        max-width: 100px;
    }
    #agentSelect {
        width: 90px;
    }
    .select-items {
        bottom: 100%;
        top: auto;
        margin-bottom: 4px;
        margin-top: 0;
        max-height: 40vh;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .work-path-box {
        font-size: 12px;
    }

    .session-item {
        padding: 6px 12px;
    }
    .session-title {
        font-size: 13px;
        max-width: none;
    }
    .session-time {
        font-size: 11px;
    }
    .session-delete {
        opacity: 0.4;
        bottom: 10px;
        top: auto;
        right: 10px;
    }

    .msg-user-wrap {
        max-width: 95%;
    }

    body {
        font-size: 15px;
    }
}

/* === Markdown 样式 === */
.markdown-content {
    line-height: 1.6;
    color: var(--text-main);
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
}

.markdown-content img {
    max-width: 100%;
    height: auto;
}

.markdown-content pre {
    max-width: 100%;
}

.markdown-content h1 {
    font-size: 1.6em;
    font-weight: 700;
    margin: 1em 0 0.5em;
    padding-bottom: 0.3em;
    border-bottom: 2px solid var(--primary-blue);
    color: #2c3e50;
}
.markdown-content h2 {
    font-size: 1.4em;
    font-weight: 600;
    margin: 0.8em 0 0.4em;
    padding-bottom: 0.2em;
    border-bottom: 1px solid #e1e4e8;
    color: #2c3e50;
}
.markdown-content h3 {
    font-size: 1.2em;
    font-weight: 600;
    margin: 0.6em 0 0.3em;
    color: #2c3e50;
}
.markdown-content h4, .markdown-content h5, .markdown-content h6 {
    font-size: 1em;
    font-weight: 600;
    margin: 0.5em 0 0.2em;
    color: #2c3e50;
}

.markdown-content p {
    margin: 0.5em 0;
}

.markdown-content a {
    color: var(--primary-blue-hover);
    text-decoration: none;
    border-bottom: 1px dashed var(--primary-blue);
}
.markdown-content a:hover {
    color: #4a90d9;
    border-bottom-style: solid;
}

.markdown-content blockquote {
    margin: 0.8em 0;
    padding: 0.5em 1em;
    border-left: 4px solid var(--primary-blue);
    background: #f8fafc;
    border-radius: 0 8px 8px 0;
    color: #666;
}
.markdown-content blockquote p {
    margin: 0.3em 0;
}

.markdown-content ul, .markdown-content ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
}
.markdown-content li {
    margin: 0.3em 0;
}
.markdown-content ul li {
    list-style-type: disc;
}
.markdown-content ol li {
    list-style-type: decimal;
}
.markdown-content ul ul, .markdown-content ol ol, .markdown-content ul ol, .markdown-content ol ul {
    margin: 0.2em 0;
}

.markdown-content table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    margin: 0.8em 0;
    font-size: 0.9em;
    overflow-x: auto;
    display: block;
}
.markdown-content thead {
    background: #f1f5f9;
}
.markdown-content th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    border: 1px solid #e2e8f0;
    color: #334155;
}
.markdown-content td {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
}
.markdown-content tr:nth-child(even) {
    background: #f8fafc;
}
.markdown-content tr:hover {
    background: #f1f5f9;
}

.markdown-content pre {
    background: #f8fafc;
    border-radius: 8px;
    padding: 16px;
    margin: 0.8em 0;
    overflow-x: auto;
    max-width: 100%;
    position: relative;
    border: 1px solid #e2e8f0;
}

/* SVG 图块（```svg 代码块渲染结果） */
.markdown-content .svg-diagram {
    margin: 12px 0;
    padding: 12px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow-x: auto;
    text-align: center;
    line-height: 0;
}
.markdown-content .svg-diagram svg {
    max-width: 100%;
    height: auto;
    display: inline-block;
    vertical-align: middle;
    line-height: normal;
}

/* 图块可点击提示 */
.markdown-content .svg-diagram svg {
    cursor: zoom-in;
}

/* === SVG 全屏预览浮层 === */
.svg-preview-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
}
.svg-preview-toolbar {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1001;
    display: flex;
    gap: 8px;
}
.svg-preview-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    font-size: 14px;
}
.svg-preview-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}
.svg-preview-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 90vw;
    height: 90vh;
    overflow: hidden;
}
.svg-preview-wrap {
    max-width: 100%;
    max-height: 100%;
    will-change: transform;
    user-select: none;
    -webkit-user-drag: none;
    cursor: grab;
    line-height: 0;
}
.svg-preview-wrap svg {
    max-width: 90vw;
    max-height: 80vh;
    height: auto;
    display: block;
}
.svg-preview-zoom {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 6px;
    font-family: monospace;
    z-index: 1001;
    pointer-events: none;
    user-select: none;
}
.markdown-content pre code {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.5;
    color: #1e293b;
    background: transparent;
    padding: 0;
}

.markdown-content code {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    background: #f1f5f9;
    color: #be185d;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

.markdown-content hr {
    border: none;
    border-top: 2px solid #e2e8f0;
    margin: 1.5em 0;
}

.markdown-content img {
    max-width: 100%;
    border-radius: 8px;
    margin: 0.5em 0;
}

.markdown-content input[type="checkbox"] {
    margin-right: 6px;
}

/* === KaTeX 公式渲染 === */
.markdown-content .katex-display {
    margin: 1em 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.2em 0;
}
.markdown-content .katex {
    font-size: 1.1em;
}
.markdown-content .katex-display > .katex {
    font-size: 1.2em;
}
/* KaTeX 错误/回退样式 */
.markdown-content .math-error {
    color: #e74c3c;
    background: #fef0f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}
.markdown-content .math-block-fallback {
    display: block;
    text-align: center;
    padding: 12px;
    background: #f1f5f9;
    border-radius: 8px;
    margin: 0.5em 0;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.95em;
    color: #334155;
}
.markdown-content .math-inline-fallback {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.9em;
    color: #334155;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
}

/* === 文件预览区域 === */
.file-preview-area {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 8px;
}
.file-preview-card {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}
.file-preview-card img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}
.file-preview-card .file-info {
    flex: 1;
}
.file-preview-card .file-name {
    font-size: 13px;
    color: #333;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.file-preview-card .file-size {
    font-size: 11px;
    color: #999;
}
.file-preview-card .remove-btn {
    width: 20px;
    height: 20px;
    border: none;
    background: #fee2e2;
    border-radius: 50%;
    cursor: pointer;
    color: #dc2626;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.file-preview-card .remove-btn:hover {
    background: #fecaca;
}
.input-area.drag-over {
    border: 2px dashed #3b82f6;
    background: #eff6ff;
}

/* 停止按钮 */
.stop-btn {
    width: var(--send-btn-size);
    height: var(--send-btn-size);
    border-radius: 50%;
    border: none;
    background: #ef4444;
    color: white;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.stop-btn:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

/* 命令菜单 */
.command-menu {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    margin-bottom: 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: var(--z-menu-dropdown);
}
.command-menu-header {
    padding: 12px 16px;
    font-size: 12px;
    color: #888;
    border-bottom: 1px solid #f0f0f0;
    font-weight: 600;
}
.command-menu-list {
    padding: 8px;
}
.command-item {
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}
.command-item:hover {
    background: #f5f7fa;
}
.command-name {
    font-weight: 500;
    color: #333;
}
.command-desc {
    display: block;
    font-size: 12px;
    color: #888;
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* === Question工具卡片样式 === */
.question-card {
    border: 1px solid #eef2f6;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    margin-top: 8px;
    max-width: 100%;
}

.question-card-header {
    padding: 12px 16px;
    background: linear-gradient(135deg, #f0f7ff 0%, #e8f4fd 100%);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #4a90d9;
}

.question-icon {
    color: #89CFF0;
    font-size: 16px;
}

.question-card-body {
    padding: 16px;
}

.question-block {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f4f8;
}

.question-block:last-of-type {
    margin-bottom: 12px;
    padding-bottom: 0;
    border-bottom: none;
}

.question-header {
    font-size: 12px;
    font-weight: 600;
    color: #888;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.question-text {
    font-size: 14px;
    color: #4a4a4a;
    margin-bottom: 12px;
    line-height: 1.5;
}

.question-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.question-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid #e1e8f0;
    background: #fafbfc;
    cursor: pointer;
    transition: all 0.2s ease;
}

.question-option:hover {
    background: #f0f7ff;
    border-color: #89CFF0;
}

.question-option:has(.question-input:checked) {
    background: #e8f4ff;
    border-color: #89CFF0;
}

.question-input {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: #89CFF0;
    cursor: pointer;
    flex-shrink: 0;
}

.question-input:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.option-content {
    flex: 1;
    min-width: 0;
}

.option-label {
    font-size: 14px;
    color: #4a4a4a;
    font-weight: 500;
}

.option-desc {
    display: block;
    font-size: 12px;
    color: #888;
    margin-top: 4px;
    line-height: 1.4;
}

.question-submit-btn {
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #89CFF0, #6db5f2);
    color: white;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(137, 207, 240, 0.3);
    margin-top: 12px;
}

.question-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(137, 207, 240, 0.4);
}

.question-submit-btn:disabled {
    background: #a8d8ff;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.question-submit-btn.submitted {
background: linear-gradient(135deg, #28a745, #34ce57);
}

.question-card.answered {
    opacity: 0.85;
    pointer-events: none;
}

.question-answer-display {
    margin-top: 12px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border-radius: 8px;
    font-size: 14px;
    color: #2e7d32;
    display: flex;
    align-items: center;
    gap: 8px;
}

.question-answer-display i {
    color: #4caf50;
}

@media (max-width: 768px) {
    .question-option {
        padding: 10px 12px;
    }
    .option-label {
        font-size: 13px;
    }
    .option-desc {
        font-size: 11px;
    }
}

/* === 开关按钮样式 === */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    display: inline-block;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #89CFF0;
}

/* === 快捷消息样式 === */
.quick-messages-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.quick-message-btn {
    padding: 6px 14px;
    border: 1px solid #e0e5ec;
    background: #f8fafc;
    border-radius: 16px;
    font-size: 12px;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.quick-message-btn:hover {
    background: #89CFF0;
    color: white;
    border-color: #89CFF0;
    transform: translateY(-1px);
}

.quick-message-config-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.qm-config-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.qm-config-name {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    min-width: 60px;
}

.qm-config-content {
    font-size: 12px;
    color: #64748b;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.qm-config-actions {
    display: flex;
    gap: 4px;
}

.qm-config-edit,
.qm-config-delete,
.qm-config-save,
.qm-config-cancel {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 12px;
    transition: all 0.2s ease;
}

.qm-config-edit:hover {
    background: #e0f2fe;
    color: #0ea5e9;
}

.qm-config-delete:hover {
    background: #fee2e2;
    color: #ef4444;
}

/* 分组配置列表（设置面板"分组"tab） */
.groups-config-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.groups-config-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.groups-config-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.groups-config-name {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.groups-config-count {
    font-size: 11px;
    color: #64748b;
    background: #eef2f7;
    padding: 1px 8px;
    border-radius: 8px;
    flex-shrink: 0;
}

.groups-config-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.groups-config-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 12px;
    transition: all 0.2s ease;
}

.groups-config-btn:hover {
    background: #e0f2fe;
    color: #0ea5e9;
}

.groups-config-btn.groups-config-danger:hover {
    background: #fee2e2;
    color: #ef4444;
}

.groups-add-form {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.groups-add-form .form-input {
    flex: 1;
}

.group-session-row:hover {
    background: #f1f5f9;
}

.qm-config-save:hover {
    background: #dcfce7;
    color: #22c55e;
}

.qm-config-cancel:hover {
    background: #f1f5f9;
    color: #64748b;
}

.qm-config-edit-mode {
    display: flex;
    gap: 8px;
    flex: 1;
}

.qm-config-edit-mode input {
    padding: 6px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 12px;
}

.qm-config-edit-mode input:first-child {
    width: 80px;
}

.qm-config-edit-mode input:last-child {
    flex: 1;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* === HTML预览占位符样式 === */
.preview-placeholder {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f0f7fc 0%, #e8f4fc 100%);
    border: 2px dashed var(--primary-blue);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 8px 0;
    max-width: 400px;
}

.preview-placeholder:hover {
    background: linear-gradient(135deg, #e0f0fc 0%, #d0e8fc 100%);
    border-style: solid;
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.preview-placeholder-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-blue);
    border-radius: 10px;
    color: white;
    font-size: 18px;
    flex-shrink: 0;
}

.preview-placeholder-text {
    flex: 1;
    min-width: 0;
}

.preview-placeholder-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 2px;
}

.preview-placeholder-id {
    font-size: 12px;
    color: var(--text-sub);
    font-family: monospace;
}

.preview-placeholder-action {
    color: var(--primary-blue);
    font-size: 14px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.preview-placeholder:hover .preview-placeholder-action {
    opacity: 1;
}

/* === 预览模态框样式 === */
.preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-global-loading);
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.preview-modal-content {
    position: relative;
    width: 90vw;
    height: 90vh;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.preview-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--card-border);
    background: linear-gradient(135deg, #f8fafc 0%, #f0f7fc 100%);
}

.preview-modal-header span {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-main);
}

.preview-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-sub);
    transition: all 0.2s;
}

.preview-modal-close:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

.preview-modal-body {
    flex: 1;
    overflow: hidden;
    padding: 0;
}

.preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

/* === 子会话面包屑 === */
.breadcrumb-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tooltip-status {
    font-size: 12px;
    color: var(--text-sub);
    margin-bottom: 4px;
}

.tooltip-tools {
    font-size: 11px;
    color: #64748b;
    margin-bottom: 4px;
}

.tooltip-message {
    font-size: 11px;
    color: #888;
    line-height: 1.4;
    max-height: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}


/* === 自动预览容器 === */
.preview-auto-container {
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius);
    overflow: hidden;
    margin: 8px 0;
    background: white;
    box-shadow: var(--shadow-sm);
    max-width: 100%;
}

.preview-auto-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: linear-gradient(135deg, #f8fafc 0%, #f0f7fc 100%);
    border-bottom: 1px solid var(--card-border);
}

.preview-auto-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-main);
}

.preview-fullscreen-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-sub);
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.preview-fullscreen-btn:hover {
    background: var(--primary-blue);
    color: white;
}

.preview-auto-body {
    position: relative;
    height: 200px;
    background: white;
}

.preview-auto-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: none;
}

.preview-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-sub);
    font-size: 14px;
    gap: 8px;
}

/* ============================================
   子智能体详情模态框样式
   ============================================ */

.agent-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal-overlay);
    padding: 20px;
}

.agent-modal-container {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 520px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.agent-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    gap: 12px;
}

.agent-modal-header i {
    font-size: 20px;
    color: var(--primary-blue);
}

.agent-modal-header span {
    flex: 1;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agent-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.agent-modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.agent-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.agent-modal-status {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 8px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.status-badge.running {
    background: #dbeafe;
    color: #2563eb;
}

.status-badge.completed {
    background: #d1fae5;
    color: #059669;
}

.status-badge.failed {
    background: #fee2e2;
    color: #dc2626;
}

.duration {
    font-size: 13px;
    color: #666;
}

.agent-modal-tools {
    margin-bottom: 16px;
}

.agent-modal-tools h4 {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0 0 12px 0;
}

.tool-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tool-item {
    padding: 10px 14px;
    background: #f8fafc;
    border-radius: 8px;
    font-size: 13px;
    color: #555;
    font-family: 'Consolas', 'Monaco', monospace;
}

.agent-modal-logs {
    margin-bottom: 16px;
}

.agent-modal-logs h4 {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0 0 12px 0;
}

.logs-content {
    max-height: 300px;
    overflow-y: auto;
    padding: 14px;
    background: #f8fafc;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.6;
    color: #444;
    max-width: 100%;
}

.logs-content pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.logs-content code {
    background: #e2e8f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

.agent-modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
}

.agent-modal-delete {
    padding: 8px 20px;
    background: #fee2e2;
    color: #dc2626;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.agent-modal-delete:hover {
    background: #fecaca;
}

@media (max-width: 768px) {
    .agent-modal-overlay {
        padding: 10px;
    }

    .agent-modal-container {
        max-height: 90vh;
    }

    .agent-modal-body {
        padding: 16px;
    }
}

/* ========== 智能体详情面板（浮动窗口样式） ========== */

/* 浮动详情面板 */
.agent-detail-panel {
    position: fixed;
    z-index: var(--z-panel-agent);
    width: 360px;
    height: 400px;
    min-width: 280px;
    min-height: 200px;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    pointer-events: none;
    will-change: opacity;
    backdrop-filter: blur(8px);
}

.agent-detail-panel.visible {
    pointer-events: auto;
    animation: agentFadeIn 0.25s ease-out forwards;
}
.agent-detail-panel.closing {
    pointer-events: none;
    animation: agentFadeOut 0.25s ease-out forwards;
}

@keyframes agentFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes agentFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* 面板拖拽时禁用过渡 */
.panel.dragging,
.agent-detail-panel.dragging,
.main-session-panel.dragging {
    transition: none !important;
}

.agent-detail-panel.z-top {
    z-index: var(--z-panel-top);
}

/* 面板标题栏 */
.agent-panel-header {
    height: 36px;
    padding: 0 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
    background: #fff;
    cursor: grab;
    user-select: none;
}

.agent-panel-header:active {
    cursor: grabbing;
}

.agent-panel-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.agent-panel-header-left i {
    font-size: 14px;
}

.agent-panel-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.agent-panel-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.agent-panel-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: all 0.2s;
}

.agent-panel-btn:hover {
    background: #f0f0f0;
    color: #333;
}

/* 面板内容区 */
.agent-panel-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 12px;
    gap: 8px;
}

/* 状态栏 */
.agent-panel-status {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #666;
}

/* 工具历史 */
.agent-panel-tools {
    flex-shrink: 0;
    border-top: 1px solid #e8e8e8;
    padding-top: 8px;
    margin-top: 0;
}

.agent-panel-tools h4 {
    font-size: 12px;
    font-weight: 500;
    color: #888;
    margin: 0 0 8px 0;
}

/* tool list and items */
.tool-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tool-item {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    background: #f0f0f0;
    font-size: 11px;
    color: #666;
    gap: 4px;
}

.tool-item.empty {
    width: 100%;
    background: transparent;
    color: #999;
    font-size: 12px;
    padding: 4px 0;
}

.tool-name {
    font-weight: 500;
    color: #555;
}

.tool-input {
    color: #999;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 日志区域 */
.agent-panel-logs {
    margin-bottom: 0;
}

.agent-panel-logs h4 {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0 0 12px 0;
}

/* 子会话消息区 */
.agent-panel-child-session {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    border-top: 1px solid #e8e8e8;
    padding-top: 8px;
    margin-top: 0;
}

.agent-panel-child-session h4 {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 500;
    color: #888;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.child-session-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    min-height: 0;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fafafa;
}

.child-session-load-btn {
    padding: 8px 16px;
    background: #f0f4f8;
    border: 1px solid #e1e8f0;
    border-radius: 8px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.child-session-load-btn:hover {
    background: #e1e8f0;
}

/* 消息记录列表 */
.agent-panel-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-top: 1px solid #e8e8e8;
    padding-top: 12px;
    margin-top: 4px;
}

.agent-panel-messages h4 {
    font-size: 12px;
    font-weight: 500;
    color: #888;
    margin: 0 0 8px 0;
}

.panel-message-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.panel-message-item {
    padding: 6px 8px 6px 10px;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 4px;
}

.panel-message-item:hover {
    filter: brightness(0.98);
}

.panel-message-item.empty {
    background: transparent !important;
    padding: 20px;
    text-align: center;
}

.panel-message-header {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
    font-size: 11px;
    color: #888;
}

.panel-message-icon {
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

.panel-message-label {
    font-weight: 500;
    color: #666;
    font-size: 11px;
}

.panel-message-time {
    margin-left: auto;
    font-size: 11px;
    color: #999;
}

.panel-message-body {
    color: #444;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.panel-message-body p {
    margin: 0 0 6px 0;
}

.panel-message-body p:last-child {
    margin-bottom: 0;
}

/* 加载中提示 */
.panel-loading {
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 13px;
}

.panel-loading i {
    margin-right: 6px;
}

/* 缩放手柄 */
.agent-panel-resize-handle {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 16px;
    height: 16px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 50%, rgba(0,0,0,0.12) 50%);
    border-radius: 0 0 12px 0;
    flex-shrink: 0;
}

/* 发送面板 */
.panel-send-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.3);
    z-index: var(--z-menu-dropdown);
    display: flex; align-items: center; justify-content: center;
}
.panel-send-box {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 320px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.panel-send-header {
    padding: 14px 16px;
    font-weight: bold;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
}
.panel-send-close {
    background: none; border: none; font-size: 18px; cursor: pointer; color: #999;
}
.panel-send-close:hover { color: #666; }
.panel-send-input {
    width: 100%;
    min-height: 80px;
    border: none;
    padding: 12px 16px;
    font-size: 14px;
    resize: vertical;
    box-sizing: border-box;
    outline: none;
    font-family: inherit;
}
.panel-send-footer {
    padding: 10px 16px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid #eee;
}
.panel-send-submit {
    background: var(--primary-blue, #89CFF0);
    color: #fff; border: none; padding: 8px 16px;
    border-radius: 8px; cursor: pointer; font-size: 13px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.panel-send-submit:hover {
    background: var(--primary-blue-hover, #75bce0);
}
.panel-send-cancel {
    background: #f0f0f0; border: none; padding: 8px 16px;
    border-radius: 8px; cursor: pointer; font-size: 13px; color: #666;
    transition: all 0.2s;
}
.panel-send-cancel:hover {
    background: #e0e0e0;
}

/* 面板标题栏耗时显示 */
.agent-panel-duration {
    font-size: 12px;
    color: #888;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 响应式适配 */
@media (max-width: 768px) {
    .agent-detail-panel {
        left: 4px !important;
        right: 4px !important;
        width: auto !important;
        height: 55vh !important;
        min-height: 280px;
        max-height: 80vh;
        top: auto !important;
        bottom: calc(56px + env(safe-area-inset-bottom, 0px) + 8px);
        border-radius: 16px 16px 0 0;
    }

    .agent-panel-body {
        padding: 10px;
    }

    .agent-panel-header {
        height: 40px;
        padding: 0 14px;
    }

    .agent-panel-resize-handle {
        width: 44px;
        height: 44px;
    }
}

/* 详情面板子会话消息间距 */
.agent-panel-child-session h4 {
    font-size: 13px;
    color: #888;
    margin-bottom: 8px;
    padding: 0 8px;
}
.child-session-content {
    padding: 0 8px 8px;
}

/* 主会话浮动面板 */
.main-session-panel {
    position: fixed;
    z-index: var(--z-panel-main);
    min-width: 300px;
    min-height: 250px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    pointer-events: none;
    transition: left 0.3s ease-out, top 0.3s ease-out, width 0.3s ease-out, height 0.3s ease-out, opacity 0.2s ease-out;
    will-change: left, top, width, height, opacity;
}

.main-session-panel.visible {
    pointer-events: auto;
}
.main-session-panel.closing {
    pointer-events: none;
    animation: mainPanelFadeOut 0.25s ease-out forwards;
}
@keyframes mainPanelFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* 消息列表容器 */
.main-session-panel-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    padding: 8px 0;
    /* 复用现有消息样式 */
}

.main-session-panel-messages .msg-ai-wrap,
.main-session-panel-messages .msg-user-wrap {
    padding: 4px 12px;
}

/* 输入区 */
.main-session-panel-input {
    flex-shrink: 0;
    padding: 8px 12px;
    border-top: 1px solid #e8e8e8;
    background: #fafafa;
}

.main-session-panel-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

/* 输入框 */
.main-session-panel-textarea {
    flex: 1;
    min-height: var(--input-height-sm);
    max-height: 120px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    font-size: 14px;
    line-height: 1.4;
    resize: none;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
}

.main-session-panel-textarea:focus {
    border-color: #89CFF0;
    box-shadow: 0 0 0 2px rgba(137, 207, 240, 0.2);
}

/* 发送按钮 */
.main-session-panel-send {
    width: var(--input-height-sm);
    height: var(--input-height-sm);
    border: none;
    border-radius: 8px;
    background: #89CFF0;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

.main-session-panel-send:hover {
    background: #6bb8e0;
}

.main-session-panel-send:active {
    background: #5aa8d0;
}

/* 手机端面板适配 */
@media (max-width: 768px) {
    .main-session-panel {
        left: 4px !important;
        right: 4px !important;
        width: auto !important;
        height: 55vh !important;
        min-height: 280px;
        bottom: calc(56px + env(safe-area-inset-bottom));
        top: auto !important;
    }
}

/* 主会话面板切换按钮 */
.detach-panel-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.2s, color 0.2s;
}

.detach-panel-btn:hover {
    background: #f0f0f0;
    color: #333;
}

@media (max-width: 768px) {
    .detach-panel-btn {
        display: none;
    }
}

.task-live-content .message-line {
    word-break: break-word;
}

.task-live-content .load-more-messages:hover {
    background: #2563eb !important;
}

/* === 消息入场动画 === */
.message-item {
    opacity: 0;
    will-change: transform, opacity;
}

.message-item.user-message {
    transform: translateX(20px);
    animation: slideInRight 0.25s ease-out forwards;
}

.message-item.ai-message {
    transform: translateX(-20px);
    animation: slideInLeft 0.25s ease-out forwards;
}

.message-item.no-animation {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
}

@keyframes slideInRight {
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInLeft {
    to { opacity: 1; transform: translateX(0); }
}

/* === 会话列表交错动画 === */
.session-item-enter {
    opacity: 0;
    transform: translateY(-10px);
    animation: fadeInDown 0.3s ease-out forwards;
}

@keyframes fadeInDown {
    to { opacity: 1; transform: translateY(0); }
}

/* === 按钮微交互动画 === */
.send-btn, button, .btn, [class*="btn"] {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.send-btn:hover, button:hover, .btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.send-btn:active, button:active, .btn:active {
    transform: scale(0.95);
}

/* === 输入框焦点发光 === */
input, textarea, select, .input-field {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(137, 207, 240, 0.3);
    outline: none;
}

/* === 开关弹性动画 === */
.toggle-slider .knob {
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.toggle-slider {
    transition: background 0.3s ease;
}

/* === 工具卡片展开动画 === */
.tool-card {
    transition: max-height 0.3s ease, box-shadow 0.2s ease;
     will-change: max-height;
}

/* ===== 骨架屏加载动画 ===== */
@keyframes skeletonShimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
    pointer-events: none;
    user-select: none;
}
.skeleton-avatar {
    width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
}
.skeleton-line {
    height: 14px; border-radius: 4px; margin-bottom: 8px;
}
.skeleton-line:last-child { width: 60%; }
.skeleton-line.short { width: 40%; }
.skeleton-line.long { width: 85%; }
.skeleton-message {
    display: flex; gap: 10px; padding: 12px 16px; align-items: flex-start;
}
.skeleton-message-body {
    flex: 1; display: flex; flex-direction: column;
}
.skeleton-agent-item {
    width: 40px; height: 40px; border-radius: 50%; margin: 6px auto; flex-shrink: 0;
}
.skeleton-agent-list {
    display: flex; flex-direction: column; align-items: center; padding: 12px 0;
}

/* === Session Group Tree View === */
.session-group {
    margin-bottom: 0;
}
.session-group-header {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    cursor: pointer;
    user-select: none;
    border-radius: 6px;
    transition: background var(--transition-fast);
    gap: 8px;
    position: relative;
}
.session-group-header:hover {
    background: var(--bg-tint);
}
.group-name {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.group-count {
    font-size: 11px;
    color: var(--text-sub);
    background: var(--bg-tint);
    padding: 1px 6px;
    border-radius: 8px;
    flex-shrink: 0;
}
.group-toggle {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform var(--transition-fast);
    color: var(--text-sub);
}
.group-toggle svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    transition: transform var(--transition-fast);
}
.group-toggle.collapsed svg {
    transform: rotate(-90deg);
}
.group-menu-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-sub);
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity var(--transition-fast), background var(--transition-fast);
}
.session-group-header:hover .group-menu-btn {
    opacity: 1;
}
.group-menu-btn:hover {
    opacity: 1;
    background: rgba(0,0,0,0.05);
}
.group-menu-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Group body (collapsible) */
.session-group-body {
    padding-left: 12px;
}
.session-group-body.collapsed {
    display: none;
}

/* Three-dot dropdown menu */
.group-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999;
    background: transparent;
}
.group-menu {
    position: fixed;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 4px 0;
    min-width: 140px;
    z-index: 1000;
    overflow: hidden;
}
.group-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-size: 13px;
    color: var(--text-main);
    cursor: pointer;
    transition: background var(--transition-fast);
    white-space: nowrap;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
}
.group-menu-item:hover {
    background: var(--bg-tint);
}
.group-menu-item.danger {
    color: #e74c3c;
}
.group-menu-item svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    flex-shrink: 0;
}

/* Color Picker */
.color-picker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.3);
}
.color-picker {
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.color-picker-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text-main);
    text-align: center;
}
.color-picker-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}
.color-swatch {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform var(--transition-fast), border-color var(--transition-fast);
    position: relative;
}
.color-swatch:hover {
    transform: scale(1.15);
}
.color-swatch.selected {
    border-color: #fff;
    box-shadow: 0 0 0 2px var(--primary-blue);
    transform: scale(1.1);
}
.color-swatch.selected::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fff;
}
/* Dark checkmark for light swatches */
.color-swatch.selected.dark-check::after {
    background: #333;
}

/* Default group label */
.default-group-label {
    padding: 4px 10px;
    font-size: 11px;
    color: var(--text-sub);
    font-weight: 500;
}

/* Drag clone */
.drag-clone {
    position: fixed;
    pointer-events: none;
    z-index: 10000;
    opacity: 0.85;
    transform: scale(0.95) rotate(-2deg);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    width: 240px;
    background: #fff;
    border-radius: 10px;
    padding: 10px 14px;
}
.drag-clone .session-title {
    font-size: 13px;
    font-weight: 600;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Drag tooltip */
.drag-tooltip {
    position: fixed;
    padding: 5px 12px;
    background: rgba(0,0,0,0.85);
    color: white;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    pointer-events: none;
    z-index: 10001;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    backdrop-filter: blur(4px);
}

/* Drop target highlighting */
.session-group-header.drop-target {
    background: #e3f2fd !important;
    border-radius: 8px;
}
.session-group-body.drop-target {
    background: rgba(137, 207, 240, 0.08);
    border-radius: 8px;
}
.session-item.drop-target {
    background: #e3f2fd !important;
    border: 1px dashed var(--primary-blue) !important;
    border-left: 3px solid var(--primary-blue) !important;
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(137, 207, 240, 0.3);
}
/* Hide the old drag-over style */
.session-item.dragging {
    opacity: 0.4;
    transform: scale(0.95);
}

/* 触控拖拽 - touch-action 不设置，让滚动正常工作 */

/* === prefers-reduced-motion 支持 === */
@media (prefers-reduced-motion: reduce) {
    .message-item,
    .session-item-enter,
    .send-btn, button, .btn, [class*="btn"],
    .tool-card,
    .session-item,
    input, textarea, select, .toggle-slider,
    .toggle-slider .knob,
    .ai-loading-shimmer,
    .typing-indicator span,
    .ai-loading .dot,
    .ai-thinking .dot,
    .ai-thinking .thinking-icon,
    .thought-block.thinking-loading,
    .dot-bounce, .bounce, .pulse {
        transition: none !important;
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
    .message-flow,
    .main-area,
    .main-session-panel,
    .agent-detail-panel,
    .panel,
    .modal-overlay {
        transition: none !important;
        animation: none !important;
        opacity: 1 !important;
    }
    .message-flow {
        opacity: 1 !important;
    }
    .main-session-panel,
    .agent-detail-panel {
        transform: none !important;
    }
}

/* ============ 虚拟会话文件夹 ============ */

/* Title bar folder button - matches .detach-panel-btn style */
.folder-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.2s, color 0.2s;
}
.folder-btn:hover {
    background: #f0f0f0;
    color: #333;
}

/* Folder panel - floating overlay panel */
.folder-panel {
    position: fixed;
    top: 60px;
    right: 20px;
    width: 360px;
    max-width: calc(100vw - 40px);
    max-height: min(60vh, 500px);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 90; /* between panel-main (80) and modal (1000) */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #eef2f6;
}

.folder-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #eef2f6;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    flex-shrink: 0;
}

.folder-close-btn,
.folder-panel-close {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #999;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.2s, color 0.2s;
}
.folder-close-btn:hover,
.folder-panel-close:hover {
    background: #f0f0f0;
    color: #333;
}

.folder-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    min-height: 100px;
}

/* Tree container */
.folder-tree {
    padding: 4px 0;
}

/* Tree node row - single line, children are siblings not nested */
.folder-node {
    display: flex;
    align-items: center;
    padding: 3px 12px;
    cursor: default;
    font-size: 13px;
    color: #333;
    transition: background 0.1s;
    white-space: nowrap;
    user-select: none;
    border-radius: 0;
}
.folder-node:hover {
    background: #f0f2f5;
}

/* Folder nodes are clickable for toggle */
.folder-node[data-type="folder"] {
    cursor: pointer;
}
.folder-node[data-type="folder"]:hover {
    background: #f0f2f5;
}

/* File nodes are clickable for preview */
.folder-node.file-node {
    cursor: pointer;
}
.folder-node.file-node:hover {
    background: #e8f0fe;
}

/* Node indentation based on depth */
.folder-node[data-depth="0"] { padding-left: 12px; }
.folder-node[data-depth="1"] { padding-left: 36px; }
.folder-node[data-depth="2"] { padding-left: 60px; }
.folder-node[data-depth="3"] { padding-left: 84px; }
.folder-node[data-depth="4"] { padding-left: 108px; }

/* Expand/collapse toggle for folders */
.folder-toggle {
    width: 14px;
    height: 14px;
    margin-right: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #888;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s;
    visibility: visible;
}
.folder-toggle.expanded {
    transform: rotate(90deg);
}

/* Node icon */
.folder-node-icon {
    width: 15px;
    margin-right: 6px;
    font-size: 13px;
    text-align: center;
    flex-shrink: 0;
}
.folder-node-icon.folder {
    color: #d4a017;
}
.folder-node-icon.file {
    color: #5a7e9e;
}

/* Node name */
.folder-node-name {
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
    line-height: 1.6;
}

/* File status indicator - missing file */
.folder-node-status {
    margin-left: 6px;
    font-size: 11px;
    color: #e74c3c;
    flex-shrink: 0;
}
.folder-node.file-missing .folder-node-name {
    color: #bbb;
}
.folder-node.file-missing .folder-node-icon.file {
    color: #ccc;
}

/* File node download button - show on hover */
.folder-download-btn {
    margin-left: 6px;
    font-size: 11px;
    color: #999;
    cursor: pointer;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.15s;
}
.folder-node:hover .folder-download-btn {
    display: flex;
}
.folder-download-btn:hover {
    color: var(--primary-blue);
    background: #e3edf7;
}

/* File node that no longer exists on disk - strikethrough */
.folder-node.file-missing {
    opacity: 0.65;
}
.folder-node.file-missing .folder-node-name {
    text-decoration: line-through;
    color: #999;
}
.folder-node.file-missing .folder-node-icon {
    opacity: 0.5;
}

/* Children container (for expand/collapse) - sibling of parent row */
.folder-children {
    overflow: hidden;
}
.folder-children.collapsed {
    display: none;
}

/* Empty state */
.folder-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #aaa;
    font-size: 13px;
}
.folder-empty i {
    font-size: 32px;
    margin-bottom: 12px;
    color: #ddd;
}

/* Loading state */
.folder-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #aaa;
    font-size: 13px;
}
.folder-loading i {
    margin-right: 8px;
    animation: fa-spin 1s linear infinite;
}

/* Error state */
.folder-error {
    padding: 20px;
    color: #e74c3c;
    font-size: 13px;
    text-align: center;
}

/* Mobile responsive: full-width folder panel */
@media (max-width: 820px) {
    .folder-panel {
        top: 0;
        right: 0;
        width: 100vw;
        max-width: 100vw;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
        border: none;
        z-index: 200;
    }
    .folder-panel-header {
        padding: 14px 16px;
        min-height: 50px;
    }
    .folder-panel-body {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .folder-node[data-depth="0"] { padding-left: 12px; }
    .folder-node[data-depth="1"] { padding-left: 32px; }
    .folder-node[data-depth="2"] { padding-left: 52px; }
    .folder-node[data-depth="3"] { padding-left: 72px; }
    .folder-node[data-depth="4"] { padding-left: 92px; }
    .folder-preview-modal {
        width: 100vw;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
    }
}

/* ============ 文件预览弹窗 ============ */

.folder-preview-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.folder-preview-overlay.visible {
    display: flex;
    animation: overlayFadeIn 0.2s ease-out;
}

.folder-preview-overlay.closing {
    display: flex;
    animation: overlayFadeOut 0.2s ease-out forwards;
}

.folder-preview-modal {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
    width: min(800px, calc(100vw - 40px));
    max-height: min(80vh, 600px);
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.25s ease;
}

.folder-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid #eef2f6;
    flex-shrink: 0;
}

.folder-preview-header .preview-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.folder-preview-header .preview-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-left: 12px;
}

.preview-download-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.2s, color 0.2s;
}
.preview-download-btn:hover {
    background: #f0f0f0;
    color: #333;
}

.preview-html-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #4a90d9;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.2s, color 0.2s;
}
.preview-html-btn:hover {
    background: #e8f0fe;
    color: #2b6cb0;
}

.preview-close-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #999;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.2s, color 0.2s;
}
.preview-close-btn:hover {
    background: #f0f0f0;
    color: #333;
}

.folder-preview-body {
    flex: 1;
    overflow: auto;
    padding: 0;
    min-height: 100px;
}

/* Code preview - for text/code files */
.folder-preview-body pre {
    margin: 0;
    padding: 16px 20px;
    font-size: 13px;
    line-height: 1.5;
    overflow-x: auto;
    background: #f8f9fa;
    border-radius: 0;
}
.folder-preview-body pre code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    background: transparent;
    padding: 0;
}

/* Markdown preview */
.folder-preview-markdown {
    padding: 20px 24px;
    font-size: 14px;
    line-height: 1.7;
    color: #333;
}
.folder-preview-markdown h1 { font-size: 22px; margin: 20px 0 10px; border-bottom: 1px solid #eee; padding-bottom: 6px; }
.folder-preview-markdown h2 { font-size: 18px; margin: 18px 0 8px; }
.folder-preview-markdown h3 { font-size: 16px; margin: 16px 0 6px; }
.folder-preview-markdown p { margin: 0 0 12px; }
.folder-preview-markdown ul, .folder-preview-markdown ol { margin: 0 0 12px; padding-left: 24px; }
.folder-preview-markdown li { margin-bottom: 4px; }
.folder-preview-markdown code { background: #f0f0f0; padding: 2px 6px; border-radius: 3px; font-size: 13px; }
.folder-preview-markdown pre { background: #f6f8fa; padding: 14px 16px; border-radius: 6px; overflow-x: auto; margin: 0 0 16px; }
.folder-preview-markdown pre code { background: none; padding: 0; }
.folder-preview-markdown blockquote { border-left: 4px solid #ddd; margin: 0 0 12px; padding: 4px 16px; color: #666; }
.folder-preview-markdown table { border-collapse: collapse; width: 100%; margin: 0 0 16px; }
.folder-preview-markdown th, .folder-preview-markdown td { border: 1px solid #ddd; padding: 6px 10px; font-size: 13px; }
.folder-preview-markdown th { background: #f6f8fa; font-weight: 600; }
.folder-preview-markdown img { max-width: 100%; }

/* Image preview */
.folder-preview-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    min-height: 200px;
}
.folder-preview-image-container img {
    max-width: 100%;
    max-height: 500px;
    object-fit: contain;
    border-radius: 4px;
}

/* Word/Docx preview */
.folder-preview-docx {
    padding: 20px;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
}
.folder-preview-docx p {
    margin: 0 0 12px;
}
.folder-preview-docx h1, 
.folder-preview-docx h2, 
.folder-preview-docx h3 {
    margin: 16px 0 8px;
    color: #222;
}
.folder-preview-docx table {
    border-collapse: collapse;
    width: 100%;
    margin: 12px 0;
}
.folder-preview-docx td, 
.folder-preview-docx th {
    border: 1px solid #ddd;
    padding: 6px 10px;
    font-size: 13px;
}
.folder-preview-docx img {
    max-width: 100%;
}

/* Preview loading/error states */
.folder-preview-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #aaa;
    font-size: 14px;
    gap: 12px;
}
.folder-preview-loading i {
    font-size: 28px;
}

.folder-preview-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #e74c3c;
    font-size: 14px;
    gap: 12px;
}
.folder-preview-error i {
    font-size: 28px;
}
.folder-preview-overlarge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

/* === 会话状态徽章 === */
.session-status-badge {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1.4;
}
.session-status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.session-status-badge.idle {
    display: inline-flex;
    color: #999;
}
.session-status-badge.idle::before {
    background: #bbb;
}
.session-status-badge.streaming {
    display: inline-flex;
    color: #2563eb;
    background: #eff6ff;
}
.session-status-badge.streaming::before {
    background: #2563eb;
    animation: pulse 1.5s ease-in-out infinite;
}
.session-status-badge.thinking {
    display: inline-flex;
    color: #d97706;
    background: #fffbeb;
}
.session-status-badge.thinking::before {
    background: #f59e0b;
    animation: pulse 1.5s ease-in-out infinite;
}
.session-status-badge.error {
    display: inline-flex;
    color: #dc2626;
    background: #fef2f2;
}
.session-status-badge.error::before {
    background: #ef4444;
}

/* === Todo 面板 === */
.todo-panel {
    position: absolute;
    right: 52px;
    top: 60px;
    width: 260px;
    max-height: 320px;
    background: #fff;
    border: 1px solid #eef2f6;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    z-index: 40;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: max-height 0.25s ease, box-shadow 0.25s ease;
}
.todo-panel.collapsed {
    max-height: 42px;
    box-shadow: none;
}
.todo-panel-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    border-bottom: 1px solid #f0f4f8;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
}
.todo-panel-header i.fa-tasks {
    color: #89CFF0;
    font-size: 13px;
}
.todo-panel-title {
    font-size: 13px;
    font-weight: 600;
    color: #4a4a4a;
    flex: 1;
}
.todo-panel-badge {
    font-size: 11px;
    color: #999;
    background: #f0f4f8;
    padding: 1px 7px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}
.todo-panel-toggle {
    border: none;
    background: transparent;
    color: #ccc;
    cursor: pointer;
    padding: 2px;
    font-size: 11px;
    transition: transform 0.2s;
}
.todo-panel.collapsed .todo-panel-toggle {
    transform: rotate(180deg);
}
.todo-panel-body {
    overflow-y: auto;
    flex: 1;
    padding: 4px 0;
}
.todo-panel.collapsed .todo-panel-body {
    display: none;
}

/* Todo 列表项 */
.todo-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 7px 14px;
    font-size: 12px;
    line-height: 1.4;
    color: #4a4a4a;
    transition: background 0.15s;
}
.todo-item:hover {
    background: #f8fafc;
}
.todo-item .todo-status-icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-top: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    color: #fff;
}
.todo-item .todo-status-icon.completed {
    background: #10b981;
}
.todo-item .todo-status-icon.in_progress {
    background: #2563eb;
    animation: pulse 1.5s ease-in-out infinite;
}
.todo-item .todo-status-icon.pending {
    background: #d1d5db;
}
.todo-item .todo-content {
    flex: 1;
    word-break: break-word;
}
.todo-item .todo-content.completed {
    text-decoration: line-through;
    color: #bbb;
}
.todo-item .todo-priority {
    flex-shrink: 0;
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: 500;
    margin-top: 1px;
}
.todo-item .todo-priority.high {
    background: #fee2e2;
    color: #dc2626;
}
.todo-item .todo-priority.medium {
    background: #fef3c7;
    color: #d97706;
}
.todo-item .todo-priority.low {
    background: #e0f2fe;
    color: #0284c7;
}
.todo-empty {
    padding: 20px;
    text-align: center;
    color: #ccc;
    font-size: 12px;
}

/* === 上下文压缩分隔线 === */
.compaction-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
    user-select: none;
}
.compaction-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, #d1d5db, transparent);
}
.compaction-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #9ca3af;
    white-space: nowrap;
    flex-shrink: 0;
}
.compaction-label i {
    font-size: 10px;
    color: #9ca3af;
}

/* === 加载更多消息 === */
.load-more-wrap {
    text-align: center;
    padding: 12px 0;
}
.load-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #89CFF0;
    cursor: pointer;
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid #dbeafe;
    background: #f8faff;
    transition: all 0.2s;
    user-select: none;
}
.load-more-btn:hover {
    background: #eff6ff;
    border-color: #89CFF0;
}
.load-more-btn i {
    font-size: 10px;
}
.load-more-indicator {
    font-size: 12px;
    color: #999;
    padding: 6px 0;
}
.load-more-indicator i {
    margin-right: 6px;
}

/* 响应式：移动端隐藏 todo 面板 */
@media (max-width: 768px) {
    .todo-panel {
        display: none !important;
    }
}

/* 响应式显示辅助 - 放在最后以确保覆盖其他样式 */
.desktop-only { display: revert; }
.mobile-only { display: none; }
@media (max-width: 768px) {
    .desktop-only { display: none !important; }
    .mobile-only { display: revert; }
}

/* ============ Mermaid 卡片操作按钮 ============ */
.mermaid-header-actions {
    margin-left: auto;
    display: flex;
    gap: 4px;
}
.mermaid-action-btn {
    background: none;
    border: 1px solid transparent;
    color: #888;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1;
    transition: all 0.15s;
}
.mermaid-action-btn:hover {
    color: #333;
    background: #f0f0f0;
    border-color: #ddd;
}

/* ============ Mermaid 放大面板 ============ */
/* Mermaid 渲染失败兜底样式 */
.mermaid-fallback {
    padding: 12px;
    font-size: 13px;
    line-height: 1.6;
}
.mermaid-fallback-section {
    font-weight: 600;
    color: #e2e8f0;
    padding: 6px 0 4px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin: 10px 0 4px;
    font-size: 13px;
}
.mermaid-fallback-section:first-child {
    margin-top: 0;
}
.mermaid-fallback-task {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    margin: 2px 0;
    border-radius: 4px;
    background: rgba(255,255,255,0.04);
}
.mermaid-fallback-task:hover {
    background: rgba(255,255,255,0.08);
}
.mermaid-fallback-task-name {
    color: #10b981;
    font-weight: 500;
}
.mermaid-fallback-task-date {
    color: #94a3b8;
    font-size: 12px;
}
.xml-fallback-content {
    white-space: pre-wrap;
    word-break: break-all;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 12px;
    color: #94a3b8;
    padding: 8px;
    margin: 0;
    background: transparent;
    border: none;
}

.mermaid-zoom-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transition: opacity 0.2s;
}
.mermaid-zoom-overlay.active {
    opacity: 1;
}
.mermaid-zoom-toolbar {
    background: #1e1e1e;
    color: #fff;
    display: flex;
    align-items: center;
    padding: 8px 16px;
    gap: 16px;
    user-select: none;
    flex-shrink: 0;
}
.mermaid-zoom-title {
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}
.mermaid-zoom-controls {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
}
.mermaid-zoom-btn {
    background: #333;
    border: 1px solid #555;
    color: #ccc;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1;
    transition: all 0.15s;
}
.mermaid-zoom-btn:hover {
    background: #444;
    color: #fff;
}
.mermaid-zoom-level {
    font-size: 13px;
    color: #aaa;
    min-width: 40px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.mermaid-zoom-viewport {
    flex: 1;
    overflow: hidden;
    position: relative;
    cursor: grab;
}
.mermaid-zoom-viewport:active {
    cursor: grabbing;
}
.mermaid-zoom-container {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    transition: none;
}

/* ============ 移动端优化（放在末尾确保优先级） ============ */
@media (max-width: 768px) {
    /* 分组缩进 - 覆盖 .session-group-body 全局规则 */
    .session-group-body {
        padding-left: 24px;
    }
}

/* ============ 子智能体列表面板 ============ */

.subsession-back-btn {
    width: 28px; height: 28px; border: none;
    border-radius: 6px; background: transparent;
    color: var(--text-sub); cursor: pointer;
    display: none; align-items: center; justify-content: center;
    font-size: 13px; transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}
.subsession-back-btn:hover {
    background: #f0f0f0; color: #333;
}

.subagent-breadcrumb {
    display: none; align-items: center; gap: 4px;
    font-size: 12px; color: #888;
    overflow: hidden; white-space: nowrap;
    margin-left: 4px; flex: 1; min-width: 0;
}
.subagent-breadcrumb .breadcrumb-item {
    cursor: pointer; padding: 2px 4px; border-radius: 4px;
    transition: background 0.15s; max-width: 120px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.subagent-breadcrumb .breadcrumb-item:hover {
    background: #f0f0f0; color: #333;
}
.subagent-breadcrumb .breadcrumb-item.current {
    color: var(--primary-blue); cursor: default;
}

.subagent-list-panel {
    position: fixed; top: 60px; right: 20px;
    width: 340px; max-width: calc(100vw - 40px);
    max-height: min(60vh, 500px);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 90; display: none; flex-direction: column;
    overflow: hidden;
    border: 1px solid #eef2f6;
}

.subagent-list-header {
    display: flex; justify-content: space-between;
    align-items: center; padding: 10px 14px;
    border-bottom: 1px solid #eef2f6;
    font-size: 13px; font-weight: 600; color: #333;
    flex-shrink: 0;
}
.subagent-list-header .subagent-list-close {
    width: 24px; height: 24px; border: none;
    border-radius: 4px; background: transparent;
    color: #aaa; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; transition: background 0.15s;
}
.subagent-list-header .subagent-list-close:hover {
    background: #f0f0f0; color: #555;
}

.subagent-list-body {
    flex: 1; overflow-y: auto; padding: 4px 0;
}

.subagent-list-empty {
    text-align: center; padding: 36px 16px;
    color: #bbb; font-size: 12px;
}
.subagent-list-empty i { font-size: 28px; display: block; margin-bottom: 8px; opacity: 0.4; }

.subagent-list-item {
    display: flex; align-items: center;
    padding: 8px 14px; cursor: pointer; gap: 10px;
    transition: background 0.12s;
}
.subagent-list-item:hover { background: #f5f8fa; }
.subagent-list-item:active { background: #edf2f6; }
.subagent-list-item.clickable { cursor: pointer; }
.subagent-list-item.clickable:hover { background: #f0f4f8; }

.subagent-list-item .agent-type-icon {
    width: 26px; height: 26px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; flex-shrink: 0;
    background: #f2f6fa;
}
.subagent-list-item .agent-item-name {
    flex: 1; font-size: 13px; color: #333; font-weight: 500;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

@media (max-width: 820px) {
    .subagent-list-panel {
        top: 0; right: 0; bottom: 0; left: 0;
        width: 100%; max-width: 100%; max-height: 100%;
        height: 100dvh;
        border-radius: 0; border: none;
        z-index: 200;
    }
    .subagent-list-item { padding: 12px 16px; min-height: 48px; }
    .subagent-list-item .agent-item-name { font-size: 14px; }
}

/* ========== 电路仿真弹窗 ========== */
.circuit-preview-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: #1a1a2e;
    display: flex;
    flex-direction: column;
    outline: none;
}
.circuit-preview-header {
    flex-shrink: 0;
    background: #16213e;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.circuit-preview-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    min-height: 44px;
}
.circuit-preview-title {
    color: #e0e0e0;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}
.circuit-preview-title i {
    color: #89CFF0;
    font-size: 16px;
}
.circuit-preview-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.circuit-preview-status {
    color: #aaa;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    white-space: nowrap;
}
.circuit-preview-status--loading {
    color: #89CFF0;
}
.circuit-preview-status--success {
    color: #66bb6a;
}
.circuit-preview-status--error {
    color: #ef5350;
    background: rgba(239, 83, 80, 0.1);
}
.circuit-preview-close {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: #ccc;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    font-size: 14px;
}
.circuit-preview-close:hover {
    background: rgba(239, 83, 80, 0.25);
    color: #ef5350;
}
.circuit-preview-body {
    flex: 1;
    position: relative;
    overflow: hidden;
}
.circuit-preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    background: #1a1a2e;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .circuit-preview-toolbar {
        padding: 8px 12px;
    }
    .circuit-preview-title {
        font-size: 14px;
    }
    .circuit-preview-status {
        font-size: 11px;
        padding: 2px 8px;
    }
    .circuit-preview-close {
        width: 36px;
        height: 36px;
    }
}

/* ========== 电路弹窗帮助按钮 ========== */
.circuit-preview-help {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: #ccc;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    font-size: 14px;
}
.circuit-preview-help:hover {
    background: rgba(137, 207, 240, 0.25);
    color: #89CFF0;
}

/* ========== 电路弹窗关闭确认层 ========== */
.circuit-preview-confirm {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
}
.circuit-preview-confirm-box {
    background: #16213e;
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
.circuit-preview-confirm-title {
    color: #e0e0e0;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.circuit-preview-confirm-title i {
    color: #ffd166;
}
.circuit-preview-confirm-text {
    color: #aaa;
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 20px;
}
.circuit-preview-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}
.circuit-preview-confirm-btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, opacity 0.15s;
}
.circuit-preview-confirm-btn--save {
    background: #66bb6a;
    color: #fff;
}
.circuit-preview-confirm-btn--save:hover {
    background: #57a85b;
}
.circuit-preview-confirm-btn--discard {
    background: rgba(239, 83, 80, 0.15);
    color: #ef5350;
}
.circuit-preview-confirm-btn--discard:hover {
    background: rgba(239, 83, 80, 0.3);
}
.circuit-preview-confirm-btn--cancel {
    background: transparent;
    color: #aaa;
    border: 1px solid rgba(255, 255, 255, 0.15);
}
.circuit-preview-confirm-btn--cancel:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #e0e0e0;
}

/* ========== 电路弹窗帮助面板 ========== */
.circuit-preview-help-panel {
    position: absolute;
    top: 56px;
    right: 16px;
    width: 100%;
    max-width: 480px;
    max-height: 70vh;
    overflow-y: auto;
    background: #16213e;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 1100;
}
.circuit-preview-help-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.circuit-preview-help-title {
    color: #e0e0e0;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
.circuit-preview-help-title i {
    color: #89CFF0;
}
.circuit-preview-help-close {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: #ccc;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    font-size: 13px;
}
.circuit-preview-help-close:hover {
    background: rgba(239, 83, 80, 0.25);
    color: #ef5350;
}
.circuit-preview-help-body {
    padding: 16px;
    line-height: 1.6;
    color: #e0e0e0;
    font-size: 13px;
}
.circuit-preview-help-body h4 {
    color: #89CFF0;
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.circuit-preview-help-body h4:not(:first-child) {
    margin-top: 14px;
}
.circuit-preview-help-body ul {
    margin: 0;
    padding-left: 18px;
}
.circuit-preview-help-body li {
    margin-bottom: 4px;
}

/* 电路弹窗确认框/帮助面板移动端适配 */
@media (max-width: 768px) {
    .circuit-preview-help {
        width: 36px;
        height: 36px;
    }
    .circuit-preview-confirm-box {
        width: 92%;
        padding: 20px 16px;
    }
    .circuit-preview-help-panel {
        width: 92%;
        right: 4%;
        max-height: 65vh;
    }
}

/* ========== 运维监控面板 v1 ========== */
/* 只读运维面板：入口按钮 / 面板 / 服务卡片 / 日志抽屉 / 配置弹窗。
   全部复用 :root 设计 token（--primary-blue、--border-radius、--shadow-* 系列、--card-border 等）。 */

/* ---- 侧边栏入口按钮 ---- */
.sidebar-header .btn-monitor {
    width: 100%;
    padding: 8px;
    border-radius: var(--border-radius);
    border: 1px solid #d9e8f2;
    background: #f4fafd;
    color: #3b7ea6;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.sidebar-header .btn-monitor:hover {
    background: #e9f5fb;
    border-color: #bcdcf2;
    color: #2f6690;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.sidebar-header .btn-monitor:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(137, 207, 240, 0.35);
}

/* ---- 遮罩与面板容器（桌面居中弹窗 / 移动端全屏） ---- */
body.monitor-lock { overflow: hidden; }

.monitor-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal-overlay);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background: rgba(43, 61, 79, 0.34);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}
.monitor-overlay.visible { animation: monitor-overlay-in 0.2s ease-out; }
.monitor-overlay.closing { animation: monitor-overlay-out 0.2s ease-out forwards; }
@keyframes monitor-overlay-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes monitor-overlay-out { from { opacity: 1; } to { opacity: 0; } }

.monitor-panel {
    width: min(1120px, 100%);
    height: min(88vh, 940px);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 24px 64px rgba(52, 73, 94, 0.28);
    overflow: hidden;
}
.monitor-panel:focus { outline: none; }
.monitor-overlay.visible .monitor-panel { animation: monitor-panel-in 0.24s cubic-bezier(0.34, 1.2, 0.64, 1); }
@keyframes monitor-panel-in {
    from { opacity: 0; transform: scale(0.97) translateY(8px); }
    to { opacity: 1; transform: none; }
}

/* ---- 面板头部 ---- */
.monitor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 22px 12px;
    flex-shrink: 0;
}
.monitor-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.monitor-title-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    color: #2f6690;
    background: linear-gradient(135deg, #eaf6fd, #d9edf9);
}
.monitor-title-text { font-size: 17px; font-weight: 700; color: #33414f; letter-spacing: 0.01em; }
.monitor-title-sub { font-size: 12px; color: #8a97a6; margin-top: 1px; }
.monitor-header-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.monitor-icon-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: #7b8794;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    font-family: inherit;
}
.monitor-icon-btn:hover { background: #f2f7fa; color: #3d4f60; }
.monitor-icon-btn:focus-visible {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(137, 207, 240, 0.35);
}
.monitor-icon-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.monitor-icon-btn.spinning i { animation: monitor-spin 0.9s linear infinite; }
@keyframes monitor-spin { to { transform: rotate(360deg); } }

/* ---- 分类开关（systemd / Docker 分段控件；Docker 分类下隐藏配置齿轮） ---- */
.monitor-cat-switch {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
    padding: 2px;
    background: #f7fafc;
    border: 1px solid var(--card-border);
    border-radius: 10px;
}
.monitor-cat-btn {
    padding: 5px 12px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #7b8794;
    font-size: 12.5px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.monitor-cat-btn:hover { color: #3d4f60; }
.monitor-cat-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(137, 207, 240, 0.35); }
.monitor-cat-btn.is-active { color: #fff; background: linear-gradient(135deg, var(--primary-blue), #6db5f2); }
.monitor-config-headrow-docker { grid-template-columns: 1.2fr 2.6fr 44px; min-width: 0; }
.monitor-config-row-docker { grid-template-columns: 1.2fr 2.6fr 44px; min-width: 0; }

/* ---- 头部统计条 ---- */
.monitor-stats {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 2px 22px 16px;
    border-bottom: 1px solid var(--card-border);
    flex-shrink: 0;
    flex-wrap: wrap;
}
.monitor-stat {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    background: #f8fbfd;
    border: 1px solid var(--card-border);
    border-radius: 999px;
    font-size: 12px;
    color: #6b7a89;
}
.monitor-stat i { font-size: 11px; color: #9db4c8; }
.monitor-stat-value { font-weight: 700; color: #33414f; font-variant-numeric: tabular-nums; }
.monitor-stat-label { letter-spacing: 0.02em; }
.monitor-stat-running i { color: #10b981; }
.monitor-stat-abnormal i { color: #c3ced8; }
.monitor-stat-abnormal.is-alert { background: #fff5f3; border-color: #ffd9d0; color: #b4553f; }
.monitor-stat-abnormal.is-alert i,
.monitor-stat-abnormal.is-alert .monitor-stat-value { color: #d9534f; }
.monitor-stats-error {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #c2410c;
}

/* ---- 卡片网格 ---- */
.monitor-body { flex: 1; min-height: 0; overflow-y: auto; }
.monitor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
    padding: 18px 22px 22px;
}

/* ---- 服务卡片 ---- */
.monitor-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px 16px 13px;
    background: #fff;
    border: 1px solid var(--card-border);
    border-left: 3px solid transparent; /* 为失败态预留，避免布局跳动 */
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.monitor-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.monitor-card.is-failed {
    border-color: #f3c6c0;
    border-left-color: #ef4444;
    background: linear-gradient(180deg, rgba(254, 242, 242, 0.75), #fff 52%);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.1);
}
.monitor-card.is-unknown { background: linear-gradient(180deg, rgba(246, 249, 251, 0.9), #fff 52%); }
.monitor-card-enter { animation: monitor-card-in 0.32s cubic-bezier(0.22, 0.61, 0.36, 1) backwards; }
@keyframes monitor-card-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

.monitor-card-head { display: flex; align-items: flex-start; gap: 10px; }
.monitor-card-head .status-dot { margin-top: 5px; }
.monitor-card-namewrap { flex: 1; min-width: 0; }
.monitor-card-name {
    font-size: 15px;
    font-weight: 700;
    color: #33414f;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.monitor-card-unit {
    display: inline-block;
    margin-top: 3px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
    font-size: 11px;
    color: #7b8a99;
    background: #f4f8fb;
    border: 1px solid #e8eff5;
    border-radius: 6px;
    padding: 1px 6px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.monitor-restart-badge {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    color: #c2410c;
    background: #fff3e8;
    border: 1px solid #ffe2c7;
    border-radius: 999px;
    padding: 3px 9px;
    white-space: nowrap;
}

/* ---- 状态点扩展（沿用 .status-dot 基础类） ---- */
.status-dot.monitor-dot-running {
    background: #10b981;
    animation: monitor-dot-pulse 2.2s ease-out infinite;
}
.status-dot.monitor-dot-failed {
    background: #ef4444;
    animation: monitor-dot-pulse-red 1.4s ease-out infinite;
}
.status-dot.monitor-dot-exited { background: #3b82f6; box-shadow: 0 0 6px rgba(59, 130, 246, 0.35); }
.status-dot.monitor-dot-inactive { background: #cfd9e2; box-shadow: none; }
.status-dot.monitor-dot-pending { background: #f59e0b; animation: pulse 1.5s ease-in-out infinite; }
.status-dot.monitor-dot-unknown { background: #cfd9e2; box-shadow: none; }
@keyframes monitor-dot-pulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
    70% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
@keyframes monitor-dot-pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
    70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* ---- 第二行：SubState + UnitFileState ---- */
.monitor-card-subrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.monitor-substate { font-size: 12px; color: #6b7a89; }
.monitor-pill {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.03em;
    padding: 2px 8px;
    border-radius: 999px;
    background: #f1f4f7;
    color: #7b8794;
    border: 1px solid #e3e9ef;
}
.monitor-pill-enabled { background: #e7f7ef; color: #0f7b54; border-color: #cdeee0; }
.monitor-pill-disabled { background: #f1f4f7; color: #7b8794; border-color: #e3e9ef; }
.monitor-pill-static { background: #eaf4fd; color: #2472b3; border-color: #d4e8fa; }

/* ---- 指标行 ---- */
.monitor-metrics { display: flex; flex-wrap: wrap; gap: 6px; }
.monitor-metric {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 4px 9px;
    background: #f7fafc;
    border: 1px solid #eef3f7;
    border-radius: 8px;
}
.monitor-metric-label { font-size: 10.5px; color: #93a1af; letter-spacing: 0.02em; }
.monitor-metric-value { font-size: 12px; font-weight: 600; color: #405060; font-variant-numeric: tabular-nums; }
.monitor-metric-empty { font-size: 12px; color: #b3bfca; }

/* ---- 卡片操作行 ---- */
.monitor-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px dashed #eef2f6;
}
.monitor-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 11px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    color: #54718a;
    background: #fff;
    border: 1px solid #dbe7f1;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s;
}
.monitor-action i { font-size: 11px; }
.monitor-action:hover:not(:disabled) {
    background: var(--bg-tint);
    border-color: #bcdcf2;
    color: #2f6690;
    transform: translateY(-1px);
}
.monitor-action:active:not(:disabled) { transform: translateY(0); }
.monitor-action:focus-visible {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(137, 207, 240, 0.35);
}
.monitor-action:disabled { opacity: 0.45; cursor: not-allowed; }
/* 服务操作语义变体：危险(停止/失败重启)红系、正向(启动)绿系，沿用白底浅边基调 */
.monitor-action.is-danger { color: #c62828; border-color: #f2d3d3; }
.monitor-action.is-danger:hover:not(:disabled) { background: #fdf5f5; border-color: #e7b1b1; color: #b3201f; }
.monitor-action.is-danger:focus-visible { border-color: #e08585; box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.22); }
.monitor-action.is-success { color: #2e7d32; border-color: #d3e6d5; }
.monitor-action.is-success:hover:not(:disabled) { background: #f5faf5; border-color: #b1d5b4; color: #276b2b; }
.monitor-action.is-success:focus-visible { border-color: #85c289; box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.22); }

/* ---- 加载 / 错误 / 空态 ---- */
.monitor-state {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 56px 20px;
    min-height: 300px;
}
.monitor-state-card {
    text-align: center;
    max-width: 400px;
    padding: 30px 34px;
    background: #fff;
    border: 1px dashed #d8e5ef;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.monitor-state-icon { font-size: 30px; color: #9db4c8; }
.monitor-state-icon.is-error { color: #e08d7f; }
.monitor-state-title { font-size: 14px; font-weight: 700; color: #33414f; }
.monitor-state-desc { font-size: 12.5px; color: #8a97a6; line-height: 1.6; }

/* ---- 通用按钮 ---- */
.monitor-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    color: #54718a;
    background: #fff;
    border: 1px solid #dbe7f1;
    border-radius: 9px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.monitor-btn:hover:not(:disabled) { background: var(--bg-tint); border-color: #bcdcf2; color: #2f6690; }
.monitor-btn:focus-visible {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(137, 207, 240, 0.35);
}
.monitor-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.monitor-btn.monitor-btn-primary {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, var(--primary-blue), #6db5f2);
    box-shadow: var(--shadow-sm);
}
.monitor-btn.monitor-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-blue-hover), #5aa8ea);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* ---- 日志抽屉 ---- */
.monitor-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-modal-overlay) + 2);
    display: none;
    background: rgba(43, 61, 79, 0.28);
    opacity: 0;
    transition: opacity 0.25s ease;
}
.monitor-drawer-backdrop.visible { opacity: 1; }
/* 日志改为居中面板（大号模态），不再右侧滑出 */
.monitor-drawer {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: calc(var(--z-modal-overlay) + 3);
    width: min(1400px, calc(100vw - 24px));
    height: min(92vh, 1150px);
    display: none;
    flex-direction: column;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(52, 73, 94, 0.28);
    transform: translate(-50%, -50%) scale(0.97);
    opacity: 0;
    transition: transform 0.22s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.22s ease;
    will-change: transform, opacity;
}
.monitor-drawer.visible { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.monitor-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--card-border);
    flex-shrink: 0;
}
.monitor-drawer-title-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; }
.monitor-drawer-titles { min-width: 0; }
.monitor-drawer-title {
    font-size: 14px;
    font-weight: 700;
    color: #33414f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.monitor-drawer-sub {
    font-size: 11.5px;
    color: #8a97a6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.monitor-drawer-actions { display: flex; gap: 4px; flex-shrink: 0; }
.monitor-drawer-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 7px 16px;
    background: #f8fbfd;
    border-bottom: 1px solid var(--card-border);
    font-size: 12px;
    color: #6b7a89;
    flex-shrink: 0;
}
.monitor-drawer-conn { display: inline-flex; align-items: center; gap: 6px; color: #8a97a6; }
.monitor-drawer-conn.is-live { color: #0f7b54; }
.monitor-drawer-conn.is-reconnecting { color: #c2410c; }
.monitor-conn-dot { width: 8px; height: 8px; border-radius: 50%; background: #c3ced8; flex-shrink: 0; }
.monitor-drawer-conn.is-live .monitor-conn-dot { background: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15); }
.monitor-drawer-conn.is-reconnecting .monitor-conn-dot { background: #f59e0b; animation: pulse 1.2s ease-in-out infinite; }
.monitor-drawer-count { font-variant-numeric: tabular-nums; }
.monitor-follow { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.monitor-follow-label { font-size: 12px; color: #5a6b7b; }

.monitor-drawer-hint {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 7px 16px;
    background: #fff7ed;
    color: #b45309;
    font-size: 12px;
    border-bottom: 1px solid #ffe8cc;
    flex-shrink: 0;
}
.monitor-drawer-hint.show { display: flex; }
.monitor-btn-link {
    padding: 2px 4px;
    border: none;
    background: none;
    color: #2472b3;
    font-size: 12px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    border-radius: 6px;
}
.monitor-btn-link:hover { text-decoration: underline; }
.monitor-btn-link:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(137, 207, 240, 0.35); }

.monitor-drawer-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    background: #10161d;
    padding: 8px 0 12px;
    font-family: 'JetBrains Mono', 'Cascadia Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', 'Courier New', monospace;
    font-variant-ligatures: none;
    font-size: 12.5px;
    line-height: 1.55;
    -webkit-overflow-scrolling: touch;
}
/* 终端区所有列强制等宽继承，中文回落系统无衬线是预期行为 */
.monitor-log-line, .monitor-log-time, .monitor-log-ident, .monitor-log-level, .monitor-log-msg { font-family: inherit; }
/* 终端式行：时刻 | 进程[pid] | 级别标签 | 正文（flex 列，隐藏字段由 body data-* 控制自动回流） */
.monitor-log-line {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 1px 14px 1px 11px;
}
.monitor-log-time { color: #7d8b99; flex-shrink: 0; user-select: none; font-variant-numeric: tabular-nums; }
.monitor-log-ident {
    color: #6ec6b4;
    flex-shrink: 0;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.monitor-log-level { flex-shrink: 0; min-width: 28px; text-align: right; font-weight: 700; font-size: 10px; letter-spacing: .3px; user-select: none; }
/* 自适应：info 行级别标签为空 → 整列连同其 gap 一起消失，ident 与正文紧邻 */
.monitor-log-level:empty { display: none; min-width: 0; }
.monitor-log-msg { flex: 1; min-width: 0; color: #d5dbe0; word-break: break-word; overflow-wrap: anywhere; white-space: pre-wrap; }
.monitor-drawer-body[data-wrap="0"] .monitor-log-msg { white-space: pre; word-break: normal; overflow-wrap: normal; }
/* 关闭换行时整行不折行，容器横向滚动看长行 */
.monitor-drawer-body[data-wrap="0"] { overflow-x: auto; }
.monitor-drawer-body[data-wrap="0"] .monitor-log-line { min-width: max-content; }
.monitor-drawer-body[data-time="0"] .monitor-log-time { display: none; }
.monitor-drawer-body[data-ident="0"] .monitor-log-ident { display: none; }
.monitor-drawer-body[data-level="0"] .monitor-log-level { display: none; }
/* 字段开关 chips */
.monitor-view-chips { display: inline-flex; gap: 6px; margin-left: 4px; }
.monitor-chip {
    border: 1px solid var(--card-border);
    background: #fff;
    color: #8a97a6;
    font-size: 11px;
    line-height: 1;
    padding: 5px 9px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.monitor-chip:hover { border-color: #b9dcf7; }
.monitor-chip.is-on { background: #eaf4fd; border-color: #9ccdf0; color: #1f6aa5; }
.monitor-chip:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(137, 207, 240, 0.5); }
/* 级别配色（深底高对比）：crit 红 / warn 琥珀 / debug 暗淡 / info 默认 */
.monitor-log-line[data-level="crit"] .monitor-log-msg { color: #ff7b72; }
.monitor-log-line[data-level="crit"] .monitor-log-level { color: #ff7b72; }
.monitor-log-line[data-level="warn"] .monitor-log-msg { color: #e3b341; }
.monitor-log-line[data-level="warn"] .monitor-log-level { color: #e3b341; }
.monitor-log-line[data-level="debug"] .monitor-log-msg,
.monitor-log-line[data-level="debug"] .monitor-log-time,
.monitor-log-line[data-level="debug"] .monitor-log-ident { color: #5b6a78; }
.monitor-log-truncated {
    text-align: center;
    font-size: 11px;
    color: #6b7a88;
    padding: 6px;
    margin-bottom: 4px;
    border-bottom: 1px dashed #2a3644;
    background: #161f28;
}
.monitor-log-notice { padding: 18px 16px; text-align: center; font-size: 12px; color: #748494; }
.monitor-log-path {
    color: #7cc7ff;
    background: rgba(124, 199, 255, 0.10);
    border: 1px solid rgba(124, 199, 255, 0.28);
    border-radius: 6px;
    padding: 0 4px;
    margin: 0 1px;
    text-decoration: none;
    transition: background 0.12s, border-color 0.12s;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}
.monitor-log-path:hover { background: rgba(124, 199, 255, 0.2); border-color: rgba(124, 199, 255, 0.45); text-decoration: underline; }
.monitor-log-path:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(137, 207, 240, 0.5); }

/* ---- 配置编辑弹窗 ---- */
.monitor-config-overlay {
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-modal-overlay) + 6);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(43, 61, 79, 0.36);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.18s ease;
}
.monitor-config-overlay.visible { opacity: 1; }
.monitor-config-modal {
    width: min(960px, 100%);
    max-height: min(84vh, 760px);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 24px 64px rgba(52, 73, 94, 0.3);
    overflow: hidden;
    animation: fadeIn 0.22s ease;
}
.monitor-config-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--card-border);
    flex-shrink: 0;
}
.monitor-config-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: #33414f; }
.monitor-config-title i { color: var(--primary-blue); }
.monitor-config-body { flex: 1; min-height: 160px; overflow: auto; padding: 0 20px 12px; }
.monitor-config-loading { padding: 36px 0; text-align: center; font-size: 13px; color: #8a97a6; }
.monitor-config-loading.is-error { color: #c2410c; }
.monitor-config-headrow,
.monitor-config-row {
    display: grid;
    grid-template-columns: 1.1fr 1.35fr 1.4fr 1.4fr 56px 74px 40px;
    gap: 10px;
    align-items: center;
    min-width: 880px;
}
.monitor-config-headrow {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #fff;
    padding: 10px 0 6px;
    font-size: 11px;
    font-weight: 700;
    color: #8a97a6;
    letter-spacing: 0.04em;
}
.monitor-config-row { padding: 5px 0; border-top: 1px dashed #eef2f6; }
.monitor-config-input {
    width: 100%;
    min-width: 0;
    padding: 7px 10px;
    font-size: 12.5px;
    font-family: inherit;
    color: #2c3e50;
    background: #f8fafc;
    border: 1px solid #e1e8f0;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.monitor-config-input:focus {
    border-color: var(--primary-blue);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(137, 207, 240, 0.22);
}
.monitor-config-unit,
.monitor-config-order { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.monitor-config-unit { color: #3d5a73; }
.monitor-config-order { text-align: center; }
.monitor-config-enabled,
.monitor-config-del { justify-self: center; }
.monitor-config-hint { grid-column: 1 / -1; display: none; font-size: 11px; color: #d9534f; margin-top: -2px; }
.monitor-config-row.unit-invalid .monitor-config-hint { display: block; }
.monitor-config-row.unit-invalid .monitor-config-unit { border-color: #ef4444; background: #fff5f5; }
.monitor-config-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 20px;
    border-top: 1px solid var(--card-border);
    flex-shrink: 0;
    flex-wrap: wrap;
}
.monitor-config-note { font-size: 12px; color: #8a97a6; }
.monitor-config-footer-btns { display: flex; gap: 8px; }

/* ---- 服务操作确认对话框 ---- */
.monitor-confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-modal-overlay) + 8);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(43, 61, 79, 0.36);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.18s ease;
}
.monitor-confirm-overlay.visible { opacity: 1; }
.monitor-confirm-modal {
    width: min(400px, 100%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px 20px 14px;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 24px 64px rgba(52, 73, 94, 0.3);
    animation: fadeIn 0.22s ease;
}
.monitor-confirm-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: #33414f; }
.monitor-confirm-title i { color: #e08d7f; }
.monitor-confirm-text { font-size: 13px; line-height: 1.6; color: #5a6b7b; }
.monitor-confirm-text b { color: #33414f; }
.monitor-confirm-input {
    width: 100%;
    min-width: 0;
    padding: 8px 11px;
    font-size: 13px;
    font-family: inherit;
    color: #2c3e50;
    background: #f8fafc;
    border: 1px solid #e1e8f0;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.monitor-confirm-input:focus {
    border-color: var(--primary-blue);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(137, 207, 240, 0.22);
}
.monitor-confirm-input:disabled { opacity: 0.6; }
.monitor-confirm-input.is-error { border-color: #ef4444; background: #fff5f5; }
.monitor-confirm-error { display: none; font-size: 12px; color: #c62828; margin-top: -6px; }
.monitor-confirm-error.show { display: block; }
.monitor-confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 2px; }

/* ---- 轻量提示 ---- */
.monitor-toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: calc(var(--z-modal-overlay) + 20);
    padding: 10px 20px;
    background: rgba(30, 41, 59, 0.88);
    color: #fff;
    font-size: 13px;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.25);
    pointer-events: none;
    animation: monitor-toast-in 2.2s ease forwards;
}
@keyframes monitor-toast-in {
    0% { opacity: 0; transform: translate(-50%, -6px); }
    8% { opacity: 1; transform: translate(-50%, 0); }
    85% { opacity: 1; transform: translate(-50%, 0); }
    100% { opacity: 0; transform: translate(-50%, -4px); }
}

/* ---- 移动端适配 ---- */
@media (max-width: 768px) {
    .sidebar-header .btn-monitor { padding: 6px 8px; font-size: 12px; border-radius: 6px; }
    .monitor-overlay {
        padding: 0;
        align-items: stretch;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    .monitor-panel {
        width: 100vw;
        height: 100dvh;
        max-height: none;
        border-radius: 0;
        box-shadow: none;
    }
    .monitor-header { padding: 12px 14px 10px; }
    .monitor-title-icon { width: 34px; height: 34px; border-radius: 10px; font-size: 15px; }
    .monitor-title-text { font-size: 16px; }
    .monitor-title-sub { display: none; }
    .monitor-stats { padding: 2px 14px 12px; gap: 8px; }
    .monitor-grid { grid-template-columns: 1fr; padding: 14px; gap: 12px; }
    .monitor-state { min-height: 260px; padding: 40px 16px; }
    .monitor-drawer {
        width: 100vw;
        max-width: 100vw;
        height: 100dvh;
        border-radius: 0;
        box-shadow: none;
        transform: translate(-50%, -50%) scale(0.98);
    }
    .monitor-config-overlay { padding: 0; align-items: flex-end; }
    .monitor-config-modal { width: 100vw; max-height: 92dvh; border-radius: 18px 18px 0 0; }
    .monitor-config-body { padding: 0 14px 10px; }
    .monitor-config-footer { padding: 10px 14px; }
    .monitor-config-footer-btns { flex: 1; }
    .monitor-config-footer-btns .monitor-btn { flex: 1; justify-content: center; }
    .monitor-confirm-overlay { padding: 0; align-items: flex-end; }
    .monitor-confirm-modal { width: 100vw; border-radius: 18px 18px 0 0; padding: 16px 16px 12px; }
    .monitor-confirm-actions .monitor-btn { flex: 1; justify-content: center; }
    /* 移动端终端行：进程列让位隐藏，时刻+级别+正文照排 */
    .monitor-log-line { gap: 8px; padding: 2px 12px; }
    .monitor-log-ident { display: none; }
}

/* ---- 减少动态效果 ---- */
@media (prefers-reduced-motion: reduce) {
    .monitor-overlay,
    .monitor-overlay *,
    .monitor-drawer,
    .monitor-drawer *,
    .monitor-config-overlay,
    .monitor-config-overlay *,
    .monitor-confirm-overlay,
    .monitor-confirm-overlay * {
        animation-duration: 0.001s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001s !important;
    }
    .status-dot.monitor-dot-running,
    .status-dot.monitor-dot-failed,
    .status-dot.monitor-dot-pending,
    .monitor-icon-btn.spinning i { animation: none !important; }
}

/* ========== 服务器指标面板 ========== */
/* 双区布局: Zone A 白底硬件档案卡（复用 monitor 设计 token 与 .monitor-header/.monitor-icon-btn 皮肤），
   Zone B 六块独立深色数据面曲线窗（#10161d 沿用终端面）。uPlot 轴/线颜色为内联值，本区只管布局与覆盖层。 */

.metrics-overlay {
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-modal-overlay) + 4);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(43, 61, 79, 0.36);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.18s ease;
}
.metrics-overlay.visible { opacity: 1; }
.metrics-overlay.closing { opacity: 0; }

.metrics-modal {
    width: min(1120px, 94vw);
    height: min(88vh, 940px);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 24px 64px rgba(52, 73, 94, 0.3);
    overflow: hidden;
    animation: metrics-modal-in 0.22s cubic-bezier(0.34, 1.2, 0.64, 1);
}
.metrics-modal:focus { outline: none; }
@keyframes metrics-modal-in {
    from { opacity: 0; transform: scale(0.97) translateY(8px); }
    to { opacity: 1; transform: none; }
}
.metrics-header { border-bottom: 1px solid var(--card-border); }

/* ---- 连接状态 pill ---- */
.metrics-conn-wrap { margin-left: auto; }
.metrics-conn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border: 1px solid var(--card-border);
    border-radius: 999px;
    background: #f8fbfd;
    font-size: 12px;
    color: #8a97a6;
    font-variant-numeric: tabular-nums;
}
.metrics-conn-dot { width: 8px; height: 8px; border-radius: 50%; background: #c3ced8; flex-shrink: 0; }
.metrics-conn.is-live { color: #0f7b54; border-color: #cdeee0; }
.metrics-conn.is-live .metrics-conn-dot { background: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15); }
.metrics-conn.is-reconnecting { color: #c2410c; border-color: #ffe2c7; }
.metrics-conn.is-reconnecting .metrics-conn-dot { background: #f59e0b; animation: pulse 1.2s ease-in-out infinite; }
.metrics-conn.is-offline { color: #b4553f; border-color: #ffd9d0; background: #fff5f3; }
.metrics-conn.is-offline .metrics-conn-dot { background: #d9534f; }

/* ---- 面板体: 灰底渐变衬托白卡，两区呼吸感分离 ---- */
.metrics-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 18px 22px 26px;
    background: linear-gradient(180deg, #fbfdfe, #f5f8fb 40%);
}

/* ---- 分区标签（图标 + 大写感小字 + 渐隐分隔线） ---- */
.metrics-zone-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #64748b;
}
.metrics-zone-label i { font-size: 12px; color: #9db4c8; }
.metrics-zone-rule { flex: 1; height: 1px; background: linear-gradient(90deg, #dbe7f1, transparent); }
.metrics-hw-ts { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace; font-size: 11px; color: #93a1af; font-variant-numeric: tabular-nums; }

/* ---- Zone A 状态（加载骨架 / 错误卡） ---- */
.metrics-hw-state {
    display: none;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}
.metrics-skeleton {
    height: 132px;
    border-radius: var(--border-radius);
    border: 1px solid var(--card-border);
    background: linear-gradient(100deg, #f4f8fb 40%, #e8f0f6 50%, #f4f8fb 60%);
    background-size: 200% 100%;
    animation: metrics-shimmer 1.3s linear infinite;
}
@keyframes metrics-shimmer { to { background-position: -200% 0; } }
.metrics-state-card { text-align: center; padding: 26px 16px; background: #fff; border: 1px solid var(--card-border); border-radius: var(--border-radius); }
.metrics-state-icon { font-size: 26px; color: #e08d7f; }
.metrics-state-title { margin-top: 8px; font-size: 14px; font-weight: 700; color: #33414f; }
.metrics-state-desc { margin-top: 4px; font-size: 12.5px; color: #8a97a6; line-height: 1.6; }
.metrics-state-retry { margin-top: 10px; }

/* ---- Zone A 档案卡网格 ---- */
.metrics-hw-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}
.metrics-hw-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 15px 12px;
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    min-width: 0;
}
.metrics-hw-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.metrics-hw-head { display: flex; align-items: center; gap: 8px; }
.metrics-hw-icon {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #2f6690;
    background: linear-gradient(135deg, #eaf6fd, #d9edf9);
    border-radius: 8px;
}
.metrics-hw-title { font-size: 14px; font-weight: 700; color: #33414f; }
.metrics-hw-sub { margin-left: auto; font-size: 10.5px; color: #8a97a6; background: #f1f4f7; border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.metrics-hw-model { font-size: 12.5px; color: #405060; line-height: 1.45; word-break: break-word; overflow-wrap: anywhere; }
.metrics-kv-row { display: flex; flex-wrap: wrap; gap: 6px; }
.metrics-kv { display: inline-flex; align-items: baseline; gap: 5px; padding: 3px 8px; background: #f7fafc; border: 1px solid #eef3f7; border-radius: 8px; }
.metrics-kv-label { font-size: 10.5px; color: #93a1af; }
.metrics-kv-value { font-size: 12px; font-weight: 600; color: #405060; font-variant-numeric: tabular-nums; }
.metrics-live-line {
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px dashed #eef2f6;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
    font-size: 11.5px;
    color: #6b7a89;
    font-variant-numeric: tabular-nums;
}

/* ---- 磁盘分区行与用量条 ---- */
.metrics-disk-name { font-weight: 600; }
.metrics-part { display: flex; flex-direction: column; gap: 5px; padding: 7px 0 3px; border-top: 1px solid #f2f6f9; }
.metrics-part-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.metrics-mount {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
    font-size: 11px;
    color: #1f6aa5;
    background: #eaf4fd;
    border: 1px solid #d4e8fa;
    border-radius: 6px;
    padding: 1px 7px;
}
.metrics-fs { font-size: 10.5px; color: #7b8794; background: #f1f4f7; border-radius: 6px; padding: 1px 6px; }
.metrics-part-txt { margin-left: auto; font-size: 11px; color: #6b7a89; font-variant-numeric: tabular-nums; }
.metrics-bar { height: 6px; border-radius: 999px; background: #eef3f7; overflow: hidden; }
.metrics-bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #9ccdf0, #7cc7ff); transition: width 0.3s ease; }
.metrics-bar-fill.is-alert { background: linear-gradient(90deg, #e08d7f, #d9534f); }

/* ---- 网卡行 ---- */
.metrics-nic { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 12px; min-width: 0; }
.metrics-nic-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.metrics-nic-dot.is-up { background: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12); }
.metrics-nic-dot.is-down { background: #cfd9e2; }
.metrics-nic-dot.is-other { background: #f59e0b; }
.metrics-nic-name { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace; color: #405060; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.metrics-nic-speed { margin-left: auto; color: #6b7a89; font-variant-numeric: tabular-nums; white-space: nowrap; }
.metrics-nic-state { font-size: 10.5px; color: #93a1af; white-space: nowrap; }

/* ---- Zone B 错误条 ---- */
.metrics-zone-err {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding: 8px 12px;
    background: #fff5f3;
    border: 1px solid #ffd9d0;
    border-radius: 10px;
    font-size: 12px;
    color: #b4553f;
}
.metrics-zone-err[hidden] { display: none; }
.metrics-zone-err i { color: #d9534f; }
.metrics-zone-err .monitor-btn { margin-left: auto; padding: 3px 10px; font-size: 11.5px; }

/* ---- 六窗曲线网格（桌面双列） ---- */
.metrics-charts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.metrics-chart-card {
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding: 12px 14px 13px;
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    min-width: 0;
}
.metrics-chart-head { display: flex; align-items: flex-start; gap: 10px; }
.metrics-chart-titles { min-width: 0; }
.metrics-chart-title { font-size: 13px; font-weight: 700; color: #33414f; }
.metrics-chart-caption { margin-top: 3px; font-size: 11px; color: #8a97a6; font-variant-numeric: tabular-nums; }
.metrics-chart-caption:empty { display: none; }
.metrics-chips { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.metrics-chip {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    padding: 2px 8px;
    border: 1px solid var(--card-border);
    border-radius: 999px;
    background: #f8fbfd;
    font-size: 10.5px;
    color: #8a97a6;
}
.metrics-chip-value { font-weight: 700; color: #405060; font-variant-numeric: tabular-nums; }
.metrics-now-wrap { margin-left: auto; display: flex; align-items: baseline; gap: 4px; flex-shrink: 0; }
.metrics-now { font-size: 20px; font-weight: 800; color: #2c3e50; font-variant-numeric: tabular-nums; line-height: 1.1; letter-spacing: -0.01em; }
.metrics-unit { font-size: 11px; font-weight: 700; color: #93a1af; }

/* ---- 深色数据面与 uPlot 覆盖层（light-on-dark） ---- */
.metrics-chart { position: relative; height: 140px; background: #10161d; border-radius: 10px; overflow: hidden; }
.metrics-chart .uplot { position: relative; font-family: 'JetBrains Mono', 'Cascadia Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace; }
.metrics-chart .u-legend {
    position: absolute;
    top: 4px;
    right: 8px;
    left: auto;
    margin: 0;
    padding: 0 6px;
    text-align: right;
    font-size: 11px;
    color: #93a1af;
    background: rgba(16, 22, 29, 0.4);
    border-radius: 6px;
    z-index: 2;
}
/* 隐藏 uPlot 图例首行（Time 值行）：该行同样带 u-series 类，label:false 在 1.6 不生效，实测须按首行裁 */
.metrics-chart .u-legend tr:first-child { display: none; }
.metrics-chart .u-legend th { font-weight: 600; }
.metrics-chart .u-legend .u-value { margin-left: 4px; color: #d5dbe0; font-weight: 700; font-variant-numeric: tabular-nums; }
.metrics-chart .u-legend .u-marker { width: 0.65em; height: 0.65em; border-radius: 2px; }

/* ---- 移动端适配 ---- */
@media (max-width: 768px) {
    .metrics-overlay { padding: 0; backdrop-filter: none; -webkit-backdrop-filter: none; }
    .metrics-modal { width: 100vw; height: 100dvh; max-height: none; border-radius: 0; box-shadow: none; }
    .metrics-header { border-bottom: 1px solid var(--card-border); }
    .metrics-conn-wrap { margin-left: 0; }
    .metrics-body { padding: 14px; gap: 18px; }
    .metrics-hw-grid { grid-template-columns: 1fr; }
    .metrics-hw-state { grid-template-columns: 1fr; }
    .metrics-charts-grid { grid-template-columns: 1fr; }
    .metrics-now { font-size: 18px; }
    .metrics-chip { padding: 1px 6px; }
}

/* ---- 减少动态效果 ---- */
@media (prefers-reduced-motion: reduce) {
    .metrics-overlay,
    .metrics-overlay * {
        animation-duration: 0.001s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001s !important;
    }
    .metrics-modal { animation: none; }
    .metrics-skeleton { animation: none; }
    .metrics-conn.is-reconnecting .metrics-conn-dot { animation: none; }
}

/* ========== 会话项目化 v1 ========== */
/* 项目栏：纵向列排（收件箱/全部/各/新建/已归档 各占一行），位于会话列表上方 */
.proj-pill-bar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 8px 12px 4px;
    max-height: 38vh;
    overflow-y: auto;
    flex-shrink: 0;
}
.proj-pill-bar::-webkit-scrollbar { width: 4px; }
.proj-pill-bar::-webkit-scrollbar-thumb { background: #d5e2ec; border-radius: 4px; }
.proj-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    width: 100%;
    text-align: left;
    padding: 7px 10px;
    border: 1px solid var(--card-border);
    border-radius: 999px;
    background: #fff;
    color: #5a6b7b;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
    max-width: 176px; /* 容纳 dot+name+count+三点（原 160px 加三点后名称区过窄；侧栏可用宽 256px 富余） */
}
.proj-pill:hover { border-color: #b9dcf7; background: #f6fbfe; }
.proj-pill:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(137, 207, 240, 0.5); }
.proj-pill.active {
    background: var(--bg-tint);
    border-color: var(--primary-blue);
    color: #1f6aa5;
}
.proj-pill-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #c3ced8;
}
.proj-pill-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.proj-pill-count {
    margin-left: auto;
    font-size: 10.5px;
    font-weight: 700;
    color: #8a97a6;
    background: #f0f4f8;
    border-radius: 999px;
    padding: 1px 6px;
    font-variant-numeric: tabular-nums;
}
.proj-pill.active .proj-pill-count { background: #dceefc; color: #1f6aa5; }
/* pill 内三点按钮：打开项目面板（皮肤参考 .proj-ws-btn，显隐参考 .session-delete 的 hover-reveal；
   桌面常态低透明、pill hover 提亮，≤768px 必须常显——0 透明度的按钮触屏摸不到） */
.proj-pill-menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    font-size: 11px;
    line-height: 1;
    color: #8a97a6;
    opacity: 0.4;
    cursor: pointer;
    transition: opacity 0.12s, background 0.12s, color 0.12s;
}
.proj-pill:hover .proj-pill-menu, .proj-pill:focus-visible .proj-pill-menu { opacity: 1; }
.proj-pill-menu:hover { background: #eaf4fd; color: #1f6aa5; }
.proj-pill.active .proj-pill-menu { color: #1f6aa5; }
.proj-pill-add { justify-content: flex-start; color: #8a97a6; }
.proj-pill-add:hover { color: #1f6aa5; }
.proj-pill-add i { width: 9px; text-align: center; }
.proj-pill-archived, .proj-pill-back {
    background: transparent;
    border-style: dashed;
    color: #9aa8b6;
    font-weight: 500;
}
.proj-pill-empty { font-size: 12px; color: #9aa8b6; padding: 5px 8px; }
.proj-pill.drop-target {
    border-color: var(--primary-blue);
    border-style: dashed;
    background: #eaf4fd;
    box-shadow: 0 0 0 2px rgba(137, 207, 240, 0.35);
}
/* 会话项上的项目归属小徽标（仅"全部"视图） */
.session-project-badge {
    flex-shrink: 1;
    min-width: 0;
    max-width: 84px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10px;
    font-weight: 600;
    color: #6b7a89;
    background: #f0f4f8;
    border-radius: 6px;
    padding: 1px 6px;
    margin-right: 6px;
}
/* 归属项目对话框 */
.proj-dialog-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(43, 61, 79, 0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.proj-dialog-box {
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    padding: 20px;
    min-width: 300px;
    max-width: 380px;
}
.proj-dialog-title { font-size: 14px; font-weight: 700; color: #33414f; margin-bottom: 4px; }
.proj-dialog-sub {
    font-size: 12px;
    color: #8a97a6;
    margin-bottom: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.proj-dialog-list {
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 4px;
    max-height: 260px;
    overflow-y: auto;
}
.proj-dialog-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #33414f;
}
.proj-dialog-item:hover { background: #f6fbfe; }
.proj-dialog-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-dialog-btns { display: flex; gap: 8px; margin-top: 12px; justify-content: flex-end; }
@media (max-width: 768px) {
    .proj-pill-bar { padding: 6px 10px 2px; max-height: 30vh; }
    .proj-pill { font-size: 12px; padding: 6px 9px; }
    /* 触屏三点必须常显且略放大命中区（hover-reveal 在触屏上永远不会触发） */
    .proj-pill-menu { opacity: 0.65; width: 22px; height: 22px; font-size: 12px; }
}
/* ---- 项目工作区 overlay（Form C） ---- */
.proj-ws-lock { overflow: hidden !important; }
.proj-ws-overlay {
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-modal-overlay) + 1);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background: rgba(43, 61, 79, 0.34);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}
.proj-ws-overlay.visible { animation: proj-ws-in 0.2s ease-out; }
.proj-ws-overlay.closing { animation: proj-ws-out 0.2s ease-out forwards; }
@keyframes proj-ws-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes proj-ws-out { from { opacity: 1; } to { opacity: 0; } }
.proj-ws-panel {
    width: min(920px, 100%);
    height: min(84vh, 880px);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 24px 64px rgba(52, 73, 94, 0.28);
    overflow: hidden;
}
.proj-ws-panel:focus { outline: none; }
.proj-ws-overlay.visible .proj-ws-panel { animation: proj-ws-panel-in 0.24s cubic-bezier(0.34, 1.2, 0.64, 1); }
@keyframes proj-ws-panel-in {
    from { opacity: 0; transform: scale(0.97) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.proj-ws-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 22px 12px;
    flex-shrink: 0;
}
.proj-ws-title-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; }
.proj-ws-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; background: #c3ced8; }
.proj-ws-title {
    font-size: 18px;
    font-weight: 700;
    color: #33414f;
    cursor: text;
    border-bottom: 1px dashed transparent;
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.proj-ws-title:hover { border-bottom-color: #b9dcf7; }
.proj-ws-sub { font-size: 11.5px; color: #9aa8b6; flex-shrink: 0; }
.proj-ws-actions { display: flex; gap: 6px; flex-shrink: 0; }
.proj-ws-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--card-border);
    background: #fff;
    color: #5a6b7b;
    font-size: 12.5px;
    font-weight: 600;
    padding: 7px 12px;
    border-radius: 9px;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.proj-ws-btn:hover { border-color: #b9dcf7; background: #f6fbfe; color: #1f6aa5; }
.proj-ws-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(137, 207, 240, 0.5); }
.proj-ws-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.proj-ws-btn:disabled:hover { border-color: var(--card-border); background: #fff; color: #5a6b7b; }
.proj-ws-delete { color: #c04a4a; }
.proj-ws-delete:hover { border-color: #f3b6b6; background: #fdf4f4; color: #b91c1c; }
.proj-ws-codir-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 22px 12px;
    padding: 8px 12px;
    background: #f8fbfd;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    flex-shrink: 0;
    min-width: 0;
}
.proj-ws-codir-row > i { color: #8a97a6; font-size: 12px; flex-shrink: 0; }
.proj-ws-codir {
    flex: 1;
    min-width: 0;
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    color: #3d5a73;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.proj-ws-codir.is-empty { color: #a5b1bd; font-style: italic; }
.proj-ws-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 4px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.proj-ws-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-align: left;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 10px;
    padding: 11px 12px;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}
.proj-ws-row:hover { background: #f6fbfe; border-color: #dceefc; }
.proj-ws-row:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(137, 207, 240, 0.5); }
.proj-ws-row.active { background: var(--bg-tint); border-color: var(--primary-blue); }
.proj-ws-row-title {
    flex: 1;
    min-width: 0;
    font-size: 13.5px;
    font-weight: 600;
    color: #33414f;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.proj-ws-row-time { font-size: 11.5px; color: #9aa8b6; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.proj-ws-empty {
    margin: 24px auto;
    padding: 36px 28px;
    border: 1.5px dashed #c9d8e4;
    border-radius: 14px;
    text-align: center;
    color: #8a97a6;
    font-size: 13.5px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}
.proj-ws-empty i { font-size: 26px; color: #c3d3df; }
.proj-ws-empty-hint { font-size: 12px; color: #a5b1bd; }
.proj-ws-footer {
    padding: 12px 22px 18px;
    border-top: 1px solid var(--card-border);
    flex-shrink: 0;
}
.proj-ws-footer .proj-ws-new { width: 100%; justify-content: center; }
.proj-ws-rename-input, .proj-ws-codir-input {
    font-size: 14px;
    padding: 6px 10px;
    border: 1px solid var(--primary-blue);
    border-radius: 8px;
    outline: none;
    min-width: 0;
}
.proj-ws-rename-input { font-weight: 700; color: #33414f; width: 240px; }
.proj-ws-codir-input {
    flex: 1;
    min-width: 0;
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
}
@media (max-width: 768px) {
    .proj-ws-overlay { padding: 0; align-items: stretch; backdrop-filter: none; -webkit-backdrop-filter: none; }
    .proj-ws-panel { width: 100vw; height: 100dvh; max-height: none; border-radius: 0; }
    .proj-ws-header { padding: 14px 16px 10px; flex-wrap: wrap; }
    .proj-ws-title { max-width: 180px; }
    .proj-ws-sub { display: none; }
    .proj-ws-codir-row { margin: 0 16px 10px; }
    .proj-ws-body { padding: 2px 10px 10px; }
    .proj-ws-footer { padding: 10px 16px 14px; }
}
@media (prefers-reduced-motion: reduce) {
    .proj-ws-overlay, .proj-ws-overlay * { animation: none !important; transition: none !important; }
}

@media (prefers-reduced-motion: reduce) {
    .proj-pill, .proj-pill-bar * { transition: none !important; }
}
