:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1a1d26;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary: #f3f4f6;
  --secondary-hover: #e5e7eb;
  --danger: #dc2626;
  --warn: #d97706;
  --ok: #059669;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.04);
  --font: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}
.wrap {
  width: min(1100px, 96vw);
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}
.header { text-align: center; margin-bottom: 1.5rem; }
.header h1 {
  margin: 0 0 0.35rem;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.subtitle { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.95rem; }
.subtitle.subtle { font-size: 0.85rem; opacity: 0.9; }
.card {
  width: 100%;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.75rem 1.75rem;
  margin-bottom: 1.1rem;
}
.card h2 { margin: 0 0 0.35rem; font-size: 1.2rem; }
.card h3 { margin: 0 0 0.6rem; font-size: 1.05rem; }
.hint { margin: 0 0 1.1rem; color: var(--muted); font-size: 0.9rem; }
.hint.tight { margin: 0.25rem 0 0; }
.hint code {
  font-size: 0.85em;
  background: #f3f4f6;
  padding: 0.1em 0.35em;
  border-radius: 4px;
}
.file-drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  min-height: 140px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem;
  cursor: pointer;
  background: #fafbfc;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.file-drop:hover {
  border-color: var(--primary);
  background: #f8faff;
}
.file-drop.drag,
.file-drop.dragover {
  border-color: var(--primary);
  background: #eff6ff;
  border-style: solid;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.15);
}
.file-drop input[type="file"] {
  position: absolute;
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
}
.file-drop-icon {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #eff6ff;
  color: var(--primary);
  font-size: 1.15rem;
  font-weight: 700;
}
.file-label {
  color: var(--primary);
  font-weight: 600;
  font-size: 1.02rem;
}
.file-name {
  font-size: 0.85rem;
  color: var(--muted);
  word-break: break-all;
  text-align: center;
  max-width: 36rem;
}
.file-list {
  list-style: none;
  padding: 0;
  margin: 0.9rem 0 0;
  max-height: 180px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
.file-list:empty { display: none; }
.file-list li {
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}
.file-list li:last-child { border-bottom: none; }
.file-list .err { color: var(--danger); }
.actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  padding: 0.7rem 1.25rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, opacity 0.15s;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn.secondary { background: var(--secondary); color: var(--text); }
.btn.secondary:hover:not(:disabled) { background: var(--secondary-hover); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.progress { margin-top: 1rem; }
.progress.hidden, .hidden { display: none !important; }
.status {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  background: #f3f4f6;
}
.bar {
  height: 8px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}
.bar span {
  display: block;
  height: 100%;
  width: 30%;
  background: var(--primary);
  border-radius: 999px;
  animation: slide 1.2s infinite ease-in-out;
}
@keyframes slide {
  0% { transform: translateX(-100%); width: 30%; }
  50% { width: 60%; }
  100% { transform: translateX(250%); width: 30%; }
}
#progressText { margin: 0.55rem 0 0; color: var(--muted); font-size: 0.9rem; }
.result-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.result-head h2 { margin: 0; }
.count { color: var(--muted); font-weight: 500; font-size: 0.95rem; }
.table-wrap {
  overflow: auto;
  max-height: 480px;
  border: 1px solid var(--border);
  border-radius: 10px;
}
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th, td {
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}
th {
  background: #f9fafb;
  position: sticky;
  top: 0;
  z-index: 1;
  font-weight: 600;
}
tr.hard td { background: #fef2f2; }
tr.soft td { background: #fffbeb; }
.status-ok { color: var(--ok); font-weight: 600; }
.status-hard { color: var(--danger); font-weight: 600; }
.status-soft { color: var(--warn); }
.buyer-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}
.buyer-grid li {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fafbfc;
}
.buyer-grid .meta { color: var(--muted); font-size: 0.85rem; }
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 50;
}
.modal-box {
  background: #fff;
  border-radius: 12px;
  max-width: 560px;
  width: 100%;
  padding: 1.25rem 1.35rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}
.modal-box h3 { margin: 0 0 0.7rem; }
.modal-body { max-height: 360px; overflow: auto; font-size: 0.92rem; }
.modal-body .item { padding: 0.55rem 0; border-bottom: 1px solid var(--border); }
.modal-body .hard { color: var(--danger); }
.modal-body .soft { color: var(--warn); }
.modal-actions { margin-top: 1rem; text-align: right; }
@media (max-width: 640px) {
  .wrap { padding: 1.25rem 0.85rem 2rem; }
  .card { padding: 1.15rem 1.1rem 1.25rem; }
  .file-drop { min-height: 120px; }
}

.cell-warn { color: var(--danger); font-weight: 600; background: #fee2e2 !important; }
.flash {
  position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%);
  z-index: 40; max-width: min(560px, 92vw); padding: 0.7rem 1rem;
  border-radius: 10px; background: #111827; color: #fff; box-shadow: var(--shadow);
  font-size: 0.92rem;
}
.flash.error { background: #991b1b; }
.flash.hidden { display: none !important; }
