/* RegLens · 最终版（完全对照图片） */
:root {
    --bg-base: #EEF3FA;
    --bg-2: #F5F8FC;
    --surface: #FFFFFF;
    --ink: #15233F;
    --ink-2: #3A4660;
    --ink-3: #6B7A8C;
    --ink-4: #8E9AAE;
    --line: #E1E8F1;
    --line-2: #CBD5E5;
    --blue-50: #EBF4FD;
    --blue-100: #D8E9F8;
    --blue-200: #B3D2EE;
    --blue-300: #6FB4E5;
    --blue-400: #4A9DE8;
    --blue-500: #1F6FC4;
    --blue-600: #1555A8;
    --blue-700: #0F4288;
    --blue-800: #0A2D6B;
    --accent: #1F6FC4;
    --accent-bright: #4A9DE8;
    --accent-deep: #0F4288;
    --accent-soft: #EBF4FD;
    --accent-ring: rgba(31, 111, 196, 0.20);
    --shadow-sm: 0 1px 3px rgba(15, 66, 136, 0.06);
    --shadow-md: 0 4px 18px rgba(15, 66, 136, 0.08);
    --shadow-card: 0 6px 24px rgba(15, 66, 136, 0.10), 0 1px 2px rgba(15, 66, 136, 0.04);
    --radius: 16px;
    --radius-sm: 10px;
    --font-display: "Source Serif 4", "Noto Serif SC", Georgia, "Songti SC", serif;
    --font-body: "Inter", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
    --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: var(--font-body);
    color: var(--ink-2);
    background: var(--bg-base);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    line-height: 1.6;
    position: relative;
    overflow: hidden;
    height: 100vh;
}
.bg-base {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background: radial-gradient(ellipse 80% 60% at 50% 30%, #F5F9FD 0%, #EEF3FA 60%, #E6EEF8 100%);
}
.bg-grid {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background-image:
        linear-gradient(rgba(31, 111, 196, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(31, 111, 196, 0.045) 1px, transparent 1px);
    background-size: 48px 48px;
    -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 40%, transparent 100%);
    mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 40%, transparent 100%);
    opacity: 0.7;
}
.decor { position: fixed; z-index: 0; pointer-events: none; opacity: 0.95; transition: opacity 0.5s ease; }
.decor-shield { left: 4%; top: 28%; width: 230px; filter: drop-shadow(0 8px 30px rgba(74, 157, 232, 0.18)); animation: float-shield 6s ease-in-out infinite; transition: opacity 0.6s ease; }
.decor-shield svg { width: 100%; height: auto; display: block; }
@keyframes float-shield { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.decor-doc { right: 4%; top: 24%; width: 200px; filter: drop-shadow(0 10px 30px rgba(15, 66, 136, 0.14)); animation: float-doc 7s ease-in-out infinite; transition: opacity 0.6s ease; }
.decor-doc svg { width: 100%; height: auto; display: block; }
/* 进入对话态后：背景装饰与粒子淡出，页面干净 */
body.chatting .decor-shield,
body.chatting .decor-doc,
body.chatting .bg-particles { opacity: 0; animation: none; }
@keyframes float-doc { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-10px) rotate(1deg); } }
.bg-particles { position: fixed; inset: 0; z-index: 0; pointer-events: none; transition: opacity 0.6s ease; }
.bg-particles span {
    position: absolute; left: var(--x); top: var(--y);
    width: 4px; height: 4px; border-radius: 50%;
    background: var(--blue-300); opacity: 0.4;
    box-shadow: 0 0 8px var(--blue-300);
    animation: particle 4s ease-in-out var(--d) infinite;
}
@keyframes particle { 0%, 100% { opacity: 0.2; transform: scale(1); } 50% { opacity: 0.7; transform: scale(1.4); } }

.app {
    position: relative; z-index: 1;
    max-width: 1200px; margin: 0 auto;
    padding: 0 40px;
    display: flex; flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.topbar { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; padding: 22px 4px 20px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark { width: 46px; height: 46px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 4px 14px rgba(31, 111, 196, 0.10); }
.brand-mark svg { width: 28px; height: 28px; }
.brand-text { display: flex; flex-direction: column; gap: 2px; line-height: 1.2; }
.brand-name { font-family: var(--font-body); font-weight: 700; font-size: 22px; color: var(--ink); letter-spacing: -0.2px; }
.brand-tag { font-size: 12.5px; color: var(--ink-3); letter-spacing: 0.2px; }
.status-pill {
    display: inline-flex; align-items: center; gap: 8px;
    font-family: var(--font-body); font-size: 13.5px; font-weight: 500;
    color: var(--blue-600); background: var(--surface);
    border: 1px solid var(--blue-200); border-radius: 999px;
    padding: 8px 16px 8px 14px; cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(31, 111, 196, 0.08);
}
.status-pill svg { width: 16px; height: 16px; }
.status-pill:hover { box-shadow: 0 4px 12px var(--accent-ring); transform: translateY(-1px); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.clear-chat-btn {
    display: inline-flex; align-items: center; gap: 7px;
    font-family: var(--font-body); font-size: 13.5px; font-weight: 500;
    color: var(--ink-3); background: var(--surface);
    border: 1px solid var(--line); border-radius: 999px;
    padding: 8px 16px 8px 14px; cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(31, 111, 196, 0.06);
}
.clear-chat-btn svg { width: 15px; height: 15px; }
.clear-chat-btn:hover { color: #DC2626; border-color: #FCA5A5; background: #FEF2F2; box-shadow: 0 4px 12px rgba(220, 38, 38, 0.14); transform: translateY(-1px); }
.clear-chat-btn:active { transform: translateY(0); }
.clear-chat-btn[hidden] { display: none; }

.welcome { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 18px 0 16px; gap: 10px; overflow: hidden; }
.welcome-badge { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--blue-600); background: var(--blue-50); border: 1px solid var(--blue-200); border-radius: 999px; padding: 6px 16px; font-weight: 500; box-shadow: 0 1px 4px rgba(31, 111, 196, 0.06); }
.welcome-badge svg { width: 16px; height: 16px; }
.welcome-title { font-family: var(--font-display); font-weight: 600; font-size: clamp(32px, 4vw, 44px); letter-spacing: -0.5px; line-height: 1.15; text-align: center; margin-top: 4px; }
.title-dark { color: var(--ink); }
.title-accent { background: linear-gradient(135deg, var(--blue-400) 0%, var(--blue-600) 50%, var(--blue-700) 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }
.title-underline { width: 56px; height: 3px; background: linear-gradient(90deg, var(--blue-300), var(--blue-500)); border-radius: 2px; margin-top: 6px; margin-bottom: 6px; }
.welcome-desc { text-align: center; font-size: 15px; color: var(--ink-3); line-height: 1.7; max-width: 640px; margin: 0; }

.suggestion-cards { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; width: 100%; max-width: 700px; margin: 16px auto 0; }
.suggestion-chip { display: flex; align-items: center; gap: 9px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; transition: all 0.22s ease; box-shadow: 0 1px 3px rgba(15, 66, 136, 0.04); min-height: 46px; font-family: var(--font-body); font-size: 13px; font-weight: 500; color: var(--ink); line-height: 1.45; letter-spacing: 0.1px; }
/* 前 3 张占 2 列（行 1：3 张），后面 4 张占 3 列（行 2、3 各 2 张） */
.suggestion-chip:nth-child(-n+3) { grid-column: span 2; }
.suggestion-chip:nth-child(n+4) { grid-column: span 3; }
.suggestion-chip:hover { border-color: var(--blue-200); box-shadow: 0 6px 18px rgba(31, 111, 196, 0.12); transform: translateY(-1px); color: var(--blue-700); }
.suggestion-chip:hover .sc-mark { background: var(--blue-100); color: var(--blue-600); transform: scale(1.06); }
.suggestion-chip:hover .sc-go { color: var(--blue-500); transform: translateX(3px); }
.suggestion-chip:active { transform: translateY(0); }
.sc-mark { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--blue-50); color: var(--blue-500); border: 1px solid var(--blue-100); box-shadow: none; transition: all 0.22s ease; }
.sc-mark svg { width: 14px; height: 14px; }
.sc-text { flex: 1; text-align: center; font-size: inherit; color: inherit; line-height: inherit; }
.sc-go { flex-shrink: 0; color: var(--ink-4); display: grid; place-items: center; transition: all 0.22s ease; }
.sc-go svg { width: 15px; height: 15px; }
.trust-text { display: flex; flex-direction: column; line-height: 1.3; }
.trust-title { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.trust-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }

.conversation { flex: 1 1 auto; overflow-y: auto; padding: 8px 4px 16px; display: flex; flex-direction: column; gap: 18px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.conversation::-webkit-scrollbar { width: 8px; }
.conversation::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; }
.message { display: flex; gap: 0; max-width: 100%; animation: msg-in 0.35s ease both; }
/* 消息进入：淡入 + 轻微上移，避免生硬弹出 */
@keyframes msg-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.message.ai { justify-content: flex-start; }
.message.user { justify-content: flex-start; flex-direction: row-reverse; }
/* 隐藏头像：让消息气泡左右边缘直接对齐 conversation 左右边（= composer 边） */
.msg-avatar { display: none; }
.message.ai .msg-avatar { display: none; }
.message.user .msg-avatar { display: none; }
.msg-content { display: flex; flex-direction: column; gap: 4px; position: relative; }
/* 消息复制按钮：悬停消息时浮现于气泡右下角外沿 */
.copy-btn { position: absolute; right: -2px; bottom: -9px; z-index: 3; display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 9px 0 8px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-3); border-radius: 999px; font-family: var(--font-body); font-size: 11px; line-height: 1; cursor: pointer; opacity: 0; transform: translateY(2px); pointer-events: none; box-shadow: var(--shadow-sm); transition: opacity 0.15s ease, transform 0.15s ease, color 0.15s ease, border-color 0.15s ease, background 0.15s ease; }
.message:hover .copy-btn { opacity: 1; transform: translateY(0); pointer-events: auto; }
.copy-btn:hover { color: var(--blue-600); border-color: var(--blue-300); background: var(--blue-50); }
.copy-btn svg { width: 11px; height: 11px; flex: none; }
.copy-btn.ok { color: #16A34A; border-color: #BBF7D0; background: #F0FDF4; }
.copy-btn.fail { color: #DC2626; border-color: #FECACA; background: #FEF2F2; }
/* AI 回答撑满整行，左/右边 = flow-card / composer 的左/右边 */
.message.ai .msg-content { width: 100%; max-width: 100%; }
/* 用户提问靠右，右边缘对齐 composer 右边缘 */
.message.user .msg-content { max-width: 85%; align-items: flex-end; }
.msg-role { font-size: 11.5px; color: var(--ink-3); letter-spacing: 0.3px; padding: 0 4px; }
.message.ai .msg-role { padding: 0 17px; }
.msg-bubble { font-size: 14.5px; line-height: 1.78; color: var(--ink-2); padding: 14px 17px; border-radius: var(--radius); word-break: break-word; white-space: pre-wrap; }
.message.ai .msg-bubble { background: transparent; border: none; box-shadow: none; border-radius: 0; color: var(--ink); padding: 2px 17px 10px; }
.message.user .msg-bubble { background: linear-gradient(135deg, var(--blue-500), var(--blue-700)); border: none; border-top-right-radius: 4px; color: #fff; box-shadow: 0 4px 14px var(--accent-ring); }
.message.user .msg-bubble strong { color: #fff; }
.msg-bubble .cite { color: var(--blue-300); font-weight: 600; font-size: 12px; margin-left: 1px; vertical-align: super; }
.message.user .msg-bubble .cite { color: rgba(255, 255, 255, 0.7); }
/* Markdown 渲染样式 */
.msg-bubble em { color: var(--ink); font-style: italic; }
.msg-bubble code { background: var(--bg-2); padding: 1px 6px; border-radius: 4px; font-family: var(--font-mono); font-size: 0.88em; color: var(--blue-700); border: 1px solid var(--line); }
.message.user .msg-bubble code { background: rgba(255, 255, 255, 0.18); color: #fff; border-color: rgba(255, 255, 255, 0.2); }
.msg-bubble ul, .msg-bubble ol { margin: 8px 0 8px 4px; padding-left: 22px; }
.msg-bubble li { margin: 3px 0; }
.source-list { margin-top: 12px; padding: 12px 14px; background: var(--bg-2); border: 1px solid var(--line); border-left: 3px solid var(--blue-500); border-radius: var(--radius-sm); font-size: 13px; }
.source-list strong { color: var(--ink); display: block; margin-bottom: 6px; font-size: 12.5px; letter-spacing: 0.3px; }
/* 「可信来源」整块折叠：标题行 + 收起/展开按钮（与 agent 流程卡同款样式） */
.sl-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.sl-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sl-title strong { margin-bottom: 0; }
.sl-count { flex: none; font-size: 11px; color: var(--blue-700); background: var(--surface); border: 1px solid var(--blue-100); border-radius: 999px; padding: 0 8px; line-height: 18px; }
.sl-toggle { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-3); background: transparent; border: none; cursor: pointer; padding: 4px 8px; border-radius: 6px; font-family: var(--font-body); transition: all 0.18s ease; }
.sl-toggle:hover { color: var(--blue-600); background: var(--blue-50); }
.sl-toggle svg { width: 12px; height: 12px; transition: transform 0.2s ease; }
.source-list.collapsed .sl-head { cursor: pointer; }
.source-list.collapsed .sl-toggle svg { transform: rotate(180deg); }
.source-list.collapsed .source-groups { display: none; }
.source-item { color: var(--ink-3); padding: 2px 0; font-family: var(--font-mono); font-size: 12px; line-height: 1.6; }
/* 可信来源 · 按文件分组的证据卡片（含原文摘录） */
.source-group { margin-top: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden; }
.sg-head { display: flex; align-items: center; gap: 8px; padding: 7px 10px; background: var(--blue-50); border-bottom: 1px solid var(--line); }
.sg-icon { width: 16px; height: 16px; color: var(--blue-600); flex: none; display: inline-flex; }
.sg-icon svg { width: 100%; height: 100%; }
.sg-name { flex: 1; min-width: 0; font-weight: 600; color: var(--ink); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-count { flex: none; font-size: 11px; color: var(--blue-700); background: var(--surface); border: 1px solid var(--blue-100); border-radius: 999px; padding: 0 8px; line-height: 18px; }
.source-evidence { padding: 8px 10px 9px; }
.source-evidence + .source-evidence { border-top: 1px dashed var(--line); }
.ev-head { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.ev-head .ev-loc { margin-bottom: 0; }
.ev-loc { display: inline-block; font-size: 11px; color: var(--blue-700); background: var(--blue-50); border: 1px solid var(--blue-100); border-radius: 4px; padding: 0 6px; line-height: 18px; font-family: var(--font-mono); margin-bottom: 5px; }
.ev-quote { font-size: 12px; line-height: 1.75; color: var(--ink-2); background: var(--bg-2); border-left: 2px solid var(--blue-400); border-radius: 0 6px 6px 0; padding: 7px 10px; white-space: pre-wrap; word-break: break-word; }
/* 默认单行截断 + 末尾省略号：用 nowrap 代替 -webkit-line-clamp，
   保证恰好一行的高度（line-clamp 与 pre-wrap 换行组合在部分浏览器会多露出第二行） */
.ev-quote.clampable { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.source-evidence.expanded .ev-quote.clampable { display: block; white-space: pre-wrap; overflow: visible; text-overflow: clip; }
/* 展开小图标：位于证据行右上角，展开时旋转 180° */
.ev-toggle { margin-left: auto; flex: none; width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line-2); background: var(--surface); border-radius: 5px; color: var(--ink-3); cursor: pointer; padding: 0; transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease; }
.ev-toggle:hover { color: var(--blue-600); border-color: var(--blue-300); background: var(--blue-50); }
.ev-toggle svg { width: 10px; height: 10px; transition: transform 0.2s ease; }
.source-evidence.expanded .ev-toggle svg { transform: rotate(180deg); }
.source-evidence.expanded .ev-toggle { color: var(--blue-600); border-color: var(--blue-300); background: var(--blue-50); }
.msg-bubble table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 13px; }
.msg-bubble th, .msg-bubble td { border: 1px solid var(--line-2); padding: 6px 10px; text-align: left; }
.msg-bubble th { background: var(--blue-50); color: var(--blue-700); font-weight: 600; }
.msg-bubble strong { color: var(--ink); }

.flow-card { align-self: stretch; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); transition: opacity 0.5s ease, transform 0.5s ease; animation: card-in 0.25s ease both; }
/* 流程卡进入：先 0.25s 快速淡入占位，内部元素再错峰点亮（见下方 rise 编排） */
@keyframes card-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
/* 内部元素错峰点亮：标题 → 5 节点从左到右逐个出现（间隔 ~60ms）→ 并行研判区 */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.lg-header { animation: rise 0.3s ease 0.05s both; }
.lg-node, .lg-arrow { animation: rise 0.3s ease both; }
.lg-node:nth-child(1) { animation-delay: 0.15s; }
.lg-arrow:nth-child(2) { animation-delay: 0.21s; }
.lg-node:nth-child(3) { animation-delay: 0.27s; }
.lg-arrow:nth-child(4) { animation-delay: 0.33s; }
.lg-node:nth-child(5) { animation-delay: 0.39s; }
.lg-arrow:nth-child(6) { animation-delay: 0.45s; }
.lg-node:nth-child(7) { animation-delay: 0.51s; }
.lg-arrow:nth-child(8) { animation-delay: 0.57s; }
.lg-node:nth-child(9) { animation-delay: 0.63s; }
.lg-parallel { animation: rise 0.35s ease 0.72s both; }
.flow-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.flow-title { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.flow-title svg { width: 20px; height: 20px; color: var(--blue-500); }
.flow-progress { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); }
.flow-progress .current { color: var(--blue-500); font-weight: 600; }
.flow-steps { display: flex; flex-direction: column; position: relative; }
.flow-step { display: flex; gap: 14px; padding: 9px 0; position: relative; }
.flow-step::before { content: ""; position: absolute; left: 15px; top: 30px; bottom: -9px; width: 2px; background: var(--line-2); }
.flow-step:last-child::before { display: none; }
.step-icon { flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-2); border: 1px solid var(--line-2); color: var(--ink-3); z-index: 1; transition: all 0.3s ease; }
.step-icon svg { width: 18px; height: 18px; }
.step-body { flex: 1; padding-top: 2px; }
.step-name { font-size: 13.5px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.step-tag { font-family: var(--font-mono); font-size: 10.5px; color: var(--blue-600); background: var(--blue-50); border: 1px solid var(--blue-200); padding: 1px 7px; border-radius: 999px; font-weight: 500; }
.step-desc { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.flow-step.active .step-icon { background: linear-gradient(135deg, var(--blue-400), var(--blue-700)); border-color: transparent; color: #fff; box-shadow: 0 0 0 4px var(--accent-ring); }
.flow-step.active .step-name { color: var(--blue-600); }
.flow-step.active::before { background: var(--blue-500); }
.flow-step.done .step-icon { background: var(--blue-500); border-color: transparent; color: #fff; }
.flow-step.done::before { background: var(--blue-500); }
.parallel-agents { display: flex; gap: 14px; margin-top: 8px; }
.pa-item { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.pa-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line-2); transition: background 0.3s ease; }
.pa-label { font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); }
.flow-step.active .pa-dot { background: var(--blue-500); animation: pa-blink 1s ease-in-out infinite; }
.flow-step.active .pa-dot:nth-child(1) { animation-delay: 0s; }
.flow-step.active .pa-dot:nth-child(2) { animation-delay: 0.15s; }
.flow-step.active .pa-dot:nth-child(3) { animation-delay: 0.3s; }
.flow-step.active .pa-dot:nth-child(4) { animation-delay: 0.45s; }
.flow-step.active .pa-dot:nth-child(5) { animation-delay: 0.6s; }
@keyframes pa-blink { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }
/* 流程卡：details（步骤详情）默认显示，summary（一行摘要）默认隐藏；点击 .collapsed 切换 */
.flow-card.collapsed { padding: 11px 16px; }
.flow-card.collapsed .flow-details { display: none; }
.flow-card:not(.collapsed) .flow-summary { display: none; }
.flow-summary { display: flex; align-items: center; gap: 9px; font-size: 13px; cursor: pointer; user-select: none; padding: 2px 4px; border-radius: 8px; transition: background 0.15s ease; }
.flow-summary:hover { background: var(--bg-2); }
.flow-summary svg { width: 18px; height: 18px; color: var(--blue-500); flex-shrink: 0; }
.summary-text { font-weight: 600; color: var(--ink); }
.summary-tag { color: var(--ink-3); }
.summary-time { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); }
.summary-chevron { margin-left: auto; color: var(--ink-3); font-size: 12px; display: inline-flex; align-items: center; gap: 4px; }
.summary-chevron svg { width: 12px; height: 12px; }
.flow-header-right { display: flex; align-items: center; gap: 14px; }
.flow-toggle { background: transparent; border: 1px solid var(--line-2); color: var(--ink-3); font-size: 12px; padding: 4px 10px; border-radius: 6px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; transition: all 0.15s ease; }
.flow-toggle:hover { border-color: var(--blue-300); color: var(--blue-600); background: var(--blue-50); }
.flow-toggle svg { width: 12px; height: 12px; }

.composer { flex-shrink: 0; padding: 16px 0 22px; }
.composer-frame { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 2px solid var(--blue-200); border-radius: 18px; padding: 8px 10px 8px 18px; box-shadow: 0 2px 4px rgba(15, 66, 136, 0.08), 0 10px 24px rgba(15, 66, 136, 0.16), 0 24px 56px rgba(31, 111, 196, 0.22), 0 40px 90px rgba(31, 111, 196, 0.16); transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.composer-frame:focus-within { border-color: var(--blue-500); box-shadow: 0 0 0 4px var(--accent-ring), 0 4px 8px rgba(15, 66, 136, 0.10), 0 16px 36px rgba(31, 111, 196, 0.24), 0 32px 72px rgba(31, 111, 196, 0.20); }
.composer-left-icon { flex-shrink: 0; color: var(--blue-500); display: grid; place-items: center; }
.composer-left-icon svg { width: 22px; height: 22px; }
.composer-input { flex: 1; border: none; outline: none; resize: none; background: transparent; font-family: var(--font-body); font-size: 15px; color: var(--ink); line-height: 1.6; padding: 10px 0; max-height: 160px; }
.composer-input::placeholder { color: var(--ink-4); }
.composer-send { flex-shrink: 0; width: 44px; height: 44px; border: none; border-radius: 12px; background: linear-gradient(135deg, var(--blue-400), var(--blue-700)); color: #fff; cursor: pointer; display: grid; place-items: center; transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease; box-shadow: 0 4px 14px rgba(31, 111, 196, 0.32); }
.composer-send svg { width: 22px; height: 22px; }
.composer-send:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(31, 111, 196, 0.42); }
.composer-send:active:not(:disabled) { transform: translateY(0); }
.composer-send:disabled { opacity: 0.5; cursor: not-allowed; }
.composer-hint { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 12px; color: var(--ink-3); margin-top: 12px; flex-wrap: wrap; }
.composer-hint kbd { display: inline-block; font-family: var(--font-mono); font-size: 11px; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line-2); border-radius: 4px; padding: 1px 6px; margin-right: 3px; box-shadow: 0 1px 0 var(--line-2); }
.composer-hint .sep { color: var(--line-2); }
.composer-foot { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 11.5px; color: var(--ink-3); margin-top: 8px; flex-wrap: wrap; }
.composer-foot span { display: inline-flex; align-items: center; gap: 5px; }
.composer-foot svg { width: 13px; height: 13px; color: var(--blue-500); }
.composer-foot .sep { color: var(--line-2); }

.typing-cursor { display: inline-block; width: 2px; height: 1.05em; background: var(--blue-500); margin-left: 2px; vertical-align: text-bottom; animation: blink-caret 1s step-end infinite; }
@keyframes blink-caret { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

@media (max-width: 960px) {
    .decor { display: none; }
    .suggestion-cards { grid-template-columns: repeat(2, 1fr); }
    .suggestion-chip:nth-child(-n+3), .suggestion-chip:nth-child(n+4) { grid-column: span 1; }
    .app { padding: 0 24px; }
    .lg-steps { grid-template-columns: repeat(5, 1fr); }
    .lg-arrow { display: none; }
}
@media (max-width: 600px) {
    .suggestion-cards { grid-template-columns: 1fr; }
    .suggestion-chip:nth-child(-n+3), .suggestion-chip:nth-child(n+4) { grid-column: span 1; }
    .brand-tag { display: none; }
    .welcome-title { font-size: 32px; }
    .topbar { padding: 16px 4px; }
    .lg-steps { grid-template-columns: repeat(5, 1fr); gap: 0; }
    .lg-node { padding: 2px 1px; }
    .node-tag { display: none; }
}

/* ============================================================
   LangGraph · 多 Agent 协同推理卡
   ============================================================ */
.flow-card.lg-open { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 20px 18px; box-shadow: 0 4px 18px rgba(15, 66, 136, 0.08); margin: 10px 0; font-family: var(--font-body); }

/* 顶部 */
.lg-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.lg-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--ink); }
.lg-title .lg-mark { width: 18px; height: 18px; color: var(--blue-500); }
.lg-title span:last-child { letter-spacing: 0.1px; }
.hb-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--blue-500); box-shadow: 0 0 0 0 rgba(31, 111, 196, 0.6); flex-shrink: 0; }
.hb-dot.pulse { animation: hb-pulse 1.4s ease-out 1; }
@keyframes hb-pulse { 0% { box-shadow: 0 0 0 0 rgba(31, 111, 196, 0.6); } 100% { box-shadow: 0 0 0 10px rgba(31, 111, 196, 0); } }
.lg-progress { font-size: 12.5px; color: var(--ink-3); font-family: var(--font-mono); }
.lg-progress .current { color: var(--blue-600); font-weight: 700; }
.lg-header-right { display: flex; align-items: center; gap: 10px; }
.lg-toggle { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-3); background: transparent; border: none; cursor: pointer; padding: 4px 8px; border-radius: 6px; font-family: var(--font-body); transition: all 0.18s ease; }
.lg-toggle:hover { color: var(--blue-600); background: var(--blue-50); }
.lg-toggle svg { width: 12px; height: 12px; transition: transform 0.2s ease; }

/* 折叠状态：隐藏节点图与并行区，仅保留标题行 */
.flow-card.lg-open.collapsed { padding: 10px 16px; }
.flow-card.lg-open.collapsed .lg-steps,
.flow-card.lg-open.collapsed .lg-parallel { display: none; }
.flow-card.lg-open.collapsed .lg-header { margin-bottom: 0; padding-bottom: 0; border-bottom: none; cursor: pointer; }
.flow-card.lg-open.collapsed .lg-toggle svg { transform: rotate(180deg); }

/* 5 节点水平容器 */
.lg-steps { display: grid; grid-template-columns: 1fr 26px 1fr 26px 1fr 26px 1fr 26px 1fr; align-items: start; gap: 2px; padding: 8px 0 16px; }
.lg-node { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 3px; padding: 4px 2px; min-width: 0; }
.node-icon { width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; padding: 3px; background: var(--surface); border: 1.5px solid var(--line); color: var(--ink-4); transition: all 0.25s ease; position: relative; overflow: visible; }
.node-icon svg.bot { width: 100%; height: 100%; display: block; }
.node-name { font-size: 12.5px; font-weight: 600; color: var(--ink); line-height: 1.25; margin-top: 4px; }
.node-tag { font-size: 10.5px; color: var(--ink-4); line-height: 1.2; font-family: var(--font-mono); }
.node-status-text { font-size: 10.5px; color: var(--ink-4); margin-top: 2px; min-height: 13px; }

/* ---------- 机器人配色变量（每个元素用 var() 绑定到 .bot 的祖先状态） ---------- */
.bot .bot-skin        { fill: var(--bot-skin, #FFFFFF); stroke: var(--bot-stroke, #C8D1DD); }
.bot .bot-skin-solid  { fill: var(--bot-skin-solid, #E8EEF6); stroke: var(--bot-stroke, #C8D1DD); }
.bot .bot-face        { fill: var(--bot-face, #4A9DE8); transition: fill 0.25s ease; }
.bot .bot-eye         { fill: var(--bot-eye, #FFFFFF); }
.bot .bot-mouth       { stroke: var(--bot-eye, #FFFFFF); }
.bot .bot-limb        { fill: var(--bot-limb, #2A3B5A); }
.bot .bot-limb-dark   { fill: var(--bot-limb-dark, #1A2845); }
.bot .bot-cheek       { fill: var(--bot-cheek, #F4A28C); }
.bot .bot-badge-bg-check { fill: #16A34A; }
.bot .bot-badge-bg-cross { fill: #DC2626; }
.bot .bot-badge-check, .bot .bot-badge-cross { transition: opacity 0.3s ease; }

/* pending：灰化待机 */
.lg-node.pending .bot,
.parallel-row.pending .bot {
    --bot-skin: #DDE3EE; --bot-skin-solid: #B8C2D1;
    --bot-face: #9AA8BD; --bot-eye: #DDE3EE;
    --bot-limb: #8E9AAE; --bot-limb-dark: #6B7A8C;
    --bot-stroke: #B8C2D1; --bot-cheek: #C8B0A8;
}
.lg-node.pending .node-icon { background: var(--surface); border-color: var(--line); }
.lg-node.pending .node-name { color: var(--ink-3); }

/* running：原色 + 整体轻微呼吸 + 脸部轻微变深 + 眼睛眨眼 + 容器光晕 */
.lg-node.running .node-icon { background: var(--blue-50); border-color: var(--blue-400); animation: node-pulse 1.5s ease-in-out infinite; }
.lg-node.running .bot { animation: bot-breathe 1.6s ease-in-out infinite; transform-origin: 32px 60px; }
.lg-node.running .bot .bot-face { animation: bot-face-glow 1.4s ease-in-out infinite; }
.lg-node.running .bot .bot-eye { transform-box: fill-box; transform-origin: center; animation: bot-blink 2.2s ease-in-out infinite; }
.lg-node.running .bot .bot-eye-l { animation-delay: 0s; }
.lg-node.running .bot .bot-eye-r { animation-delay: 0.05s; }
.parallel-row.running .bot { animation: bot-breathe 1.6s ease-in-out infinite; transform-origin: 32px 60px; }
.parallel-row.running .bot .bot-eye { transform-box: fill-box; transform-origin: center; animation: bot-blink 2.4s ease-in-out infinite; }

@keyframes node-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(31, 111, 196, 0); } 50% { box-shadow: 0 0 0 6px rgba(31, 111, 196, 0.14); } }
@keyframes bot-breathe { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-1.5px); } }
@keyframes bot-face-glow { 0%,100% { fill: #4A9DE8; } 50% { fill: #1F6FC4; } }
@keyframes bot-blink {
    0%, 92%, 100% { transform: scaleY(1); }
    94%, 98% { transform: scaleY(0.2); }
}

/* completed：脸部变深蓝 + 右下绿勾徽章浮现 */
.lg-node.completed .bot { --bot-face: #1F6FC4; }
.lg-node.completed .bot .bot-badge-check { opacity: 1; }
.parallel-row.completed .bot .bot-badge-check { opacity: 1; }
.lg-node.completed .node-name { color: var(--ink); }
.lg-node.completed .node-tag { color: var(--blue-500); }
.lg-node.completed .node-status-text { color: var(--blue-600); font-weight: 500; }

/* failed：脸部变红 + 右下红叉徽章浮现 */
.lg-node.failed .bot { --bot-face: #DC2626; }
.lg-node.failed .bot .bot-badge-cross { opacity: 1; }
.parallel-row.failed .bot .bot-badge-cross { opacity: 1; }
.lg-node.failed .node-name { color: #DC2626; }
.lg-node.failed .node-status-text { color: #DC2626; }

/* 节点间箭头 */
.lg-arrow { display: grid; place-items: center; height: 38px; color: var(--line-2); margin-top: 0; }
.lg-arrow svg { width: 20px; height: 20px; }

/* 并行研判详情区 */
.lg-parallel { background: var(--blue-50); border: 1px solid var(--blue-100); border-radius: 12px; padding: 14px 16px 12px; }
.parallel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 8px; flex-wrap: wrap; }
.parallel-title { font-size: 12.5px; font-weight: 600; color: var(--ink); letter-spacing: 0.1px; }
.parallel-count { font-size: 12px; color: var(--blue-600); font-family: var(--font-mono); }
.parallel-count .cur { color: var(--blue-700); font-weight: 700; font-size: 14px; }

/* 文件行容器 */
.parallel-rows { display: flex; flex-direction: column; gap: 9px; min-height: 50px; align-content: start; }
.parallel-rows[data-empty="true"] { display: flex; align-items: center; justify-content: center; min-height: 80px; }
.parallel-empty { color: var(--ink-4); font-size: 12px; display: inline-flex; align-items: center; gap: 8px; }
.empty-spinner { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--blue-200); border-top-color: var(--blue-500); animation: spin 0.9s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 单个文件行 */
.parallel-row { display: flex; align-items: center; gap: 10px; padding: 9px 11px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; transition: all 0.22s ease; min-height: 50px; }
.row-avatar { flex-shrink: 0; position: relative; width: 34px; height: 34px; }
.avatar-bot { position: absolute; inset: 0; display: block; transition: opacity 0.22s ease; }
.avatar-bot .bot { width: 100%; height: 100%; display: block; }
.row-info { flex: 1; min-width: 0; }
.row-file { font-size: 12px; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-stage { font-size: 11px; color: var(--ink-3); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-progress { flex-shrink: 0; width: 60px; height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; position: relative; }
.progress-fill { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(90deg, var(--blue-300), var(--blue-500)); transform: translateX(-100%); }
.progress-fill.run { animation: flow 1.6s linear infinite; }
.progress-fill.full { transform: translateX(0); animation: none; opacity: 0.85; }
@keyframes flow { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.row-evidence { flex-shrink: 0; font-size: 11px; color: var(--ink-3); font-family: var(--font-mono); min-width: 56px; text-align: right; }

/* 文件行状态 */
.parallel-row.running .row-evidence { color: var(--blue-500); }
.parallel-row.completed { border-color: var(--blue-200); }
.parallel-row.completed .row-evidence { color: var(--blue-600); font-weight: 600; }
.parallel-row.completed .ok-tick { color: #16A34A; margin-left: 1px; }
.parallel-row.failed { border-color: #FCA5A5; background: #FEF2F2; }
.parallel-row.failed .row-stage { color: #DC2626; }
.parallel-row.failed .row-evidence .fail-tag { color: #DC2626; font-weight: 600; }

/* 底部摘要 */
.parallel-footer { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--blue-100); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; }
.footer-stats { display: flex; gap: 14px; flex-wrap: wrap; }
.footer-item { font-size: 12px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 4px; }
.footer-item strong { font-size: 13.5px; color: var(--ink); font-weight: 700; font-family: var(--font-mono); margin-left: 1px; }
.footer-item::before { content: ''; display: inline-block; width: 14px; height: 14px; font-size: 12px; line-height: 14px; text-align: center; flex-shrink: 0; }
.footer-item.ic-file::before { content: '📁'; }
.footer-item.ic-evi::before { content: '📋'; }
.footer-item.ic-con::before { content: '⚠'; }
.footer-item.ic-gap::before { content: '⊘'; }
.footer-item.ic-con strong { color: #B45309; }
.footer-item.ic-gap strong { color: #DC2626; }

.footer-status { font-size: 12px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.footer-status .status-running { display: inline-flex; align-items: center; gap: 6px; }
.footer-status .status-running::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--blue-500); animation: dot-blink 1.2s ease-in-out infinite; flex-shrink: 0; }
.footer-status .status-running.finished::before { display: none; }
.footer-status .status-running.finished { color: var(--blue-600); font-weight: 500; }
@keyframes dot-blink { 0%,100% { opacity: 0.3; } 50% { opacity: 1; } }

/* reliability badge */
.reliability-badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; background: var(--blue-50); border: 1px solid var(--blue-200); color: var(--blue-700); font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.18s ease; }
.reliability-badge:hover { background: var(--blue-100); border-color: var(--blue-300); }
.reliability-badge svg { width: 13px; height: 13px; color: var(--blue-500); }
.reliability-badge.open { background: var(--blue-100); }
.reliability-badge[data-level="中"] { background: #FEF3C7; border-color: #FCD34D; color: #92400E; }
.reliability-badge[data-level="中"] svg { color: #B45309; }
.reliability-badge[data-level="低"] { background: #FEE2E2; border-color: #FCA5A5; color: #991B1B; }
.reliability-badge[data-level="低"] svg { color: #DC2626; }
.reliability-badge[hidden] { display: none; }

/* reliability reasons panel */
.reliability-reasons { margin-top: 10px; padding: 11px 14px; background: var(--surface); border: 1px solid var(--blue-100); border-radius: 9px; }
.reliability-reasons[hidden] { display: none; }
.rr-title { font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.rr-list { padding-left: 18px; color: var(--ink-2); font-size: 12px; line-height: 1.75; }
.rr-list li::marker { color: var(--blue-500); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ============================================================
   访问密钥验证弹窗
   ============================================================ */
.auth-overlay {
    position: fixed; inset: 0; z-index: 100;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    background: radial-gradient(ellipse 80% 60% at 50% 30%, #F5F9FD 0%, #E6EEF8 60%, #DCE7F5 100%);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.auth-overlay.hidden { display: none; }
.auth-card {
    width: 100%; max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 36px 36px 26px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(15, 66, 136, 0.18), 0 4px 16px rgba(15, 66, 136, 0.10);
    animation: auth-in 0.4s ease;
}
@keyframes auth-in { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
.auth-icon {
    width: 60px; height: 60px; margin: 0 auto 14px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--blue-50), var(--blue-100));
    border: 1px solid var(--blue-200);
    border-radius: 18px;
    box-shadow: 0 6px 18px rgba(31, 111, 196, 0.14);
}
.auth-icon svg { width: 34px; height: 34px; }
.auth-name { font-weight: 700; font-size: 20px; color: var(--ink); letter-spacing: -0.2px; }
.auth-tag { font-size: 12px; color: var(--ink-3); margin-top: 2px; letter-spacing: 0.2px; }
.auth-title { font-family: var(--font-display); font-size: 17px; font-weight: 600; color: var(--ink); margin-top: 22px; }
.auth-desc { font-size: 13px; color: var(--ink-3); margin-top: 6px; line-height: 1.6; }
.auth-form { margin-top: 22px; display: flex; flex-direction: column; gap: 12px; }
.auth-input {
    width: 100%; padding: 12px 14px;
    border: 1.5px solid var(--line-2); border-radius: 10px;
    font-family: var(--font-body); font-size: 14.5px; color: var(--ink);
    background: var(--surface);
    outline: none; transition: border-color 0.2s ease, box-shadow 0.2s ease;
    letter-spacing: 1px;
}
.auth-input::placeholder { color: var(--ink-4); letter-spacing: 0; }
.auth-input:focus { border-color: var(--blue-500); box-shadow: 0 0 0 4px var(--accent-ring); }
.auth-submit {
    width: 100%; padding: 12px;
    border: none; border-radius: 10px;
    background: linear-gradient(135deg, var(--blue-400), var(--blue-700));
    color: #fff; font-size: 14.5px; font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(31, 111, 196, 0.30);
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.auth-submit:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(31, 111, 196, 0.40); }
.auth-submit:active:not(:disabled) { transform: translateY(0); }
.auth-submit:disabled { opacity: 0.6; cursor: not-allowed; }
.auth-error {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    margin-top: 14px; font-size: 12.5px; color: #DC2626;
    background: #FEF2F2; border: 1px solid #FCA5A5;
    border-radius: 8px; padding: 8px 10px;
}
.auth-error[hidden] { display: none; }
.auth-error svg { width: 14px; height: 14px; flex-shrink: 0; }
.auth-foot { margin-top: 16px; font-size: 11.5px; color: var(--ink-4); }

@media (max-width: 600px) {
    .auth-card { padding: 28px 24px 22px; }
}
