/* BatchRefiner AI Agent 面板样式（与全局米色 UI 统一） */
#ai2-agent-root {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99998;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* 右侧中间：圆形机器人入口（扁平风机器人脸） */
#ai2-agent-fab {
  pointer-events: auto;
  position: fixed;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  background: rgba(23, 26, 29, .92);
  color: #fff;
  box-shadow: 0 12px 34px rgba(82, 109, 245, .22);
  cursor: pointer;
  transition: transform 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

#ai2-agent-fab svg {
  width: 36px;
  height: 36px;
  display: block;
}

#ai2-agent-fab:hover {
  transform: translateY(-50%) scale(1.08);
}

/* 右侧滑出面板 */
#ai2-agent-panel {
  pointer-events: auto;
  position: fixed;
  right: 18px;
  top: 70px;
  bottom: 24px;
  width: 400px;
  max-width: calc(100vw - 36px);
  background: rgba(255, 255, 255, .97);
  border: 1px solid rgba(154, 162, 169, .32);
  border-radius: var(--ai2-r-panel);
  box-shadow: 0 22px 60px rgba(82, 109, 245, .22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(460px);
  transition: transform 0.22s ease;
}

#ai2-agent-panel.is-open {
  transform: translateX(0);
}

.ai2-agent-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px 10px;
  border-bottom: 1px solid rgba(154, 162, 169, .25);
}

.ai2-agent-head b {
  display: block;
  font-size: 15px;
  color: #171a1d;
}

.ai2-agent-head span {
  font-size: 11px;
  color: #9aa2a9;
}

.ai2-agent-head-btns {
  display: flex;
  gap: 6px;
}

.ai2-agent-mini {
  border: none;
  background: #edeff2;
  color: #33383d;
  border-radius: var(--ai2-r-panel);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

#ai2-agent-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai2-agent-empty {
  font-size: 12px;
  color: #9aa2a9;
  text-align: center;
  padding: 24px 12px;
  line-height: 1.7;
}

.ai2-agent-msg {
  display: flex;
}

.ai2-agent-msg.user {
  justify-content: flex-end;
}

.ai2-agent-bubble {
  max-width: 84%;
  padding: 8px 11px;
  border-radius: var(--ai2-r-panel);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.ai2-agent-msg.user .ai2-agent-bubble {
  background: #526df5;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.ai2-agent-msg.assistant .ai2-agent-bubble {
  background: #fff;
  border: 1px solid #e3e7ea;
  color: #171a1d;
  border-bottom-left-radius: 4px;
}

.ai2-agent-msg.thinking .ai2-agent-bubble,
.ai2-agent-thinking {
  color: #9aa2a9;
}

.ai2-agent-thinking {
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.55;
}

.ai2-agent-thinking summary {
  cursor: pointer;
  color: #9aa2a9;
  user-select: none;
}

.ai2-agent-thinking-body {
  margin-top: 5px;
  padding-left: 10px;
  border-left: 2px solid #eef1ff;
}

.ai2-agent-inputwrap {
  margin: 10px;
  background: #fff;
  border: 1px solid #e3e7ea;
  border-radius: var(--ai2-r-panel);
  box-shadow: 0 8px 24px rgba(82, 109, 245, .08);
  padding: 10px;
}

#ai2-agent-input {
  width: 100%;
  box-sizing: border-box;
  border: none;
  border-radius: var(--ai2-r-field);
  background: transparent;
  padding: 6px 4px;
  font-size: 12px;
  font-family: inherit;
  color: #171a1d;
  resize: none;
  outline: none;
}

#ai2-agent-input:focus {
  outline: none;
}

.ai2-agent-toolbar {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  align-items: center;
}

.ai2-agent-pill {
  flex: 1 1 0;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  background: #fff;
  border: 1px solid #f1f3f5;
  border-radius: var(--ai2-r-field);
  height: 30px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 700;
  color: #667078;
  cursor: pointer;
}

.ai2-agent-pill-label {
  color: #9aa2a9;
  flex-shrink: 0;
}

.ai2-agent-pill-val {
  color: #171a1d;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai2-agent-pill-arrow {
  color: #9aa2a9;
  font-size: 10px;
  margin-left: auto;
  flex-shrink: 0;
}

.ai2-agent-dd {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: max-content;
  min-width: 100%;
  max-width: 200px;
  max-height: 220px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e3e7ea;
  border-radius: var(--ai2-r-field);
  box-shadow: 0 12px 30px rgba(24,32,38, .16);
  padding: 4px;
  z-index: 6;
}

.ai2-dd-item {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: #171a1d;
  padding: 7px 10px;
  border-radius: var(--ai2-r-field);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai2-dd-item:hover {
  background: #f7f8fa;
}

.ai2-dd-item.on {
  background: #e3e7ea;
  color: #171a1d;
}

#ai2-agent-send {
  flex: 0 0 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: #171a1d;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}

#ai2-agent-send:disabled {
  opacity: 0.5;
}

/* Match node controls: warm peach outline, larger hit targets, upward menus. */
.ai2-agent-toolbar {
  gap: 8px;
}

.ai2-agent-pill {
  min-height: 44px;
  height: 44px;
  padding: 0 14px;
  border: 1px solid #e3e7ea;
  background: #fff;
  color: #667078;
  font-size: 12px;
  transition: background .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease;
}

.ai2-agent-pill:hover,
.ai2-agent-pill:has(.ai2-agent-dd) {
  background: #fff;
  border-color: #526df5;
  color: #3f55c4;
  box-shadow: inset 0 0 0 3px #eef1ff;
}

.ai2-agent-pill:has(.ai2-agent-dd) .ai2-agent-pill-label,
.ai2-agent-pill:has(.ai2-agent-dd) .ai2-agent-pill-val,
.ai2-agent-pill:has(.ai2-agent-dd) .ai2-agent-pill-arrow {
  color: #3f55c4;
}

.ai2-agent-dd {
  bottom: calc(100% + 10px);
  padding: 8px;
  border: 1px solid #ccd3d9;
  border-radius: var(--ai2-r-panel);
  box-shadow: 0 18px 42px rgba(82, 109, 245, .18);
}

.ai2-dd-item {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--ai2-r-field);
  display: flex;
  align-items: center;
  font-size: 12px;
}

.ai2-dd-item:hover,
.ai2-dd-item.on {
  background: #fff;
  border-color: #526df5;
  color: #3f55c4;
  box-shadow: inset 0 0 0 2px #eef1ff;
}

#ai2-agent-send {
  flex-basis: 44px;
  height: 44px;
}
