:root {
  --paper: #fbf7f6;
  --paper-2: #f7f0f0;
  --surface: #ffffff;
  --ink: #3b3136;
  --ink-2: #6e5f66;
  --ink-3: #9c8d95;
  --line: #efe2e4;
  --line-soft: #f7eeef;
  --rose: #c08a9e;
  --rose-deep: #9c6379;
  --rose-wash: #f9eef1;
  --clay: #b4544a;
  --clay-mid: #c2766b;
  --clay-wash: #fbedeb;
  --amber: #a9772f;
  --amber-wash: #fbf3e6;
  --sage: #5f8873;
  --sage-wash: #eef5f0;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(59, 49, 54, .04), 0 12px 32px -24px rgba(59, 49, 54, .45);
  --ease: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 28px 64px;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 6px 0 26px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
}

.brand { display: flex; align-items: center; gap: 14px; }

.brand-mark {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 13px;
  background: linear-gradient(150deg, #f7e6ec, #f3eee6);
  color: var(--rose-deep);
  border: 1px solid #f1dee4;
  flex: none;
}
.brand-mark svg { width: 22px; height: 22px; }

.brand-text h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.brand-text p {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--ink-3);
}

.topbar-actions { display: flex; gap: 10px; align-items: center; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 9px 16px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: transform .18s var(--ease), background .18s, border-color .18s, box-shadow .18s;
  white-space: nowrap;
}
.btn:active { transform: scale(.975); }
.btn svg { width: 15px; height: 15px; }

.btn-primary {
  background: var(--rose-deep);
  color: #fff;
  box-shadow: 0 2px 10px -4px rgba(156, 99, 121, .55);
}
.btn-primary:hover { background: #8d5670; }

.btn-ghost {
  background: transparent;
  color: var(--ink-2);
  border-color: var(--line);
}
.btn-ghost:hover { background: var(--surface); border-color: #e4d3d7; }

.btn-soft {
  background: var(--surface);
  color: var(--rose-deep);
  border-color: #ecd9e0;
}
.btn-soft:hover { background: var(--rose-wash); }

/* ---------- 上传槽位 ---------- */
.uploader {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.slot {
  background: var(--surface);
  border: 1.5px dashed #e6d2d8;
  border-radius: var(--radius-lg);
  padding: 18px 20px 20px;
  transition: border-color .25s, background .25s, box-shadow .25s;
}
.slot.is-over { border-color: var(--rose); background: var(--rose-wash); }
.slot.is-loaded {
  border-style: solid;
  border-color: #ecd9e0;
  background: linear-gradient(180deg, #fffdfd, #fdf7f8);
  padding: 13px 16px 14px;
}
.slot.is-loaded .slot-top { margin-bottom: 9px; }

.slot-top { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }
.slot-icon {
  width: 34px; height: 34px;
  flex: none;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--rose-wash);
  color: var(--rose-deep);
}
.slot-icon svg { width: 17px; height: 17px; }
.slot-title { flex: 1; min-width: 0; }
.slot-title h3 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -.01em; }
.slot-title span { font-size: 11.5px; color: var(--ink-3); }
.slot-state {
  font-size: 11px;
  color: var(--ink-3);
  background: #f7f2f3;
  border-radius: 20px;
  padding: 2px 9px;
  flex: none;
}
.slot.is-loaded .slot-state { background: var(--sage-wash); color: var(--sage); }

.slot-drop { text-align: center; padding: 6px 0 2px; }
.slot-drop p { margin: 0 0 11px; font-size: 12.5px; color: var(--ink-2); }

.slot-file { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.slot-file-main { min-width: 0; }
.slot-file-main strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.slot-file-main span { font-size: 11.5px; color: var(--ink-3); }
.slot-clear {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-family: inherit;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 8px;
  cursor: pointer;
  flex: none;
  transition: background .18s, border-color .18s;
}
.slot-clear:hover { background: var(--clay-wash); border-color: #f2dcd8; color: var(--clay); }

.uploader-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 12px 0 24px;
  font-size: 12px;
  color: var(--ink-3);
}
.uploader-note svg { width: 13px; height: 13px; flex: none; }

/* ---------- 加载 ---------- */
.loading { padding: 8px 0; }
.skeleton {
  background: linear-gradient(90deg, #f4ecee 25%, #faf4f5 37%, #f4ecee 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--radius-md);
}
.skeleton-title { height: 22px; width: 220px; margin-bottom: 20px; }
.skeleton-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.skeleton-kpi { height: 104px; }
.skeleton-block { height: 320px; }

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

/* ---------- 错误 ---------- */
.error-card {
  border: 1px solid #f0d9d6;
  background: var(--clay-wash);
  border-radius: var(--radius-lg);
  padding: 30px;
  text-align: center;
}
.error-card h3 { margin: 0 0 8px; font-size: 16px; color: #8f3f37; }
.error-card p { margin: 0 0 18px; color: #96605a; font-size: 13px; }

/* ---------- 文件条 ---------- */
.filebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-md);
  margin-bottom: 18px;
}
.filebar-main { display: flex; align-items: center; gap: 11px; min-width: 0; }
.file-chip {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--rose-wash);
  color: var(--rose-deep);
  flex: none;
}
.file-chip svg { width: 16px; height: 16px; }
.filebar strong { display: block; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filebar .muted { font-size: 12px; color: var(--ink-3); }
.filebar-time { font-size: 12px; color: var(--ink-3); flex: none; }

/* ---------- 总览（试驾 / 购车 拆分） ---------- */
.overview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 26px;
}
.ov-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px 14px;
  box-shadow: var(--shadow);
}
.ov-card.is-empty {
  border-style: dashed;
  border-color: #e9dde0;
  background: linear-gradient(180deg, #fffdfd, #fcf8f8);
  box-shadow: none;
}
.ov-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}
.ov-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ov-head h3::before {
  content: "";
  width: 3px; height: 13px;
  border-radius: 3px;
  background: var(--rose);
}
.ov-meta {
  font-size: 11.5px;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 55%;
  text-align: right;
}
.ov-placeholder {
  margin: 18px 0 14px;
  font-size: 12.5px;
  color: var(--ink-3);
  text-align: center;
}
.ov-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
.ov-item {
  padding: 8px 8px 7px;
  border-radius: 10px;
  background: #fdfafb;
  text-align: center;
}
.ov-label { display: block; font-size: 11px; color: var(--ink-3); margin-bottom: 3px; }
.ov-value {
  display: block;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.ov-sub { display: block; font-size: 10.5px; color: var(--ink-3); margin-top: 1px; }
.ov-item.is-alert { background: var(--clay-wash); }
.ov-item.is-alert .ov-value { color: var(--clay); }
.ov-item.is-warn { background: var(--amber-wash); }
.ov-item.is-warn .ov-value { color: var(--amber); }
.ov-item.is-good .ov-value { color: var(--sage); }

/* ---------- Tabs ---------- */
.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: #f5ebed;
  border-radius: 12px;
  margin-bottom: 22px;
}
.tab {
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  padding: 7px 18px;
  border-radius: 9px;
  cursor: pointer;
  transition: background .2s, color .2s, box-shadow .2s;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] {
  background: var(--surface);
  color: var(--rose-deep);
  box-shadow: 0 1px 3px rgba(59, 49, 54, .07);
}
.tab-count {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 20px;
  background: rgba(192, 138, 158, .16);
  color: var(--rose-deep);
  font-variant-numeric: tabular-nums;
}
.tab-count.count-alert { background: #f6ddd9; color: var(--clay); }

.panel { display: none; }
.panel.is-active { display: block; }

/* ---------- 区块 ---------- */
.section { margin-bottom: 30px; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}
.section-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
  display: flex;
  align-items: center;
  gap: 9px;
}
.section-head h3::before {
  content: "";
  width: 4px; height: 14px;
  border-radius: 3px;
  background: var(--rose);
}
.section-head .hint { font-size: 12px; color: var(--ink-3); }

/* ---------- 表格 ---------- */
.table-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.table-scroll { overflow-x: auto; }
table.score {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 700px;
}
table.score thead th {
  background: #fdf8f9;
  color: var(--ink-2);
  font-weight: 500;
  font-size: 11.5px;
  letter-spacing: .02em;
  text-align: right;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  position: sticky;
  top: 0;
}
table.score thead th:first-child { text-align: left; }
table.score tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-soft);
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  white-space: nowrap;
}
table.score tbody tr:last-child td { border-bottom: 0; }
table.score tbody tr:hover td { background: #fdfafb; }
table.score td.name { text-align: left; font-weight: 600; color: var(--ink); }
table.score td.store { text-align: left; color: var(--ink-3); font-size: 12px; }
table.score th.vol { width: 74px; }

td.score-cell { color: var(--ink-3); }
td.score-cell.has { font-weight: 600; }
td.score-cell.s4 { background: #fdf3ec; color: #a9682f; }
td.score-cell.s3 { background: #fbe7e3; color: #b85c52; }
td.score-cell.s2 { background: #f8d8d2; color: #a84a40; }
td.score-cell.s1 { background: #f3c8c1; color: #8f342a; }

td.nss-low { color: var(--clay); font-weight: 600; }
td.nss-ok { color: var(--sage); }
td.rate-low { color: var(--amber); }

.row-total td {
  background: #fdf8f9;
  font-weight: 600;
  color: var(--ink);
  border-top: 1px solid var(--line);
}

/* 门店分组行 */
table.score tbody tr.group-row td {
  background: #fbf5f6;
  border-top: 1px solid var(--line);
  padding: 8px 12px;
  text-align: left;
  font-size: 12px;
  letter-spacing: .01em;
}
table.score tbody tr.group-row:first-child td { border-top: 0; }
.group-name { font-weight: 600; color: var(--ink-2); }
.group-n {
  margin-left: 8px;
  font-size: 11px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* 低分标记点 */
.low-flag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--clay);
  background: var(--clay-wash);
  border: 1px solid #f2dcd8;
  border-radius: 20px;
  padding: 2px 9px;
}
.low-flag.none { color: var(--ink-3); background: transparent; border-color: transparent; font-weight: 400; padding: 2px 0; }

/* ---------- 低分卡片 ---------- */
.low-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.low-card {
  background: var(--surface);
  border: 1px solid #f2e0dc;
  border-left: 3px solid var(--clay-mid);
  border-radius: var(--radius-md);
  padding: 15px 17px;
  box-shadow: 0 1px 2px rgba(59, 49, 54, .03);
  max-width: 620px;
}
.low-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}
.low-badge {
  width: 30px; height: 30px;
  border-radius: 9px;
  display: grid; place-items: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex: none;
  font-variant-numeric: tabular-nums;
}
.low-badge.s4 { background: #c99a5f; }
.low-badge.s3 { background: #c2766b; }
.low-badge.s2 { background: #b4544a; }
.low-badge.s1 { background: #9c3f35; }

.low-who { display: flex; align-items: baseline; gap: 8px; flex: 1; min-width: 0; }
.low-who strong { font-size: 13.5px; font-weight: 600; }
.low-who span { font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.low-time { font-size: 11.5px; color: var(--ink-3); flex: none; font-variant-numeric: tabular-nums; }

.low-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 12px;
  color: var(--ink-2);
  margin-bottom: 9px;
}
.low-meta em { font-style: normal; color: var(--ink-3); }

.low-words {
  border-top: 1px dashed #f0dedb;
  padding-top: 9px;
  font-size: 12.5px;
  color: var(--ink-2);
  display: grid;
  gap: 5px;
}
.low-words div { display: flex; gap: 8px; }
.low-words b { font-weight: 500; color: var(--ink-3); flex: none; font-size: 11.5px; padding-top: 1px; }
.low-words span { color: var(--ink); word-break: break-word; }

/* ---------- 异常 ---------- */
.anomaly-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.chip {
  font-size: 12px;
  padding: 4px 11px;
  border-radius: 20px;
  background: var(--amber-wash);
  color: var(--amber);
  border: 1px solid #f0e2c9;
  font-variant-numeric: tabular-nums;
}
.chip.chip-high { background: var(--clay-wash); color: var(--clay); border-color: #f2dcd8; }

.anomaly-list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.anomaly-item {
  display: flex;
  gap: 13px;
  padding: 13px 17px;
  border-bottom: 1px solid var(--line-soft);
  align-items: flex-start;
}
.anomaly-item:last-child { border-bottom: 0; }
.anomaly-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-top: 7px;
  flex: none;
  background: var(--amber);
}
.anomaly-dot.high { background: var(--clay); }
.anomaly-body { flex: 1; min-width: 0; }
.anomaly-title { font-size: 13px; font-weight: 500; color: var(--ink); }
.anomaly-title .tag {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 5px;
  margin-right: 7px;
  background: var(--amber-wash);
  color: var(--amber);
  font-weight: 500;
}
.anomaly-title .tag.high { background: var(--clay-wash); color: var(--clay); }
.anomaly-detail { font-size: 12px; color: var(--ink-2); margin-top: 3px; }
.anomaly-loc { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; font-variant-numeric: tabular-nums; }

.more-wrap { margin-top: 12px; text-align: center; }
.more-wrap .btn { font-size: 12.5px; padding: 8px 18px; }

/* ---------- 空状态 ---------- */
.empty {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 34px 24px;
  text-align: center;
}
.empty-icon {
  width: 40px; height: 40px;
  margin: 0 auto 12px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--sage-wash);
  color: var(--sage);
}
.empty-icon svg { width: 20px; height: 20px; }
.empty p { margin: 0; font-size: 13px; color: var(--ink-2); }
.empty p.sub { font-size: 12px; color: var(--ink-3); margin-top: 4px; }

/* 紧凑空状态条 */
.empty-inline {
  display: flex;
  align-items: center;
  gap: 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 15px 18px;
}
.empty-inline .tick {
  width: 28px; height: 28px;
  flex: none;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--sage-wash);
  color: var(--sage);
}
.empty-inline .tick svg { width: 15px; height: 15px; }
.empty-inline p {
  margin: 0;
  font-size: 13px;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.empty-inline p span { font-size: 12px; color: var(--ink-3); }

/* ---------- 页脚 ---------- */
.footer {
  margin-top: 44px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.footer p { margin: 0; font-size: 12px; color: var(--ink-3); }

/* ---------- 动效 ---------- */
.reveal { animation: rise .5s var(--ease) both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ---------- 提示 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translate(-50%, 12px);
  background: #3b3136;
  color: #fff;
  font-size: 12.5px;
  padding: 10px 18px;
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .3s var(--ease);
  z-index: 50;
  max-width: 80vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .ov-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 820px) {
  .page { padding: 20px 16px 48px; }
  .topbar { flex-wrap: wrap; gap: 14px; }
  .brand-text p { display: none; }
  .uploader { grid-template-columns: 1fr; }
  .overview { grid-template-columns: 1fr; }
  .ov-grid { grid-template-columns: repeat(3, 1fr); }
  .low-grid { grid-template-columns: 1fr; }
}
