/* ==================== 基础重置 ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: #f5f7fa;
  color: #333;
  line-height: 1.6;
  min-height: 100vh;
}

/* ==================== 布局 ==================== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* ==================== 头部 ==================== */
.header {
  text-align: center;
  margin-bottom: 30px;
  padding: 30px 0;
}

.header h1 {
  font-size: 28px;
  color: #1a1a2e;
  margin-bottom: 8px;
}

.subtitle {
  color: #666;
  font-size: 14px;
}

/* ==================== 卡片 ==================== */
.card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  transition: box-shadow 0.2s;
}

.card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

/* ==================== 表单 ==================== */
.form-row {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.form-group {
  flex: 1;
  min-width: 200px;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 14px;
  color: #444;
}

select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.2s;
}

select:focus {
  outline: none;
  border-color: #4A90D9;
  box-shadow: 0 0 0 3px rgba(74,144,217,0.1);
}

.radio-group {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 14px;
  padding: 8px 12px;
  border: 1px solid #eee;
  border-radius: 8px;
  transition: all 0.2s;
}

.radio-label:hover {
  border-color: #4A90D9;
  background: #f8fbff;
}

.radio-label input:checked + span {
  color: #4A90D9;
}

/* ==================== 上传区域 ==================== */
.upload-zone {
  border: 2px dashed #ddd;
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: #4A90D9;
  background: #f8fbff;
}

.upload-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.upload-text {
  font-size: 16px;
  color: #555;
  margin-bottom: 8px;
}

.upload-hint {
  font-size: 12px;
  color: #999;
  margin-bottom: 16px;
}

.file-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #f0f7ff;
  border-radius: 8px;
  border: 1px solid #d0e4ff;
}

.file-name {
  font-size: 14px;
  color: #2c5f8a;
  word-break: break-all;
}

/* ==================== 按钮 ==================== */
.btn {
  display: inline-block;
  padding: 10px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: #4A90D9;
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: #357ABD;
}

.btn-success {
  background: #4CAF50;
  color: #fff;
}

.btn-success:hover:not(:disabled) {
  background: #388E3C;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
  background: #eee;
  color: #666;
}

.btn-sm:hover {
  background: #ddd;
}

.btn-lg {
  width: 100%;
  padding: 14px;
  font-size: 16px;
}

/* ==================== 进度条 ==================== */
.progress-bar {
  height: 8px;
  background: #eee;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4A90D9, #67B8F8);
  border-radius: 4px;
  transition: width 0.3s ease;
  width: 0%;
}

.progress-text {
  text-align: center;
  color: #666;
  font-size: 14px;
}

/* ==================== 结果区域 ==================== */
.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.result-header h2 {
  font-size: 18px;
  color: #333;
}

/* ==================== 统计卡片 ==================== */
.stats {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.stat-card {
  padding: 12px 20px;
  border-radius: 8px;
  text-align: center;
  min-width: 100px;
  flex: 1;
}

.stat-card .stat-count {
  font-size: 24px;
  font-weight: 700;
  display: block;
}

.stat-card .stat-label {
  font-size: 12px;
  margin-top: 4px;
  display: block;
}

.stat-developable {
  background: #e8f5e9;
  color: #2e7d32;
}

.stat-dangerous {
  background: #ffebee;
  color: #c62828;
}

.stat-anti-dumping {
  background: #fff3e0;
  color: #e65100;
}

.stat-restricted {
  background: #fff8e1;
  color: #f57f17;
}

.stat-pending {
  background: #f5f5f5;
  color: #616161;
}

/* ==================== 额度预警 ==================== */
.quota-warning {
  background: #fff3e0;
  border: 1px solid #ffe0b2;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #e65100;
}

.quota-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  font-size: 12px;
  color: #888;
}

.quota-source {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quota-bar {
  width: 120px;
  height: 6px;
  background: #eee;
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}

.quota-fill {
  height: 100%;
  background: #4CAF50;
  border-radius: 3px;
  transition: width 0.5s;
}

.quota-fill.warning {
  background: #FF9800;
}

.quota-fill.danger {
  background: #f44336;
}

/* ==================== 结果表格 ==================== */
.table-wrapper {
  overflow-x: auto;
  max-height: 600px;
  overflow-y: auto;
  border: 1px solid #eee;
  border-radius: 8px;
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}

.result-table th {
  background: #f8f9fa;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 2px solid #eee;
}

.result-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #f0f0f0;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-table tr:hover {
  background: #f8fbff;
}

/* 判定颜色标签 */
.judgment-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.tag-developable {
  background: #e8f5e9;
  color: #2e7d32;
}

.tag-dangerous {
  background: #ffebee;
  color: #c62828;
}

.tag-anti-dumping {
  background: #fff3e0;
  color: #e65100;
}

.tag-restricted {
  background: #fff8e1;
  color: #f57f17;
}

.tag-pending {
  background: #f5f5f5;
  color: #616161;
}

/* ==================== 页脚 ==================== */
.footer {
  text-align: center;
  padding: 20px;
  color: #999;
  font-size: 12px;
}

/* ==================== 禁发库配置 ==================== */
.banned-config {
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 4px 12px;
}

.banned-config-summary {
  font-weight: 600;
  font-size: 14px;
  color: #444;
  cursor: pointer;
  padding: 8px 0;
  outline: none;
}

.banned-config-summary::-webkit-details-marker {
  color: #999;
}

.config-hint {
  font-weight: 400;
  font-size: 12px;
  color: #999;
  margin-left: 8px;
}

.config-body {
  padding: 12px 0;
  border-top: 1px solid #f0f0f0;
  margin-top: 8px;
}

.banned-file-row {
  display: flex;
  align-items: center;
  margin-top: 8px;
}

/* ==================== 结果布局 ==================== */
.result-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.filter-panel {
  flex: 0 0 200px;
  background: #fafafa;
  border-radius: 8px;
  padding: 16px;
  border: 1px solid #eee;
  position: sticky;
  top: 20px;
}

.filter-title {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eee;
}

.filter-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #555;
  transition: all 0.2s;
  margin-bottom: 2px;
}

.filter-item:hover {
  background: #f0f0f0;
}

.filter-item.active {
  background: #e3f2fd;
  color: #1565c0;
  font-weight: 600;
}

.filter-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-all { background: #666; }
.dot-developable { background: #4CAF50; }
.dot-dangerous { background: #f44336; }
.dot-anti-dumping { background: #FF9800; }
.dot-restricted { background: #FFD700; }
.dot-pending { background: #9E9E9E; }

.filter-count {
  margin-left: auto;
  background: #eee;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  color: #666;
}

.filter-item.active .filter-count {
  background: #bbdefb;
  color: #1565c0;
}

.table-container {
  flex: 1;
  min-width: 0;
}

/* ==================== 匹配来源标签 ==================== */
.match-source-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  color: #fff;
}

.tag-source-cn {
  background: #2196F3;  /* 蓝色 */
}

.tag-source-en {
  background: #9C27B0;  /* 紫色 */
}

.tag-source-both {
  background: #4CAF50;  /* 绿色 */
}

/* 匹配来源筛选点 */
.dot-source-cn { background: #2196F3; }
.dot-source-en { background: #9C27B0; }
.dot-source-both { background: #4CAF50; }

/* ==================== 原生语言优先匹配提示条 ==================== */
.native-match-banner {
  background: linear-gradient(135deg, #E8F5E9, #F3E5F5);
  border: 1px solid #C8E6C9;
  border-left: 4px solid #9C27B0;
  border-radius: 8px;
  padding: 12px 16px;
  margin: 12px 0;
  font-size: 14px;
  color: #555;
  display: flex;
  align-items: center;
  gap: 8px;
}

.native-match-banner strong {
  color: #9C27B0;
  font-weight: 600;
}

/* ==================== 导航标签 ==================== */
.tab-nav {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 6px 14px;
  border: 1.5px solid #e0e0e0;
  background: #fff;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  color: #666;
  line-height: 1.4;
}

.tab-btn:hover {
  border-color: #2196F3;
  color: #2196F3;
}

.tab-btn.active {
  border-color: #2196F3;
  background: #E3F2FD;
  color: #1565C0;
  font-weight: 600;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* 店铺管理板块 flex 布局（激活时） */
#tab-stores.active {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 48px);
}

/* ==================== 选品库 ==================== */
.product-lib-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}

.product-lib-header h2 {
  margin: 0;
  font-size: 20px;
}

.product-lib-subtitle {
  color: #888;
  font-size: 13px;
}

.product-lib-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.lib-search-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.lib-search-input {
  flex: 1;
  min-width: 200px;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
}

.lib-search-input:focus {
  outline: none;
  border-color: #2196F3;
}

.lib-filter-select {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
  cursor: pointer;
}

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

.lib-table th {
  background: #f5f7fa;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid #e0e0e0;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

/* 选品池固定表头 */
#poolTable thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

#poolTable thead th {
  position: relative;
  z-index: 11;
  background: #f5f7fa;
  top: 0;
}

/* 选品池排序静默刷新：保留内容，轻微淡化提示处理中 */
#poolSection .table-wrapper.pool-refreshing {
  opacity: 0.55;
  transition: opacity 0.15s ease;
}

/* 选品池操作列下拉菜单 */
.pool-action-trigger {
  font-size: 12px;
  padding: 4px 10px;
  background: #fff;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  color: #333;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}
.pool-action-trigger:hover {
  background: #f0f4ff;
  border-color: #1a56db;
  color: #1a56db;
}
.pool-action-caret {
  font-size: 10px;
  color: #888;
}
.pool-action-menu {
  position: fixed;
  z-index: 100000;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .16);
  min-width: 168px;
  max-width: 240px;
  padding: 6px;
  display: none;
  font-size: 13px;
}
.pool-action-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 6px;
  font-size: 13px;
  color: #333;
  white-space: nowrap;
}
.pool-action-item:hover {
  background: #f0f4ff;
  color: #1a56db;
}
.pool-action-item.pool-action-danger {
  color: #e74c3c;
}
.pool-action-item.pool-action-danger:hover {
  background: #fdf0ef;
  color: #c0392b;
}
.pool-action-item.pool-action-info {
  cursor: default;
  font-size: 12px;
}
.pool-action-item.pool-action-info:hover {
  background: none;
  color: inherit;
}

/* 选品池表头点击排序 */
#poolTable th.pool-sortable {
  cursor: pointer;
  user-select: none;
}
#poolTable th.pool-sortable:hover {
  background: #e8f0fe;
}
#poolTable th.pool-sorted {
  color: #2196F3;
  font-weight: 700;
}
#poolTable th.pool-sorted::after {
  content: none;
}

/* 选品池 ASIN 可点击跳转亚马逊 */
#poolTable td.asin-cell a.pool-asin-link {
  color: #1a73e8;
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px dashed rgba(26, 115, 232, 0.6);
  cursor: pointer;
}
#poolTable td.asin-cell a.pool-asin-link:hover {
  color: #d93025;
  border-bottom-color: #d93025;
  text-decoration: underline;
}

.table-wrapper {
  position: relative;
}

/* 选品池搜索栏紧凑布局 */
.lib-search-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 6px;
  padding: 6px 8px;
  background: #f8f9fa;
  border-radius: 6px;
  border: 1px solid #eee;
}

.lib-search-bar .lib-search-input.pool-filter-compact {
  max-width: 90px;
  padding: 3px 6px !important;
  height: 24px !important;
  font-size: 11px !important;
}

.lib-search-bar select.pool-filter-compact {
  min-width: 65px;
  padding: 3px 4px !important;
  height: 24px !important;
  font-size: 11px !important;
}

.lib-search-bar input[type="date"].pool-filter-compact {
  width: 90px;
  padding: 3px 4px !important;
  height: 24px !important;
  font-size: 11px !important;
}

.lib-search-bar .btn {
  padding: 3px 8px !important;
  font-size: 11px !important;
  height: 24px !important;
  line-height: 1 !important;
}

/* 批量操作栏 */
.batch-action-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #e8f5e9;
  border-radius: 6px;
  margin-bottom: 8px;
  border: 1px solid #c8e6c9;
}

.batch-action-bar .batch-count {
  font-size: 12px;
  font-weight: 600;
  color: #2e7d32;
}

.lib-table th:hover {
  background: #eef1f5;
}

.lib-table th::after {
  content: ' ↕';
  font-size: 11px;
  color: #aaa;
}

/* 列宽拖拽手柄 - 始终可见的竖线 */
.lib-table .resize-handle {
  border-right: 2px solid #d9d9d9;
}
.lib-table .resize-handle:hover {
  border-right: 2px solid #4a90d9;
  background: rgba(74,144,217,0.08);
}

/* 列拖拽排序 */
.lib-table th[draggable="true"] {
  cursor: grab;
}
.lib-table th[draggable="true"]:active {
  cursor: grabbing;
}
.lib-table th.drag-over {
  border-left: 3px solid #4a90d9 !important;
  background: #e8f0fe !important;
}

/* 紧凑筛选控件 */
.pool-filter-compact {
  padding: 3px 6px !important;
  font-size: 11px !important;
  border: 1px solid #ddd !important;
  border-radius: 3px !important;
  height: 24px !important;
  line-height: 1.2 !important;
  background: #fff;
}

.lib-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #f0f0f0;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lib-table tr:hover td {
  background: #f8f9ff;
}

.lib-table .lib-title-cell {
  max-width: 350px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.loading-cell {
  text-align: center;
  color: #999;
  padding: 40px !important;
}

.lib-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #f0f0f0;
}

.lib-pagination span {
  font-size: 12px;
  color: #888;
}

.pool-filter-compact {
  padding: 5px 8px !important;
  font-size: 12px !important;
  border: 1px solid #ddd !important;
  border-radius: 4px !important;
  height: 30px !important;
  line-height: 1.2 !important;
}

.lib-table th.drag-over {
  border-left: 3px solid #4a90d9 !important;
  background: #e8f0fe !important;
}

.lib-judgment-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  color: #fff;
}

/* ==================== 1688 货源卡片 ==================== */

.sourcing-card {
  transition: box-shadow 0.2s;
}
.sourcing-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.sourcing-card-collapsed {
  opacity: 0.7;
}
.sourcing-card-collapsed:hover {
  opacity: 1;
}

.sku-table th {
  background: #f0f2f5;
  font-weight: 600;
  font-size: 11px;
}
.sku-table td {
  font-size: 11px;
}

/* 详情信息表 */
.detail-info-table td {
  vertical-align: middle;
}

/* ==================== 货源详情表格 ==================== */

.sourcing-detail-table th {
  background: #f5f7fa;
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
}
.sourcing-detail-table td {
  font-size: 12px;
}
.sourcing-detail-table tbody tr:hover td {
  background: #f0f4ff !important;
}

/* ==================== 响应式 ==================== */
@media (max-width: 900px) {
  .result-layout {
    flex-direction: column;
  }
  .filter-panel {
    flex: none;
    width: 100%;
    position: static;
  }
  .filter-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }
  .filter-item {
    flex: 1;
    min-width: 120px;
  }
}
  .container {
    padding: 12px;
  }

/* ==================== 统一筛选栏 ==================== */

.filter-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 0;
}

.page-section-title {
  font-size: 15px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.filter-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
  background: #f7f8fa;
  border: 1px solid #e5e6eb;
  border-radius: 6px;
  padding: 6px 10px;
}

.filter-controls input,
.filter-controls select {
  height: 32px;
  padding: 4px 10px;
  font-size: 13px;
  border: 1px solid #d0d5dd;
  border-radius: 4px;
  background: #fff;
  min-width: 110px;
  width: auto;
}

.filter-controls input:focus,
.filter-controls select:focus {
  outline: none;
  border-color: #4A90D9;
  box-shadow: 0 0 0 2px rgba(74,144,217,0.12);
}

.filter-controls .btn {
  height: 32px;
  padding: 4px 14px;
  font-size: 13px;
  border-radius: 4px;
  white-space: nowrap;
}

.filter-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

.filter-actions .btn {
  height: 32px;
  padding: 4px 12px;
  font-size: 12px;
  border-radius: 4px;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .filter-toolbar {
    gap: 8px;
  }
  .filter-controls {
    flex: 1 1 100%;
  }
  .filter-actions {
    margin-left: 0;
  }
}

  .card {
    padding: 16px;
  }

  .form-row {
    flex-direction: column;
  }

  .radio-group {
    flex-direction: column;
  }

  .stats {
    flex-direction: column;
  }

  .stat-card {
    min-width: auto;
  }
}

/* ==================== 加载动效 ==================== */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.loading {
  animation: pulse 1.5s ease-in-out infinite;
}

/* ==================== 错误提示 ==================== */
.error-message {
  background: #ffebee;
  border: 1px solid #ffcdd2;
  border-radius: 8px;
  padding: 16px;
  color: #c62828;
  font-size: 14px;
  margin-bottom: 16px;
  white-space: pre-line;
}

/* ==================== 选品库增强样式 ==================== */

/* 选品库表格容器（水平滚动） */
.lib-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.lib-table-wrapper .lib-table {
  min-width: 1800px; /* 确保所有列在一行 */
}

/* 主图缩略图 */
.lib-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #eee;
  display: block;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.lib-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  z-index: 1;
  position: relative;
}

/* 列宽度 */
.lib-table .th-img {
  width: 90px;
  min-width: 90px;
}

/* ====== 图片大图预览弹窗 ====== */
.img-modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  cursor: zoom-out;
}

.img-modal-overlay.active {
  display: flex;
}

.img-modal-close {
  position: absolute;
  top: 16px;
  right: 24px;
  width: 40px;
  height: 40px;
  font-size: 28px;
  line-height: 40px;
  text-align: center;
  color: #fff;
  background: rgba(255,255,255,0.15);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  transition: background 0.2s;
}

.img-modal-close:hover {
  background: rgba(255,255,255,0.3);
}

.img-modal-container {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  cursor: grab;
}

.img-modal-container.grabbing {
  cursor: grabbing;
}

.img-modal-container img {
  display: block;
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  transition: transform 0.05s ease;
}

.img-modal-toolbar {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  background: rgba(0,0,0,0.6);
  border-radius: 8px;
  padding: 6px 12px;
  z-index: 10;
}

.img-modal-toolbar button {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  font-size: 18px;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
  line-height: 36px;
  text-align: center;
  padding: 0;
}

.img-modal-toolbar button:hover {
  background: rgba(255,255,255,0.3);
}

.img-modal-toolbar .zoom-label {
  color: #ccc;
  font-size: 13px;
  line-height: 36px;
  min-width: 48px;
  text-align: center;
}

.img-modal-loading {
  color: #fff;
  font-size: 16px;
  text-align: center;
  padding: 40px;
}

/* 弹窗内按钮 — 「使用原图去1688搜同款」 */
.img-modal-sourcing {
  background: #ff6a00;
  border: none;
  color: #fff;
  font-size: 14px;
  padding: 8px 20px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.img-modal-sourcing:hover {
  background: #e55d00;
}

/* ASIN 链接 */
.lib-table td a {
  color: #1565c0;
  text-decoration: none;
  font-weight: 500;
}

.lib-table td a:hover {
  text-decoration: underline;
  color: #0d47a1;
}

/* 数字列右对齐 */
.lib-cell-num {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

/* 缺数据标红 */
.lib-cell-missing {
  color: #d32f2f !important;
  background: #ffebee !important;
  font-weight: 600;
  cursor: help;
}

/* 文本溢出省略 */
.lib-cell-ellipsis {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 操作按钮容器 */
.lib-actions {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
}

.lib-actions-cell {
  min-width: 200px;
}

/* 操作按钮通用样式 */
.btn-action {
  padding: 4px 10px;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  font-weight: 500;
}

.btn-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-action-claim {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
}

.btn-action-claim:hover:not(:disabled) {
  background: #c8e6c9;
}

.btn-action-hold {
  background: #fff3e0;
  color: #e65100;
  border: 1px solid #ffcc80;
}

.btn-action-hold:hover:not(:disabled) {
  background: #ffe0b2;
}

.btn-action-abandon {
  background: #ffebee;
  color: #c62828;
  border: 1px solid #ef9a9a;
}

.btn-action-abandon:hover:not(:disabled) {
  background: #ffcdd2;
}

.btn-action-release {
  background: #f5f5f5;
  color: #757575;
  border: 1px solid #bdbdbd;
}

.btn-action-release:hover:not(:disabled) {
  background: #eeeeee;
}

/* 已认领状态 */
.lib-dev-confirmed {
  color: #e65100;
  font-weight: 500;
  font-size: 12px;
}

.lib-status-confirmed {
  color: #2e7d32;
  font-weight: 500;
  font-size: 12px;
}

/* 统计卡片 - 选品库 */
.product-lib-stats .stat-card {
  flex: 0 0 auto;
  min-width: 100px;
}

/* 响应式 - 选品库搜索栏 */
@media (max-width: 900px) {
  .lib-search-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .lib-search-input {
    min-width: auto;
  }

  .lib-filter-select {
    width: 100%;
  }
}

/* ==================== 模态框通用 ==================== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.25);
  padding: 28px 32px;
  width: 90%;
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-content {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  max-width: 800px;
  width: 90%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #eee;
}

.modal-header h3 {
  margin: 0;
  font-size: 16px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  color: #999;
}

.modal-close:hover {
  background: #f5f5f5;
  color: #333;
}

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

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid #eee;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ==================== 1688 搜索弹窗 ==================== */
.modal-1688 { max-width: 700px; }

.modal-product-info {
  font-size: 12px;
  color: #888;
  margin-bottom: 12px;
  line-height: 1.5;
}

.modal-1688-status {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 12px;
}

.modal-1688-status.searching {
  background: #e3f2fd;
  color: #1565c0;
}

.modal-1688-status.success {
  background: #e8f5e9;
  color: #2e7d32;
}

.modal-1688-status.no-results {
  background: #fff3e0;
  color: #e65100;
}

.modal-1688-status.error {
  background: #ffebee;
  color: #c62828;
}

.modal-1688-error {
  background: #ffebee;
  color: #c62828;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 12px;
}

.modal-1688-results {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.source-card {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 12px;
  transition: box-shadow 0.2s;
}

.source-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.source-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.source-match-score {
  background: #e3f2fd;
  color: #1565c0;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.source-price {
  font-size: 16px;
  font-weight: 700;
  color: #d32f2f;
}

.source-card-body {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
}

.source-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #eee;
  flex-shrink: 0;
}

.source-info {
  flex: 1;
  min-width: 0;
}

.source-title {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.source-shop {
  font-size: 12px;
  color: #888;
}

.source-link {
  font-size: 12px;
  color: #1976d2;
  text-decoration: none;
}

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

.source-card-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

/* ==================== 操作按钮样式 ==================== */
.btn-action-1688 {
  background: #e3f2fd;
  color: #1565c0;
  border: 1px solid #bbdefb;
}

.btn-action-1688:hover {
  background: #bbdefb;
}

.btn-action-profit {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #c8e6c9;
}

.btn-action-profit:hover {
  background: #c8e6c9;
}

.btn-action-disabled {
  background: #f5f5f5;
  color: #bdbdbd;
  border: 1px solid #e0e0e0;
  cursor: not-allowed;
  font-size: 11px;
}

.btn-action-delete {
  background: #fce4ec;
  color: #c62828;
  border: 1px solid #f8bbd0;
}

.btn-action-delete:hover {
  background: #f8bbd0;
}

/* ==================== 利润核算弹窗 ==================== */
.modal-profit { max-width: 850px; }

.profit-product-info {
  font-size: 13px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profit-product-meta {
  font-size: 12px;
  color: #888;
}

.profit-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.profit-tab {
  padding: 6px 12px;
  font-size: 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fafafa;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.profit-tab.active {
  background: #1976d2;
  color: #fff;
  border-color: #1976d2;
}

.profit-tab:hover:not(.active) {
  background: #f0f0f0;
}

.profit-source-info {
  font-size: 12px;
  color: #666;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profit-form-body {
  min-height: 200px;
}

.profit-section {
  margin-bottom: 16px;
  padding: 12px;
  background: #fafafa;
  border-radius: 8px;
}

.profit-section h4 {
  margin: 0 0 10px 0;
  font-size: 13px;
  color: #555;
}

.profit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.profit-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profit-field label {
  font-size: 11px;
  color: #888;
  font-weight: 500;
}

.profit-field .profit-val {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  padding: 6px 0;
}

.profit-field.editable input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
  box-sizing: border-box;
}

.profit-field.editable input:focus {
  border-color: #1976d2;
  outline: none;
  box-shadow: 0 0 0 2px rgba(25,118,210,0.1);
}

.profit-unit {
  font-size: 11px;
  color: #999;
  margin-top: 2px;
}

.profit-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  margin-top: 2px;
}

.profit-badge.auto {
  background: #e3f2fd;
  color: #1565c0;
}

.profit-badge.manual {
  background: #fff3e0;
  color: #e65100;
}

.profit-result {
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
}

.profit-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.result-item {
  text-align: center;
  padding: 8px;
  background: #fff;
  border-radius: 6px;
}

.result-label {
  display: block;
  font-size: 11px;
  color: #888;
  margin-bottom: 4px;
}

.result-value {
  display: block;
  font-size: 16px;
  font-weight: 700;
}

.result-value.positive {
  color: #2e7d32;
}

.result-value.neutral {
  color: #1976d2;
}

.result-value.negative {
  color: #c62828;
}

.profit-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.loading-spinner {
  text-align: center;
  padding: 40px;
  color: #999;
  font-size: 14px;
}

.error-msg {
  color: #c62828;
  padding: 20px;
  text-align: center;
}

/* ==================== 利润核算对比表格 ==================== */
.profit-basics {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.profit-basics-header {
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin-bottom: 8px;
}

.profit-basics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.pb-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pb-field label {
  font-size: 11px;
  color: #888;
}

.pb-input {
  padding: 5px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
  width: 100%;
  box-sizing: border-box;
}

.pb-input:focus {
  border-color: #1976d2;
  outline: none;
  box-shadow: 0 0 0 2px rgba(25,118,210,0.1);
}

.pb-static {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  padding: 5px 0;
}

.profit-compare-section {
  margin-bottom: 12px;
}

.profit-compare-header {
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin-bottom: 8px;
}

.profit-compare-table-wrap {
  overflow-x: auto;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
}

.profit-compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.profit-compare-table th {
  background: #f5f5f5;
  padding: 8px 10px;
  text-align: center;
  font-weight: 600;
  border-bottom: 2px solid #e0e0e0;
  white-space: nowrap;
  min-width: 100px;
}

.profit-compare-table th:first-child {
  text-align: left;
  min-width: 80px;
  position: sticky;
  left: 0;
  background: #f5f5f5;
  z-index: 1;
}

.profit-compare-table td {
  padding: 6px 10px;
  text-align: center;
  border-bottom: 1px solid #f0f0f0;
}

.profit-compare-table td:first-child {
  text-align: left;
  font-weight: 500;
  color: #555;
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 1;
}

.profit-compare-table tr:hover td {
  background: #f8f9fa;
}

.profit-compare-table tr:hover td:first-child {
  background: #f0f4f8;
}

.pc-radio-col {
  min-width: 70px;
  text-align: center !important;
  position: sticky;
  left: 0;
  background: #f5f5f5;
  z-index: 1;
}

.pc-radio {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #1976d2;
  vertical-align: middle;
}

.pc-primary-badge {
  display: inline-block;
  background: #1976d2;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
  vertical-align: middle;
}

.pc-backup-badge {
  display: inline-block;
  background: #e0e0e0;
  color: #666;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
  vertical-align: middle;
}

.pc-title-cell {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left !important;
}

.pc-url-hint {
  display: block;
  font-size: 9px;
  color: #aaa;
  word-break: break-all;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 备用供应商列表 */
.np-backup-cell {
  min-width: 180px;
  padding: 4px 8px !important;
}

.np-backup-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 0;
  font-size: 11px;
  border-bottom: 1px solid #f0f0f0;
}

.np-backup-item:last-child {
  border-bottom: none;
}

.np-backup-idx {
  display: inline-block;
  background: #e0e0e0;
  color: #666;
  font-size: 9px;
  font-weight: 600;
  padding: 0 4px;
  border-radius: 2px;
  flex-shrink: 0;
}

.np-backup-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #555;
}

.np-backup-price {
  font-weight: 600;
  color: #d32f2f;
  flex-shrink: 0;
  font-size: 11px;
}

.np-no-backup {
  color: #ccc;
  font-size: 11px;
}

.pc-row-label {
  font-weight: 500;
  color: #555;
}

.pc-bold {
  font-weight: 700;
  color: #333;
}

.pc-input {
  width: 80px;
  padding: 3px 6px;
  border: 1px solid #ddd;
  border-radius: 3px;
  font-size: 12px;
  text-align: right;
}

.pc-input:focus {
  border-color: #1976d2;
  outline: none;
}

.pc-unit {
  font-size: 11px;
  color: #999;
  margin-left: 2px;
}

.positive { color: #2e7d32; }
.neutral { color: #1976d2; }
.negative { color: #c62828; }

/* 缩略图 fallback */
.source-thumb-wrap {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
  border-radius: 6px;
  overflow: hidden;
}

.source-thumb-fallback {
  font-size: 28px;
  line-height: 1;
}

.source-url-hint {
  display: block;
  font-size: 10px;
  color: #aaa;
  word-break: break-all;
  margin-top: 2px;
}

/* ==================== 多选与批量操作 ==================== */
.th-checkbox {
  width: 36px;
  min-width: 36px;
  text-align: center;
  padding: 4px !important;
}

.th-checkbox input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: #1976d2;
}

.btn-danger {
  background: #d32f2f;
  color: #fff;
  border: 1px solid #b71c1c;
}

.btn-danger:hover {
  background: #b71c1c;
}

/* ==================== 响应式 - 弹窗 ==================== */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    max-height: 90vh;
  }

  .profit-grid {
    grid-template-columns: 1fr 1fr;
  }

  .profit-result-grid {
    grid-template-columns: 1fr 1fr;
  }

  .source-card-body {
    flex-direction: column;
    align-items: center;
  }

  .source-thumb {
    width: 120px;
    height: 120px;
  }
}

/* ==================== ����������� ==================== */
.params-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 8px;
}
.params-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.params-item label {
  font-size: 12px;
  color: #888;
}
.param-input {
  padding: 6px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
  width: 100%;
}
.param-input:focus {
  border-color: #4a90d9;
  outline: none;
  box-shadow: 0 0 0 2px rgba(74,144,217,0.2);
}

/* ������ť */
#btnParamsPanel, #btnAdminLogout {
  background: #f0ad4e;
  color: #fff;
  border: none;
}
#btnAdminLogin {
  background: #5bc0de;
  color: #fff;
  border: none;
}

/* ==================== �������� Tab �������� ==================== */
.params-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.params-sections {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.params-section {
  background: #fafbfc;
  border: 1px solid #e8ecf1;
  border-radius: 10px;
  padding: 20px 24px;
}
.params-section-title {
  font-size: 15px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid #4a90d9;
}
.params-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.params-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.params-item label {
  font-size: 13px;
  color: #555;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}
.param-hint-icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #d0d7de;
  color: #fff;
  font-size: 10px;
  align-items: center;
  justify-content: center;
  cursor: help;
  font-weight: 700;
}
.param-input {
  padding: 8px 12px;
  border: 1.5px solid #dde;
  border-radius: 6px;
  font-size: 14px;
  width: 100%;
  transition: border-color .2s, box-shadow .2s;
}
.param-input:focus {
  border-color: #4a90d9;
  outline: none;
  box-shadow: 0 0 0 3px rgba(74,144,217,0.12);
}

/* Σ�հ�ť�����ʽ */
.btn-danger-outline {
  background: transparent;
  color: #e74c3c;
  border: 1px solid #e74c3c;
}
.btn-danger-outline:hover {
  background: #e74c3c;
  color: #fff;
}

/* ����Ա Tab ��ť */
.tab-btn.admin-only {
  background: #f0ad4e;
  color: #fff;
}
.tab-btn.admin-only.active {
  background: #e09d3e;
  box-shadow: 0 2px 8px rgba(240,173,78,0.3);
}

/* ��Ϊ���ֶε�ռλ��ʾ */
.param-input::placeholder {
  color: #bbb;
  font-style: italic;
  font-size: 12px;
}

/* ==================== ͳ�ƿ�Ƭ v2 ==================== */
.stat-card-v2 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 20px;
  border-radius: 10px;
  min-width: 120px;
  gap: 4px;
  transition: transform .15s;
}
.stat-card-v2:hover { transform: translateY(-2px); }
.stat-card-v2 .stat-label-v2 {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,.9);
  letter-spacing: 1px;
}
.stat-card-v2 .stat-count-v2 {
  font-size: 36px;
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
}
.stat-card-v2 .stat-sub-v2 {
  font-size: 12px;
  color: rgba(255,255,255,.7);
}
.stat-blue  { background: linear-gradient(135deg, #4a90d9, #357abd); }
.stat-green { background: linear-gradient(135deg, #27ae60, #1e8449); }
.stat-red   { background: linear-gradient(135deg, #e74c3c, #c0392b); }
.stat-orange{ background: linear-gradient(135deg, #f39c12, #d68910); }
.stat-purple{ background: linear-gradient(135deg, #9b59b6, #7d3c98); }
.stat-empty { background: #f5f5f5; color: #999; font-size: 14px; }

.product-lib-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ÿҳ����ѡ���� */
.page-size-select {
  padding: 4px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 12px;
  background: #fff;
  cursor: pointer;
}

/* ==================== ��Ʒ���й���̨ ==================== */

.research-workbench {
  display: flex;
  gap: 16px;
  height: calc(100vh - 180px);
  min-height: 600px;
}

.research-panel {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.research-left { flex: 0 0 28%; }
.research-center { flex: 0 0 34%; }
.research-right { flex: 0 0 38%; }

.research-panel-header {
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}

.research-panel-header h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
}

.panel-hint {
  font-size: 11px;
  color: #999;
}

.research-panel-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.research-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

/* Ŀ�꾺Ʒ�б� */
.target-product-item {
  padding: 10px 12px;
  border: 1px solid #eee;
  border-radius: 6px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all .15s;
}

.target-product-item:hover { border-color: #4a90d9; background: #f8fbff; }
.target-product-item.active { border-color: #4a90d9; background: #e8f4fd; }

.target-product-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.target-asin {
  font-size: 13px;
  font-weight: 600;
  color: #007185;
}

.target-product-title {
  font-size: 12px;
  color: #555;
  margin-bottom: 6px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.target-product-meta {
  font-size: 11px;
  color: #999;
}

.btn-start-research {
  margin-top: 8px;
  width: 100%;
}

/* ״̬�ձ� */
.badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

.badge-pending { background: #fff3cd; color: #856404; }
.badge-researching { background: #d1ecf1; color: #0c5460; }
.badge-has-plan { background: #d4edda; color: #155724; }
.badge-confirmed { background: #cce5ff; color: #004085; }
.badge-hold { background: #e2e3e5; color: #383d41; }
.badge-abandoned { background: #f8d7da; color: #721c24; }

/* �������� */
.task-detail-card {
  padding: 4px 0;
}

.task-id {
  font-size: 13px;
  font-family: monospace;
  color: #888;
  margin-bottom: 8px;
}

.task-status-row {
  margin-bottom: 12px;
}

.task-status-badge {
  font-size: 13px;
  padding: 4px 12px;
  border-radius: 12px;
  font-weight: 600;
}

.status-pending { background: #e2e3e5; }
.status-collecting { background: #d1ecf1; color: #0c5460; }
.status-analyzing { background: #fff3cd; color: #856404; }
.status-done { background: #d4edda; color: #155724; }
.status-archived { background: #cce5ff; color: #004085; }
.status-failed { background: #f8d7da; color: #721c24; }

/* ������ */
.task-progress {
  margin: 12px 0;
}

.progress-bar {
  height: 6px;
  background: #e9ecef;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4a90d9, #67b26f);
  border-radius: 3px;
  transition: width .5s ease;
}

.progress-text {
  font-size: 11px;
  color: #888;
}

/* ͳ�� */
.task-stats {
  display: flex;
  gap: 16px;
  margin: 12px 0;
}

.task-stat {
  text-align: center;
}

.stat-label {
  display: block;
  font-size: 11px;
  color: #999;
}

.stat-value {
  font-size: 16px;
  font-weight: 700;
  color: #333;
}

.task-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* ����Ԥ�� */
.plan-section {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f0f0f0;
}

.plan-section:last-child { border-bottom: none; }

.plan-section h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #333;
}

.plan-title-text {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 6px;
  border-left: 3px solid #4a90d9;
}

.plan-title-text[contenteditable="true"] {
  background: #fffbeb;
  border-left-color: #f59e0b;
  outline: none;
}

.plan-bullets {
  padding-left: 20px;
  font-size: 13px;
  line-height: 1.7;
}

.plan-bullets li {
  margin-bottom: 6px;
}

.plan-brief {
  font-size: 13px;
  line-height: 1.6;
  color: #555;
  white-space: pre-wrap;
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 6px;
}

.plan-brief[contenteditable="true"] {
  background: #fffbeb;
  outline: none;
}

/* ��״̬ */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #aaa;
  font-size: 14px;
}

.empty-state.error { color: #e74c3c; }
.empty-state small { display: block; margin-top: 6px; font-size: 12px; }

/* 竞品弹窗（内部 overlay 用 absolute，由父级 .modal 的 fixed 定位） */
.modal > .modal-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.4); }
.modal-content { background: #fff; border-radius: 12px; z-index: 1001; max-height: 85vh; display: flex; flex-direction: column; position: relative; }
.modal-xl { width: 95%; max-width: 1100px; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid #eee; display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { margin: 0; font-size: 16px; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: #999; }
.modal-close:hover { color: #333; }
.modal-body { padding: 20px; overflow-y: auto; }

.asin-link { color: #007185; text-decoration: none; font-size: 12px; }
.asin-link:hover { text-decoration: underline; }

.loading-cell { padding: 40px; text-align: center; color: #aaa; }
.loading-cell.error { color: #e74c3c; }

/* ==================== 竞品数据采集页 ==================== */
.comp-detail-section {
  margin-bottom: 20px;
  border: 1px solid #eee;
  border-radius: 8px;
  overflow: hidden;
}

.comp-detail-section-title {
  background: #f5f7fa;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 14px;
  border-bottom: 1px solid #eee;
}

.comp-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  padding: 12px 16px;
}

.comp-info-grid label {
  font-size: 11px;
  color: #888;
  display: block;
  margin-bottom: 2px;
}

.comp-info-grid span {
  font-size: 13px;
  color: #333;
  word-break: break-all;
}

/* ��Ӧʽ���ƶ������� */
@media (max-width: 900px) {
  .research-workbench { flex-direction: column; height: auto; }
  .research-left, .research-center, .research-right { flex: none; max-height: 400px; }
}

/* ==================== 自定义列弹窗 ==================== */
.col-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px;
  margin: 2px 0;
  border: 1px solid transparent;
  border-radius: 4px;
  transition: background 0.15s, border-color 0.15s;
  cursor: default;
}

.col-item:hover {
  background: #f0f4ff;
}

.col-item.col-dragging {
  opacity: 0.5;
  background: #e8f0fe;
}

.col-item.col-drag-over {
  border-color: #4A90D9;
  background: #e8f0fe;
}

.col-drag-handle {
  cursor: grab;
  color: #bbb;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
  user-select: none;
  letter-spacing: -2px;
}

.col-drag-handle:hover {
  color: #666;
}

.col-drag-handle:active {
  cursor: grabbing;
}

.col-item-label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 13px;
  padding: 2px 6px;
  border-radius: 4px;
  flex: 1;
}

.col-item-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: #4A90D9;
}

/* ==================== 权限管理弹窗 ==================== */
.perms-matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.perms-matrix-table th {
  text-align: center;
  padding: 10px 8px;
  border-bottom: 2px solid #4a90d9;
  background: #f8fafc;
  font-weight: 600;
  color: #2c3e50;
}
.perms-matrix-table th:first-child {
  text-align: left;
  min-width: 180px;
}
.perms-matrix-table td {
  padding: 10px 8px;
  border-bottom: 1px solid #eee;
  vertical-align: middle;
}
.perms-matrix-table td:first-child {
  font-weight: 500;
}
.perms-matrix-table input[type="checkbox"] {
  transform: scale(1.3);
  cursor: pointer;
  accent-color: #4a90d9;
}
.perms-matrix-table input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}
.perms-role-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #f0f0f0;
}
.perms-role-item:hover {
  background: #f8fafc;
}
.perms-role-remove {
  color: #e74c3c;
  font-size: 11px;
  padding: 2px 8px;
  border: 1px solid #e74c3c;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  transition: all .15s;
}
.perms-role-remove:hover {
  background: #e74c3c;
  color: #fff;
}

/* ==================== 产品管理下拉菜单 ==================== */
.mp-actions-dropdown {
  position: relative;
}

.mp-dropdown-menu {
  position: absolute;
  right: 0;
  top: 100%;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 10000;
  min-width: 130px;
}

.mp-dropdown-menu > div:hover {
  background: #f0f4f8;
}

.mp-dropdown-toggle:hover {
  background: #e8e8e8 !important;
}

/* 确认测品按钮 */
.btn-action-confirm {
  background: #4CAF50;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
}
.btn-action-confirm:hover {
  background: #388E3C;
}

/* ==================== 采购订单表格文本换行 + 表头固定 ==================== */
#poTable {
  table-layout: auto;
  border-collapse: collapse;
}
#poTable td {
  word-wrap: break-word;
  word-break: break-all;
  overflow-wrap: anywhere;
  white-space: normal;
}
#poTable thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #f5f5f5;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}

/* ==================== §9.5 采购计划表格文本换行（硬性约束） ==================== */
#ppTable {
  table-layout: fixed;
  border-collapse: collapse;
}
#ppTable td {
  word-wrap: break-word;
  word-break: break-all;
  overflow-wrap: anywhere;
  white-space: normal;
  max-width: none;
  text-overflow: unset;
  overflow: visible;
}
#ppTable th {
  position: relative;
  user-select: none;
}
/* 列宽拖拽调整手柄 */
.pp-resize-handle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  cursor: col-resize;
  z-index: 2;
}
.pp-resize-handle:hover,
.pp-resize-handle.active {
  background: #1976D2;
}
/* 列头拖拽排序 */
#ppTable th[draggable="true"] {
  cursor: grab;
}
#ppTable th.drag-over {
  border-left: 3px solid #1976D2;
}
#ppTable th.dragging {
  opacity: 0.4;
}
/* 拖拽时禁止文本选择 */
body.pp-dragging {
  user-select: none;
  -webkit-user-select: none;
}

/* ==================== 采购计划表格滚动与表头固定 ==================== */
.pp-table-wrapper {
  padding: 8px 0 14px 0;
}
#ppTable thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #f9f9f9;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}

/* ==================== 操作列下拉菜单 (§10) ==================== */
.pp-action-dropdown {
  position: relative;
  display: inline-block;
  margin-left: 2px;
}
.pp-action-dropdown .pp-dropdown-toggle {
  font-size: 10px;
  padding: 2px 8px;
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.pp-action-dropdown .pp-dropdown-toggle:hover {
  background: #e0e0e0;
}
/* 下拉菜单渲染到 body 层级，避免被 overflow:auto 裁剪 */
.pp-dropdown-portal {
  position: fixed;
  z-index: 9999;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
  min-width: 140px;
  padding: 4px 0;
}
.pp-dropdown-portal a {
  display: block;
  padding: 6px 14px;
  font-size: 12px;
  color: #333;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.pp-dropdown-portal a:hover {
  background: #f5f5f5;
}
.pp-dropdown-portal a.disabled {
  color: #ccc;
  pointer-events: none;
  cursor: default;
}
.pp-dropdown-portal .pp-menu-sep {
  border-top: 1px solid #eee;
  margin: 4px 0;
}
/* 旧的内嵌菜单样式保留兼容 */
.pp-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 999;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  min-width: 140px;
  padding: 4px 0;
}
.pp-dropdown-menu.show {
  display: block;
}
.pp-dropdown-menu.up {
  top: auto;
  bottom: 100%;
}
.pp-dropdown-menu a {
  display: block;
  padding: 6px 14px;
  font-size: 12px;
  color: #333;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.pp-dropdown-menu a:hover {
  background: #f5f5f5;
}
.pp-dropdown-menu a.disabled {
  color: #ccc;
  pointer-events: none;
  cursor: default;
}
.pp-dropdown-menu .pp-menu-sep {
  border-top: 1px solid #eee;
  margin: 4px 0;
}
