/* AI 应用库：左列表 + 右详情（独立组件，只依赖 shell.css 变量）
 * v6 双栏重做：左栏检索/分类/列表（组头吸顶、行内状态徽标），右栏详情卡
 * （封面、动作条、配置摘要、参数与素材表）。内置应用也能「删除」——软删进
 * 「已移除」区，文件不动可恢复。结构类名与 e2e 锁保持一致。
 * v13 宽屏适配：内容区不再死守 1560px（27 寸 2K 上会空出小半屏黑边），改成
 * 「铺满 + 超宽软上限」，列宽/封面/详情排布全部随视口伸缩，窄屏仍落单栏。
 * v14 左栏批量：行首勾选块（hover 才显形）+ 批量操作条 + 隐藏区「全部恢复」。
 */
.ap-content {
  flex: 1; min-height: 0; overflow: auto; padding: 14px 20px 36px;
  /* 软上限只在超宽屏生效（4K 及以上）：2480px 之后居中留白，避免文字行长失控 */
  --ap-max: 2480px;
}
.ap-content > * {
  max-width: min(100%, var(--ap-max)); width: 100%; box-sizing: border-box;
  margin-left: auto; margin-right: auto;
}

/* ------------------------------ hero（Banner 弱化：深灰底 + 细边框） ------------------------------ */
/* 顶部横幅：以前是写死的深色块（0x16181f）+ 主题文字色，纸白主题下变成深字压黑底，
   整行「一次接入，全画布通用。」和右边四个数字都看不见。改回跟主题走：
   背景/描边用卡片变量，数字用「文字色→强调色」的渐变，深浅主题都成立。 */
.ap-hero {
  position: relative; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; width: 100%; border-radius: 12px; padding: 12px 20px;
  border: 1px solid var(--line2); background: var(--card2);
  margin-bottom: 12px; overflow: hidden;
}
.ap-hero h2 { font-size: 15px; font-weight: 600; margin: 0 0 5px; letter-spacing: .2px; color: var(--text); }
.ap-hero p { margin: 0; font-size: 12px; color: var(--text2); line-height: 1.7; max-width: 720px; }
.ap-hero-stat { display: flex; gap: 0; }
.ap-hero-stat div {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 2px 20px; border-right: 1px solid var(--line);
}
.ap-hero-stat div:last-child { border-right: 0; }
.ap-hero-stat b {
  font-size: 21px; font-weight: 600;
  background: linear-gradient(180deg, var(--text), var(--accent));
  -webkit-background-clip: text;
  background-clip: text; -webkit-text-fill-color: transparent;
}
.ap-hero-stat span { font-size: 11px; color: var(--text3); }

.ap-alert {
  border: 1px solid rgba(255,92,92,.4); background: rgba(255,92,92,.09); color: var(--tone-danger);
  border-radius: 10px; padding: 10px 14px; font-size: 12px; margin-bottom: 14px;
}

/* ------------------------------ 工具条（底部统一分隔线，筛选与搜索同属一个工具栏） ------------------------------ */
.ap-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0 0 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line);
}
.ap-divider { width: 1px; align-self: stretch; background: var(--line); flex: none; }
.ap-filters { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line2);
  border-radius: 999px; padding: 5px 13px; font-size: 12px; color: var(--text2);
  background: var(--card); transition: border-color .15s, background .15s, color .15s;
}
.chip:hover { background: var(--pill-hi); color: var(--text); border-color: var(--line2); }
.chip.on {
  background: var(--accent-soft); border-color: rgba(91,140,255,.55); color: var(--tone-info);
  box-shadow: 0 0 0 1px rgba(91,140,255,.18) inset;
}
.chip b { font-weight: 600; }
.chip .n { font-size: 10.5px; color: var(--text3); }
.chip.on .n { color: var(--tone-accent); }
.ap-search, .ap-tagselect {
  background: var(--card2); border: 1px solid var(--line2); border-radius: 9px;
  padding: 6px 11px; font-size: 12px; color: var(--text); outline: none; min-width: 180px;
  transition: border-color .15s, box-shadow .15s;
}
.ap-search:focus, .ap-tagselect:focus {
  border-color: rgba(91,140,255,.55); box-shadow: 0 0 0 3px rgba(91,140,255,.12);
}
.ap-search::placeholder { color: var(--text3); }
.ap-tagselect { min-width: 130px; }

/* ============================== 双栏工作区 ==============================
 * 左栏固定宽（随视口伸缩），右栏自适应详情；列表自身滚动，左栏随页面 sticky。
 * 窄屏落成单栏：列表在上、详情在下，避免手机上左右挤成两条细缝。
 */
.ap-work {
  display: grid; grid-template-columns: clamp(300px, 18vw, 424px) minmax(0, 1fr); gap: 14px;
  align-items: start;
}
.ap-side {
  position: sticky; top: 0; display: flex; flex-direction: column;
  /* 高度：贴内容长、由视口封顶（max-height）。用 auto 而不是 100vh-X 的理由——
     27 寸屏上应用只有十来个，写死视口高会在列表下面留半屏空白，右栏详情卡又没那么高，
     整页看起来断了一半。视口封顶的减数 = 顶栏 61 + 内容上内距 14 + hero 81 + 其下
     外边距 12 + 底部呼吸；给少了会凭空多出一条竖直滚动条。
     注意：面板一旦是 auto 高度，子元素里的百分比 max-height 会退化成 none
     （历史 bug：已移除清单按内容长开，把列表压成 0 高，看起来「空了」）——
     所以 .ap-hidden 的限高改成 vh，不再用 %。 */
  height: auto; max-height: calc(100vh - 206px); min-height: 360px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card2);
  overflow: hidden;
}
.ap-side-head {
  display: flex; flex-direction: column; gap: 9px;
  padding: 11px 12px 10px; border-bottom: 1px solid var(--line); background: var(--card);
}
.ap-search-wrap { position: relative; display: flex; align-items: center; }
.ap-search-icon {
  position: absolute; left: 10px; width: 14px; height: 14px; color: var(--text3);
  pointer-events: none;
}
.ap-search-wrap .ap-search { width: 100%; min-width: 0; padding-left: 30px; padding-right: 30px; }
.ap-kbd {
  position: absolute; right: 8px; font-size: 10px; color: var(--text3);
  border: 1px solid var(--line2); border-radius: 4px; padding: 0 5px; line-height: 16px;
  background: var(--card2); pointer-events: none;
}
.ap-search:focus + .ap-kbd { opacity: 0; }
.ap-side-head .ap-filters { gap: 5px; }
.ap-side-head .chip { padding: 3px 9px; font-size: 11.5px; }
.ap-side-selects { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ap-side-selects .ap-tagselect { min-width: 0; width: 100%; padding: 5px 8px; font-size: 11.5px; }
.ap-side-meta { font-size: 11px; color: var(--text3); }

.ap-list { flex: 1; min-height: 0; overflow: auto; padding: 6px 6px 10px; scrollbar-width: thin; }
.ap-list-empty { padding: 22px 14px; text-align: center; color: var(--text3); }
.ap-list-empty strong { display: block; font-size: 12.5px; color: var(--text2); margin-bottom: 6px; }
.ap-list-empty p { font-size: 11.5px; margin: 0; line-height: 1.6; }

.ap-group + .ap-group { margin-top: 4px; }
.ap-group-head {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: baseline; gap: 7px;
  padding: 6px 8px 5px; margin: 0; background: var(--card2);
  border-left: 2px solid rgba(91,140,255,.55);
}
.ap-group-head h3 { font-size: 11.5px; font-weight: 600; margin: 0; color: var(--text2); letter-spacing: .3px; }
.ap-group-head .ap-cat-count { font-size: 10.5px; color: var(--text3); }

/* 行：缩略图 + 名称/副标题 + 状态徽标；整行可点即选中 */
.ap-row {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 7px 9px; border: 1px solid transparent; border-radius: 9px;
  background: transparent; color: var(--text2); cursor: pointer;
  transition: background .13s, border-color .13s;
}
.ap-row:hover { background: var(--pill-hi); }
.ap-row.on {
  background: rgba(91,140,255,.14); border-color: rgba(91,140,255,.5);
  box-shadow: 0 0 0 1px rgba(91,140,255,.14) inset;
}
.ap-row-thumb {
  position: relative; width: 38px; height: 38px; flex: none; border-radius: 7px;
  overflow: hidden; border: 1px solid var(--line); background: var(--card);
  display: grid; place-items: center;
}
.ap-row-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ap-thumb-ph { display: grid; place-items: center; width: 100%; height: 100%; color: var(--text3); }
.ap-thumb-ph svg { width: 18px; height: 18px; opacity: .6; }
.ap-row-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.ap-row-title { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ap-row-title b {
  flex: 1; min-width: 0; font-size: 12.5px; font-weight: 500; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* 副标题：厂商（带色点）+ 参数数量。厂商单独成段，不再和计费挤在一句灰字里 */
.ap-row-sub {
  display: flex; align-items: center; gap: 4px; min-width: 0;
  font-size: 10.5px; color: var(--text3); white-space: nowrap;
}
.ap-vendor {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  color: var(--text2); font-weight: 500;
  max-width: 128px; overflow: hidden; text-overflow: ellipsis;
}
.ap-vendor i {
  width: 5px; height: 5px; flex: none; border-radius: 50%;
  background: currentColor; opacity: .9;
}
/* 厂商色点：只染点与字，不做整块底色——一屏十几个胶囊会花。
   未登记的厂商落回 --text2 灰，宁可不显眼也不编品牌色。 */
.ap-vendor[data-v="comfy-local"] { color: var(--tone-ok); }
.ap-vendor[data-v="runninghub"] { color: var(--tone-accent); }
.ap-vendor[data-v="krea"] { color: var(--tone-violet); }
.ap-vendor[data-v="jimeng"], .ap-vendor[data-v="doubao"] { color: var(--tone-info); }
.ap-vendor[data-v="kling"] { color: var(--tone-warn); }
.ap-dot-sep { color: var(--text3); }
/* 计费徽标：免费=绿、需积分=琥珀。列表行与详情卡同一套语义色，
   看清「要不要花积分」不该靠读小字。 */
.ap-flag.bill.free {
  color: var(--tone-ok); border-color: rgba(65,209,154,.45); background: rgba(65,209,154,.14);
}
.ap-flag.bill.credits {
  color: var(--tone-warn); border-color: rgba(239,159,39,.5); background: rgba(239,159,39,.15);
}
.ap-row-flags {
  display: flex; gap: 4px; flex: none; flex-wrap: wrap;
  justify-content: flex-end; align-items: center; max-width: 120px;
}
.ap-flag {
  font-size: 9.5px; line-height: 15px; padding: 0 5px; border-radius: 4px;
  border: 1px solid var(--line2); color: var(--text3); background: var(--pill);
}
/* 颜色语义一一对应，一行里同时出现几枚也不混淆：
   绿=免费、琥珀=需积分、蓝=内置、紫=默认、红=需配置/停用。
   以前「默认」也是绿、「需配置」也是琥珀，和计费徽标撞色（2026-11-16）。 */
.ap-flag.def { color: var(--tone-violet); border-color: rgba(155,110,255,.45); background: rgba(155,110,255,.14); }
.ap-flag.builtin { color: var(--tone-info); border-color: rgba(91,140,255,.45); background: rgba(91,140,255,.16); }
.ap-flag.warn { color: var(--tone-danger); border-color: rgba(255,92,92,.45); background: rgba(255,92,92,.12); }
.ap-flag.off { color: var(--tone-danger); border-color: rgba(255,92,92,.4); background: rgba(255,92,92,.12); }

/* ---------------------- 左栏批量选择（勾选块 + 操作条） ---------------------- */
/* 勾选块平时淡出：批量是低频操作，不能抢走「点一行看详情」的主交互 */
.ap-pick {
  width: 16px; height: 16px; flex: none; margin-right: -3px;
  border: 1px solid var(--line2); border-radius: 4px;
  display: grid; place-items: center; cursor: pointer;
  opacity: 0; transition: opacity .12s, background .12s, border-color .12s;
}
.ap-pick svg {
  width: 10px; height: 10px; fill: none; stroke: #0d0f14; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; opacity: 0;
}
.ap-row:hover .ap-pick,
.ap-row:focus-visible .ap-pick,
.ap-row.picked .ap-pick { opacity: 1; }
.ap-pick:hover { border-color: #5b8cff; }
.ap-pick.on { background: #5b8cff; border-color: #5b8cff; }
.ap-pick.on svg { opacity: 1; }
.ap-row.picked { background: rgba(91,140,255,.1); border-color: rgba(91,140,255,.35); }
.ap-row.picked:hover { background: rgba(91,140,255,.16); }

.ap-bulk {
  display: flex; flex-direction: column; gap: 7px;
  margin: 7px 0 3px; padding: 8px 9px; border-radius: 9px;
  border: 1px solid rgba(91,140,255,.42); background: rgba(91,140,255,.12);
}
.ap-bulk[hidden] { display: none !important; }
.ap-bulk-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ap-bulk-count { font-size: 11.5px; font-weight: 500; color: var(--text); white-space: nowrap; }
.ap-bulk-x {
  width: 18px; height: 18px; flex: none; padding: 0; line-height: 1;
  border: 0; border-radius: 5px; background: transparent; cursor: pointer;
  color: var(--text3); font-size: 14px;
}
.ap-bulk-x:hover { color: var(--text); background: rgba(255,255,255,.1); }
.ap-bulk-acts { display: flex; gap: 5px; flex-wrap: wrap; }
.ap-bulk-btn {
  padding: 4px 9px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--line2); background: var(--pill); color: var(--text2);
  font: 11px/1.3 inherit; white-space: nowrap;
}
.ap-bulk-btn:hover {
  color: var(--text); border-color: rgba(91,140,255,.6); background: rgba(91,140,255,.16);
}
.ap-bulk-btn.danger:hover {
  color: var(--tone-danger); border-color: rgba(255,92,92,.6); background: rgba(255,92,92,.14);
}

/* ============================== 右栏详情 ============================== */
.ap-detail { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.ap-detail-card { display: block; padding: 16px 18px 18px; }
.ap-detail-card:hover { transform: none; box-shadow: none; border-color: var(--line); }
.ap-detail-top { display: flex; gap: 16px; align-items: flex-start; }
.ap-detail-cover {
  width: clamp(168px, 11vw, 280px); aspect-ratio: 16 / 10; flex: none; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); position: relative;
  display: grid; place-items: center;
  background:
    radial-gradient(90% 120% at 20% 0%, rgba(91,140,255,.12), transparent 60%),
    var(--card);
}
.ap-detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.ap-detail-cover .ap-thumb-ph svg { width: 40px; height: 40px; opacity: .32; }
.ap-detail-head { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.ap-detail-head h2 { font-size: 17px; font-weight: 600; margin: 0; color: var(--text); letter-spacing: .2px; }
.ap-detail-id {
  font-size: 10.5px; color: var(--text3);
  font-family: ui-monospace, Consolas, monospace; word-break: break-all;
}
.ap-detail-desc { font-size: 12.5px; color: var(--text2); line-height: 1.75; margin: 0; }
/* 详情卡上的徽标不再绝对定位：跟着标题区正常排，别在封面上叠成一堆 */
.ap-detail-badges .ap-badge {
  position: static; display: inline-flex; align-items: center; backdrop-filter: none;
}

.ap-detail-actions {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  margin: 14px 0 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line);
}
.ap-detail-actions .ap-btn { padding: 6px 13px; font-size: 12px; }

.ap-detail-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 8px;
}
.ap-detail-grid > div {
  display: flex; flex-direction: column; gap: 3px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card); min-width: 0;
}
.ap-detail-grid b { font-size: 10.5px; font-weight: 500; color: var(--text3); letter-spacing: .2px; }
.ap-detail-grid span {
  font-size: 12px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.ap-detail-sec { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.ap-detail-sec-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 9px; }
.ap-detail-sec-head b { font-size: 12.5px; color: var(--text); font-weight: 600; }
.ap-detail-sec-head span { font-size: 11px; color: var(--text3); }
.ap-param-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.ap-param-table th {
  text-align: left; font-size: 10.5px; font-weight: 500; color: var(--text3);
  padding: 5px 9px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.ap-param-table td { padding: 6px 9px; border-bottom: 1px dashed var(--line); color: var(--text2); vertical-align: middle; }
.ap-param-table td:nth-child(2) { white-space: nowrap; }   /* 类型列别把「数字」拆成两行 */
.ap-param-table td:nth-child(3) { white-space: nowrap; }
.ap-param-table tr:last-child td { border-bottom: 0; }
.ap-param-table td b { font-size: 12px; font-weight: 500; color: var(--text); }
.ap-param-table td code {
  font-family: ui-monospace, Consolas, monospace; font-size: 10.5px; color: var(--text3);
  margin-left: 6px;
}
.ap-param-table .ap-mini-tag { margin-left: 6px; }
.ap-param-range { color: var(--text3); font-size: 11px; }
.ap-dim { color: var(--text3); }
.ap-slot-block { margin-top: 12px; }
.ap-slot-block h4 { font-size: 11.5px; font-weight: 500; color: var(--text3); margin: 0 0 6px; }
.ap-slot-row {
  display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap;
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin-bottom: 6px;
  background: var(--card);
}
.ap-slot-row b { font-size: 12px; font-weight: 500; color: var(--text); }
.ap-slot-row span { font-size: 11px; color: var(--text3); }
.ap-slot-row code { font-family: ui-monospace, Consolas, monospace; font-size: 10.5px; color: var(--tone-accent); margin-left: auto; }
/* 能做什么：动作徽标 + 来源 + 素材槽，与参数表同宽对齐 */
.ap-cap { margin: 4px 0 14px; }
.ap-cap-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 11px; }
.ap-cap-line .ap-mini-tag { background: var(--accent-soft); color: var(--tone-info); }
.ap-cap .ap-detail-note { margin-top: 8px; }
.ap-detail-note {
  border: 1px dashed var(--line2); border-radius: 8px; padding: 10px 12px;
  font-size: 11.5px; color: var(--text3);
}

/* 详情空态：占满右栏，给出键盘提示 */
.ap-detail-blank {
  border: 1px dashed var(--line2); border-radius: 12px; background: var(--card);
  min-height: clamp(300px, calc(100vh - 300px), 760px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 9px; text-align: center; padding: 26px;
}
.ap-detail-blank-icon {
  width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center;
  color: var(--tone-accent); background: rgba(91,140,255,.1); border: 1px solid rgba(91,140,255,.28);
}
.ap-detail-blank-icon svg { width: 26px; height: 26px; }
.ap-detail-blank strong { font-size: 14px; font-weight: 600; color: var(--text); }
.ap-detail-blank p { font-size: 12px; color: var(--text3); margin: 0; max-width: 380px; line-height: 1.7; }
.ap-detail-blank-tips { display: flex; gap: 14px; margin-top: 4px; flex-wrap: wrap; justify-content: center; }
.ap-detail-blank-tips span { font-size: 11px; color: var(--text3); display: inline-flex; align-items: center; gap: 5px; }
.ap-detail-blank-tips kbd {
  border: 1px solid var(--line2); border-radius: 4px; padding: 0 5px; line-height: 16px;
  font-size: 10px; background: var(--card2); color: var(--text2); font-family: inherit;
}

/* ------------------------------ 分组 ------------------------------ */
.ap-group { margin: 0 0 24px; }
.ap-group-head {
  display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px; padding-left: 10px;
  border-left: 2px solid rgba(91,140,255,.55);
}
.ap-group-head h3 { font-size: 13.5px; font-weight: 600; margin: 0; color: var(--text); }
.ap-group-head .ap-cat-count { font-size: 11px; color: var(--text3); }
.ap-group-head p { font-size: 11.5px; color: var(--text3); margin: 0; }

/* ------------------------------ 卡片 ------------------------------ */
.ap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 14px; }

.ap-card {
  border: 1px solid var(--line); border-radius: 12px; background: var(--card2);
  overflow: hidden; display: flex; flex-direction: column;
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.ap-card:hover {
  border-color: rgba(91,140,255,.45); transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0,0,0,.35);
}
.ap-card-cover {
  position: relative; aspect-ratio: 16 / 10; overflow: hidden;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(90% 120% at 20% 0%, rgba(91,140,255,.12), transparent 60%),
    radial-gradient(80% 110% at 90% 100%, rgba(64,190,160,.08), transparent 55%),
    var(--card);
}
.ap-card-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.ap-card:hover .ap-card-cover img { transform: scale(1.04); }
.ap-cover-ph { display: flex; flex-direction: column; align-items: center; gap: 7px; color: var(--text3); font-size: 11px; }
.ap-cover-ph svg { width: 34px; height: 34px; opacity: .45; }
/* 封面角标（内置 / 外部 API / 计费…）：压在封面图上，配色不跟主题变量走。
   底色是一层固定深色遮罩，文字用固定的亮色系——否则纸白主题下会变成深字压深底。 */
.ap-badge {
  position: absolute; top: 9px; left: 9px; border-radius: 4px; padding: 2px 9px;
  font-size: 10.5px; background: rgba(10,10,12,.72);
  border: 1px solid rgba(255,255,255,.22); color: rgba(255,255,255,.95);
  backdrop-filter: blur(6px);
}
.ap-badge.builtin { background: rgba(26,40,72,.84); border-color: rgba(91,140,255,.6); color: #cfe0ff; }
/* 厂商徽标：详情卡第一枚，用品牌色描边；未登记的厂商保持中性白边 */
.ap-badge.vendor { background: rgba(18,20,28,.86); border-color: rgba(255,255,255,.3); color: #e9edff; }
.ap-badge.vendor[data-v="comfy-local"] { border-color: rgba(64,190,160,.7); color: #bdf0dd; }
.ap-badge.vendor[data-v="runninghub"] { border-color: rgba(124,140,255,.75); color: #dbe2ff; }
.ap-badge.external { background: rgba(38,26,64,.84); border-color: rgba(155,110,255,.6); color: #dcc9ff; }
/* 插件包封装的应用：与 external 同色系偏青，和「外部 API」区分开 */
.ap-badge.plugin { background: rgba(16,48,42,.84); border-color: rgba(64,190,160,.6); color: #bdf0dd; }
.ap-badge.bill { background: rgba(52,36,12,.84); border-color: rgba(239,159,39,.55); color: #f5c97b; }
/* 免费与需积分必须一眼分开：同形状、不同色，扫列表时不用逐字读 */
.ap-badge.bill.free { background: rgba(10,44,32,.86); border-color: rgba(65,209,154,.6); color: #a7f0d2; }
.ap-badge.off { background: rgba(56,16,18,.84); border-color: rgba(255,92,92,.55); color: #ffb3b3; }

.ap-card-body { padding: 12px 14px 13px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.ap-card-title { display: flex; align-items: baseline; gap: 8px; }
.ap-card-title b {
  font-size: 13.5px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ap-card-title .mid {
  font-size: 10px; color: var(--text3); margin-left: auto; white-space: nowrap;
  font-family: ui-monospace, Consolas, monospace;
}
.ap-card-desc {
  font-size: 11.5px; color: var(--text3); line-height: 1.65; min-height: 34px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ap-card-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ap-mini-tag {
  font-size: 10.5px; color: var(--text2); background: var(--pill);
  border: 1px solid transparent; border-radius: 4px; padding: 1px 7px;
}
.ap-mini-tag.cat { background: var(--accent-soft); color: var(--tone-info); border-color: rgba(91,140,255,.3); }
.ap-card-actions { display: flex; align-items: center; gap: 6px; margin-top: auto; flex-wrap: wrap; padding-top: 4px; }
.ap-btn {
  border: 1px solid var(--line2); background: var(--card); color: var(--text2);
  border-radius: 8px; padding: 5px 10px; font-size: 11.5px; white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.ap-btn:hover { background: var(--pill-hi); color: var(--text); }
.ap-btn.primary { border-color: rgba(91,140,255,.5); background: rgba(91,140,255,.12); color: var(--tone-info); }
.ap-btn.primary:hover { background: rgba(91,140,255,.24); }
.ap-btn.link { border-color: transparent; background: transparent; color: var(--tone-accent); }
.ap-btn.link:hover { background: var(--accent-soft); }
.ap-btn[disabled] { opacity: .4; cursor: not-allowed; }
.ap-promote { border-color: rgba(65,209,154,.4); color: var(--tone-ok); }
.ap-promote:hover { background: rgba(65,209,154,.14); color: #b6f2d9; }
/* 两步确认删除：第一下只是提示，armed 才是真的要删 */
.ap-del:hover { border-color: rgba(255,92,92,.45); color: var(--tone-danger); background: rgba(255,92,92,.08); }
.ap-del.armed, .ap-del.armed:hover {
  border-color: rgba(255,92,92,.7); background: rgba(255,92,92,.18); color: var(--tone-danger);
  animation: ap-pulse 1.1s ease-in-out infinite;
}
@keyframes ap-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,92,92,.28); }
  50% { box-shadow: 0 0 0 4px rgba(255,92,92,.12); }
}

/* 空状态：满宽双栏面板——左边引导 + CTA，右边「未来的卡片墙」骨架 */
.ap-empty {
  border: 1px dashed var(--line2);
  border-radius: 12px; background:
    radial-gradient(70% 100% at 50% 0%, rgba(91,140,255,.06), transparent 60%), var(--card);
}
.ap-empty-hero {
  display: grid; grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.15fr);
  gap: 22px; padding: 26px 28px; align-items: center;
  /* 撑满内容区剩余可视高度：不留「矮面板 + 下半屏全空」的观感（上限 720 防超高窗口失衡） */
  min-height: clamp(420px, calc(100vh - 300px), 720px);
}
@media (max-width: 860px) {
  .ap-empty-hero { grid-template-columns: 1fr; min-height: 0; }
}
.ap-empty-main { text-align: center; }
.ap-empty-icon {
  width: 60px; height: 60px; margin: 0 auto 12px; border-radius: 16px;
  display: grid; place-items: center; color: var(--tone-accent);
  background: rgba(91,140,255,.1); border: 1px solid rgba(91,140,255,.3);
}
.ap-empty-icon svg { width: 30px; height: 30px; }
.ap-empty strong { display: block; font-size: 15px; font-weight: 600; margin-bottom: 7px; }
.ap-empty p { font-size: 12px; color: var(--text3); margin: 0 auto 16px; max-width: 420px; line-height: 1.7; }
.ap-empty-cta { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.ap-empty-cta .ap-btn { padding: 9px 18px; font-size: 13px; border-radius: 8px; }
.ap-empty .ap-hint { display: block; }

/* 骨架卡墙：模拟发布后的卡片网格（封面 + 两行文字），比三根灰条更有「这里会填满」的暗示
 * align-self: stretch 覆盖 hero 的 center——卡墙随面板满高拉伸，行高 1fr 均分 */
.ap-empty-skeleton {
  display: grid; grid-template-columns: repeat(2, 1fr); grid-auto-rows: 1fr;
  gap: 12px; align-self: stretch;
}
.ap-sk-card {
  display: flex; flex-direction: column; gap: 8px; padding: 10px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card2);
}
.ap-sk-card i {
  border-radius: 6px; opacity: .5;
  background: linear-gradient(100deg, var(--card) 40%, rgba(255,255,255,.05) 50%, var(--card) 60%);
  background-size: 220% 100%; animation: ap-shimmer 2.4s ease-in-out infinite;
}
.ap-sk-card .ap-sk-cover { flex: 1; min-height: 74px; border-radius: 7px; }
.ap-sk-card .ap-sk-line { height: 9px; width: 70%; }
.ap-sk-card .ap-sk-line.w40 { width: 40%; animation-delay: .2s; }
.ap-sk-card .ap-sk-line.w45 { width: 45%; animation-delay: .2s; }
.ap-sk-card .ap-sk-line.w35 { width: 35%; animation-delay: .2s; }
.ap-sk-card .ap-sk-line.w55 { width: 55%; }
.ap-sk-card .ap-sk-line.w60 { width: 60%; }
.ap-sk-card .ap-sk-line.w70 { width: 70%; }
.ap-sk-card .ap-sk-line.w75 { width: 75%; }
.ap-sk-card:nth-child(2) i { animation-delay: .25s; }
.ap-sk-card:nth-child(3) i { animation-delay: .5s; }
.ap-sk-card:nth-child(4) i { animation-delay: .75s; }
@keyframes ap-shimmer {
  0% { background-position: 130% 0; }
  100% { background-position: -90% 0; }
}
/* 圆角与对比度口径（统一：卡片 12 / 按钮 8 / 小标签 4；辅助文字提亮一档） */
/* 这里原本把 --text3 局部覆盖成一个浅灰（0x8b90a0）：整页次级文字被钉死后，
   纸白主题下只有 2.97:1，列表副标题 / 模型 ID / 计数全糊。次级色只由主题变量给。 */

/* ------------------------------ 弹窗 ------------------------------ */
.ap-modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; }
.ap-modal-mask { position: absolute; inset: 0; background: rgba(0,0,0,.62); backdrop-filter: blur(3px); }
.ap-modal-card {
  position: relative; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 60px); overflow: auto;
  background: var(--card); border: 1px solid var(--line2); border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0,0,0,.55);
  animation: ap-pop .18s ease-out;
}
@keyframes ap-pop {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.ap-modal-head {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--line); background: var(--card);
}
.ap-modal-head strong { font-size: 14px; font-weight: 600; }
.ap-x { font-size: 20px; line-height: 1; color: var(--text3); padding: 0 4px; }
.ap-x:hover { color: var(--text); }
.ap-modal-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.ap-field { display: flex; flex-direction: column; gap: 6px; font-size: 11.5px; color: var(--text3); }
.ap-field input[type="text"], .ap-field textarea {
  background: var(--card2); border: 1px solid var(--line2); border-radius: 9px;
  padding: 8px 10px; font-size: 12.5px; color: var(--text); outline: none; font-family: inherit; width: 100%;
  box-sizing: border-box; resize: vertical; transition: border-color .15s, box-shadow .15s;
}
.ap-field input:focus, .ap-field textarea:focus {
  border-color: rgba(91,140,255,.55); box-shadow: 0 0 0 3px rgba(91,140,255,.1);
}
.ap-cover-row { display: flex; gap: 12px; align-items: stretch; }
.ap-cover-preview {
  width: 150px; height: 96px; flex: none; border: 1px dashed var(--line2); border-radius: 9px;
  background: var(--card2); display: flex; align-items: center; justify-content: center;
  color: var(--text3); font-size: 11px; overflow: hidden;
}
.ap-cover-preview img { width: 100%; height: 100%; object-fit: cover; }
.ap-cover-tools { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.ap-cover-tools small { font-size: 11px; color: var(--text3); line-height: 1.6; }
.ap-upload { position: relative; overflow: hidden; cursor: pointer; }
.ap-modal-foot {
  position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 9px;
  padding: 12px 18px; border-top: 1px solid var(--line); background: var(--card);
}

/* 外部 API 登记弹窗：渐进式披露（简单模式 + 可视化映射 + 高级 JSON 折叠） */
.ap-sec { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 13px; background: var(--card); margin-bottom: 12px; }
.ap-sec-head { display: flex; align-items: center; gap: 8px; }
.ap-sec-head b { font-size: 12px; color: var(--text); }
.ap-sec-head .ap-btn { margin-left: auto; }
.ap-map-row { display: grid; grid-template-columns: 96px minmax(70px, 1fr) 14px minmax(90px, 1.2fr) minmax(60px, .8fr) 26px;
  gap: 6px; align-items: center; }
.ap-map-row + .ap-map-row { margin-top: 6px; }
.ap-map-row select, .ap-map-row input {
  background: var(--card2); border: 1px solid var(--line2); border-radius: 7px;
  padding: 6px 8px; font-size: 12px; color: var(--text); outline: none; min-width: 0; width: 100%;
  box-sizing: border-box; transition: border-color .15s, box-shadow .15s;
}
.ap-map-row select:focus, .ap-map-row input:focus { border-color: rgba(91,140,255,.55); box-shadow: 0 0 0 2px rgba(91,140,255,.1); }
.ap-map-row .mr-arrow { text-align: center; color: var(--text3); font-size: 12px; }
.ap-map-row .mr-del { padding: 4px 7px; font-size: 11px; }
.ap-map-row .mr-del:hover { border-color: rgba(255,92,92,.45); color: var(--tone-danger); background: rgba(255,92,92,.08); }
@media (max-width: 720px) { .ap-map-row { grid-template-columns: 1fr 1fr; } }
.ap-test { display: flex; flex-direction: column; gap: 7px; }
.ap-test textarea {
  background: var(--card2); border: 1px solid var(--line2); border-radius: 8px;
  padding: 7px 9px; font-size: 11.5px; color: var(--text); outline: none; width: 100%; box-sizing: border-box;
  font-family: ui-monospace, Consolas, monospace;
}
.ap-test textarea:focus { border-color: rgba(91,140,255,.55); }
.ap-test-out {
  font-size: 11.5px; color: var(--text2); background: var(--card2);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; line-height: 1.8;
}
.ap-test-out b { color: var(--text); font-weight: 500; }
.ap-test-out code { color: var(--tone-ok); font-size: 11px; }
.ap-test-out .miss { color: var(--tone-warn); font-style: normal; }
.ap-adv { border: 1px dashed var(--line2); border-radius: 10px; padding: 9px 13px; margin-bottom: 12px; }
.ap-adv summary { font-size: 12px; color: var(--text2); cursor: pointer; }
.ap-adv summary:hover { color: var(--text); }
.ap-adv[open] { background: var(--card); }
.ap-adv .ap-field { margin-top: 10px; }

/* 外部 API 登记弹窗 */
.ap-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.ap-tab { font-size: 12px; color: var(--text3); padding: 5px 12px; border-radius: 7px; }
.ap-tab:hover { color: var(--text); background: var(--pill-hi); }
.ap-tab.on { background: var(--accent-soft); color: var(--tone-info); }
.ap-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ap-field select {
  background: var(--card2); border: 1px solid var(--line2); border-radius: 9px;
  padding: 8px 10px; font-size: 12.5px; color: var(--text); outline: none;
}
.ap-field textarea { font-family: ui-monospace, Consolas, monospace; font-size: 11.5px; }
.ap-hint { font-size: 11px; color: var(--text3); line-height: 1.6; }
.ap-ext-list { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.ap-ext-row {
  display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text2);
  padding: 6px 2px; border-bottom: 1px dashed var(--line); flex-wrap: wrap;
}
.ap-ext-row:last-child { border-bottom: 0; }
.ap-ext-row b { color: var(--text); font-weight: 500; }
.ap-ext-row .tag { font-size: 10px; border-radius: 4px; padding: 1px 6px;
  background: var(--pill); color: var(--text3); }
.ap-ext-row .tag.bill { background: rgba(239,159,39,.14); color: var(--tone-warn); }
.ap-ext-row button { color: var(--text3); font-size: 11px; margin-left: auto; }
.ap-ext-row button:hover { color: var(--danger); }

.ap-toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 300;
  border-radius: 10px; padding: 10px 18px; font-size: 12.5px;
  border: 1px solid rgba(65,209,154,.4); background: rgba(65,209,154,.14); color: var(--tone-ok);
  box-shadow: 0 8px 30px rgba(0,0,0,.4); animation: ap-toast-in .2s ease-out;
}
@keyframes ap-toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.ap-toast.error { border-color: rgba(255,92,92,.45); background: rgba(255,92,92,.14); color: var(--tone-danger); }

.ap-promote-done .ap-done-lead { font-size: 13px; color: var(--text); line-height: 1.7; margin: 2px 0 10px; }
.ap-promote-done .ap-done-lead b { color: var(--tone-ok); font-weight: 500; }
.ap-promote-done .ap-done-hint { font-size: 12px; color: var(--text2); line-height: 1.7; margin: 0 0 14px; }
.ap-done-check {
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  background: var(--surface2, rgba(255,255,255,.02));
}
.ap-done-check label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text); cursor: pointer; }
.ap-done-check input { accent-color: #5b8cff; }

/* ------------------------------ 统一管控：默认 / 隐藏 ------------------------------ */
/* 默认徽标统一紫色：绿色留给「免费」，两枚相邻时才不会看成都叫「免费」 */
.ap-badge.ap-default { left: auto; right: 8px; top: 52px; background: rgba(34,24,58,.86);
  color: #dcc9ff; border-color: rgba(155,110,255,.55); }
.ap-btn.ap-setdefault { color: var(--tone-ok); }
.ap-btn.ap-hide { color: var(--text3); }
/* 已移除 / 已隐藏：挂在左栏底部，默认收起只留一行计数，点开才占高度 */
.ap-hidden {
  /* vh 而不是 %：左栏现在是 auto 高度，百分比限高会退化成 none（见 .ap-side 注释） */
  flex: none; max-height: min(38vh, 340px); overflow: auto; margin: 0;
  border-top: 1px solid var(--line); background: var(--card); padding: 8px 11px 9px;
}
.ap-hidden-head {
  display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap;
  cursor: pointer; user-select: none;
}
.ap-hidden-head b { font-size: 11.5px; color: var(--text2); }
.ap-hidden-head .ap-hidden-caret {
  margin-left: auto; font-size: 10px; color: var(--text3); transition: transform .15s;
}
.ap-hidden.open .ap-hidden-head .ap-hidden-caret { transform: rotate(90deg); }
.ap-hidden-head span { flex-basis: 100%; font-size: 10.5px; color: var(--text3); line-height: 1.5; }
.ap-hidden-list { display: none; flex-direction: column; gap: 5px; margin-top: 7px; }
.ap-hidden.open .ap-hidden-list { display: flex; }
.ap-hidden-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  background: var(--card2); border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; }
.ap-hidden-row b { font-size: 11.5px; font-weight: 500; color: var(--text2); }
.ap-hidden-row .mid { font-size: 10px; color: var(--text3); flex: 1; min-width: 60px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-hidden-row .ap-btn { padding: 3px 8px; font-size: 10.5px; }
/* 隐藏条目一多，逐条点「恢复显示」很累：给一行「全部恢复」 */
.ap-hidden-bulk {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 3px 2px 1px;
}
.ap-hidden-bulk span { font-size: 10.5px; color: var(--text3); }
.ap-hidden-bulk .ap-btn { padding: 3px 8px; font-size: 10.5px; }
/* ------------------------------ 宽屏（≥1700px）------------------------------
 * 27 寸 2K 屏铺满后详情卡有 1800px 宽。这里只做「横向分配」，不改信息架构：
 * 参数表定宽分列（auto 布局会把三列推得很散），配置摘要按内容自适应多列，
 * 描述行宽收一下——避免 1800px 一行读到底。
 * 曾经试过「左身份 / 右参数」双列网格，结果左列被大封面撑到 690px、右列只有
 * 一张 130px 的表，卡里空出一大块；单列 + 自适应网格反而更均衡，故回退。
 */
@media (min-width: 1700px) {
  .ap-detail-desc { max-width: 92ch; }
  .ap-detail-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
  .ap-param-table { table-layout: fixed; }
  .ap-param-table th:nth-child(1) { width: 30%; }
  .ap-param-table th:nth-child(2) { width: 9%; }
  .ap-param-table th:nth-child(3) { width: 13%; }
}

@media (max-width: 1100px) {
  .ap-work { grid-template-columns: 296px minmax(0, 1fr); }
  .ap-detail-cover { width: 168px; }
}
@media (max-width: 900px) {
  .ap-content { padding: 14px 14px 32px; }
  .ap-hero-stat { gap: 14px; }
  /* 窄屏：单栏——列表限高在上，详情在下。46vh 太抠：筛选区就占 187px，
     剩下只够显示一行应用；给到 72vh（上限 560）能看见 4–6 行，页面照样能滚。 */
  .ap-work { grid-template-columns: 1fr; }
  .ap-side { position: static; max-height: min(72vh, 560px); }
  .ap-detail-top { flex-direction: column; }
  .ap-detail-cover { width: 100%; max-width: 320px; }
  .ap-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .ap-manage-rows > div { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .ap-content { padding: 12px 12px 28px; }
  .ap-hero { padding: 12px 14px; }
  .ap-hero-stat div { padding: 2px 10px; }
  .ap-hero-stat b { font-size: 18px; }
  .ap-detail-card { padding: 14px 14px 16px; }
  .ap-side-selects { grid-template-columns: 1fr; }
  .ap-detail-grid { grid-template-columns: 1fr 1fr; }
  .ap-param-table th:nth-child(2), .ap-param-table td:nth-child(2) { display: none; }
}
@media (max-width: 420px) {
  .ap-detail-grid { grid-template-columns: 1fr; }
  .ap-detail-cover { max-width: none; }
}
