:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1f2329;
  --muted: #8a9099;
  --line: #e9ebef;
  --brand: #4f46e5;
  --brand-soft: #eef0ff;
  --danger: #e5484d;
  --ok: #2f9e44;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(20, 23, 28, 0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
/* 预留滚动条空间，避免页面内容高度变化时出现/消失滚动条导致画面晃动 */
html { scrollbar-gutter: stable; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* 滚动条样式统一（桌面端） */
@media (min-width: 860px) {
  ::-webkit-scrollbar { width: 12px; height: 12px; }
  ::-webkit-scrollbar-thumb { background: #d0d3da; border-radius: 8px; border: 3px solid var(--bg); }
  ::-webkit-scrollbar-thumb:hover { background: #b8bcc6; }
  ::-webkit-scrollbar-track { background: transparent; }
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 14px; }

/* ---------- 通用按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--text);
  padding: 8px 14px; border-radius: 10px; font-size: 14px; transition: .15s;
}
.btn:hover { border-color: #d3d6db; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: #4338ca; }
.btn-danger { color: var(--danger); border-color: #f3c2c4; }
.btn-danger:hover { background: #fdecec; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }

/* ---------- 顶部栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; background: rgba(255,255,255,.85); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--brand); }
.topbar .links { display: flex; gap: 8px; }

.container { max-width: 1280px; margin: 0 auto; padding: 20px; }

/* ---------- 产品目录（前台） ---------- */
.section-title { font-size: 20px; font-weight: 700; margin: 8px 0 18px; }
/* 一行 2 个 600 宽卡片（2×560+24gap+40padding=1184px） */
.grid {
  display: grid; gap: 24px;
  grid-template-columns: repeat(auto-fill, minmax(560px, 600px));
  justify-content: center; /* 居中 */
}
@media (max-width: 1240px) {
  .grid { grid-template-columns: minmax(0, 600px); justify-content: center; }
}
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s;
  cursor: pointer;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(20,23,28,.1); }
.card .thumb {
  aspect-ratio: 16 / 9; /* 600x337.5 比例 */
  background: #eceef1 center/cover no-repeat;
  display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px;
  position: relative;
}
.card .body { padding: 16px 18px 18px; }
.card .name { font-weight: 700; font-size: 20px; }
.card .desc { color: var(--muted); font-size: 14px; margin-top: 6px; line-height: 1.6; }
.price { color: var(--brand); font-weight: 700; }

/* 团购倒计时角标 */
.countdown-badge {
  position: absolute; top: 12px; right: 12px;
  background: rgba(229,72,77,.92); color: #fff; font-size: 13px; font-weight: 600;
  padding: 5px 12px; border-radius: 20px; letter-spacing: .5px;
  display: flex; align-items: center; gap: 4px; box-shadow: 0 4px 14px rgba(229,72,77,.4);
}
.countdown-badge span { font-variant-numeric: tabular-nums; font-weight: 700; }
.countdown-badge.ended { background: rgba(60,64,70,.8); }
.countdown-badge.notstart { background: rgba(37,99,235,.9); box-shadow: 0 4px 14px rgba(37,99,235,.4); }

/* ---------- 详情弹层（前台选色） ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,18,24,.55); z-index: 50;
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-mask.open { display: flex; }
.modal {
  background: #fff; border-radius: 18px; width: 100%; max-width: 920px; max-height: 92vh;
  overflow: auto; display: grid; grid-template-columns: 1.1fr 1fr;
}
.modal .gallery { padding: 18px; background: #fafbfc; }
.modal .gallery .main {
  aspect-ratio: 1 / 1; border-radius: 12px; background: #eceef1 center/cover no-repeat;
  margin-bottom: 12px;
}
.modal .gallery .thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.modal .gallery .thumbs img {
  width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 2px solid transparent; cursor: pointer;
}
.modal .gallery .thumbs img.active { border-color: var(--brand); }
.modal .info { padding: 26px 24px; position: relative; }
.modal .info .close {
  position: absolute; top: 14px; right: 16px; border: none; background: transparent;
  font-size: 22px; color: var(--muted);
}
.modal .info h2 { margin: 0 0 6px; font-size: 22px; }
.modal .info .desc { color: var(--muted); font-size: 14px; margin-bottom: 16px; }
.swatches { display: flex; gap: 18px; flex-wrap: wrap; margin: 20px 0 6px; padding-bottom: 34px; }
.swatch {
  width: 56px; height: 56px; border-radius: 50%; cursor: pointer; position: relative;
  border: 3px solid #fff; box-shadow: 0 0 0 1.5px var(--line);
  transition: transform .12s, box-shadow .12s;
}
.swatch:hover { transform: scale(1.08); }
.swatch.active { box-shadow: 0 0 0 3px var(--brand), 0 4px 14px rgba(79,70,229,.3); }
.swatch .label {
  position: absolute; bottom: -30px; left: 50%; transform: translateX(-50%);
  font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap;
}
.specs { list-style: none; padding: 0; margin: 12px 0; }
.specs li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.specs li span:first-child { color: var(--muted); }
.modal .price-lg { font-size: 26px; font-weight: 800; color: var(--brand); margin: 10px 0; }
.stock-tag { font-size: 13px; color: var(--ok); }
.stock-tag.out { color: var(--danger); }

/* ---------- 管理后台 ---------- */
.admin { display: grid; grid-template-columns: 280px 1fr; gap: 18px; align-items: start; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.prod-list { padding: 12px; }
.prod-list h3 { margin: 4px 8px 10px; font-size: 14px; color: var(--muted); }
.prod-item {
  display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; cursor: pointer;
}
.prod-item:hover { background: var(--brand-soft); }
.prod-item.active { background: var(--brand-soft); outline: 1px solid var(--brand); }
.prod-item .mini {
  width: 40px; height: 40px; border-radius: 8px; background: #eceef1 center/cover no-repeat; flex: none;
}
.prod-item .t { font-size: 14px; font-weight: 600; }
.prod-item .s { font-size: 12px; color: var(--muted); }
.prod-item .pi-main { flex: 1; min-width: 0; }
.prod-item .pi-main .t, .prod-item .pi-main .s { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 上市/下市开关 */
.pi-switch {
  flex: none; display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
  padding: 3px 7px 3px 3px; border-radius: 16px; font-size: 11px; font-weight: 600;
  transition: background .15s; user-select: none; border: none;
}
.pi-switch .pi-sw-thumb {
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s;
}
.pi-switch.on { background: var(--ok); color: #fff; }
.pi-switch.on .pi-sw-thumb { transform: translateX(0); }
.pi-switch.off { background: #d5d8de; color: #6b7280; }
.pi-switch.off .pi-sw-thumb { transform: translateX(-3px); }

.editor { padding: 20px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input[type=text], .field input[type=number], .field textarea, .field input[type=color] {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--text);
}
.field textarea { min-height: 64px; resize: vertical; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row .field { flex: 1; min-width: 140px; }
.subhead { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 12px; }
.subhead h3 { margin: 0; font-size: 16px; }

.sku-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 14px; background: #fcfcfd; }
.sku-card .sku-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.color-dot { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); flex: none; }

.attr-row { display: flex; gap: 8px; margin-bottom: 6px; }
.attr-row input { flex: 1; }
.attr-row .btn { flex: none; }

.img-grid { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.img-cell {
  width: 84px; height: 84px; border-radius: 10px; overflow: hidden; position: relative;
  border: 1px solid var(--line); background: #eee; cursor: grab;
}
.img-cell.dragging { opacity: .4; }
.img-cell img { width: 100%; height: 100%; object-fit: cover; }
.img-cell .del {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(0,0,0,.6); color: #fff; border: none; font-size: 12px; line-height: 1;
}
.img-cell .ord {
  position: absolute; bottom: 3px; left: 3px; background: var(--brand); color: #fff;
  font-size: 11px; padding: 1px 6px; border-radius: 6px;
}

/* ---------- 零件标题 ---------- */
.part-header {
  display: flex; align-items: center; gap: 10px; margin: 10px 0 14px; padding: 10px 14px;
  background: var(--brand-soft); border: 1px solid #e2e5ff; border-radius: 12px; flex-wrap: wrap;
}
.part-header .ph-badge {
  width: 26px; height: 26px; border-radius: 8px; background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: none;
}
.part-header .pt-name {
  flex: 1; min-width: 140px; border: 1px solid #dfe3ff; background: #fff; border-radius: 8px;
  padding: 7px 10px; font-weight: 600;
}
.part-header .ph-label { color: var(--muted); font-size: 13px; }
.part-header .pt-z { width: 60px; padding: 6px 8px; border: 1px solid #dfe3ff; border-radius: 8px; text-align: center; font-size: 13px; }

/* ---------- SKU 卡片（摘要行 + 可折叠详情）---------- */
.sku-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 4px; margin-bottom: 8px;
}
.sku-card { border: 1px solid var(--line); border-radius: 14px; margin-bottom: 8px; background: #fff; overflow: hidden; box-shadow: 0 1px 2px rgba(20,23,28,.03); }
.sku-card.open { border-color: var(--brand); box-shadow: 0 2px 10px rgba(79,70,229,.1); }

/* 摘要行 */
.sku-summary {
  display: flex; align-items: center; gap: 12px; padding: 8px 14px; cursor: pointer;
  background: #fff; transition: background .15s;
}
.sku-summary:hover { background: #fafbff; }
.sku-card.open .sku-summary { background: var(--brand-soft); border-bottom: 1px solid var(--line); }
.sku-summary .sum-arrow { font-size: 12px; color: var(--muted); width: 14px; flex: none; }
.sku-summary .sum-thumb {
  width: 44px; height: 44px; border-radius: 10px; background: #eceef1 center/cover no-repeat;
  flex: none; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 10px;
  border: 1px solid var(--line);
}
.sku-summary .sum-main { flex: 1; min-width: 0; }
.sku-summary .sum-name { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.sku-summary .sum-tag {
  font-style: normal; font-size: 10px; background: var(--brand); color: #fff;
  border-radius: 6px; padding: 1px 6px; flex: none;
}
.sku-summary .sum-sub { display: flex; gap: 10px; font-size: 12px; color: var(--muted); margin-top: 2px; }
.sku-summary .sum-sub .qc-tag { color: var(--danger); font-weight: 700; }
.sku-summary .sum-price { font-size: 14px; font-weight: 700; color: var(--brand); flex: none; }
.sku-summary .sum-dot {
  width: 20px; height: 20px; border-radius: 50%; flex: none;
  border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line);
}
.sku-summary .del-opt { flex: none; }

.sku-detail { border-top: 1px solid var(--line); }
.sku-detail > .sku-head {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px;
  background: #f7f8fa;
}
.sku-head .thumb {
  width: 64px; height: 64px; border-radius: 12px; background: #eceef1 center/cover no-repeat;
  flex: none; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 11px;
  border: 1px solid var(--line);
}
.sku-head .name-field { flex: 1; min-width: 0; }
.sku-head .name-field .o-name {
  width: 100%; font-size: 16px; font-weight: 600; border: none; background: transparent;
  padding: 2px 0; margin-bottom: 8px;
}
.sku-head .name-field .o-name:focus { outline: none; border-bottom: 2px solid var(--brand); }
.sku-head .del-btn { flex: none; }
.sku-sub { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sku-sub .sub-item label {
  display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px;
}
.sku-sub .sub-item input { font-size: 13px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; width: 100%; }

/* 三栏 */
.sku-cols { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0; }
.sku-cols .sku-col { padding: 16px 18px; border-right: 1px solid var(--line); }
.sku-cols .sku-col:last-child { border-right: none; }
.sku-col h4 {
  margin: 0 0 12px; font-size: 12px; color: var(--muted); font-weight: 700; letter-spacing: .5px;
  text-transform: uppercase; display: flex; align-items: center; gap: 6px;
}
.sku-col h4::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.sku-col .field { margin-bottom: 12px; }
.sku-col .field:last-child { margin-bottom: 0; }

/* 色板 */
.color-row { display: flex; align-items: center; gap: 10px; }
.color-row input[type=color] { width: 56px; height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 3px; background: #fff; cursor: pointer; }
.color-row .hex-val { font-size: 13px; color: var(--muted); background: var(--bg); padding: 4px 8px; border-radius: 6px; }

/* 图片选择 */
.img-pick { width: 100%; }
.img-preview-box.big {
  width: 100%; height: 130px; border-radius: 12px; overflow: hidden; position: relative;
  background: var(--bg); display: flex; align-items: center; justify-content: center;
  border: 2px dashed var(--line); cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.img-preview-box.big:hover { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.img-preview-box.big img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-preview-box.big .pick-hint {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 600; letter-spacing: .3px;
  background: rgba(20,23,28,.45); opacity: 0; transition: opacity .15s;
}
.img-preview-box.big:hover .pick-hint { opacity: 1; }
.img-preview-box.big .pick-placeholder { text-align: center; color: var(--muted); font-size: 13px; line-height: 1.6; }
.img-preview-box.big .pick-placeholder small { font-size: 11px; }
.img-pick-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

/* 属性栏 */
.chk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; margin-bottom: 12px; }
.chk-row {
  display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 14px; cursor: pointer;
}
.chk-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--brand); }

/* 删除产品确认弹窗 */
.del-box {
  background: #fff; border-radius: 16px; padding: 24px 26px; width: 100%; max-width: 400px;
  box-shadow: 0 20px 60px rgba(15,18,24,.3);
}
.del-box h3 { margin: 0 0 8px; font-size: 18px; color: var(--danger); }
.del-box .muted { margin: 0 0 16px; line-height: 1.7; }
.del-box .muted b { color: var(--danger); }
.del-box input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 15px; letter-spacing: 1px;
}
.del-box input:focus { outline: none; border-color: var(--danger); box-shadow: 0 0 0 3px rgba(229,72,77,.12); }
.del-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.del-actions .btn { min-width: 90px; }
.del-actions .btn:disabled { opacity: .45; cursor: not-allowed; }

/* 产品操作按钮（产品名称右侧，与输入框垂直居中） */
.name-row { align-items: center; }
.fab-btns { display: flex; gap: 8px; align-items: center; flex: none; }
.fab-btns .btn { min-width: 96px; }

/* 封面/背景图 label 居中 */
.center-label { text-align: center; }

/* 画布尺寸 + 封面/背景图 两列布局 */
.setup-row {
  display: flex; flex-direction: column; gap: 16px; margin-bottom: 4px;
}
.setup-cols-2 { display: flex; gap: 24px; flex-wrap: wrap; }
.setup-row .setup-cols-2 { justify-content: center; }
.setup-row .setup-cols-2 > .field { flex: 1 1 0; max-width: 400px; min-width: 240px; }

/* 封面 / 背景图 卡片 */
.img-opt { display: flex; align-items: center; justify-content: center; gap: 12px; }
.img-opt .img-preview-box {
  width: 256px; height: 144px; border-radius: 12px; border: 2px dashed var(--line);
  background: var(--bg); overflow: hidden; cursor: pointer; flex: none;
  transition: border-color .15s, box-shadow .15s;
  display: flex; align-items: center; justify-content: center; position: relative;
}
.img-opt .img-preview-box:hover { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.img-opt .img-preview-box img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-opt .img-preview-box.empty::after {
  content: '点击选择图片'; font-size: 12px; color: var(--muted); text-align: center;
}
/* 图片框右上角 hover × 清除按钮 */
.img-del {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0,0,0,.65); color: #fff; border: none; font-size: 14px; line-height: 1;
  cursor: pointer; opacity: 0; transition: opacity .15s; z-index: 2;
}
.img-preview-box:hover .img-del { opacity: 1; }
.img-del:hover { background: var(--danger); }

/* 媒体库选择器 */
.picker {
  background: #fff; border-radius: 18px; width: 100%; max-width: 1020px; height: 84vh;
  display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(15,18,24,.3);
}
.picker-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.picker-head strong { font-size: 15px; }
.picker-head-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.picker-body { flex: 1; display: flex; min-height: 0; }
.picker-side {
  width: 230px; flex: none; border-right: 1px solid var(--line); padding: 12px; overflow: auto;
}
.picker-side .media-side-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.picker-side .media-side-head h3 { margin: 0; font-size: 14px; }
.picker-main { flex: 1; padding: 14px 18px; overflow: auto; }
.picker-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px;
}
.picker-cell {
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer;
  background: #fff; transition: border-color .15s, box-shadow .15s, transform .15s;
}
.picker-cell:hover { border-color: var(--brand); box-shadow: 0 6px 18px rgba(79,70,229,.15); transform: translateY(-2px); }
.picker-cell img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; background: #eee; }
.picker-cell span {
  display: block; font-size: 11px; color: var(--muted); padding: 5px 7px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.empty { color: var(--muted); font-size: 14px; padding: 30px; text-align: center; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1f2329; color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 100;
}
.toast.show { opacity: 1; }

.muted { color: var(--muted); font-size: 13px; }
.landing .row { display: flex; }

/* ---------- 配置器 ---------- */
/* 配置器铺满全屏 */
#configurator { max-width: none; }
.cfg-head { margin: 6px 0 16px; }
.cfg-head h2 { margin: 0 0 6px; font-size: 28px; }
.cfg-head .muted { margin: 0; font-size: 15px; }

/* 画布大图 + 右侧零件面板 */
.cfg { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 20px; align-items: start; }
.cfg-left { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cfg-stage {
  background: #fafbfc; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; box-shadow: var(--shadow); position: relative; min-height: 480px;
  display: flex; align-items: center; justify-content: center;
}
.cfg-stage canvas {
  /* 固定 2560x1440 (16:9) 显示窗口：宽度撑满，高度按比例；最大宽度受视口高度约束 */
  width: 100%; height: auto;
  max-width: min(100%, calc((100vh - 220px) * 16 / 9));
  display: block; border-radius: 12px; cursor: zoom-in; background:
    linear-gradient(45deg, #eee 25%, transparent 25%) -10px 0/20px 20px,
    linear-gradient(-45deg, #eee 25%, transparent 25%) -10px 0/20px 20px,
    linear-gradient(45deg, transparent 75%, #eee 75%) -10px 0/20px 20px,
    linear-gradient(-45deg, transparent 75%, #eee 75%) -10px 0/20px 20px, #fff;
}
.cfg-stage .stage-zoom {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  background: rgba(15,18,24,.7); color: #fff; border: none; border-radius: 10px;
  padding: 7px 14px; font-size: 14px; cursor: pointer; opacity: .85; transition: opacity .15s;
}
.cfg-stage .stage-zoom:hover { opacity: 1; }
.cfg-stage .stage-hint {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  background: rgba(15,18,24,.6); color: #fff; border-radius: 20px; padding: 4px 14px;
  font-size: 12px; opacity: 0; transition: opacity .2s; pointer-events: none;
}
.cfg-stage:hover .stage-hint { opacity: 1; }

/* 全屏灯箱（可缩放平移） */
.zoom-box {
  position: relative; max-width: 96vw; max-height: 96vh; display: flex; flex-direction: column;
  align-items: center; gap: 8px;
}
.zoom-box .close {
  position: absolute; top: -40px; right: 0; border: none; background: rgba(0,0,0,.6); color: #fff;
  font-size: 18px; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; z-index: 3;
}
.zoom-controls {
  display: flex; align-items: center; gap: 6px; background: rgba(15,18,24,.75); color: #fff;
  padding: 6px 10px; border-radius: 30px; z-index: 3;
}
.zoom-controls .btn { background: rgba(255,255,255,.15); color: #fff; border: none; font-size: 16px; line-height: 1; padding: 4px 10px; }
.zoom-controls .btn:hover { background: rgba(255,255,255,.3); }
.zoom-controls #z-scale { font-size: 13px; min-width: 52px; text-align: center; font-variant-numeric: tabular-nums; }
.zoom-viewport {
  width: 94vw; height: calc(96vh - 90px); overflow: hidden; position: relative;
  display: flex; align-items: center; justify-content: center;
  cursor: grab; touch-action: none;
}
.zoom-viewport:active { cursor: grabbing; }
.zoom-viewport img {
  max-width: 100%; max-height: 100%; object-fit: contain; user-select: none;
  will-change: transform; transform-origin: center center;
  box-shadow: 0 12px 50px rgba(0,0,0,.5); background:
    linear-gradient(45deg, #eee 25%, transparent 25%) -10px 0/20px 20px,
    linear-gradient(-45deg, #eee 25%, transparent 25%) -10px 0/20px 20px,
    linear-gradient(45deg, transparent 75%, #eee 75%) -10px 0/20px 20px,
    linear-gradient(-45deg, transparent 75%, #eee 75%) -10px 0/20px 20px, #fff;
}
.zoom-box .muted { color: #d8dbe0; }
.cfg-panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); position: sticky; top: 70px; max-height: calc(100vh - 90px);
  overflow: auto;
}
.cfg-panel h2 { margin: 0 0 4px; font-size: 20px; }

/* 零件页签 */
.part-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.part-tab {
  display: flex; align-items: center; gap: 8px; padding: 10px 16px; border: 1px solid var(--line);
  border-radius: 12px; background: #fff; font-size: 15px; font-weight: 500; cursor: pointer; transition: .15s;
}
.part-tab:hover { border-color: var(--brand); }
.part-tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.part-tab em {
  font-style: normal; font-size: 13px; background: var(--brand-soft); color: var(--brand);
  border-radius: 9px; padding: 1px 8px; line-height: 18px; font-weight: 700;
}
.part-tab.active em { background: rgba(255,255,255,.25); color: #fff; }
.part-tab small {
  font-size: 13px; opacity: .85; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.part-block { padding: 6px 0; }
.part-name { font-size: 17px; font-weight: 700; margin-bottom: 14px; }

/* SKU 卡片式选择 */
.sku-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.sku-pick {
  border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 12px;
  background: #fff; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s;
  display: flex; flex-direction: column; gap: 6px;
}
.sku-pick:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(79,70,229,.12); }
.sku-pick.active { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft), 0 6px 16px rgba(79,70,229,.18); }
.sku-pick .sp-head { display: flex; align-items: center; gap: 8px; }
.sku-pick .sp-dot {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line);
}
.sku-pick .sp-name { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sku-pick .sp-line { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.sku-pick .sp-line b { color: var(--text); font-weight: 600; }
.sku-pick .sp-price {
  font-size: 16px; font-weight: 800; color: var(--brand); margin-top: 2px;
  border-top: 1px dashed var(--line); padding-top: 6px;
}
.sku-pick .sp-price i { font-style: normal; font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 8px; }

/* 操作栏（画布下方，与画布同宽） */
.cfg-bar {
  padding: 14px 18px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.cfg-summary {
  display: flex; gap: 20px; align-items: center; flex-wrap: wrap; font-size: 18px; font-weight: 600;
  background: var(--brand-soft); border-radius: 12px; padding: 12px 18px; color: var(--text);
}
.cfg-summary .sum-label {
  font-size: 13px; font-weight: 700; color: #fff; background: var(--brand); border-radius: 20px;
  padding: 3px 12px; letter-spacing: .5px;
}
.cfg-summary b { color: var(--brand); font-size: 20px; }
.cfg-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-left: auto; }
.cfg-actions .btn { font-size: 15px; padding: 10px 18px; }
.code-box { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; display: flex; align-items: center; gap: 12px; }
.code-box .muted { white-space: nowrap; font-size: 13px; }
.code-box code { display: block; font-size: 18px; font-weight: 700; color: var(--brand); letter-spacing: .5px; word-break: break-all; }

/* ---------- 媒体库 ---------- */
.media { display: grid; grid-template-columns: 240px 1fr; gap: 18px; align-items: start; }
.media-side { padding: 14px; }
.media-side-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.media-side-head h3 { margin: 0; font-size: 15px; }
.tree-row { display: flex; align-items: center; gap: 2px; }
.tree-arrow {
  width: 18px; height: 20px; flex: none; display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--muted); cursor: pointer; border-radius: 4px; user-select: none;
}
.tree-arrow:hover { background: #e6e8f0; }
.tree-arrow.none { cursor: default; }
.tree-arrow.none:hover { background: none; }
.tree-label {
  flex: 1; display: flex; align-items: center; gap: 6px; padding: 5px 6px; border-radius: 8px;
  cursor: pointer; font-size: 14px; color: var(--text); overflow: hidden; white-space: nowrap;
}
.tree-label:hover { background: var(--brand-soft); }
.tree-label.active { background: var(--brand-soft); outline: 1px solid var(--brand); font-weight: 600; }
.tree-label em {
  font-style: normal; font-size: 11px; color: var(--muted); background: var(--bg);
  border-radius: 8px; padding: 0 6px; line-height: 16px; margin-left: auto; flex: none;
}
.tree-children { margin-left: 14px; border-left: 1px dashed var(--line); padding-left: 4px; }
.tree-del {
  flex: none; width: 18px; height: 18px; border-radius: 50%; margin-right: 4px;
  display: flex; align-items: center; justify-content: center; font-size: 12px; line-height: 1;
  color: var(--muted); background: transparent; border: none; cursor: pointer;
  opacity: 0; transition: opacity .15s, background .15s, color .15s;
}
.tree-row:hover .tree-del { opacity: 1; }
.tree-del:hover { background: var(--danger); color: #fff; }
.media-main { padding: 14px; min-height: 420px; }
.media-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.breadcrumb { font-size: 14px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.crumb { color: var(--brand); cursor: pointer; }
.crumb-cur { color: var(--text); font-weight: 600; cursor: default; }
.sep { color: var(--muted); }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.media-cell {
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff;
  transition: box-shadow .15s;
}
.media-cell:hover { box-shadow: var(--shadow); }
.media-cell .m-thumb {
  aspect-ratio: 1 / 1; background: #eceef1 center/cover no-repeat; cursor: pointer;
}
.media-cell .m-name {
  font-size: 12px; color: var(--muted); padding: 6px 8px 2px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.media-cell .m-actions { display: flex; align-items: center; gap: 4px; padding: 4px 6px 8px; }
.media-cell .m-actions select {
  font-size: 12px; padding: 3px 4px; border: 1px solid var(--line); border-radius: 6px; max-width: 92px;
}

/* 灯箱 */
.lightbox {
  background: #fff; border-radius: 14px; padding: 12px; max-width: 90vw; max-height: 90vh;
  position: relative; display: flex; flex-direction: column;
}
.lightbox .close {
  position: absolute; top: -4px; right: 4px; border: none; background: transparent;
  font-size: 24px; color: var(--muted); z-index: 2;
}
.lightbox img { max-width: 100%; max-height: 78vh; object-fit: contain; border-radius: 8px; }

/* 通用确认/输入弹窗 */
.mz-dialog {
  background: #fff; border-radius: 16px; padding: 24px 26px; width: 100%; max-width: 420px;
  box-shadow: 0 20px 60px rgba(15,18,24,.3); display: flex; flex-direction: column; gap: 12px;
}
.mz-dialog h3 { margin: 0; font-size: 17px; }
.mz-dialog .muted { margin: 0; line-height: 1.7; }
.mz-dialog input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 14px; display: none;
}
.mz-dialog input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.mz-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.mz-actions .btn { min-width: 90px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1000px) {
  .cfg { grid-template-columns: 1fr; }
  .cfg-panel { position: static; max-height: none; }
  .cfg-stage { min-height: 0; }
  .cfg-actions { margin-left: 0; }
  .cfg-stage canvas { max-width: 100%; }
}
@media (max-width: 860px) {
  .sku-cols { grid-template-columns: 1fr; }
  .sku-cols .sku-col { border-right: none; border-bottom: 1px solid var(--line); padding: 14px 18px; }
  .sku-cols .sku-col:last-child { border-bottom: none; }
  .media { grid-template-columns: 1fr; }
  .media-side { max-height: 200px; overflow: auto; }
}
@media (max-width: 820px) {
  .admin { grid-template-columns: 1fr; }
  .modal { grid-template-columns: 1fr; max-height: 94vh; }
  .modal .gallery { padding: 14px; }
  .container { padding: 14px; }
}
@media (max-width: 520px) {
  .card .name { font-size: 17px; }
  .topbar { padding: 12px 14px; }
}
