/* 展板智能体「小钩」：可拖动头像浮窗 + 对话面板 */

.agent-fab {
  position: fixed;
  right: clamp(16px, 2vw, 32px);
  bottom: clamp(16px, 2vw, 32px);
  width: clamp(96px, 5.8vw, 124px);
  height: clamp(96px, 5.8vw, 124px);
  padding: 5px;
  border: 4px solid #ffffff;
  border-radius: 50%;
  background: var(--teal-soft);
  box-shadow: 0 14px 36px rgba(23, 60, 64, .28), 0 0 0 8px rgba(255, 255, 255, .3);
  z-index: 50;
  cursor: grab;
  touch-action: none;
  transition: transform .18s ease, box-shadow .18s ease;
}
.agent-fab:hover { transform: scale(1.06); }
.agent-fab img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; pointer-events: none; }
.agent-fab.is-dragging {
  transition: none;
  cursor: grabbing;
  transform: scale(1.1);
  box-shadow: 0 16px 40px rgba(23, 60, 64, .36);
}

.agent-panel {
  position: fixed;
  left: auto;
  top: auto;
  width: min(384px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 150px));
  display: flex;
  flex-direction: column;
  z-index: 60;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(23, 60, 64, .24);
  overflow: hidden;
}

.agent-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(120deg, var(--teal-soft), #f7fbf9 60%, #fff7f3);
}
.agent-head-avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.agent-head-title { flex: 1; min-width: 0; }
.agent-head-title b {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 1px;
  color: var(--ink);
}
.agent-online { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(47, 139, 98, .14); }
.agent-head-title small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agent-close { flex: none; border: 0; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; }

.agent-icon-btn {
  flex: none;
  padding: 3px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.2;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.agent-icon-btn:hover { background: var(--teal-soft); color: var(--teal-deep); }

.agent-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 14px;
  background: linear-gradient(180deg, #f1f6f4, #f8faf9);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.agent-log::-webkit-scrollbar { width: 5px; }
.agent-log::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; }

.agent-msg {
  position: relative;
  max-width: 86%;
  padding: 9px 13px 7px;
  border-radius: 15px;
  font-size: 13.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  animation: agent-in .18s ease both;
  box-shadow: 0 2px 8px rgba(23, 60, 64, .05);
}
.agent-msg.bot {
  align-self: flex-start;
  margin-left: 34px;
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--text);
  border-top-left-radius: 5px;
}
.agent-msg.bot::before {
  content: "";
  position: absolute;
  left: -34px;
  top: -2px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: url("../agent/avatar-lucky.png") center/cover no-repeat #eef6f4;
  border: 1px solid var(--line);
}
.agent-msg.user { align-self: flex-end; background: var(--teal); color: #ffffff; border-bottom-right-radius: 5px; }
.agent-msg.err { align-self: flex-start; background: var(--accent-soft); color: var(--red); border: 1px solid #f0d3c8; }
@keyframes agent-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.agent-quick { display: flex; flex-wrap: wrap; gap: 6px; padding-left: 34px; }
.agent-quick-chip {
  padding: 5px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #ffffff;
  color: var(--teal);
  font-size: 11px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.agent-quick-chip:hover { background: var(--teal); color: #ffffff; }

.agent-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 11px 14px;
  margin-left: 34px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 15px;
  border-top-left-radius: 5px;
}
.agent-typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--muted-2); animation: agent-dot .9s infinite ease-in-out; }
.agent-typing i:nth-child(2) { animation-delay: .15s; }
.agent-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes agent-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-4px); opacity: 1; } }

.agent-status {
  padding: 7px 14px;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted);
  background: var(--teal-soft);
  border-top: 1px solid var(--line);
}

.agent-compose { display: flex; align-items: center; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: #ffffff; }
.agent-input-wrap { position: relative; flex: 1; min-width: 0; display: flex; }
.agent-input {
  flex: 1;
  width: 100%;
  min-width: 0;
  padding: 10px 54px 10px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  outline: none;
  background: #ffffff;
  color: var(--text);
  font-size: 13px;
}
.agent-input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(27, 106, 109, .12); }
.agent-count {
  position: absolute;
  right: 12px;
  bottom: 8px;
  font-size: 10px;
  letter-spacing: .3px;
  color: var(--muted-2);
  pointer-events: none;
}
.agent-count.is-warn { color: var(--accent); font-weight: 500; }

.agent-mic, .agent-send {
  flex: none;
  border: 0;
  border-radius: 999px;
  padding: 9px 14px;
  background: var(--teal);
  color: #ffffff;
  font-size: 12.5px;
  white-space: nowrap;
  cursor: pointer;
}
.agent-mic { background: #ffffff; color: var(--teal); border: 1px solid var(--line-strong); }
.agent-mic.is-listening { background: var(--accent); border-color: var(--accent); color: #ffffff; animation: agent-pulse 1s infinite; }
.agent-mic:disabled, .agent-send:disabled { opacity: .45; cursor: not-allowed; }
.agent-send.is-stop { background: var(--accent); }
@keyframes agent-pulse { 50% { opacity: .55; } }

.agent-foot { display: flex; gap: 8px; padding: 0 12px 10px; }
.agent-ghost-btn {
  padding: 5px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #ffffff;
  color: var(--teal);
  font-size: 11.5px;
  cursor: pointer;
}
.agent-ghost-btn:hover { background: var(--teal-soft); }
.agent-ghost-btn.is-on { background: var(--teal-soft); border-color: var(--teal); color: var(--teal-deep); }
.agent-ghost-btn.is-off { color: var(--muted-2); }

.agent-msg-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 5px;
  font-size: 10px;
  line-height: 1.2;
  color: var(--muted-2);
}
.agent-msg.user .agent-msg-tools { color: rgba(255, 255, 255, .72); }
.agent-msg-tools time { flex: none; letter-spacing: .3px; }
.agent-mini-btn {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--teal);
  font-size: 10px;
  cursor: pointer;
}
.agent-msg.user .agent-mini-btn { color: rgba(255, 255, 255, .85); }
.agent-mini-btn:hover { text-decoration: underline; }

/* 展开（投影远看）模式 */
.agent-panel.is-wide { width: min(720px, 92vw); height: min(760px, calc(100vh - 96px)); }
.agent-panel.is-wide .agent-head { padding: 16px 18px; }
.agent-panel.is-wide .agent-head-title b { font-size: 17px; }
.agent-panel.is-wide .agent-log { padding: 20px 18px; gap: 14px; }
.agent-panel.is-wide .agent-msg { max-width: 75%; font-size: 16px; line-height: 1.8; }
.agent-panel.is-wide .agent-msg-tools { font-size: 12px; }
.agent-panel.is-wide .agent-mini-btn { font-size: 12px; }
.agent-panel.is-wide .agent-input { font-size: 15px; padding: 12px 60px 12px 16px; }
.agent-panel.is-wide .agent-count { font-size: 11px; }
.agent-panel.is-wide .agent-mic,
.agent-panel.is-wide .agent-send { font-size: 14px; padding: 11px 18px; }
.agent-panel.is-wide .agent-quick-chip { font-size: 12.5px; padding: 6px 13px; }

/* 定位到某组时的高亮 */
.board-col.is-flash { animation: board-flash 2.1s ease; }
@keyframes board-flash {
  0%, 100% { box-shadow: none; }
  18%, 62% { box-shadow: 0 0 0 3px rgba(176, 138, 69, .55), 0 14px 34px rgba(23, 60, 64, .18); border-radius: 14px; }
}

.agent-panel [hidden], .agent-quick[hidden] { display: none !important; }
