/* 本地版补充样式：在原有 SoleMatch 样式之上只做少量可见性/尺寸修正 */

/* 简单模式默认隐藏了结果工具栏与算法说明，本地版需要保留 */
body.simple-mode .result-toolbar{display:flex!important;align-items:center;justify-content:space-between;gap:16px;
  border-bottom:1px solid #e2e8da;padding-bottom:13px;margin-top:14px}
body.simple-mode #algorithm-note{display:block!important}
body.simple-mode .result-summary .check-label{display:none}

/* 图标：data-icon 容器内注入的 svg */
span[data-icon]{display:inline-flex;align-items:center;justify-content:center;flex:none}
span[data-icon] svg{display:block;width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.7;
  stroke-linecap:round;stroke-linejoin:round}

/* 查询面板空状态 */
.query-preview.empty>span[data-icon] svg{width:38px;height:38px;stroke-width:1.1;color:#b0bd9d;margin-bottom:12px}
.dropzone>span[data-icon] svg{width:22px;height:22px;color:#8eaa70;margin-bottom:3px}

/* 权重调整 */
.weights-summary{font-size:12px;color:#64735e;background:#f4f7ee;border:1px solid #e4ebda;border-radius:7px;
  padding:8px 11px;margin:0 0 14px}
.weight-fields{padding:2px 0 14px}
.weight-fields.hidden{display:none}
.weight-fields .weight-field{margin:12px 0}
.weight-fields .weight-field label{display:flex;align-items:center;gap:7px;font-size:12px;color:#64735e}
.weight-fields .weight-field input[type=range]{width:100%;margin-top:8px}

/* 图库筛选 */
.brand-filter input[type=search]{min-width:170px}
.catalog-heading{align-items:flex-end}
.catalog-card .sku-row{margin-bottom:9px}

/* 详情弹窗 */
#detail-content{min-width:0}
.status-dot{width:7px;height:7px;border-radius:50%;background:#79a970}

@media(max-width:640px){
  body.simple-mode .result-toolbar{flex-wrap:wrap}
  .brand-filter{width:100%;flex-direction:column;align-items:stretch;gap:8px}
  .brand-filter input[type=search]{width:100%}
}

/* ---- 已标记页：恢复对照弹窗需要的卡片信息（原站紧凑样式会隐藏这些块） ---- */
#marked-grid .product-card{display:block;min-height:0;height:auto}
#marked-grid .product-card .marked-query{display:block}
#marked-grid .product-card .card-evidence{display:flex}
#marked-grid .product-card .card-footer{display:flex;flex-wrap:wrap;gap:8px;align-items:center;justify-content:space-between}
#marked-grid .product-card .component-scores{display:block}
#marked-grid .product-card .product-body{display:block!important;padding:14px 16px 16px;gap:0}
#marked-grid .product-card .product-title-row{display:flex;align-items:baseline;justify-content:space-between;gap:10px;margin:6px 0 4px}
#marked-grid .product-card .sku-row{margin-bottom:8px}
#marked-grid .product-card .component-scores{margin:8px 0 10px}
#marked-grid .product-card .card-evidence{display:flex;gap:6px;margin:0 0 10px}
#marked-grid .product-card .card-footer{border-top:1px solid #edf1e5;padding-top:9px}

/* ---- AI 识图补充 ---- */
.ai-panel{margin:14px 0 0;padding:14px 16px;border:1px solid #e3ebd6;border-radius:10px;background:#f7faf0}
.ai-panel h3{margin:0 0 8px;font-size:12px;letter-spacing:.06em;color:#6c7d5d;font-weight:600}
.ai-chips{display:flex;flex-wrap:wrap;gap:6px}
.ai-chip{display:inline-block;padding:3px 9px;border-radius:999px;background:#fff;border:1px solid #dde7cc;font-size:12px;color:#4c5f3e;line-height:1.6}
.ai-note{margin:9px 0 0;font-size:12px;color:#5f6f52;line-height:1.7}
.ai-line{margin:6px 0 0;font-size:12px;color:#3f5133;font-weight:600}

/* ---- 图库卡片自适应（NAS 品牌/文件名较长时不再挤压） ---- */
#catalog-grid{grid-template-columns:repeat(auto-fill,minmax(230px,1fr))!important;gap:14px!important}
#catalog-grid .catalog-card .product-body{display:block!important;padding:11px 13px 12px}
#catalog-grid .catalog-card .catalog-product-name{margin:0 0 5px;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#catalog-grid .catalog-card .sku-row{display:flex;justify-content:space-between;align-items:center;gap:8px;margin:0 0 6px;font-size:11px;min-width:0}
#catalog-grid .catalog-card .sku-row>span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
#catalog-grid .catalog-card .catalog-path{margin:0 0 9px;font-size:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#catalog-grid .catalog-card .sample-search{width:100%;justify-content:center;white-space:nowrap}

/* ---- AI 识图配置弹窗 ---- */
.ai-config-button{margin-left:auto;font-size:12px;padding:6px 12px;white-space:nowrap}
.ai-dialog{border:none;border-radius:14px;padding:0;width:min(520px,92vw);box-shadow:0 24px 60px rgba(30,50,25,.24);background:#fff}
.ai-dialog::backdrop{background:rgba(28,38,24,.42)}
.ai-dialog-body{padding:20px 22px 18px}
.ai-dialog-note{font-size:12px;color:#6f7f62;line-height:1.7;margin:8px 0 2px}
.ai-dialog-body .field-label{display:block;margin:14px 0 6px;font-size:12px;color:#6a7a5d;letter-spacing:.04em}
.ai-dialog-body input{width:100%;box-sizing:border-box;padding:9px 11px;border:1px solid #dbe3d1;border-radius:8px;font-size:13px;background:#fbfcf8;color:#2f3a28}
.ai-dialog-actions{display:flex;justify-content:space-between;align-items:center;margin-top:18px;gap:12px}
#ai-save-note{font-size:12px;color:#a0592f}

.ai-score {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(16, 95, 62, 0.10);
  color: #0b5c3d;
  font-variant-numeric: tabular-nums;
}
.ai-score:only-child { margin-left: 0; }

.ai-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: -2px 0 10px;
  font-size: 10px;
  line-height: 1.6;
  color: #4f7a54;
  background: #f2f7ea;
  border: 1px solid #e0e9d2;
  border-radius: 6px;
  padding: 4px 8px;
  overflow-wrap: anywhere;
}
.ai-inline .ai-dot { width: 6px; height: 6px; border-radius: 50%; background: #7fa863; flex: none; }
.ai-inline .ai-score { margin: 0; padding: 0; background: none; }

/* 权重/阈值滑杆：加大命中区域与滑块尺寸，之前 3px 高几乎点不到 */
.weight-fields input[type=range],
#threshold,
.threshold-label input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  height: 22px;
  padding: 0;
  background: transparent;
  cursor: pointer;
  touch-action: pan-y;
}
.weight-fields input[type=range]::-webkit-slider-runnable-track,
#threshold::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: #e4ebdb;
}
#threshold::-webkit-slider-runnable-track { width: 100%; }
.weight-fields input[type=range]::-webkit-slider-thumb,
#threshold::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -5px;
  border-radius: 50%;
  background: #6d9060;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(35, 59, 46, .25);
}
.weight-fields input[type=range]::-moz-range-track,
#threshold::-moz-range-track { height: 6px; border-radius: 999px; background: #e4ebdb; }
.weight-fields input[type=range]::-moz-range-thumb,
#threshold::-moz-range-thumb { width: 16px; height: 16px; border: 2px solid #fff; border-radius: 50%; background: #6d9060; }

/* 多款并行检索：结果按款分组 */
.results-grid.grouped { display: block; }
.result-group { margin-bottom: 32px; }
.result-group .results-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.group-head { display: flex; align-items: center; gap: 12px; margin-bottom: 13px; padding: 10px 13px; background: #f5f8ef; border: 1px solid #e3ead9; border-radius: 9px; }
.group-thumb { width: 52px; height: 52px; object-fit: contain; background: #fff; border: 1px solid #e2e9d8; border-radius: 8px; flex: none; }
.group-meta strong { display: block; font-size: 12px; color: #5b7546; font-weight: 600; overflow-wrap: anywhere; }
.group-meta small { font-size: 9px; color: #98a687; }
@media (min-width: 1600px) { .result-group .results-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 820px) { .result-group .results-grid { grid-template-columns: 1fr; } }

/* 覆盖 .simple-mode #results-grid.results-grid 的高优先级网格 */
#results-grid.grouped { display: block !important; }
.simple-mode #results-grid.grouped { display: block !important; }

/* 同款核对状态 */
.ai-inline.same { background: #eaf3dd; border-color: #d3e4bd; color: #557a3d; }
.ai-inline.diff { background: #faf0e6; border-color: #eddcc8; color: #a4784f; }
.ai-inline.same .ai-dot { background: #6f9a4d; }
.ai-inline.diff .ai-dot { background: #c69354; }

/* 货号输入框（可选） */
.sku-field { margin: 12px 0 16px; }
.sku-field label { display: block; font-size: 11px; color: #748763; margin-bottom: 5px; }
.sku-field input { width: 100%; border: 1px solid #dce5d2; background: #fff; border-radius: 6px; padding: 8px 10px; font-size: 11px; color: #5e7350; }
.sku-field input::placeholder { color: #a6b19a; }
.sku-field input:focus { outline: none; border-color: #9dbd80; box-shadow: 0 0 0 2px #e8f1dc; }

/* 拼版命中：卡片里只展示那一格（裁切铺满） */
.cell-crop{width:100%;height:100%;background-repeat:no-repeat;background-color:#fff;
  background-size:cover;background-position:center;}
/* 结果列表在桌面上固定一排 3 款 */
#results-grid{grid-template-columns:repeat(3,minmax(0,1fr))!important;}
@media (max-width:1180px){#results-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;}}
@media (max-width:820px){#results-grid{grid-template-columns:1fr!important;}}

/* 卡片宽度铺满列，产品图 1:1 白底 */
#results-grid .product-card{width:100%!important;}
#results-grid .product-card .product-visual{height:auto!important;aspect-ratio:1/1;}
#results-grid .product-card .product-visual img{width:100%;height:100%;object-fit:contain;background:#fff;}

/* 单图结果：每组内只有一张卡，撑满整列 */
#results-grid .result-group > .results-grid{grid-template-columns:1fr!important;}
#results-grid .result-group > .results-grid .product-card{width:100%!important;}

/* 检索结果：每一组占满整行，组内一排 3 款 */
#results-grid .result-group{grid-column:1 / -1!important;width:100%;}
#results-grid .result-group > .results-grid{grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:18px;}
@media (max-width:1180px){#results-grid .result-group > .results-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;}}
@media (max-width:820px){#results-grid .result-group > .results-grid{grid-template-columns:1fr!important;}}
