/* ===== 物料选型库样式 ===== */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --sidebar-bg: #1e293b;
  --sidebar-hover: #334155;
  --sidebar-active: #2563eb;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-light: #64748b;
  --text-lighter: #94a3b8;
  --green: #059669;
  --orange: #d97706;
  --red: #dc2626;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .08);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, .12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  font-family: "Segoe UI", "Microsoft YaHei", -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ===== 全局标题栏（页面顶部：标题居中，右侧品牌官网链接） ===== */
/* ===== 全局标题栏（页面顶部居中） ===== */
.app-header {
  text-align: center;
  padding: 14px 16px 12px;
  background: var(--sidebar-bg);
  border-bottom: 1px solid #334155;
  flex-shrink: 0;
}

.app-header h1 {
  font-size: 20px;
  font-weight: 600;
  color: #f1f5f9;
  letter-spacing: 1px;
}

.app-header span {
  font-size: 11px;
  color: #64748b;
  letter-spacing: 1px;
}

.app-body {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

/* ===== 侧边栏 ===== */
.sidebar {
  width: 232px;
  min-width: 232px;
  background: var(--sidebar-bg);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
}

.category-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px;
}

.category-nav::-webkit-scrollbar { width: 5px; }
.category-nav::-webkit-scrollbar-thumb { background: #475569; border-radius: 3px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: #cbd5e1;
  font-size: 14px;
  text-align: left;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s;
  margin-bottom: 2px;
}

.nav-item:hover { background: var(--sidebar-hover); }

.nav-item.active {
  background: var(--sidebar-active);
  color: #fff;
  font-weight: 500;
}

.nav-item .nav-icon { font-size: 17px; width: 22px; text-align: center; }
.nav-item .nav-name { flex: 1; }
.nav-item .nav-count {
  font-size: 11px;
  background: rgba(255, 255, 255, .15);
  padding: 1px 7px;
  border-radius: 10px;
}

.nav-item.active .nav-count { background: rgba(255, 255, 255, .25); }

.nav-group { margin-bottom: 6px; }

.nav-group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: #cbd5e1;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  text-align: left;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.nav-group-title:hover { background: var(--sidebar-hover); color: #cbd5e1; }

.nav-group-title .nav-icon { font-size: 17px; width: 22px; text-align: center; }

.nav-group-title .nav-gname { flex: 1; }

.nav-group-title .nav-count {
  font-size: 11px;
  background: rgba(255, 255, 255, .15);
  padding: 1px 7px;
  border-radius: 10px;
}

.nav-arrow {
  display: inline-block;
  font-size: 11px;
  color: #64748b;
  transition: transform .18s ease;
}

.nav-group.open .nav-arrow { transform: rotate(90deg); }

.nav-group-items { overflow: hidden; }

.nav-group:not(.open) .nav-group-items { display: none; }

.nav-item.nav-sub { padding-left: 24px; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid #334155;
}

.btn-reload {
  width: 100%;
  padding: 8px;
  background: transparent;
  border: 1px solid #475569;
  border-radius: 6px;
  color: #94a3b8;
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
}

.btn-reload:hover { border-color: #94a3b8; color: #e2e8f0; }

/* 侧边栏「报价核算」入口 */
.btn-quote-entry {
  width: 100%;
  padding: 8px;
  margin-bottom: 6px;
  background: rgba(245, 158, 11, .12);
  border: 1px solid #b45309;
  border-radius: 6px;
  color: #fbbf24;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.btn-quote-entry:hover { background: rgba(245, 158, 11, .22); border-color: #f59e0b; color: #fde68a; }
.btn-quote-entry.active { background: #f59e0b; border-color: #f59e0b; color: #1e293b; }

/* ===== 主区域 ===== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}

.topbar-left h2 { font-size: 18px; font-weight: 600; }
.category-desc { font-size: 12px; color: var(--text-light); }

.category-notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0 24px 12px;
  padding: 10px 14px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-left: 3px solid #f59e0b;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.6;
}
.category-notice .cn-title {
  flex: 0 0 auto;
  font-weight: 600;
  color: #f59e0b;
  white-space: nowrap;
}
.category-notice .cn-body {
  white-space: pre-line;
  color: var(--text-light);
}
.category-notice .cn-edit {
  margin-left: auto;
  flex: 0 0 auto;
  align-self: center;
  font-size: 12px;
}
.notice-textarea {
  flex: 1 1 100%;
  width: 100%;
  min-height: 130px;
  margin-top: 6px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.6;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.15);
  color: var(--text);
  resize: vertical;
}
.cn-editbar {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  flex: 1 1 100%;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  font-size: 13px;
  opacity: .55;
  pointer-events: none;
}

#globalSearch {
  width: 300px;
  padding: 8px 12px 8px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

#globalSearch:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
}

.btn:hover { border-color: var(--primary); color: var(--primary); }

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-primary:hover { background: var(--primary-dark); color: #fff; }

/* ===== 导出下拉菜单 ===== */
.export-menu { position: relative; }

.export-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 230px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .14);
  padding: 6px;
  z-index: 200;
}

.export-menu.open .export-dropdown { display: block; }

.export-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
  white-space: nowrap;
}

.export-item:hover { background: var(--bg); color: var(--primary); }

/* ===== 内容区 ===== */
.content {
  flex: 1;
  display: flex;
  overflow: hidden;
  padding: 16px 24px 24px;
  gap: 16px;
}

/* 筛选面板 */
.filter-panel {
  width: 250px;
  min-width: 250px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 12px;
  cursor: pointer;
}

.btn-link:hover { text-decoration: underline; }

.filter-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.filter-body::-webkit-scrollbar { width: 5px; }
.filter-body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

.filter-empty {
  padding: 30px 14px;
  text-align: center;
  color: var(--text-lighter);
  font-size: 12px;
}

/* 连接器分类专属：品牌官网入口（筛选面板底部） */
.brand-websites {
  border-top: 1px solid var(--border);
  padding: 10px 14px 14px;
  background: rgba(148, 163, 184, 0.05);
}
.brand-websites .bw-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-lighter);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}
.brand-websites .bw-link {
  display: block;
  font-size: 12px;
  color: #94a3b8;
  text-decoration: none;
  padding: 5px 10px;
  margin: 2px 0;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-websites .bw-link:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: rgba(56, 189, 248, 0.08);
}

.filter-group { margin-bottom: 4px; }

.filter-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  user-select: none;
  border-radius: 4px;
}

.filter-group-header:hover { background: #f8fafc; }
.filter-group-header .arrow { transition: transform .2s; font-size: 10px; }
.filter-group.collapsed .arrow { transform: rotate(-90deg); }

.filter-options {
  padding: 2px 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.filter-group.collapsed .filter-options { display: none; }

.filter-option {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  padding: 3px 4px;
  border-radius: 4px;
  word-break: break-all;
}

.filter-option:hover { background: #f1f5f9; }
.filter-option input { accent-color: var(--primary); cursor: pointer; }
.filter-option .opt-count { margin-left: auto; color: var(--text-lighter); font-size: 11px; }

/* 范围筛选 */
.range-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 8px;
}

.range-filter input {
  width: 100%;
  padding: 5px 7px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 12px;
  outline: none;
}

.range-filter input:focus { border-color: var(--primary); }
.range-filter .dash { color: var(--text-lighter); }

/* 单选下拉筛选（如连接器「品牌」「系列」） */
.dropdown-filter {
  padding: 4px 8px 8px;
}

.dropdown-filter select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 12px;
  color: var(--text);
  background: var(--card-bg);
  outline: none;
  cursor: pointer;
}

.dropdown-filter select:focus { border-color: var(--primary); }

.filter-group.collapsed .dropdown-filter { display: none; }

.active-filter-badge {
  display: inline-block;
  min-width: 6px;
  height: 6px;
  border-radius: 3px;
  background: var(--primary);
}

/* 表格区域 */
.table-area {
  flex: 1;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.table-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  font-size: 12px;
  color: var(--text-light);
  border-bottom: 1px solid var(--border);
}

.table-meta #resultCount { font-weight: 600; color: var(--text); }
.table-meta .hint { color: var(--text-lighter); }

/* ---------- 分页栏 ---------- */
.table-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: #fafbfc;
  font-size: 13px;
}
.table-pager .pg-info { color: var(--text-light); white-space: nowrap; }
.table-pager .pg-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.table-pager .pg-btn {
  min-width: 34px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border, #e2e8f0);
  background: #fff;
  color: var(--text, #1e293b);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.table-pager .pg-btn:hover:not([disabled]):not(.active) { background: #eef2ff; border-color: #c7d2fe; }
.table-pager .pg-btn.active { background: var(--primary, #2563eb); border-color: var(--primary, #2563eb); color: #fff; font-weight: 600; }
.table-pager .pg-btn[disabled] { opacity: .45; cursor: not-allowed; }

.table-wrapper {
  flex: 1;
  overflow: auto;
  position: relative;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-light);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  z-index: 2;
}

.data-table th:hover { background: #eef2f7; }
.data-table th .sort-ind { font-size: 10px; margin-left: 3px; color: var(--primary); }

.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid #f1f5f9;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table tbody tr { cursor: pointer; transition: background .1s; }
.data-table tbody tr:hover { background: #eff6ff; }
.data-table tbody tr:nth-child(even) { background: #fafbfc; }
.data-table tbody tr:nth-child(even):hover { background: #eff6ff; }

.data-table td.num { font-variant-numeric: tabular-nums; }
.data-table td .tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  background: var(--primary-light);
  color: var(--primary-dark);
}

.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-lighter);
}

.empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-sub { font-size: 12px; margin-top: 6px; }

/* ===== 详情面板 ===== */
.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .35);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}

.detail-panel {
  position: fixed;
  top: 0;
  right: -460px;
  width: 440px;
  height: 100vh;
  background: var(--card-bg);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: right .28s cubic-bezier(.4, 0, .2, 1);
}

.detail-panel.open { right: 0; }
.detail-overlay.open { opacity: 1; pointer-events: auto; }

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.detail-header h3 {
  font-size: 15px;
  font-weight: 600;
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.detail-header-actions .btn {
  font-size: 12px;
  padding: 4px 10px;
}

.btn-close {
  background: none;
  border: none;
  font-size: 16px;
  color: var(--text-light);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.btn-close:hover { background: #f1f5f9; color: var(--text); }

.detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.detail-body::-webkit-scrollbar { width: 5px; }
.detail-body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

.detail-group { margin-bottom: 18px; }

.detail-group-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--primary-light);
  margin-bottom: 8px;
  letter-spacing: .5px;
}

.detail-row {
  display: flex;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px dashed #f1f5f9;
  gap: 12px;
}

.detail-row .dk {
  width: 128px;
  min-width: 128px;
  color: var(--text-light);
}

.detail-row .dv {
  flex: 1;
  color: var(--text);
  word-break: break-all;
  white-space: pre-wrap;
}

/* 编辑模式下字段输入框 */
.detail-row .detail-edit-input {
  width: 100%;
  padding: 5px 8px;
  font-size: 13px;
  color: var(--text);
  background: var(--card-bg, #fff);
  border: 1px solid var(--border);
  border-radius: 5px;
  outline: none;
}

.detail-row .detail-edit-input:focus {
  border-color: var(--primary);
}

/* 详情面板内嵌 3D 预览（点击「预览」后展开，不弹窗） */
.detail-model-viewer {
  flex-shrink: 0;
  flex-direction: column;
  border-top: 1px solid var(--border);
  padding: 0 16px 12px;
}

.dmv-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0 8px;
}

.dmv-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dmv-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.dmv-canvas-wrap {
  width: 100%;
  height: 300px;
  background: #1e293b;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.dmv-canvas-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.dmv-status {
  font-size: 12px;
  color: #94a3b8;
  padding: 8px 0;
}

.dmv-status.hidden { display: none; }

.dmv-footer {
  font-size: 11px;
  color: #64748b;
  text-align: center;
  padding: 6px 0 0;
}

/* TDS 附件链接 */
.tds-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #1d65e6 !important;
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
  transition: background 0.15s;
}
.tds-link:hover { background: #e2e8f0; text-decoration: underline; }

/* 离线单文件版提示条（3D 预览需本机服务） */
.offline-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 7px 18px;
  background: #fef3c7;
  border-bottom: 1px solid #fcd34d;
  font-size: 13px;
  color: #78350f;
  white-space: nowrap;
}
.offline-bar a {
  color: #1d65e6 !important;
  font-weight: 600;
  text-decoration: none;
}
.offline-bar a:hover { text-decoration: underline; }
.offline-bar .offline-hint { color: #92620f; }

/* 分类级附件栏（UL 黄卡 / 规格表等参考资料） */
.cat-attachments {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 0;
  margin-top: 6px;
}
.cat-attachments .att-label {
  font-size: 13px;
  color: #64748b;
  margin-right: 10px;
  white-space: nowrap;
}

/* 图片类参考资料：缩略图直显 + 点击看原图 */
.cat-attachments .att-thumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 12px;
  padding: 2px 8px 2px 2px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f8fafc;
  text-decoration: none;
  transition: background 0.15s;
}
.cat-attachments .att-thumb:hover { background: #e2e8f0; }
.cat-attachments .att-thumb img {
  display: block;
  height: 34px;
  width: auto;
  max-width: 90px;
  object-fit: cover;
  border-radius: 4px;
}
.cat-attachments .att-cap {
  font-size: 13px;
  color: #1d65e6;
  white-space: nowrap;
}

/* UL 黄卡图片 */
.ul-card-img { padding: 4px 0; }
.ul-card-img img {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: zoom-in;
  transition: opacity .15s;
  display: block;
}
.ul-card-img img:hover { opacity: .88; }

/* ===== 物料差异比对 ===== */
/* 表格勾选列 */
.cmp-th { width: 36px; min-width: 36px; padding: 0 !important; }
.cmp-td {
  width: 36px;
  min-width: 36px;
  text-align: center;
  padding: 0 !important;
}
.cmp-check {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--primary);
  vertical-align: middle;
}
.cmp-check:hover { transform: scale(1.2); }

/* 底部比对栏 */
.compare-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(15, 23, 42, .2);
  padding: 10px 16px;
  z-index: 300;
  max-width: min(90vw, 900px);
}
.cmp-count {
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
  font-size: 13px;
}
.cmp-names {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  max-width: 460px;
}
.cmp-chip {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 比对弹窗 */
.cmp-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .5);
  backdrop-filter: blur(2px);
  z-index: 400;
  align-items: center;
  justify-content: center;
  padding: 30px;
}
.cmp-overlay.open { display: flex; }

.cmp-modal {
  background: var(--card-bg);
  border-radius: 14px;
  width: min(96vw, 1250px);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.cmp-header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.cmp-header h3 { font-size: 16px; color: var(--text); }
.cmp-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-light);
  cursor: pointer;
  user-select: none;
}
.cmp-toggle input { accent-color: var(--orange); cursor: pointer; }
.cmp-header .btn-close { margin-left: auto; }

.cmp-body { overflow: auto; padding: 0 0 16px; }

.cmp-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}
.cmp-table th, .cmp-table td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
  word-break: break-all;
}

/* 属性名列（左侧固定） */
.cmp-key, .cmp-key-th {
  position: sticky;
  left: 0;
  background: var(--card-bg);
  z-index: 2;
  font-weight: 600;
  color: var(--text-light);
  min-width: 150px;
  white-space: nowrap;
}
.cmp-key small { font-weight: 400; color: var(--text-lighter); margin-left: 3px; }
.cmp-key-th { background: #f8fafc; top: 0; z-index: 3; }

/* 物料名表头 */
.cmp-item-th {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  min-width: 180px;
  max-width: 260px;
  position: sticky;
  top: 0;
  z-index: 2;
  white-space: normal;
}

/* 分组行 */
.cmp-group-row td {
  background: #f8fafc;
  font-weight: 600;
  color: var(--primary-dark);
  font-size: 12px;
  padding: 6px 12px;
  letter-spacing: .5px;
}

/* 差异高亮 */
.cmp-table td.diff {
  background: #fef3c7;
  color: #92400e;
  font-weight: 600;
}
.cmp-table tr.has-diff .cmp-key { color: var(--orange); }
.diff-dot {
  color: var(--orange);
  font-size: 10px;
  margin-left: 5px;
}
.cmp-table td.same { color: var(--text); }
.cmp-none { color: var(--text-lighter); }

/* 比对表「结论」列：逐条属性判定哪个物料最优 */
.cmp-concl-th { background: #f8fafc; color: var(--text); min-width: 130px; }
.cmp-concl { font-size: 12px; white-space: nowrap; }
.cmp-concl-best { background: #f0fdf4; color: #15803d; font-weight: 600; }
.cmp-concl-tie  { background: #fff7ed; color: #c2410c; font-weight: 600; }
.cmp-concl-same { background: #f8fafc; color: var(--text-lighter); }
.cmp-concl-na   { background: #f8fafc; color: #cbd5e1; }

/* 黄卡图片比对 */
.cmp-img {
  width: 170px;
  max-height: 200px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: zoom-in;
  display: block;
}
.cmp-img:hover { opacity: .88; }

/* 响应式 */
@media (max-width: 1100px) {
  .filter-panel { width: 210px; min-width: 210px; }
  #globalSearch { width: 200px; }
}

@media (max-width: 900px) {
  .sidebar { width: 60px; min-width: 60px; }
  .nav-item .nav-name, .nav-item .nav-count, .sidebar-footer { display: none; }
  .nav-item { justify-content: center; }
  .nav-gname, .nav-group-title .nav-count { display: none; }
  .app-header h1 { font-size: 16px; }
  .app-header span { display: none; }
  .filter-panel { display: none; }
}

/* ===== 3D 数据模型卡片（详情面板内） ===== */
.model-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  margin: 3px 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f8fafc;
  max-width: 420px;
}
.model-card-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.model-card-name {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: visible;
}
.model-card-meta {
  font-size: 11px;
  color: var(--text-lighter);
  white-space: nowrap;
}
.model-card-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn-3d {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 10px;
  border: 1px solid var(--primary);
  border-radius: 5px;
  background: #fff;
  color: var(--primary);
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.btn-3d:hover { background: var(--primary); color: #fff; text-decoration: none; }
.btn-3d-dl { border-color: var(--border); color: var(--text-light); }
.btn-3d-dl:hover { background: #e2e8f0; color: var(--text); border-color: var(--border); }

/* ==========================================================================
   报价核算模块（D-R&D-A017 A0 物料报价核算表）
   ========================================================================== */
.quote-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px 32px;
  min-height: 0;
}
.quote-wrap { max-width: 1500px; }

/* 顶部：类型选择 + 操作按钮 */
.quote-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.quote-types { display: flex; flex-wrap: wrap; gap: 6px; }
.quote-type-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 13px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-light);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}
.quote-type-btn:hover { border-color: var(--primary); color: var(--primary); }
.quote-type-btn.active {
  background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600;
}
.quote-type-btn .qt-icon { font-size: 14px; }
.quote-actions { display: flex; gap: 8px; flex-shrink: 0; }
.quote-desc {
  font-size: 12px;
  color: var(--text-lighter);
  margin-bottom: 14px;
  padding-left: 2px;
}

/* 区块 */
.quote-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px 14px;
  margin-bottom: 12px;
}
.quote-section .qs-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.btn-mini {
  padding: 2px 9px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #f8fafc;
  color: var(--text-light);
  cursor: pointer;
  white-space: nowrap;
}
.btn-mini:hover { border-color: var(--primary); color: var(--primary); }

/* 基本信息 / 附加参数 网格 */
.quote-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px 12px;
}
.qi-item { display: flex; flex-direction: column; gap: 3px; }
.qi-label { font-size: 12px; color: var(--text-lighter); white-space: nowrap; }
.qi-input {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 13px;
  background: #fff;
  color: var(--text);
  width: 100%;
}
.qi-input:focus { outline: none; border-color: var(--primary); }

/* 明细表 */
.quote-table-wrap { overflow-x: auto; }
.quote-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}
.quote-table th {
  background: #f1f5f9;
  padding: 6px 8px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-light);
  border-bottom: 1px solid var(--border);
}
.quote-table td { padding: 3px 6px; border-bottom: 1px solid #f1f5f9; }
.quote-table tr:hover td { background: #f8fafc; }
.qc-input {
  width: 100%;
  min-width: 50px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 13px;
  background: transparent;
  color: var(--text);
}
.qc-input:hover { border-color: var(--border); }
.qc-input:focus { outline: none; border-color: var(--primary); background: #fff; }
.qc-calc {
  font-weight: 600;
  color: var(--primary);
  text-align: right;
  min-width: 90px;
  padding-right: 10px !important;
}
.qc-del { width: 32px; text-align: center; }
.btn-row-del {
  width: 20px; height: 20px;
  border: none; border-radius: 4px;
  background: transparent; color: #cbd5e1;
  cursor: pointer; font-size: 12px; line-height: 1;
}
.btn-row-del:hover { background: #fee2e2; color: #dc2626; }

/* 核算结果 */
.quote-summary { border-left: 3px solid var(--primary); }
.quote-sum-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 8px;
}
.qsum-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 11px;
  background: #f8fafc;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.qsum-item.hl {
  background: rgba(56, 189, 248, .1);
  border-color: var(--primary);
}
.qsum-label { font-size: 12px; color: var(--text-light); white-space: nowrap; }
.qsum-val { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; }
.qsum-item.hl .qsum-val { color: var(--primary); font-size: 15px; }

/* 已保存记录 */
.quote-records { display: flex; flex-direction: column; gap: 5px; }
.qrec-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 13px;
}
.qrec-name { font-weight: 600; color: var(--text); min-width: 140px; }
.qrec-meta { font-size: 12px; color: var(--text-lighter); flex: 1; }

/* ==========================================================================
   选型比对 PDF 报告（屏幕预览 + 打印 / 另存为 PDF）
   ========================================================================== */
.report-overlay {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(15, 23, 42, .55);
  display: none; align-items: flex-start; justify-content: center;
  overflow: auto; padding: 20px;
}
.report-overlay.open { display: flex; }
.report-wrap { width: 100%; max-width: 900px; display: flex; flex-direction: column; gap: 10px; }

/* 顶部工具条（仅屏幕可见，打印时隐藏） */
.report-toolbar {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; background: #fff;
  border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}
.rt-title { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; }
.rt-hint { font-size: 12px; color: var(--text-light); flex: 1; min-width: 180px; }
.rt-btn {
  padding: 6px 14px; border: 1px solid var(--border); border-radius: 6px;
  background: #fff; color: var(--text); font-size: 13px; white-space: nowrap;
  cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.rt-btn:hover { border-color: var(--primary); color: var(--primary); }
.rt-btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.rt-btn-primary:hover { background: var(--primary-dark); color: #fff; }

/* A4 纸张 */
.report-paper {
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  padding: 16mm 14mm; box-shadow: 0 2px 12px rgba(0, 0, 0, .12);
  font-size: 13px; color: #1e293b; line-height: 1.55;
}
.rp-head { border-bottom: 2px solid var(--primary); padding-bottom: 10px; margin-bottom: 16px; }
.rp-title { font-size: 20px; font-weight: 700; color: var(--primary-dark); margin: 0 0 5px; }
.rp-sub { font-size: 12px; color: #64748b; }

.rp-sec { margin-bottom: 16px; break-inside: avoid; }
/* 长表格章节允许跨页（整块 avoid 会被推到下一页并留下大片空白） */
.rp-sec-long { break-inside: auto; }
.rp-sec-title {
  font-size: 14px; font-weight: 600; color: var(--text);
  margin: 0 0 7px; padding-left: 8px; border-left: 3px solid var(--primary);
}
.rp-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.rp-chip {
  padding: 3px 11px; border: 1px solid var(--primary); border-radius: 14px;
  background: #eff6ff; color: var(--primary-dark);
  font-size: 13px; font-weight: 600; white-space: nowrap;
}
.rp-sum {
  display: flex; gap: 18px; flex-wrap: wrap;
  padding: 9px 12px; background: #f8fafc;
  border: 1px solid var(--border); border-radius: 6px;
}
.rp-sum-item { font-size: 13px; white-space: nowrap; }
.rp-sum-item b { color: var(--primary); font-size: 15px; }
.rp-diffs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.rp-diff-tag {
  font-size: 12px; padding: 2px 9px; background: #fff7ed;
  border: 1px solid #fed7aa; color: #c2410c;
  border-radius: 4px; white-space: nowrap;
}
.rp-diff-none { font-size: 13px; color: #16a34a; }

/* 比对表 */
.rp-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.rp-table th, .rp-table td {
  border: 1px solid #cbd5e1; padding: 5px 8px;
  text-align: left; vertical-align: top;
}
.rp-table thead th { background: #eff6ff; color: #1e40af; font-weight: 600; }
.rp-group-row td { background: #f1f5f9; font-weight: 600; color: #334155; }
.rp-key { background: #f8fafc; font-weight: 600; white-space: nowrap; }
.rp-cell-diff { background: #fff7ed; color: #9a3412; font-weight: 600; }
.rp-cell-same { color: #334155; }
.rp-none { color: #94a3b8; }
/* 报告「结论」列 */
.rp-concl { white-space: nowrap; }
.rp-concl-best { background: #f0fdf4; color: #15803d; font-weight: 600; }
.rp-concl-tie  { background: #fff7ed; color: #c2410c; font-weight: 600; }
.rp-concl-same { background: #f8fafc; color: #94a3b8; }
.rp-concl-na   { background: #f8fafc; color: #cbd5e1; }
/* 综合推荐（系统统计 + 人工可编辑结论） */
.rp-rec-block {
  margin-top: 8px; padding: 10px 12px;
  background: #f0fdf4; border: 1px solid #86efac; border-radius: 6px;
}
.rp-rec-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 7px; }
.rp-rec-label { font-size: 13px; font-weight: 600; color: #15803d; white-space: nowrap; }
.rp-pick {
  padding: 3px 8px; border: 1px solid #86efac; border-radius: 5px;
  background: #fff; color: #15803d; font-size: 13px; font-weight: 600;
  max-width: 320px; cursor: pointer;
}
/* 人工结论编辑区（contenteditable） */
.rp-note-edit {
  min-height: 42px; padding: 7px 9px;
  background: #fff; border: 1px dashed #86efac; border-radius: 5px;
  font-size: 13px; color: #14532d; line-height: 1.6; outline: none;
  word-break: break-word;
}
.rp-note-edit:focus { border-color: var(--primary); border-style: solid; background: #f8fafc; }
.rp-note-edit:empty::before { content: attr(data-placeholder); color: #94a3b8; }
.rp-note {
  margin-top: 7px; padding: 7px 10px;
  background: #f8fafc; border-left: 3px solid #cbd5e1;
  font-size: 11px; color: #64748b; line-height: 1.6;
}
.rp-img-row td { text-align: center; }
.rp-img { max-height: 150px; max-width: 100%; object-fit: contain; border: 1px solid var(--border); }

.rp-foot {
  margin-top: 16px; padding-top: 8px; border-top: 1px solid var(--border);
  font-size: 11px; color: #94a3b8;
  display: flex; justify-content: space-between; gap: 10px;
}

/* ---------- 打印：只输出报告纸张，其余界面全部隐藏 ---------- */
@media print {
  @page { size: A4 portrait; margin: 14mm 12mm 16mm; }
  html, body { margin: 0 !important; padding: 0 !important; background: #fff !important; }
  /* 隐藏除报告外的所有 body 直接子元素 */
  body > *:not(#reportOverlay) { display: none !important; }

  #reportOverlay { display: none !important; }
  #reportOverlay.open {
    display: block !important; position: static !important; inset: auto !important;
    background: #fff !important; padding: 0 !important; margin: 0 !important;
    overflow: visible !important;
  }
  .report-toolbar, .no-print { display: none !important; }
  .report-wrap { max-width: none !important; gap: 0 !important; box-shadow: none !important; }
  .report-paper {
    border: 0 !important; border-radius: 0 !important; box-shadow: none !important;
    padding: 0 !important; margin: 0 !important;
  }
  /* 表格跨页：表头每页重复、行不撕裂 */
  .rp-table { font-size: 11px; }
  .rp-table thead { display: table-header-group; }
  .rp-table tr { break-inside: avoid; }
  .rp-sec { break-inside: avoid; }
  /* 长表格章节跨页 */
  .rp-sec.rp-sec-long { break-inside: auto; }
  .rp-sec-title { break-after: avoid; }
  /* 人工结论：打印时去掉编辑框外观，呈现为正式结论文本 */
  .rp-note-edit {
    border: 0 !important; padding: 0 !important; background: transparent !important;
    color: #14532d; font-weight: 600;
  }
  .rp-pick {
    appearance: none; -webkit-appearance: none;
    border: 0 !important; background: transparent !important;
    padding: 0 !important; font-weight: 700; color: #15803d;
  }
  .rp-rec-block { background: #f0fdf4 !important; border: 1px solid #86efac !important; }
  /* 保留高亮底色（Chrome 默认不打印背景色） */
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
}
