* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: #f5f7fa; color: #1f2937; min-height: 100vh;
}
header {
  background: #fff; border-bottom: 1px solid #e5e7eb;
  display: flex; align-items: center; gap: 16px;
  padding: 14px 24px; position: sticky; top: 0; z-index: 10;
}
header h1 { font-size: 18px; flex: 1; }
header .who { color: #6b7280; font-size: 14px; }
button {
  background: #2563eb; color: #fff; border: none; border-radius: 8px;
  padding: 10px 18px; font-size: 14px; cursor: pointer;
}
button:hover { background: #1d4ed8; }
button.secondary { background: #fff; color: #374151; border: 1px solid #d1d5db; }
button.secondary:hover { background: #f3f4f6; }
button.danger { background: #fff; color: #dc2626; border: 1px solid #fca5a5; }
input, textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid #d1d5db;
  border-radius: 8px; font-size: 14px; font-family: inherit;
}
input:focus, textarea:focus { outline: none; border-color: #2563eb; }
main { max-width: 960px; margin: 24px auto; padding: 0 16px; }
.card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
  padding: 24px; margin-bottom: 20px;
}
.card h2 { font-size: 16px; margin-bottom: 16px; }
.hint { color: #6b7280; font-size: 13px; margin-bottom: 12px; }
.center { display: flex; align-items: center; justify-content: center; }
.login-card { width: 360px; display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { text-align: center; font-size: 22px; margin-bottom: 8px; }
textarea { min-height: 220px; resize: vertical; font-family: monospace; }
.row { display: flex; gap: 12px; align-items: center; }
.row > * { flex: 1; }
#msg { margin-top: 12px; font-size: 14px; }
#msg.ok { color: #16a34a; }
#msg.err { color: #dc2626; }
.stats { display: flex; gap: 16px; margin-bottom: 20px; }
.stat { flex: 1; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 20px; text-align: center; }
.stat .num { font-size: 28px; font-weight: 700; }
.stat .label { color: #6b7280; font-size: 13px; margin-top: 4px; }
.progress-bar { height: 10px; background: #e5e7eb; border-radius: 5px; overflow: hidden; margin: 12px 0; }
.progress-bar > div { height: 100%; background: #2563eb; transition: width .3s; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #f3f4f6; }
th { color: #6b7280; font-weight: 500; }
.fail-list { max-height: 200px; overflow-y: auto; background: #fef2f2; border-radius: 8px; padding: 10px; font-size: 13px; margin-top: 8px; }
.fail-list div { padding: 2px 0; }
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: #fff; border-radius: 12px; padding: 24px; width: 360px; display: flex; flex-direction: column; gap: 12px; }
.hidden { display: none; }

/* ---- 浏览页 ---- */
.browse-main { max-width: 1200px; }
.searchbar { display: flex; gap: 12px; margin-bottom: 16px; }
.searchbar input { flex: 1; }
.searchbar button { flex: 0; }
.tabs { display: flex; gap: 12px; margin-bottom: 16px; }
.tab {
  background: #fff; color: #374151; border: 1px solid #d1d5db;
  border-radius: 8px; padding: 10px 20px; font-size: 15px;
}
.tab.active { background: #2563eb; color: #fff; border-color: #2563eb; }
.tab .cnt { font-size: 13px; opacity: .85; }
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.cell {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
  overflow: hidden; cursor: pointer; position: relative; aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
}
.cell:hover { border-color: #2563eb; box-shadow: 0 2px 8px rgba(37,99,235,.15); }
.cell img { width: 100%; height: 100%; object-fit: cover; }
.cell .sku-label {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 6px;
  font-size: 11px; color: #fff; background: rgba(0,0,0,.55);
  text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cell.noimg .sku-label {
  position: static; height: 100%; display: flex; align-items: center;
  justify-content: center; background: transparent; color: #9ca3af; font-size: 12px;
}
.loadmore { text-align: center; margin: 20px 0; }
.empty { text-align: center; color: #9ca3af; padding: 60px 0; }

/* 大图查看器 */
.viewer {
  background: #fff; border-radius: 12px; overflow: hidden;
  width: min(92vw, 860px); max-height: 92vh; display: flex; flex-direction: column;
}
.viewer-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid #e5e7eb;
}
.view-sku { font-weight: 600; font-size: 16px; flex: 1; }
.viewer-actions { display: flex; gap: 8px; align-items: center; }
.btn-dl {
  background: #2563eb; color: #fff; border-radius: 8px;
  padding: 10px 18px; font-size: 14px; text-decoration: none;
}
.viewer-body {
  flex: 1; overflow: auto; display: flex; align-items: center; justify-content: center;
  background: #f5f7fa; padding: 16px;
}
.viewer-body img { max-width: 100%; max-height: 70vh; object-fit: contain; }

