:root {
  --bg: #f6f7f9; --surface: #fff; --border: #e4e7ec; --text: #1c2434;
  --muted: #6b7484; --brand: #2f6bff; --brand-dark: #1f52d6;
  --ok: #0f9d58; --warn: #d98600; --err: #d92d20; --soft: #f0f4ff;
  --shadow: 0 1px 3px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.04);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; padding-bottom: 88px; }
.hidden { display: none !important; }

.topbar { height: 64px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 28px; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 20px; font-weight: 700; }
.brand h1 { font-size: 16px; margin: 0; font-weight: 650; }
.brand .sub { font-size: 12px; color: var(--muted); }
.conn { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.shop-tag { background: #f2f4f7; border: 1px solid var(--border); padding: 5px 10px; border-radius: 6px; font-weight: 500; color: var(--text); }
.arrow { color: var(--brand); font-weight: 700; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--warn); }
.status-dot.ok { background: var(--ok); } .status-dot.err { background: var(--err); }

main { max-width: 1240px; margin: 22px auto 0; padding: 0 24px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); margin-bottom: 18px; overflow: hidden; }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); font-size: 13px; }
.link { background: none; border: 0; color: var(--brand); cursor: pointer; font-size: 13px; }
.opt-grid { padding: 16px 18px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 18px; }
.opt-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 500; }
.opt-grid input[type=number], .opt-grid select { height: 34px; border: 1px solid var(--border); border-radius: 7px; padding: 0 10px; font-size: 13px; color: var(--text); background: #fff; outline: none; }
.opt-grid input:focus, .opt-grid select:focus { border-color: var(--brand); }
.opt-grid label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); padding-top: 18px; font-size: 13px; }
.opt-note { grid-column: 1 / -1; background: var(--soft); color: #42506b; padding: 9px 12px; border-radius: 7px; font-size: 12px; line-height: 1.6; }

.toolbar { display: flex; align-items: center; gap: 10px; padding: 14px 18px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.search-wrap { display: flex; align-items: center; gap: 7px; border: 1px solid var(--border); border-radius: 8px; padding: 0 10px; height: 36px; min-width: 290px; color: var(--muted); background: #fff; }
.search-wrap:focus-within { border-color: var(--brand); }
.search-wrap input { border: 0; outline: none; flex: 1; font-size: 13px; color: var(--text); background: transparent; }
.clear-search { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; }
.filters { display: flex; gap: 4px; background: #f2f4f7; padding: 3px; border-radius: 8px; }
.chip { border: 0; background: transparent; padding: 6px 12px; border-radius: 6px; font-size: 12px; color: var(--muted); cursor: pointer; }
.chip.active { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); font-weight: 600; }
.spacer { flex: 1; }
.btn { height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border); background: #fff; color: var(--text); font-size: 13px; cursor: pointer; font-weight: 500; }
.btn:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; padding: 0 22px; height: 42px; font-size: 14px; }
.btn.primary:hover:not(:disabled) { background: var(--brand-dark); color: #fff; }
.meta-line { padding: 9px 18px; font-size: 12px; color: var(--muted); }

.table-head, .row { display: grid; grid-template-columns: 42px minmax(280px, 1fr) 160px 70px 110px 110px; align-items: center; gap: 10px; padding: 0 18px; }
.table-head { height: 36px; background: #fafbfc; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); font-size: 12px; color: var(--muted); font-weight: 600; }
.row { min-height: 72px; border-bottom: 1px solid #f0f2f5; cursor: pointer; }
.row:hover { background: #fafbff; }
.row.selected { background: var(--soft); }
.c-check { display: flex; align-items: center; }
.row input[type=checkbox], .select-all-box { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }
.p-info { display: flex; align-items: center; gap: 12px; min-width: 0; }
.thumb { width: 50px; height: 50px; border-radius: 7px; border: 1px solid var(--border); object-fit: cover; background: #f2f4f7; flex-shrink: 0; }
.p-title { font-size: 13px; line-height: 1.4; font-weight: 500; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.p-id { font-size: 11px; color: #9aa3b2; margin-top: 3px; }
.cell { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; }
.badge { display: inline-block; font-size: 11px; padding: 3px 8px; border-radius: 20px; font-weight: 600; }
.badge.synced { background: #e7f6ee; color: var(--ok); }
.badge.unsynced { background: #f0f2f5; color: var(--muted); }
.empty { padding: 60px 20px; text-align: center; color: var(--muted); }

.actionbar { position: fixed; bottom: 0; left: 0; right: 0; height: 72px; background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -4px 18px rgba(16,24,40,.05); display: flex; align-items: center; justify-content: space-between; padding: 0 max(24px, calc((100vw - 1240px)/2 + 24px)); z-index: 20; }
.sel-info { font-size: 13px; color: var(--muted); }
.sel-info strong { color: var(--brand); font-size: 18px; margin-right: 3px; }

.modal-mask, .login-mask { position: fixed; inset: 0; background: rgba(18,25,40,.45); display: grid; place-items: center; z-index: 50; }
.modal { width: min(720px, 92vw); background: #fff; border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.2); overflow: hidden; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.progress { height: 6px; background: #eef1f5; }
.progress > div { height: 100%; width: 0; background: var(--brand); transition: width .3s; }
.progress-text { padding: 12px 20px 4px; font-size: 12px; color: var(--muted); }
.log { height: 300px; overflow: auto; padding: 8px 20px 20px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11.5px; line-height: 1.8; }
.log div { border-bottom: 1px dashed #f0f2f5; padding: 2px 0; }
.log .ok { color: var(--ok); } .log .warn { color: var(--warn); } .log .error { color: var(--err); }
.login-box { width: 360px; background: #fff; border-radius: 14px; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.login-box h2 { margin: 0 0 6px; font-size: 18px; }
.login-box p { color: var(--muted); font-size: 12px; margin: 0 0 18px; }
.login-box input { width: 100%; height: 40px; border: 1px solid var(--border); border-radius: 8px; padding: 0 12px; outline: none; }
.login-box button { width: 100%; height: 40px; margin-top: 14px; border: 0; border-radius: 8px; background: var(--brand); color: #fff; cursor: pointer; font-size: 14px; }
.login-err { color: var(--err); font-size: 12px; margin-top: 10px; }
@media (max-width: 860px) {
  .opt-grid { grid-template-columns: repeat(2, 1fr); }
  .table-head, .row { grid-template-columns: 36px minmax(160px,1fr) 60px 60px; }
  .table-head span:nth-child(3), .table-head span:nth-child(5), .table-head span:nth-child(6),
  .row .c-sku, .row .c-variants, .row .c-price, .row .c-status { display: none; }
  .conn { display: none; }
}
