:root {
  --ht-teal: #1b6e6e;
  --ht-teal-dark: #125252;
  --ht-gold: #c9a227;
  --ht-orange: #e8941a;
  --ht-bg: #f4f7f7;
  --ht-line: #e4eaea;
  --ht-text: #2b3333;
  --ht-muted: #6b7575;
  --ht-high: #2e8b57;
  --ht-med: #e8941a;
  --ht-low: #c0392b;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--ht-bg);
  color: var(--ht-text);
  line-height: 1.5;
}
.ht-header {
  background: linear-gradient(135deg, var(--ht-teal), var(--ht-teal-dark));
  color: #fff;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.ht-logo {
  width: 42px; height: 42px; border-radius: 10px;
  background: #fff; color: var(--ht-teal);
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 11px; letter-spacing: -0.5px;
}
.ht-header h1 { font-size: 18px; font-weight: 700; }
.ht-header p { font-size: 12px; opacity: .85; }
.ht-nav {
  background: #fff; border-bottom: 1px solid var(--ht-line);
  display: flex; gap: 4px; padding: 8px 16px; flex-wrap: wrap;
}
.ht-nav a {
  text-decoration: none; color: var(--ht-muted); font-size: 13px;
  padding: 8px 14px; border-radius: 8px;
}
.ht-nav a.on, .ht-nav a:hover { background: #eef5f5; color: var(--ht-teal); font-weight: 600; }
.ht-main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 40px; }
.ht-card {
  background: #fff; border-radius: 14px; padding: 20px;
  box-shadow: 0 4px 16px rgba(27,110,110,.08); margin-bottom: 16px;
}
.ht-card h2 { font-size: 16px; color: var(--ht-teal-dark); margin-bottom: 14px; }
.ht-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 18px; border-radius: 10px; border: none; cursor: pointer;
  font-weight: 700; font-size: 14px; text-decoration: none;
}
.ht-btn-primary { background: var(--ht-teal); color: #fff; }
.ht-btn-gold { background: linear-gradient(90deg, var(--ht-orange), var(--ht-gold)); color: #fff; }
.ht-btn-outline { background: #fff; border: 1px solid var(--ht-teal); color: var(--ht-teal); }
.ht-badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700;
}
.ht-badge.high { background: #dff5e8; color: var(--ht-high); }
.ht-badge.medium { background: #fff3cd; color: #856404; }
.ht-badge.low { background: #fde8e6; color: var(--ht-low); }
.ht-badge.pending { background: #eef1f1; color: #666; }
.ht-badge.ok { background: #dff5e8; color: var(--ht-high); }
.ht-badge.no { background: #fde8e6; color: var(--ht-low); }
table.ht-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.ht-table th, table.ht-table td { padding: 10px 8px; border-bottom: 1px solid var(--ht-line); text-align: left; }
table.ht-table th { color: var(--ht-muted); font-weight: 600; }
.ht-stats { display: grid; grid-template-columns: repeat(auto-fit,minmax(140px,1fr)); gap: 12px; }
.ht-stat { background: #fff; border-radius: 12px; padding: 16px; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,.04); }
.ht-stat b { display: block; font-size: 24px; color: var(--ht-teal); }
.ht-stat span { font-size: 12px; color: var(--ht-muted); }
.ht-alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 12px; font-size: 13px; }
.ht-alert.err { background: #fde8e6; color: #922; }
.ht-alert.ok { background: #dff5e8; color: #155724; }
.ht-alert.info { background: #eef5f5; color: var(--ht-teal-dark); }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--ht-line);
  border-radius: 8px; font-size: 14px; margin-bottom: 10px;
}
textarea { min-height: 72px; resize: vertical; }
.ht-mobile { max-width: 430px; margin: 0 auto; min-height: 100vh; background: #fff; }
.ht-mobile-body { padding: 16px; }
.ht-upload {
  border: 2px dashed var(--ht-teal); border-radius: 16px;
  padding: 28px 16px; text-align: center; background: #f9fcfc;
}
.ht-upload img { max-width: 100%; max-height: 220px; border-radius: 10px; margin-top: 12px; }
.ht-flow { display: flex; gap: 8px; margin: 16px 0; flex-wrap: wrap; }
.ht-flow div { flex: 1; min-width: 70px; text-align: center; font-size: 11px; color: var(--ht-muted); }
.ht-flow b { display: block; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; background: #eef1f1; margin: 0 auto 4px; font-size: 12px; }
.ht-flow div.on b { background: var(--ht-orange); color: #fff; }

.ht-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .ht-detail-grid { grid-template-columns: 1fr; }
}
.ht-detail-img {
  background: #f8fafa;
  border-radius: 12px;
  padding: 12px;
  border: 1px solid var(--ht-line);
  min-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ht-detail-img img {
  max-width: 100%;
  max-height: 520px;
  border-radius: 8px;
  object-fit: contain;
}
.ht-field-grid {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px 14px;
  font-size: 14px;
}
.ht-field-grid .k { color: var(--ht-muted); }
.ht-field-grid .v { font-weight: 600; word-break: break-word; }
.ht-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--ht-line);
}
.ht-ocr-box {
  margin-top: 14px;
  background: #f8fafa;
  border-radius: 8px;
  padding: 12px;
  font-size: 12px;
  white-space: pre-wrap;
  max-height: 180px;
  overflow: auto;
  color: #444;
}
.ht-scan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.ht-scan-panel {
  border: 1px solid var(--ht-line);
  border-radius: 10px;
  padding: 12px;
  background: #fafcfc;
}
.ht-scan-panel h3 {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--ht-teal);
}
.ht-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 8px;
}
.ht-items-table th, .ht-items-table td {
  border-bottom: 1px solid var(--ht-line);
  padding: 6px 4px;
  text-align: left;
}
.ht-items-table th { color: var(--ht-muted); font-weight: 600; }
.ht-items-table .sum-row td { font-weight: 700; border-top: 2px solid var(--ht-line); }
.ht-check-ok { color: #1a8f5a; font-weight: 600; }
.ht-check-bad { color: #c0392b; font-weight: 600; }
.ht-compare-row { font-size: 12px; padding: 4px 0; display: flex; gap: 8px; flex-wrap: wrap; }
.ht-compare-row .tag { padding: 2px 8px; border-radius: 999px; font-size: 11px; }
.ht-compare-row .tag.ok { background: #e8f7ef; color: #1a8f5a; }
.ht-compare-row .tag.bad { background: #fdecea; color: #c0392b; }

.ht-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--ht-line);
}
.ht-switch-row:last-child { border-bottom: none; }
.ht-switch-row .label b { display: block; font-size: 14px; margin-bottom: 2px; }
.ht-switch-row .label span { font-size: 12px; color: var(--ht-muted); }
.ht-switch {
  position: relative;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}
.ht-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.ht-switch .slider {
  position: absolute; inset: 0; cursor: pointer;
  background: #cfd8d8; border-radius: 999px; transition: .2s;
}
.ht-switch .slider:before {
  content: ""; position: absolute; width: 22px; height: 22px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 4px rgba(0,0,0,.15);
}
.ht-switch input:checked + .slider { background: var(--ht-teal); }
.ht-switch input:checked + .slider:before { transform: translateX(20px); }
.ht-filter-row { display:flex; flex-wrap:wrap; gap:10px; align-items:flex-end; margin-bottom:14px; }
.ht-filter-row label { font-size:12px; color:var(--ht-muted); display:block; margin-bottom:4px; }
.ht-filter-row .field { min-width:140px; }
.ht-filter-row input, .ht-filter-row select { width:100%; padding:8px 10px; border:1px solid var(--ht-line); border-radius:8px; font-size:13px; }
.ht-badge.inactive { background:#fde8e6; color:#922; }
.ht-badge.active-store { background:#dff5e8; color:var(--ht-high); }
.ht-modal-backdrop { position:fixed; inset:0; background:rgba(0,0,0,.35); display:flex; align-items:center; justify-content:center; z-index:1000; }
.ht-modal { background:#fff; border-radius:14px; padding:20px; width:min(480px,92vw); max-height:90vh; overflow:auto; }

/* 识别链路可视化 */
.ht-pipeline {
  margin: 0 0 20px;
  padding: 16px;
  background: linear-gradient(180deg, #f8fcfc 0%, #fff 100%);
  border: 1px solid var(--ht-line);
  border-radius: 12px;
}
.ht-pipeline h2 {
  font-size: 15px;
  color: var(--ht-teal-dark);
  margin: 0 0 4px;
}
.ht-pipeline .ht-pipe-intro {
  font-size: 12px;
  color: var(--ht-muted);
  margin-bottom: 14px;
}
.ht-pipe-section {
  margin-bottom: 16px;
}
.ht-pipe-section:last-child { margin-bottom: 0; }
.ht-pipe-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ht-teal);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}
.ht-pipe-track {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0;
}
.ht-pipe-step {
  flex: 1 1 120px;
  min-width: 110px;
  max-width: 200px;
  position: relative;
  padding: 10px 12px 10px 10px;
  border: 1px solid var(--ht-line);
  border-radius: 10px;
  background: #fff;
  margin-right: 28px;
}
.ht-pipe-step:last-child { margin-right: 0; }
.ht-pipe-step::after {
  content: "→";
  position: absolute;
  right: -22px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ht-muted);
  font-size: 16px;
  font-weight: 700;
}
.ht-pipe-step:last-child::after { display: none; }
.ht-pipe-step .name {
  font-size: 12px;
  font-weight: 700;
  color: var(--ht-text);
  margin-bottom: 4px;
  line-height: 1.3;
}
.ht-pipe-step .meta {
  font-size: 11px;
  color: var(--ht-muted);
  line-height: 1.45;
  word-break: break-word;
}
.ht-pipe-step .st {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
}
.ht-pipe-step.ok { border-color: #b8e6cc; background: #f6fcf9; }
.ht-pipe-step.ok .st { background: #dff5e8; color: var(--ht-high); }
.ht-pipe-step.warn { border-color: #f5d9a8; background: #fffbf3; }
.ht-pipe-step.warn .st { background: #fff3cd; color: #856404; }
.ht-pipe-step.fail { border-color: #f0c4c0; background: #fff8f7; }
.ht-pipe-step.fail .st { background: #fde8e6; color: var(--ht-low); }
.ht-pipe-step.skip { border-color: #e8ecec; background: #fafbfb; opacity: 0.85; }
.ht-pipe-step.skip .st { background: #eef1f1; color: #888; }
.ht-pipe-step.run { border-color: #9fd4d4; background: #eef8f8; }
.ht-pipe-step.run .st { background: #d4efef; color: var(--ht-teal-dark); }
.ht-pipe-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  font-size: 11px;
  color: var(--ht-muted);
}
.ht-pipe-legend span::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}
.ht-pipe-legend .lg-ok::before { background: var(--ht-high); }
.ht-pipe-legend .lg-warn::before { background: var(--ht-med); }
.ht-pipe-legend .lg-fail::before { background: var(--ht-low); }
.ht-pipe-legend .lg-skip::before { background: #bbb; }
@media (max-width: 720px) {
  .ht-pipe-track { flex-direction: column; }
  .ht-pipe-step { max-width: none; margin-right: 0; margin-bottom: 8px; }
  .ht-pipe-step::after {
    content: "↓";
    right: auto;
    left: 50%;
    top: auto;
    bottom: -18px;
    transform: translateX(-50%);
  }
  .ht-pipe-step:last-child { margin-bottom: 0; }
}
.ht-poc-modal { width: min(760px, 94vw); }
.ht-debug-section { margin-bottom: 16px; }
.ht-debug-section h3,
.ht-debug-section h4 {
  font-size: 12px;
  font-weight: 600;
  color: var(--ht-teal-dark);
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ht-debug-section pre {
  margin: 0;
  max-height: 280px;
  overflow: auto;
  font-size: 11px;
  line-height: 1.45;
  background: #f4f7f7;
  border: 1px solid var(--ht-line);
  border-radius: 6px;
  padding: 10px;
  white-space: pre-wrap;
  word-break: break-word;
}
.ht-poc-block { margin-bottom: 14px; }
.ht-poc-block h3 {
  font-size: 12px;
  font-weight: 600;
  color: var(--ht-teal-dark);
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ht-poc-pre {
  margin: 0;
  max-height: 220px;
  overflow: auto;
  font-size: 11px;
  line-height: 1.45;
  background: #f4f7f7;
  border: 1px solid var(--ht-line);
  border-radius: 8px;
  padding: 10px 12px;
  white-space: pre-wrap;
  word-break: break-word;
}
.ht-assess-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin: 12px 0 16px;
}
.ht-assess-card {
  border-radius: 12px;
  border: 1px solid var(--ht-line);
  padding: 14px 16px;
  background: #fafbfb;
}
.ht-assess-card.ok { border-color: #b8e6cc; background: #f6fcf9; }
.ht-assess-card.warn { border-color: #f5d9a8; background: #fffbf3; }
.ht-assess-card.fail { border-color: #f0c4c0; background: #fff8f7; }
.ht-assess-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--ht-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.ht-assess-grade {
  font-size: 16px;
  font-weight: 700;
  color: var(--ht-teal-dark);
  margin-bottom: 6px;
}
.ht-assess-meta, .ht-assess-blockers {
  font-size: 12px;
  color: var(--ht-muted);
  line-height: 1.5;
}
.ht-assess-blockers { margin-top: 6px; }
