/* ═══════ 智能中枢（AI Agent 管理面板） ═══════ */
/* 宽度与工作台一致：跟随 .view.active 的 --content-max（1320px），不再内部收窄 */
.ai-agent-wrap { padding: 18px 4px 32px; width: 100%; max-width: none; display: flex; flex-direction: column; gap: 14px; }
/* 头部：标题行 + 独立 Tabs 行 */
.ai-agent-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 4px 2px 0; }
.ai-agent-title h2 { font-size: 24px; font-weight: 800; margin: 0; letter-spacing: -0.02em; }
.ai-agent-sub { font-size: 12.5px; color: var(--text-muted); }
.ai-agent-tabs { display: flex; gap: 4px; background: rgba(255,255,255,0.05); border: 1px solid var(--border, rgba(255,255,255,0.1)); padding: 5px; border-radius: 13px; width: 100%; overflow-x: auto; scrollbar-width: none; }
.ai-agent-tabs::-webkit-scrollbar { display: none; }
.aia-tab { border: none; background: transparent; color: var(--text-dim); font-size: 13px; font-weight: 600; padding: 9px 12px; border-radius: 9px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: 1 1 0; min-width: 92px; white-space: nowrap; transition: background .15s ease, color .15s ease; }
.aia-tab:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.aia-tab.active { background: rgba(74,222,128,0.16); color: #4ade80; box-shadow: inset 0 0 0 1px rgba(74,222,128,0.25); }
.aia-tab-badge { background: #f87171; color: #fff; font-size: 10.5px; border-radius: 999px; padding: 1px 7px; }
.ai-agent-actions { display: flex; align-items: center; gap: 14px; padding-bottom: 2px; }
.aia-global-switch { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-dim); }
.aia-refresh { border: 1px solid var(--border); background: rgba(255,255,255,0.06); color: var(--text); font-size: 12.5px; padding: 7px 14px; border-radius: 9px; cursor: pointer; }
.aia-refresh:hover { background: rgba(255,255,255,0.1); }
.ai-agent-body { display: flex; flex-direction: column; gap: 14px; }
.aia-page { display: none; }
.aia-page.active { display: flex; flex-direction: column; gap: 14px; }
.aia-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.aia-select, .aia-input { height: 34px; border-radius: 9px; border: 1px solid var(--border); background: rgba(255,255,255,0.05); color: var(--text); font-size: 13px; padding: 0 10px; outline: none; }
.aia-input { min-width: 180px; }
.aia-btn { border: 1px solid var(--border); background: rgba(255,255,255,0.06); color: var(--text); font-size: 12.5px; font-weight: 600; padding: 7px 14px; border-radius: 9px; cursor: pointer; }
.aia-btn:hover { background: rgba(255,255,255,0.12); }
.aia-btn.primary { background: rgba(74,222,128,0.16); border-color: rgba(74,222,128,0.45); color: #4ade80; }
.aia-btn.danger { background: rgba(248,113,113,0.14); border-color: rgba(248,113,113,0.45); color: #f87171; }
.aia-btn.warn { background: rgba(251,191,36,0.12); border-color: rgba(251,191,36,0.4); color: #fbbf24; }
.aia-btn:disabled { opacity: .45; cursor: not-allowed; }
.aia-link { border: none; background: none; color: #60a5fa; cursor: pointer; font-size: 12.5px; padding: 0; }
.aia-link:hover { text-decoration: underline; }
.aia-card { background: rgba(255,255,255,0.04); border: 1px solid var(--border, rgba(255,255,255,0.09)); border-radius: 16px; padding: 16px 18px; }
.aia-card-title { font-size: 13px; font-weight: 700; color: var(--text-dim); margin-bottom: 10px; }
.aia-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 900px) {
  .aia-grid2 { grid-template-columns: 1fr; }
  .aia-stats { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
  .aia-tab { min-width: 84px; }
  .aia-chat-layout { height: auto; min-height: 520px; flex-direction: column; }
  .aia-chat-sidebar { width: 100%; max-height: 180px; }
}
.aia-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.aia-stat { background: rgba(255,255,255,0.04); border: 1px solid var(--border); border-radius: 14px; padding: 14px 12px; text-align: center; transition: background .15s ease, transform .15s ease; }
.aia-stat:hover { background: rgba(255,255,255,0.07); transform: translateY(-1px); }
.aia-stat-num { font-size: 30px; font-weight: 800; color: var(--text); }
.aia-stat-num.ok { color: #4ade80; }
.aia-stat-num.err { color: #f87171; }
.aia-stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.aia-plugin-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.aia-plugin-row:last-child { border-bottom: none; }
.aia-plugin-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.aia-plugin-name { font-size: 11.5px; color: var(--text-muted); }
.aia-rowline { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.aia-rowline:last-child { border-bottom: none; }
.aia-row-main { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.aia-row-sub { color: var(--text-muted); font-size: 11.5px; }
.aia-chip { font-size: 10.5px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-dim); background: rgba(255,255,255,0.06); flex-shrink: 0; }
.aia-chip.chip-ok { color: #4ade80; border-color: rgba(74,222,128,0.35); background: rgba(74,222,128,0.1); }
.aia-chip.chip-err { color: #f87171; border-color: rgba(248,113,113,0.35); background: rgba(248,113,113,0.1); }
.aia-chip.chip-warn { color: #fbbf24; border-color: rgba(251,191,36,0.35); background: rgba(251,191,36,0.1); }
.aia-chip.chip-dim { opacity: .55; }
.aia-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.aia-table th { text-align: left; color: var(--text-muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 11.5px; white-space: nowrap; }
.aia-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.aia-table tr:hover td { background: rgba(255,255,255,0.03); }
.aia-table-wrap { background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: 12px; overflow: auto; }
.aia-mono { font-family: ui-monospace, Menlo, monospace; font-size: 11.5px; }
.aia-empty { text-align: center; color: var(--text-muted); font-size: 13px; padding: 34px 16px; }
.aia-note { line-height: 1.7; }
.aia-sub-tabs { display: flex; gap: 6px; }
.aia-subtab { border: none; background: transparent; color: var(--text-dim); font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: 8px; cursor: pointer; }
.aia-subtab.active { background: rgba(74,222,128,0.14); color: #4ade80; }
/* 变更审核卡片 */
.aia-review-card { background: rgba(255,255,255,0.04); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; }
.aia-review-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.aia-review-head strong { font-size: 14px; }
.aia-review-meta { font-size: 11.5px; color: var(--text-muted); margin: 4px 0 10px; }
.aia-review-section { margin-top: 10px; }
.aia-field-label { display: block; font-size: 11px; font-weight: 700; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .3px; }
.aia-text { font-size: 12.5px; color: var(--text); line-height: 1.7; white-space: pre-wrap; }
.aia-file { display: inline-block; background: rgba(255,255,255,0.06); border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px; font-size: 11.5px; margin: 2px 4px 2px 0; font-family: ui-monospace, Menlo, monospace; }
.aia-review-actions { display: flex; gap: 8px; margin-top: 12px; }
/* 代码高亮 */
.aia-code { background: rgba(0,0,0,0.35); border: 1px solid var(--border); border-radius: 10px; overflow: auto; max-height: 320px; padding: 8px 0; font-family: ui-monospace, Menlo, monospace; font-size: 12px; line-height: 1.5; }
.aia-code-line { white-space: pre; padding: 0 12px; color: #d4d4d8; }
.aia-code-line.aia-diff-add { background: rgba(74,222,128,0.10); color: #86efac; }
.aia-code-line.aia-diff-del { background: rgba(248,113,113,0.10); color: #fca5a5; }
.aia-code-line.aia-diff-meta { color: #7dd3fc; background: rgba(59,130,246,0.08); }
.aia-code-line.aia-diff-head { color: #c4b5fd; }
.aia-doc { background: rgba(0,0,0,0.35); border: 1px solid var(--border); border-radius: 10px; padding: 12px; font-size: 12.5px; line-height: 1.7; white-space: pre-wrap; color: var(--text); }
.aia-json { background: rgba(0,0,0,0.35); border: 1px solid var(--border); border-radius: 10px; padding: 10px; font-family: ui-monospace, Menlo, monospace; font-size: 11.5px; overflow: auto; max-height: 260px; color: #a5b4fc; white-space: pre-wrap; }
.aia-json.err { color: #fca5a5; }
.aia-field { margin-top: 10px; }
/* 弹窗 */
.aia-modal-overlay .ui-modal-card { max-width: 720px; overflow: hidden; }
.aia-modal { display: flex; flex-direction: column; max-height: 82vh; }
.aia-modal-title { font-size: 15px; font-weight: 800; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.aia-modal-body { padding: 12px 16px; overflow: auto; }
.aia-modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.aia-note { width: 100%; min-height: 90px; border-radius: 9px; border: 1px solid var(--border); background: rgba(255,255,255,0.05); color: var(--text); font-size: 13px; padding: 8px 10px; resize: vertical; }
/* 开关 */
.aia-toggle { width: 38px; height: 20px; border-radius: 999px; border: 1px solid var(--border); background: rgba(255,255,255,0.1); position: relative; cursor: pointer; transition: all .15s ease; flex-shrink: 0; }
.aia-toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: all .15s ease; }
.aia-toggle.on { background: rgba(74,222,128,0.8); border-color: rgba(74,222,128,0.9); }
.aia-toggle.on::after { left: 20px; }
.aia-toggle:disabled { opacity: .5; cursor: not-allowed; }
/* 浅色主题适配 */
html[data-theme="light"] .aia-card,
html[data-theme="light"] .aia-review-card { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.10); }
html[data-theme="light"] .aia-table-wrap { background: #fff; border-color: rgba(0,0,0,0.10); }
html[data-theme="light"] .aia-code,
html[data-theme="light"] .aia-json,
html[data-theme="light"] .aia-doc { background: #f4f4f5; border-color: rgba(0,0,0,0.12); color: #1f2937; }
html[data-theme="light"] .aia-code-line { color: #374151; }
html[data-theme="light"] .aia-code-line.aia-diff-add { background: rgba(22,163,74,0.10); color: #15803d; }
html[data-theme="light"] .aia-code-line.aia-diff-del { background: rgba(220,38,38,0.10); color: #b91c1c; }
html[data-theme="light"] .aia-json { color: #4338ca; }
html[data-theme="light"] .aia-json.err { color: #b91c1c; }
/* 业务记忆页 */
.aia-tool-label { font-size: 12px; color: var(--muted, #9ca3af); margin-left: 4px; }
.aia-memory-meta { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 10px; border: 1px solid var(--border); border-radius: 12px; background: rgba(255,255,255,0.03); }
.aia-note { width: 100%; min-height: 90px; border-radius: 9px; border: 1px solid var(--border); background: rgba(255,255,255,0.05); color: var(--text); font-size: 13px; padding: 8px 10px; resize: vertical; }
input.aia-note { min-height: 38px; height: 38px; }
/* 模型设置（卡片式） */
.aia-llm-overlay .ui-modal-card { max-width: 760px; width: 92%; }
.aia-llm .aia-modal-body { max-height: 70vh; overflow-y: auto; }
.aia-llm-section { border: 1px solid var(--border, rgba(255,255,255,0.1)); border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; background: rgba(255,255,255,0.03); }
.aia-llm-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.aia-llm-sec-head strong { font-size: 13.5px; }
.aia-llm-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.aia-llm-defsel { flex: 1; min-width: 180px; }
.aia-llm-definput { flex: 1; min-width: 180px; }
.aia-llm-card { border: 1px solid var(--border, rgba(255,255,255,0.1)); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; background: rgba(255,255,255,0.04); }
.aia-llm-card-head { display: flex; align-items: center; gap: 10px; }
.aia-llm-dot { width: 10px; height: 10px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 8px rgba(74,222,128,0.6); flex-shrink: 0; }
.aia-llm-card-name { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.aia-llm-card-name strong { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aia-llm-card-actions { display: flex; align-items: center; gap: 8px; }
.aia-llm-card-grid { display: grid; grid-template-columns: 1.6fr 1fr 0.8fr 1fr; gap: 8px 16px; margin-top: 10px; }
.aia-llm-item { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.aia-llm-label { font-size: 11px; color: var(--text-muted, #9ca3af); }
.aia-llm-value { font-size: 12.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aia-llm-weight { display: inline-flex; align-items: center; gap: 8px; }
.aia-llm-weight .aia-btn { padding: 2px 9px; font-size: 13px; line-height: 1.2; }
.aia-llm-weight b { min-width: 18px; text-align: center; }
.aia-llm-formcard { border: 1px solid rgba(74,222,128,0.35); border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; background: rgba(74,222,128,0.05); }
.aia-llm-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.aia-llm-field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text-dim); }
.aia-llm-field .aia-input { width: 100%; }
.aia-llm-check { flex-direction: row; align-items: center; gap: 8px; font-size: 12.5px; }
.aia-llm-form-actions { display: flex; justify-content: flex-end; margin-top: 12px; }
.aia-llm-note { font-size: 11.5px; color: var(--text-muted, #9ca3af); line-height: 1.7; }
html[data-theme="light"] .aia-llm-section { background: #fafafa; }
html[data-theme="light"] .aia-llm-card { background: #fff; }
html[data-theme="light"] .aia-llm-formcard { background: rgba(22,163,74,0.06); }
@media (max-width: 640px) {
  .aia-llm-card-grid { grid-template-columns: 1fr 1fr; }
  .aia-llm-grid2 { grid-template-columns: 1fr; }
}
/* 对话工作台 */
.aia-chat-layout { display: flex; height: calc(100vh - 205px); min-height: 440px; gap: 14px; }
.aia-chat-sidebar { width: 230px; flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; }
.aia-chat-new { width: 100%; }
.aia-chat-convs { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.aia-chat-conv { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; transition: background .15s ease; }
.aia-chat-conv:hover { background: rgba(255,255,255,0.05); }
.aia-chat-conv.active { background: rgba(74,222,128,0.12); border-color: rgba(74,222,128,0.5); }
.aia-chat-conv-title { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aia-chat-conv-sub { font-size: 11px; color: var(--muted, #9ca3af); margin-top: 2px; }
.aia-chat-main { flex: 1; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; min-width: 0; }
.aia-chat-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); font-weight: 600; }
.aia-chat-history { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.aia-chat-msg { display: flex; }
.aia-chat-msg.user { justify-content: flex-end; }
.aia-chat-msg.assistant { justify-content: flex-start; }
.aia-chat-bubble { max-width: 82%; padding: 10px 14px; border-radius: 12px; font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.aia-chat-bubble.user { background: rgba(74,222,128,0.15); border: 1px solid rgba(74,222,128,0.35); }
.aia-chat-bubble.assistant { background: rgba(255,255,255,0.05); border: 1px solid var(--border); width: 82%; }
.aia-chat-plan-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.aia-chat-plan-sec { margin-top: 8px; }
.aia-chat-plan-sec ul { margin: 4px 0 0 18px; padding: 0; }
.aia-chat-actions { display: flex; gap: 10px; margin-top: 12px; }
.aia-chat-welcome { text-align: center; color: var(--muted, #9ca3af); padding: 40px 20px; font-size: 14px; line-height: 1.9; }
.aia-chat-inputbar { display: flex; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--border); align-items: flex-end; }
.aia-chat-inputbar textarea { flex: 1; min-height: 44px; max-height: 120px; border-radius: 10px; border: 1px solid var(--border); background: rgba(255,255,255,0.05); color: var(--text); font-size: 13px; padding: 10px 12px; resize: vertical; }
.aia-chat-inputbar textarea:disabled { opacity: .5; }
.aia-chat-hint { padding: 6px 14px; font-size: 11px; color: var(--muted, #9ca3af); border-top: 1px dashed var(--border); }
html[data-theme="light"] .aia-chat-bubble.assistant { background: #fff; border-color: rgba(0,0,0,0.10); }
html[data-theme="light"] .aia-chat-bubble.user { background: rgba(22,163,74,0.10); border-color: rgba(22,163,74,0.25); }
html[data-theme="light"] .aia-chat-conv:hover { background: rgba(0,0,0,0.04); }
/* 对话附件与项目方案 */
.aia-chat-attachbar { padding: 0 14px 8px; display: flex; gap: 8px; align-items: center; }
.aia-chat-attachbar .aia-file { display: inline-flex; align-items: center; gap: 6px; }
.aia-proj-file { margin: 4px 0; border: 1px solid var(--border); border-radius: 8px; background: rgba(255,255,255,0.03); }
.aia-proj-file summary { padding: 6px 10px; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--text); }
.aia-proj-file summary .aia-row-sub { color: var(--muted, #9ca3af); font-weight: 400; }
.aia-proj-file pre { margin: 0; border-top: 1px solid var(--border); border-radius: 0 0 8px 8px; max-height: 220px; overflow: auto; }
html[data-theme="light"] .aia-proj-file { background: #fafafa; }
/* 全局对话输入框（智能中枢底部 dock） */
.aia-dock { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; padding: 16px 18px 18px; border: 1px solid var(--border, rgba(255,255,255,0.1)); border-radius: 18px; background: rgba(255,255,255,0.04); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.aia-dock-box { display: flex; align-items: flex-end; gap: 12px; width: 100%; }
.aia-dock-add { width: 44px; height: 44px; flex-shrink: 0; border-radius: 12px; border: 1px dashed var(--border, rgba(255,255,255,0.22)); background: rgba(255,255,255,0.05); color: var(--text-dim); font-size: 22px; font-weight: 300; cursor: pointer; display: flex; align-items: center; justify-content: center; transform: skewX(-6deg); transition: background .15s ease, border-color .15s ease; }
.aia-dock-add:hover { background: rgba(255,255,255,0.1); border-color: rgba(74,222,128,0.5); color: #4ade80; }
.aia-dock-inputwrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.aia-dock-inputwrap textarea { width: 100%; border: none; background: transparent; color: var(--text); font-size: 15px; line-height: 1.6; padding: 8px 2px; resize: none; outline: none; min-height: 44px; max-height: 140px; }
.aia-dock-inputwrap textarea::placeholder { color: var(--text-muted, #9ca3af); }
.aia-dock-inputwrap textarea:disabled { opacity: .5; }
.aia-dock-attach { display: flex; gap: 8px; align-items: center; min-height: 20px; }
.aia-dock-attach .aia-file { font-size: 12px; }
.aia-dock-send { width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; border: none; background: rgba(74,222,128,0.85); color: #06281a; font-size: 20px; font-weight: 800; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform .15s ease, background .15s ease; }
.aia-dock-send:hover { transform: translateY(-1px); background: #4ade80; }
.aia-dock-send:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.aia-dock-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-dim); }
.aia-dock-agent { color: #22d3ee; display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.aia-dock-at { color: #22d3ee; opacity: .8; }
.aia-dock-hint { color: var(--text-muted, #9ca3af); margin-left: auto; font-size: 11.5px; }
html[data-theme="light"] .aia-dock { background: #fff; border-color: rgba(0,0,0,0.10); }
html[data-theme="light"] .aia-dock-send { background: #16a34a; color: #fff; }
@media (max-width: 700px) {
  .aia-dock-hint { display: none; }
}
/* 智能中枢仪表盘（中间主体） */
.aia-dash-grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.aia-dash-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 1100px) {
  .aia-dash-grid3 { grid-template-columns: 1fr; }
  .aia-dash-grid2 { grid-template-columns: 1fr; }
}

/* 右侧 Sheet：对话工作台 */
.aia-sheet-overlay { position: fixed; inset: 0; z-index: 3000; background: rgba(0,0,0,0.45); display: flex; justify-content: flex-end; opacity: 0; transition: opacity .2s ease; }
.aia-sheet-overlay.show { opacity: 1; }
.aia-sheet { width: min(560px, 94vw); height: 100%; background: var(--bg-elevated, #1c1c1e); border-left: 1px solid var(--border, rgba(255,255,255,0.1)); display: flex; flex-direction: column; transform: translateX(100%); transition: transform .25s cubic-bezier(0.16,1,0.3,1); box-shadow: -12px 0 32px rgba(0,0,0,0.35); }
.aia-sheet-overlay.show .aia-sheet { transform: translateX(0); }
.aia-sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border, rgba(255,255,255,0.1)); }
.aia-sheet-head strong { font-size: 15px; }
.aia-sheet-body { flex: 1; min-height: 0; padding: 12px 14px; }
.aia-sheet-body .aia-chat-layout { height: 100%; min-height: 0; }
html[data-theme="light"] .aia-sheet { background: #fff; }
.aia-sheet-overlay[hidden] { display: none !important; }
/* Sheet 内 FF 智能体风格适配 */
.aia-sheet-agent .aia-agent-sheet { height: 100%; display: flex; flex-direction: column; overflow: hidden; border: none; }
.aia-sheet-agent .cr-agent-messages { flex: 1; min-height: 0; }
.aia-sheet-agent .cr-agent-input { border-top: 1px solid var(--border, rgba(255,255,255,0.1)); }
.aia-sheet-agent .cr-agent-msg-avatar { width: 26px; height: 26px; font-size: 11px; }
.aia-sheet-agent .cr-agent-msg-bubble { max-width: 100%; }
.aia-sheet-agent .cr-agent-history { z-index: 5; }
/* 智能中枢：仪表盘主体 + 右侧固定 FF 智能体面板（与消息中心同款位置） */
#view-ai-agent.active { max-width: none; }
.ai-agent-layout { display: flex; min-height: 0; width: 100%; }
.ai-agent-dash { flex: 1; min-width: 0; margin-right: 400px; overflow-y: auto; transition: margin-right .2s ease; }
.ai-agent-inspector {
  position: fixed; right: 0; top: 0; bottom: 0; width: 400px; min-width: 340px; max-width: 480px;
  z-index: 1500; background: var(--bg-elevated, #16161a);
  border-left: 1px solid var(--border, rgba(255,255,255,0.1));
  box-shadow: -8px 0 24px rgba(0,0,0,0.2);
}
.ai-agent-inspector[hidden] { display: none; }
.ai-agent-inspector .cr-agent-panel { height: 100%; }
.ai-agent-inspector .cr-agent-messages { flex: 1; min-height: 0; }
html[data-theme="light"] .ai-agent-inspector { background: #fff; }
@media (max-width: 1100px) {
  .ai-agent-inspector { width: 360px; }
  .ai-agent-dash { margin-right: 360px; }
}
@media (max-width: 860px) {
  .ai-agent-inspector { width: 100%; max-width: 100%; }
  .ai-agent-dash { margin-right: 0; }
}
/* right-panel 内对话工作台（FF 智能体风格） */
#rightBody .ai-agent-sheet { display: flex; flex-direction: column; min-height: 0; }
#rightBody .cr-agent-messages { flex: 1; min-height: 220px; overflow-y: auto; }
#rightBody .cr-agent-welcome { min-height: 200px; }
#rightBody .cr-agent-history { z-index: 5; }
/* 历史会话层：毛玻璃 */
#rightBody .cr-agent-history {
  background: rgba(22, 24, 30, 0.72);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  border-radius: 12px;
  margin: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
html[data-theme="light"] #rightBody .cr-agent-history {
  background: rgba(255,255,255,0.78);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
/* 面板加宽后 min-width 同步 */
.ai-agent-inspector { min-width: 340px; }
/* 对话输入框（融入 FF 智能体：背景透明，无独立容器） */
#rightBody .ai-chat-composer {
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 6px 2px 4px;
}
.ai-composer-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ai-composer-agent {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; color: #22d3ee;
  border: 1px solid rgba(34,211,238,0.35); background: rgba(34,211,238,0.08);
  border-radius: 999px; padding: 3px 10px; cursor: pointer;
  transition: background .15s ease;
}
.ai-composer-agent:hover { background: rgba(34,211,238,0.16); }
html[data-theme="light"] .ai-composer-agent { color: #0e7490; border-color: rgba(14,116,144,0.35); background: rgba(14,116,144,0.08); }
.ai-composer-tool { width: 26px; height: 26px; border: none; background: transparent; color: var(--text-dim); border-radius: 7px; cursor: pointer; display: inline-grid; place-items: center; }
.ai-composer-tool:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.ai-composer-tool svg { width: 15px; height: 15px; }
.ai-composer-badge { font-size: 11px; color: var(--text-muted); border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; background: rgba(255,255,255,0.04); }
.ai-composer-input { width: 100%; border: none; background: transparent; color: var(--text); font-size: 13.5px; line-height: 1.6; padding: 6px 2px 2px; resize: none; outline: none; min-height: 40px; max-height: 130px; }
.ai-composer-input::placeholder { color: var(--text-muted, #9ca3af); }
.ai-composer-input:disabled { opacity: .5; }
.ai-composer-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.ai-composer-left { display: flex; align-items: center; gap: 8px; }
.ai-composer-hint { font-size: 11px; color: var(--text-muted, #9ca3af); }
.ai-composer-right { display: flex; align-items: center; gap: 8px; }
.ai-composer-model { font-size: 11.5px; color: var(--text-dim); border: 1px solid var(--border); border-radius: 999px; padding: 2px 9px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-composer-send { width: 32px; height: 32px; border-radius: 50%; border: none; background: rgba(255,255,255,0.12); color: #fff; cursor: pointer; display: inline-grid; place-items: center; transition: background .15s ease, transform .15s ease; flex-shrink: 0; }
.ai-composer-send:hover { background: rgba(74,222,128,0.75); transform: translateY(-1px); }
.ai-composer-send:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.ai-composer-send svg { width: 15px; height: 15px; }
.ai-composer-note { font-size: 10.5px; color: var(--text-muted, #9ca3af); text-align: center; padding-top: 4px; }
html[data-theme="light"] #rightBody .ai-chat-composer { background: #fff; box-shadow: 0 6px 18px rgba(0,0,0,0.08); }
html[data-theme="light"] .ai-composer-send { background: #3f3f46; }
/* 发送按钮生成中状态：保留图标，轻微旋转动效 */
.ai-composer-send.loading svg { animation: ai-send-spin .8s linear infinite; }
@keyframes ai-send-spin { to { transform: rotate(360deg); } }
.ai-composer-send.loading { opacity: .6; }
html[data-theme="light"] .ai-composer-badge { color: #4b5563; border-color: rgba(0,0,0,0.12); background: rgba(0,0,0,0.03); }
html[data-theme="light"] .ai-composer-tool { color: #4b5563; }
html[data-theme="light"] .ai-composer-tool:hover { background: rgba(0,0,0,0.06); color: #111827; }
html[data-theme="light"] .ai-composer-model { color: #374151; border-color: rgba(0,0,0,0.14); }
html[data-theme="light"] .ai-composer-send { background: #3f3f46; color: #fff; }
html[data-theme="light"] .ai-composer-hint,
html[data-theme="light"] .ai-composer-note { color: #6b7280; }
/* 智能中枢对话工作台输入框：去分隔线/底色 + 边框底纹 */
#rightBody .cr-agent-input { border-top: none; background: transparent; }
#rightBody .ai-chat-composer { border: 1px solid var(--border, rgba(255,255,255,0.12)); border-radius: 14px; padding: 8px 10px 6px; background: transparent; }
html[data-theme="light"] #rightBody .ai-chat-composer { border-color: rgba(0,0,0,0.14); }
