/* =========================================
   AgentHub-U — 样式系统 (v10.1.0)
   ========================================= */

:root {
  --bg-base: #0B0E14;
  --bg-elevated: #14161A;
  --bg-card-hover: #1C1F26;
  --border-subtle: #282C34;
  --border-hover: #40454F;
  --accent: #3B82F6;
  --accent-glow: rgba(59, 130, 246, 0.15);
  --text-primary: #FFFFFF;
  --text-secondary: #8B8FA4;
  --text-muted: #5F6377;
  --text-placeholder: #5F6377;
  --radius-card: 12px;
  --radius-btn: 8px;
  --radius-full: 9999px;
  --header-height: 64px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, sans-serif;
  overflow: hidden;
}

/* ---------- 应用外壳 ---------- */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: radial-gradient(circle at 50% 40%, #0E131C 0%, #000000 100%);
}

/* ---------- 头部 ---------- */
.header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 32px;
}

.header__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}
.brand-icon {
  color: var(--accent);
  font-size: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  line-height: 0;
}
.brand-icon img {
  width: 28px;
  height: 28px;
  display: block;
  filter: drop-shadow(0 0 6px rgba(124, 227, 255, 0.35));
}
.brand-name { font-size: 18px; font-weight: 600; background: linear-gradient(135deg, #fff 60%, var(--accent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.brand-version { font-size: 11px; color: var(--text-muted); }

.health-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  animation: pulse 2s infinite;
}

.health-indicator.healthy {
  background: #22c55e;
  animation: none;
}

.health-indicator.degraded {
  background: #f59e0b;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.agent-update-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid rgba(59, 130, 246, 0.45);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.92);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}
.agent-update-banner__body {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}
.agent-update-banner__body strong {
  color: var(--text-primary);
  font-size: 14px;
}
.agent-update-banner__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
@media (max-width: 720px) {
  .agent-update-banner {
    align-items: stretch;
    flex-direction: column;
  }
  .agent-update-banner__actions {
    flex-wrap: wrap;
  }
}

.header__actions { display: flex; align-items: center; gap: 16px; }

.user-status {
  padding: 6px 14px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.user-status:hover {
  border-color: var(--accent);
  color: var(--text-primary);
  background: var(--accent-glow);
}

.user-status__email {
  color: var(--text-primary);
}

.user-status__balance {
  color: var(--accent);
  font-weight: 600;
}

.lang-selector-wrapper { position: relative; }
.lang-toggle {
  display: flex; align-items: center; gap: 4px; padding: 4px 10px;
  background: transparent; border: 1px solid var(--border-subtle);
  border-radius: var(--radius-btn); color: var(--text-secondary);
  font-size: 13px; cursor: pointer; transition: 0.2s;
}
.lang-toggle:hover { border-color: var(--border-hover); color: var(--text-primary); }
.lang-toggle .chevron { width: 12px; height: 12px; }

.lang-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 120px; background: var(--bg-elevated);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-card);
  padding: 4px; opacity: 0; visibility: hidden; transform: translateY(-8px);
  transition: 0.2s; box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}
.lang-dropdown.open { opacity: 1; visibility: visible; transform: translateY(0); }
.lang-dropdown button {
  display: block; width: 100%; padding: 6px 12px; background: transparent;
  border: none; border-radius: 4px; color: var(--text-secondary);
  font-size: 13px; text-align: left; cursor: pointer; transition: 0.15s;
}
.lang-dropdown button:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.user-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--bg-elevated);
  border: 1px solid var(--border-subtle); display: flex; align-items: center;
  justify-content: center; cursor: pointer; font-size: 16px;
  transition: 0.2s;
}
.user-avatar:hover { border-color: var(--accent); box-shadow: 0 0 20px var(--accent-glow); }

/* ---------- 主内容区域 ---------- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0 24px 24px 24px;
}

/* ---------- 搜索区 ---------- */
.search-container {
  flex-shrink: 0;
  padding: 20px 0 12px 0;
  display: flex;
  justify-content: center;
}
.input-wrapper {
  position: relative;
  width: 100%;
  max-width: 600px;
}
#commandInput {
  width: 100%; padding: 12px 16px; background: var(--bg-elevated);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-btn);
  font-size: 15px; color: var(--text-primary); outline: none;
  transition: 0.3s; text-align: center;
}
#commandInput::placeholder {
  color: var(--text-placeholder);
  font-weight: 300;
  opacity: 1;
}
#commandInput:focus {
  border-color: var(--accent);
  box-shadow: 0 0 30px var(--accent-glow);
}

/* ---------- 分类标签 ---------- */
.tabs-container {
  flex-shrink: 0;
  padding: 8px 0 16px 0;
}
.category-tabs {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  max-width: 800px; margin: 0 auto;
}
.tab-btn {
  padding: 6px 16px; border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle); background: transparent;
  color: var(--text-secondary); font-size: 13px; cursor: pointer;
  transition: 0.2s;
}
.tab-btn:hover { border-color: var(--border-hover); color: var(--text-primary); }
.tab-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- 网格容器 ---------- */
.grid-container {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

.grid-container::-webkit-scrollbar { width: 4px; }
.grid-container::-webkit-scrollbar-track { background: transparent; }
.grid-container::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: var(--radius-full); }

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 4px 0 20px 0;
}

/* ---------- 卡片 ---------- */
.tool-card {
  display: flex;
  flex-direction: column;
  min-height: 224px;
  padding: 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  transition: all 0.2s ease;
}
.tool-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-2px);
}
.tool-card.unknown {
  border-color: rgba(245, 158, 11, 0.42);
}
.tool-card.unknown:hover {
  border-color: rgba(245, 158, 11, 0.68);
}
.tool-card.running {
  border-color: rgba(34, 197, 94, 0.38);
}
.tool-card.has-failure {
  border-color: rgba(239, 68, 68, 0.38);
}
.tool-card__content { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.tool-card__name { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.tool-card__desc {
  font-size: 13px; color: var(--text-secondary); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical;
  overflow: hidden; text-overflow: ellipsis;
}
.tool-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}
.tool-card__badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  min-height: 24px;
  padding: 3px 7px;
  border-radius: 7px;
  border: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.38);
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.tool-card__badge--terminal {
  border-color: rgba(245, 158, 11, 0.42);
  background: rgba(245, 158, 11, 0.08);
  color: #fbbf24;
}
.tool-card__notice {
  margin-top: 10px;
  padding: 6px 8px;
  border: 1px solid rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.08);
  color: #fbbf24;
  border-radius: var(--radius-btn);
  font-size: 12px;
  line-height: 1.35;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tool-card__notice strong {
  color: #facc15;
  font-size: 12px;
}
.tool-card__notice span {
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}
.tool-card__notice--success {
  border-color: rgba(34, 197, 94, 0.36);
  background: rgba(34, 197, 94, 0.08);
  color: #86efac;
}
.tool-card__notice--success strong {
  color: #86efac;
}
.tool-card__notice--danger {
  border-color: rgba(239, 68, 68, 0.38);
  background: rgba(239, 68, 68, 0.08);
  color: #fca5a5;
}
.tool-card__notice--danger strong {
  color: #fca5a5;
}
.tool-card__footer {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(34px, auto);
  align-items: stretch;
  gap: 8px;
}
.tool-card__action {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 6px 7px; border-radius: var(--radius-btn);
  border: 1px solid var(--border-subtle); background: transparent;
  color: var(--text-secondary); font-size: 12px; cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: keep-all;
  text-align: center;
}
.tool-card__action:hover { border-color: var(--accent); color: var(--text-primary); background: var(--accent-glow); }
.tool-card__action:disabled,
.tool-card__action--disabled,
.tool-card__action--disabled:hover {
  cursor: not-allowed;
  color: var(--text-muted);
  border-color: var(--border-subtle);
  background: rgba(148, 163, 184, 0.08);
  opacity: 0.72;
}
.tool-card.installed .tool-card__action:not(.tool-card__action--skill):not(.tool-card__action--workflow):not(.tool-card__action--danger):not(.tool-card__action--secondary):not(.tool-card__action--disabled) { background: var(--accent); border-color: var(--accent); color: #fff; }
.tool-card.installed .tool-card__action:not(.tool-card__action--skill):not(.tool-card__action--workflow):not(.tool-card__action--danger):not(.tool-card__action--secondary):not(.tool-card__action--disabled):hover { background: #2563EB; border-color: #2563EB; }
.tool-card__action--secondary { background: transparent; border-color: var(--border-subtle); color: var(--text-secondary); }
.tool-card__action--solution { border-color: rgba(20, 184, 166, 0.42); color: #5eead4; }
.tool-card__action--runtime { border-color: rgba(34, 197, 94, 0.42); color: #86efac; }
.tool-card__action--diagnose { border-color: rgba(239, 68, 68, 0.38); color: #fca5a5; }
.tool-card__action--danger { background: transparent !important; border-color: var(--border-subtle) !important; color: var(--text-secondary) !important; }
.tool-card__action--danger:hover { border-color: #ef4444 !important; color: #ef4444 !important; background: rgba(239,68,68,0.08) !important; }

/* ---------- 启动模式下拉 ---------- */
.launch-mode-wrapper { position: relative; display: block; min-width: 0; }
.launch-mode-wrapper .tool-card__action { width: 100%; }
.launch-mode-toggle { cursor: pointer; }
.launch-chevron { font-size: 9px; margin-left: 2px; display: inline-block; }
.launch-mode-menu {
  display: none; position: absolute; top: 100%; left: 0; z-index: 100;
  min-width: 260px; max-width: min(360px, 86vw); background: var(--bg-elevated); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card); padding: 6px; margin-top: 6px;
  box-shadow: 0 18px 48px rgba(0,0,0,0.55); animation: modal-in 0.12s ease;
}
.launch-mode-menu.open { display: block; }
.launch-mode-option {
  display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 9px; align-items: start; width: 100%; padding: 10px; background: transparent;
  border: none; color: var(--text-secondary); font-size: 12px;
  text-align: left; cursor: pointer; border-radius: 6px; transition: 0.15s; white-space: normal;
  line-height: 1.35;
}
.launch-mode-option:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.launch-mode-menu__divider {
  height: 1px;
  margin: 6px 4px;
  background: var(--border-subtle);
}
.launch-mode-option--control .launch-mode-option__icon {
  color: var(--text-secondary);
}
.launch-mode-option__icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-base);
  color: var(--accent);
}
.launch-mode-option__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.launch-mode-option__text strong { color: var(--text-primary); font-size: 12.5px; font-weight: 650; overflow-wrap: anywhere; }
.launch-mode-option__text small { color: var(--text-secondary); font-size: 11.5px; line-height: 1.35; overflow-wrap: anywhere; }
.launch-mode-option__text em { color: var(--accent); font-style: normal; font-size: 10.5px; }

/* ---------- 模型选择器 ---------- */
.model-select-wrapper { margin-top: 4px; }
.model-select {
  width: 100%; padding: 8px 10px; background: var(--bg-base);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-btn);
  color: var(--text-primary); font-size: 13px; outline: none; cursor: pointer;
  transition: border-color 0.2s;
}
.model-select:focus { border-color: var(--accent); box-shadow: 0 0 12px var(--accent-glow); }
.model-select option { background: var(--bg-elevated); color: var(--text-primary); }

/* ---------- Workflow 卡片 ---------- */
.workflow-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  transition: all 0.2s ease;
  margin-bottom: 12px;
}

.workflow-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
}

.workflow-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.workflow-card__name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.workflow-card__stars {
  font-size: 13px;
  color: #f59e0b;
}

.workflow-card__desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.workflow-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.workflow-card__tag {
  padding: 2px 8px;
  font-size: 11px;
  border-radius: var(--radius-full);
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.workflow-card__download {
  align-self: flex-start;
  padding: 6px 16px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.workflow-card__download:hover {
  border-color: var(--accent);
  color: var(--text-primary);
  background: var(--accent-glow);
}

/* ---------- Solution package cards ---------- */
.solution-card-list {
  display: grid;
  gap: 10px;
}
.solution-card {
  display: grid;
  gap: 9px;
  padding: 14px;
  background: #111827;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}
.solution-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.solution-card__header strong {
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.35;
}
.solution-card__header span,
.solution-card__meta span,
.solution-card__checks span {
  color: var(--text-secondary);
  font-size: 11px;
}
.solution-card__desc {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
}
.solution-card__meta,
.solution-card__checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.solution-card__meta span,
.solution-card__checks span {
  padding: 3px 8px;
  border: 1px solid rgba(96, 165, 250, 0.18);
  border-radius: 6px;
  background: rgba(96, 165, 250, 0.08);
}
.solution-card__steps {
  margin: 0;
  padding-left: 18px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.55;
}
.solution-card__detail-btn {
  width: fit-content;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid rgba(20, 184, 166, 0.38);
  border-radius: 7px;
  background: rgba(20, 184, 166, 0.08);
  color: #5eead4;
  font-size: 12px;
  cursor: pointer;
}
.solution-card__detail-btn:hover {
  border-color: rgba(20, 184, 166, 0.68);
  background: rgba(20, 184, 166, 0.14);
}
.solution-card__detail-btn--deliver {
  border-color: rgba(251, 191, 36, 0.42);
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
  font-weight: 700;
}
.solution-card__detail-btn--deliver:hover {
  border-color: rgba(251, 191, 36, 0.72);
  background: rgba(251, 191, 36, 0.18);
}

/* ---------- XiaoU local Agent install guidance ---------- */
.agent-required-modal {
  width: min(720px, calc(100vw - 28px));
}
.agent-required-hero .tool-info-icon {
  width: 42px;
  min-width: 42px;
  height: 42px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
}
.agent-required-guide {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(96, 165, 250, 0.32);
  border-radius: 8px;
  background: #0d1117;
  text-align: left;
}
.agent-required-guide__title {
  color: #f8fafc;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.35;
}
.agent-required-guide__lead,
.agent-required-note,
.agent-required-boundary {
  color: #c9d1d9;
  font-size: 13px;
  line-height: 1.65;
  margin: 0;
}
.agent-required-steps {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.agent-required-steps li {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid #30363d;
  border-radius: 8px;
  background: #111827;
}
.agent-required-steps strong {
  color: #7ee787;
  font-size: 13px;
}
.agent-required-steps span {
  color: #c9d1d9;
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.agent-required-trust,
.agent-required-advanced,
.agent-required-boundary {
  border: 1px solid #30363d;
  border-radius: 8px;
  background: #161b22;
  padding: 12px;
}
.agent-required-trust strong {
  color: #f8fafc;
  font-size: 13px;
}
.agent-required-trust ol {
  margin: 8px 0 0 18px;
  padding: 0;
  color: #c9d1d9;
  font-size: 13px;
  line-height: 1.6;
}
.agent-required-advanced summary {
  color: #58a6ff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}
.agent-required-advanced p {
  color: #c9d1d9;
  font-size: 13px;
  line-height: 1.6;
  margin: 8px 0;
}
.agent-required-advanced code {
  display: block;
  padding: 10px;
  border-radius: 8px;
  background: #010409;
  color: #7ee787;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.agent-required-actions,
.agent-required-os-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.agent-required-actions button,
.agent-required-os-switch button {
  min-height: 36px;
  border-radius: 8px;
  border: 1px solid #30363d;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
}
.agent-required-primary {
  background: #238636;
  color: #fff;
  border-color: #2ea043 !important;
}
.agent-required-secondary {
  background: #1f6feb;
  color: #fff;
  border-color: #388bfd !important;
}
.agent-required-ghost,
.agent-required-os-switch button {
  background: #21262d;
  color: #f8fafc;
}

@media (max-width: 640px) {
  .agent-required-steps li {
    grid-template-columns: 1fr;
  }
  .agent-required-actions button,
  .agent-required-os-switch button {
    width: 100%;
  }
}
.solution-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.solution-card__detail-btn--health {
  border-color: rgba(96, 165, 250, 0.36);
  background: rgba(96, 165, 250, 0.08);
  color: #93c5fd;
}
.solution-card__detail-btn--health:hover {
  border-color: rgba(96, 165, 250, 0.68);
  background: rgba(96, 165, 250, 0.14);
}
.solution-detail {
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  display: grid;
  gap: 10px;
}
.solution-detail__title {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
}
.solution-detail__desc,
.solution-detail__section,
.solution-detail__loading {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.55;
}
.solution-detail__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.solution-detail__grid div {
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  padding: 7px 8px;
  background: rgba(15, 23, 42, 0.36);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 12px;
}
.solution-detail__grid strong,
.solution-detail__section strong {
  color: var(--text-primary);
}
.solution-detail__section ol,
.solution-detail__section ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

/* ---------- 空状态 ---------- */
.empty-state {
  padding: 60px 0; text-align: center; color: var(--text-muted);
  font-size: 16px;
}

.solution-health {
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  display: grid;
  gap: 8px;
}
.solution-health__head,
.solution-health__row {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}
.solution-health__head {
  color: var(--text-primary);
  font-size: 13px;
}
.solution-health__head span,
.solution-health__badge {
  width: fit-content;
  min-width: 56px;
  text-align: center;
  padding: 3px 7px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-secondary);
  font-size: 11px;
}
.solution-health__row {
  padding: 7px;
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  background: rgba(15, 23, 42, 0.32);
}
.solution-health__section {
  padding: 8px 9px;
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  background: rgba(15, 23, 42, 0.22);
}
.solution-health__section > strong {
  display: block;
  color: var(--text-primary);
  font-size: 12px;
  margin-bottom: 6px;
}
.solution-health__steps {
  margin: 0;
  padding-left: 18px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.55;
}
.solution-health__section a {
  color: #93c5fd;
  text-decoration: none;
}
.solution-health__section a:hover {
  text-decoration: underline;
}
.solution-health__row strong {
  display: block;
  color: var(--text-primary);
  font-size: 12px;
  margin-bottom: 3px;
}
.solution-health__row p,
.solution-health__action {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
}
.solution-health__action {
  margin-top: 4px;
  color: #fbbf24;
}
.solution-health__row--passed .solution-health__badge,
.solution-health--passed .solution-health__head span {
  border-color: rgba(34, 197, 94, 0.38);
  background: rgba(34, 197, 94, 0.12);
  color: #86efac;
}
.solution-health__row--blocked .solution-health__badge,
.solution-health--blocked .solution-health__head span {
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.12);
  color: #fca5a5;
}
.solution-health__row--pending .solution-health__badge,
.solution-health__row--warning .solution-health__badge,
.solution-health--warning .solution-health__head span,
.solution-health--pending .solution-health__head span {
  border-color: rgba(251, 191, 36, 0.36);
  background: rgba(251, 191, 36, 0.11);
  color: #fde68a;
}
.solution-delivery {
  margin-top: 2px;
  padding: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.28);
  display: grid;
  gap: 9px;
}
.solution-delivery__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-primary);
  font-size: 13px;
}
.solution-delivery__resume {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 9px;
  border: 1px solid rgba(96, 165, 250, 0.2);
  border-radius: 7px;
  background: rgba(96, 165, 250, 0.07);
}
.solution-delivery__resume span {
  min-width: 0;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
}
.solution-delivery__head span {
  flex: 0 0 auto;
  padding: 3px 8px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 11px;
}
.solution-delivery__bar {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
}
.solution-delivery__bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #14b8a6, #60a5fa);
}
.solution-delivery__message {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
}
.solution-delivery__quick {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
  padding: 8px;
  border: 1px solid rgba(20, 184, 166, 0.22);
  border-radius: 7px;
  background: rgba(20, 184, 166, 0.06);
}
.solution-delivery__quick-copy {
  min-width: 0;
}
.solution-delivery__quick-copy strong {
  display: block;
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.35;
}
.solution-delivery__quick-copy p {
  margin: 3px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}
.solution-delivery__quick-copy span {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.4;
}
.solution-delivery__report {
  margin-top: 6px;
}
.solution-delivery__report summary {
  color: #93c5fd;
  font-size: 12px;
  cursor: pointer;
}
.solution-delivery__report pre {
  max-height: 220px;
  overflow: auto;
  margin: 6px 0 0;
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 7px;
  background: rgba(2, 6, 23, 0.35);
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.solution-delivery__form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 6px;
}
.solution-delivery__form label {
  display: grid;
  gap: 4px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.25;
}
.solution-delivery__form input,
.solution-delivery__form select {
  width: 100%;
  min-width: 0;
  height: 30px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 6px;
  background: rgba(2, 6, 23, 0.3);
  color: var(--text-primary);
  font-size: 12px;
  padding: 4px 7px;
}
.solution-delivery__form input::placeholder {
  color: var(--text-muted);
}
.solution-delivery__quick-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
.solution-delivery__phases {
  display: grid;
  gap: 6px;
}
.solution-delivery__phase {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 8px;
  padding: 7px;
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  background: rgba(2, 6, 23, 0.25);
}
.solution-delivery__phase > span {
  width: fit-content;
  min-width: 56px;
  align-self: start;
  padding: 3px 6px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 6px;
  color: var(--text-secondary);
  text-align: center;
  font-size: 11px;
}
.solution-delivery__phase strong {
  display: block;
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.35;
}
.solution-delivery__phase p,
.solution-delivery__phase em,
.solution-delivery__actions p {
  margin: 3px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
  font-style: normal;
}
.solution-delivery__phase em {
  color: #fbbf24;
}
.solution-delivery__phase--passed > span,
.solution-delivery--ready .solution-delivery__head span {
  border-color: rgba(34, 197, 94, 0.38);
  background: rgba(34, 197, 94, 0.12);
  color: #86efac;
}
.solution-delivery__phase--blocked > span,
.solution-delivery--blocked .solution-delivery__head span {
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.12);
  color: #fca5a5;
}
.solution-delivery__phase--pending > span,
.solution-delivery__phase--warning > span,
.solution-delivery--pending .solution-delivery__head span,
.solution-delivery--waiting_for_user_auth .solution-delivery__head span {
  border-color: rgba(251, 191, 36, 0.36);
  background: rgba(251, 191, 36, 0.11);
  color: #fde68a;
}
.solution-delivery__actions {
  padding: 8px;
  border: 1px solid rgba(251, 191, 36, 0.2);
  border-radius: 7px;
  background: rgba(251, 191, 36, 0.07);
}
.solution-delivery__actions strong {
  display: block;
  color: var(--text-primary);
  font-size: 12px;
}
.solution-delivery__action-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.solution-delivery__action-item p {
  margin: 0;
  min-width: 0;
}
.solution-delivery__action-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}
.solution-delivery__action-meta span {
  padding: 2px 6px;
  border: 1px solid rgba(94, 234, 212, 0.24);
  border-radius: 6px;
  background: rgba(20, 184, 166, 0.08);
  color: #99f6e4;
  font-size: 11px;
  line-height: 1.35;
}
.solution-delivery__boundary {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.45;
}
.solution-delivery__action-btn {
  border: 1px solid rgba(94, 234, 212, 0.34);
  border-radius: 6px;
  background: rgba(20, 184, 166, 0.12);
  color: #99f6e4;
  padding: 5px 8px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.solution-delivery__action-btn--secondary {
  border-color: rgba(148, 163, 184, 0.28);
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-secondary);
}
.solution-delivery__action-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}
.solution-deliverable {
  display: grid;
  gap: 8px;
}
.solution-deliverable__head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-primary);
  font-size: 12px;
}
.solution-deliverable__head span {
  color: var(--text-muted);
  font-size: 11px;
}
.solution-deliverable__section {
  display: grid;
  gap: 6px;
  padding: 7px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 7px;
  background: rgba(2, 6, 23, 0.22);
}
.solution-deliverable__section > strong {
  color: var(--text-primary);
  font-size: 12px;
}
.solution-deliverable__metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 6px;
}
.solution-deliverable__metrics span {
  display: grid;
  gap: 2px;
  padding: 6px;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.09);
  color: var(--text-primary);
  font-size: 12px;
}
.solution-deliverable__metrics strong {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}
.solution-deliverable__items {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.solution-deliverable__items li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-primary);
  font-size: 12px;
}
.solution-deliverable__items span {
  color: var(--text-muted);
  text-align: right;
}
@media (max-width: 560px) {
  .solution-delivery__resume,
  .solution-delivery__head {
    align-items: flex-start;
    flex-direction: column;
  }
  .solution-delivery__phase,
  .solution-health__head,
  .solution-health__row {
    grid-template-columns: 1fr;
  }
  .solution-delivery__action-item {
    grid-template-columns: 1fr;
  }
  .solution-delivery__quick {
    grid-template-columns: 1fr;
  }
  .solution-delivery__form {
    grid-template-columns: 1fr 1fr;
  }
  .solution-delivery__form label:first-child {
    grid-column: 1 / -1;
  }
  .solution-delivery__quick-actions {
    justify-content: stretch;
  }
  .solution-delivery__action-btn {
    width: 100%;
  }
  .solution-deliverable__head,
  .solution-deliverable__items li {
    flex-direction: column;
  }
  .solution-deliverable__items span {
    text-align: left;
  }
}

/* ---------- Toast ---------- */
.toast-container {
  position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%);
  z-index: 999; display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 10px 20px; background: var(--bg-elevated);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-btn);
  box-shadow: 0 8px 32px rgba(0,0,0,0.6); color: var(--text-primary);
  font-size: 14px; animation: toast-in 0.3s ease;
}
.toast--success { border-color: #22C55E; }
.toast--error { border-color: #EF4444; }
.toast--info { border-color: var(--accent); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- 模态框 ---------- */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(8px); z-index: 500;
  display: none; align-items: center; justify-content: center; padding: 24px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg-elevated); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card); max-width: 560px; width: 100%;
  max-height: 80vh; display: flex; flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,0.8); animation: modal-in 0.25s ease;
}
.modal--wide { max-width: 720px; }
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.95) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border-subtle);
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close {
  background: transparent; border: none; color: var(--text-muted);
  font-size: 20px; cursor: pointer; padding: 4px;
}
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }

/* ---------- 底部操作栏 ---------- */
.bottom-bar {
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border-subtle);
  padding: 8px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.bottom-bar__actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.bar-btn {
  padding: 6px 14px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.bar-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
  background: var(--accent-glow);
}

.bar-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bar-divider {
  width: 1px;
  height: 24px;
  background: var(--border-subtle);
  margin: 0 6px;
}

.bottom-bar__legal,
.bottom-bar__sponsor {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 2px;
  opacity: 0.7;
  transition: 0.2s;
}

.bottom-bar__legal {
  opacity: 0.85;
}

.bottom-bar__legal a {
  color: var(--text-muted);
  text-decoration: none;
}

.bottom-bar__legal a:hover,
.bottom-bar__sponsor:hover { opacity: 1; color: var(--text-secondary); }

.tool-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow), inset 0 0 20px var(--accent-glow);
}

/* ---------- 右键菜单 ---------- */
.context-menu {
  position: fixed; z-index: 9999; min-width: 160px;
  background: var(--bg-elevated); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card); padding: 4px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6); animation: modal-in 0.15s ease;
}
.context-menu button {
  display: block; width: 100%; padding: 8px 12px; background: transparent;
  border: none; color: var(--text-secondary); font-size: 13px;
  text-align: left; cursor: pointer; border-radius: 4px; transition: 0.15s;
}
.context-menu button:hover { background: var(--bg-card-hover); color: var(--text-primary); }

/* ---------- 系统信息 ---------- */
.info-row {
  display: flex; justify-content: space-between; padding: 6px 0;
  border-bottom: 1px solid var(--border-subtle); font-size: 13px;
}
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--text-muted); }
.info-value { color: var(--text-primary); }

/* ---------- 认证表单 ---------- */
.auth-form .form-group {
  margin-bottom: 16px;
}

.auth-form .form-label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.auth-form .form-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-btn);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: 0.2s;
}

.auth-form .form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
}

.auth-form .form-actions {
  margin-top: 20px;
}

.auth-form .form-switch {
  text-align: center;
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

.auth-form .form-switch span {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}

.current-balance {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-base);
  border-radius: var(--radius-btn);
  margin-bottom: 16px;
  border: 1px solid var(--border-subtle);
}

.current-balance-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.current-balance-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}

/* ---------- 套餐计划 ---------- */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.plan-intro {
  grid-column: 1 / -1;
  padding: 12px 14px;
  border: 1px solid rgba(59, 130, 246, 0.28);
  border-radius: var(--radius-card);
  background: rgba(59, 130, 246, 0.08);
}
.plan-intro__title {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
}
.plan-intro__body {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
}
.plan-card {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}
.plan-card:hover {
  border-color: var(--border-hover);
}
.plan-card--current {
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
}
.plan-card--economy {
  --plan-accent: #3B82F6;
}
.plan-card--professional {
  --plan-accent: #8B5CF6;
}
.plan-card--pro {
  --plan-accent: #8B5CF6;
}
.plan-card--flagship {
  --plan-accent: #F59E0B;
}
.plan-card--free {
  --plan-accent: #6B7280;
}
.plan-card__badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--plan-accent);
  color: #fff;
  opacity: 0.9;
}
.plan-card__name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.plan-card__sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.plan-card__price {
  font-size: 24px;
  font-weight: 700;
  color: var(--plan-accent, var(--text-primary));
  margin-bottom: 2px;
}
.plan-card__price small {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}
.plan-card__desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
  flex: 1;
}
.plan-card__features {
  list-style: none;
  padding: 0;
  margin: 0 0 14px 0;
  font-size: 12px;
  color: var(--text-secondary);
}
.plan-card__features li {
  padding: 3px 0;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  line-height: 1.35;
}
.plan-card__features li::before {
  content: "✓";
  color: var(--plan-accent, #22C55E);
  font-weight: 700;
}
.plan-card .btn {
  margin-top: auto;
}
.plan-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  font-size: 12px;
  color: var(--text-secondary);
  flex-wrap: wrap;
  gap: 8px;
}
.plan-status-bar__plan {
  color: var(--accent);
  font-weight: 600;
}
.plan-status-bar__days {
  color: var(--text-primary);
}
.plan-loading {
  text-align: center;
  padding: 40px 0;
  color: var(--text-muted);
  font-size: 14px;
}
.plan-error {
  text-align: center;
  padding: 20px 0;
  color: #EF4444;
  font-size: 13px;
}

/* ---------- 一键接入 ---------- */
.gateway-access { margin-top: 12px; }
.gateway-divider { border: none; border-top: 1px solid var(--border-subtle); margin: 12px 0; }
.gateway-card {
  background: var(--bg-elevated); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card); padding: 12px 16px; margin-bottom: 10px;
}
.gateway-card__label { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.gateway-card__value { font-size: 22px; font-weight: 700; color: #22c55e; }
.gateway-card__hint {
  display: inline-block;
  margin-left: 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}
.gateway-card__code {
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  font-size: 13px; color: var(--text-primary); word-break: break-all;
  background: var(--bg-base); padding: 6px 10px; border-radius: 6px;
  margin: 6px 0;
}
.gateway-models {
  font-size: 12px; color: var(--text-secondary); line-height: 1.6;
}
.gateway-model-scope {
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  margin: 2px 0 6px;
}
.gateway-model-source {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0 10px;
}
.gateway-model-source__btn {
  min-height: 52px;
  padding: 8px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-base);
  color: var(--text-secondary);
  cursor: pointer;
  text-align: left;
  transition: border-color .18s ease, background .18s ease, color .18s ease;
}
.gateway-model-source__btn strong,
.gateway-model-source__btn span {
  display: block;
}
.gateway-model-source__btn strong {
  color: var(--text-primary);
  font-size: 12.5px;
  margin-bottom: 3px;
}
.gateway-model-source__btn span {
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.35;
}
.gateway-model-source__btn:hover:not(:disabled),
.gateway-model-source__btn.active {
  border-color: var(--accent);
  background: var(--accent-glow);
}
.gateway-model-source__btn.active strong {
  color: var(--accent);
}
.gateway-model-source__btn:disabled {
  cursor: not-allowed;
  opacity: .46;
}
.gateway-card--models { margin-bottom: 0; }
.gateway-model-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.gateway-model-check,
.gateway-model-checks label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: 6px;
  background: rgba(59, 130, 246, 0.09);
  color: var(--text-primary);
  font-size: 12px;
}
.gateway-model-check input,
.gateway-model-checks input {
  accent-color: var(--accent);
}
.gateway-key-panel {
  text-align: center;
  padding: 22px 18px;
}
.gateway-key-panel__icon {
  font-size: 42px;
  margin-bottom: 10px;
}
.gateway-key-panel__title {
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}
.gateway-key-panel__code {
  display: inline-block;
  margin: 8px 0;
  background: var(--bg-base);
  color: #58a6ff;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 8px 14px;
  font: 600 15px/1.3 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
}
.gateway-key-panel__hint,
.gateway-key-reason {
  max-width: 520px;
  margin: 8px auto 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}
.gateway-model-checks--panel {
  justify-content: center;
  margin: 14px 0;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  min-width: 0;
}
.settings-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-elevated);
}
.settings-card__label {
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0;
}
.settings-card__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}
.settings-card__row strong,
.settings-card__row span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.settings-card__desc {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.settings-card__muted {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.settings-card__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.settings-card__actions .btn {
  max-width: 100%;
  white-space: normal;
}

/* ---------- Tool progress ---------- */
.tool-progress-overlay {
  position: fixed;
  inset: 0;
  z-index: 11000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0,0,0,0.62);
  backdrop-filter: blur(8px);
}
.tool-progress-overlay.open { display: flex; }
.tool-progress-modal {
  width: min(540px, 100%);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  box-shadow: 0 24px 64px rgba(0,0,0,0.75);
  overflow: hidden;
  animation: modal-in 0.18s ease;
}
.tool-progress-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-subtle);
}
.tool-progress-modal__eyebrow {
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 4px;
  text-transform: uppercase;
}
.tool-progress-modal h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}
.tool-progress-modal__close {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}
.tool-progress-modal__body { padding: 18px; }
.tool-progress-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
}
.tool-progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3B82F6, #22C55E);
  transition: width 0.25s ease;
}
.tool-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
  color: var(--text-secondary);
  font-size: 13px;
}
.tool-progress-percent {
  color: var(--text-primary);
  font-weight: 700;
}
.tool-progress-elapsed {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.tool-progress-status {
  flex: 1 1 220px;
  min-width: 0;
  text-align: right;
}
.tool-progress-hint {
  margin-top: 10px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
}
.tool-progress-launch {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px;
  border: 1px solid rgba(59, 130, 246, .32);
  border-radius: 8px;
  background: rgba(59, 130, 246, .08);
}
.tool-progress-launch[hidden] {
  display: none;
}
.tool-progress-launch code {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text-secondary);
  font-size: 12px;
}
.tool-progress-log {
  min-height: 96px;
  max-height: 180px;
  margin-top: 14px;
  padding: 12px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.55;
}
.tool-progress-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}
.tool-progress-actions[hidden] {
  display: none;
}
.tool-progress-diagnose {
  min-height: 32px;
  padding: 7px 11px;
  border: 1px solid rgba(251, 191, 36, .48);
  border-radius: 7px;
  background: rgba(251, 191, 36, .12);
  color: #fbbf24;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.tool-progress-diagnose:hover {
  border-color: rgba(251, 191, 36, .75);
  background: rgba(251, 191, 36, .18);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 16px;
  border-radius: var(--radius-btn);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  white-space: nowrap;
  line-height: 1;
}
.btn:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
}
.btn--primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn--primary:hover {
  background: rgba(59, 130, 246, 0.85);
  border-color: var(--accent);
  color: #fff;
}
.btn--primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn--ghost {
  background: transparent;
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}
.btn--ghost:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}
.btn--small {
  padding: 4px 10px;
  font-size: 11px;
}
.btn--full { width: 100%; }

/* ---------- 激活 ---------- */
.modal--narrow { max-width: 420px; }
.activation-section { margin-bottom: 16px; }
.activation-section--machine { display: none; }
.activation-label {
  display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px;
}
.machine-id-box {
  background: var(--bg-base); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-btn); padding: 10px 14px;
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  font-size: 13px; color: var(--accent); word-break: break-all;
  user-select: all; cursor: text;
}
.activation-hint {
  font-size: 12px; color: var(--text-muted); margin-top: 6px; line-height: 1.5;
}
.activation-input {
  width: 100%; padding: 10px 14px; background: var(--bg-base);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-btn);
  font-size: 14px; color: var(--text-primary); outline: none;
  transition: border-color 0.2s; font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  letter-spacing: 2px;
}
.activation-input:focus { border-color: var(--accent); }
.activation-input::placeholder {
  color: var(--text-placeholder); letter-spacing: 0;
}
.activation-actions { margin-bottom: 0; }
.activation-message {
  font-size: 13px; margin-top: 8px; min-height: 20px; text-align: center;
}
.activation-message.success { color: #22C55E; }
.activation-message.error { color: #EF4444; }
.bar-btn--activate {
  border-color: var(--accent); color: var(--accent);
}
.bar-btn--activate:hover {
  background: var(--accent-glow); border-color: var(--accent); color: var(--accent);
}

/* ---------- 充值 ---------- */
.recharge-section { margin-bottom: 18px; }
.recharge-boundary-note {
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.06);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.55;
}
.recharge-section-label {
  font-size: 13px; color: var(--text-secondary); margin-bottom: 8px;
}
.recharge-amount-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.recharge-amount-btn {
  padding: 10px 8px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-btn);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  line-height: 1.3;
}
.recharge-amount-btn:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
}
.recharge-amount-btn.selected {
  border-color: var(--accent);
  background: var(--accent-glow);
  box-shadow: 0 0 12px var(--accent-glow);
}
.recharge-amount-btn small {
  display: block;
  font-size: 10px;
  font-weight: 400;
  color: var(--accent);
  margin-top: 2px;
}
.recharge-amount-btn--recommended {
  border-color: rgba(59, 130, 246, 0.3);
}
.recharge-method-tabs {
  display: flex;
  gap: 8px;
}
.recharge-method-tab {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-btn);
  background: var(--bg-base);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.recharge-method-tab:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}
.recharge-method-tab.active {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--accent);
}
.recharge-qr-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
}
.recharge-qr-section img {
  width: 200px;
  height: 200px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 8px;
  background: #fff;
  object-fit: contain;
}
.recharge-qr-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 10px;
}
.recharge-qr-placeholder {
  width: 100%;
  margin: 0;
  padding: 18px 16px;
  color: var(--text-muted);
  text-align: center;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-btn);
  background: rgba(255,255,255,0.02);
  font-size: 13px;
  line-height: 1.5;
}
.recharge-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 0;
  font-size: 14px;
  color: var(--text-secondary);
}
.recharge-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: recharge-spin 0.8s linear infinite;
}
@keyframes recharge-spin {
  to { transform: rotate(360deg); }
}
.recharge-status.success {
  color: #22C55E;
}
.recharge-status.fail {
  color: #EF4444;
}
.recharge-actions {
  padding-top: 4px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .header { padding: 0 16px; }
  .brand-name { font-size: 15px; }
  .brand-version { display: none; }
  .user-status { padding: 4px 10px; font-size: 12px; }
  .tool-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .search-container { padding: 12px 0 8px 0; }
  .tabs-container { padding: 4px 0 8px 0; }
  .category-tabs { gap: 4px; }
  .tab-btn { font-size: 12px; padding: 4px 12px; }
  .bottom-bar { padding: 6px 12px; }
  .bottom-bar__actions { gap: 4px; flex-wrap: wrap; }
  .bar-group { gap: 4px; }
  .bar-divider { margin: 0 3px; height: 20px; }
  .bar-btn { font-size: 12px; padding: 4px 8px; }
  .bottom-bar__sponsor { font-size: 10px; }
}

@media (max-width: 480px) {
  .tool-grid { grid-template-columns: 1fr; }
  .tool-card { min-height: 180px; padding: 16px; }
}

/* ---------- API 密钥 Badge ---------- */
.api-key-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  margin-left: 6px;
  cursor: help;
  vertical-align: middle;
}
.api-key-badge.configured { color: #22c55e; }
.api-key-badge.missing { color: #f59e0b; }
.api-key-badge.unknown { color: var(--text-muted); }

/* ---------- API 密钥管理 ---------- */
.key-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}
.key-item:last-child { border-bottom: none; }
.key-provider {
  font-weight: 600;
  color: var(--text-primary);
  min-width: 140px;
  font-size: 12px;
}
.key-value {
  flex: 1;
  color: var(--text-secondary);
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  font-size: 12px;
}
.key-add-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.key-add-form select,
.key-add-form input {
  flex: 1;
  min-width: 120px;
  padding: 8px 10px;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-btn);
  color: var(--text-primary);
  font-size: 13px;
}
.key-add-form select:focus,
.key-add-form input:focus {
  border-color: var(--accent);
  outline: none;
}
.empty-keys {
  padding: 20px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* =========================================
   AI 客服浮窗 (ahub-bot-*)
   ========================================= */

/* ── 浮窗容器 ── */
.ahub-bot {
  position: fixed;
  z-index: 9999;
  font-family: system-ui, -apple-system, sans-serif;
}

/* ── 浮动气泡 ── */
.ahub-bot__bubble {
  position: fixed;
  bottom: 128px;
  right: 24px;
  width: 122px;
  height: 54px;
  border-radius: 999px;
  background: linear-gradient(135deg, #58a6ff, #3fb950);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.26);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease, box-shadow 0.25s ease;
  z-index: 10000;
  user-select: none;
  touch-action: none;
}
.ahub-bot__bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 14px 34px rgba(37, 99, 235, 0.32);
}
.ahub-bot__bubble:active {
  transform: scale(0.95);
}
.ahub-bot__bubble--hidden {
  transform: scale(0);
  opacity: 0;
  pointer-events: none;
}
.ahub-bot__bubble-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font-size: 21px;
  line-height: 1;
  filter: none;
}
.ahub-bot__bubble-icon img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  display: block;
}
.ahub-bot__bubble-text {
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  text-shadow: none;
}
.ahub-bot__bubble-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ef4444;
  border: 2px solid rgba(255, 255, 255, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: ahub-bot-pulse 2s infinite;
}
@keyframes ahub-bot-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

/* ── 聊天窗口 ── */
.ahub-bot__window {
  position: fixed;
  bottom: 104px;
  right: 24px;
  width: min(380px, calc(100vw - 32px));
  height: min(540px, calc(100vh - 132px));
  min-width: 300px;
  min-height: 330px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 42px rgba(15, 23, 42, 0.34), 0 0 0 1px rgba(255,255,255,0.04);
  overflow: hidden;
  resize: both;
  z-index: 10001;
  animation: ahub-bot-window-in 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: bottom right;
}
@keyframes ahub-bot-window-in {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}
.ahub-bot__window--minimized {
  height: 64px !important;
  min-height: 58px;
  overflow: hidden;
  border-radius: 16px;
  resize: none;
}

/* ── 头部 ── */
.ahub-bot__header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background:
    linear-gradient(135deg, rgba(96, 165, 250, 0.16), rgba(59, 130, 246, 0.06) 60%, transparent),
    var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
  cursor: move;
  user-select: none;
  min-height: 64px;
}
.ahub-bot__header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  position: relative;
  padding-top: 7px;
}
.ahub-bot__header-avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: transparent;
  flex-shrink: 0;
  font-size: 22px;
  line-height: 1;
}
.ahub-bot__header-avatar img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 5px rgba(59, 130, 246, 0.22));
}
.ahub-bot__header-avatar-dot {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid var(--bg-elevated);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}
.ahub-bot__header-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.ahub-bot__header-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  letter-spacing: 0.2px;
}
.ahub-bot__header-status {
  position: absolute;
  left: 0;
  top: -3px;
  font-size: 11px;
  color: #22c55e;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.14);
  border: 1px solid rgba(34, 197, 94, 0.28);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.18);
  line-height: 1;
  white-space: nowrap;
}
.ahub-bot__header-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.7);
}
.ahub-bot[data-bot-status="offline"] .ahub-bot__header-status {
  color: #94a3b8;
  background: rgba(148, 163, 184, 0.14);
  border-color: rgba(148, 163, 184, 0.24);
}
.ahub-bot[data-bot-status="offline"] .ahub-bot__header-status::before,
.ahub-bot[data-bot-status="offline"] .ahub-bot__header-avatar-dot {
  background: #94a3b8;
  box-shadow: 0 0 6px rgba(148, 163, 184, 0.45);
}
.ahub-bot[data-bot-status="server"] .ahub-bot__header-status {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.13);
  border-color: rgba(251, 191, 36, 0.30);
}
.ahub-bot[data-bot-status="server"] .ahub-bot__header-status::before,
.ahub-bot[data-bot-status="server"] .ahub-bot__header-avatar-dot {
  background: #fbbf24;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.58);
}
.ahub-bot[data-bot-status="working"] .ahub-bot__header-status {
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.16);
  border-color: rgba(96, 165, 250, 0.34);
}
.ahub-bot[data-bot-status="working"] .ahub-bot__header-status::before,
.ahub-bot[data-bot-status="working"] .ahub-bot__header-avatar-dot {
  background: #60a5fa;
  box-shadow: 0 0 9px rgba(96, 165, 250, 0.68);
}
.ahub-bot__header-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.ahub-bot__header-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.ahub-bot__header-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}
.ahub-bot__header-btn--close:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* ── 能力模式切换 ── */
.ahub-bot__cap-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  position: relative;
  margin-right: 4px;
}
.ahub-bot__cap-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.ahub-bot__cap-slider {
  position: relative;
  width: 32px;
  height: 18px;
  background: var(--border-subtle);
  border-radius: 12px;
  transition: background 0.2s;
  flex-shrink: 0;
}
.ahub-bot__cap-slider::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-secondary);
  transition: all 0.2s;
}
.ahub-bot__cap-toggle input:checked + .ahub-bot__cap-slider {
  background: linear-gradient(135deg, #58a6ff, #3fb950);
}
.ahub-bot__cap-toggle input:checked + .ahub-bot__cap-slider::before {
  left: 16px;
  background: #fff;
}
.ahub-bot__cap-label {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  min-width: 48px;
}

/* ── 能力切换警告弹窗 ── */
.ahub-bot__cap-warning {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10010;
  animation: ahub-bot-fade-in 0.15s ease;
}
@keyframes ahub-bot-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.ahub-bot__cap-warning-content {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 24px;
  max-width: 360px;
  width: 90%;
  text-align: center;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
}
.ahub-bot__cap-warning-icon {
  font-size: 36px;
  margin-bottom: 12px;
}
.ahub-bot__cap-warning-text {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: 20px;
}
.ahub-bot__cap-warning-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.ahub-bot__cap-warning-btn {
  padding: 8px 20px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.ahub-bot__cap-warning-btn--no {
  background: transparent;
  color: var(--text-secondary);
}
.ahub-bot__cap-warning-btn--no:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}
.ahub-bot__cap-warning-btn--yes {
  background: linear-gradient(135deg, #58a6ff, #3fb950);
  color: #fff;
  border-color: transparent;
}
.ahub-bot__cap-warning-btn--yes:hover {
  opacity: 0.9;
}

/* ── 消息区域 ── */
.ahub-bot__messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
  background:
    radial-gradient(circle at top right, rgba(96, 165, 250, 0.05), transparent 60%),
    var(--bg-base);
}
.ahub-bot__messages::-webkit-scrollbar {
  width: 4px;
}
.ahub-bot__messages::-webkit-scrollbar-track {
  background: transparent;
}
.ahub-bot__messages::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 4px;
}

/* ── 消息 ── */
.ahub-bot__msg {
  display: flex;
  gap: 10px;
  max-width: 85%;
  animation: ahub-bot-msg-in 0.2s ease;
  position: relative;
  align-items: flex-end;
}
@keyframes ahub-bot-msg-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.ahub-bot__msg--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.ahub-bot__msg--bot {
  align-self: flex-start;
}
.ahub-bot__msg--system {
  align-self: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 12px;
  background: var(--bg-elevated);
  border-radius: 8px;
  max-width: 90%;
  text-align: center;
}
.ahub-bot__msg--error .ahub-bot__msg-content--bot {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}
.ahub-bot__msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}
.ahub-bot__msg-avatar img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  display: block;
}
.ahub-bot__msg--user .ahub-bot__msg-avatar {
  background: linear-gradient(135deg, #60A5FA, #3B82F6);
  border-color: transparent;
  color: #fff;
}
.ahub-bot__msg-content {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
  background: linear-gradient(135deg, #3B82F6, #2563EB);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.25);
}
.ahub-bot__msg-content--bot {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
.ahub-bot__msg-content--bot p {
  margin: 0 0 6px;
}
.ahub-bot__msg-content--bot p:last-child {
  margin-bottom: 0;
}
.ahub-bot__msg-content--bot code {
  background: var(--bg-base);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  color: #f59e0b;
}
.ahub-bot__msg-content--bot pre {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px;
  overflow-x: auto;
  margin: 8px 0;
}
.ahub-bot__msg-content--bot pre code {
  background: none;
  padding: 0;
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.5;
}
.ahub-bot__msg-content--bot ul,
.ahub-bot__msg-content--bot ol {
  padding-left: 20px;
  margin: 6px 0;
}
.ahub-bot__msg-content--bot li {
  margin-bottom: 4px;
}
.ahub-bot__msg-content--bot h1,
.ahub-bot__msg-content--bot h2,
.ahub-bot__msg-content--bot h3,
.ahub-bot__msg-content--bot h4 {
  margin: 8px 0 4px;
  color: var(--text-primary);
}
.ahub-bot__msg-content--bot h1 { font-size: 16px; }
.ahub-bot__msg-content--bot h2 { font-size: 14px; }
.ahub-bot__msg-content--bot h3 { font-size: 13px; }
.ahub-bot__msg-content--bot blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 10px;
  margin: 6px 0;
  color: var(--text-secondary);
  font-style: italic;
}
.ahub-bot__msg-content--bot a {
  color: #58a6ff;
  text-decoration: underline;
}
.ahub-bot__msg-content--bot hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 8px 0;
}
.ahub-bot__msg-content--bot table {
  border-collapse: collapse;
  width: 100%;
  margin: 8px 0;
  font-size: 12px;
}
.ahub-bot__msg-content--bot th,
.ahub-bot__msg-content--bot td {
  border: 1px solid var(--border-subtle);
  padding: 6px 8px;
  text-align: left;
}
.ahub-bot__msg-content--bot th {
  background: var(--bg-elevated);
  font-weight: 600;
}
.ahub-bot__msg--task {
  max-width: 92%;
}
.ahub-bot__msg--task .ahub-bot__msg-content--bot {
  width: min(340px, 100%);
  padding: 0;
  overflow: hidden;
}
.ahub-bot__task-card {
  padding: 12px;
}
.ahub-bot__task-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.ahub-bot__task-head div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.ahub-bot__task-head strong {
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.ahub-bot__task-head span {
  color: var(--text-muted);
  font-size: 12px;
}
.ahub-bot__task-badge {
  flex-shrink: 0;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--border-subtle);
}
.ahub-bot__task-badge--active {
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.28);
}
.ahub-bot__task-badge--success {
  color: #86efac;
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.28);
}
.ahub-bot__task-badge--error {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.28);
}
.ahub-bot__task-progress {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  border: 1px solid rgba(148, 163, 184, 0.14);
}
.ahub-bot__task-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3b82f6, #22c55e);
  transition: width 0.25s ease;
}
.ahub-bot__task-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.35;
}
.ahub-bot__task-meta span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}
.ahub-bot__task-id {
  margin-top: 7px;
  color: var(--text-muted);
  font-size: 10.5px;
  font-family: 'Cascadia Code', 'Consolas', monospace;
}
.ahub-bot__task-hint {
  margin-top: 9px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}
.ahub-bot__task-details {
  max-height: 110px;
  overflow: auto;
  margin: 9px 0 0;
  padding: 9px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-base);
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.ahub-bot__task-diagnose {
  margin-top: 10px;
  width: 100%;
  min-height: 32px;
  border: 1px solid rgba(96, 165, 250, 0.36);
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.14);
  color: #bfdbfe;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.ahub-bot__task-diagnose:hover {
  background: rgba(37, 99, 235, 0.22);
  color: #dbeafe;
}
.ahub-bot__msg-time {
  position: absolute;
  bottom: -16px;
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  pointer-events: none;
}
.ahub-bot__msg--user .ahub-bot__msg-time {
  right: 0;
}
.ahub-bot__msg--bot .ahub-bot__msg-time {
  left: 36px;
}

/* ── 空白状态 ── */
.ahub-bot__empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ahub-bot__empty-content {
  text-align: center;
  padding: 20px 24px;
}
.ahub-bot__empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: transparent;
}
.ahub-bot__empty-icon img {
  width: 78px;
  height: 78px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 4px 12px rgba(59, 130, 246, 0.4));
}
.ahub-bot__empty-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.ahub-bot__empty-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 22px;
  line-height: 1.5;
}

/* ── 快速操作按钮 ── */
.ahub-bot__quick-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
}
.ahub-bot__quick-btn {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: center;
  white-space: nowrap;
  line-height: 1.2;
}
.ahub-bot__quick-btn:hover {
  border-color: #60A5FA;
  background: rgba(96, 165, 250, 0.12);
  color: #fff;
  transform: translateY(-1px);
}

/* ── 输入区域 ── */
.ahub-bot__input-area {
  flex-shrink: 0;
  border-top: 1px solid var(--border-subtle);
  padding: 12px 14px 10px;
  background: var(--bg-elevated);
}
.ahub-bot__input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 6px 6px 6px 14px;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-base);
  transition: border-color 0.18s, box-shadow 0.18s;
}
.ahub-bot__input-wrapper:focus-within {
  border-color: #60A5FA;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
}
.ahub-bot__input {
  flex: 1;
  padding: 8px 0;
  border-radius: 0;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 13.5px;
  font-family: inherit;
  resize: none;
  outline: none;
  min-height: 28px;
  max-height: 120px;
  line-height: 1.5;
}
.ahub-bot__input:focus {
  border: none;
  box-shadow: none;
}
.ahub-bot__input::placeholder {
  color: var(--text-placeholder);
}
.ahub-bot__send {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #60A5FA, #3B82F6);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.35);
}
.ahub-bot__send:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.5);
}
.ahub-bot__send:active:not(:disabled) {
  transform: scale(0.95);
}
.ahub-bot__send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.ahub-bot__input-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 4px;
  min-height: 20px;
}
.ahub-bot__char-count {
  font-size: 11px;
  color: var(--text-muted);
}
.ahub-bot__char-count--warn {
  color: #ef4444;
}

/* ── 打字指示器 ── */
.ahub-bot__typing {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  align-self: flex-start;
  margin-left: 36px;
  animation: ahub-bot-msg-in 0.2s ease;
}
.ahub-bot__typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: ahub-bot-typing-bounce 1.2s infinite ease-in-out;
}
.ahub-bot__typing-dot:nth-child(1) { animation-delay: 0s; }
.ahub-bot__typing-dot:nth-child(2) { animation-delay: 0.2s; }
.ahub-bot__typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes ahub-bot-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}
.ahub-bot__typing-text {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 4px;
}

/* ── 确认弹窗 ── */
.ahub-bot__confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10020;
  animation: ahub-bot-fade-in 0.15s ease;
}
.ahub-bot__confirm-modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 24px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  animation: ahub-bot-confirm-in 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes ahub-bot-confirm-in {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}
.ahub-bot__confirm-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.ahub-bot__confirm-icon {
  font-size: 28px;
}
.ahub-bot__confirm-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}
.ahub-bot__confirm-body {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: 16px;
  background: var(--bg-base);
  border-radius: 10px;
  padding: 14px;
  border: 1px solid var(--border-subtle);
}
.ahub-bot__confirm-body p {
  margin: 0 0 6px;
}
.ahub-bot__confirm-body p:last-child {
  margin-bottom: 0;
}
.ahub-bot__confirm-tool {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 8px;
  font-size: 13px;
}
.ahub-bot__confirm-tool-label {
  color: var(--text-secondary);
}
.ahub-bot__confirm-tool-name {
  color: #f59e0b;
  font-weight: 600;
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
}
.ahub-bot__confirm-boundary {
  margin: 0 0 12px;
  padding: 9px 11px;
  border: 1px solid rgba(59, 130, 246, 0.22);
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.06);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
}
.ahub-bot__confirm-timeout {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
  justify-content: center;
}
.ahub-bot__confirm-timer {
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  color: var(--accent);
  font-weight: 600;
}
.ahub-bot__confirm-actions {
  display: flex;
  gap: 10px;
}
.ahub-bot__confirm-btn {
  flex: 1;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid var(--border-subtle);
  text-align: center;
}
.ahub-bot__confirm-btn--cancel {
  background: var(--bg-base);
  color: var(--text-secondary);
}
.ahub-bot__confirm-btn--cancel:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}
.ahub-bot__confirm-btn--confirm {
  background: linear-gradient(135deg, #58a6ff, #3fb950);
  color: #fff;
  border-color: transparent;
}
.ahub-bot__confirm-btn--confirm:hover {
  opacity: 0.9;
}

/* ── 响应式 ── */
@media (max-width: 500px) {
  .ahub-bot__window {
    bottom: 12px;
    right: 5vw;
    left: 5vw;
    width: 90vw;
    height: calc(100vh - 24px) !important;
    max-height: calc(100vh - 24px);
    border-radius: 16px;
    min-width: 0;
    resize: none;
  }
  .ahub-bot__bubble {
    bottom: 124px;
    right: 16px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    padding: 0;
  }
  .ahub-bot__bubble-text {
    display: none;
  }
  .ahub-bot__confirm-modal {
    width: 95%;
    margin: 16px;
  }
}
@media (min-width: 501px) and (max-width: 768px) {
  .ahub-bot__window {
    width: 380px;
    height: min(560px, calc(100vh - 148px));
    max-height: calc(100vh - 148px);
    right: 16px;
    bottom: 116px;
  }
}

/* ── 欢迎引导（未登录） ── */
.ahub-bot__welcome {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 100%;
  padding: 0;
  overflow: visible;
}
.ahub-bot__welcome-content {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ahub-bot__welcome-hero {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.ahub-bot__welcome-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, rgba(96, 165, 250, 0.2), rgba(96, 165, 250, 0) 70%);
}
.ahub-bot__welcome-avatar img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 4px 10px rgba(59, 130, 246, 0.35));
}
.ahub-bot__welcome-copy {
  min-width: 0;
}
.ahub-bot__welcome-kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 3px;
}
.ahub-bot__welcome-title {
  color: var(--text-primary);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 5px;
}
.ahub-bot__welcome-desc {
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 1.5;
}
.ahub-bot__welcome-flow {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 8px;
  padding: 2px 0;
}
.ahub-bot__welcome-flow span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.2;
}
.ahub-bot__welcome-flow span:not(:last-child)::after {
  content: '→';
  color: var(--text-muted);
  font-weight: 500;
  margin-left: 8px;
}
.ahub-bot__welcome-note {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}
.ahub-bot__welcome-samples {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.ahub-bot__welcome-sample-btn {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(96, 165, 250, 0.18);
  background: transparent;
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
  text-align: center;
  line-height: 1.25;
  white-space: normal;
}
.ahub-bot__welcome-sample-btn--wide {
  grid-column: 1 / -1;
}
.ahub-bot__welcome-sample-btn:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}
.ahub-bot__welcome-sample-btn:active {
  transform: translateY(0);
}
.ahub-bot__welcome-sample-btn:disabled,
.ahub-bot__welcome-sample-btn:disabled:hover {
  cursor: wait;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
  border-color: rgba(96, 165, 250, 0.18);
  background: transparent;
}

/* ── 输入框禁用状态（未登录） ── */
.ahub-bot__input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: var(--border-subtle);
}

/* ── SKILL button & modal ── */
.tool-card .tool-card__action--skill {
  background: #7c3aed;
  border-color: #7c3aed;
  color: #fff;
}
.tool-card .tool-card__action--skill:hover {
  background: #6d28d9;
  border-color: #6d28d9;
  color: #fff;
}
.tool-card .tool-card__action--workflow {
  background: #0f766e;
  border-color: #0f766e;
  color: #fff;
}
.tool-card .tool-card__action--workflow:hover {
  background: #0d9488;
  border-color: #0d9488;
  color: #fff;
}
.skill-modal-overlay{position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,.75);z-index:10000;display:flex;align-items:center;justify-content:center}
.skill-modal{background:#1a1a2e;border-radius:8px;max-width:600px;width:90%;max-height:80vh;overflow-y:auto;padding:24px}
.skill-modal__header{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}
.skill-modal__header h3{color:#e0e0e0;margin:0;font-size:20px}
.skill-modal__close{background:none;border:none;color:#e0e0e0;font-size:24px;cursor:pointer}
.skill-card{background:#16213e;border-radius:8px;padding:16px;margin-bottom:12px}
.skill-card__name{color:#7c3aed;font-weight:700;font-size:16px;margin-bottom:4px}
.skill-card__meta{color:#8b949e;font-size:12px;margin-bottom:8px}
.skill-card__desc{color:#c9d1d9;font-size:13px;margin-bottom:8px}
.skill-card__tags{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:10px}
.skill-tag{background:#1e3a5f;color:#58a6ff;padding:2px 8px;border-radius:4px;font-size:11px}
.skill-card__install{background:#238636;color:#fff;border:none;padding:6px 16px;border-radius:6px;cursor:pointer;font-size:13px}
.skill-card__install:hover{background:#2ea043}
.tool-info-modal { max-width: 720px; }
.tool-info-hero {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 14px;
  align-items: center;
  padding: 2px 0 14px;
  border-bottom: 1px solid var(--border-subtle);
}
.tool-info-icon {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent-glow);
  color: var(--accent);
  font-size: 24px;
}
.tool-info-title { color: var(--text-primary); font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.tool-info-desc { color: var(--text-secondary); font-size: 13px; line-height: 1.55; }
.tool-info-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.tool-info-summary > div {
  padding: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-base);
}
.tool-info-summary span {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  margin-bottom: 4px;
}
.tool-info-summary strong {
  color: var(--text-primary);
  font-size: 13px;
}
.tool-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.tool-info-block,
.tool-info-section {
  padding: 10px 0;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.tool-info-section { margin-top: 6px; }
.tool-info-label {
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0;
  margin-bottom: 6px;
}
.tool-info-value { color: var(--text-primary); font-size: 13px; }
.tool-info-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.tool-info-modes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 9px;
}
.tool-info-mode {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-height: 68px;
  padding: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-base);
  color: var(--text-secondary);
  text-align: left;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.tool-info-mode:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-glow);
  transform: translateY(-1px);
}
.tool-info-mode:disabled {
  cursor: not-allowed;
  opacity: .65;
}
.tool-info-mode__icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--accent);
  background: var(--bg-elevated);
}
.tool-info-mode__copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tool-info-mode__copy strong { color: var(--text-primary); font-size: 13px; overflow-wrap: anywhere; }
.tool-info-mode__copy small { color: var(--text-secondary); font-size: 11.5px; line-height: 1.35; overflow-wrap: anywhere; }
.tool-info-mode__copy em { color: var(--accent); font-size: 10.5px; font-style: normal; }
.launch-mode-picker { max-width: 680px; }
.launch-mode-picker__hint {
  color: var(--text-secondary);
  font-size: 13px;
  margin: -4px 0 14px;
}
.launch-mode-picker__readiness {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: -4px 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.08);
}
.launch-mode-picker__readiness strong {
  color: var(--text-primary);
  font-size: 13px;
}
.launch-mode-picker__readiness span {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}
.launch-mode-picker__readiness--ready {
  border-color: rgba(34, 197, 94, 0.38);
  background: rgba(34, 197, 94, 0.08);
}
.launch-mode-picker__readiness--pending {
  border-color: rgba(245, 158, 11, 0.38);
  background: rgba(245, 158, 11, 0.08);
}
.launch-mode-picker__grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.launch-mode-picker__mode {
  min-height: 78px;
}
.launch-mode-picker__mode--primary {
  border-color: rgba(59, 130, 246, 0.48);
  background: rgba(59, 130, 246, 0.09);
}
.launch-mode-picker__more {
  width: fit-content;
  margin: 10px 0 0;
  padding: 7px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-base);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
}
.launch-mode-picker__more:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}
.launch-mode-picker__advanced {
  margin-top: 10px;
}
.launch-mode-picker__actions {
  justify-content: flex-end;
  margin-top: 16px;
}
.launch-mode-picker__controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}
.launch-mode-picker__control-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.launch-mode-picker__control-copy strong {
  color: var(--text-primary);
  font-size: 12.5px;
}
.launch-mode-picker__control-copy span {
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.4;
}
.launch-mode-picker__control-buttons {
  display: flex;
  gap: 10px;
  flex: 0 0 auto;
}
@media (max-width: 640px) {
  .launch-mode-picker__controls {
    align-items: stretch;
    flex-direction: column;
  }
  .launch-mode-picker__control-buttons {
    width: 100%;
  }
  .launch-mode-picker__control-buttons .btn {
    flex: 1;
  }
}
.tool-info-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  background: var(--bg-base);
  font-size: 12px;
  line-height: 1.25;
}
.tool-info-pill--warn { border-color: rgba(245,158,11,.5); color: #fbbf24; }
.tool-info-pill--ok { border-color: rgba(34,197,94,.45); color: #86efac; }
.tool-info-note {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(59, 130, 246, .32);
  background: rgba(59, 130, 246, .08);
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 1.55;
}
.tool-info-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
}
@media (max-width: 720px) {
  .tool-info-summary,
  .tool-info-grid {
    grid-template-columns: 1fr;
  }
}
.ahub-bot__input:disabled:focus {
  box-shadow: none;
  border-color: var(--border-subtle);
}

/* =========================================
   先贤语音对话 — Sage Voice Conversation
   ========================================= */

/* ── 先贤按钮 ── */
.sage-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-btn);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-right: 12px;
  white-space: nowrap;
}

.sage-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* ── 先贤面板容器 ── */
.ahub-sage {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
}

.ahub-sage__content {
  width: 100%;
  max-width: 800px;
  height: 90vh;
  max-height: 800px;
  background: var(--bg-elevated);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* ── 先贤列表视图 ── */
.ahub-sage__list-header {
  padding: 32px 24px 24px;
  text-align: center;
  border-bottom: 1px solid var(--border-subtle);
}

.ahub-sage__list-title {
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.ahub-sage__list-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
}

.ahub-sage__list {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  align-content: start;
}

/* ── 先贤卡片 ── */
.ahub-sage__card {
  background: var(--bg-card-hover);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.ahub-sage__card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--sage-color, #667eea);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.ahub-sage__card:hover {
  border-color: var(--sage-color, #667eea);
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.ahub-sage__card:hover::before {
  transform: scaleX(1);
}

.ahub-sage__card-avatar {
  margin-bottom: 12px;
}

.ahub-sage__card-avatar img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid var(--sage-color, #667eea);
  object-fit: cover;
}

.ahub-sage__card-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.ahub-sage__card-era {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.ahub-sage__card-school {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── 聊天视图 ── */
.ahub-sage__chat-header {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  background: var(--bg-base);
  border-bottom: 1px solid var(--border-subtle);
  gap: 16px;
}

.ahub-sage__back-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--radius-btn);
  transition: all 0.2s;
}

.ahub-sage__back-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.ahub-sage__chat-sage-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.ahub-sage__avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  object-fit: cover;
  transition: all 0.3s ease;
}

.ahub-sage__avatar--speaking {
  border-color: #4ade80;
  box-shadow: 0 0 20px rgba(74, 222, 128, 0.5);
  animation: sage-speaking 1.5s ease-in-out infinite;
}

@keyframes sage-speaking {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.ahub-sage__chat-sage-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.ahub-sage__chat-sage-era {
  font-size: 12px;
  color: var(--text-secondary);
}

.ahub-sage__chat-actions {
  display: flex;
  gap: 8px;
}

.ahub-sage__tts-toggle,
.ahub-sage__clear-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-btn);
  transition: all 0.2s;
}

.ahub-sage__tts-toggle:hover,
.ahub-sage__clear-btn:hover {
  background: var(--bg-card-hover);
}

/* ── 消息区域 ── */
.ahub-sage__messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ahub-sage__msg {
  display: flex;
  gap: 12px;
  max-width: 80%;
  animation: sage-msg-in 0.3s ease-out;
}

@keyframes sage-msg-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.ahub-sage__msg--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.ahub-sage__msg--sage {
  align-self: flex-start;
}

.ahub-sage__msg--system {
  align-self: center;
}

.ahub-sage__msg-avatar img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.ahub-sage__msg-content {
  padding: 12px 16px;
  border-radius: 12px;
  position: relative;
}

.ahub-sage__msg-content--user {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-bottom-right-radius: 4px;
}

.ahub-sage__msg-content--sage {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.ahub-sage__msg-content--system {
  background: var(--bg-base);
  color: var(--text-secondary);
  font-size: 13px;
  text-align: center;
}

.ahub-sage__msg-name {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.ahub-sage__msg-text {
  line-height: 1.6;
}

.ahub-sage__msg-speak {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}

.ahub-sage__msg-content--sage:hover .ahub-sage__msg-speak {
  opacity: 1;
}

/* ── 输入指示器 ── */
.ahub-sage__typing {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  color: var(--text-secondary);
  font-size: 14px;
}

.ahub-sage__typing-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: sage-typing 1.4s ease-in-out infinite;
}

.ahub-sage__typing-dot:nth-child(2) { animation-delay: 0.2s; }
.ahub-sage__typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes sage-typing {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ── 输入区域 ── */
.ahub-sage__input-area {
  padding: 16px 20px;
  background: var(--bg-base);
  border-top: 1px solid var(--border-subtle);
}

.ahub-sage__interim {
  padding: 8px 12px;
  background: var(--bg-card-hover);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 12px;
  font-style: italic;
}

.ahub-sage__waveform-container {
  height: 60px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ahub-sage__waveform {
  width: 100%;
  height: 60px;
  background: var(--bg-card-hover);
  border-radius: 8px;
}

.ahub-sage__input-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.ahub-sage__text-input {
  flex: 1;
  background: var(--bg-card-hover);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-btn);
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
}

.ahub-sage__text-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.ahub-sage__text-input::placeholder {
  color: var(--text-placeholder);
}

.ahub-sage__send-btn {
  background: var(--accent);
  border: none;
  color: white;
  padding: 12px;
  border-radius: var(--radius-btn);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
}

.ahub-sage__send-btn:hover {
  background: #2563eb;
  transform: translateY(-1px);
}

/* ── 录音按钮 ── */
.ahub-sage__record-btn {
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  border: none;
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-btn);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
  -webkit-user-select: none;
}

.ahub-sage__record-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
}

.ahub-sage__record-btn--recording {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  animation: sage-pulse 1.5s ease-in-out infinite;
}

@keyframes sage-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}

.ahub-sage__record-icon {
  font-size: 18px;
}

.ahub-sage__record-text {
  font-size: 13px;
}

/* ── 响应式设计 ── */
@media (max-width: 768px) {
  .ahub-sage__content {
    width: 100%;
    height: 100vh;
    max-height: none;
    border-radius: 0;
  }

  .ahub-sage__list {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    padding: 16px;
  }

  .ahub-sage__card {
    padding: 16px;
  }

  .ahub-sage__card-avatar img {
    width: 48px;
    height: 48px;
  }

  .ahub-sage__msg {
    max-width: 90%;
  }

  .ahub-sage__input-row {
    flex-wrap: wrap;
  }

  .ahub-sage__text-input {
    min-width: 0;
  }
}

/* ── 滚动条样式 ── */
.ahub-sage__messages::-webkit-scrollbar,
.ahub-sage__list::-webkit-scrollbar {
  width: 6px;
}

.ahub-sage__messages::-webkit-scrollbar-track,
.ahub-sage__list::-webkit-scrollbar-track {
  background: transparent;
}

.ahub-sage__messages::-webkit-scrollbar-thumb,
.ahub-sage__list::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 3px;
}

.ahub-sage__messages::-webkit-scrollbar-thumb:hover,
.ahub-sage__list::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}
