/* ==========================================================================
   供给方「产品选型工作台」样式
   --------------------------------------------------------------------------
   设计目标：把 361 条产品从「卡片罗列」变成「可检索 / 可排序 / 可比选」的专业数据库视图。
   结构：左栏分类树 + 筛选面板 → 右栏数据表（表格视图）/ 卡片（浏览视图）→ 产品档案抽屉
   ========================================================================== */

/* ---------------- 工作台骨架 ---------------- */
.sel-bench {
  display: grid;
  grid-template-columns: 262px minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}
.sel-side {
  position: sticky;
  top: 96px;
  background: var(--surface, #fff);
  border: 1px solid var(--line, #DCE6E8);
  border-radius: 14px;
  padding: 18px 16px 20px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}
.sel-main { min-width: 0; }

/* ---------------- 左栏：分类树 ---------------- */
.sel-side-h {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted, #627781);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sel-side-h button {
  background: none;
  border: 0;
  color: var(--teal, #12A59C);
  font-size: 11.5px;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
}
.sel-tree { margin-bottom: 22px; }
.sel-tree-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--text, #1E323A);
  transition: background .15s, color .15s;
}
.sel-tree-item:hover { background: rgba(18,165,156,.07); }
.sel-tree-item.is-active {
  background: rgba(18,165,156,.13);
  color: var(--n900, #0B1F2E);
  font-weight: 600;
}
.sel-tree-item .cnt {
  font-size: 11.5px;
  color: var(--muted, #627781);
  font-variant-numeric: tabular-nums;
  flex: none;
}
.sel-tree-item.is-active .cnt { color: var(--teal, #12A59C); }
.sel-tree-sub { margin: 2px 0 6px 8px; padding-left: 10px; border-left: 1px solid var(--line2, #ECF1F2); }
.sel-tree-sub .sel-tree-item { font-size: 12.8px; padding: 5px 9px; }

/* ---------------- 左栏：筛选组 ---------------- */
.sel-fgroup { margin-bottom: 18px; }
.sel-fgroup-h {
  font-size: 12px;
  font-weight: 700;
  color: var(--n800, #123043);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line2, #ECF1F2);
}
.sel-fopt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  font-size: 12.8px;
  color: var(--text, #1E323A);
  cursor: pointer;
}
.sel-fopt:hover { color: var(--teal, #12A59C); }
.sel-fopt .cnt { font-size: 11.5px; color: var(--muted, #627781); font-variant-numeric: tabular-nums; }
.sel-fopt input { accent-color: var(--teal, #12A59C); margin: 0; }
.sel-fopt-label { display: flex; align-items: center; gap: 7px; min-width: 0; }
.sel-fopt-label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 滑块区间 */
.sel-range { padding: 4px 0 2px; }
.sel-range input[type=range] { width: 100%; accent-color: var(--teal, #12A59C); }
.sel-range-v {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--muted, #627781);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

/* ---------------- 右栏：工具条 ---------------- */
.sel-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line, #DCE6E8);
}
.sel-search {
  position: relative;
  flex: 1;
  min-width: 210px;
}
.sel-search input {
  width: 100%;
  height: 40px;
  border-radius: 9px;
  border: 1px solid var(--line, #DCE6E8);
  background: var(--surface, #fff);
  padding: 0 36px 0 36px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text, #1E323A);
}
.sel-search input:focus { outline: none; border-color: var(--teal, #12A59C); box-shadow: 0 0 0 3px rgba(18,165,156,.12); }
.sel-search .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted, #627781);
  font-size: 14px;
  pointer-events: none;
}
.sel-search .clr {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: none;
  color: var(--muted, #627781);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 4px;
  display: none;
}
.sel-search.has-value .clr { display: block; }

.sel-viewsw {
  display: inline-flex;
  border: 1px solid var(--line, #DCE6E8);
  border-radius: 9px;
  overflow: hidden;
  background: var(--surface, #fff);
  flex: none;
}
.sel-viewsw button {
  border: 0;
  background: none;
  padding: 9px 13px;
  font-size: 12.8px;
  color: var(--muted, #627781);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.sel-viewsw button.is-active { background: var(--n900, #0B1F2E); color: #fff; }
.sel-viewsw button:hover:not(.is-active) { background: rgba(11,31,46,.05); }

.sel-sort {
  height: 40px;
  border-radius: 9px;
  border: 1px solid var(--line, #DCE6E8);
  background: var(--surface, #fff);
  padding: 0 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text, #1E323A);
  flex: none;
  cursor: pointer;
}

/* 已选筛选条件 */
.sel-chips { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 14px; }
.sel-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(18,165,156,.1);
  border: 1px solid rgba(18,165,156,.25);
  color: #0f6e56;
  border-radius: 100px;
  padding: 4px 6px 4px 11px;
  font-size: 12px;
  font-weight: 500;
}
.sel-chip button {
  border: 0;
  background: none;
  cursor: pointer;
  color: inherit;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
  opacity: .7;
}
.sel-chip button:hover { opacity: 1; }
.sel-chip--reset { background: none; border-color: transparent; color: var(--muted, #627781); cursor: pointer; padding-left: 4px; }

/* 结果统计条 */
.sel-stat {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--muted, #627781);
}
.sel-stat b { font-size: 19px; color: var(--n900, #0B1F2E); font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------------- 数据表视图 ---------------- */
.sel-table-wrap {
  background: var(--surface, #fff);
  border: 1px solid var(--line, #DCE6E8);
  border-radius: 12px;
  overflow: auto;
}
.sel-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  min-width: 1080px;
}
.sel-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--n900, #0B1F2E);
  color: #D6E9ED;
  font-weight: 600;
  font-size: 12px;
  text-align: left;
  padding: 11px 12px;
  white-space: nowrap;
  border-right: 1px solid rgba(255,255,255,.07);
}
.sel-table thead th:last-child { border-right: 0; }
.sel-table th.sortable { cursor: pointer; user-select: none; }
.sel-table th.sortable:hover { color: #fff; }
.sel-table th .arrow { opacity: .35; margin-left: 3px; font-size: 10px; }
.sel-table th.is-sorted { color: var(--teal-b, #38C6BC); }
.sel-table th.is-sorted .arrow { opacity: 1; }

.sel-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line2, #ECF1F2);
  vertical-align: top;
  color: var(--text, #1E323A);
}
.sel-table tbody tr:nth-child(even) { background: rgba(18,165,156,.022); }
.sel-table tbody tr:hover { background: rgba(18,165,156,.07); }
.sel-table tbody tr.is-selected { background: rgba(18,165,156,.1); }

.sel-t-name { font-weight: 600; color: var(--n900, #0B1F2E); line-height: 1.45; max-width: 300px; }
.sel-t-name .sub { display: block; font-size: 11.5px; color: var(--muted, #627781); font-weight: 400; margin-top: 3px; }
.sel-t-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sel-t-muted { color: var(--muted, #627781); }

/* 表内小徽标 */
.sel-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
  border: 1px solid transparent;
}
.sel-badge--drug { background: #e8f4fb; color: #0d5f8a; border-color: #cfe6f3; }
.sel-badge--device { background: #eaf7f0; color: #0f6e56; border-color: #cfe9dc; }
.sel-badge--herbal { background: #f3f0e6; color: #6b5b1f; border-color: #e3dcc0; }
.sel-badge--cmo { background: #f3ecfa; color: #5b3a8c; border-color: #e2d5f2; }
.sel-badge--reg { background: #e6f7f5; color: #0f6e56; border-color: #c8ebe6; }
.sel-badge--free { background: #fdf3e2; color: #854f0b; border-color: #f2e0bd; }
.sel-badge--gray { background: #f1f4f5; color: #5a6d77; border-color: #e2e9ea; }

/* 表内操作 */
.sel-t-act { display: flex; gap: 6px; }
.sel-mini {
  border: 1px solid var(--line, #DCE6E8);
  background: var(--surface, #fff);
  color: var(--n800, #123043);
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: border-color .15s, color .15s, background .15s;
}
.sel-mini:hover { border-color: var(--teal, #12A59C); color: var(--teal, #12A59C); }
.sel-mini--primary { background: var(--teal, #12A59C); border-color: var(--teal, #12A59C); color: #fff; }
.sel-mini--primary:hover { background: #0E8F88; color: #fff; border-color: #0E8F88; }

/* ---------------- 卡片视图（浏览模式） ---------------- */
.sel-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.sel-card {
  background: var(--surface, #fff);
  border: 1px solid var(--line, #DCE6E8);
  border-radius: 12px;
  padding: 16px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  transition: border-color .18s, box-shadow .18s, transform .18s;
}
.sel-card:hover {
  border-color: rgba(18,165,156,.5);
  box-shadow: 0 10px 26px rgba(6,20,31,.09);
  transform: translateY(-2px);
}
.sel-card-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sel-card h4 { font-size: 15px; font-weight: 700; color: var(--n900, #0B1F2E); line-height: 1.45; }
.sel-card-specs { display: flex; flex-wrap: wrap; gap: 5px; }
.sel-card-kv {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 4px 8px;
  font-size: 12.5px;
  padding-top: 8px;
  border-top: 1px dashed var(--line2, #ECF1F2);
}
.sel-card-kv b { color: var(--muted, #627781); font-weight: 500; }
.sel-card-kv span { color: var(--text, #1E323A); }
.sel-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 10px; }
.sel-card-org { font-size: 12px; color: var(--muted, #627781); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- 产品档案抽屉 ---------------- */
.sel-drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
}
.sel-drawer.open { display: block; }
.sel-drawer-mask {
  position: absolute;
  inset: 0;
  background: rgba(6,20,31,.55);
  backdrop-filter: blur(2px);
  animation: selFade .22s ease;
}
.sel-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(620px, 94vw);
  background: var(--surface, #fff);
  box-shadow: -18px 0 50px rgba(6,20,31,.2);
  overflow-y: auto;
  animation: selSlide .26s cubic-bezier(.22,1,.36,1);
}
@keyframes selFade { from { opacity: 0 } to { opacity: 1 } }
@keyframes selSlide { from { transform: translateX(28px); opacity: .4 } to { transform: none; opacity: 1 } }

.sel-drawer-head {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--surface, #fff);
  border-bottom: 1px solid var(--line, #DCE6E8);
  padding: 20px 24px 16px;
}
.sel-drawer-head .row1 { display: flex; align-items: flex-start; gap: 12px; }
.sel-drawer-head h3 { font-size: 19px; font-weight: 800; color: var(--n900, #0B1F2E); line-height: 1.42; flex: 1; }
.sel-drawer-x {
  border: 0;
  background: #f1f4f5;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted, #627781);
  flex: none;
}
.sel-drawer-x:hover { background: #e4eaeb; color: var(--text, #1E323A); }
.sel-drawer-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.sel-drawer-body { padding: 20px 24px 32px; }

.sel-sec { margin-bottom: 22px; }
.sel-sec-h {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--teal, #12A59C);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line2, #ECF1F2);
}
.sel-spec-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sel-spec-table th {
  text-align: left;
  font-weight: 500;
  color: var(--muted, #627781);
  width: 116px;
  padding: 7px 10px 7px 0;
  vertical-align: top;
  white-space: nowrap;
}
.sel-spec-table td { padding: 7px 0; color: var(--text, #1E323A); }
.sel-spec-table tr + tr th, .sel-spec-table tr + tr td { border-top: 1px solid var(--line2, #ECF1F2); }
.sel-spec-table .na { color: var(--muted, #627781); font-style: italic; }

.sel-desc {
  font-size: 13.5px;
  line-height: 1.85;
  color: var(--text, #1E323A);
  background: #f7faf9;
  border-left: 3px solid rgba(18,165,156,.45);
  padding: 12px 14px;
  border-radius: 0 8px 8px 0;
}

.sel-drawer-foot {
  position: sticky;
  bottom: 0;
  background: var(--surface, #fff);
  border-top: 1px solid var(--line, #DCE6E8);
  padding: 13px 24px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.sel-drawer-foot .org { flex: 1; font-size: 12.5px; color: var(--muted, #627781); min-width: 0; }
.sel-drawer-foot .org b { display: block; color: var(--text, #1E323A); font-size: 13.5px; }

/* 询盘弹窗 */
.sel-inq-note {
  font-size: 12.5px;
  color: var(--muted, #627781);
  background: #f7faf9;
  border: 1px solid var(--line2, #ECF1F2);
  border-radius: 8px;
  padding: 9px 11px;
  margin-bottom: 14px;
  line-height: 1.7;
}

/* ---------------- 响应式 ---------------- */
@media (max-width:1180px) {
  .sel-bench { grid-template-columns: 1fr; }
  .sel-side { position: static; max-height: none; }
  .sel-side.collapsed .sel-tree, .sel-side.collapsed .sel-fgroup { display: none; }
  .sel-side-toggle { display: inline-flex !important; }
}
.sel-side-toggle {
  display: none;
  align-items: center;
  gap: 7px;
  width: 100%;
  border: 1px solid var(--line, #DCE6E8);
  background: var(--surface, #fff);
  border-radius: 9px;
  padding: 10px 13px;
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  color: var(--text, #1E323A);
  margin-bottom: 12px;
}
@media (max-width:760px) {
  .sel-cards { grid-template-columns: 1fr; }
  .sel-toolbar { gap: 9px; }
  .sel-drawer-body, .sel-drawer-head { padding-left: 16px; padding-right: 16px; }
  .sel-spec-table th { width: 92px; }
}
