:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1d2430;
  --muted: #5f6b7a;
  --line: #d9e0e8;
  --blue: #1769e0;
  --blue-dark: #0f56bd;
  --green: #1a8f4c;
  --green-bg: #e8f7ee;
  --red: #c62828;
  --red-bg: #fdecec;
  --amber: #a86400;
  --amber-bg: #fff5df;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  font-size: 18px;
  line-height: 1.6;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

/* 顶栏 */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 22px 0 18px;
}
.topbar h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: 1px;
}
.topbar .sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 17px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}
.brand-logo {
  width: 68px;
  height: 68px;
  flex: 0 0 auto;
  border-radius: 18px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, .16);
}
.brand-text {
  min-width: 0;
}

/* 步骤条 */
.steps {
  display: flex;
  gap: 10px;
  padding-top: 22px;
  padding-bottom: 6px;
}
.step {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #e9edf3;
  color: #7b8796;
  border-radius: 999px;
  padding: 12px 10px;
  font-size: 18px;
  font-weight: 700;
}
.step .num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #cfd7e2;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.step.active {
  background: var(--blue);
  color: #fff;
}
.step.active .num {
  background: rgba(255,255,255,.25);
}
.step.done {
  background: var(--green-bg);
  color: var(--green);
}
.step.done .num {
  background: var(--green);
}

main {
  padding-top: 18px;
  padding-bottom: 40px;
}

/* 上传区 */
.dropzone {
  background: var(--card);
  border: 3px dashed #b9c6d8;
  border-radius: 18px;
  padding: 48px 24px;
  text-align: center;
  transition: border-color .15s, background .15s;
}
.dropzone.over {
  border-color: var(--blue);
  background: #eef4ff;
}
.dz-icon {
  font-size: 54px;
  line-height: 1;
  color: var(--blue);
  font-weight: 300;
}
.dz-title {
  font-size: 26px;
  font-weight: 700;
  margin-top: 10px;
}
.dz-hint {
  color: var(--muted);
  margin-top: 6px;
  font-size: 17px;
}
.dz-or {
  margin-top: 18px;
  color: #8a95a3;
  font-size: 15px;
}

/* 按钮 */
.btn {
  border: 0;
  border-radius: 10px;
  font-family: inherit;
  font-size: 19px;
  font-weight: 700;
  padding: 13px 24px;
  cursor: pointer;
  transition: background .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--blue);
  color: #fff;
}
.btn.primary:hover { background: var(--blue-dark); }
.btn.primary:disabled {
  background: #b8c4d4;
  cursor: not-allowed;
}
.btn.ghost:disabled {
  opacity: .5;
  cursor: not-allowed;
}
.btn.ghost:disabled:hover { background: #fff; }
.btn.ghost {
  background: #fff;
  color: var(--blue);
  border: 1px solid #b9cce8;
}
.btn.ghost:hover { background: #eef4ff; }
.btn.big {
  font-size: 21px;
  padding: 16px 34px;
  margin-top: 20px;
}
.dz-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.btn.small {
  font-size: 16px;
  padding: 9px 16px;
}
.btn.danger {
  background: var(--red);
  color: #fff;
}
.btn.danger:hover { background: #a32222; }

.fail-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px 16px;
  background: var(--red-bg);
  border: 1px solid #f0b4b4;
  border-radius: 10px;
}
.fail-bar[hidden] { display: none; }
.fail-text {
  color: var(--red);
  font-size: 17px;
  font-weight: 700;
}
.demo-row {
  text-align: center;
  margin-top: 18px;
}

/* 卡片 */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 18px;
  box-shadow: 0 1px 3px rgba(24, 39, 64, .06);
}
.card-title {
  margin: 0;
  font-size: 22px;
}
.card-sub {
  margin: 6px 0 18px;
  color: var(--muted);
  font-size: 16px;
}
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* 表单 */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field > span:first-child {
  font-size: 17px;
  font-weight: 700;
}
.auto-tag {
  font-style: normal;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  background: #eef1f5;
  border-radius: 999px;
  padding: 1px 8px;
  margin-left: 6px;
  vertical-align: middle;
}
.auto-tag.ok {
  color: var(--green);
  background: var(--green-bg);
}
.auto-tag.need {
  color: var(--amber);
  background: var(--amber-bg);
}
.field input {
  font-family: inherit;
  font-size: 19px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  outline: none;
}
.field input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(23, 105, 224, .14);
}
.field textarea {
  font-family: inherit;
  font-size: 17px;
  line-height: 1.5;
  padding: 11px 14px;
  border: 2px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  outline: none;
  resize: vertical;
  min-height: 62px;
}
.field textarea::placeholder { color: #a6b0bd; }
.field textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(23, 105, 224, .14);
}
.field-note {
  margin-top: 18px;
}
.field input.invalid {
  border-color: var(--red);
  background: #fffafa;
}
.field .err {
  color: var(--red);
  font-size: 14px;
  min-height: 20px;
}

/* 齐全度 */
.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.checklist li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--green-bg);
  color: #126638;
  font-size: 17px;
}
.checklist li.miss {
  background: var(--red-bg);
  color: var(--red);
}
.checklist .mark {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex: 0 0 auto;
}
.checklist li.miss .mark { background: var(--red); }

.miss-hint {
  margin: 14px 0 0;
  font-size: 16px;
  line-height: 1.6;
  color: var(--red);
  background: var(--red-bg);
  border-radius: 9px;
  padding: 10px 14px;
}
.miss-hint.ok {
  color: #126638;
  background: var(--green-bg);
}
.miss-hint:empty { display: none; }

.pill {
  display: inline-block;
  background: var(--green-bg);
  color: var(--green);
  border-radius: 999px;
  padding: 2px 12px;
  font-size: 15px;
  font-weight: 700;
  vertical-align: middle;
}
.pill.gray {
  background: #eef1f5;
  color: var(--muted);
}
.pill.bad {
  background: var(--red-bg);
  color: var(--red);
}

/* 识别条 */
.recognize-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px 14px;
  background: #eef4ff;
  border-radius: 10px;
}
.recognize-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.recognize-bar .btn {
  font-size: 18px;
  padding: 11px 22px;
}
.progress-text {
  color: var(--muted);
  font-size: 16px;
}
.progress-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}
.progress-track {
  flex: 1;
  height: 12px;
  background: #d7e3f8;
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #1769e0, #2e8bff);
  transition: width .3s ease;
}
.progress-fill.done { background: linear-gradient(90deg, #1a8f4c, #35b56a); }
.progress-pct {
  min-width: 52px;
  text-align: right;
  font-size: 16px;
  font-weight: 700;
  color: var(--blue);
  font-variant-numeric: tabular-nums;
}
.progress-pct.done { color: var(--green); }

/* 文件列表 */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.empty {
  text-align: center;
  color: var(--muted);
  padding: 30px 10px;
  font-size: 17px;
}
.file-row {
  display: grid;
  grid-template-columns: 66px 1fr 230px 150px 82px 40px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfe;
}
.file-row.unknown {
  border-color: #f0c36b;
  background: var(--amber-bg);
}
.thumb {
  width: 66px;
  height: 66px;
  border-radius: 8px;
  object-fit: cover;
  background: #e6ebf2;
  border: 1px solid var(--line);
  cursor: zoom-in;
}
.file-name {
  min-width: 0;
}
.file-name .orig {
  font-size: 15px;
  color: var(--muted);
  word-break: break-all;
}
.file-name .new {
  font-size: 17px;
  font-weight: 700;
  margin-top: 2px;
  word-break: break-all;
}
.file-name .new.warn { color: var(--amber); }
.file-name .new.bad { color: var(--red); }

.file-row select,
.file-row input {
  font-family: inherit;
  font-size: 16px;
  padding: 9px 10px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  width: 100%;
  outline: none;
}
.type-cell {
  min-width: 0;
}
.type-name {
  font-size: 16px;
  font-weight: 700;
  word-break: break-all;
}
.type-name.pending {
  color: var(--muted);
  font-weight: 400;
}
.type-select {
  margin-top: 6px;
}
.type-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  margin-top: 2px;
}
.link-btn {
  border: 0;
  background: none;
  color: var(--blue);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 0;
}
.link-btn:hover {
  text-decoration: underline;
}
.file-row select:focus,
.file-row input:focus { border-color: var(--blue); }

.status {
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  border-radius: 999px;
  padding: 5px 8px;
}
.status.ok { background: var(--green-bg); color: var(--green); }
.status.warn { background: var(--amber-bg); color: var(--amber); }
.status.bad { background: var(--red-bg); color: var(--red); }
.status.dup { background: #eef1f5; color: var(--muted); }
.status.skip { background: #eef1f5; color: #7a8593; }

.file-row.duplicate {
  background: #f6f7f9;
  border-style: dashed;
}
.file-row.duplicate .thumb { opacity: .45; }

.file-row.skipped {
  background: #f4f5f7;
  border-style: dashed;
  opacity: .72;
}
.file-row.skipped .thumb { filter: grayscale(1); }
.file-row.skipped .file-name .new { color: var(--muted); }

.checklist .miss-detail {
  font-size: 14px;
  font-weight: 400;
  opacity: .9;
  margin-left: 2px;
}

.icon-btn {
  border: 0;
  background: transparent;
  color: #98a3b1;
  font-size: 22px;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
}
.icon-btn:hover { background: var(--red-bg); color: var(--red); }

/* 导出条 */
.export-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: #fff;
  border-top: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 16px 22px;
  box-shadow: 0 -4px 18px rgba(24, 39, 64, .08);
  margin-top: 8px;
}
.export-info #export-hint {
  font-size: 18px;
  font-weight: 700;
}
.export-info .export-sub {
  color: var(--muted);
  font-size: 15px;
  margin-top: 2px;
}
.export-bar .btn { margin-top: 0; }

/* 提示 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: #1d2430;
  color: #fff;
  font-size: 17px;
  padding: 12px 22px;
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 50;
  max-width: 90vw;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.foot {
  color: #8a95a3;
  font-size: 14px;
  padding-bottom: 30px;
  text-align: center;
}

/* 图片放大 */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 20, .88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 24px 96px;
  z-index: 80;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 94vw;
  max-height: 78vh;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 48px rgba(0, 0, 0, .55);
}
.lightbox-close {
  position: fixed;
  top: 18px;
  right: 22px;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
  color: #fff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}
.lightbox-close:hover { background: rgba(255, 255, 255, .3); }
.lightbox-back {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 999px;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  padding: 12px 30px;
  cursor: pointer;
}
.lightbox-back:active { background: rgba(255, 255, 255, .3); }

/* 帮助 */
.help-fab {
  position: fixed;
  right: 22px;
  bottom: 120px;
  height: 48px;
  padding: 0 20px;
  border-radius: 999px;
  border: 0;
  background: var(--blue);
  color: #fff;
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(23, 105, 224, .35);
  z-index: 40;
}
.help-fab:hover {
  background: var(--blue-dark);
}
.help-mask {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .5);
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 60;
}
.help-mask.show {
  display: flex;
}
.help-panel {
  position: relative;
  background: #fff;
  border-radius: 16px;
  max-width: 620px;
  width: 100%;
  max-height: 86vh;
  overflow: auto;
  padding: 30px 32px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
.help-panel h2 {
  margin: 0 0 12px;
  font-size: 26px;
}
.help-panel h3 {
  margin: 22px 0 8px;
  font-size: 19px;
  color: var(--blue);
}
.help-panel p,
.help-panel li {
  font-size: 17px;
  line-height: 1.8;
}
.help-panel ol,
.help-panel ul {
  padding-left: 22px;
  margin: 0;
}
.help-close {
  position: absolute;
  top: 12px;
  right: 14px;
  border: 0;
  background: transparent;
  font-size: 28px;
  color: var(--muted);
  cursor: pointer;
}
.help-panel .btn {
  margin-top: 22px;
  width: 100%;
}

/* 窄屏 */
@media (max-width: 820px) {
  .form-grid,
  .checklist { grid-template-columns: 1fr; }
  .file-row {
    grid-template-columns: 56px 1fr 44px;
    grid-template-areas:
      "thumb name del"
      "type type type"
      "status status status"
      "owner owner owner";
  }
  .thumb { grid-area: thumb; width: 56px; height: 56px; }
  .file-name { grid-area: name; }
  .file-row .type-cell { grid-area: type; }
  .file-row .owner-input { grid-area: owner; }
  .file-row .status { grid-area: status; justify-self: start; }
  .file-row .icon-btn { grid-area: del; }
  .export-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .export-bar .btn { width: 100%; }
  .topbar h1 { font-size: 24px; }
  .brand { gap: 12px; }
  .brand-logo { width: 54px; height: 54px; border-radius: 14px; }
  .step { font-size: 15px; padding: 9px 6px; }
  .step .num { width: 24px; height: 24px; font-size: 13px; }
  .help-fab { bottom: 170px; right: 16px; }
}
