
/* 保留原「技能」大标题，结构不变；仅在其右侧新增「工具」标题 tab */
.skd-demo__title { cursor: pointer; transition: color .15s ease; }
.skd-demo__title.lgtool-dim { color: #00000059; }
.skd-demo__title.lgtool-dim:hover { color: #0000008f; }

/* 新增的「工具 / 连接器」标题 tab：与「技能」同字号同粗细，未选中置灰。
   紧挨在「技能」右侧成组（技能 工具 连接器），右侧操作按钮由 margin-left:auto 推到最右。 */
.lgtool-tooltab {
  margin-left: 22px;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 20px;
  font-weight: 600;
  line-height: 28px;
  color: #00000059;
  padding: 0;
  cursor: pointer;
  transition: color .15s ease;
}
.lgtool-tooltab:hover { color: #0000008f; }
.lgtool-tooltab.is-active { color: #060606; }

/* 右侧操作按钮推到最右：技能态是 React 的 upload，工具/连接器态是接入按钮。
   两者互斥显示，各自加 margin-left:auto 只有可见的那个生效，标题组保持靠左成组。 */
.skd-demo__head .skd-demo__upload,
.skd-demo__head .lgtool-headbtn { margin-left: auto; }

/* 「接入工具」按钮（工具态显示，复用 upload 按钮观感） */
.lgtool-headbtn {
  display: none;
  align-items: center;
  gap: 4px;
  height: 36px;
  padding: 0 16px;
  border: none;
  border-radius: 8px;
  background: #495dff;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s ease;
}
.lgtool-headbtn:hover { background: #3a4ce0; }
.lgtool-headbtn svg { display: block; }

/* 工具态：隐藏 React 技能内容 + upload，显示工具面板与接入按钮 */
.skd-demo.lgtool-mode .skd-demo__toolbar,
.skd-demo.lgtool-mode .skd-demo__cats,
.skd-demo.lgtool-mode .skd-demo__grid,
.skd-demo.lgtool-mode .skd-demo__config { display: none !important; }
.skd-demo.lgtool-mode .skd-demo__upload { display: none !important; }
.skd-demo.lgtool-mode .lgtool-headbtn { display: inline-flex; }

/* 关键修复：注入的工具面板复用了 .skd-demo__toolbar / .skd-demo__cats 类名，
   上面的隐藏规则会连带把面板内的二级 tab、分类 chips 一起隐藏，
   导致只剩卡片网格显示。这里用更高特异性把面板内部的这些控件重新显示出来。 */
.skd-demo.lgtool-mode .lgtool-panel .skd-demo__toolbar { display: flex !important; }
.skd-demo.lgtool-mode .lgtool-panel .skd-demo__cats { display: flex !important; }

/* 工具面板骨架 */
.lgtool-panel { display: none; }
.skd-demo.lgtool-mode .lgtool-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* 工具网格：与 .skd-demo__grid 完全一致的排布 */
.lgtool-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  align-content: start;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding-bottom: 24px;
}

/* 工具卡片类型标签（内置 / MCP / 自定义 / 官方） */
.lgtool-type {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  line-height: 20px;
  white-space: nowrap;
}
.lgtool-type--builtin { color: #2970ff; background: #2970ff14; }
.lgtool-type--mcp     { color: #4f46e5; background: linear-gradient(135deg, #ede9fe, #dbeafe); font-weight: 600; }
.lgtool-type--custom  { color: #b54708; background: #fffaeb; }
.lgtool-type--official{ color: #04b545; background: #04b5451a; }
.lgtool-type--conn    { color: #475569; background: #f1f5f9; font-weight: 500; }

/* 卡片名称行：名字 + 类型标签同排 */
.lgtool-nameline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* 连接器卡片：关联工具 meta 行 */
.lgtool-cardmeta {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  font-size: 12px;
  color: #00000059;
}
.lgtool-cardmeta svg { display: block; opacity: .7; }

/* 开关（复用对话内工具开关观感） */
.lgtool-toggle {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 18px;
  border-radius: 999px;
  background: #d4d4d4;
  cursor: pointer;
  transition: background .16s ease;
  flex-shrink: 0;
}
.lgtool-toggle.is-on { background: #495dff; }
.lgtool-toggle__dot {
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.18);
  transition: transform .16s ease;
}
.lgtool-toggle.is-on .lgtool-toggle__dot { transform: translateX(14px); }

/* 市场卡片「接入 / 已接入」按钮 */
.lgtool-add {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid rgba(41,112,255,.4);
  background: #fff;
  color: #2970ff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
}
.lgtool-add:hover { background: #2970ff; color: #fff; }
.lgtool-add.is-added {
  border-color: rgba(0,0,0,.08);
  color: #00000075;
  background: #fff;
  cursor: default;
}
.lgtool-add.is-added:hover { background: #fff; color: #00000075; }
.lgtool-add svg { display: block; }

/* 工具配置视图 */
.lgtool-config { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 24px; }
.lgtool-cfg-card {
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 14px;
  background: #fff;
}
.lgtool-cfg-card__title { font-size: 15px; font-weight: 600; color: #000000f0; margin-bottom: 4px; }
.lgtool-cfg-card__sub { font-size: 13px; color: #00000075; line-height: 1.6; }
.lgtool-cfg-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid #f1f3f7;
}
.lgtool-cfg-row:first-of-type { border-top: 0; }
.lgtool-cfg-row__label { font-size: 14px; color: #000000d1; font-weight: 500; }
.lgtool-cfg-row__hint { font-size: 12px; color: #00000073; margin-top: 3px; }

/* ---- 工具详情弹层 ---- */
.lgtmodal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.42);
  z-index: 2147482960;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 24px;
  overflow-y: auto;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  animation: lgtmodalMaskIn .16s ease-out;
}
.lgtmodal-mask.is-open { display: flex; }
@keyframes lgtmodalMaskIn { from { background: rgba(15,23,42,0); } to { background: rgba(15,23,42,.42); } }
.lgtmodal {
  width: 720px;
  max-width: 100%;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(15,23,42,.22);
  padding: 24px 28px 28px;
  color: #1a1a1a;
  animation: lgtmodalIn .2s ease-out;
  box-sizing: border-box;
}
.lgtmodal *, .lgtmodal *::before, .lgtmodal *::after { box-sizing: border-box; }
@keyframes lgtmodalIn { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.lgtmodal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.lgtmodal-header__title { font-size: 17px; font-weight: 600; color: #111827; }
.lgtmodal-close {
  border: none; background: transparent; width: 28px; height: 28px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  color: rgba(15,23,42,.55); cursor: pointer; transition: background .15s ease, color .15s ease;
}
.lgtmodal-close:hover { background: rgba(15,23,42,.06); color: rgba(15,23,42,.85); }

.lgtmodal-summary { display: flex; align-items: flex-start; gap: 14px; padding-bottom: 20px; border-bottom: 1px solid #eef1f6; margin-bottom: 20px; }
.lgtmodal-icon { width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 600; flex-shrink: 0; }
.lgtmodal-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; padding-top: 2px; }
.lgtmodal-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lgtmodal-name { font-size: 16px; font-weight: 600; color: #0f172a; }
.lgtmodal-provider { font-size: 12px; color: #64748b; }

.lgtmodal-primary {
  border: none; background: #495dff; color: #fff; font-size: 13px; padding: 8px 16px;
  border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  font-weight: 500; transition: background .15s ease; flex-shrink: 0;
}
.lgtmodal-primary:hover { background: #3a4ce0; }
.lgtmodal-primary svg { display: block; }
.lgtmodal-primary.is-off { background: #eef1f6; color: #475569; }
.lgtmodal-primary.is-off:hover { background: #e2e8f0; }

.lgtmodal-section { margin-bottom: 20px; }
.lgtmodal-section:last-child { margin-bottom: 0; }
.lgtmodal-section__title { font-size: 14px; font-weight: 600; color: #0f172a; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.lgtmodal-section__hint { font-size: 11px; color: #94a3b8; font-weight: 400; letter-spacing: .2px; }

.lgtmodal-desc { background: #f5f7fa; border-radius: 10px; padding: 14px 16px; font-size: 13px; line-height: 1.7; color: #334155; }

/* 提供的能力（函数 / API） */
.lgtmodal-fns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lgtmodal-fn { background: #f8fafc; border: 1px solid #eef1f6; border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.lgtmodal-fn__name { font-size: 13px; font-weight: 600; color: #0f172a; font-family: "SFMono-Regular", ui-monospace, Menlo, monospace; }
.lgtmodal-fn__desc { font-size: 12px; color: #64748b; line-height: 1.5; }

/* 认证与连接 */
.lgtmodal-conn { background: #f5f7fa; border-radius: 10px; padding: 14px 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.lgtmodal-conn__col { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.lgtmodal-conn__k { font-size: 11px; color: #94a3b8; }
.lgtmodal-conn__v { font-size: 13px; color: #334155; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.lgtmodal-conn__sep { width: 1px; align-self: stretch; background: #e2e8f0; }
.lgtmodal-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.lgtmodal-dot--on { background: #04b545; }
.lgtmodal-dot--off { background: #cbd5e1; }
.lgtmodal-conn__btn { margin-left: auto; border: 1px solid rgba(0,0,0,.1); background: #fff; color: #475569; font-size: 12px; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-family: inherit; transition: all .15s ease; }
.lgtmodal-conn__btn:hover { border-color: rgba(41,112,255,.4); color: #2970ff; }

/* 标签组（权限范围 / 可用范围） */
.lgtmodal-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.lgtmodal-tag { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 8px; font-size: 12px; font-weight: 500; background: #f5f7fa; color: #475569; }
.lgtmodal-tag svg { display: block; opacity: .75; }
.lgtmodal-tag--w { background: #fff4ee; color: #c2410c; }
.lgtmodal-tag--r { background: #eef2ff; color: #4338ca; }

/* 调用统计 */
.lgtmodal-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.lgtmodal-stat { background: #f8fafc; border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.lgtmodal-stat__v { font-size: 20px; font-weight: 700; color: #0f172a; font-variant-numeric: tabular-nums; }
.lgtmodal-stat__k { font-size: 12px; color: #64748b; }

@media (max-width: 720px) {
  .lgtmodal { padding: 20px; }
  .lgtmodal-fns, .lgtmodal-stats { grid-template-columns: 1fr; }
}
  