/* panel.css — 詹老师的AIPROS 侧边栏面板样式
   前缀 .aic- 用于隔离，避免与宿主页面样式冲突
   注入到页面的元素均使用 aic- 前缀
*/

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --ui-ink: #181818;
  --ui-ink-soft: #34322e;
  --ui-muted: #716d64;
  --ui-faint: #9a9489;
  --ui-line: #ded8cb;
  --ui-line-strong: #c8bfae;
  --ui-bg: #f7f4ed;
  --ui-bg-cool: #f1eee7;
  --ui-surface: #fffdf7;
  --ui-surface-2: #f8f6f0;
  --ui-raised: #ffffff;
  --ui-brand: #2d2b27;
  --ui-brand-deep: #111111;
  --ui-brand-mid: #4a4640;
  --ui-brand-soft: #f0ece2;
  --ui-info: #4f6f86;
  --ui-info-soft: #edf4f6;
  --ui-accent: #c6a15b;
  --ui-accent-deep: #84632b;
  --ui-accent-soft: #f7efd9;
  --ui-success: #60737d;
  --ui-success-soft: #edf3f5;
  --ui-danger: #8f7134;
  --ui-danger-soft: #fff2d4;
  --ui-shadow-sm: 0 1px 2px rgba(24, 24, 24, 0.08);
  --ui-shadow-md: 0 12px 32px rgba(24, 24, 24, 0.12);
  --ui-shadow-lg: 0 24px 70px rgba(24, 24, 24, 0.18);
  --ui-radius: 8px;
  --ui-radius-sm: 6px;
}

html, body {
  width: 100%;
  min-width: 280px;
  height: 100%;
  min-height: 0;
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 13px;
  color: #1a1a2e;
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ===== 面板头 ===== */
.panel-header {
  background: var(--ui-brand);
  color: white;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.panel-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-logo {
  width: 26px; height: 26px;
  background: rgba(255,255,255,0.2);
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.panel-title { font-size: 13px; font-weight: bold; line-height: 1.2; }
.panel-close-btn {
  background: none;
  border: none;
  color: #aaa;
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.2s, background 0.2s;
}
.panel-close-btn:hover {
  color: var(--ui-danger);
  background: var(--ui-danger-soft);
}

/* ===== 上下文条 ===== */
.panel-context-bar {
  background: #f7f8fa;
  border-bottom: 1px solid #eee;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.context-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #666;
  overflow: hidden;
}
.context-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #d9d9d9;
  flex-shrink: 0;
  transition: background 0.3s;
}
.context-dot.active { background: var(--ui-success); }
.context-dot.warn { background: #faad14; }
.context-dot.loading {
  background: var(--ui-brand);
  animation: pulse 1s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.3} }
.context-refresh {
  font-size: 14px;
  color: #bbb;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.2s;
}
.context-refresh:hover { color: var(--ui-brand); }

/* ===== URL 解析条 ===== */
.url-context-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-bottom: 1px solid #eceff3;
  background: #ffffff;
  flex-shrink: 0;
}
.url-context-input {
  flex: 1;
  min-width: 0;
  height: 30px;
  border: 1px solid #d8dee8;
  border-radius: 6px;
  padding: 0 9px;
  font-size: 12px;
  color: #1f2933;
  outline: none;
  font-family: inherit;
}
.url-context-input:focus {
  border-color: var(--ui-accent);
  box-shadow: 0 0 0 2px rgba(198, 161, 91, 0.14);
}
.url-context-btn {
  height: 30px;
  padding: 0 10px;
  border: none;
  border-radius: 6px;
  background: var(--ui-brand);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.url-context-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ===== 顶部设置按钮 ===== */
.panel-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}
.panel-settings-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.75);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.2s, background 0.2s;
}
.panel-settings-btn:hover {
  color: #fff;
  background: rgba(255,255,255,0.15);
}

/* ===== Skill 浮层（输入框 / 调出） ===== */
.skill-popup {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  margin-bottom: 4px;
  z-index: 100;
  overflow: hidden;
}
.skill-popup-search {
  width: 100%;
  border: none;
  border-bottom: 1px solid #f0f0f0;
  padding: 8px 10px;
  font-size: 12px;
  outline: none;
  font-family: inherit;
}
.skill-popup-list {
  max-height: 180px;
  overflow-y: auto;
  padding: 4px 0;
}
.skill-popup-item {
  padding: 7px 12px;
  font-size: 12px;
  cursor: pointer;
  color: #333;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}
.skill-popup-item:hover {
  background: #f0f0ff;
  color: var(--ui-brand);
}
.skill-popup-item .skill-popup-badge {
  font-size: 11px;
  opacity: 0.6;
}
.skill-popup-empty {
  padding: 12px;
  text-align: center;
  color: #999;
  font-size: 12px;
}

.skill-benchmark-card,
.agent-policy-card,
.automation-queue-card {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
  margin: 8px 0 10px;
}
.skill-benchmark-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px 72px;
  gap: 8px;
  align-items: center;
}
.skill-benchmark-main {
  min-width: 0;
}
.skill-benchmark-score {
  height: 32px;
  text-align: center;
}
.skill-benchmark-btn {
  height: 32px;
  padding: 0 10px;
}
.skill-benchmark-result {
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: var(--ui-info-soft);
  color: #1e3a8a;
  padding: 8px 10px;
  margin: 8px 0;
  font-size: 12px;
  line-height: 1.5;
  max-height: 180px;
  overflow-y: auto;
}
.skill-benchmark-result.err {
  border-color: #fecaca;
  background: var(--ui-danger-soft);
  color: var(--ui-danger);
}
.agent-policy-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0;
}
.agent-policy-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: #475569;
}
.agent-policy-paths {
  min-height: 54px;
  margin-top: 6px;
}

/* ===== 选中 Skill 标签 ===== */
.selected-skill-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f0f0ff;
  color: var(--ui-brand);
  border: 1px solid #d9d0ff;
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 11px;
  margin: 4px 0;
  white-space: nowrap;
}
.selected-skill-tag .tag-remove {
  cursor: pointer;
  font-size: 13px;
  opacity: 0.6;
  margin-left: 2px;
}
.selected-skill-tag .tag-remove:hover {
  opacity: 1;
}

/* ===== 输出区 ===== */
.panel-output {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  min-height: 0;
}
.panel-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #bbb;
  text-align: center;
  padding: 20px;
}
.panel-empty-icon { font-size: 32px; margin-bottom: 8px; opacity: 0.5; }
.panel-empty-text { font-size: 12px; line-height: 1.7; }

.stream-output {
  padding: 12px;
  font-size: 12px;
  line-height: 1.8;
  color: #333;
  display: none;
}
.stream-loading {
  color: #999;
  font-size: 12px;
  padding: 8px 0;
  animation: pulse 1.2s infinite;
}
.stream-error {
  color: var(--ui-danger);
  font-size: 12px;
  padding: 6px 0;
}
.section-tag {
  color: var(--ui-brand);
  font-weight: bold;
}
.risk-high { color: var(--ui-danger); }
.risk-mid { color: #d46b08; }
.risk-ok { color: var(--ui-success); }

/* 离线提示 */
.offline-hint {
  text-align: center;
  padding: 20px 12px;
  color: #888;
}
.offline-icon { font-size: 28px; margin-bottom: 8px; }
.offline-title { font-size: 13px; font-weight: bold; color: #1a1a2e; margin-bottom: 8px; }
.offline-body { font-size: 11px; line-height: 1.8; margin-bottom: 12px; }
.offline-body code {
  display: block;
  background: #f5f5f5;
  border-radius: 3px;
  padding: 2px 6px;
  font-family: monospace;
  color: #333;
  margin: 2px 0;
}
.btn-retry {
  background: var(--ui-brand);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 6px 16px;
  font-size: 12px;
  cursor: pointer;
}
.btn-retry:hover { opacity: 0.85; }

/* ===== 操作区（填入结果按钮现在在chat-label里，保留样式） ===== */
.btn-fill {
  background: white;
  color: var(--ui-brand);
  border: 1.5px solid var(--ui-brand);
  border-radius: 5px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-fill:hover { background: var(--ui-brand); color: white; }

/* ===== 底部状态栏 ===== */
.panel-footer {
  background: #fafafa;
  border-top: 1px solid #eee;
  padding: 5px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.footer-status {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: #bbb;
}

/* ===== 对话框（现在是主输出区，flex:1 撑满） ===== */
.panel-chat {
  border-top: 2px solid #ede9ff;
  background: white;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

/* ===== Agent 执行闭环 ===== */
.agent-loop-panel {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 20;
  width: 25%;
  margin: 0;
  border: 1px solid #d9e2f2;
  border-radius: 8px;
  background: #f8fbff;
  overflow: hidden;
  max-height: calc(100% - 86px);
  flex-shrink: 0;
  transition: width 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease, transform 0.22s ease;
}
.agent-loop-panel.collapsed {
  width: 12%;
  min-width: 48px;
  margin: 0;
  border-radius: 999px;
}
.agent-loop-header {
  min-height: 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3px;
  padding: 3px 4px 3px 5px;
  border-bottom: 1px solid #e5edf8;
  background: #ffffff;
}
.agent-loop-title-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}
.agent-loop-kicker {
  display: none;
  font-size: 8px;
  color: #64748b;
  line-height: 1;
}
.agent-loop-title {
  font-size: 10px;
  font-weight: 700;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 34px;
}
.agent-loop-panel.collapsed .agent-loop-kicker {
  display: none;
}
.agent-loop-panel.collapsed .agent-loop-title-wrap {
  display: none;
}
.agent-loop-panel.expanded .agent-loop-title-wrap {
  display: none;
}
.agent-loop-panel.expanded .agent-loop-header {
  justify-content: flex-end;
}
.agent-loop-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.agent-loop-status {
  width: 6px;
  height: 6px;
  padding: 0;
  font-size: 0;
  border-radius: 999px;
  color: #fff;
  background: #64748b;
  white-space: nowrap;
}
.agent-loop-panel.collapsed .agent-loop-status {
  box-shadow: 0 0 0 3px rgba(198, 161, 91, 0.1);
}
.agent-loop-status.running { background: var(--ui-info); }
.agent-loop-status.completed { background: var(--ui-success); }
.agent-loop-status.failed { background: var(--ui-danger); }
.agent-loop-status.stale { background: var(--ui-accent); }
.agent-loop-btn {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
}
.agent-loop-btn:hover { background: #f1f5f9; }
.agent-loop-btn.muted { color: #64748b; }
.agent-loop-icon-btn {
  width: 18px;
  height: 18px;
  border: 1px solid rgba(198, 161, 91, 0.26);
  background: rgba(255, 253, 247, 0.82);
  color: var(--ui-brand);
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}
.agent-loop-icon-btn:hover {
  background: var(--ui-brand-soft);
  color: var(--ui-brand-deep);
  border-color: rgba(198, 161, 91, 0.45);
  transform: translateY(-1px);
}
.agent-loop-icon-btn.muted {
  color: var(--ui-muted);
}
.agent-loop-icon {
  width: 10px;
  height: 10px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.agent-loop-panel .icon-collapse {
  display: none;
}
.agent-loop-panel.expanded .icon-expand {
  display: none;
}
.agent-loop-panel.expanded .icon-collapse {
  display: block;
}
.agent-loop-body {
  padding: 4px 4px 5px;
}
.agent-loop-elapsed {
  display: none;
  margin: 0 0 4px;
  padding: 1px 2px;
  color: var(--ui-muted);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.agent-loop-elapsed.visible {
  display: block;
  animation: elapsed-soft-in 0.22s ease-out;
}
.agent-loop-elapsed.running::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 4px;
  margin-right: 5px;
  border-radius: 999px;
  background: var(--ui-info);
  vertical-align: 1px;
  opacity: 0.62;
  animation: elapsed-dot-pulse 1.8s ease-in-out infinite;
}
.agent-loop-elapsed.completed::before,
.agent-loop-elapsed.failed::before,
.agent-loop-elapsed.replayed::before,
.agent-loop-elapsed.stale::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 4px;
  margin-right: 5px;
  border-radius: 999px;
  background: var(--ui-line-strong);
  vertical-align: 1px;
}
@keyframes elapsed-soft-in {
  from { opacity: 0; transform: translateY(-2px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes elapsed-dot-pulse {
  0%, 100% { opacity: 0.38; transform: scale(0.92); }
  50% { opacity: 0.72; transform: scale(1); }
}
.agent-loop-section + .agent-loop-section {
  margin-top: 5px;
}
.agent-loop-section-title {
  font-size: 9px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 3px;
}
.agent-loop-steps {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.agent-step {
  display: grid;
  grid-template-columns: 7px minmax(0, 1fr);
  gap: 3px;
  align-items: center;
  color: #475569;
  font-size: 9px;
}
.agent-step-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #cbd5e1;
}
.agent-step.in_progress .agent-step-dot { background: var(--ui-info); box-shadow: 0 0 0 3px rgba(79,111,134,0.14); }
.agent-step.completed .agent-step-dot { background: var(--ui-success); }
.agent-step.failed .agent-step-dot { background: var(--ui-danger); }
.agent-step-title {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agent-step-msg {
  grid-column: 2;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 8px;
}
.agent-loop-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
  margin-top: 5px;
}
.agent-loop-logs,
.agent-loop-checkpoints {
  min-height: 20px;
  max-height: 48px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  background: #fff;
  padding: 3px 4px;
}
.agent-log {
  display: flex;
  gap: 3px;
  align-items: baseline;
  font-size: 8px;
  line-height: 1.3;
  color: #475569;
}
.agent-log.error { color: var(--ui-danger); }
.agent-log.warn { color: #b45309; }
.agent-log-time {
  display: none;
}
.agent-log-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.agent-checkpoint {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 2px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 8px;
  color: #475569;
}
.agent-checkpoint:last-child { border-bottom: none; }
.agent-empty {
  color: #94a3b8;
  font-size: 8px;
}
.agent-loop-panel.collapsed .agent-loop-body { display: none; }
.agent-loop-panel[style*="block"] ~ .chat-history {
  padding-right: calc(25% + 18px);
}
.agent-loop-panel.collapsed[style*="block"] ~ .chat-history {
  padding-right: calc(12% + 18px);
}
@media (max-width: 360px) {
  .agent-loop-grid { grid-template-columns: 1fr; }
  .agent-loop-title { max-width: 130px; }
}
.chat-label {
  padding: 6px 12px 5px;
  font-size: 10px;
  color: #bbb;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  border-bottom: 1px solid #f5f5f5;
}
.chat-label-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}
.chat-clear {
  cursor: pointer;
  opacity: 0.5;
  font-size: 11px;
  transition: opacity 0.2s;
}
.chat-clear:hover { opacity: 1; }
.chat-history {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}
.chat-msg {
  max-width: 92%;
  font-size: 12px;
  line-height: 1.6;
  padding: 7px 10px;
  border-radius: 8px;
  word-break: break-word;
  white-space: pre-wrap;
}
/* 气泡外层包裹（用于放工具栏） */
.chat-msg-wrap {
  display: flex;
  flex-direction: column;
  margin-bottom: 4px;
}
.chat-msg-wrap.user {
  align-items: flex-end;
}
.chat-msg-wrap.ai {
  align-items: flex-start;
}
/* AI 消息底部工具栏 */
.chat-msg-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  padding-left: 4px;
}

.chat-msg.user {
  background: var(--ui-brand);
  color: white;
  border-bottom-right-radius: 2px;
}
.chat-msg.ai {
  background: var(--ui-surface);
  color: #333;
  border-bottom-left-radius: 2px;
  border: 1px solid var(--ui-line);
  position: relative;
}
/* 分析结果使用更宽的气泡 */
.chat-msg.ai.analysis {
  max-width: 100%;
  background: var(--ui-surface);
  border-color: var(--ui-line-strong);
}
/* ===== 追问建议按钮 ===== */
.followup-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 0 4px;
  border-top: 1px dashed #e5e7eb;
}
.followup-btn {
  background: linear-gradient(135deg, var(--ui-brand-soft) 0%, var(--ui-accent-soft) 100%);
  border: 1px solid var(--ui-line-strong);
  border-radius: 18px;
  padding: 6px 14px;
  font-size: 12.5px;
  color: var(--ui-brand-deep);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(24, 24, 24, 0.08);
}
.followup-btn:hover {
  background: linear-gradient(135deg, var(--ui-accent-soft) 0%, var(--ui-accent-soft) 100%);
  border-color: var(--ui-accent);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(24, 24, 24, 0.14);
  color: var(--ui-brand-deep);
}
.followup-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(24, 24, 24, 0.10);
}

/* ===== 文档生成进度指示器 ===== */
.doc-gen-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--ui-success-soft) 0%, var(--ui-success-soft) 100%);
  border: 1px solid var(--ui-line-strong);
  border-radius: 12px;
  animation: doc-gen-pulse 2s ease-in-out infinite;
}
.doc-gen-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--ui-success-soft);
  border-top-color: var(--ui-success);
  border-radius: 50%;
  animation: doc-gen-spin 0.8s linear infinite;
  flex-shrink: 0;
}
.doc-gen-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.doc-gen-label {
  color: var(--ui-success);
  font-weight: 500;
}
.doc-gen-timer {
  background: var(--ui-success-soft);
  color: var(--ui-success);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 30px;
  text-align: center;
}
@keyframes doc-gen-spin {
  to { transform: rotate(360deg); }
}
@keyframes doc-gen-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}
/* 文档生成完成提示 */
.doc-gen-done {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  padding: 10px 16px;
  background: linear-gradient(135deg, var(--ui-success-soft) 0%, var(--ui-success-soft) 100%);
  border: 1px solid var(--ui-line-strong);
  border-radius: 10px;
  font-size: 13px;
  color: var(--ui-success);
  font-weight: 500;
  animation: doc-gen-appear 0.3s ease-out;
}
/* 文档生成失败提示 */
.doc-gen-error {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  padding: 10px 16px;
  background: linear-gradient(135deg, var(--ui-danger-soft) 0%, var(--ui-danger-soft) 100%);
  border: 1px solid var(--ui-line-strong);
  border-radius: 10px;
  font-size: 13px;
  color: var(--ui-danger);
  font-weight: 500;
  animation: doc-gen-appear 0.3s ease-out;
}
.artifact-card {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  gap: 5px;
  align-items: center;
  width: 100%;
  min-height: 28px;
  margin: 0;
  padding: 3px 5px;
  border: 1px solid rgba(198, 161, 91, 0.22);
  border-radius: 7px;
  background: rgba(255, 253, 247, 0.88);
  box-shadow: 0 2px 7px rgba(24, 24, 24, 0.05);
  white-space: normal;
}
.artifact-thumb {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}
.artifact-thumb span {
  width: 13px;
  height: 10px;
  border: 1.5px solid var(--ui-muted);
  border-radius: 3px;
  position: relative;
}
.artifact-thumb span::before,
.artifact-thumb span::after {
  content: '';
  position: absolute;
  background: var(--ui-muted);
}
.artifact-thumb span::before {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  left: 2px;
  top: 2px;
}
.artifact-thumb span::after {
  width: 9px;
  height: 1.5px;
  left: 2px;
  bottom: 2px;
  transform: rotate(-18deg);
  transform-origin: left center;
}
.artifact-main {
  display: flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
}
.artifact-title {
  font-size: 11.5px;
  line-height: 1.15;
  color: var(--ui-ink);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.artifact-meta {
  flex-shrink: 0;
  margin-top: 0;
  font-size: 9.5px;
  color: var(--ui-muted);
}
.artifact-actions {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}
.artifact-actions button {
  border: 1px solid rgba(198, 161, 91, 0.3);
  background: rgba(255, 253, 247, 0.86);
  color: var(--ui-brand);
  border-radius: 6px;
  min-height: 22px;
  padding: 2px 6px;
  font: inherit;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}
.artifact-actions button:hover {
  background: var(--ui-brand-soft);
  color: var(--ui-brand-deep);
}
.artifact-actions button:disabled {
  opacity: 0.58;
  cursor: wait;
}
.chat-msg.ai.artifact-msg,
.chat-msg.ai:has(.artifact-card) {
  width: min(350px, 96%);
  max-width: 94%;
  padding: 3px;
  line-height: 1;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(24, 24, 24, 0.07);
}
.chat-msg.ai.deploy-msg,
.chat-msg.ai:has(.deploy-result-card) {
  width: min(360px, 96%);
  max-width: 96%;
  padding: 3px;
  line-height: 1;
}
.deploy-result-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: min(350px, 100%);
  padding: 7px 8px;
  border: 1px solid rgba(198, 161, 91, 0.24);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.94);
  box-shadow: 0 2px 8px rgba(24, 24, 24, 0.06);
  line-height: 1.25;
}
.deploy-result-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.deploy-result-kicker {
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ui-accent-deep);
  font-weight: 800;
}
.deploy-result-main strong,
.deploy-result-main a {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.deploy-result-main strong {
  font-size: 12px;
  color: var(--ui-ink);
}
.deploy-result-main a {
  font-size: 10.5px;
  color: var(--ui-info);
  text-decoration: none;
}
.deploy-copy-btn {
  height: 24px;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid rgba(198, 161, 91, 0.28);
  background: rgba(255, 253, 247, 0.92);
  color: var(--ui-brand);
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
}
/* 文档生成步骤指示器 */
.doc-gen-steps {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.doc-gen-step {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--ui-success-soft);
  color: #6b7280;
  transition: all 0.3s ease;
}
.doc-gen-step.active {
  background: var(--ui-success);
  color: #fff;
  animation: doc-gen-step-pulse 1s ease-in-out infinite;
}
.doc-gen-step.done {
  background: var(--ui-line-strong);
  color: var(--ui-success);
}
@keyframes doc-gen-step-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}
@keyframes doc-gen-appear {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-input-area {
  flex-shrink: 0;
  border-top: 1px solid #f0f0f0;
}
.chat-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 6px 12px 0;
}
.attach-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--ui-brand-soft);
  border: 1px solid rgba(198, 161, 91, 0.2);
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--ui-brand-deep);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attach-remove {
  cursor: pointer;
  color: #999;
  font-size: 10px;
  flex-shrink: 0;
}
.attach-remove:hover { color: var(--ui-danger); }
.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 6px 12px 8px;
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  border: 1.5px solid var(--ui-line);
  border-radius: 7px;
  padding: 6px 9px;
  font-size: 12px;
  font-family: inherit;
  resize: none;
  max-height: 80px;
  min-height: 32px;
  line-height: 1.5;
  color: #1a1a2e;
  transition: border-color 0.2s;
  background: #fafafa;
}
.chat-input:focus { outline: none; border-color: var(--ui-brand); background: white; }
.chat-input::placeholder { color: #ccc; }
.chat-send-btn {
  width: 32px; height: 32px;
  background: var(--ui-brand);
  border: none;
  border-radius: 7px;
  color: white;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}
.chat-send-btn:hover { background: #5a52e0; }
.chat-send-btn:disabled { background: #d9d9d9; cursor: not-allowed; }

/* ===== 语音输入 ===== */
.chat-input-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: flex-end;
}

.chat-input-wrapper::after {
  content: "松开即可添加文件 / 文件夹";
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px dashed rgba(198, 161, 91, 0.52);
  background: rgba(255, 253, 247, 0.92);
  color: var(--ui-brand-deep);
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
}

.chat-input-area.is-attachment-dragging .chat-input-wrapper::after {
  display: flex;
}

.chat-input-area.is-attachment-dragging .chat-input {
  border-color: rgba(198, 161, 91, 0.62);
  box-shadow: 0 0 0 3px rgba(198, 161, 91, 0.13);
}
.chat-input-wrapper .chat-input {
  width: 100%;
  padding-right: 30px; /* 给麦克风腾位置 */
}
.chat-voice-btn {
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 4px;
  opacity: 0.5;
  transition: opacity 0.15s, transform 0.15s;
  line-height: 1;
}
.chat-voice-btn:hover { opacity: 0.9; transform: scale(1.1); }
.chat-voice-btn.recording {
  opacity: 1;
  color: var(--ui-danger);
  filter: drop-shadow(0 0 4px rgba(255,77,79,0.5));
  animation: voice-pulse 1.2s ease-in-out infinite;
}
.chat-voice-btn.paused { opacity: 0.7; }

@keyframes voice-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* 语音状态提示条 */
.voice-status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: var(--ui-brand-soft);
  border-bottom: 1px solid var(--ui-line);
  font-size: 11px;
  color: var(--ui-brand);
}
.voice-status-text { flex: 1; }
.voice-wave {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 14px;
}
.voice-wave span {
  display: inline-block;
  width: 3px;
  background: var(--ui-brand);
  border-radius: 2px;
  animation: wave-bar 0.9s ease-in-out infinite;
}
.voice-wave span:nth-child(1) { animation-delay: 0s;    height: 4px; }
.voice-wave span:nth-child(2) { animation-delay: 0.15s; height: 8px; }
.voice-wave span:nth-child(3) { animation-delay: 0.3s;  height: 12px; }
.voice-wave span:nth-child(4) { animation-delay: 0.15s; height: 8px; }
.voice-wave span:nth-child(5) { animation-delay: 0s;    height: 4px; }
.voice-status-bar.paused .voice-wave span {
  animation-play-state: paused;
  height: 4px !important;
}
@keyframes wave-bar {
  0%, 100% { transform: scaleY(0.4); }
  50%       { transform: scaleY(1); }
}
.voice-pause-btn, .voice-stop-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 4px;
  color: var(--ui-brand);
  transition: background 0.15s;
}
.voice-pause-btn:hover { background: var(--ui-accent-soft); }
.voice-stop-btn { color: #999; }
.voice-stop-btn:hover { background: var(--ui-danger-soft); color: var(--ui-danger); }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(26,26,46,0.88);
  color: white;
  font-size: 12px;
  padding: 7px 14px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  z-index: 9999;
}
.toast.show { opacity: 1; }
.toast.warn { background: rgba(212,107,8,0.9); }

/* ===== Skill 管理按钮 ===== */
.btn-skill-mgr {
  width: 24px; height: 24px;
  background: var(--ui-brand-soft);
  border: 1px solid var(--ui-line);
  border-radius: 4px;
  color: var(--ui-brand);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}
.btn-skill-mgr:hover { background: var(--ui-brand); color: white; }

/* ===== Skill 管理抽屉 ===== */
/* ===== 设置面板（全屏覆盖） ===== */
.settings-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.settings-container {
  background: #fff;
  border-radius: 12px;
  width: 92%;
  max-width: 520px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  overflow: hidden;
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
}
.settings-header-title { font-size: 14px; font-weight: bold; color: #1a1a2e; }
.settings-close { cursor: pointer; color: #aaa; font-size: 14px; padding: 4px; }
.settings-close:hover { color: #333; }

.settings-tabs {
  display: flex;
  border-bottom: 1px solid #f0f0f0;
}
.settings-tab {
  flex: 1;
  text-align: center;
  padding: 10px 0;
  font-size: 12px;
  color: #888;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.settings-tab.active { color: var(--ui-brand); border-bottom-color: var(--ui-brand); font-weight: bold; }
.settings-tab:hover { color: var(--ui-brand); }

.settings-panel {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  max-height: calc(88vh - 100px);
}

/* Skill 子Tab */
.skill-sub-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  background: #f5f5f7;
  border-radius: 8px;
  padding: 3px;
}
.skill-sub-tab {
  flex: 1;
  text-align: center;
  padding: 6px 0;
  font-size: 11px;
  color: #888;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s;
}
.skill-sub-tab.active { background: #fff; color: var(--ui-brand); font-weight: bold; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.skill-sub-tab:hover { color: var(--ui-brand); }

.skill-sub-panel {
  flex: 1;
}

/* 模型状态卡片 */
.model-current-card {
  background: linear-gradient(135deg, var(--ui-surface-2) 0%, var(--ui-brand-soft) 100%);
  border: 1px solid var(--ui-line);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.model-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.model-card-label { font-size: 11px; color: #888; }
.model-card-status {
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 10px;
  font-weight: bold;
}
.model-card-info { font-size: 13px; color: #444; font-weight: 500; }

/* 知识库 */
.kb-upload-zone {
  border: 2px dashed #d9d9d9;
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #fafafa;
}
.kb-upload-zone:hover, .kb-drag-over {
  border-color: var(--ui-brand);
  background: var(--ui-brand-soft);
}
.kb-upload-icon { font-size: 28px; margin-bottom: 6px; }
.kb-upload-text { font-size: 13px; color: #555; margin-bottom: 4px; }
.kb-upload-hint { font-size: 11px; color: #aaa; }

.kb-header-info { margin-bottom: 12px; }
.kb-count { font-size: 11px; color: #888; font-weight: normal; }

.kb-list { max-height: 300px; overflow-y: auto; }
.kb-empty { text-align: center; color: #bbb; padding: 24px; font-size: 12px; }

.kb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid #f5f5f5;
  transition: background 0.1s;
}
.kb-item:hover { background: #fafafa; }
.kb-item-icon { font-size: 18px; }
.kb-item-info { flex: 1; min-width: 0; }
.kb-item-name { font-size: 12px; color: #333; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kb-item-desc { font-size: 10px; color: #999; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.kb-item-delete {
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  font-size: 12px;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.1s;
}
.kb-item-delete:hover { color: var(--ui-danger); background: var(--ui-danger-soft); }

/* 知识库：状态栏 */
.kb-status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: linear-gradient(135deg, var(--ui-success-soft) 0%, var(--ui-success-soft) 100%);
  border: 1px solid var(--ui-line-strong);
  border-radius: 8px;
  margin-bottom: 12px;
}
.kb-status-icon { font-size: 16px; }
.kb-status-text { flex: 1; font-size: 11px; color: var(--ui-success); }
.kb-status-count { font-size: 11px; color: var(--ui-success); font-weight: bold; white-space: nowrap; }

/* 知识库：进度条 */
.kb-progress {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--ui-info-soft);
  border: 1px solid var(--ui-line-strong);
  border-radius: 8px;
}
.kb-progress-bar {
  width: 100%;
  height: 6px;
  background: #e6f7ff;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}
.kb-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ui-brand), var(--ui-accent));
  border-radius: 3px;
  transition: width 0.3s ease;
}
.kb-progress-text {
  font-size: 11px;
  color: #1890ff;
}

/* 知识库：上传结果摘要 */
.kb-result-summary {
  position: relative;
  margin-top: 8px;
  padding: 10px 32px 10px 12px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.6;
  max-height: 200px;
  overflow-y: auto;
}
.kb-result-summary.kb-result-success {
  background: var(--ui-success-soft);
  border: 1px solid #b7eb8f;
  color: var(--ui-success);
}
.kb-result-summary.kb-result-error {
  background: #fff2f0;
  border: 1px solid #ffccc7;
  color: var(--ui-danger);
}
.kb-result-summary.kb-result-warn {
  background: #fffbe6;
  border: 1px solid #ffe58f;
  color: #ad6800;
}
.kb-result-summary-content {
  white-space: pre-wrap;
  word-break: break-all;
}
.kb-result-close {
  position: absolute;
  top: 6px;
  right: 6px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: #999;
  padding: 2px 4px;
  line-height: 1;
  border-radius: 3px;
}
.kb-result-close:hover {
  color: #333;
  background: rgba(0,0,0,0.06);
}

/* 知识库：来源文件分组头 */
.kb-source-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 4px;
  font-size: 12px;
  font-weight: bold;
  color: #555;
  border-bottom: 1px solid #e8e8e8;
  margin-top: 6px;
}
.kb-source-header:first-child { margin-top: 0; }
.kb-seg-count {
  font-size: 10px;
  font-weight: normal;
  color: #aaa;
}
.kb-source-delete {
  margin-left: auto;
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  font-size: 11px;
  padding: 2px 4px;
  border-radius: 3px;
  transition: all 0.15s;
}
.kb-source-delete:hover { color: var(--ui-danger); background: var(--ui-danger-soft); }

/* 已安装列表 */
.skill-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; overflow-y: auto; max-height: 260px; }
.skill-list-loading, .skill-list-empty, .skill-list-error {
  font-size: 11px; color: #aaa; text-align: center; padding: 12px 0;
}
.skill-list-error { color: var(--ui-danger); }

/* 搜索行 */
.skill-search-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.skill-search-input {
  flex: 1;
  padding: 5px 10px;
  border: 1px solid var(--ui-line);
  border-radius: 6px;
  font-size: 12px;
  color: #333;
  outline: none;
  background: #fafafa;
}
.skill-search-input:focus { border-color: var(--ui-brand); background: #fff; }
.skill-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: white;
  border: 1px solid #eee;
  border-radius: 5px;
}
.skill-item-name { flex: 1; font-size: 12px; color: #1a1a2e; font-weight: 500; }
.skill-item-info { flex: 1; min-width: 0; }
.skill-item-desc { font-size: 11px; color: #888; margin-top: 2px; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.skill-badge {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  white-space: nowrap;
}
.badge-builtin { background: #f0f0f0; color: #888; }
.badge-local   { background: #e6f4ff; color: #1677ff; }
.badge-remote  { background: var(--ui-success-soft); color: var(--ui-success); }
.btn-use-skill {
  font-size: 10px;
  padding: 2px 8px;
  background: var(--ui-brand);
  color: white;
  border: none;
  border-radius: 3px;
  cursor: pointer;
}
.btn-use-skill:hover { opacity: 0.85; }
.btn-refresh-skills {
  padding: 5px 10px;
  background: none;
  border: 1px solid var(--ui-line);
  border-radius: 6px;
  color: var(--ui-brand);
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
}
.btn-refresh-skills:hover { background: var(--ui-brand-soft); }

/* 安装区 */
.install-section { margin-bottom: 10px; }
.install-label { font-size: 11px; font-weight: bold; color: #555; margin-bottom: 4px; }
.install-input {
  width: 100%;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 11px;
  font-family: inherit;
  margin-bottom: 4px;
  color: #1a1a2e;
}
.install-input:focus { outline: none; border-color: var(--ui-brand); }
.install-textarea {
  width: 100%;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 11px;
  font-family: inherit;
  resize: vertical;
  min-height: 70px;
  margin-bottom: 4px;
  color: #1a1a2e;
}
.install-textarea:focus { outline: none; border-color: var(--ui-brand); }
.install-divider { text-align: center; font-size: 11px; color: #ccc; margin: 6px 0; }
.btn-install {
  width: 100%;
  background: var(--ui-brand);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 6px;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-install:hover { opacity: 0.85; }
.install-result {
  margin-top: 6px;
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 11px;
}
.install-result.ok      { background: var(--ui-success-soft); color: var(--ui-success); }
.install-result.err     { background: var(--ui-danger-soft); color: var(--ui-danger); }
.install-result.pending { background: #f0f0f0; color: #888; }

/* 设置区 */
.settings-section { margin-bottom: 10px; }
.settings-label { font-size: 11px; font-weight: bold; color: #555; margin-bottom: 2px; }
.settings-hint  { font-size: 10px; color: #aaa; margin-bottom: 4px; }

/* 自动化任务 */
.automation-status-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.automation-status-card {
  border: 1px solid #c7efe4;
  background: #f0fdfa;
  border-radius: 7px;
  padding: 9px 10px;
}
.automation-status-card.muted {
  border-color: #e5e7eb;
  background: #f8fafc;
}
.automation-status-label {
  font-size: 10px;
  color: #64748b;
  margin-bottom: 4px;
}
.automation-status-value {
  font-size: 12px;
  color: var(--ui-brand);
  font-weight: 600;
  line-height: 1.35;
}
.automation-status-card.muted .automation-status-value {
  color: #475569;
}
.automation-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.automation-mini-actions {
  display: flex;
  flex-shrink: 0;
  gap: 4px;
}
.automation-queue-summary {
  margin-top: 7px;
  padding: 6px 8px;
  border-radius: 7px;
  background: #eef6ff;
  color: #1e3a8a;
  font-size: 11px;
  line-height: 1.4;
}
.automation-queue-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  max-height: 150px;
  overflow-y: auto;
}
.automation-queue-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid #e5e7eb;
  border-radius: 7px;
  background: #fff;
  padding: 7px 8px;
}
.automation-queue-title {
  min-width: 0;
  color: #111827;
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.automation-queue-meta {
  margin-top: 2px;
  color: #64748b;
  font-size: 10px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.automation-queue-status {
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  padding: 2px 7px;
  font-size: 10px;
}
.automation-queue-status.success { background: var(--ui-success-soft); color: #15803d; }
.automation-queue-status.error { background: var(--ui-danger-soft); color: var(--ui-danger); }
.automation-queue-status.running { background: #dbeafe; color: #1d4ed8; }
.automation-queue-status.queued { background: #fef3c7; color: #92400e; }
.automation-editor {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 12px;
  background: #fff;
}
.automation-field-label {
  margin-top: 9px;
}
.automation-task-input {
  min-height: 92px;
  resize: vertical;
  line-height: 1.55;
  white-space: pre-wrap;
}
.automation-check-row {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #475569;
  font-size: 12px;
  margin: 4px 0 8px;
}
.automation-check-row input {
  width: 15px;
  height: 15px;
}
.automation-trigger-card {
  border: 1px solid #e8ecf4;
  border-radius: 8px;
  background: #fbfdff;
  padding: 9px;
  margin-bottom: 8px;
}
.automation-schedule-wrap {
  margin-top: 8px;
}
.automation-schedule-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
}
.automation-time-input {
  width: 112px;
}
.automation-weekdays {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.automation-weekday-btn {
  border: 1px solid #dbe3ee;
  background: #fff;
  color: #475569;
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 11px;
  cursor: pointer;
}
.automation-weekday-btn.active {
  border-color: var(--ui-accent);
  background: var(--ui-accent-soft);
  color: var(--ui-accent-deep);
  font-weight: 600;
}
.automation-inline-label {
  color: #64748b;
  font-size: 11px;
}
.automation-number-input {
  width: 82px;
}
.automation-unit-input {
  width: 92px;
}
.automation-schedule-summary {
  margin-top: 8px;
  padding: 7px 8px;
  border-radius: 7px;
  background: #f1f5f9;
  color: #334155;
  font-size: 11px;
  line-height: 1.45;
}
.automation-steps-input {
  min-height: 150px;
  font-family: "SF Mono", Consolas, monospace;
  font-size: 11px;
  line-height: 1.55;
  white-space: pre;
}
.automation-actions {
  display: grid;
  grid-template-columns: 0.8fr 0.9fr 1.2fr;
  gap: 8px;
}
.automation-secondary {
  background: #f1f5f9;
  color: #334155;
}
.automation-link-btn {
  border: none;
  background: transparent;
  color: var(--ui-accent-deep);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 4px;
}
.automation-list,
.automation-log-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}
.automation-item {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 7px;
  padding: 8px;
  background: #fff;
}
.automation-item.disabled {
  opacity: 0.62;
}
.automation-item-main {
  flex: 1;
  min-width: 0;
}
.automation-item-title {
  font-size: 12px;
  color: #111827;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.automation-item-meta {
  font-size: 10px;
  color: #64748b;
  margin-top: 3px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.automation-item-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.automation-item-actions button {
  border: 1px solid #dbe3ee;
  background: #f8fafc;
  color: #334155;
  border-radius: 5px;
  padding: 3px 6px;
  font-size: 10px;
  cursor: pointer;
}
.automation-item-actions button:hover {
  border-color: var(--ui-accent);
  color: var(--ui-accent-deep);
}
.automation-log {
  display: grid;
  grid-template-columns: 58px 42px 1fr;
  align-items: center;
  gap: 6px;
  border: 1px solid #edf2f7;
  border-radius: 6px;
  padding: 6px 8px;
  background: #fff;
  font-size: 10px;
  color: #475569;
}
.automation-log-status {
  text-align: center;
  border-radius: 999px;
  padding: 1px 5px;
  background: #e2e8f0;
  color: #475569;
}
.automation-log.success .automation-log-status { background: var(--ui-success-soft); color: #15803d; }
.automation-log.error .automation-log-status { background: var(--ui-danger-soft); color: var(--ui-danger); }
.automation-log.running .automation-log-status { background: #dbeafe; color: #1d4ed8; }
.automation-log-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ui-line); border-radius: 2px; }

/* 即时回显气泡：用户发送后立刻显示 */
.chat-msg.quick-ack {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--ui-brand-soft);
  border: 1px dashed rgba(198, 161, 91, 0.38);
  color: var(--ui-muted);
  font-size: 12px;
  padding: 6px 10px;
}
.chat-msg.quick-ack::before {
  content: 'J';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: linear-gradient(145deg, var(--ui-brand) 0%, var(--ui-brand-deep) 100%);
  border: 1px solid rgba(198, 161, 91, 0.45);
  color: #fffdf7;
  font-family: "Bodoni 72", "Didot", Georgia, serif;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.quick-ack-text {
  color: var(--ui-brand-mid);
}
/* 三点跳动动画 */
.chat-msg.quick-ack::after {
  content: '···';
  animation: quickDot 1.2s infinite;
  color: var(--ui-accent-deep);
  letter-spacing: 2px;
}
@keyframes quickDot {
  0%,100% { opacity: 1; }
  50% { opacity: 0.3; }
}

@keyframes header-border-flow {
  0%, 100% { background-position: 0% 50%; opacity: 0.52; }
  45% { background-position: 100% 50%; opacity: 0.82; }
  70% { background-position: 62% 50%; opacity: 0.62; }
}

@keyframes header-soft-line {
  0%, 100% { transform: translateX(-12%); opacity: 0.32; }
  50% { transform: translateX(12%); opacity: 0.62; }
}

@keyframes logo-breathe {
  0%, 100% {
    box-shadow: inset 0 1px 0 rgba(255, 253, 247, 0.35), 0 8px 18px rgba(0, 0, 0, 0.16);
    border-color: rgba(198, 161, 91, 0.5);
  }
  50% {
    box-shadow: inset 0 1px 0 rgba(255, 253, 247, 0.42), 0 10px 22px rgba(0, 0, 0, 0.2), 0 0 16px rgba(198, 161, 91, 0.16);
    border-color: rgba(198, 161, 91, 0.76);
  }
}

@keyframes logo-glint {
  0%, 62%, 100% { left: -56%; opacity: 0; }
  72% { opacity: 0.7; }
  86% { left: 112%; opacity: 0; }
}

@keyframes logo-letter-drift {
  0%, 100% { transform: translateY(-1px) scale(1); }
  50% { transform: translateY(-2px) scale(1.025); }
}

@keyframes shortcut-border-flow {
  0%, 100% {
    background-position: 0% 50%;
    opacity: 0.52;
  }
  45% {
    background-position: 100% 50%;
    opacity: 0.78;
  }
  72% {
    background-position: 58% 50%;
    opacity: 0.6;
  }
}

/* ===== 工具调用折叠区块样式 ===== */
.tool-result-block {
  margin: 8px 0;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #f8f9fa;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.tool-result-block.error {
  border-color: var(--ui-danger);
  background: #fff2f0;
}

.tool-result-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #f0f0f0;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
  font-size: 13px;
}

.tool-result-block.error .tool-result-header {
  background: #ffccc7;
}

.tool-result-header:hover {
  background: #e0e0e0;
}

.tool-result-block.error .tool-result-header:hover {
  background: #ffa39e;
}

.tool-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.tool-name {
  flex: 1;
  font-weight: 500;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-result-block.error .tool-name {
  color: var(--ui-danger);
}

.tool-status {
  font-size: 12px;
  color: var(--ui-success);
  flex-shrink: 0;
}

.tool-result-block.error .tool-status {
  color: var(--ui-danger);
}

.tool-toggle {
  font-size: 10px;
  color: #999;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.tool-result-block.expanded .tool-toggle {
  transform: rotate(180deg);
}

.tool-result-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.tool-result-block.expanded .tool-result-content {
  max-height: 500px;
}

.tool-code {
  margin: 0;
  padding: 12px;
  background: #1e1e1e;
  color: #d4d4d4;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.tool-code.error {
  background: #2b1818;
  color: var(--ui-danger);
}

.tool-code code {
  font-family: inherit;
}

.tool-preview {
  padding: 8px 12px;
  font-size: 12px;
  color: #666;
  background: #f0f0f0;
  border-top: 1px dashed #d0d0d0;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 60px;
  overflow: hidden;
}

.tool-result-block.expanded .tool-preview {
  display: none;
}

.browser-tool-card .tool-result-header {
  cursor: default;
}

.browser-tool-progress {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px 12px;
}

.browser-tool-dot {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 999px;
  background: var(--ui-success);
  box-shadow: 0 0 0 4px rgba(46, 139, 87, 0.12);
  flex-shrink: 0;
}

.browser-tool-dot.failed {
  background: var(--ui-danger);
  box-shadow: 0 0 0 4px rgba(138, 98, 24, 0.14);
}

.browser-tool-copy {
  min-width: 0;
}

.browser-tool-action {
  font-size: 13px;
  font-weight: 700;
  color: var(--ui-ink);
}

.browser-tool-meta,
.browser-tool-note {
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ui-muted);
  overflow-wrap: anywhere;
}

.browser-tool-note {
  color: var(--ui-brand-deep);
}

/* ===== Mermaid 流程图渲染 ===== */
.mermaid-container {
  position: relative;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  margin: 10px 0;
  overflow: auto;
  min-height: 60px;
  transition: border-color 0.3s;
}
.mermaid-container.mermaid-rendered {
  border-color: #c7d2fe;
  background: linear-gradient(135deg, var(--ui-surface), var(--ui-brand-soft));
}
.mermaid-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px 0;
  color: #999;
  font-size: 13px;
}
.mermaid-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--ui-line);
  border-top-color: var(--ui-brand);
  border-radius: 50%;
  animation: mermaid-spin 0.8s linear infinite;
}
@keyframes mermaid-spin {
  to { transform: rotate(360deg); }
}
.mermaid-container svg {
  max-width: 100%;
  height: auto;
}
.mermaid-expand-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 5px;
  background: rgba(255,255,255,0.85);
  color: #999;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s, color 0.2s, background 0.2s;
  z-index: 5;
  padding: 0;
}
.mermaid-container:hover .mermaid-expand-btn {
  opacity: 1;
}
.mermaid-expand-btn:hover {
  color: var(--ui-brand);
  background: #fff;
}

/* ===== Mermaid 全屏弹窗 ===== */
.mermaid-fullscreen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.75);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: mermaid-fadein 0.2s ease-out;
}
@keyframes mermaid-fadein {
  from { opacity: 0; }
  to { opacity: 1; }
}
.mermaid-fullscreen-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  color: #666;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100000;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.mermaid-fullscreen-close:hover {
  background: #fff;
  color: #333;
  transform: scale(1.1);
}
.mermaid-fullscreen-content {
  width: calc(100vw - 80px);
  height: calc(100vh - 80px);
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.3);
}
.mermaid-fullscreen-content svg {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
}

/* ===== 右下角复制按钮（输出完成后出现，定位在气泡上） ===== */
.msg-copy-btn {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: #bbb;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s, color 0.2s, background 0.2s;
  z-index: 5;
  padding: 0;
}
.chat-msg.ai:hover .msg-copy-btn {
  opacity: 1;
}
.msg-copy-btn:hover {
  color: var(--ui-brand);
  background: rgba(198,161,91,0.14);
}
.msg-copy-btn.copied {
  color: var(--ui-success);
  opacity: 1;
}

/* Word 导出按钮（hover 才显示，定位在气泡上） */
.doc-export-btn {
  position: absolute;
  right: 36px;
  bottom: 6px;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: #bbb;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s, color 0.2s, background 0.2s;
  font-size: 12px;
  z-index: 5;
  padding: 0;
}
.chat-msg.ai:hover .doc-export-btn {
  opacity: 0.6;
}
.doc-export-btn:hover {
  opacity: 1 !important;
  color: #1f5bbf;
  background: rgba(31, 91, 191, 0.08);
}

/* ===== 对话消息操作按钮（hover显示） ===== */
.chat-msg-wrap {
  position: relative;
}

.chat-msg-actions {
  position: absolute;
  right: 8px;
  top: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 10;
}

.chat-msg-wrap:hover .chat-msg-actions {
  opacity: 1;
  visibility: visible;
}

.chat-action-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: rgba(255,255,255,0.9);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.chat-action-btn:hover {
  background: #fff;
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.chat-msg-wrap.user .chat-msg-actions {
  right: auto;
  left: 8px;
}

/* 工具提示 */
.chat-tooltip {
  animation: tooltipFadeIn 0.2s ease;
}

@keyframes tooltipFadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Skill 思考沙箱区块 ===== */
.skill-thinking-block {
  margin: 0 0 6px 0;
  border: 1px solid rgba(110, 99, 255, 0.2);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(110, 99, 255, 0.04);
}

.skill-thinking-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  color: var(--ui-brand);
  font-weight: 500;
  background: rgba(110, 99, 255, 0.06);
  transition: background 0.15s;
}

.skill-thinking-header:hover {
  background: rgba(110, 99, 255, 0.12);
}

.skill-thinking-icon { font-size: 13px; }
.skill-thinking-label { flex: 1; }

.skill-thinking-toggle {
  font-size: 10px;
  transition: transform 0.2s;
  color: #aaa;
}

.skill-thinking-block.expanded .skill-thinking-toggle {
  transform: rotate(90deg);
}

/* 默认折叠：body高度0不可见 */
.skill-thinking-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
  font-size: 12px;
  color: #666;
  padding: 0 10px;
  line-height: 1.6;
}

/* 展开：显示最多 3 行高度，超出滚动 */
.skill-thinking-block.expanded .skill-thinking-body {
  max-height: 72px;   /* 约3行（12px * 1.6 * 3 ≈ 58px，留余量）*/
  overflow-y: auto;
  padding: 8px 10px;
  border-top: 1px solid rgba(110, 99, 255, 0.1);
}

/* 执行过程中：自动展开以显示实时内容 */
.skill-thinking-block.running .skill-thinking-body {
  max-height: 72px;
  overflow-y: auto;
  padding: 8px 10px;
  border-top: 1px solid rgba(110, 99, 255, 0.1);
}

.skill-thinking-block.running .skill-thinking-toggle {
  transform: rotate(90deg);
}

/* ===== Skill 结论气泡 ===== */
.tool-call-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(110, 99, 255, 0.08);
  border: 1px solid rgba(110, 99, 255, 0.25);
  border-radius: 6px;
  padding: 4px 10px;
  margin: 4px 0;
  font-size: 12px;
  color: var(--ui-brand);
  animation: toolCallSlideIn 0.2s ease;
}

.tool-call-status.done {
  background: rgba(82, 196, 26, 0.08);
  border-color: rgba(82, 196, 26, 0.3);
  color: var(--ui-success);
}

.tool-call-icon {
  font-size: 13px;
}

.tool-call-name {
  font-weight: 500;
}

.tool-call-spinner {
  color: #aaa;
  font-size: 12px;
  animation: dotBlink 1s infinite;
}

.tool-call-status.done .tool-call-spinner {
  animation: none;
  color: var(--ui-success);
  font-weight: bold;
}

@keyframes toolCallSlideIn {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes dotBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ===== Skill 意图识别确认条 ===== */
.skill-intent-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin: 6px 0;
  background: linear-gradient(135deg, var(--ui-info-soft) 0%, var(--ui-info-soft) 100%);
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  font-size: 12px;
  color: #1e40af;
  animation: skill-bar-in 0.3s ease-out;
}
.skill-intent-bar .skill-intent-icon {
  font-size: 16px;
  flex-shrink: 0;
}
.skill-intent-bar .skill-intent-text {
  flex: 1;
  line-height: 1.4;
}
.skill-intent-bar .skill-intent-text strong {
  color: #1d4ed8;
}
.skill-intent-bar .skill-intent-run {
  padding: 4px 14px;
  border: none;
  border-radius: 6px;
  background: var(--ui-info);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}
.skill-intent-bar .skill-intent-run:hover {
  background: #1d4ed8;
}
.skill-intent-bar .skill-intent-skip {
  padding: 4px 10px;
  border: 1px solid #93c5fd;
  border-radius: 6px;
  background: transparent;
  color: var(--ui-info);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.skill-intent-bar .skill-intent-skip:hover {
  background: #dbeafe;
}
@keyframes skill-bar-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 页面上下文确认条 */
.page-context-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin: 6px 0;
  background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
  border: 1px solid #fde68a;
  border-radius: 10px;
  font-size: 12px;
  color: #92400e;
  animation: skill-bar-in 0.3s ease-out;
}
.page-context-bar .page-context-icon {
  font-size: 16px;
  flex-shrink: 0;
}
.page-context-bar .page-context-text {
  flex: 1;
  line-height: 1.4;
}
.page-context-bar .page-context-text strong {
  color: #b45309;
}
.page-context-bar .page-context-yes {
  padding: 4px 14px;
  border: none;
  border-radius: 6px;
  background: #d97706;
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}
.page-context-bar .page-context-yes:hover {
  background: #b45309;
}
.page-context-bar .page-context-no {
  padding: 4px 10px;
  border: 1px solid #fbbf24;
  border-radius: 6px;
  background: transparent;
  color: #d97706;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}
.page-context-bar .page-context-no:hover {
  background: #fef3c7;
}

.is-hidden-utility {
  display: none !important;
}

/* ===== 商业化视觉系统：Meridian Workbench ===== */
html,
body {
  color: var(--ui-ink);
  background:
    linear-gradient(180deg, #fffdf7 0%, #f6f3ea 48%, #eaf4f1 100%),
    repeating-linear-gradient(90deg, rgba(198, 161, 91, 0.022) 0, rgba(198, 161, 91, 0.022) 1px, transparent 1px, transparent 18px);
}

body {
  border-left: 1px solid rgba(198, 161, 91, 0.18);
}

button,
input,
textarea,
select {
  font-family: inherit;
}

button {
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, border-color 0.16s ease, color 0.16s ease, opacity 0.16s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(198, 161, 91, 0.28);
  outline-offset: 2px;
}

.panel-header {
  position: relative;
  min-height: 58px;
  padding: 12px 14px;
  color: #fffdf7;
  background:
    linear-gradient(135deg, #111111 0%, #2d2b27 66%, #c6a15b 145%);
  box-shadow: 0 10px 26px rgba(17, 17, 17, 0.22);
  overflow: hidden;
}

.panel-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  padding: 1px;
  pointer-events: none;
  background: linear-gradient(
    115deg,
    rgba(255, 253, 247, 0.12) 0%,
    rgba(198, 161, 91, 0.58) 22%,
    rgba(255, 253, 247, 0.16) 38%,
    rgba(198, 161, 91, 0.2) 58%,
    rgba(255, 253, 247, 0.1) 100%
  );
  background-size: 260% 260%;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.74;
  animation: header-border-flow 10s ease-in-out infinite;
}

.panel-header::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  z-index: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 253, 247, 0.58), transparent);
  opacity: 0.54;
  animation: header-soft-line 7s ease-in-out infinite;
}

.panel-header-left {
  position: relative;
  z-index: 2;
  gap: 10px;
}

.panel-logo {
  width: 34px;
  height: 34px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-radius: 10px;
  background:
    linear-gradient(145deg, rgba(255, 253, 247, 0.15), rgba(255, 253, 247, 0.04)),
    #24221f;
  border: 1px solid rgba(198, 161, 91, 0.58);
  box-shadow: inset 0 1px 0 rgba(255, 253, 247, 0.35), 0 8px 18px rgba(0, 0, 0, 0.16);
  animation: logo-breathe 5.8s ease-in-out infinite;
}

.panel-logo::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 7px;
  border: 1px solid rgba(198, 161, 91, 0.32);
  opacity: 0.76;
}

.panel-logo::after {
  content: "";
  position: absolute;
  top: -40%;
  bottom: -40%;
  left: -56%;
  width: 18px;
  background: linear-gradient(90deg, transparent, rgba(255, 253, 247, 0.36), transparent);
  transform: rotate(18deg);
  animation: logo-glint 6.2s ease-in-out infinite;
  z-index: 0;
}

.panel-logo-letter {
  position: relative;
  z-index: 1;
  font-family: "Bodoni 72", "Didot", Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  color: #fffdf7;
  text-shadow: 0 0 12px rgba(198, 161, 91, 0.34);
  transform: translateY(-1px);
  animation: logo-letter-drift 5.8s ease-in-out infinite;
}

.panel-title {
  font-size: 14px;
  font-weight: 750;
  letter-spacing: 0;
}

.panel-header-right {
  position: relative;
  z-index: 2;
}

.panel-settings-btn,
.panel-close-btn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: rgba(255, 253, 247, 0.86);
}

.panel-settings-btn:hover,
.panel-close-btn:hover {
  color: #fffdf7;
  background: rgba(255, 253, 247, 0.16);
}

.panel-context-bar,
.url-context-bar {
  background: rgba(255, 253, 247, 0.92);
  border-bottom: 1px solid var(--ui-line);
}

.panel-context-bar {
  padding: 7px 12px;
}

.context-info {
  color: var(--ui-muted);
  font-weight: 500;
}

.context-dot {
  width: 7px;
  height: 7px;
  background: var(--ui-line-strong);
  box-shadow: 0 0 0 3px rgba(198, 161, 91, 0.1);
}

.context-dot.active {
  background: var(--ui-success);
}

.context-dot.warn,
.context-dot.loading {
  background: var(--ui-accent);
}

.context-refresh:hover,
.section-tag {
  color: var(--ui-brand);
}

.url-context-btn,
.btn-retry,
.btn-fill:hover,
.btn-install,
.btn-use-skill,
.chat-send-btn,
.skill-intent-bar .skill-intent-run,
.page-context-bar .page-context-yes {
  background: linear-gradient(135deg, var(--ui-brand) 0%, var(--ui-brand-deep) 100%) !important;
  color: #fffdf7 !important;
  border: 1px solid rgba(255, 253, 247, 0.12) !important;
  box-shadow: var(--ui-shadow-sm);
}

.url-context-btn:hover,
.btn-install:hover,
.btn-use-skill:hover,
.chat-send-btn:hover,
.skill-intent-bar .skill-intent-run:hover,
.page-context-bar .page-context-yes:hover {
  background: linear-gradient(135deg, var(--ui-brand-mid) 0%, var(--ui-brand-deep) 100%) !important;
  opacity: 1;
  box-shadow: 0 8px 18px rgba(24, 24, 24, 0.16);
}

.url-context-input,
.skill-search-input,
.install-input,
.install-textarea,
.chat-input {
  border: 1px solid var(--ui-line);
  background: rgba(255, 253, 247, 0.92);
  color: var(--ui-ink);
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(19, 32, 31, 0.03);
}

.url-context-input:focus,
.skill-search-input:focus,
.install-input:focus,
.install-textarea:focus,
.chat-input:focus {
  border-color: var(--ui-brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(198, 161, 91, 0.14);
}

.chat-label {
  background: rgba(255, 253, 247, 0.68);
  border-bottom: 1px solid var(--ui-line);
  color: var(--ui-faint);
}

.chat-history {
  gap: 10px;
  padding: 14px 13px 8px;
  background:
    linear-gradient(180deg, #f8faf5, #eaf4f1),
    repeating-linear-gradient(0deg, rgba(19, 32, 31, 0.018) 0, rgba(19, 32, 31, 0.018) 1px, transparent 1px, transparent 22px);
}

.panel-empty {
  color: var(--ui-muted);
}

.panel-empty-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--ui-brand-soft), #fffdf7);
  border: 1px solid var(--ui-line);
  box-shadow: var(--ui-shadow-sm);
  opacity: 1;
}

.panel-empty-text {
  max-width: 280px;
  color: var(--ui-muted);
}

.panel-empty {
  padding: 24px 18px;
}

.panel-empty-icon {
  width: 42px;
  height: 42px;
  margin: 0 auto 12px;
  color: var(--ui-brand);
  font-size: 19px;
}

.empty-card {
  width: min(100%, 330px);
  padding: 22px 18px 18px;
  border: 1px solid rgba(198, 161, 91, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.94), rgba(244, 250, 247, 0.88)),
    radial-gradient(circle at 50% 0%, rgba(201, 141, 38, 0.14), transparent 46%);
  box-shadow: 0 18px 44px rgba(19, 32, 31, 0.09);
}

.empty-kicker {
  color: var(--ui-accent-deep);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.empty-title {
  margin-top: 7px;
  color: var(--ui-ink);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.35;
}

.empty-subtitle {
  max-width: 260px;
  margin: 7px auto 0;
  color: var(--ui-muted);
  font-size: 12px;
  line-height: 1.65;
}

.empty-prompts {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 16px;
}

.empty-prompt {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background:
    linear-gradient(rgba(255, 253, 247, 0.92), rgba(255, 253, 247, 0.92)) padding-box,
    linear-gradient(135deg, var(--ui-line), rgba(198, 161, 91, 0.2), var(--ui-line)) border-box;
  color: var(--ui-ink-soft);
  padding: 8px 10px;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  position: relative;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.empty-prompt::after {
  content: "↵";
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ui-faint);
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.empty-prompt:hover {
  background:
    linear-gradient(var(--ui-brand-soft), var(--ui-brand-soft)) padding-box,
    linear-gradient(135deg, rgba(198, 161, 91, 0.38), rgba(255, 253, 247, 0.72), rgba(198, 161, 91, 0.26)) border-box;
  color: var(--ui-brand-deep);
  transform: translateY(-1px);
  box-shadow: var(--ui-shadow-sm);
}

.empty-prompt:hover::after,
.empty-prompt.is-active::after {
  opacity: 1;
  transform: translateY(-50%) translateX(2px);
}

.empty-prompt.is-active {
  background:
    linear-gradient(180deg, #fffdf7, var(--ui-accent-soft)) padding-box,
    linear-gradient(
      115deg,
      rgba(132, 99, 43, 0.42) 0%,
      rgba(198, 161, 91, 0.82) 26%,
      rgba(255, 253, 247, 0.7) 43%,
      rgba(198, 161, 91, 0.34) 64%,
      rgba(132, 99, 43, 0.32) 100%
    ) border-box;
  background-size: 100% 100%, 240% 240%;
  color: var(--ui-brand-deep);
  box-shadow: inset 0 0 0 1px rgba(198, 161, 91, 0.12), 0 7px 16px rgba(24, 24, 24, 0.08);
  animation: shortcut-border-flow 7.5s ease-in-out infinite;
}

.empty-prompt:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(198, 161, 91, 0.16);
}

.chat-msg {
  max-width: 94%;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.68;
  box-shadow: var(--ui-shadow-sm);
}

.chat-msg.user {
  color: #fffdf7;
  background: linear-gradient(135deg, var(--ui-brand-deep), var(--ui-brand));
  border: 1px solid rgba(255, 253, 247, 0.1);
  border-bottom-right-radius: 3px;
}

.chat-msg.ai {
  color: var(--ui-ink-soft);
  background: rgba(255, 253, 247, 0.96);
  border: 1px solid var(--ui-line);
  border-bottom-left-radius: 3px;
}

.chat-msg.ai.analysis {
  background: linear-gradient(180deg, #fffdf7, #f4faf7);
  border-color: rgba(198, 161, 91, 0.22);
}

.chat-msg.ai code,
.chat-msg.ai pre {
  border-radius: 8px;
}

.msg-copy-btn {
  color: var(--ui-faint);
  border: 1px solid transparent;
  border-radius: 8px;
}

.msg-copy-btn:hover {
  color: var(--ui-brand);
  background: var(--ui-brand-soft);
  border-color: rgba(198, 161, 91, 0.18);
}

.msg-copy-btn.copied {
  color: var(--ui-success);
}

.followup-suggestions {
  border-top: 1px dashed var(--ui-line);
}

.followup-btn,
.skill-intent-bar,
.page-context-bar {
  border-radius: 8px;
}

.followup-btn {
  background: linear-gradient(135deg, #fffdf7 0%, var(--ui-brand-soft) 100%);
  border: 1px solid rgba(198, 161, 91, 0.24);
  color: var(--ui-brand-deep);
  box-shadow: none;
}

.followup-btn:hover {
  background: linear-gradient(135deg, var(--ui-brand-soft), #d8eee8);
  border-color: var(--ui-brand);
  color: var(--ui-brand-deep);
  box-shadow: 0 8px 18px rgba(198, 161, 91, 0.16);
}

.chat-input-area {
  border-top: 1px solid var(--ui-line);
  background: rgba(255, 253, 247, 0.96);
  box-shadow: 0 -12px 28px rgba(19, 32, 31, 0.06);
}

.chat-input-row {
  padding: 9px 12px 12px;
  gap: 8px;
}

.chat-input {
  min-height: 38px;
  max-height: 116px;
  padding: 9px 38px 9px 11px;
  background: #fff;
}

.composer-action-btn,
.chat-voice-btn {
  border: 1px solid var(--ui-line);
  background: var(--ui-surface-2);
  color: var(--ui-brand);
  border-radius: 8px;
}

.composer-action-btn:hover,
.chat-voice-btn:hover {
  background: var(--ui-brand-soft);
}

.composer-action-btn {
  flex-shrink: 0;
  height: 34px;
  min-width: 34px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.composer-action-btn.muted {
  color: var(--ui-muted);
  background: #f3f6f1;
}

.attach-tag,
.selected-skill-tag {
  background: var(--ui-brand-soft);
  border: 1px solid rgba(198, 161, 91, 0.2);
  color: var(--ui-brand-deep);
  border-radius: 999px;
}

.attach-remove:hover,
.tag-remove:hover,
.settings-close:hover,
.voice-stop-btn:hover,
.kb-source-delete:hover {
  color: var(--ui-danger) !important;
  background: var(--ui-danger-soft) !important;
}

.settings-overlay {
  background:
    linear-gradient(135deg, rgba(17, 17, 17, 0.28), rgba(70, 66, 58, 0.28)),
    rgba(24, 24, 24, 0.18);
  backdrop-filter: blur(10px);
}

.settings-container {
  border-radius: 8px;
  background: var(--ui-surface);
  border: 1px solid rgba(255, 253, 247, 0.72);
  box-shadow: var(--ui-shadow-lg);
}

.settings-header {
  background: linear-gradient(135deg, #fffdf7 0%, #f3eee2 100%);
  border-bottom: 1px solid var(--ui-line);
}

.settings-header-title {
  color: var(--ui-ink);
}

.settings-tabs {
  gap: 4px;
  padding: 6px 8px 0;
  background: #fffdf7;
  border-bottom: 1px solid var(--ui-line);
}

.settings-tab {
  border-radius: 8px 8px 0 0;
  color: var(--ui-muted);
  border-bottom-width: 2px;
}

.settings-tab.active,
.settings-tab:hover {
  color: var(--ui-brand-deep);
  border-bottom-color: var(--ui-brand);
  background: var(--ui-brand-soft);
}

.settings-panel {
  background: linear-gradient(180deg, #fffdf7, #f8f6f0);
}

.skill-sub-tabs {
  background: #eee9dd;
  border: 1px solid var(--ui-line);
}

.skill-sub-tab {
  color: var(--ui-muted);
}

.skill-sub-tab.active {
  color: var(--ui-brand-deep);
  background: #fffdf7;
  box-shadow: var(--ui-shadow-sm);
}

.skill-sub-tab:hover {
  color: var(--ui-brand);
}

.skill-benchmark-card,
.agent-policy-card,
.automation-queue-card,
.automation-editor,
.model-current-card,
.automation-status-card,
.automation-trigger-card,
.kb-upload-zone,
.kb-status-bar,
.kb-result-summary,
.tool-result-block,
.skill-thinking-block,
.agent-loop-panel {
  border-radius: 8px;
  border-color: var(--ui-line);
  background: rgba(255, 253, 247, 0.9);
  box-shadow: var(--ui-shadow-sm);
}

.skill-benchmark-card,
.agent-policy-card,
.automation-queue-card {
  background: linear-gradient(180deg, rgba(255, 253, 247, 0.98), rgba(244, 250, 247, 0.94));
}

.automation-status-card {
  border-color: rgba(198, 161, 91, 0.24);
  background: var(--ui-brand-soft);
}

.automation-status-card.muted {
  border-color: var(--ui-line);
  background: var(--ui-surface-2);
}

.automation-status-value {
  color: var(--ui-brand-deep);
}

.settings-label,
.install-label,
.automation-item-title,
.skill-item-name,
.tool-name,
.agent-loop-title,
.model-card-info {
  color: var(--ui-ink);
}

.settings-hint,
.skill-item-desc,
.automation-item-meta,
.automation-queue-meta,
.model-card-label,
.tool-preview,
.agent-step,
.agent-log,
.automation-log-text {
  color: var(--ui-muted);
}

.skill-item,
.automation-item,
.automation-queue-item,
.automation-log {
  border-color: var(--ui-line);
  background: rgba(255, 253, 247, 0.96);
  border-radius: 8px;
  box-shadow: 0 1px 0 rgba(19, 32, 31, 0.04);
}

.skill-item:hover,
.automation-item:hover,
.automation-queue-item:hover {
  border-color: rgba(198, 161, 91, 0.34);
  box-shadow: 0 10px 22px rgba(19, 32, 31, 0.08);
}

.badge-builtin {
  background: #eef2ee;
  color: var(--ui-muted);
}

.badge-local,
.automation-queue-status.running,
.agent-loop-status.running,
.automation-log.running .automation-log-status {
  background: var(--ui-info-soft);
  color: var(--ui-info);
}

.badge-remote,
.automation-queue-status.success,
.agent-loop-status.completed,
.automation-log.success .automation-log-status {
  background: var(--ui-success-soft);
  color: var(--ui-success);
}

.agent-loop-status.stale {
  background: var(--ui-accent-soft);
  color: var(--ui-accent-deep);
}

.automation-queue-status.queued {
  background: var(--ui-accent-soft);
  color: var(--ui-accent-deep);
}

.automation-queue-status.error,
.agent-loop-status.failed,
.automation-log.error .automation-log-status,
.skill-list-error,
.stream-error,
.risk-high,
.tool-result-block.error .tool-name,
.tool-result-block.error .tool-status {
  background: var(--ui-danger-soft);
  color: var(--ui-danger) !important;
}

.risk-mid,
.agent-log.warn {
  color: var(--ui-accent-deep);
}

.risk-ok,
.agent-step.completed .agent-step-dot {
  color: var(--ui-success);
}

.agent-loop-panel {
  background: linear-gradient(180deg, rgba(255, 253, 247, 0.98) 0%, rgba(248, 246, 240, 0.96) 100%);
  border-color: rgba(198, 161, 91, 0.24);
}

.agent-loop-panel.collapsed {
  box-shadow: 0 8px 20px rgba(24, 24, 24, 0.08);
  background: rgba(255, 253, 247, 0.94);
}

.agent-loop-panel.expanded {
  box-shadow: 0 14px 30px rgba(24, 24, 24, 0.12);
}

.html-progress-card {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid rgba(198, 161, 91, 0.24);
  border-radius: 7px;
  background: rgba(255, 253, 247, 0.96);
  box-shadow: 0 4px 10px rgba(24, 24, 24, 0.06);
  white-space: normal;
}

.html-progress-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.html-progress-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--ui-brand);
  box-shadow: 0 0 0 4px rgba(198, 161, 91, 0.12);
  flex: 0 0 auto;
  animation: htmlProgressPulse 1.1s ease-in-out infinite;
}

.html-progress-title {
  font-size: 13px;
  font-weight: 650;
  color: var(--ui-ink);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.html-progress-meta {
  margin-left: auto;
  flex: 0 0 auto;
  font-size: 11px;
  line-height: 1.2;
  color: var(--ui-muted);
  white-space: nowrap;
}

.html-progress-bar {
  position: relative;
  height: 4px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(198, 161, 91, 0.14);
}

.html-progress-bar span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 38%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(198, 161, 91, 0.35), var(--ui-brand), rgba(198, 161, 91, 0.35));
  animation: htmlProgressSlide 1.25s ease-in-out infinite;
}

.chat-msg-wrap.html-progress-wrap {
  width: 360px;
  max-width: 94%;
}

.chat-msg.ai.html-progress-msg {
  width: 100%;
  max-width: 100%;
  padding: 3px;
  line-height: 1;
  white-space: normal;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

@keyframes htmlProgressPulse {
  0%, 100% { opacity: 0.58; transform: scale(0.94); }
  50% { opacity: 1; transform: scale(1.08); }
}

@keyframes htmlProgressSlide {
  0% { transform: translateX(-80%); }
  50% { transform: translateX(85%); }
  100% { transform: translateX(230%); }
}

.agent-loop-header {
  background: rgba(255, 253, 247, 0.9);
  border-bottom: 1px solid var(--ui-line);
}

.agent-loop-panel.collapsed .agent-loop-header {
  min-height: 30px;
  padding: 4px 5px 4px 7px;
  border-bottom-color: transparent;
}

.agent-loop-status {
  border-radius: 999px;
  box-shadow: none;
}

.agent-step-dot {
  background: var(--ui-line-strong);
}

.agent-step.in_progress .agent-step-dot {
  background: var(--ui-info);
  box-shadow: 0 0 0 3px rgba(29, 111, 138, 0.12);
}

.agent-step.failed .agent-step-dot {
  background: var(--ui-danger);
}

.agent-loop-logs,
.agent-loop-checkpoints {
  border-color: var(--ui-line);
  background: rgba(255, 253, 247, 0.72);
}

.agent-log.error {
  color: var(--ui-danger);
}

.tool-result-block {
  background: #fffdf7;
  overflow: hidden;
}

.tool-result-block.error {
  border-color: rgba(138, 98, 24, 0.32);
  background: var(--ui-danger-soft);
}

.tool-result-header,
.tool-result-block.error .tool-result-header {
  background: linear-gradient(135deg, #f6f8f2, #edf6f2);
  border-bottom: 1px solid var(--ui-line);
}

.tool-result-header:hover,
.tool-result-block.error .tool-result-header:hover {
  background: var(--ui-brand-soft);
}

.tool-status {
  color: var(--ui-success);
}

.tool-code {
  background: #0f1c1b;
  color: #d8e8e3;
}

.tool-code.error {
  background: #261f13;
  color: #f3d08a;
}

.tool-preview {
  background: #f3f6f1;
  border-top: 1px dashed var(--ui-line);
}

.doc-gen-progress,
.doc-gen-done,
.skill-intent-bar {
  background: linear-gradient(135deg, var(--ui-brand-soft), #f7fbf8);
  border-color: rgba(198, 161, 91, 0.24);
  color: var(--ui-brand-deep);
}

.doc-gen-error {
  background: var(--ui-danger-soft);
  border-color: rgba(138, 98, 24, 0.24);
  color: var(--ui-danger);
}

.doc-gen-spinner {
  border-color: #cfebe2;
  border-top-color: var(--ui-brand);
}

.doc-gen-label,
.skill-intent-bar .skill-intent-text strong {
  color: var(--ui-brand-deep);
}

.doc-gen-timer,
.doc-gen-step,
.doc-gen-step.done {
  background: #d9eee7;
  color: var(--ui-brand-deep);
}

.doc-gen-step.active {
  background: var(--ui-brand);
}

.page-context-bar {
  background: linear-gradient(135deg, var(--ui-accent-soft), #fffaf0);
  border-color: rgba(201, 141, 38, 0.32);
  color: var(--ui-accent-deep);
}

.page-context-bar .page-context-text strong,
.page-context-bar .page-context-no {
  color: var(--ui-accent-deep);
}

.page-context-bar .page-context-no {
  border-color: rgba(201, 141, 38, 0.42);
}

.page-context-bar .page-context-no:hover {
  background: var(--ui-accent-soft);
}

.toast {
  background: rgba(19, 32, 31, 0.92);
}

.toast.warn {
  background: rgba(139, 93, 20, 0.92);
}

.offline-title {
  color: var(--ui-ink);
}

.offline-body code {
  background: #eef3ef;
  color: var(--ui-ink);
}

.btn-fill,
.btn-refresh-skills,
.automation-secondary,
.automation-link-btn,
.agent-loop-btn,
.agent-loop-icon-btn,
.skill-intent-bar .skill-intent-skip {
  color: var(--ui-brand) !important;
  border-color: rgba(198, 161, 91, 0.3) !important;
  background: rgba(255, 253, 247, 0.78) !important;
}

.btn-fill:hover,
.btn-refresh-skills:hover,
.automation-secondary:hover,
.automation-link-btn:hover,
.agent-loop-btn:hover,
.agent-loop-icon-btn:hover,
.skill-intent-bar .skill-intent-skip:hover {
  background: var(--ui-brand-soft) !important;
  color: var(--ui-brand-deep) !important;
}

.model-current-card {
  background: linear-gradient(135deg, #fffdf7 0%, var(--ui-brand-soft) 100%);
  border-color: rgba(198, 161, 91, 0.22);
}

.model-card-status {
  background: var(--ui-accent-soft);
  color: var(--ui-accent-deep);
}

.kb-upload-zone {
  border-color: var(--ui-line-strong);
  background: linear-gradient(180deg, rgba(255, 253, 247, 0.92), rgba(248, 250, 245, 0.86));
}

.kb-upload-zone:hover,
.kb-drag-over {
  border-color: var(--ui-brand);
  background: var(--ui-brand-soft);
}

.install-result.ok {
  background: var(--ui-success-soft);
  color: var(--ui-success);
}

.install-result.err {
  background: var(--ui-danger-soft);
  color: var(--ui-danger);
}

.install-result.pending {
  background: #eef3ef;
  color: var(--ui-muted);
}

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: rgba(216, 225, 220, 0.34);
}

::-webkit-scrollbar-thumb {
  background: rgba(198, 161, 91, 0.34);
  border: 2px solid rgba(255, 253, 247, 0.7);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(198, 161, 91, 0.52);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
