/* Design Studio · 设计台首页 / 设计库
   Layout follows the DSH 设计台 reference: light canvas, centered column,
   three-segment switcher, card shelves and a bottom composer. */
:root {
  --bg: #fafbfc;
  --panel: #ffffff;
  --line: #e6e9ef;
  --line-2: #d5dae3;
  --text: #1b1f27;
  --muted: #8a93a3;
  --accent: #4f6ef7;
  --accent-soft: #eef1ff;
  --card-bg: #f4f6f9;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 30, 60, .04), 0 8px 24px rgba(20, 30, 60, .05);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 13px/1.5 system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  padding-bottom: 108px;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ---- 顶部三页签 + 常驻入口（v7） ---- */
.topbar {
  height: 56px; display: flex; align-items: center; gap: 20px;
  padding: 0 24px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { font-size: 14px; font-weight: 700; letter-spacing: .2px; white-space: nowrap; }
.brand .mark { color: var(--accent); margin-right: 4px; }
.segments { display: flex; gap: 2px; background: #f2f4f8; padding: 3px; border-radius: 9px; margin: 0 auto; }
.segments button {
  border: 0; background: transparent; padding: 7px 22px; border-radius: 7px;
  font-size: 12px; color: var(--muted); transition: .15s; display: inline-flex; align-items: center; gap: 7px;
}
.segments button b { font-size: 10px; font-weight: 600; background: #e6eaf2; color: #98a1b0; padding: 1px 6px; border-radius: 10px; }
.segments button:hover { color: var(--text); }
.segments button.active { background: var(--accent); color: #fff; font-weight: 600; box-shadow: 0 2px 6px rgba(79, 110, 247, .3); }
.segments button.active b { background: rgba(255,255,255,.25); color: #fff; }
.top-right { display: flex; align-items: center; gap: 10px; white-space: nowrap; min-width: 0; margin-left: auto; }
.top-btn { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 7px 12px; font-size: 12px; color: #5c6675; }
.top-btn:hover { color: var(--accent); border-color: #c3cdfb; }
.wb-btn { font-size: 12px; color: #fff; background: var(--accent); border-radius: 8px; padding: 8px 14px; font-weight: 600; flex: none; }
.wb-btn:hover { background: #4260e8; }

/* ---- 挂载条：替代宿主输入框的模板 chip（技能无法注入宿主 UI） ---- */
.attach-strip {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: #eef1ff; border-bottom: 1px solid #dbe2ff; padding: 9px 24px;
  font-size: 12px;
}
.attach-chip { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1px solid #dbe2ff; border-radius: 20px; padding: 4px 6px 4px 10px; box-shadow: 0 1px 2px rgba(20,30,60,.05); }
.attach-chip b { font-weight: 600; color: var(--text); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-chip button { border: 0; background: transparent; font-size: 15px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.attach-chip button:hover { color: #d93025; }
.attach-kind { font-size: 10px; color: var(--accent); background: var(--accent-soft); border-radius: 10px; padding: 2px 8px; }
.attach-kind.k-style { color: #0f6e56; background: #e1f5ee; }
.attach-kind.k-component { color: #854f0b; background: #faeeda; }
.attach-hint { color: #5c6675; }

/* ---- 列表头 ---- */
.library { max-width: 1080px; margin: 0 auto; padding: 26px 28px 20px; }
.library-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.library-title h1 { margin: 0; font-size: 19px; font-weight: 600; }
.library-title p { margin: 5px 0 0; font-size: 12px; color: var(--muted); }
.library-tools { display: flex; align-items: center; gap: 8px; }
.search {
  width: 200px; border: 1px solid var(--line); background: var(--panel);
  border-radius: 8px; padding: 7px 12px; font-size: 12px; outline: none;
}
.search:focus { border-color: var(--accent); }
.filter-btn { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 7px 14px; font-size: 12px; color: var(--muted); }
.filter-btn:hover { color: var(--accent); border-color: #c3cdfb; }
.filter-btn.active { color: var(--accent); background: var(--accent-soft); border-color: #c3cdfb; }
.facet-row { display: flex; gap: 7px; flex-wrap: wrap; margin: 18px 0 20px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }

/* ---- views ---- */
.view { animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px) } to { opacity: 1; transform: none } }
.home-inner { max-width: 900px; margin: 0 auto; padding: 44px 28px 20px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.link, .btn-primary { border: 0; background: transparent; color: var(--muted); font-size: 12px; }
.link:hover { color: var(--accent); }
.btn-primary { background: var(--accent); color: #fff; border-radius: 8px; padding: 9px 18px; font-weight: 600; }
.btn-primary:hover { background: #4260e8; }
.btn-primary.small { padding: 7px 14px; }
.home-tip { text-align: center; color: var(--muted); font-size: 12px; margin-top: 32px; }

/* ---- recent / mine cards (large, 3 columns) ---- */
.recent-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.recent-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); cursor: pointer; transition: .16s;
}
.recent-card:hover { border-color: #c3cdfb; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(79, 110, 247, .12); }
.recent-thumb { height: 176px; background: var(--card-bg); position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.recent-thumb iframe { width: 1000px; height: 900px; border: 0; transform: scale(.28); transform-origin: top left; position: absolute; top: 0; left: 0; pointer-events: none; background: #fff; }
.recent-meta { padding: 12px 14px 14px; }
.recent-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-detail { font-size: 11px; color: var(--muted); margin-top: 4px; }
.new-card {
  border: 1px dashed var(--line-2); border-radius: var(--radius); background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; min-height: 236px; color: var(--muted); font-size: 12px; transition: .16s;
}
.new-card:hover { border-color: var(--accent); color: var(--accent); background: #fafbff; }
.new-card .plus { width: 38px; height: 38px; border-radius: 50%; background: #f0f2f7; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 300; }
.new-card:hover .plus { background: var(--accent-soft); }

/* ---- library shelves ---- */
.library { max-width: 1080px; margin: 0 auto; padding: 28px 28px 20px; }
.shelf-tabs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.shelf-tabs button {
  border: 1px solid transparent; background: transparent; padding: 6px 12px; border-radius: 8px;
  font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px;
}
.shelf-tabs button b { font-size: 10px; font-weight: 600; background: #eceff5; color: #98a1b0; padding: 1px 6px; border-radius: 10px; }
.shelf-tabs button:hover { background: #f2f4f8; color: var(--text); }
.shelf-tabs button.active { background: var(--accent); color: #fff; font-weight: 600; }
.shelf-tabs button.active b { background: rgba(255,255,255,.25); color: #fff; }
.flex { flex: 1; }
.search {
  width: 190px; border: 1px solid var(--line); background: var(--panel);
  border-radius: 8px; padding: 7px 12px; font-size: 12px; outline: none;
}
.search:focus { border-color: var(--accent); }
.filter-btn { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 7px 14px; font-size: 12px; color: var(--muted); }
.filter-btn:hover { color: var(--accent); border-color: #c3cdfb; }
.filter-btn.active { color: var(--accent); background: var(--accent-soft); border-color: #c3cdfb; }

.facet-row { display: flex; gap: 7px; flex-wrap: wrap; margin: 16px 0 20px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.facet {
  border: 1px solid var(--line); background: var(--panel); border-radius: 20px;
  padding: 5px 11px; font-size: 11px; color: #5c6675; display: inline-flex; gap: 6px; align-items: center;
}
.facet b { font-size: 10px; color: #a4acba; font-weight: 600; }
.facet:hover { border-color: #c3cdfb; color: var(--accent); }
.facet.active { background: var(--accent-soft); border-color: #c3cdfb; color: var(--accent); font-weight: 600; }
.facet.active b { color: var(--accent); }

/* ---- card grid (3 columns, like the reference) ---- */
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.lib-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; transition: .16s;
}
.lib-card:hover { border-color: #c3cdfb; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(79, 110, 247, .12); }
.lib-thumb { height: 186px; background: var(--card-bg); position: relative; overflow: hidden; cursor: pointer; }
.lib-thumb iframe { width: 1000px; height: 900px; border: 0; transform: scale(.28); transform-origin: top left; position: absolute; top: 0; left: 0; pointer-events: none; background: #fff; }
.lib-thumb .dot { position: absolute; right: 10px; top: 10px; width: 20px; height: 20px; border-radius: 50%; background: rgba(20,26,40,.35); color: #fff; font-size: 12px; display: flex; align-items: center; justify-content: center; z-index: 2; cursor: pointer; }
.lib-thumb .dot:hover { background: var(--accent); }
.lib-meta { padding: 11px 13px 12px; }
.lib-name { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-detail { font-size: 10px; color: var(--muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* ---- 卡片：收藏星 + 统一的双动作 ---- */
.lib-thumb .fav-star {
  position: absolute; right: 10px; top: 10px; width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid rgba(20,26,40,.12); background: rgba(255,255,255,.92); color: #98a1b0;
  font-size: 15px; line-height: 1; display: flex; align-items: center; justify-content: center;
  z-index: 3; cursor: pointer; padding: 0;
}
.lib-thumb .fav-star:hover { color: #f0b429; border-color: #f0b429; }
.lib-thumb .fav-star.on { color: #f0b429; background: #fff8e6; border-color: #f0b429; }
.lib-name:hover { color: var(--accent); cursor: pointer; }
.lib-actions { display: flex; border-top: 1px solid var(--line); }
.lib-actions button {
  flex: 1; border: 0; background: #fbfcfe; padding: 9px 6px; font-size: 11px; color: #5c6675;
}
.lib-actions button + button { border-left: 1px solid var(--line); }
.lib-actions button:hover { background: #f2f5ff; color: var(--accent); font-weight: 600; }
.lib-actions .act-create:hover { background: var(--accent); color: #fff; }
.lib-actions button:disabled { opacity: .6; cursor: default; }

/* style cards: colour swatch + big label, like the reference */
.style-card { cursor: pointer; display: flex; flex-direction: column; }
.style-swatch { height: 186px; position: relative; padding: 18px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
.style-swatch .dots { display: flex; gap: 5px; }
.style-swatch .dots i { width: 7px; height: 7px; border-radius: 50%; display: block; }
.style-swatch .style-zh { font-size: 22px; font-weight: 700; letter-spacing: 1px; line-height: 1.2; }
.style-swatch .rule { height: 18px; border-radius: 10px; padding: 0 8px; display: flex; align-items: center; gap: 5px; max-width: 78%; }
.style-swatch .rule i { display: block; height: 2px; border-radius: 2px; flex: 1; }
.style-swatch .badge { position: absolute; top: 14px; right: 14px; font-size: 9px; padding: 2px 7px; border-radius: 10px; }

/* component cards: centred live preview */
.comp-thumb { display: flex; align-items: center; justify-content: center; background: var(--card-bg); }
.comp-thumb iframe { width: 380px; height: 300px; transform: scale(.72); position: static; border: 0; background: transparent; }

.empty { text-align: center; color: var(--muted); padding: 60px 20px; font-size: 13px; }
.attribution { text-align: center; color: #a9b0bd; font-size: 10px; margin-top: 26px; }

/* ---- attach box on 我的 ---- */
.attach-box { margin-top: 36px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.attach-title { font-size: 12px; font-weight: 600; margin-bottom: 10px; }
.attach-body { font-size: 12px; color: var(--muted); line-height: 1.8; }
.attach-item { display: flex; align-items: center; gap: 10px; background: var(--accent-soft); border: 1px solid #dbe2ff; border-radius: 8px; padding: 10px 12px; color: var(--text); }
.attach-item b { color: var(--accent); }
.attach-item .kind { font-size: 10px; color: var(--muted); border: 1px solid var(--line-2); border-radius: 10px; padding: 2px 8px; }

/* ---- 底部：上传文档 + 内置 AI 提示 ---- */
.home-foot {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  background: rgba(255,255,255,.96); border-top: 1px solid var(--line);
  box-shadow: 0 -4px 20px rgba(20,30,60,.05);
}
.foot-inner {
  max-width: 1080px; margin: 0 auto; padding: 12px 28px;
  display: flex; align-items: center; gap: 14px;
}
.foot-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.foot-text b { font-size: 12px; }
.foot-text span { font-size: 11px; color: var(--muted); line-height: 1.5; }
/* 分离部署时显示当前连的是哪台服务端，方便排查跨域 / 地址填错 */
.foot-text .server-tag { font-size: 10px; line-height: 1.4; opacity: .85; }
.foot-text .server-tag.ok { color: #2f9e6f; }
.foot-text .server-tag.bad { color: #d64545; font-weight: 600; }
.btn-ghost { border: 1px solid var(--line-2); background: var(--panel); border-radius: 8px; padding: 9px 14px; font-size: 12px; color: #5c6675; white-space: nowrap; }
.btn-ghost:hover { color: var(--accent); border-color: #c3cdfb; }

/* ---- 我的设计弹窗 ---- */
.modal-box.wide { width: min(760px, calc(100vw - 40px)); }
.mine-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-height: 56vh; overflow: auto; }
.mine-card { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; background: var(--panel); }
.mine-card:hover { border-color: #c3cdfb; }
.mine-thumb { height: 120px; position: relative; overflow: hidden; background: var(--card-bg); border-bottom: 1px solid var(--line); }
.mine-thumb iframe { width: 900px; height: 700px; border: 0; transform: scale(.2); transform-origin: top left; position: absolute; top: 0; left: 0; pointer-events: none; background: #fff; }
.mine-meta { padding: 9px 12px; display: flex; flex-direction: column; gap: 3px; }
.mine-meta b { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mine-meta span { font-size: 10px; color: var(--muted); }
.mine-empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 40px 10px; font-size: 12px; }

/* ---- modal + toast ---- */
.modal { position: fixed; inset: 0; background: rgba(20, 26, 40, .38); display: flex; align-items: center; justify-content: center; z-index: 40; }
.modal-box { width: 400px; background: var(--panel); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.2); padding: 20px 22px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h3 { margin: 0; font-size: 15px; }
.icon { border: 0; background: transparent; font-size: 20px; color: var(--muted); line-height: 1; }
.modal-box label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 12px; }
.modal-box input, .modal-box select { display: block; width: 100%; margin-top: 5px; border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; font-size: 12px; outline: none; background: #fff; }
.modal-box input:focus, .modal-box select:focus { border-color: var(--accent); }
.modal-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; }
.hint { font-size: 11px; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%); background: #1b1f27; color: #fff; font-size: 12px; padding: 10px 18px; border-radius: 8px; z-index: 60; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: 80vw; text-align: center; }

@media (max-width: 900px) {
  .card-grid, .recent-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar { gap: 12px; padding: 0 14px; }
  .segments button { padding: 6px 12px; }
}

/* 行业筛选（v10）：模板来自真实项目，按行业过滤 */
.industry-row { margin: 14px 0 0; padding-bottom: 12px; align-items: center; }
.industry-label { font-size: 11px; color: var(--muted); margin-right: 2px; }
.industry-row .facet { border-style: dashed; }
.industry-row .facet.active { border-style: solid; }
