[hidden] { display: none !important; }

:root {
  /* Stay light until the workbench explicitly supplies its appearance. */
  color-scheme: light;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-hover: #fbfcfd;
  --text: #1f2329;
  --text-2: #5d6675;
  --muted: #8b94a3;
  --line: #e8ebf0;
  --line-strong: #d8dde6;
  --brand: #165dff;
  --brand-hover: #0e42d2;
  --brand-soft: #e8efff;
  --brand-border: #b8ceff;
  --blue: var(--brand);
  --blue-soft: var(--brand-soft);
  --violet: var(--brand);
  --violet-soft: var(--brand-soft);
  --amber: var(--brand);
  --amber-soft: var(--brand-soft);
  --success: #008a20;
  --success-soft: #e8f7ed;
  --danger: #f53f3f;
  --on-brand: #ffffff;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-hover: 0 8px 22px rgba(16, 24, 40, 0.07);
  --radius: 12px;
  --font-scale: 1;
  --sans: Inter, "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, monospace;
}
[data-theme='dark'] {
  color-scheme: dark;
  --bg: #1a1a1a;
  --surface: #0e0e0e;
  --surface-hover: #1f1f1f;
  --text: #ffffff;
  --text-2: #ced3dc;
  --muted: #9099a6;
  --line: #333333;
  --line-strong: #4d4d4d;
  --brand: #4d9fff;
  --brand-hover: #7ab4ff;
  --brand-soft: color-mix(in srgb, var(--brand) 18%, transparent);
  --brand-border: color-mix(in srgb, var(--brand) 38%, var(--line));
  --blue: #75a9ff;
  --blue-soft: color-mix(in srgb, var(--blue) 18%, transparent);
  --violet: #a1aacb;
  --violet-soft: #3d4150;
  --amber: #ff9a2e;
  --amber-soft: color-mix(in srgb, var(--amber) 18%, transparent);
  --success: #23c343;
  --success-soft: color-mix(in srgb, var(--success) 18%, transparent);
  --danger: #f76560;
  --on-brand: #0e0e0e;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 8px 22px rgba(0, 0, 0, 0.55);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background: var(--bg);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.topbar {
  height: 60px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.brand strong { font-style: italic; font-size: 27px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.text-link { color: var(--muted); font-size: 13px; }
.text-link:hover { color: var(--text); }
.publish-button {
  height: 34px; padding: 0 14px; border: 0; border-radius: 8px;
  color: #fff; background: var(--brand); cursor: pointer; font-weight: 650;
}
.publish-button:hover { background: var(--brand-hover); }

.page { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 56px 0 80px; }
.intro { text-align: center; }
.intro h1 { margin: 0; font-size: 34px; letter-spacing: -0.04em; }
.intro p { margin: 10px 0 0; color: var(--muted); font-size: 14px; }

.search-box {
  width: min(720px, 100%);
  height: 48px;
  margin: 30px auto 0;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.search-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.search-box svg { width: 18px; height: 18px; color: var(--muted); }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); }
.search-box input::placeholder { color: #a6aebb; }
#clearSearch {
  width: 24px; height: 24px; display: grid; place-items: center;
  border: 0; border-radius: 50%; color: var(--muted); background: transparent; cursor: pointer;
  visibility: hidden;
}
#clearSearch.visible { visibility: visible; }
#clearSearch:hover { background: var(--bg); color: var(--text); }

.filters {
  margin: 22px auto 0;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}
.filters button {
  height: 32px; padding: 0 13px; border: 1px solid var(--line);
  border-radius: 999px; color: var(--text-2); background: var(--surface); cursor: pointer;
  font-size: 13px; transition: 130ms ease;
}
.filters button:hover { border-color: var(--line-strong); color: var(--text); }
.filters button.active { border-color: var(--brand-border); color: var(--brand); background: var(--brand-soft); font-weight: 650; }
.filters .divider { width: 1px; height: 22px; margin: 5px 6px; background: var(--line); }

.result-line { margin: 30px 0 12px; color: var(--muted); font-size: 13px; }
.capability-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.cap-card {
  min-height: 210px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}
.cap-card:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: 0 8px 22px rgba(16, 24, 40, .07); }
.card-head { display: flex; align-items: flex-start; gap: 10px; }
.cap-icon { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; font: 750 11px var(--mono); }
.cap-icon.mcp { color: var(--brand); background: var(--brand-soft); }
.cap-icon.skill { color: var(--brand); background: var(--brand-soft); }
.cap-icon.agent { color: var(--brand); background: var(--brand-soft); }
.card-title { min-width: 0; flex: 1; }
.card-title h3 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.card-title span { color: var(--muted); font-size: 11px; }
.type-tag { padding: 3px 7px; border-radius: 999px; font-size: 10px; font-weight: 700; }
.type-tag.mcp { color: var(--brand); background: var(--brand-soft); }
.type-tag.skill { color: var(--brand); background: var(--brand-soft); }
.type-tag.agent { color: var(--brand); background: var(--brand-soft); }
.cap-desc {
  margin: 14px 0 0;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-foot { margin-top: auto; padding-top: 14px; display: flex; align-items: center; gap: 10px; }
.card-meta { color: var(--text-2); font-size: 13px; font-weight: 650; }
.card-section { margin-top: 6px; }
.card-desc {
  margin: 6px 0 0;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-features,
.card-audience {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}
.card-audience { margin-top: 10px; padding-top: 0; border-top: 0; }
.card-label { display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; font-weight: 650; }
.card-features p,
.card-audience p {
  margin: 0;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-detail-link {
  margin-left: auto;
  padding: 4px 9px;
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 11px;
  font-weight: 650;
}
.install-button {
  margin-left: auto; height: 30px; padding: 0 11px; border: 1px solid var(--line-strong);
  border-radius: 7px; color: var(--text-2); background: var(--surface); cursor: pointer;
  font-size: 12px; font-weight: 650;
}
.install-button:hover { color: var(--brand); border-color: var(--brand-border); background: var(--brand-soft); }
.install-button.installed { color: var(--success); border-color: transparent; background: var(--success-soft); cursor: default; }
.empty { padding: 80px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; margin-bottom: 6px; color: var(--text); }
.toast {
  position: fixed; right: 22px; bottom: 22px; z-index: 30;
  padding: 10px 14px; border: 1px solid var(--line); border-radius: 9px;
  color: var(--text); background: var(--surface); box-shadow: 0 10px 30px rgba(16,24,40,.12);
  opacity: 0; transform: translateY(8px); pointer-events: none; transition: 160ms ease;
  font-size: 13px;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1050px) { .capability-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 780px) {
  .topbar { padding: 0 16px; }
  .page { width: calc(100% - 24px); padding-top: 38px; }
  .intro h1 { font-size: 28px; }
  .capability-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .text-link { display: none; }
  .capability-grid { grid-template-columns: 1fr; }
  .filters { justify-content: flex-start; }
}

.cap-card { cursor: pointer; }
.card-foot { justify-content: space-between; }
.detail-view { padding-top: 8px; }
.back-button { height: 34px; padding: 0 12px; border: 0; border-radius: 8px; color: var(--text-2); background: transparent; cursor: pointer; }
.back-button:hover { color: var(--text); background: var(--surface); }
.detail-hero { margin-top: 20px; padding: 28px; display: flex; align-items: flex-start; gap: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.detail-icon { width: 58px; height: 58px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 15px; color: var(--brand); background: var(--brand-soft); font: 800 15px var(--mono); }
.detail-heading { min-width: 0; flex: 1; }
.detail-title-row { display: flex; align-items: center; gap: 10px; }
.detail-title-row h1 { margin: 0; font-size: 25px; letter-spacing: -0.03em; }
.detail-icon-wrap { flex: 0 0 auto; display: grid; gap: 8px; justify-items: center; }
.detail-icon-version { color: var(--muted); font-size: 12px; font-weight: 650; }
.detail-id { margin: 6px 0 0; color: var(--text); font-size: 14px; font-weight: 750; }
.detail-author { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.detail-description { margin: 14px 0 0; color: var(--text-2); font-size: 14px; line-height: 1.7; }
.install-button.primary { height: 38px; padding: 0 20px; margin-left: 12px; color: #fff; border-color: var(--brand); background: var(--brand); }
.install-button.primary:hover { color: #fff; background: var(--brand-hover); }
.install-button.primary.installed { color: var(--success); border-color: transparent; background: var(--success-soft); }
.detail-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.detail-meta-grid { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.detail-meta-grid div { padding: 18px; }
.detail-meta-grid div + div { border-left: 1px solid var(--line); }
.detail-meta-grid span { display: block; color: var(--muted); font-size: 11px; }
.detail-meta-grid strong { display: block; margin-top: 5px; font-size: 14px; }
.detail-panel { padding: 22px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.detail-panel h2 { margin: 0 0 12px; font-size: 15px; }
.detail-panel p { margin: 0; color: var(--text-2); font-size: 13px; line-height: 1.8; }
.permission-list { display: grid; gap: 9px; color: var(--text-2); font-size: 13px; }
.permission-list span::before { content: "✓"; margin-right: 8px; color: var(--success); font-weight: 800; }
@media (max-width: 780px) {
  .detail-hero { flex-wrap: wrap; }
  .detail-hero .install-button.primary { width: 100%; margin-left: 0; }
  .detail-body { grid-template-columns: 1fr; }
  .detail-meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-meta-grid div:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .detail-meta-grid div:nth-child(4) { border-top: 1px solid var(--line); }
}

.install-config { margin-top: 16px; padding: 20px; display: grid; gap: 12px; border: 1px solid var(--brand-border); border-radius: 12px; background: var(--brand-soft); }
.install-config-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.install-config-head div { display: grid; gap: 3px; }
.install-config-head strong { font-size: 14px; }
.install-config-head span { color: var(--muted); font-size: 11px; }
.install-config label { display: grid; gap: 5px; }
.install-config label > span { color: var(--text-2); font-size: 12px; font-weight: 650; }
.install-config input { height: 38px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--text); background: var(--surface); outline: none; font: 12px var(--mono); }
.install-config input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.install-config .install-button.primary { width: 100%; margin: 4px 0 0; }
.copy-row { display: flex; gap: 8px; align-items: flex-start; }
.json-box {
  flex: 1; min-height: 132px; padding: 10px 11px; border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface); color: var(--text-2); resize: vertical;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.6;
}
.json-box:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.copy-row input { flex: 1; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: var(--text-2); }
.copy-button {
  height: 38px; padding: 0 16px; border: 1px solid var(--brand); border-radius: 8px;
  color: #fff; background: var(--brand); cursor: pointer; font-size: 12px; font-weight: 650; white-space: nowrap;
}
.copy-button:hover { background: var(--brand-hover); }
.install-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; }
.install-foot a { color: var(--brand); text-decoration: none; }
.install-foot a:hover { text-decoration: underline; }
.publish-wrap { max-width: 780px; margin: 0 auto; }
.detail-manage {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 16px; padding: 12px 16px; border: 1px dashed var(--line-strong); border-radius: 10px;
  color: var(--muted); font-size: 12px;
}
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid label { display: grid; gap: 5px; }
.form-grid label > span { color: var(--text-2); font-size: 12px; font-weight: 650; }
.form-grid input, .form-grid select {
  height: 38px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface); color: var(--text); font-size: 13px;
}
.form-grid input:focus, .form-grid select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.install-foot button + button { margin-left: 8px; }
.publish-list { display: grid; gap: 8px; }
.publish-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
}
.publish-row strong { font-size: 13px; }
.publish-row span { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.publish-actions button {
  height: 28px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 7px;
  background: var(--surface); color: var(--text-2); cursor: pointer; font-size: 12px;
}
.publish-actions button:hover { color: var(--brand); border-color: var(--brand-border); }
.publish-actions button.danger:hover { color: #d33; border-color: #f0c4c4; }
.publish-empty { padding: 12px 0; color: var(--muted); font-size: 13px; }
.publish-row.off { opacity: .6; border-style: dashed; }
.adv-toggle { display: inline-flex; align-items: center; gap: 5px; margin-right: 10px; color: var(--text-2); font-size: 12px; cursor: pointer; }
#advancedPanel { margin-top: 4px; padding-top: 12px; border-top: 1px dashed var(--line-strong); }
#advancedPanel .form-grid { margin-bottom: 12px; }

/* ---- 详情页（对齐开放市场那种布局）---- */
.detail-meta-line { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.detail-access { margin: 10px 0 0; color: var(--text-2); font-size: 12px; }
.detail-tabs { display: flex; gap: 4px; margin: 18px 0 14px; border-bottom: 1px solid var(--line); }
.detail-tabs .tab {
  padding: 9px 14px; border: none; background: none; cursor: pointer;
  color: var(--text-2); font-size: 13px; font-weight: 650; border-bottom: 2px solid transparent;
}
.detail-tabs .tab:hover { color: var(--brand); }
.detail-tabs .tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.detail-main { display: grid; gap: 16px; }
.detail-aside { display: grid; gap: 12px; position: sticky; top: 88px; }
.install-card { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); display: grid; gap: 14px; }
.install-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.install-card-title { font-size: 14px; font-weight: 700; }
.env-select { height: 28px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); font-size: 12px; }
.install-block { display: grid; gap: 7px; }
.install-label { color: var(--muted); font-size: 11px; }
.copy-line { display: flex; gap: 8px; }
.copy-line input { flex: 1; min-width: 0; height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--text-2); font-size: 12px; }
.copy-button.small { height: 34px; padding: 0 12px; font-size: 12px; }
.client-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.client-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px;
  border: 1px solid var(--brand); border-radius: 9px; background: var(--brand); color: #fff;
  cursor: pointer; font-size: 13px; font-weight: 650;
}
.client-btn:hover { background: var(--brand-hover); }
.client-btn.installed { background: var(--success-soft); color: var(--success); border-color: transparent; cursor: default; }
.client-badge { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 6px; background: rgba(255,255,255,.22); font-weight: 800; }
.client-btn.installed .client-badge { background: var(--success-soft); }
.client-manual { color: var(--brand); font-size: 11px; text-decoration: none; }
.client-manual:hover { text-decoration: underline; }
.manual-row { display: flex; gap: 8px; flex-wrap: wrap; }
.manual-row .install-button { width: auto; margin: 0; }
.install-hint { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.fact-row { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--muted); }
.fact-row strong { color: var(--text); font-size: 13px; }
.count-chip { margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: 11px; font-weight: 700; }
.tool-list { display: grid; gap: 8px; }
.tool-row { display: grid; gap: 3px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; }
.tool-row code { color: var(--text); font-size: 12px; font-weight: 700; font-family: ui-monospace, Menlo, Consolas, monospace; }
.tool-row span { color: var(--muted); font-size: 12px; line-height: 1.6; }
.install-button.danger:hover { color: #d33; border-color: #f0c4c4; }
@media (max-width: 900px) {
  .detail-layout { grid-template-columns: minmax(0, 1fr); }
  .detail-aside { position: static; }
}
/* ---- 首页：统计行 + 更宽的搜索 + 4 列卡片 ---- */
.market-stats {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px;
  margin: 4px 0 16px; color: var(--muted); font-size: 13px;
}
.market-stats span { display: inline-flex; align-items: center; gap: 6px; }
.market-stats span::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); opacity: .7; }
.search-box { height: 46px; }
.search-box input { font-size: 14px; }
.capability-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cap-desc { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cap-card { min-height: 176px; }
@media (max-width: 1200px) { .capability-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* ---- 注册/创建页 ---- */
.form-section {
  margin: 6px 0 2px; padding-bottom: 6px; border-bottom: 1px solid var(--line);
  color: var(--text); font-size: 13px; font-weight: 700;
}
.publish-button.secondary { color: var(--text-2); background: var(--surface); border: 1px solid var(--line-strong); }
.publish-button.secondary:hover { color: var(--brand); border-color: var(--brand-border); background: var(--brand-soft); }
.publish-button { display: inline-flex; align-items: center; text-decoration: none; }
.action-link {
  display: inline-flex; align-items: center; height: 28px; padding: 0 10px;
  border: 1px solid var(--line-strong); border-radius: 7px; color: var(--text-2); font-size: 12px; text-decoration: none;
}
.action-link:hover { color: var(--brand); border-color: var(--brand-border); }
/* ================= 注册 / 创建 表单页（精致版） ================= */
.reg-wrap { max-width: 880px; margin: 0 auto; }

.reg-hero { display: flex; align-items: center; gap: 14px; margin: 4px 0 20px; }
.reg-hero-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 13px; flex: none;
  background: var(--brand-soft); color: var(--brand);
  font-size: 13px; font-weight: 800; letter-spacing: .02em;
}
.reg-hero h1 { margin: 0; font-size: 22px; letter-spacing: -0.02em; }
.reg-hero p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.reg-hero-tag {
  margin-left: auto; padding: 3px 10px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand); font-size: 11px; font-weight: 700;
}

.reg-card {
  padding: 26px 26px 22px; border: 1px solid var(--line); border-radius: 16px;
  background: var(--surface); box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 8px 24px -18px rgba(16,24,40,.18);
}
.reg-section + .reg-section { margin-top: 26px; padding-top: 24px; border-top: 1px solid var(--line); }
.reg-section-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 16px; }
.reg-section-head h2 { margin: 0; font-size: 14px; font-weight: 700; }
.reg-section-head h2::before {
  content: ''; display: inline-block; width: 3px; height: 12px; margin-right: 8px;
  border-radius: 2px; background: var(--brand); vertical-align: -1px;
}
.reg-section-head span { color: var(--muted); font-size: 12px; }

.reg-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.reg-field { display: grid; gap: 7px; min-width: 0; }
.reg-field.span-2 { grid-column: 1 / -1; }
.reg-field > span { color: var(--text-2); font-size: 12px; font-weight: 600; }
.reg-field input,
.reg-field select,
.reg-field textarea {
  width: 100%; min-width: 0; height: 40px; padding: 0 13px;
  border: 1px solid var(--line-strong); border-radius: 10px; background: #fff; color: var(--text);
  font-family: inherit; font-size: 13px; line-height: 1;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.reg-field select { padding-right: 30px; }
.reg-field textarea {
  height: auto; min-height: 160px; padding: 12px 13px; line-height: 1.65;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px;
}
.reg-field input::placeholder, .reg-field textarea::placeholder { color: #a9b1bd; }
.reg-field input:focus, .reg-field select:focus, .reg-field textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
.reg-field input[type='file'] {
  height: auto; padding: 9px 13px; font-size: 12px; background: #f8fafc; border-style: dashed; cursor: pointer;
}
.reg-field input[type='file']::file-selector-button {
  margin-right: 12px; padding: 6px 12px; border: 1px solid var(--line-strong); border-radius: 8px;
  background: #fff; color: var(--text-2); font-size: 12px; cursor: pointer;
}
.reg-field input[type='file']::file-selector-button:hover { color: var(--brand); border-color: var(--brand-border); }

.reg-hint { color: var(--muted); font-size: 11px; line-height: 1.5; }
.reg-field input[readonly] { background: #f7f9fb; color: var(--text-2); }
.reg-advanced { margin-top: 18px; padding-top: 18px; border-top: 1px dashed var(--line-strong); }

.reg-actions {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line);
}
.reg-error { margin-right: auto; color: #d64545; font-size: 12px; }
.reg-btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 40px; padding: 0 20px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 650;
  text-decoration: none; cursor: pointer; transition: .15s ease;
}
.reg-btn:hover { color: var(--brand); border-color: var(--brand-border); }
.reg-btn.primary { border-color: var(--brand); background: var(--brand); color: #fff; }
.reg-btn.primary:hover { background: var(--brand-hover); color: #fff; }
.auth-probe-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.auth-probe-row .reg-btn { height: 36px; padding: 0 14px; font-size: 12.5px; }
.auth-probe-hint { font-size: 12px; color: var(--text-3, #7a8190); }
.auth-probe-hint.ok { color: #12805c; }
.auth-probe-hint.err { color: #c0392b; }
.adv-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-2); font-size: 12px; cursor: pointer; user-select: none;
}

@media (max-width: 720px) {
  .reg-grid { grid-template-columns: minmax(0, 1fr); }
  .reg-card { padding: 20px 16px; }
}
/* 复选框不能被表单的宽度规则撑开 */
.reg-toggle-row { grid-column: 1 / -1; }
.adv-toggle input[type='checkbox'],
.reg-field input[type='checkbox'],
.reg-toggle-row input[type='checkbox'] {
  width: 16px; height: 16px; min-width: 0; padding: 0; margin: 0; flex: none;
  accent-color: var(--brand); cursor: pointer;
}
.reg-toggle-row .adv-toggle { font-size: 12px; color: var(--text-2); }
/* ---- 统一「能力」呈现：图标不再按类型上色 ---- */
.cap-icon { color: var(--brand); background: var(--brand-soft); }

/* ---- 详情页：一个主按钮 + 折叠起来的其它方式 / 技术信息 ---- */
.install-primary {
  width: 100%; height: 42px; border: 1px solid var(--brand); border-radius: 9px;
  background: var(--brand); color: #fff; cursor: pointer; font-size: 14px; font-weight: 700;
}
.install-primary:hover { background: var(--brand-hover); }
.install-primary.installed { color: var(--success); border-color: transparent; background: var(--success-soft); cursor: default; }
.install-primary:disabled { opacity: .72; }
.install-more > summary { cursor: pointer; color: var(--muted); font-size: 11px; list-style: none; user-select: none; }
.install-more > summary::-webkit-details-marker { display: none; }
.install-more > summary::before { content: '\25B8  '; }
.install-more[open] > summary::before { content: '\25BE  '; }
.install-more > summary:hover { color: var(--brand); }
.install-more > *:not(summary) { margin-top: 10px; }

/* ---- 发布能力：形式切换 ---- */
.reg-kind-switch { display: flex; gap: 8px; margin-bottom: 16px; }
.reg-kind-switch button {
  height: 34px; padding: 0 16px; border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface); color: var(--text-2); cursor: pointer; font-size: 13px; font-weight: 650;
}
.reg-kind-switch button:hover { color: var(--brand); border-color: var(--brand-border); }
.reg-kind-switch button.active { color: #fff; background: var(--brand); border-color: var(--brand); }

/* ---- 首页改版：搜索区独立成块 + 页签 ---- */
.page { padding: 28px 0 80px; }
.search-panel {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.search-box {
  width: 100%;
  height: 44px;
  margin: 0;
  border-color: transparent;
  background: var(--bg);
  box-shadow: none;
}
.search-box:focus-within { border-color: var(--brand); background: var(--surface); }
.panel-foot {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.filters { margin: 0; justify-content: flex-start; }
.filters button { background: transparent; }
.filters button.active { background: var(--brand-soft); }
.market-stats { margin: 0; }
.market-stats span::before { display: none; }

/* ---- 详情页面包屑 ---- */
.breadcrumb { display: flex; align-items: center; gap: 8px; margin: 0 0 18px; font-size: 13px; }
.crumb {
  padding: 0; border: 0; background: transparent; color: var(--muted);
  cursor: pointer; font-size: 13px; line-height: 1.6;
}
.crumb:hover { color: var(--brand); }
.crumb-sep { color: var(--line-strong); }
.crumb-current { color: var(--text); font-weight: 650; }

/* ---- 首页头图区：统计 + 搜索 + 页签，整体居中，并与下面的豆腐块分区 ---- */
.hero {
  padding: 26px 20px 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}
.market-stats {
  display: block;
  margin: 0 0 16px;
  color: var(--text-2);
  font-size: 15px;
  font-weight: 650;
}
.market-stats span::before { display: none; }
.search-box {
  width: min(720px, 100%);
  height: 46px;
  margin: 0 auto;
  border-color: transparent;
  background: var(--bg);
  box-shadow: none;
}
.search-box:focus-within { border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 3px var(--brand-soft); }
.filters { margin: 16px auto 0; justify-content: center; }
.filters button { background: transparent; }
.filters button.active { background: var(--brand-soft); }
.result-line { margin: 22px 0 12px; }

/* ---- 首页头图区：浅色底 + 通栏无边界搜索 ---- */
.hero {
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    radial-gradient(120% 150% at 8% 0%, #e9f7f1 0%, rgba(233, 247, 241, 0) 58%),
    radial-gradient(110% 130% at 92% 4%, #edf3ff 0%, rgba(237, 243, 255, 0) 62%),
    linear-gradient(180deg, #fbfdfc 0%, #ffffff 72%);
  box-shadow: var(--shadow);
  text-align: center;
}
.market-stats { margin: 0; padding: 28px 20px 20px; }
.search-box {
  width: 100%;
  height: 52px;
  margin: 0;
  padding: 0 26px;
  border: 0;
  border-radius: 0;
  background: rgba(255, 255, 255, .74);
  box-shadow: none;
}
.search-box:focus-within { border: 0; background: #fff; box-shadow: none; }
.filters { margin: 0; padding: 16px 20px 20px; justify-content: center; }

/* ---- 页头整块：通栏、左右打通，不用圆角卡片围起来 ---- */
body { overflow-x: hidden; }
.page { padding-top: 0; }
.hero {
  margin: 0 calc(50% - 50vw);
  padding: 30px max(20px, calc(50vw - 590px)) 22px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  background:
    radial-gradient(90% 200% at 0% 0%, #e9f7f1 0%, rgba(233, 247, 241, 0) 55%),
    radial-gradient(90% 200% at 100% 0%, #edf3ff 0%, rgba(237, 243, 255, 0) 58%),
    linear-gradient(180deg, #fbfdfc 0%, #ffffff 100%);
  text-align: center;
}
.market-stats { margin: 0 0 18px; padding: 0; }
.search-box {
  width: 100%;
  height: 52px;
  margin: 0;
  padding: 0 20px;
  border: 0;
  border-radius: 0;
  background: rgba(255, 255, 255, .72);
  box-shadow: none;
}
.search-box:focus-within { border: 0; background: #fff; box-shadow: none; }
.filters { margin: 16px 0 0; padding: 0; justify-content: center; }
.result-line { margin: 22px 0 12px; }

/* ---- 参考开放市场：通栏头图 + 居中搜索 + 下划线页签 ---- */
body { overflow-x: hidden; }
.page { padding: 0 0 80px; }
.hero {
  margin: 0 calc(50% - 50vw);
  padding: 44px max(20px, calc(50vw - 590px)) 40px;
  border: 0;
  border-radius: 0;
  background-color: #f8fbfa;
  background-image: url('hero-bg.svg');
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  text-align: center;
}
.market-stats {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 20px;
  padding: 0;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
}
.market-stats::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #22c55e; }
.search-box {
  width: min(760px, 100%);
  height: 50px;
  margin: 0 auto;
  padding: 0 5px 0 16px;
  gap: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 2px 10px rgba(16, 24, 40, .05);
}
.search-box:focus-within { border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 3px var(--brand-soft); }
.search-submit {
  width: 42px;
  height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: #1f2329;
  color: #fff;
  cursor: pointer;
}
.search-submit svg { width: 18px; height: 18px; }
.search-submit:hover { background: #000; }

/* 页签：左对齐 + 下划线选中 */
.tabs-bar { border-bottom: 1px solid var(--line); }
.filters { margin: 0; padding: 0; gap: 28px; justify-content: flex-start; flex-wrap: nowrap; }
.filters button {
  height: 46px;
  padding: 0;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
}
.filters button:hover { color: var(--text); }
.filters button.active {
  color: var(--text);
  border-bottom-color: var(--text);
  background: transparent;
  font-weight: 700;
}
.result-line { margin: 24px 0 14px; color: var(--text); font-size: 15px; font-weight: 650; }

/* 详情页：页面顶部内边距已经交给头图区，这里补回自己的间距 */
.detail-view { padding-top: 26px; }

/* ---- 豆腐块右上角角标：内置 / 已安装 ---- */
.cap-card { position: relative; }
.card-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.7;
}
.card-badge.builtin { color: var(--text-2); background: var(--bg); border: 1px solid var(--line); }
.card-badge.installed { color: var(--success); background: var(--success-soft); }

/* ---- 角标配色：内置=蓝（来源），已安装=绿（状态） ---- */
.card-badge { border: 0; padding: 3px 9px; font-size: 11px; }
.card-badge.builtin { color: var(--brand); background: var(--brand-soft); }
.card-badge.installed { color: var(--success); background: var(--success-soft); }
.card-badge.installed::before { content: '\2713'; margin-right: 3px; font-weight: 800; }
.card-badge.private { color: #b26a00; background: rgba(255, 176, 32, 0.16); }
.card-badge.private::before { content: '\1F512'; margin-right: 3px; }

/* ---- 详情页：不再折叠，内容直接铺开 ---- */
.install-alt { display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.install-alt .install-label { color: var(--muted); }
.fact-row { gap: 12px; align-items: flex-start; }
.fact-row strong { text-align: right; word-break: break-all; }

/* ---- 页签栏：左边四组，右边「已安装」 ---- */
.tabs-bar { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.filters-right { justify-content: flex-end; }
.filters button { white-space: nowrap; }

/* ---- EnWork-WB 主题桥接：内嵌时由客户端注入同名变量 ---- */
body { font-size: calc(14px * var(--font-scale, 1)); }
.topbar {
  height: 52px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}
.brand strong { font-style: normal; font-size: 20px; }
.publish-button { color: var(--on-brand); background: var(--brand); }
.publish-button:hover { background: var(--brand-hover); }
.card-detail-link { color: var(--brand); background: var(--brand-soft); border-color: var(--brand-border); }
.install-button:hover { border-color: var(--brand); }
.install-button.primary,
.install-primary,
.client-btn,
.copy-button,
.reg-btn.primary { color: var(--on-brand); background: var(--brand); }
.install-button.primary:hover,
.install-primary:hover,
.client-btn:hover,
.copy-button:hover,
.reg-btn.primary:hover { color: var(--on-brand); background: var(--brand-hover); }
.install-config { border-color: var(--brand); }
.install-config input:focus,
.json-box:focus,
.form-grid input:focus,
.form-grid select:focus,
.reg-field input:focus,
.reg-field select:focus,
.reg-field textarea:focus { box-shadow: 0 0 0 3px var(--brand-soft); }
.reg-field input,
.reg-field select,
.reg-field textarea,
.reg-field input[type='file'],
.reg-field input[type='file']::file-selector-button { background: var(--surface); }
.reg-field input[readonly] { background: var(--surface-hover); }
.reg-kind-switch button.active { color: var(--on-brand); }
.page { width: min(1120px, calc(100% - 48px)); padding-bottom: 48px; }
.hero {
  background: var(--bg);
}
.market-stats::before { background: var(--muted); }
.search-box { box-shadow: var(--shadow); }
.search-submit { background: var(--brand); color: var(--on-brand); }
.search-submit:hover { background: var(--brand-hover); }
.cap-card:hover { box-shadow: var(--shadow-hover); }
.filters button.active { border-bottom-color: var(--brand); color: var(--brand); }
.card-badge.installed { color: var(--success); }
.detail-hero,
.detail-panel,
.install-card,
.detail-meta-grid { border-radius: var(--radius); }

/* Installed is a success state, independent of the action theme. */
.install-primary.installed,
.install-primary.installed:hover,
.install-button.primary.installed,
.install-button.primary.installed:hover,
.client-btn.installed,
.client-btn.installed:hover {
  color: var(--success);
  background: var(--success-soft);
  border-color: transparent;
}
.install-primary:disabled:not(.installed) {
  color: var(--muted);
  background: var(--surface-hover);
  border-color: var(--line);
  cursor: not-allowed;
}
.search-box input::placeholder { color: var(--muted); }
.publish-actions button.danger:hover,
.install-button.danger:hover { color: var(--danger); border-color: var(--danger); }
.reg-error { color: var(--danger); }

/* ---- 授权卡片 / 授权弹窗 ---- */
.card-badge.auth { color: #b26a00; background: rgba(255, 176, 32, 0.16); }
.auth-card { display: grid; gap: 10px; }
.auth-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.auth-head strong { font-size: 15px; }
.auth-status { font-size: 12px; padding: 2px 8px; border-radius: 999px; }
.auth-status.ok { color: var(--success); background: var(--success-soft); }
.auth-status.warn { color: #b26a00; background: rgba(255, 176, 32, 0.16); }
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal-backdrop[hidden] { display: none; }
.modal-card { width: min(420px, calc(100vw - 32px)); background: var(--bg); border-radius: 14px; padding: 22px; box-shadow: 0 24px 60px rgba(15, 23, 42, .25); display: grid; gap: 14px; }
.modal-card h3 { margin: 0; font-size: 17px; }
.modal-field { display: grid; gap: 6px; font-size: 13px; color: var(--text-2); }
.modal-field input { height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; font-size: 14px; }
.modal-error { margin: 0; color: #c93434; font-size: 13px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.modal-actions .install-primary,
.modal-actions .install-button {
  width: auto;
  min-width: 92px;
  height: 38px;
  margin: 0;
  flex: 0 0 auto;
  white-space: nowrap;
}
.modal-field input:focus { outline: 2px solid rgba(37, 99, 235, .35); outline-offset: 1px; }
/* ---- 卡片右上角状态（可多个） ---- */
.card-badges { position: absolute; top: 12px; right: 12px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; max-width: 65%; z-index: 1; }
.card-badges .card-badge { position: static; top: auto; right: auto; }
.card-badge.ok { color: var(--success); background: var(--success-soft); }
.card-badge.warn { color: #b26a00; background: rgba(255, 176, 32, 0.16); }
