/* =========================================================
   大目湾海洋低空试验场 - AI智能体工作台 全局样式
   设计语言：深空玻璃态 + 海青蓝主调 + 珊瑚橙对话高亮
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ---------- 设计令牌 ---------- */
:root {
    /* 基底色 */
    --bg-base: #070B16;
    --bg-deep: #0F172A;
    --bg-elev: #131C33;
    --bg-elev-2: #1A2440;

    /* 主强调色 */
    --primary: #3DD9F5;           /* 海青蓝 */
    --primary-dark: #0EA5C4;
    --primary-light: #7BE8F8;
    --primary-glow: rgba(61, 217, 245, 0.35);

    /* 功能色 */
    --accent: #FF7B5A;            /* 珊瑚橙 - 对话高亮 */
    --accent-glow: rgba(255, 123, 90, 0.3);
    --success: #10E5A8;           /* 翡翠绿 */
    --warning: #FFC857;           /* 暖琥珀 */
    --danger: #FF5A7B;            /* 玫红 */
    --purple: #8B5CF6;

    /* 文本 */
    --text-primary: #FFFFFF;
    --text-secondary: #E8EDF7;
    --text-muted: #C8D2E5;
    --text-on-primary: #051428;

    /* 玻璃态 */
    --glass-bg: rgba(26, 36, 64, 0.55);
    --glass-bg-strong: rgba(26, 36, 64, 0.78);
    --glass-border: rgba(125, 145, 195, 0.18);
    --glass-border-strong: rgba(125, 145, 195, 0.32);
    --glass-blur: 18px;

    /* 边框/阴影 */
    --border: rgba(125, 145, 195, 0.14);
    --border-strong: rgba(125, 145, 195, 0.28);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.45);
    --shadow-glow: 0 0 24px var(--primary-glow);

    /* 圆角 */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-pill: 999px;

    /* 字体 */
    --font-sans: 'Noto Sans SC', 'HarmonyOS Sans SC', 'Microsoft YaHei', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;
}

/* ---------- 重置 ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-sans);
    color: var(--text-primary);
    background: var(--bg-base);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
}

/* 背景氛围：深空渐变 + 网格光点 */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 20% 10%, rgba(61, 217, 245, 0.12), transparent 60%),
        radial-gradient(ellipse 70% 50% at 90% 90%, rgba(255, 123, 90, 0.10), transparent 60%),
        radial-gradient(ellipse 60% 40% at 50% 100%, rgba(139, 92, 246, 0.10), transparent 60%),
        linear-gradient(180deg, #070B16 0%, #0A1124 100%);
    z-index: -2;
    pointer-events: none;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(125, 145, 195, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(125, 145, 195, 0.04) 1px, transparent 1px);
    background-size: 48px 48px;
    z-index: -1;
    pointer-events: none;
    mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, black 40%, transparent 100%);
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(125, 145, 195, 0.22); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(125, 145, 195, 0.4); }

/* =========================================================
   应用容器
   ========================================================= */
.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* ---------- 顶部全局栏 ---------- */
.topbar {
    height: 60px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 0 20px 0 16px;
    background: var(--glass-bg-strong);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-bottom: 1px solid var(--glass-border);
    z-index: 50;
}

.topbar .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 220px;
}

.brand-logo {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary) 0%, #1E88E5 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-on-primary);
    font-size: 18px;
    box-shadow: 0 0 18px var(--primary-glow);
    flex-shrink: 0;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-title {
    font-size: 15px;
    font-weight: 700;
    background: linear-gradient(90deg, #fff, var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.brand-sub { font-size: 11px; color: var(--text-secondary); letter-spacing: 0.5px; }

.topbar .topbar-search {
    flex: 1;
    max-width: 420px;
    position: relative;
}
.topbar-search input {
    width: 100%;
    height: 38px;
    padding: 0 14px 0 38px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.topbar-search input::placeholder { color: var(--text-muted); }
.topbar-search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.topbar-search .ico {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.ai-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 10px;
    background: rgba(16, 229, 168, 0.10);
    border: 1px solid rgba(16, 229, 168, 0.3);
    border-radius: var(--radius-pill);
    font-size: 12px;
    color: var(--success);
}
.ai-status .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
    position: relative;
}
.icon-btn:hover { color: var(--text-primary); border-color: var(--primary); background: rgba(61, 217, 245, 0.08); }
.icon-btn .badge {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 6px var(--accent);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 12px 4px 4px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-pill);
    transition: border-color 0.2s;
}
.user-chip:hover { border-color: var(--primary); }
.user-chip .avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--success));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-on-primary);
    font-weight: 700;
    font-size: 13px;
}
.user-chip .uname { font-size: 13px; font-weight: 500; }

/* =========================================================
   四栏主布局：新建会话 | 对话框（主体）| 模块面板（可收起）| 智能体工具条
   ========================================================= */
.layout {
    flex: 1;
    display: grid;
    grid-template-columns: 200px 1fr 0 48px;
    gap: 8px;
    padding: 8px;
    min-height: 0;
    transition: grid-template-columns 0.3s ease;
}

/* 展开模块面板时，最多占屏幕 1/4 */
.layout.module-open {
    grid-template-columns: 200px 1fr minmax(320px, 25vw) 48px;
}

/* 场景模块展开时面板更宽 */
.layout.module-open.module-scene-wide {
    grid-template-columns: 200px 1fr minmax(400px, 35vw) 48px;
}

/* 全屏模式：模块面板固定覆盖全屏 */
.layout.module-fullscreen .module-panel {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 9999;
    border-radius: 0;
    border: none;
    opacity: 1 !important;
    visibility: visible !important;
    width: 100vw;
    height: 100vh;
}
/* 全屏模式：卡片一行五个 */
.layout.module-fullscreen .card-list {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

/* =========================================================
   左侧 - 新建会话侧边栏（参考 KIMI 风格）
   ========================================================= */
.sidebar {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.new-chat-btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 10px 14px;
    margin: 8px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-on-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(61, 217, 245, 0.2);
}

.new-chat-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(61, 217, 245, 0.3);
}

.new-chat-btn i {
    font-size: 14px;
}

/* ============ 历史会话列表 ============ */
.session-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px 8px;
}

.session-list-title {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 6px 6px;
    font-weight: 600;
}

.session-empty {
    padding: 24px 12px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
}

.session-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    margin-bottom: 4px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
}

.session-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.session-item.active {
    background: rgba(61, 217, 245, 0.1);
    border-left: 2px solid var(--primary);
}

.session-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

.session-info {
    flex: 1;
    min-width: 0;
}

.session-title {
    font-size: 12px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

.session-del {
    background: transparent;
    border: none;
    color: var(--text-muted);
    width: 20px;
    height: 20px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    opacity: 0;
    transition: all 0.15s;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.session-item:hover .session-del {
    opacity: 1;
}

.session-del:hover {
    color: var(--danger);
    background: rgba(255, 90, 90, 0.1);
}

/* ============ 居中输入框工具栏 ============ */
.centered-tools-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 8px 6px 12px;
    border-top: 1px solid var(--glass-border);
}

.tool-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s;
}

.tool-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.tool-label {
    font-size: 11px;
    color: var(--text-muted);
}

.centered-tools-bar .send-btn {
    margin-left: auto;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.centered-tools-bar .send-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--text-on-primary);
    box-shadow: 0 2px 8px var(--primary-glow);
}

.centered-tools-bar .send-btn.active:hover {
    transform: translateY(-1px);
}

/* 语音录制状态 */
.tool-btn.voice-btn.recording {
    color: var(--danger);
    background: rgba(255, 90, 123, 0.15);
    animation: voice-pulse 1s ease-in-out infinite;
}
@keyframes voice-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 90, 123, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(255, 90, 123, 0); }
}

/* ============ Cesium 地图 ============ */
#cesiumContainer .cesium-viewer-bottom { display: none !important; }
#cesiumContainer .cesium-credit-container { display: none !important; }
#cesiumContainer .cesium-viewer-toolbar { display: none !important; }

/* ============ 工具箱弹窗 ============ */
.tools-popup {
    background: var(--glass-bg-strong);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    width: 320px;
    max-height: 400px;
    overflow-y: auto;
    padding: 8px;
}
.tools-popup-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}
.tools-popup-header i { color: var(--primary); }
.tools-popup-close {
    margin-left: auto;
    width: 24px; height: 24px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
}
.tools-popup-close:hover { color: var(--danger); background: rgba(255,90,123,0.1); }
/* Agent 分组（层次感） */
.tools-group {
    margin-bottom: 4px;
    border-left: 2px solid var(--group-color, var(--primary));
    padding-left: 2px;
}
.tools-group-title {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px 4px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
    margin-top: 4px;
}
.tools-group-icon { font-size: 13px; }
.tools-group-name { color: var(--group-color, var(--primary)); font-size: 13px; }
.tools-group-desc {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 400;
    margin-left: auto;
}
.tools-group-items {
    padding: 2px 4px 4px 8px;
}
.tools-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 8px 10px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    text-align: left;
    transition: all 0.15s;
}
.tools-item:hover {
    background: rgba(61, 217, 245, 0.1);
    color: var(--text-primary);
}
.tools-item-label { flex: 1; }

/* ============ 快捷指令浮层 ============ */
.quick-cmd-popover {
    position: fixed;
    bottom: 200px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-elev);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 180px;
}

.quick-cmd-item {
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 8px 12px;
    text-align: left;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
}

.quick-cmd-item:hover {
    background: rgba(61, 217, 245, 0.1);
    color: var(--primary);
}

/* =========================================================
   最右侧 - 智能体工具条（极简风格）
   ========================================================= */
.toolbar {
    background: transparent;
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: none;
    border-radius: var(--radius-lg);
    padding: 6px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    overflow-y: auto;
    overflow-x: visible;
    position: relative;
}

.agent-btn {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: rgba(255,255,255,0.04);
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    transition: all 0.2s;
    overflow: visible;
    flex-shrink: 0;
}

.agent-btn .agent-emoji {
    font-size: 16px;
    line-height: 1;
    filter: grayscale(0.5);
    opacity: 0.6;
    transition: all 0.2s;
}

.agent-btn .agent-name {
    font-size: 7px;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.2px;
    transition: color 0.2s;
}

.agent-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.15);
}
.agent-btn:hover .agent-emoji { opacity: 0.9; filter: grayscale(0); }
.agent-btn:hover .agent-name { color: var(--text-secondary); }

.agent-btn.active {
    background: linear-gradient(135deg, rgba(61, 217, 245, 0.25), rgba(61, 217, 245, 0.1));
    border-color: var(--agent-color, var(--primary));
    box-shadow: 0 0 12px var(--agent-color, var(--primary)), inset 0 0 8px rgba(61, 217, 245, 0.1);
}
.agent-btn.active .agent-emoji {
    opacity: 1;
    filter: grayscale(0) drop-shadow(0 0 4px var(--agent-color, var(--primary)));
    transform: scale(1.1);
}
.agent-btn.active .agent-name { color: var(--text-primary); font-weight: 600; }
.agent-btn.active::before {
    content: '';
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--agent-color, var(--primary));
    border-radius: 3px 0 0 3px;
    box-shadow: 0 0 8px var(--agent-color, var(--primary));
}

/* Tooltip（从左侧显示，因为 toolbar 在最右侧） */
.agent-btn .tooltip {
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-elev-2);
    border: 1px solid var(--glass-border-strong);
    padding: 8px 12px;
    border-radius: var(--radius-md);
    font-size: 12px;
    color: var(--text-primary);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 100;
    box-shadow: var(--shadow-md);
}
.agent-btn .tooltip strong { color: var(--primary); display: block; margin-bottom: 2px; }
.agent-btn .tooltip span { color: var(--text-secondary); font-size: 11px; }
.agent-btn:hover .tooltip { opacity: 1; transform: translateY(-50%) translateX(-2px); }

.toolbar-footer {
    margin-top: auto;
    padding-top: 8px;
}

/* =========================================================
   中侧 - 对话框
   ========================================================= */
.dialog {
    background: transparent;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

.dialog-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.dialog-header .agent-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--agent-color, var(--primary)), var(--agent-color-dark, var(--primary-dark)));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 0 14px var(--agent-color-glow, var(--primary-glow));
    flex-shrink: 0;
    transition: all 0.3s;
}

.dialog-header .agent-meta { flex: 1; min-width: 0; }
.dialog-header .agent-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}
.dialog-header .agent-status {
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}
.dialog-header .agent-status .dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
}

.dialog-header-actions { display: flex; gap: 6px; }
.mini-btn {
    width: 30px; height: 30px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px;
    transition: all 0.2s;
}
.mini-btn:hover { background: rgba(125, 145, 195, 0.1); color: var(--text-primary); }

/* 消息流 */
.dialog-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.msg-day-divider {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    margin: 4px 0;
    position: relative;
}
.msg-day-divider::before, .msg-day-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 80px;
    height: 1px;
    background: var(--glass-border);
}
.msg-day-divider::before { left: 50%; transform: translateX(-90px); }
.msg-day-divider::after { right: 50%; transform: translateX(90px); }

.message {
    display: flex;
    gap: 10px;
    max-width: 92%;
    animation: msg-in 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user { flex-direction: row-reverse; align-self: flex-end; }

.message .msg-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    position: relative;
    display: flex; align-items: center; justify-content: center;
}

/* AI 头像：渐变环 + 中心图标 */
.msg-avatar.ai-avatar .avatar-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(from 0deg, var(--ai-color, var(--primary)), var(--ai-color-dark, var(--primary-dark)), var(--ai-color, var(--primary)));
    animation: avatar-spin 6s linear infinite;
}

.msg-avatar.ai-avatar .avatar-inner {
    position: relative;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--bg-elev);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px;
    color: var(--ai-color, var(--primary));
    z-index: 1;
}

@keyframes avatar-spin {
    to { transform: rotate(360deg); }
}

/* 用户头像：海青蓝渐变 + 管理员图标 */
.msg-avatar.user-avatar .avatar-inner {
    width: 100%; height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--text-on-primary);
    font-weight: 600;
    font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 12px var(--primary-glow);
}

.message .msg-content { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.message.user .msg-content { align-items: flex-end; }

.message .bubble {
    padding: 11px 15px;
    border-radius: var(--radius-lg);
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--text-primary);
    word-break: break-word;
    box-shadow: var(--shadow-sm);
}
.message.assistant .bubble {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    border-top-left-radius: 4px;
}
.message.user .bubble {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--text-on-primary);
    border-top-right-radius: 4px;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.message .bubble strong { color: var(--primary); font-weight: 600; }
.message.user .bubble strong { color: #fff; }

.message .msg-time {
    font-size: 10px;
    color: var(--text-muted);
    padding: 0 4px;
}

/* 字段抽取卡片 */
.field-card {
    margin-top: 4px;
    padding: 10px 12px;
    background: rgba(61, 217, 245, 0.06);
    border: 1px solid rgba(61, 217, 245, 0.25);
    border-radius: var(--radius-md);
    width: 100%;
}
.field-card-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.field-card-header i { font-size: 11px; }
.field-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.field-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 9px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-pill);
    font-size: 11px;
    color: var(--text-primary);
    transition: all 0.2s;
    cursor: pointer;
}
.field-chip:hover { border-color: var(--primary); color: var(--primary); }
.field-chip .chip-label { color: var(--text-muted); font-size: 10px; }
.field-chip .chip-value { color: var(--text-primary); font-weight: 500; }
.field-chip.missing {
    border-style: dashed;
    border-color: var(--danger);
    color: var(--danger);
    background: rgba(255, 90, 123, 0.05);
}

/* 思考过程折叠面板 */
.thinking-panel {
    margin-top: 4px;
    padding: 8px 12px;
    background: rgba(139, 92, 246, 0.06);
    border: 1px dashed rgba(139, 92, 246, 0.3);
    border-radius: var(--radius-md);
    width: 100%;
}
.thinking-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--purple);
    cursor: pointer;
    user-select: none;
}
.thinking-toggle i { transition: transform 0.2s; }
.thinking-panel.expanded .thinking-toggle i { transform: rotate(90deg); }
.thinking-content {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-primary);
    line-height: 1.5;
    display: none;
}
.thinking-panel.expanded .thinking-content { display: block; }

/* 打字光标 */
.typing-cursor {
    display: inline-block;
    width: 7px;
    height: 14px;
    background: var(--primary);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* 输入区 */
.dialog-footer {
    border-top: 1px solid var(--glass-border);
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.agent-info-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    font-size: 12px;
}

.agent-info-bar i {
    font-size: 14px;
}

.agent-name-label {
    font-weight: 600;
    color: var(--text-primary);
}

.agent-desc-label {
    color: var(--text-primary);
    font-size: 11px;
    opacity: 0.7;
}

.quick-commands {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.quick-cmd {
    padding: 5px 11px;
    background: rgba(61, 217, 245, 0.06);
    border: 1px solid rgba(61, 217, 245, 0.18);
    border-radius: var(--radius-pill);
    font-size: 11.5px;
    color: var(--primary-light);
    transition: all 0.2s;
}
.quick-cmd:hover {
    background: rgba(61, 217, 245, 0.14);
    border-color: var(--primary);
    color: var(--text-primary);
    transform: translateY(-1px);
}

/* 输入框上方工具清单 */
.footer-tools-bar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px;
    padding: 0 2px;
}
.footer-tool-chip {
    padding: 5px 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-pill);
    font-size: 12px;
    color: var(--text-secondary);
    transition: all 0.15s;
    white-space: nowrap;
}
.footer-tool-chip:hover {
    background: rgba(61, 217, 245, 0.12);
    border-color: var(--primary);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 8px 8px 8px 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.input-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.input-wrap textarea {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    color: var(--text-primary);
    font-size: 13.5px;
    line-height: 1.5;
    max-height: 120px;
    min-height: 22px;
    padding: 4px 0;
}
.input-wrap textarea::placeholder { color: var(--text-muted); }

.input-actions { display: flex; gap: 4px; }
.send-btn {
    width: 34px; height: 34px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--text-on-primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    transition: all 0.2s;
    box-shadow: 0 4px 12px var(--primary-glow);
}
.send-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px var(--primary-glow); }
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

/* 空对话模式（KIMI 风格） */
.dialog-empty-mode {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    border: none !important;
}

.dialog-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px;
    gap: 16px;
}
.dialog-empty .big-emoji {
    font-size: 64px;
    filter: drop-shadow(0 0 24px var(--agent-color-glow, var(--primary-glow)));
}

/* SkyTrial Logo：旋转渐变环 + 中心测试图标 */
.skytrial-logo {
    width: 88px; height: 88px;
    position: relative;
    display: flex; align-items: center; justify-content: center;
}
.skytrial-logo .skytrial-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(from 0deg,
        var(--ai-color, var(--primary)),
        var(--ai-color-dark, var(--primary-dark)),
        var(--ai-color, var(--primary)));
    animation: avatar-spin 6s linear infinite;
    mask: radial-gradient(circle, transparent 58%, black 60%);
    -webkit-mask: radial-gradient(circle, transparent 58%, black 60%);
}
.skytrial-logo .skytrial-core {
    position: relative;
    width: 60px; height: 60px;
    border-radius: 50%;
    background: var(--bg-elev);
    border: 2px solid var(--glass-border);
    display: flex; align-items: center; justify-content: center;
    font-size: 26px;
    color: var(--ai-color, var(--primary));
    box-shadow: 0 0 24px var(--primary-glow);
    z-index: 1;
}
.dialog-empty h3 { font-size: 32px; font-weight: 700; color: var(--text-primary); letter-spacing: 1px; }
.dialog-empty p { font-size: 14px; color: var(--text-primary); opacity: 0.75; max-width: 480px; line-height: 1.6; }
.dialog-empty .skytrial-desc { font-size: 14px; color: var(--text-primary); opacity: 0.7; margin-top: -4px; }

/* 推荐操作卡片 */
.suggestion-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    width: 900px;
    max-width: 90%;
    margin-top: 24px;
}
.suggestion-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    background: rgba(26, 36, 64, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    transition: all 0.2s;
    cursor: pointer;
}
.suggestion-card:hover {
    background: rgba(26, 36, 64, 0.7);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}
.suggestion-icon {
    font-size: 22px;
    line-height: 1;
}
.suggestion-text {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
}
.suggestion-card:hover .suggestion-text {
    color: var(--text-primary);
}

/* 居中大输入框（KIMI 风格） */
.centered-input-wrap {
    width: 900px;
    max-width: 90%;
    margin-top: 32px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.2s;
}

.centered-input-wrap:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
}

.centered-input-wrap:focus-within {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(61, 217, 245, 0.15);
}

.centered-textarea {
    width: 100%;
    min-height: 130px;
    max-height: 240px;
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.6;
    background: transparent;
    border: none;
    color: var(--text-primary);
    resize: none;
    outline: none;
    box-sizing: border-box;
    display: block;
}

.centered-textarea::placeholder {
    color: var(--text-muted);
}

.centered-input-wrap .send-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    border: none;
    cursor: not-allowed;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.centered-input-wrap .send-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--text-on-primary);
    box-shadow: 0 2px 8px var(--primary-glow);
    cursor: pointer;
}

.centered-input-wrap .send-btn.active:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.centered-input-wrap .send-btn:disabled {
    opacity: 0.5;
}

/* =========================================================
   右侧 - 模块面板（卡片列表，默认隐藏）
   ========================================================= */
.module-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    position: relative;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.layout.module-open .module-panel {
    opacity: 1;
    visibility: visible;
}

.module-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}
.module-title-wrap { flex: 1; min-width: 0; }
.module-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.module-title i { color: var(--primary); }
.module-subtitle { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

/* 模块全屏按钮 */
.module-fullscreen-btn {
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    transition: all 0.2s;
    flex-shrink: 0;
}
.module-fullscreen-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(61, 217, 245, 0.08);
}

.module-tabs {
    display: flex;
    gap: 2px;
    background: rgba(0, 0, 0, 0.25);
    padding: 3px;
    border-radius: var(--radius-md);
}
.module-tab {
    padding: 6px 12px;
    font-size: 12px;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    white-space: nowrap;
}
.module-tab:hover { color: var(--text-secondary); }
.module-tab.active {
    background: rgba(61, 217, 245, 0.12);
    color: var(--primary);
    font-weight: 600;
}

.module-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 18px;
    min-height: 0;
}

/* 模块切换过渡 */
.module-body.switching { opacity: 0; transform: translateY(4px); transition: all 0.25s; }
.module-body { transition: opacity 0.3s, transform 0.3s; }

/* 模块底部操作 */
.module-footer {
    padding: 12px 18px;
    border-top: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.15);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-shrink: 0;
}

/* ---------- 通用组件 ---------- */

/* 统计卡片网格 */
.stats-grid {
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
}
.stats-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.stats-grid.cols-5 { grid-template-columns: repeat(5, 1fr); }
.stats-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }

.stat-card {
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
    transition: all 0.2s;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--accent-color, var(--primary));
}
.stat-card:hover { border-color: var(--accent-color, var(--primary)); transform: translateY(-2px); }
.stat-card .stat-label { font-size: 11px; color: var(--text-secondary); margin-bottom: 4px; }
.stat-card .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    font-family: var(--font-mono);
}
.stat-card .stat-trend { font-size: 10px; margin-top: 4px; color: var(--success); }

/* 数据表格 */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}
.data-table thead th {
    background: rgba(0, 0, 0, 0.25);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}
.data-table tbody td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-primary);
    vertical-align: middle;
}
.data-table tbody tr { transition: background 0.2s; }
.data-table tbody tr:hover { background: rgba(61, 217, 245, 0.04); }
.data-table tbody tr.row-new { animation: row-highlight 1.5s ease-out; }
@keyframes row-highlight {
    0% { background: rgba(61, 217, 245, 0.2); }
    100% { background: transparent; }
}

/* AI 填充字段高亮动画 */
.ai-filled {
    animation: field-fill-pulse 1.2s ease-out;
}
@keyframes field-fill-pulse {
    0%   { background: rgba(61, 217, 245, 0.45); transform: scale(1); }
    50%  { background: rgba(61, 217, 245, 0.22); transform: scale(1.015); }
    100% { background: transparent; transform: scale(1); }
}

/* 状态徽章 */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.6;
}
.badge .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.pending     { background: rgba(255, 200, 87, 0.12); color: var(--warning); }
.badge.approved    { background: rgba(16, 229, 168, 0.12); color: var(--success); }
.badge.testing     { background: rgba(61, 217, 245, 0.12); color: var(--primary); }
.badge.reviewing   { background: rgba(139, 92, 246, 0.12); color: var(--purple); }
.badge.completed   { background: rgba(16, 229, 168, 0.16); color: var(--success); }
.badge.rejected    { background: rgba(255, 90, 123, 0.12); color: var(--danger); }
.badge.normal      { background: rgba(16, 229, 168, 0.12); color: var(--success); }
.badge.abnormal    { background: rgba(255, 90, 123, 0.12); color: var(--danger); }
.badge.on-duty     { background: rgba(16, 229, 168, 0.12); color: var(--success); }
.badge.off-duty    { background: rgba(152, 166, 199, 0.12); color: var(--text-secondary); }

/* 按钮 */
.btn {
    padding: 7px 14px;
    border-radius: var(--radius-md);
    font-size: 12.5px;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid transparent;
    white-space: nowrap;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--text-on-primary);
    box-shadow: 0 4px 12px var(--primary-glow);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px var(--primary-glow); }
.btn-ghost {
    background: rgba(0, 0, 0, 0.2);
    border-color: var(--glass-border);
    color: var(--text-secondary);
}
.btn-ghost:hover { border-color: var(--primary); color: var(--text-primary); background: rgba(61, 217, 245, 0.06); }
.btn-success { background: linear-gradient(135deg, var(--success), #0FBF85); color: #04231A; box-shadow: 0 4px 12px rgba(16, 229, 168, 0.3); }
.btn-danger  { background: linear-gradient(135deg, var(--danger), #E0456A); color: #fff; }
.btn-icon { padding: 6px 8px; }

/* 卡片网格 */
.card-grid {
    display: grid;
    gap: 10px;
}
.card-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.card-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }

.info-card {
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    transition: all 0.2s;
    cursor: pointer;
}
.info-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* 空状态 */
.empty-state {
    padding: 48px 20px;
    text-align: center;
    color: var(--text-muted);
}
.empty-state i { font-size: 36px; margin-bottom: 12px; display: block; }
.empty-state p { font-size: 13px; }

/* ============ 卡片列表（精致设计） ============ */
.card-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-card {
    background: rgba(19, 28, 51, 0.7);
    border: 1px solid rgba(125, 145, 195, 0.15);
    border-radius: var(--radius-lg);
    padding: 0;
    transition: all 0.25s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

/* 左侧彩色强调条 */
.info-card::after {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--card-accent, var(--primary));
    box-shadow: 0 0 8px var(--card-accent, var(--primary));
}

.info-card:hover {
    background: rgba(26, 36, 64, 0.85);
    border-color: rgba(125, 145, 195, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.info-card.card-new {
    animation: card-highlight 1.5s ease-out;
}

@keyframes card-highlight {
    0% { box-shadow: 0 0 0 2px var(--card-accent, var(--primary)), 0 0 20px var(--card-accent, var(--primary)); }
    100% { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); }
}

/* 卡片头部 */
.info-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px 10px 20px;
}

.info-card .card-title {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: 0.3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 卡片信息区 */
.info-card .card-body {
    padding: 0 16px 12px 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
}

.info-card .card-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 24px;
}

.info-card .card-label {
    color: var(--text-muted);
    font-size: 11px;
    flex-shrink: 0;
}

.info-card .card-value {
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.info-card .card-row[data-field].ai-filled {
    animation: field-flash 1.5s ease-out;
}

/* 卡片底部操作区 */
.info-card .card-footer {
    padding: 10px 16px 10px 20px;
    border-top: 1px solid rgba(125, 145, 195, 0.1);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    background: rgba(0, 0, 0, 0.15);
}

.btn-sm {
    font-size: 11px;
    padding: 5px 12px;
}

/* 骨架屏 */
.skeleton {
    background: linear-gradient(90deg, rgba(125, 145, 195, 0.05) 25%, rgba(125, 145, 195, 0.15) 50%, rgba(125, 145, 195, 0.05) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-sm);
}
@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.skeleton-line { height: 12px; margin-bottom: 8px; }
.skeleton-line.short { width: 60%; }

/* Toast 通知 */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    background: var(--bg-elev-2);
    border: 1px solid var(--glass-border-strong);
    border-left: 3px solid var(--primary);
    padding: 12px 18px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    color: var(--text-primary);
    min-width: 280px;
    max-width: 360px;
    animation: toast-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast .toast-title { font-weight: 600; margin-bottom: 2px; }
.toast .toast-msg { color: var(--text-secondary); font-size: 12px; }
@keyframes toast-in {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* 目录树 */
.tree { font-size: 13px; }
.tree-node { margin-left: 12px; }
.tree-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s;
    color: var(--text-secondary);
}
.tree-row:hover { background: rgba(61, 217, 245, 0.06); color: var(--text-primary); }
.tree-row.active { background: rgba(61, 217, 245, 0.12); color: var(--primary); }
.tree-row .caret { width: 14px; transition: transform 0.2s; color: var(--text-muted); }
.tree-row.expanded .caret { transform: rotate(90deg); }
.tree-row .tree-icon { color: var(--warning); }
.tree-children { display: none; }
.tree-node.expanded > .tree-children { display: block; }

/* Modal 弹出框 */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.modal-overlay.show { opacity: 1; }
.modal-card {
    background: var(--bg-elev-2);
    border: 1px solid var(--glass-border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 560px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    transform: scale(0.92) translateY(8px);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
}
.modal-overlay.show .modal-card { transform: scale(1) translateY(0); }
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}
.modal-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
}
.modal-close {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
}
.modal-close:hover { background: rgba(255, 90, 123, 0.15); color: var(--danger); }
.modal-body {
    padding: 18px;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.6;
}
.modal-body .detail-row {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.modal-body .detail-row:last-child { border-bottom: none; }
.modal-body .detail-label {
    width: 100px;
    color: var(--text-muted);
    font-size: 12px;
    flex-shrink: 0;
}
.modal-body .detail-value {
    color: var(--text-primary);
    font-weight: 500;
    flex: 1;
}

/* 表单（行内编辑） */
.form-field { margin-bottom: 12px; }
.form-label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 7px 11px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* 图标列表 */
.icon-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-pill);
    font-size: 11px;
    color: var(--text-secondary);
}

/* 模态框 */
.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(7, 11, 22, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fade-in 0.2s;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
    background: var(--bg-elev);
    border: 1px solid var(--glass-border-strong);
    border-radius: var(--radius-xl);
    width: 560px;
    max-width: 92vw;
    max-height: 86vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: modal-in 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes modal-in { from { transform: translateY(20px) scale(0.98); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--glass-border); display: flex; gap: 8px; justify-content: flex-end; }

/* 滚动反馈 */
.scroll-fade-top, .scroll-fade-bottom {
    position: absolute;
    left: 0; right: 0;
    height: 24px;
    pointer-events: none;
    z-index: 5;
}
.scroll-fade-top { top: 0; background: linear-gradient(to bottom, var(--glass-bg), transparent); }
.scroll-fade-bottom { bottom: 0; background: linear-gradient(to top, var(--glass-bg), transparent); }

/* 响应式 */
@media (max-width: 1280px) {
    .layout {
        grid-template-columns: 160px 1fr 0 40px;
        gap: 6px;
        padding: 6px;
    }
    .layout.module-open {
        grid-template-columns: 160px 1fr minmax(280px, 28vw) 40px;
    }
    .agent-btn { width: 32px; height: 32px; }
    .agent-btn .agent-emoji { font-size: 14px; }
}

@media (max-width: 980px) {
    .layout { grid-template-columns: 40px 1fr 0 40px; }
    .layout.module-open { grid-template-columns: 40px 1fr 100vw 40px; }
    .sidebar { display: none; }
}
