/* AI 网页操作助手样式：悬浮球、可拖动面板、接管态彩色跑马灯边框、响应式 H5 */
.agw-no-record { font-family: inherit; }

/* 悬浮球 */
.agw-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 2147483000;
  width: 58px; height: 58px; border-radius: 18px; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: #fff;
  background: linear-gradient(135deg, #5b8cff, #7b6bff 55%, #9b6bff);
  box-shadow: 0 10px 26px rgba(91,140,255,.45);
  transition: transform .18s ease, box-shadow .18s ease;
}
.agw-fab svg { width: 28px; height: 28px; }
.agw-fab:hover { transform: translateY(-2px) scale(1.05); box-shadow: 0 14px 32px rgba(91,140,255,.55); }
.agw-fab.recording { animation: agw-rec-pulse 1.1s infinite; }
@keyframes agw-rec-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(229,72,72,.55); }
  50% { box-shadow: 0 0 0 12px rgba(229,72,72,0); }
}
.agw-fab.hidden, .hidden.agw-go, .agw-saverow.hidden, .agw-view.hidden,
.agw-tabs.hidden, .agw-tab.hidden, .agw-ghost.hidden, .agw-field.hidden { display: none !important; }

/* 面板 */
.agw-panel {
  position: fixed; right: 22px; bottom: 22px; z-index: 2147483001;
  width: 400px; max-width: calc(100vw - 24px); height: 600px; max-height: calc(100vh - 36px);
  background: #f6f8fd; border-radius: 20px; overflow: hidden;
  display: none; flex-direction: column;
  box-shadow: 0 24px 70px rgba(20,30,60,.30);
  border: 1px solid rgba(20,30,60,.07);
}
.agw-panel.show { display: flex; animation: agw-pop .22s ease; }
@keyframes agw-pop { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }

.agw-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px; cursor: grab;
  color: #1f2740; background: #fff; border-bottom: 1px solid #eef1f6;
  user-select: none;
}
.agw-head:active { cursor: grabbing; }
.agw-avatar {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 12px; color: #fff;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #5b8cff, #7b6bff 55%, #9b6bff);
  box-shadow: 0 6px 16px rgba(91,140,255,.4);
}
.agw-avatar svg { width: 22px; height: 22px; }
.agw-htitle { flex: 1; font-weight: 700; font-size: 15.5px; line-height: 1.3; }
.agw-hstatus { display: flex; align-items: center; gap: 5px; font-weight: 500; font-size: 11.5px; color: #16a34a; margin-top: 2px; }
.agw-online-dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.18); }
.agw-head-btn {
  border: none; background: #f2f4f8; color: #8b93a3; cursor: pointer;
  width: 28px; height: 28px; border-radius: 9px; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.agw-head-btn:hover { background: #e8ebf2; color: #5b6472; }

.agw-tabs { display: flex; gap: 4px; padding: 6px 12px 0; background: #fff; border-bottom: 1px solid #eef1f6; }
.agw-tab {
  flex: 1; border: none; background: transparent; cursor: pointer;
  padding: 9px 0 11px; font-size: 13px; color: #6b7280; border-bottom: 2px solid transparent;
}
.agw-tab:hover { color: #4f7cff; }
.agw-tab.active { color: #4f7cff; border-bottom-color: #4f7cff; font-weight: 600; }

.agw-view { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 14px; gap: 10px; }

/* 对话 */
.agw-chatbody { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding-right: 2px; }
.agw-msg { display: flex; gap: 8px; align-items: flex-start; }
.agw-msg.user { justify-content: flex-end; }
.agw-msgavatar {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 10px; color: #fff;
  display: flex; align-items: center; justify-content: center; margin-top: 1px;
  background: linear-gradient(135deg, #5b8cff, #7b6bff 55%, #9b6bff);
}
.agw-msgavatar svg { width: 17px; height: 17px; }
.agw-bubble { max-width: 80%; padding: 11px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.6; word-break: break-word; white-space: pre-wrap; }
.agw-msg.bot .agw-bubble { background: #fff; color: #1f2937; border-top-left-radius: 5px; box-shadow: 0 2px 10px rgba(20,30,60,.06); }
.agw-msg.user .agw-bubble { background: linear-gradient(135deg, #5b8cff, #7b6bff); color: #fff; border-top-right-radius: 5px; }

/* 欢迎卡片 + 引导示例 */
.agw-welcome-title { font-size: 15px; font-weight: 700; color: #1f2740; margin-bottom: 4px; }
.agw-welcome-sub { font-size: 13px; color: #6b7280; line-height: 1.6; }
.agw-welcome-hint { font-size: 12.5px; color: #9aa3b2; margin-top: 8px; }
.agw-chips { display: flex; flex-direction: column; gap: 7px; margin-top: 12px; }
.agw-chip {
  text-align: left; border: 1px solid #e3e8f2; background: #fafbff; color: #3f4a63;
  border-radius: 10px; padding: 9px 12px 9px 28px; cursor: pointer; font-size: 13px;
  position: relative; transition: border-color .15s, background .15s, transform .1s;
}
.agw-chip::before { content: "→"; position: absolute; left: 12px; color: #5b8cff; font-weight: 700; }
.agw-chip:hover { border-color: #5b8cff; background: #f0f4ff; transform: translateX(2px); }

.agw-inbox { background: #fff; border: 1px solid #e3e8f2; border-radius: 16px; padding: 10px 12px; box-shadow: 0 2px 12px rgba(20,30,60,.05); }
.agw-inbox:focus-within { border-color: #5b8cff; box-shadow: 0 2px 14px rgba(91,140,255,.16); }
.agw-inrow { display: flex; gap: 8px; align-items: flex-end; }
.agw-inrow textarea {
  flex: 1; resize: none; border: none; background: transparent; padding: 4px 2px;
  font-size: 13.5px; font-family: inherit; max-height: 110px; outline: none; color: #1f2937; line-height: 1.5;
}
.agw-send {
  flex: 0 0 auto; border: none; color: #fff; border-radius: 12px; width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  background: linear-gradient(135deg, #5b8cff, #7b6bff); transition: opacity .15s, transform .1s;
}
.agw-send:hover { transform: scale(1.06); }
.agw-inbox.agw-disabled { opacity: .6; }
.agw-inbox.agw-disabled .agw-send { background: #c7cdda; cursor: not-allowed; }
.agw-inhint { font-size: 11px; color: #aab2c2; margin-top: 7px; padding: 0 2px; }
.agw-foot { text-align: center; font-size: 11.5px; color: #aab2c2; padding-top: 2px; }

/* 执行卡片 */
.agw-runcard { margin-top: 8px; padding: 12px 14px; border: 1px solid #e3e8f2; border-radius: 14px; background: #fff; box-shadow: 0 2px 10px rgba(20,30,60,.05); }
.agw-runtitle { font-size: 13.5px; color: #1f2937; }
.agw-runtitle b { color: #5b8cff; }
.agw-runmeta { font-size: 12px; color: #8b93a3; margin: 4px 0 10px; }
.agw-runops { display: flex; gap: 8px; }
.agw-go {
  border: none; cursor: pointer; border-radius: 11px; padding: 9px 14px; font-size: 13.5px; color: #fff;
  background: linear-gradient(135deg, #5b8cff, #7b6bff); white-space: nowrap;
}
.agw-go.sm { padding: 6px 12px; font-size: 12.5px; }
.agw-go.danger { background: linear-gradient(135deg, #ff6b6b, #e5484d); }
.agw-ghost {
  border: 1px solid #d8dee9; background: #fff; color: #4b5563; border-radius: 10px;
  padding: 9px 14px; cursor: pointer; font-size: 13.5px;
}
.agw-ghost.sm { padding: 6px 12px; font-size: 12.5px; }
.agw-tip { font-size: 13px; color: #4b5563; margin-bottom: 6px; }

/* 录制 */
.agw-recbar { display: flex; gap: 8px; }
.agw-recsteps { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.agw-step { display: flex; align-items: flex-start; gap: 8px; padding: 7px 9px; background: #f6f8fc; border-radius: 8px; font-size: 12.5px; }
.agw-step.sensitive { background: #fff4f4; }
.agw-stepno { flex: 0 0 18px; height: 18px; line-height: 18px; text-align: center; border-radius: 50%; background: #4f7cff; color: #fff; font-size: 11px; }
.agw-step.sensitive .agw-stepno { background: #e5484d; }
.agw-steptxt { color: #374151; line-height: 1.5; }
.agw-step.param { background: #eef4ff; }
.agw-step.param .agw-stepno { background: #8a5cff; }
.agw-segdiv { margin: 4px 0; padding: 8px 10px; border: 1px dashed #b9a6ff; border-radius: 10px; background: #f7f4ff; display: flex; flex-direction: column; gap: 6px; }
.agw-segtag { font-size: 12px; color: #7c5cff; text-align: center; font-weight: 600; letter-spacing: .5px; }
.agw-stepedit { margin: -2px 0 4px 26px; display: flex; flex-direction: column; gap: 5px; }
.agw-askrow { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #5b6472; cursor: pointer; }
.agw-askrow input[type=checkbox] { width: 14px; height: 14px; }
.agw-field.sm { padding: 6px 9px; font-size: 12.5px; }
.agw-saverow { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid #eef1f6; padding-top: 10px; }
.agw-field { border: 1px solid #d8dee9; border-radius: 9px; padding: 8px 11px; font-size: 13px; font-family: inherit; outline: none; }
.agw-field:focus { border-color: #4f7cff; }

/* 技能库 */
.agw-skillsbody { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.agw-skill { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid #e6eaf2; border-radius: 12px; }
.agw-skillinfo { flex: 1; min-width: 0; }
.agw-skillname { font-size: 13.5px; font-weight: 600; color: #1f2937; }
.agw-skillmeta { font-size: 11.5px; color: #8b93a3; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agw-skillops { display: flex; gap: 6px; }

.agw-empty { color: #9aa3b2; font-size: 13px; text-align: center; padding: 30px 12px; line-height: 1.6; }

/* 回放高亮 */
.agw-hl {
  outline: 3px solid #4f7cff !important; outline-offset: 2px !important;
  box-shadow: 0 0 0 6px rgba(79,124,255,.22) !important; border-radius: 6px;
  transition: outline-color .2s; position: relative; z-index: 2147482000;
  animation: agw-hl-pulse .9s ease-in-out;
}
@keyframes agw-hl-pulse { 0%,100% { box-shadow: 0 0 0 6px rgba(79,124,255,.22); } 50% { box-shadow: 0 0 0 10px rgba(138,92,255,.30); } }

/* 接管态：全屏彩色跑马灯边框（不挡点击） */
.agw-takeover { position: fixed; inset: 0; z-index: 2147483002; pointer-events: none; display: none; }
.agw-takeover.show { display: block; }
.agw-marquee {
  position: fixed; background-size: 300% 300%;
  background-image: linear-gradient(90deg, #4f7cff, #8a5cff, #e15bd0, #ff9a3d, #2dd4bf, #4f7cff);
}
.agw-marquee.t { top: 0; left: 0; right: 0; height: 5px; animation: agw-flow-x 2.6s linear infinite; }
.agw-marquee.b { bottom: 0; left: 0; right: 0; height: 5px; animation: agw-flow-x 2.6s linear infinite reverse; }
.agw-marquee.l { top: 0; bottom: 0; left: 0; width: 5px; animation: agw-flow-y 2.6s linear infinite; }
.agw-marquee.r { top: 0; bottom: 0; right: 0; width: 5px; animation: agw-flow-y 2.6s linear infinite reverse; }
@keyframes agw-flow-x { 0% { background-position: 0% 50%; } 100% { background-position: 150% 50%; } }
@keyframes agw-flow-y { 0% { background-position: 50% 0%; } 100% { background-position: 50% 150%; } }

/* 状态条 */
.agw-statusbar {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; pointer-events: auto;
  max-width: calc(100vw - 32px); padding: 10px 14px; border-radius: 999px;
  background: rgba(20,24,40,.92); color: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.32);
  font-size: 13px; backdrop-filter: blur(6px);
}
.agw-statusbar.done { background: rgba(28,40,30,.94); }
.agw-status-dot { width: 9px; height: 9px; border-radius: 50%; background: #4f7cff; animation: agw-blink 1s infinite; flex: 0 0 auto; }
.agw-statusbar.done .agw-status-dot { animation: none; background: #34d399; }
@keyframes agw-blink { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
.agw-status-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw; }
.agw-status-actions { display: flex; gap: 6px; }
.agw-sbtn { border: none; cursor: pointer; border-radius: 999px; padding: 6px 12px; font-size: 12.5px; background: rgba(255,255,255,.16); color: #fff; }
.agw-sbtn.primary { background: #4f7cff; }
.agw-sbtn.danger { background: #e5484d; }

/* toast */
.agw-toast {
  position: fixed; left: 50%; top: 24px; transform: translateX(-50%); z-index: 2147483003;
  background: rgba(20,24,40,.92); color: #fff; padding: 9px 16px; border-radius: 999px;
  font-size: 13px; transition: opacity .4s; box-shadow: 0 8px 24px rgba(0,0,0,.28);
}
.agw-toast.hide { opacity: 0; }

/* ============ 操作技能 管理页（AI 能力板块内） ============ */
.agent-admin { max-width: 920px; margin: 0 auto; padding: 4px; }
.agent-admin-empty { color: #8b93a3; text-align: center; padding: 40px 12px; }
.agent-admin-head { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.agent-admin-title { font-size: 18px; font-weight: 700; color: #1f2937; }
.agent-admin-tabs { display: flex; gap: 6px; }
.agent-tab { border: 1px solid #d8dee9; background: #fff; color: #5b6472; border-radius: 999px; padding: 6px 16px; cursor: pointer; font-size: 13.5px; }
.agent-tab.active { background: linear-gradient(135deg, #4f7cff, #8a5cff); color: #fff; border-color: transparent; }
.agent-hint { font-size: 12.5px; color: #8b93a3; line-height: 1.6; margin-bottom: 12px; background: #f6f8fc; padding: 9px 12px; border-radius: 10px; }
.agent-skill-list { display: flex; flex-direction: column; gap: 8px; }
.agent-skill-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid #e6eaf2; border-radius: 12px; background: #fff; }
.agent-skill-main { flex: 1; min-width: 0; }
.agent-skill-name { font-size: 14.5px; font-weight: 600; color: #1f2937; display: flex; align-items: center; gap: 8px; }
.agent-skill-meta { font-size: 12px; color: #8b93a3; margin-top: 3px; }
.agent-skill-ops { display: flex; gap: 6px; }
.agent-btn { border: 1px solid #d8dee9; background: #fff; color: #4b5563; border-radius: 9px; padding: 7px 14px; cursor: pointer; font-size: 13px; white-space: nowrap; }
.agent-btn.primary { background: linear-gradient(135deg, #4f7cff, #8a5cff); color: #fff; border-color: transparent; }
.agent-btn.danger { color: #e5484d; border-color: #f3c0c2; }
.agent-badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #eef1f6; color: #8b93a3; font-weight: 400; }
.agent-badge.learn { background: #eaf1ff; color: #4f7cff; }
.agent-site-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.agent-input { border: 1px solid #d8dee9; border-radius: 9px; padding: 8px 11px; font-size: 13px; outline: none; min-width: 160px; }
.agent-input:focus { border-color: #4f7cff; }
.agent-learn { display: flex; align-items: center; gap: 5px; font-size: 13px; color: #5b6472; cursor: pointer; }
.agent-site-search { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.agent-site-search .agent-input { flex: 1; min-width: 0; }
.agent-sec-title { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: #1f2937; margin: 16px 0 8px; }
.agent-sec-count { font-size: 11.5px; font-weight: 700; color: #fff; background: #f59e0b; border-radius: 999px; padding: 1px 8px; }
.agent-badge.pending { background: #fff4e5; color: #c2790b; }
.agent-badge.rejected { background: #fdecec; color: #d14343; }
.agent-badge.reco { background: #eafaf0; color: #1f9d57; margin-left: 8px; }

/* 集成代码（SDK）面板 */
.agent-sdk-toolbar { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 8px; }
.agent-sdk-toolbar-title { font-size: 14px; font-weight: 600; color: #1f2937; }
.agent-sdk-code {
  margin: 0; padding: 16px 18px; border-radius: 12px; border: 1px solid #2a3350;
  background: #0f1426; color: #d7e0f5; font-size: 12.5px; line-height: 1.7;
  font-family: ui-monospace, SFMono-Regular, "Cascadia Code", Consolas, Menlo, monospace;
  white-space: pre; overflow-x: auto;
}
.agent-sdk-notes { margin-top: 16px; background: #f6f8fc; border-radius: 12px; padding: 14px 16px; }
.agent-sdk-notes-title { font-size: 13.5px; font-weight: 600; color: #1f2937; margin-bottom: 8px; }
.agent-sdk-notes ul { margin: 0; padding-left: 20px; }
.agent-sdk-notes li { font-size: 13px; color: #4b5563; line-height: 1.8; }
.agent-sdk-notes code {
  background: #e8ecf5; color: #4f46e5; border-radius: 5px; padding: 1px 6px; font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

/* 移动端 H5 自适应 */
@media (max-width: 560px) {
  .agw-panel {
    right: 8px; left: 8px; bottom: 8px; top: auto; width: auto; max-width: none;
    height: 76vh; max-height: 76vh;
  }
  .agw-fab { right: 14px; bottom: 14px; width: 52px; height: 52px; border-radius: 16px; }
  .agw-fab svg { width: 25px; height: 25px; }
  .agw-status-text { max-width: 40vw; }
  .agw-statusbar { bottom: 14px; font-size: 12px; }
}
