/* ─── 全局变量 ─────────────────────────────── */
:root {
  --primary: #667eea;
  --primary-dark: #764ba2;
  --gradient: linear-gradient(135deg, #667eea, #764ba2);
  --bg: #f8f9fc;
  --card: #fff;
  --border: #e8e8f0;
  --text: #333;
  --text-secondary: #888;
  --text-muted: #aaa;
  --cost-price: #e44;
  --sell-price: #333;
  --success: #2e7d32;
  --warning: #f57c00;
  --error: #d32f2f;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.hidden { display: none !important; }

/* ─── 标题栏 ─────────────────────────────── */
.header {
  background: var(--gradient);
  color: white;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.header h1 { font-size: 18px; font-weight: 600; }

.date-badge {
  background: rgba(255,255,255,0.2);
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  margin-left: 12px;
}

.header-right { display: flex; align-items: center; gap: 10px; }

.btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.btn-outline {
  background: rgba(255,255,255,0.15);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
}
.btn-outline:hover { background: rgba(255,255,255,0.25); }

.btn-primary {
  background: var(--gradient);
  color: white;
}
.btn-primary:hover { opacity: 0.9; }

.mode-switch {
  display: flex;
  background: rgba(255,255,255,0.15);
  border-radius: 6px;
  overflow: hidden;
}

.mode-btn {
  padding: 6px 14px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}
.mode-btn.active {
  background: rgba(255,255,255,0.25);
  color: white;
  font-weight: 600;
}

/* ─── 工具栏 ─────────────────────────────── */
.toolbar {
  background: white;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.toolbar-left { display: flex; align-items: center; gap: 12px; }
.toolbar-right { display: flex; align-items: center; gap: 8px; }

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

.search-icon {
  position: absolute;
  left: 10px;
  font-size: 14px;
}

.search-box input {
  padding: 7px 12px 7px 32px;
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 260px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
.search-box input:focus { border-color: var(--primary); }

.filter-select {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  background: white;
  cursor: pointer;
}

.view-switch {
  display: flex;
  background: var(--bg);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.view-btn {
  padding: 6px 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 0.2s;
}
.view-btn.active {
  background: var(--primary);
  color: white;
}

/* ─── 分类导航 ─────────────────────────────── */
.category-nav {
  background: white;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.main-categories {
  display: flex;
  gap: 8px;
  padding: 8px 0;
  flex-wrap: wrap;
}

.main-cat-tab {
  padding: 4px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: all 0.2s;
}
.main-cat-tab:hover { border-color: var(--primary); color: var(--primary); }
.main-cat-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.sub-categories {
  display: flex;
  gap: 8px;
  padding: 8px 0;
  flex-wrap: wrap;
}

.sub-cat-chip {
  padding: 4px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
  transition: all 0.2s;
}
.sub-cat-chip:hover { border-color: var(--primary); color: var(--primary); }
.sub-cat-chip.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ─── 内容区 ─────────────────────────────── */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

.breadcrumb {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.breadcrumb span { color: var(--primary); font-weight: 500; }

/* 表格视图 */
.product-table {
  width: 100%;
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.product-table table {
  width: 100%;
  border-collapse: collapse;
}

.product-table th {
  background: var(--bg);
  padding: 10px 14px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.product-table td {
  padding: 10px 14px;
  font-size: 13px;
  border-bottom: 1px solid #f0f0f5;
}

.product-table tr:nth-child(even) { background: #fafafe; }
.product-table tr:hover { background: #f0f0ff; }

.model-cell {
  font-family: 'Consolas', 'Monaco', monospace;
  color: var(--primary);
  font-size: 12px;
}

.cost-price { color: var(--cost-price); font-weight: 500; }
.sell-price { color: var(--sell-price); font-weight: 700; font-size: 14px; }
.diy-price { color: #667eea; font-weight: 700; font-size: 14px; }

/* 卡片视图 */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.product-card {
  background: white;
  border-radius: 10px;
  padding: 16px;
  border: 1px solid var(--border);
  transition: box-shadow 0.2s;
}
.product-card:hover { box-shadow: 0 4px 12px rgba(102,126,234,0.15); }

.product-card h4 { font-size: 15px; margin-bottom: 4px; }
.product-card .card-model {
  font-family: 'Consolas', monospace;
  font-size: 11px;
  color: var(--primary);
  margin-bottom: 8px;
}
.product-card .card-specs {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.product-card .card-prices {
  display: flex;
  gap: 16px;
  align-items: baseline;
}

/* 详细参数面板 */
.specs-panel {
  margin-top: 8px;
  padding: 8px;
  background: var(--bg);
  border-radius: 6px;
  font-size: 12px;
}

.specs-panel .spec-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  border-bottom: 1px solid #eee;
}
.specs-panel .spec-row:last-child { border-bottom: none; }
.specs-panel .spec-label { color: var(--text-secondary); }
.specs-panel .spec-value { font-weight: 500; }

/* ─── 配置器 ─────────────────────────────── */
.configurator-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  background: white;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.config-tab {
  flex: 1;
  padding: 14px 20px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 15px;
  color: var(--text-secondary);
  transition: all 0.2s;
}
.config-tab.active {
  background: var(--gradient);
  color: white;
  font-weight: 600;
}

.config-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
}

.config-selector {
  background: white;
  border-radius: 10px;
  padding: 20px;
  border: 1px solid var(--border);
}

.config-summary {
  background: white;
  border-radius: 10px;
  padding: 20px;
  border: 1px solid var(--border);
  position: sticky;
  top: 0;
  align-self: start;
}

.config-step {
  margin-bottom: 20px;
}

.config-step h4 {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.config-step h4 .step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gradient);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.config-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.config-option {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
  background: white;
}
.config-option:hover { border-color: var(--primary); }
.config-option.selected {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.config-option .opt-price {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.config-option.selected .opt-price { color: rgba(255,255,255,0.8); }

/* 产品详情弹出 */
.config-product-detail {
  margin-top: 10px;
  padding: 12px;
  background: var(--bg);
  border-radius: 8px;
  font-size: 12px;
}

.config-product-detail .detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
}

.config-product-detail .detail-item {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
}

.config-product-detail .detail-label { color: var(--text-secondary); }
.config-product-detail .detail-value { font-weight: 500; }

/* 汇总面板 */
.summary-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.summary-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 13px;
  border-bottom: 1px solid #f0f0f5;
}

.summary-item .item-label { color: var(--text-secondary); }
.summary-item .item-value { font-weight: 500; }
.summary-item .item-price { font-weight: 700; color: var(--sell-price); }

.summary-total {
  margin-top: 16px;
  padding: 14px;
  background: var(--gradient);
  border-radius: 8px;
  color: white;
  text-align: center;
}

.summary-total .total-label { font-size: 13px; opacity: 0.9; }
.summary-total .total-price { font-size: 24px; font-weight: 700; }

/* 兼容性状态 */
.compat-status {
  margin-top: 16px;
  padding: 12px;
  border-radius: 8px;
  font-size: 13px;
}

.compat-status.ok {
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
  color: var(--success);
}

.compat-status.has-issues {
  background: #ffebee;
  border: 1px solid #ef9a9a;
  color: var(--error);
}

.compat-status .compat-item {
  padding: 3px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.compat-status .compat-item.warning { color: var(--warning); }

/* ─── 弹窗 ─────────────────────────────── */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

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

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

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-secondary);
}

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

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.scraper-options {
  display: flex;
  gap: 20px;
  margin-bottom: 12px;
  font-size: 13px;
}

.scraper-output {
  background: #1e1e2e;
  color: #a6e3a1;
  padding: 14px;
  border-radius: 8px;
  font-family: 'Consolas', monospace;
  font-size: 12px;
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ─── 底部状态栏 ─────────────────────────────── */
.status-bar {
  background: white;
  padding: 6px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* ─── 数量选择器 ─────────────────────────────── */
.qty-control {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin-left: 8px;
}

.qty-btn {
  width: 26px;
  height: 26px;
  border: none;
  background: var(--bg);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qty-btn:hover { background: #e0e0e8; }

.qty-value {
  width: 30px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
}

/* ─── 缺货标识 ─────────────────────────────── */
.oos-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  background: #ffebee;
  color: var(--error);
  vertical-align: middle;
}

.oos-badge-sm {
  display: inline-block;
  padding: 0 6px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  background: #ffebee;
  color: var(--error);
  vertical-align: middle;
}

.product-table tr.row-oos {
  background: #fff8f5;
}
.product-table tr.row-oos:hover { background: #fff0e8; }

.product-card.card-oos {
  border-color: #ffcdd2;
  background: #fffaf8;
}

/* ─── 配置器（重新设计） ─────────────────────────────── */

/* 提示栏 */
.cfg-hint-bar {
  background: #f0f0ff;
  border: 1px solid #e0e0f0;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.required-mark {
  color: var(--error);
  font-weight: 600;
  font-size: 12px;
}

.req-star {
  color: var(--error);
  font-weight: 700;
  margin-right: 1px;
}

.req-star-sm {
  color: var(--error);
  font-weight: 700;
  font-size: 11px;
}

/* 组件标签栏 */
.cfg-component-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
  background: white;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.cfg-comp-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.cfg-comp-tab:hover { border-color: var(--primary); color: var(--primary); }

.cfg-comp-tab.active {
  background: var(--gradient);
  color: white;
  border-color: transparent;
}

.cfg-comp-tab.has-selection {
  border-color: var(--primary);
  color: var(--primary);
}
.cfg-comp-tab.active.has-selection {
  background: var(--gradient);
  color: white;
}

/* 双栏主体 */
.cfg-main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  min-height: 400px;
}

/* 左栏 */
.cfg-left {
  background: white;
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow: hidden;
  align-self: start;
  position: sticky;
  top: 0;
}

.cfg-left-inner {
  padding: 16px;
}

.cfg-left-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}

.cfg-left-title::before {
  content: '🔧';
  font-size: 16px;
}

.cfg-left-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cfg-left-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: all 0.2s;
  cursor: pointer;
}

.cfg-left-item:hover {
  background: #f8f8ff;
  border-color: #e8e8f0;
}

.cfg-left-item.empty {
  opacity: 0.7;
}

.cfg-left-item.filled {
  background: #f8f8ff;
  border-color: #e8e8f0;
}

.cfg-item-icon { font-size: 18px; flex-shrink: 0; }

.cfg-item-info { flex: 1; min-width: 0; }
.cfg-item-name { font-size: 13px; font-weight: 500; }
.cfg-item-detail {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cfg-item-detail.placeholder {
  color: var(--text-muted);
  font-style: italic;
}
.cfg-item-price { color: var(--sell-price); font-weight: 600; }

.cfg-item-remove {
  width: 22px;
  height: 22px;
  border: none;
  background: #ffebee;
  color: var(--error);
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cfg-item-remove:hover { background: #ffcdd2; }

.cfg-left-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px;
  margin-top: 14px;
  background: var(--bg);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
}

.cfg-total-price {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
}

/* 右栏 */
.cfg-right {
  background: white;
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.cfg-right-inner {
  padding: 16px;
}

.cfg-right-header {
  margin-bottom: 14px;
}

.cfg-right-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.cfg-right-title h3 {
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.cfg-right-count {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg);
  padding: 2px 10px;
  border-radius: 12px;
}

/* 搜索框 */
.cfg-search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.cfg-search-icon {
  position: absolute;
  left: 10px;
  font-size: 14px;
  pointer-events: none;
}

.cfg-search-input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
.cfg-search-input:focus { border-color: var(--primary); }

/* 空状态 */
.cfg-right-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.cfg-right-empty .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

/* 产品列表 */
.cfg-product-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 500px;
  overflow-y: auto;
}

.cfg-product-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid #f0f0f5;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.cfg-product-card:hover { border-color: var(--primary); background: #f8f8ff; }
.cfg-product-card.selected { border-color: var(--primary); background: #f0f0ff; }
.cfg-product-card.is-oos { opacity: 0.65; border-left: 3px solid var(--error); }

.cfg-product-img {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cfg-product-img .img-placeholder {
  font-size: 24px;
  opacity: 0.5;
}

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

.cfg-product-name {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
}

.cfg-product-model {
  font-family: 'Consolas', monospace;
  font-size: 11px;
  color: var(--primary);
  margin-top: 2px;
}

.cfg-product-specs {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.cfg-product-brand {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.cfg-product-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.cfg-product-price {
  font-size: 16px;
  font-weight: 700;
  color: var(--sell-price);
  white-space: nowrap;
}

.cfg-price-diy {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
}

.cfg-price-cost {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 2px;
}

.cfg-price-diy-sm {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
}

.cfg-price-cost-sm {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-left: 4px;
}

.cfg-select-btn {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 0.2s;
  white-space: nowrap;
}

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

.cfg-select-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ─── 移动端响应式 ─────────────────────────────── */
@media (max-width: 768px) {
  .header {
    padding: 10px 14px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .header h1 { font-size: 15px; }
  .date-badge { font-size: 11px; margin-left: 8px; }

  .header-right {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
  }

  .header-right .btn-outline {
    padding: 5px 10px;
    font-size: 12px;
  }

  .mode-switch { order: -1; }
  .mode-btn { padding: 5px 10px; font-size: 12px; }

  .toolbar {
    padding: 8px 14px;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
  }

  .toolbar-left {
    flex-wrap: wrap;
    gap: 8px;
  }

  .search-box { width: 100%; }
  .search-box input { width: 100%; }

  .filter-select { flex: 1; min-width: 0; }

  .toolbar-right { justify-content: flex-end; }
  .view-switch { display: none; }

  .category-nav { padding: 0 14px; }
  .main-cat-tab { padding: 3px 10px; font-size: 11px; }
  .sub-categories { padding: 6px 0; }
  .sub-cat-chip { padding: 3px 10px; font-size: 11px; }

  .content { padding: 14px; }

  .product-table { display: none; }

  .card-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .product-card { padding: 14px; }
  .product-card h4 { font-size: 14px; }

  .config-layout {
    grid-template-columns: 1fr;
  }

  .config-summary {
    position: static;
  }

  .cfg-main {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .cfg-left { order: 1; position: static; }
  .cfg-right { order: 2; }

  .cfg-component-tabs {
    gap: 4px;
    padding: 8px 10px;
  }

  .cfg-comp-tab {
    padding: 6px 10px;
    font-size: 12px;
  }

  .cfg-product-list { max-height: none; }

  .cfg-product-actions { gap: 6px; }
  .cfg-product-price { font-size: 14px; }
  .cfg-select-btn { padding: 4px 10px; font-size: 11px; }

  .cfg-product-img { width: 44px; height: 44px; }
  .cfg-product-img .img-placeholder { font-size: 20px; }

  .cfg-product-card { padding: 10px; gap: 8px; }

  .configurator-tabs { border-radius: 8px; }
  .config-tab { padding: 10px 14px; font-size: 13px; }

  .modal-content {
    width: calc(100vw - 24px);
    max-height: 90vh;
    border-radius: 10px;
  }

  .scraper-output { max-height: 200px; font-size: 11px; }
  .scraper-options { flex-direction: column; gap: 8px; }

  .status-bar {
    padding: 5px 14px;
    font-size: 11px;
  }

  .cfg-total-price { font-size: 18px; }
}

@media (max-width: 480px) {
  .header h1 { font-size: 14px; }

  .header-right .btn-outline span {
    display: none;
  }

  .config-tab { font-size: 12px; padding: 8px 10px; }

  .cfg-comp-tab { font-size: 11px; padding: 5px 8px; }

  .cfg-product-name { font-size: 13px; }
  .cfg-product-model, .cfg-product-specs { font-size: 10px; }
}

/* ─── 购物车导航 ─────────────────────────────── */
.header-nav-btn {
  text-decoration: none !important;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.cart-badge {
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  border-radius: 9px;
  text-align: center;
  padding: 0 4px;
  margin-left: 4px;
}

/* ─── 加入购物车按钮 ─────────────────────────────── */
.btn-cart-add {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--primary);
  background: white;
  color: var(--primary);
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
  transition: all 0.2s;
}
.btn-cart-add:hover {
  background: var(--primary);
  color: white;
}
.btn-cart-add:disabled {
  opacity: 0.7;
  cursor: default;
}
.btn-cart-added {
  background: var(--success) !important;
  color: white !important;
  border-color: var(--success) !important;
}
.btn-cart-error {
  background: var(--error) !important;
  color: white !important;
  border-color: var(--error) !important;
}

.card-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

/* ─── 购物车数量确认弹窗 ─────────────────────────────── */
.modal-sm {
  width: 380px;
}

.cart-qty-product {
  margin-bottom: 16px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 8px;
}

.cart-qty-name {
  font-size: 14px;
  font-weight: 600;
}

.cart-qty-model {
  font-family: 'Consolas', monospace;
  font-size: 12px;
  color: var(--primary);
  margin-top: 2px;
}

.cart-qty-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.qty-input {
  width: 50px;
  text-align: center;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  outline: none;
  -moz-appearance: textfield;
}

.qty-input::-webkit-inner-spin-button,
.qty-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.cart-qty-row .qty-control {
  margin-left: 0;
}
