:root {
  --bg: #f5f6f8;
  --card: #fff;
  --line: #e3e6eb;
  --text: #1f2328;
  --muted: #6b7280;
  --brand: #2f6fed;
  --warn: #f59e0b;
  --danger: #dc2626;
  --ok: #16a34a;
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.55 -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--brand); text-decoration: none; }
button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: #fff;
  padding: 6px 12px;
  border-radius: 8px;
}
button:hover { border-color: var(--brand); color: var(--brand); }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.primary:hover { filter: brightness(1.06); color: #fff; }
button.danger { color: var(--danger); }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea {
  font: inherit;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  width: 100%;
}
textarea { resize: vertical; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 10px 18px; background: #fff; border-bottom: 1px solid var(--line);
}
.brand { font-size: 16px; font-weight: 600; }
.brand small { margin-left: 8px; color: var(--muted); font-weight: 400; font-size: 12px; }
.tabs { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.tabs a {
  padding: 6px 12px; border-radius: 8px; color: var(--muted); font-size: 14px;
}
.tabs a.active { background: #eef3ff; color: var(--brand); font-weight: 600; }
.badge {
  display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 12px; line-height: 18px; text-align: center;
}
.badge:empty, .badge[data-zero="1"] { display: none; }
.who { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.who input { width: 72px; }

main { padding: 18px; max-width: 1400px; margin: 0 auto; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px;
}
.card h2 { margin: 0 0 12px; font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; }
.right { margin-left: auto; }

/* ---------- 上传区 ---------- */
.dropzone {
  border: 2px dashed #cbd5e1; border-radius: 14px; padding: 34px;
  text-align: center; color: var(--muted); background: #fafbff; transition: .15s;
}
.dropzone.over { border-color: var(--brand); background: #eef3ff; color: var(--brand); }
.dropzone b { color: var(--text); }
.uploadList { margin-top: 14px; display: grid; gap: 6px; }
.uploadItem { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.uploadItem .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 列表 ---------- */
table.list { width: 100%; border-collapse: collapse; background: #fff; }
table.list th, table.list td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.list th { background: #fafbfc; font-weight: 600; color: var(--muted); font-size: 12px; white-space: nowrap; }
table.list tr:hover td { background: #fcfdff; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tag { display: inline-block; padding: 0 7px; border-radius: 6px; font-size: 12px; line-height: 20px; background: #eef1f5; color: #475569; }
.tag.warn { background: #fff4e5; color: #b45309; }
.tag.ok { background: #e9f9ef; color: #15803d; }
.tag.gray { background: #f1f3f5; color: #6b7280; }
.tag.blue { background: #eef3ff; color: #2f6fed; }
.issue { color: var(--warn); font-size: 12px; }

/* ---------- 校对视图 ---------- */
.review { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .review { grid-template-columns: 1fr; } }
.previewBox {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px; min-height: 420px; overflow: auto; max-height: calc(100vh - 160px);
}
.previewBox img { display: block; max-width: 100%; margin: 0 auto; }
.previewBox iframe { width: 100%; height: calc(100vh - 200px); border: 0; }
/* HTML 表格兜底预览（Excel/Word 转出来的） */
.srcHtml { font-size: 12px; }
.srcHtml h4 { margin: 8px 0 6px; font-size: 13px; color: var(--muted); }
table.srcTable { border-collapse: collapse; width: 100%; background: #fff; margin-bottom: 14px; }
table.srcTable th, table.srcTable td {
  border: 1px solid var(--line); padding: 4px 6px; text-align: left;
  vertical-align: top; white-space: pre-wrap; word-break: break-word; max-width: 320px;
}
table.srcTable th { background: #fafbfc; font-weight: 600; }
.srcHtml p { margin: 6px 0; }
.previewEmpty {
  border: 1px dashed var(--line); border-radius: 10px; padding: 18px;
  background: #fafbfc; line-height: 1.8;
}
.formGrid { display: grid; grid-template-columns: 96px 1fr; gap: 10px 12px; align-items: center; }
.formGrid label { color: var(--muted); text-align: right; font-size: 13px; }
.formGrid .full { grid-column: 1 / -1; }
.req::after { content: " *"; color: var(--danger); }
.issuesBox { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.logBox { font-size: 12px; color: var(--muted); white-space: pre-wrap; }

/* ---------- 页签 ---------- */
.subtabs { display: flex; gap: 6px; margin-bottom: 12px; }
.subtabs button.active { background: #eef3ff; border-color: var(--brand); color: var(--brand); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: #1f2328; color: #fff; padding: 10px 16px; border-radius: 10px;
  opacity: 0; pointer-events: none; transition: .2s; max-width: 80vw;
}
.toast.show { opacity: .95; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); }

/* ---------- 统计 ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.kpi b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.kpi span { color: var(--muted); font-size: 12px; }
