:root {
  --bg: #f4f6f8;
  --card: #fff;
  --text: #1a2332;
  --muted: #6b7785;
  --line: #e3e8ee;
  --accent: #0f6e56;
  --accent-soft: #e6f4ef;
  --danger: #b42318;
  --warn: #b54708;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 24px rgba(16, 24, 40, 0.04);
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 400px at 10% -10%, #d9efe7 0%, transparent 55%),
    radial-gradient(900px 360px at 100% 0%, #e8eef8 0%, transparent 50%),
    var(--bg);
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
body.page-orders .wrap,
body.page-shops .wrap,
body.page-previews .wrap { width: min(1680px, calc(100% - 24px)); }
.topnav {
  background: rgba(255,255,255,0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.topnav .wrap {
  display: flex; align-items: center; gap: 24px; min-height: 58px;
}
.brand { font-weight: 700; color: var(--text); letter-spacing: 0.02em; }
.topnav .links { display: flex; gap: 4px; flex: 1; }
.topnav .links a {
  padding: 8px 12px; border-radius: 8px; color: var(--muted); font-weight: 500;
}
.topnav .links a.active, .topnav .links a:hover {
  background: var(--accent-soft); color: var(--accent); text-decoration: none;
}
.topnav .right { display: flex; align-items: center; gap: 10px; }
.topnav .user { color: var(--muted); font-size: 14px; }
.page { padding: 28px 0 48px; }
h1 { margin: 0 0 6px; font-size: 28px; letter-spacing: -0.02em; }
.sub { color: var(--muted); margin: 0 0 22px; }
.grid { display: grid; gap: 16px; }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 20px; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px;
}
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 28px; font-weight: 700; margin-top: 4px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; background: var(--accent); color: #fff;
  border-radius: 8px; padding: 8px 14px; font-weight: 600; cursor: pointer;
  font-size: 14px;
}
.btn:hover { filter: brightness(1.05); text-decoration: none; }
.btn.ghost { background: #fff; color: var(--text); border-color: var(--line); }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.alert {
  padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px;
}
.alert.ok { background: #ecfdf3; color: #067647; border: 1px solid #abefc6; }
.alert.err { background: #fef3f2; color: var(--danger); border: 1px solid #fecdca; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
tr:hover td { background: #fafbfc; }
.form-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 12px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input, select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; font: inherit; background: #fff;
}
textarea { min-height: 72px; resize: vertical; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 16px; }
.pager { display: flex; gap: 8px; align-items: center; margin-top: 16px; color: var(--muted); font-size: 14px; }
.thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; background: #eee; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; background: #f2f4f7; color: #344054; font-weight: 600;
}
.badge.ok { background: #ecfdf3; color: #067647; }
.badge.warn { background: #fffaeb; color: var(--warn); }
.badge.err { background: #fef3f2; color: var(--danger); }
tr.shop-row-sync-fail > td {
  background: #fef3f2 !important;
  box-shadow: inset 3px 0 0 var(--danger);
}
tr.shop-row-sync-fail .shop-label { color: var(--danger); }
/* 履约状态 · 贴近 Shopify Admin */
.badge.ful-unfulfilled,
.badge.ful-partial,
.badge.ful-pending {
  background: #ffea8a;
  color: #5c4e00;
}
.badge.ful-fulfilled {
  background: #aee9d1;
  color: #0b7b3e;
}
.badge.ful-progress,
.badge.ful-scheduled {
  background: #a4e8f2;
  color: #003d5c;
}
.badge.ful-hold,
.badge.ful-restocked {
  background: #e4e5e7;
  color: #4a4a4a;
}
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.login-card {
  width: min(400px, 100%); background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow); padding: 28px;
}
.login-card h1 { font-size: 22px; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.shop-picker { position: relative; }
.shop-dropdown {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30;
  max-height: 280px; overflow: auto; background: #fff;
  border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow);
}
.shop-opt {
  padding: 8px 10px; cursor: pointer; font-size: 14px; border-bottom: 1px solid #f2f4f7;
}
.shop-opt:hover { background: var(--accent-soft); }
.shop-opt:last-child { border-bottom: 0; }
.shop-opt .mono { font-size: 12px; display: block; margin-top: 2px; }
.sk5-shops { min-width: 240px; }
.sk5-shop-list { display: flex; flex-direction: column; gap: 6px; max-height: 180px; overflow: auto; }
.sk5-shop-item {
  position: relative; padding: 6px 28px 6px 8px;
  border: 1px solid var(--line); border-radius: 6px; background: #fafbfc;
}
.sk5-shop-item .btn-unbind-shop {
  position: absolute; top: 4px; right: 4px; padding: 2px 7px; min-width: 0; line-height: 1.2;
}
.sk5-shop-picker input.sk5-shop-q { width: 100%; padding: 5px 8px; font-size: 13px; }
.user-shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
  margin-top: 10px;
  max-height: 420px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbfc;
}
.user-shop-opt {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 0;
  font-size: 13px;
  padding: 6px 8px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #eef1f5;
}
.user-shop-opt:hover { border-color: #c7d2fe; background: var(--accent-soft); }
.user-shop-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
}
@media (max-width: 720px) {
  .topnav .wrap { flex-wrap: wrap; padding: 8px 0; }
  .topnav .links { width: 100%; overflow-x: auto; }
}
.help-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 16px;
}
.help-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.help-toolbar {
  flex-wrap: wrap; gap: 4px; margin-bottom: 8px; padding: 6px 8px;
  border: 1px solid var(--line); border-bottom: 0; border-radius: 8px 8px 0 0;
  background: #f8fafc;
}
.help-editor {
  min-height: 420px; background: #fff;
  border: 1px solid var(--line); border-radius: 0 0 8px 8px;
}
.help-card .ql-container.ql-snow { border: 0; font-size: 15px; }
.help-card .ql-editor { min-height: 420px; }
.help-card .ql-editor img { max-width: 100%; }
.help-card .ql-disabled { background: #fafbfc; }
.bulk-log {
  margin: 0; white-space: pre-wrap; font-size: 13px; line-height: 1.5;
  max-height: 320px; overflow: auto; background: #f8fafc; padding: 10px; border-radius: 8px;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}
.preview-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.preview-card.is-busy { opacity: 0.72; }
.preview-card.is-err { border-color: #fecdca; }
.preview-shot {
  position: relative;
  aspect-ratio: 1920 / 1080;
  background: #eef2f6;
  cursor: zoom-in;
}
.preview-shot.has-empty { cursor: pointer; }
.preview-shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}
.preview-shot .ph {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 13px; text-align: center; padding: 12px;
}
.preview-shot .busy {
  position: absolute; inset: 0;
  background: rgba(15, 23, 42, 0.45);
  color: #fff; font-size: 13px; font-weight: 600;
  display: none; align-items: center; justify-content: center;
}
.preview-card.is-busy .busy { display: flex; }
.preview-lightbox {
  position: fixed; inset: 0; z-index: 80;
  display: none; align-items: center; justify-content: center;
  background: rgba(15, 23, 42, 0.84);
  padding: 20px;
  cursor: zoom-out;
}
.preview-lightbox.is-open { display: flex; }
.preview-lightbox .box {
  max-width: min(1920px, 96vw);
  max-height: 92vh;
  display: flex; flex-direction: column; gap: 10px;
  cursor: default;
}
.preview-lightbox img {
  display: block; max-width: 96vw; max-height: calc(92vh - 52px);
  object-fit: contain; background: #fff; border-radius: 8px;
}
.preview-lightbox .cap {
  color: #e2e8f0; font-size: 13px; text-align: center; line-height: 1.45;
}
.preview-lightbox .cap strong { color: #fff; }
.preview-lightbox .x {
  position: absolute; top: 12px; right: 16px;
  border: 0; background: transparent; color: #fff;
  font-size: 28px; line-height: 1; cursor: pointer; padding: 4px 8px;
}
.preview-meta { padding: 8px 10px 10px; min-width: 0; }
.preview-meta .name {
  font-weight: 700; font-size: 13px; line-height: 1.35;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.preview-meta .domain {
  font-size: 11px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 2px;
}
.preview-meta .primary {
  font-size: 11px; color: #0f172a;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 2px;
}
.preview-meta .when { font-size: 11px; color: var(--muted); margin-top: 4px; }
.preview-meta .err { font-size: 11px; color: var(--danger); margin-top: 4px; }
.preview-meta .row-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
@media (max-width: 1400px) {
  .preview-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .preview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
