﻿/* === 变量与全局设置 === */
: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;

    /* ===== 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); }
    }
}

/* 文字选中样式 */
::selection { background: rgba(137, 207, 240, 0.3); color: inherit; }
::-moz-selection { background: rgba(137, 207, 240, 0.3); color: inherit; }

/* 滚动条美化 */
::-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: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
}
.session-item {
    padding: 12px 14px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    border: 1px solid transparent;
}
.session-item:hover { background: #f8fbff; border-color: #e6f0f9; }
.session-item.active { background: #eff7fc; border-color: var(--primary-blue); }

.session-header { width: 100%; display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; gap: 4px; }
.session-title { font-size: 14px; font-weight: bold; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; min-width: 0; flex-shrink: 1; }
.session-time { font-size: 11px; color: #a0aab5; }
.session-preview { font-size: 12px; color: var(--text-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; }

.session-delete {
    position: absolute; right: 10px; bottom: 10px; background: none; border: none;
    color: #ff9999; cursor: pointer; opacity: 0; transition: var(--transition-fast); font-size: 14px;
}
.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-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    scroll-behavior: smooth;
    position: relative;
    opacity: 0;
    transition: opacity 0.3s ease-in;
}
.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;
    gap: 24px;
    box-sizing: border-box;
    min-width: 0;
}
.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%; }

/* 思考区块 */
.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;
}

/* 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;
    max-width: 100%;
}
.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); }
.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;
}

/* 设置操作按钮 */
.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) {
    html, body {
        overflow-x: hidden;
        width: 100%;
    }

    .main-area {
        width: 100%;
        flex: none;
    }

    .message-content {
        overflow-x: hidden;
    }

    .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;
    }
    .message-header-path-row {
        padding: 0 12px 6px;
    }
    .message-content {
        padding: 8px 8px;
    }

    .input-area {
        padding: 10px 12px;
    }

    .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;
    }

    .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: 10px 14px;
    }
    /* 移动端更紧凑的侧边栏头部 */
    .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: 4px;
    }

    .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-preview {
        display: none;
    }
    .session-item {
        padding: 10px 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;
}
.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;
}

/* === 文件预览区域 === */
.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;
}

.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;
}

/* === 子会话面包屑 === */
    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;
}

/* === 会话项悬停高亮 === */
.session-item {
    transition: background 0.2s ease, border-color 0.2s ease;
}

.session-item:hover {
    background: var(--bg-tint);
    border-left: 3px solid var(--primary-blue);
}

/* ===== 骨架屏加载动画 ===== */
@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: 2px;
}
.session-group-header {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    user-select: none;
    border-radius: 8px;
    transition: background var(--transition-fast);
    gap: 8px;
    position: relative;
}
.session-group-header:hover {
    background: var(--bg-tint);
}
.group-color-bar {
    width: 4px;
    height: 20px;
    border-radius: 2px;
    flex-shrink: 0;
}
.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: 6px 12px;
    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-clone .session-preview {
    font-size: 11px;
    color: var(--text-sub);
    margin-top: 4px;
    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%;
        border-radius: 0; border: none;
    }
    .subagent-list-item { padding: 12px 16px; min-height: 48px; }
    .subagent-list-item .agent-item-name { font-size: 14px; }
}

