/* =============================================================================
 * 消费级外骨骼产品采购库 — 样式 (专业 / 响应式 / 轻量)
 * ========================================================================== */
:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --ink: #1c2430;
  --ink-soft: #5b6675;
  --line: #e4e8ef;
  --accent: #1f6feb;
  --accent-soft: #e8f0fe;
  --shadow: 0 1px 3px rgba(20, 30, 50, .08), 0 6px 20px rgba(20, 30, 50, .06);
  --radius: 14px;
  --maxw: 1280px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ---------------- 顶栏 ---------------- */
.topbar {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 22px 20px 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
}
.brand-block { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 46px; height: 46px; border-radius: 12px;
  background: linear-gradient(135deg, #1f6feb, #00b4d8);
  color: #fff; font-weight: 800; letter-spacing: 1px;
  display: grid; place-items: center; font-size: 15px;
  box-shadow: var(--shadow);
}
.topbar h1 { font-size: 21px; margin: 0; font-weight: 800; }
.sub { margin: 2px 0 0; color: var(--ink-soft); font-size: 13px; }
.stats { display: flex; gap: 10px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 6px 14px; text-align: center; min-width: 76px; box-shadow: var(--shadow);
}
.stat b { display: block; font-size: 19px; color: var(--accent); line-height: 1.1; }
.stat span { font-size: 11.5px; color: var(--ink-soft); }

/* ---------------- 工具栏 ---------------- */
.toolbar {
  max-width: var(--maxw); margin: 6px auto 0; padding: 12px 20px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.search-box {
  flex: 1 1 320px; display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 0 12px; box-shadow: var(--shadow);
}
.search-ico { opacity: .55; }
.search-box input { flex: 1; border: 0; outline: 0; padding: 11px 0; font-size: 15px; background: transparent; color: var(--ink); }
.btn-filter-toggle { display: none; border: 1px solid var(--line); background: var(--surface); padding: 10px 16px; border-radius: 10px; font-weight: 600; cursor: pointer; }
.result-line { color: var(--ink-soft); font-size: 14px; }
.result-line b { color: var(--ink); }

/* ---------------- 布局 ---------------- */
.layout {
  max-width: var(--maxw); margin: 8px auto 30px; padding: 0 20px;
  display: grid; grid-template-columns: 270px 1fr; gap: 22px; align-items: start;
}

/* ---------------- 筛选侧栏 ---------------- */
.filters {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); position: sticky; top: 14px;
}
.filter-group { margin-bottom: 16px; }
.filter-group h4 { margin: 0 0 8px; font-size: 13px; color: var(--ink-soft); font-weight: 700; letter-spacing: .3px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px;
  font-size: 13px; cursor: pointer; user-select: none; transition: .15s; background: #fbfcfe;
}
.chip input { display: none; }
.chip:hover { border-color: var(--accent); }
.chip.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.btn-reset {
  width: 100%; margin-top: 4px; padding: 9px; border: 1px dashed var(--line);
  background: transparent; color: var(--ink-soft); border-radius: 10px; cursor: pointer; font-size: 13px;
}
.btn-reset:hover { border-color: var(--accent); color: var(--accent); }

/* ---------------- 产品网格 ---------------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(20,30,50,.12); }
.card-visual { position: relative; height: 122px; overflow: hidden; background: var(--line); }
.card-cover { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
.card-visual::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 -22px 30px rgba(11,18,32,.28); pointer-events: none; }
.badge-status {
  position: absolute; right: 12px; top: 12px; color: #fff; font-size: 12px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px; box-shadow: 0 1px 4px rgba(0,0,0,.25); z-index: 2;
}
.badge-aud {
  display: inline-block; color: #fff; font-size: 11px; font-weight: 600;
  padding: 1px 8px; border-radius: 999px; margin-left: 6px; vertical-align: middle;
}
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1; }
.card-brand { font-size: 12px; color: var(--ink-soft); font-weight: 600; }
.card-name { font-size: 16px; margin: 3px 0 4px; font-weight: 800; }
.card-cat { display: inline-block; font-size: 12px; color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 6px; align-self: flex-start; margin-bottom: 8px; }
.card-func { font-size: 13px; color: var(--ink-soft); margin: 0 0 10px; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; gap: 12px; font-size: 13px; color: var(--ink); margin-bottom: 12px; flex-wrap: wrap; }
.card-actions { display: flex; gap: 8px; }
.btn-detail, .btn-compare {
  flex: 1; padding: 9px; border-radius: 9px; font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid var(--line);
}
.btn-detail { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-detail:hover { filter: brightness(1.05); }
.btn-compare { background: #fff; color: var(--ink); }
.btn-compare:hover { border-color: var(--accent); color: var(--accent); }
.btn-compare.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.empty { text-align: center; color: var(--ink-soft); padding: 60px 20px; font-size: 15px; }

/* ---------------- 详情弹窗 ---------------- */
.modal { position: fixed; inset: 0; z-index: 50; display: none; }
.modal.open { display: block; }
.modal-mask { position: absolute; inset: 0; background: rgba(15,22,35,.5); backdrop-filter: blur(2px); }
.modal-panel {
  position: absolute; right: 0; top: 0; height: 100%; width: min(480px, 92vw);
  background: var(--surface); box-shadow: -10px 0 40px rgba(0,0,0,.25); overflow-y: auto;
  padding: 26px 24px 30px; animation: slideIn .22s ease;
}
@keyframes slideIn { from { transform: translateX(30px); opacity: .4; } to { transform: translateX(0); opacity: 1; } }
.modal-close { position: absolute; right: 16px; top: 16px; border: 0; background: transparent; font-size: 26px; color: var(--ink-soft); cursor: pointer; line-height: 1; }
.detail-head { display: flex; gap: 14px; align-items: center; border-bottom: 3px solid; padding-bottom: 14px; margin-bottom: 14px; }
.detail-avatar { width: 48px; height: 48px; border-radius: 12px; color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 20px; }
.detail-brand { font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.detail-name { margin: 2px 0 8px; font-size: 19px; font-weight: 800; }
.detail-cover { margin: -26px -24px 18px; height: 150px; overflow: hidden; background: var(--line); }
.detail-cover img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
.detail-row { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.detail-k { width: 92px; flex: none; color: var(--ink-soft); }
.detail-v { flex: 1; }
.detail-section { margin-top: 14px; }
.detail-section h4 { margin: 0 0 6px; font-size: 14px; }
.detail-section ul { margin: 0; padding-left: 18px; font-size: 14px; color: var(--ink); }
.detail-section li { margin: 3px 0; }
.detail-note { margin-top: 14px; background: #fff7e6; border: 1px solid #ffe1a8; color: #8a5a00; font-size: 13px; padding: 10px 12px; border-radius: 10px; }
.detail-foot { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.btn-primary { background: var(--accent); color: #fff; border: 1px solid var(--accent); padding: 10px 16px; border-radius: 10px; font-weight: 700; cursor: pointer; text-decoration: none; display: inline-block; }
.btn-primary:hover { filter: brightness(1.05); }
.detail-source { margin-top: 14px; font-size: 12px; color: var(--ink-soft); word-break: break-all; }

/* ---------------- 专业规格速览 ---------------- */
.detail-spec { margin-top: 16px; background: #f7f9fc; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.detail-spec h4 { margin: 0 0 10px; font-size: 14px; }
.spec-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.spec-cell { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.spec-k { font-size: 12px; color: var(--ink-soft); margin-bottom: 6px; font-weight: 700; }
.spec-v { display: flex; flex-wrap: wrap; gap: 6px; }
.spec-tag { display: inline-block; font-size: 12px; line-height: 1.5; padding: 3px 9px; border-radius: 999px; background: #eef3fb; color: #2b4a7a; border: 1px solid #dbe6f5; }
.spec-tag.warn { background: #fdecec; color: #b3261e; border-color: #f6c9c6; }
.spec-tag.cert { background: #e8f6ee; color: #1f7a44; border-color: #bfe6cd; }
.spec-empty { font-size: 12px; color: var(--ink-soft); font-style: italic; }
.spec-foot { margin: 10px 0 0; font-size: 11.5px; color: var(--ink-soft); line-height: 1.6; }
@media (max-width: 560px) {
  .spec-grid { grid-template-columns: 1fr; }
}

/* ---------------- 对比视图 ---------------- */
.compare-view { display: none; }
.compare-view.open { display: block; }
.cmp-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.cmp-head h2 { margin: 0; font-size: 18px; }
.btn-back, .btn-clear, .btn-ghost { border: 1px solid var(--line); background: #fff; padding: 8px 14px; border-radius: 9px; cursor: pointer; font-size: 13px; font-weight: 600; }
.btn-back:hover, .btn-clear:hover { border-color: var(--accent); color: var(--accent); }
.cmp-scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.cmp-table { border-collapse: collapse; width: 100%; min-width: 520px; font-size: 14px; }
.cmp-table th, .cmp-table td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 12px 14px; text-align: left; vertical-align: top; }
.cmp-table thead th { background: #fafbfe; position: sticky; top: 0; }
.cmp-table .cmp-key { background: #fafbfe; font-weight: 700; color: var(--ink-soft); width: 110px; }
.cmp-brand { font-weight: 800; margin-bottom: 4px; }
.cmp-remove { font-size: 12px; color: #c0392b; background: transparent; border: 0; cursor: pointer; padding: 0; }
.cmp-remove:hover { text-decoration: underline; }
.cmp-table small { color: var(--ink-soft); }
.cmp-sep { background: #0f172a; color: #fff; font-size: 13px; font-weight: 700; padding: 8px 14px; text-align: center; letter-spacing: 1px; }

/* ---------------- 对比浮动栏 ---------------- */
.compare-bar {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(120%);
  bottom: 18px; z-index: 40; background: var(--ink); color: #fff;
  padding: 12px 18px; border-radius: 14px; display: flex; align-items: center; gap: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.3); transition: transform .25s ease; font-size: 14px;
  max-width: calc(100vw - 32px);
}
.compare-bar.open { transform: translateX(-50%) translateY(0); }
.compare-bar b { color: #6fd3ff; }
.compare-bar-actions { display: flex; gap: 8px; }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
.btn-ghost:hover { border-color: #fff; }
.compare-bar .btn-primary { background: #6fd3ff; color: #06243a; border-color: #6fd3ff; }

/* ---------------- 页脚 ---------------- */
.site-foot { max-width: var(--maxw); margin: 0 auto 40px; padding: 0 20px; }
.site-foot p { font-size: 12px; color: var(--ink-soft); border-top: 1px solid var(--line); padding-top: 14px; }
.site-foot code { background: #eef1f6; padding: 1px 5px; border-radius: 5px; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .btn-filter-toggle { display: inline-block; }
  .filters {
    position: fixed; top: 0; left: 0; height: 100%; width: 84vw; max-width: 320px;
    border-radius: 0; transform: translateX(-100%); transition: transform .25s ease; z-index: 45; overflow-y: auto;
  }
  body.filters-open .filters { transform: translateX(0); }
  body.filters-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 44; }
  .stats { width: 100%; justify-content: space-between; }
  .stat { flex: 1; }
  .modal-panel { width: 100vw; }
}
@media (max-width: 480px) {
  .topbar h1 { font-size: 18px; }
  .grid { grid-template-columns: 1fr; }
}

/* ---------------- 数据口径 / 置信度图例弹窗 ---------------- */
.btn-about {
  flex: 0 0 auto; border: 1px solid var(--line); background: var(--surface);
  padding: 10px 14px; border-radius: 10px; font-size: 13px; font-weight: 600;
  color: var(--ink-soft); cursor: pointer; box-shadow: var(--shadow); white-space: nowrap;
}
.btn-about:hover { border-color: var(--accent); color: var(--accent); }
.btn-domain {
  flex: 0 0 auto; border: 1px solid var(--line); background: var(--surface);
  padding: 10px 14px; border-radius: 10px; font-size: 13px; font-weight: 600;
  color: var(--ink-soft); cursor: pointer; box-shadow: var(--shadow); white-space: nowrap;
}
.btn-domain:hover { border-color: #1a7f37; color: #1a7f37; }
.btn-domain.is-on { border-color: #1a7f37; color: #1a7f37; background: #eaf6ee; }

#about-modal.modal-center.open {
  display: flex; align-items: flex-start; justify-content: center;
  padding: 5vh 16px; overflow-y: auto;
}
.about-panel {
  position: relative; z-index: 1; width: min(720px, 100%);
  max-height: 90vh; overflow-y: auto; background: var(--surface);
  border-radius: var(--radius); box-shadow: 0 18px 60px rgba(15,22,35,.28);
  padding: 26px 28px 28px; animation: popIn .2s ease;
}
@keyframes popIn { from { transform: scale(.97); opacity: .35; } to { transform: scale(1); opacity: 1; } }
.about-title { margin: 0 0 4px; font-size: 20px; font-weight: 800; }
.about-sub { margin: 0 0 18px; color: var(--accent); font-size: 13px; font-weight: 600; }
.about-sec { margin-bottom: 18px; }
.about-sec h3 { margin: 0 0 9px; font-size: 15px; border-left: 3px solid var(--accent); padding-left: 9px; }
.about-text { margin: 0; font-size: 13.5px; color: var(--ink-soft); line-height: 1.7; }
.about-list { margin: 0; padding-left: 18px; font-size: 13.5px; color: var(--ink); }
.about-list li { margin: 5px 0; line-height: 1.6; }
.about-list em { color: var(--ink-soft); font-style: normal; }
.about-list code, .about-text code { background: #eef1f6; padding: 1px 5px; border-radius: 5px; font-size: 12px; }
.legend { display: flex; flex-direction: column; gap: 9px; }
.legend-row { font-size: 13.5px; color: var(--ink); display: flex; align-items: flex-start; gap: 8px; }
.dot { flex: 0 0 auto; width: 12px; height: 12px; border-radius: 50%; margin-top: 5px; }
.dot-high { background: #1a7f37; }
.dot-mid { background: #b58100; }
.dot-low { background: #6e7781; }
.legend-row b { color: var(--ink); }
.about-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.as { background: #f7f9fc; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; text-align: center; }
.as b { display: block; font-size: 22px; color: var(--accent); line-height: 1.1; }
.as span { font-size: 12px; color: var(--ink-soft); }
.about-foot { margin: 8px 0 0; font-size: 12px; color: var(--ink-soft); border-top: 1px solid var(--line); padding-top: 12px; }

.filter-hint { margin: 8px 0 0; font-size: 11.5px; color: var(--ink-soft); line-height: 1.55; }


/* ---------------- 排序 / 收藏 ---------------- */
.sort-select {
  flex: 0 0 auto; border: 1px solid var(--line); background: var(--surface);
  padding: 10px 12px; border-radius: 10px; font-size: 13px; font-weight: 600;
  color: var(--ink); cursor: pointer; box-shadow: var(--shadow);
}
.btn-fav {
  flex: 0 0 auto; border: 1px solid var(--line); background: var(--surface);
  padding: 10px 14px; border-radius: 10px; font-size: 13px; font-weight: 600;
  color: var(--ink-soft); cursor: pointer; box-shadow: var(--shadow); white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-fav:hover { border-color: #e23b3b; color: #e23b3b; }
.btn-fav.is-on { border-color: #e23b3b; color: #e23b3b; background: #fff0f0; }
.btn-fav b { color: inherit; }

.fav-btn {
  position: absolute; left: 10px; top: 10px; z-index: 3;
  width: 30px; height: 30px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.86); color: #e23b3b; font-size: 16px; line-height: 1;
  cursor: pointer; box-shadow: 0 1px 5px rgba(0,0,0,.28);
  display: grid; place-items: center; transition: transform .12s;
}
.fav-btn:hover { background: #fff; transform: scale(1.08); }
.fav-btn.is-fav { background: #e23b3b; color: #fff; }

.fav-toggle {
  border: 1px solid var(--line); background: #fff; padding: 10px 16px; border-radius: 10px;
  font-weight: 700; cursor: pointer; font-size: 13px; color: var(--ink);
}
.fav-toggle.is-fav { border-color: #e23b3b; color: #e23b3b; background: #fff0f0; }

/* ---------------- 对比导出 ---------------- */
.cmp-export { display: flex; gap: 8px; }
.cmp-export .btn-ghost { background: var(--surface); box-shadow: var(--shadow); }

/* ---------------- 打印 / 另存 PDF ---------------- */
@media print {
  body { background: #fff; }
  .topbar, .toolbar, .filters, .compare-bar, .site-foot, .modal { display: none !important; }
  .layout { display: block; margin: 0; padding: 0; }
  #list-view { display: none !important; }
  #compare-view { display: block !important; }
  .cmp-scroll { overflow: visible; box-shadow: none; border: 0; }
  .cmp-table { width: 100%; font-size: 11px; }
  .cmp-table th, .cmp-table td { border: 1px solid #ccc; }
  .cmp-export, #cmp-back, #cmp-clear { display: none !important; }
}
