* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f4f6f9; color: #1a1a2e; font-size: 14px;
}
.wrap { max-width: 1600px; margin: 0 auto; padding: 22px 26px 60px; }

/* ── 顶栏 ─────────────────────────────────────────────── */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.topbar h1 { font-size: 20px; font-weight: 700; letter-spacing: .3px; }
.topbar-actions { display: flex; gap: 9px; }

/* ── 颜色说明 ─────────────────────────────────────────── */
.legend-bar {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 11px;
  padding: 8px 15px; display: flex; align-items: center; gap: 18px;
  flex-wrap: wrap; margin-bottom: 12px;
}
.legend-title { font-size: 12px; font-weight: 600; color: #94a3b8; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; color: #475569; }
.sw { width: 13px; height: 13px; border-radius: 4px; display: inline-block; border: 2px solid; }
.legend-hint { margin-left: auto; font-size: 12px; color: #b6bfcc; }

/* 三档状态配色 */
.st-none { background: #fef2f2; border-color: #fca5a5; color: #b91c1c; }
.st-qs   { background: #fffbeb; border-color: #fcd34d; color: #b45309; }
.st-done { background: #ecfdf5; border-color: #6ee7b7; color: #047857; }

/* ── 筛选栏 ───────────────────────────────────────────── */
.filter-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.filter-bar select, .filter-bar input {
  padding: 7px 11px; border: 1px solid #d1d5db; border-radius: 8px;
  font-size: 13px; outline: none; background: #fff; font-family: inherit;
}
.filter-bar select:focus, .filter-bar input:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.1); }
.filter-bar input { min-width: 180px; }
.summary { margin-left: auto; font-size: 12.5px; color: #94a3b8; white-space: nowrap; }
.summary span { white-space: nowrap; }
.summary b { color: #334155; }

/* ── 按钮 ─────────────────────────────────────────────── */
.btn {
  padding: 8px 16px; border-radius: 8px; border: none; font-size: 13.5px;
  cursor: pointer; font-weight: 500; display: inline-flex; align-items: center;
  gap: 5px; white-space: nowrap; transition: all .15s; font-family: inherit;
}
.btn-primary { background: #6366f1; color: #fff; } .btn-primary:hover { background: #4f46e5; }
.btn-danger  { background: #ef4444; color: #fff; } .btn-danger:hover  { background: #dc2626; }
.btn-ghost   { background: #fff; color: #475569; border: 1px solid #d1d5db; } .btn-ghost:hover { background: #f8fafc; }
.btn-secondary { background: #e5e7eb; color: #374151; } .btn-secondary:hover { background: #d1d5db; }
.btn-sm { padding: 5px 12px; font-size: 12.5px; border-radius: 7px; }
.btn-xs { padding: 3px 9px; font-size: 12px; border-radius: 6px; }

/* ── 批量选择 ─────────────────────────────────────────── */
.batch-checkbox { width: 18px; height: 18px; cursor: pointer; flex-shrink: 0; accent-color: #6366f1; }
.batch-selected-badge {
  background: #6366f1; color: #fff; border-radius: 20px; padding: 2px 10px;
  font-size: 12px; font-weight: 600; margin-left: 4px; display: none;
}
.batch-selected-badge.show { display: inline-flex; }
.card-batch-row { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ── 商品卡片 ─────────────────────────────────────────── */
.cards-grid { display: flex; gap: 12px; align-items: flex-start; }
/* 每列是一条独立的竖排：展开卡片只推动本列下方的卡片，其他列不受影响 */
.cards-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.card { background: #fff; border: 1px solid #e5e7eb; border-radius: 13px; box-shadow: 0 1px 2px rgba(0,0,0,.04); page-break-inside: avoid; }

/* ── 紧凑行（折叠态）──────────────────────────────────── */
/* 左：勾选 + 箭头 + 商品名（占满剩余宽度）；右：品类 · 到货 · 进度条 · 数字 */
.card-row { display: flex; align-items: center; gap: 10px; padding: 12px 15px; cursor: pointer; border-radius: 12px; }
.card-row:hover { background: #f8fafc; }
.card.open .card-row { border-bottom: 1px solid #f1f5f9; border-radius: 12px 12px 0 0; }
.card-row .p-name {
  flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-size: 14.5px; font-weight: 600; color: #0f172a;
}
.caret { color: #cbd5e1; font-size: 11px; width: 12px; flex-shrink: 0; text-align: center; transition: transform .2s; }
.card.open .caret { transform: rotate(90deg); }

/* 右侧群组：全部固定宽度、不换行，形成一条对齐的竖栏 */
.cat-tag {
  font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 20px;
  background: #eef2ff; color: #4f46e5; white-space: nowrap; flex-shrink: 0;
  min-width: 34px; text-align: center;
}
.arrived-tag {
  font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 20px;
  white-space: nowrap; flex-shrink: 0; cursor: pointer; transition: opacity .15s;
}
.arrived-tag:hover { opacity: .75; }
.arrived-yes { background: #d1fae5; color: #065f46; }
.arrived-no  { background: #f1f5f9; color: #94a3b8; }
.arrived-restricted { background: #fee2e2; color: #991b1b; }

.p-count {
  min-width: 40px; text-align: right; font-size: 12.5px; color: #94a3b8;
  flex-shrink: 0; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.p-count b { font-weight: 700; color: #334155; }
.p-count.done b { color: #059669; }

/* ── 折叠态隐藏详情区 ─────────────────────────────────── */
.card .card-body { display: none; }
.card.open .card-body { display: block; }

/* ── 进度条 ───────────────────────────────────────────── */
.pbar { display: flex; width: 62px; height: 6px; border-radius: 99px; overflow: hidden; background: #eef1f5; flex-shrink: 0; }
.pbar i { display: block; height: 100%; }
.pbar .s-none { background: #f87171; }
.pbar .s-qs   { background: #fbbf24; }
.pbar .s-done { background: #34d399; }
.pbar-empty { background: #f1f5f9; }

/* ── 展开后的详情区 ───────────────────────────────────── */
.card-body { padding: 12px 16px 14px; }
.body-meta { margin-bottom: 8px; }
.card-body .p-remark { margin-bottom: 10px; max-height: 110px; }
.card-actions { display: flex; gap: 8px; justify-content: flex-end; margin-bottom: 12px; }
.card-body .cells { padding: 0; }
.p-approval { font-size: 12px; color: #94a3b8; font-family: ui-monospace, Consolas, monospace; }

/* 备注区（红框位置） */
.p-remark {
  flex: 1; min-width: 240px; font-size: 13.5px; color: #334155;
  background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 8px;
  padding: 8px 12px; cursor: text; transition: all .15s;
  line-height: 1.6; white-space: pre-wrap; word-break: break-word;
  max-height: 138px; overflow: auto;
}
.p-remark:hover { border-color: #6366f1; background: #fff; }
.p-remark.empty { color: #b6bfcc; }
.p-remark textarea {
  width: 100%; border: none; outline: none; font-size: 13.5px;
  font-family: inherit; background: transparent; color: #0f172a;
  resize: none; line-height: 1.6; display: block; overflow: hidden;
}

/* ── 店铺格子 ─────────────────────────────────────────── */
.cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 9px; padding: 15px 20px; }

.chip {
  border: 2px solid; border-radius: 10px; padding: 9px 11px; cursor: pointer;
  transition: transform .12s, box-shadow .12s; display: flex; flex-direction: column; gap: 5px;
}
.chip:hover { transform: translateY(-2px); box-shadow: 0 5px 14px rgba(0,0,0,.1); }
.chip .c-store { font-size: 12.5px; font-weight: 600; opacity: .85; line-height: 1.3; }
.chip .c-status { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.chip .c-status .dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.chip .c-sku { font-size: 11.5px; opacity: .75; line-height: 1.4; word-break: break-all; }

/* ── 弹窗 ─────────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.45);
  backdrop-filter: blur(3px); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal { background: #fff; border-radius: 15px; max-width: 96vw; max-height: 90vh; overflow-y: auto; box-shadow: 0 24px 60px rgba(0,0,0,.25); }
.modal-head { padding: 20px 24px 0; display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { font-size: 17px; font-weight: 700; }
.x { background: none; border: none; font-size: 19px; cursor: pointer; color: #9ca3af; line-height: 1; }
.x:hover { color: #374151; }
.modal-body { padding: 20px 24px; }
.modal-foot { padding: 0 24px 20px; display: flex; gap: 10px; justify-content: flex-end; }

/* ── 表单 ─────────────────────────────────────────────── */
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: #475569; margin-bottom: 6px; }
.field input, .field select {
  width: 100%; padding: 9px 12px; border: 1px solid #d1d5db; border-radius: 8px;
  font-size: 13.5px; outline: none; font-family: inherit;
}
.field input:focus, .field select:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.1); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.tip { font-size: 12px; color: #94a3b8; margin-top: 5px; line-height: 1.5; }

/* 状态选择大按钮 */
.status-pick { display: flex; flex-direction: column; gap: 9px; }
.status-btn {
  display: flex; align-items: center; gap: 11px; padding: 13px 15px;
  border: 2px solid #e5e7eb; border-radius: 10px; background: #fff;
  cursor: pointer; font-size: 14.5px; font-weight: 600; color: #64748b;
  transition: all .15s; font-family: inherit; text-align: left;
}
.status-btn:hover { border-color: #c7d2fe; }
.status-btn .sw { width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0; }
.status-btn.on { color: #0f172a; }
.status-btn.on.st-none { border-color: #ef4444; background: #fef2f2; }
.status-btn.on.st-qs   { border-color: #f59e0b; background: #fffbeb; }
.status-btn.on.st-done { border-color: #10b981; background: #ecfdf5; }

/* ── 店铺管理列表 ─────────────────────────────────────── */
.store-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #f1f5f9; }
.store-row:last-child { border-bottom: none; }
.store-row .s-name { flex: 1; font-size: 14px; font-weight: 500; }
.store-row input { flex: 1; padding: 7px 11px; border: 1px solid #d1d5db; border-radius: 7px; font-size: 13.5px; outline: none; font-family: inherit; }
.add-store { display: flex; gap: 9px; margin-top: 14px; padding-top: 14px; border-top: 1px solid #f1f5f9; }
.add-store input { flex: 1; padding: 9px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 13.5px; outline: none; font-family: inherit; }

.empty { padding: 50px 20px; text-align: center; color: #94a3b8; font-size: 13.5px; line-height: 2; background: #fff; border: 1px solid #e5e7eb; border-radius: 13px; }

/* ── 筛选隐藏格子 ───────────────────────────────────────── */
.hidden-chip { display: none; }

/* ── Toast ────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; right: 24px; background: #1e293b; color: #fff;
  padding: 12px 22px; border-radius: 10px; font-size: 13.5px; z-index: 999;
  animation: slideIn .25s ease; box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
@keyframes slideIn { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ─── 登录/注册页 ───────────────────────────────────────── */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-box {
  background: white;
  border-radius: 16px;
  padding: 40px;
  width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-box h2 {
  text-align: center;
  margin-bottom: 30px;
  color: #1e293b;
  font-size: 24px;
}
.error-msg {
  color: #dc2626;
  font-size: 14px;
  margin-bottom: 15px;
  text-align: center;
  min-height: 20px;
}
.btn-block { width: 100%; }

/* ─── 用户管理 ─────────────────────────────────────────── */
.user-list { margin-bottom: 24px; }
.user-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px;
  background: #f8fafc;
  border-radius: 10px;
  margin-bottom: 10px;
}
.user-info { display: flex; flex-direction: column; gap: 4px; }
.user-name { font-weight: 600; color: #1e293b; }
.user-meta { font-size: 12px; color: #94a3b8; }
.user-actions { display: flex; gap: 8px; align-items: center; }
.role-select {
  padding: 6px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 13px;
}

/* ─── 操作日志 ─────────────────────────────────────────── */
.log-list { max-height: 500px; overflow-y: auto; }
.log-item {
  padding: 12px;
  background: #f8fafc;
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 13px;
}
.log-time { color: #94a3b8; font-size: 12px; }
.log-user { color: #6366f1; font-weight: 600; }
.log-action { color: #1e293b; font-weight: 600; }
.log-detail { color: #475569; margin-top: 4px; }

/* ─── 用户信息标签 ─────────────────────────────────────── */
.legend-user {
  background: #fef3c7;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  color: #92400e;
}
