/* ============================================================
   商城后台 · 组件与布局
   所有颜色 / 圆角 / 阴影 / 字体均引用 themes.css 的语义变量，
   单一浅色皮肤，本文件不含任何字面色值。
   ============================================================ */

/* 设计令牌统一定义在 themes.css */

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 14px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.hidden { display: none !important; }
button, input, select, textarea { font-family: inherit; font-size: 14px; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
::selection { background: rgba(var(--accent-rgb), .16); }

/* 细滚动条 */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 9px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================ 登录 ============================ */
.login-wrap {
  min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr;
  background: var(--surface);
}
.login-aside {
  position: relative; overflow: hidden; background: var(--side); color: var(--side-fg);
  padding: 56px 58px; display: flex; flex-direction: column; justify-content: space-between;
}
.login-aside::before {
  content: ""; position: absolute; inset: 0;
  background: var(--side-deco);
}
.login-aside::after {
  content: ""; position: absolute; inset: 0; opacity: .18;
  background-image: linear-gradient(var(--side-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--side-grid) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(160deg, #000 20%, transparent 78%);
}
.login-aside > * { position: relative; z-index: 1; }
.login-eyebrow { font-size: 10px; letter-spacing: .26em; text-transform: uppercase; color: var(--side-fg-dim); }
.login-quote { font-family: var(--font-display); font-size: clamp(30px, 3.2vw, 44px); line-height: 1.35; letter-spacing: .02em; margin: 0 0 18px; }
.login-quote em { font-style: normal; color: var(--red); }
.login-note { margin: 0; color: var(--side-fg-dim); font-size: 13px; letter-spacing: .02em; }
.login-meta { display: flex; gap: 34px; font-size: 12px; color: var(--side-fg-dim); }
.login-meta b { display: block; font-family: var(--font-num); font-size: 18px; color: var(--side-fg); font-weight: 500; letter-spacing: .02em; }

.login-card { width: min(400px, 100%); margin: auto; padding: 46px 0 60px; text-align: left; }
.login-logo {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 11px;
  background: var(--accent); color: var(--on-accent); font-family: var(--font-display); font-size: 22px;
  box-shadow: 0 6px 16px rgba(var(--accent-rgb), .26);
  overflow: hidden;
}
.login-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.login-card h1 { margin: 22px 0 6px; font-size: 24px; font-weight: 600; letter-spacing: .01em; }
.login-sub { margin: 0 0 32px; color: var(--muted); font-size: 13px; }
.login-card .field { margin-bottom: 16px; }
.login-error { color: var(--bad); min-height: 20px; margin: 10px 0 0; font-size: 12.5px; }
.login-hint { margin: 22px 0 0; color: var(--faint); font-size: 12px; line-height: 1.75; }

/* ============================ 框架 ============================ */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 226px; flex: none; background: var(--side); color: var(--side-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar::after { content: ""; position: absolute; inset: 0 0 0 auto; width: 1px; background: var(--side-border); }
.brand { display: flex; align-items: center; gap: 11px; padding: 26px 22px 22px; color: var(--side-fg); }
.brand-mark {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
  background: var(--accent); color: var(--on-accent); font-family: var(--font-display); font-size: 17px; flex: none;
}
.brand-name { font-size: 14.5px; font-weight: 600; letter-spacing: .08em; line-height: 1.2; }
.brand-en { display: block; font-size: 8.5px; letter-spacing: .22em; color: var(--side-fg-dim); margin-top: 3px; font-weight: 400; }

#nav { padding: 6px 10px 10px; display: flex; flex-direction: column; gap: 1px; }
.nav-group { padding: 16px 12px 7px; font-size: 9.5px; letter-spacing: .2em; color: var(--side-fg-dim); text-transform: uppercase; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 12px; border: 0; border-radius: 7px; background: transparent;
  color: var(--side-text); text-align: left; font-size: 13.5px; letter-spacing: .02em;
  transition: background .16s ease, color .16s ease;
}
.nav-item i { display: inline-grid; place-items: center; width: 17px; height: 17px; font-style: normal; opacity: .72; }
.nav-item i svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.nav-item:hover { background: var(--side-hover); color: var(--side-fg); }
.nav-item.active { background: var(--side-active); color: var(--side-fg); font-weight: 500; }
.nav-item.active::before {
  content: ""; position: absolute; left: -10px; top: 50%; transform: translateY(-50%);
  width: 2px; height: 16px; border-radius: 2px; background: var(--red);
}
.nav-item.active i { opacity: 1; color: var(--red); }

.sidebar-foot { margin-top: auto; padding: 16px 20px 20px; border-top: 1px solid var(--side-line); }
.cloud-state { font-size: 11.5px; color: var(--side-fg-dim); margin-bottom: 12px; display: flex; align-items: center; gap: 7px; }
.cloud-state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--side-fg-dim); }
.cloud-state.ok::before { background: var(--ok); box-shadow: 0 0 0 3px rgba(var(--ok-rgb), .14); }
.cloud-state.bad::before { background: var(--bad); box-shadow: 0 0 0 3px rgba(var(--bad-rgb), .14); }
.build-tag { margin-top: 10px; font-family: var(--font-num); font-size: 11px; letter-spacing: .04em; color: var(--side-fg-dim); }
.sidebar .btn.ghost {
  width: 100%; border-color: var(--side-border-strong); color: var(--side-fg); background: transparent;
  border-radius: 6px; padding: 7px 10px; font-size: 12.5px;
}
.sidebar .btn.ghost:hover { background: var(--side-hover); color: var(--side-fg); border-color: var(--side-border-strong); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: 68px; flex: none;
  background: var(--glass-bg); backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line); padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.topbar h2 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: .01em; line-height: 1.35; }
.topbar p { margin: 1px 0 0; color: var(--muted); font-size: 12px; letter-spacing: .01em; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.content { padding: 24px 28px 80px; flex: 1; min-width: 0; animation: fade-up .32s ease; }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ============================ 按钮 ============================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 0 14px; height: 34px; border-radius: var(--r); font-size: 13px;
  transition: background .16s ease, border-color .16s ease, color .16s ease, transform .08s ease;
  white-space: nowrap;
}
.btn:hover { border-color: var(--line-strong); background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 1px 2px rgba(var(--accent-rgb), .22); }
.btn.primary:hover { background: var(--red-deep); border-color: var(--red-deep); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--hover-soft); border-color: transparent; }
.btn.small { height: 28px; padding: 0 11px; font-size: 12px; }
.btn.sm { height: 26px; padding: 0 10px; font-size: 12px; border-radius: 6px; }
.btn.block { width: 100%; height: 38px; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad-line); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid rgba(var(--accent-rgb), .35); outline-offset: 1px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }

.seg { display: inline-flex; background: var(--surface-3); border-radius: 8px; padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; height: 27px; padding: 0 13px; border-radius: 6px;
  color: var(--muted); font-size: 12px; transition: all .16s ease;
}
.seg button:hover { color: var(--ink); }
.seg button.active { background: var(--surface); color: var(--ink); font-weight: 500; box-shadow: 0 1px 3px var(--shadow-soft); }

/* ============================ 卡片 / 看板 ============================ */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 18px;
}
.card h3 { margin: 0 0 16px; font-size: 14.5px; font-weight: 600; letter-spacing: .01em; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.card-head h3 { margin: 0; }
.muted { color: var(--muted); font-size: 12px; }
.mono { font-family: var(--font-num); font-size: 12px; letter-spacing: .01em; }
.price { font-variant-numeric: tabular-nums; }
b { font-weight: 600; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 16px 18px 15px; box-shadow: var(--shadow); overflow: hidden;
}
.kpi::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: transparent;
}
.kpi.accent::after { background: linear-gradient(90deg, var(--red), rgba(var(--accent-rgb), .06)); }
.kpi.profit::after { background: linear-gradient(90deg, var(--jade), rgba(var(--jade-rgb), .06)); }
.kpi .label {
  color: var(--muted); font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  display: flex; align-items: center; gap: 6px;
}
.kpi .value {
  font-family: var(--font-display); font-size: 27px; font-weight: 600; line-height: 1.25;
  margin-top: 8px; letter-spacing: .01em; font-variant-numeric: tabular-nums;
}
.kpi .sub { font-size: 12px; color: var(--faint); margin-top: 5px; }
.kpi.accent .value { color: var(--ink); }
.kpi.profit .value { color: var(--jade); }

.notice {
  display: flex; align-items: flex-start; gap: 10px; position: relative;
  background: var(--amber-soft); border: 1px solid var(--warn-line); color: var(--warn-ink);
  padding: 11px 14px 11px 40px; border-radius: var(--r); font-size: 12.5px; margin-bottom: 16px; line-height: 1.7;
}
.notice::before {
  content: "!"; position: absolute; left: 14px; top: 11px; width: 17px; height: 17px;
  display: grid; place-items: center; border-radius: 50%; background: var(--warn); color: var(--on-accent);
  font-size: 11px; font-weight: 700;
}
.notice.info { background: var(--blue-soft); border-color: var(--blue-line); color: var(--blue-ink); }
.notice.info::before { content: "i"; background: var(--blue); font-family: var(--font-display); }

.chart { display: flex; align-items: flex-end; gap: 8px; height: 188px; padding: 12px 4px 0; border-bottom: 1px solid var(--line-soft); }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 7px; min-width: 0; }
.chart-col:hover .chart-bar { filter: saturate(1.15) brightness(1.04); }
.chart-bar {
  width: 58%; max-width: 38px; min-height: 2px; border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--chart-top), var(--red));
  transition: height .4s cubic-bezier(.2, .7, .2, 1), filter .16s ease;
}
.chart-label { font-size: 10.5px; color: var(--faint); white-space: nowrap; letter-spacing: .02em; }
.chart-empty { color: var(--faint); font-size: 13px; padding: 52px 0; text-align: center; width: 100%; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; color: var(--muted); font-weight: 500; font-size: 11px;
  letter-spacing: .08em; text-transform: uppercase;
  padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2);
}
td { padding: 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .14s ease; }
tbody tr:hover td { background: var(--surface-2); }
.thumb-sm { width: 42px; height: 42px; border-radius: 6px; object-fit: cover; background: var(--surface-2); border: 1px solid var(--line); }
.thumb-empty { width: 42px; height: 42px; border-radius: 6px; background: var(--surface-2); display: grid; place-items: center; color: var(--faint); font-size: 10.5px; border: 1px dashed var(--line); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 5px; font-size: 11px; font-weight: 500; letter-spacing: .02em; line-height: 1.7; }
.tag.on { background: var(--jade-soft); color: var(--jade); }
.tag.off { background: var(--surface-3); color: var(--muted); }
.tag.warn { background: var(--amber-soft); color: var(--amber); }
.tag.pay { background: var(--blue-soft); color: var(--blue); }
.row-actions { display: flex; gap: 2px; white-space: nowrap; }
.link-btn {
  border: 0; background: transparent; color: var(--ink-2); padding: 4px 7px; font-size: 12.5px;
  border-radius: 5px; transition: background .14s ease, color .14s ease;
}
.link-btn:hover { background: var(--hover-soft); color: var(--ink); text-decoration: none; }
.link-btn.red { color: var(--red); }
.link-btn.red:hover { background: var(--red-soft); }
.empty { text-align: center; padding: 56px 20px; color: var(--muted); font-size: 13px; line-height: 1.9; }
.empty .big { font-family: var(--font-display); font-size: 30px; margin-bottom: 8px; opacity: .22; }
/* 上线自检 */
.checklist { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 10px; }
.checklist li { display: flex; gap: 12px; padding: 12px 14px; border: 1px solid var(--line-soft); border-radius: var(--r); background: var(--surface-2); }
.checklist li > i { flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; position: relative; }
.checklist li.ok > i { background: var(--jade-soft); border: 1px solid rgba(var(--jade-rgb), .28); }
.checklist li.ok > i::after { content: ""; position: absolute; left: 5px; top: 3px; width: 6px; height: 9px; border: solid var(--jade); border-width: 0 1.6px 1.6px 0; transform: rotate(42deg); }
.checklist li.warn > i { background: var(--amber-soft); border: 1px solid rgba(var(--amber-rgb), .3); }
.checklist li.warn > i::after { content: "!"; position: absolute; inset: 0; display: grid; place-items: center; font: 700 11px/1 var(--font-num); color: var(--amber); }
.checklist li > div { display: grid; gap: 2px; }
.checklist li b { font-size: 13px; font-weight: 600; color: var(--ink); }
.checklist li span { font-size: 12.5px; color: var(--muted); }
.checklist li em { font-style: normal; font-size: 12px; color: var(--amber); margin-top: 2px; }
.checklist-foot { margin: 14px 0 0; font-size: 12px; color: var(--faint); }
.stock-input {
  width: 84px; height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px;
  text-align: center; font-variant-numeric: tabular-nums; background: var(--input-bg); outline: none;
}
.stock-input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .1); }

/* ============================ 表单通用 ============================ */
.field { display: block; }
.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; letter-spacing: .02em; }
.field > span b { color: var(--red); font-weight: 400; }
input, select, textarea { outline: none; }
.field input, .field select, .url-input, .inp {
  width: 100%; height: 34px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--input-bg); color: var(--ink); transition: border-color .16s ease, box-shadow .16s ease;
}
.field input:hover, .field select:hover, .url-input:hover, .inp:hover { border-color: var(--line-strong); }
.field input:focus, .field select:focus, .url-input:focus, .inp:focus {
  border-color: var(--red); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .1);
}
.field input::placeholder, .inp::placeholder, .url-input::placeholder { color: var(--faint); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.form-error { color: var(--red); font-size: 12px; }
.inp.invalid, input.invalid { border-color: var(--bad) !important; box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .1) !important; }
.img-grid.invalid { outline: 1px dashed var(--red); outline-offset: 5px; border-radius: 8px; }

.upload-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.upload-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  background: var(--input-bg); border: 1px solid var(--line-strong); color: var(--ink-2); border-radius: 6px; font-size: 12.5px;
  cursor: pointer; white-space: nowrap; transition: all .16s ease;
}
.upload-btn:hover { border-color: var(--red); color: var(--red); background: var(--accent-soft); }
.url-input { flex: 1; min-width: 200px; }
.url-input.wide { flex: none; width: 100%; }
.upload-hint { font-size: 12px; color: var(--faint); }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.thumb-box { position: relative; width: 88px; height: 88px; }
.thumb-box img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); }
.thumb-box .del {
  position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--surface); background: var(--accent); color: var(--on-accent); line-height: 1; font-size: 12px; padding: 0;
  display: grid; place-items: center; box-shadow: 0 1px 4px var(--shadow-soft);
}

/* ============================ 商品编辑 · 工作台布局 ============================ */
.edx {
  display: grid; grid-template-columns: minmax(0, 1fr) 262px;
  gap: 20px; align-items: start; max-width: 1280px;
}
.edx-main { min-width: 0; }

.edx-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 4px 0 20px; }
.crumb { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--faint); letter-spacing: .04em; margin-bottom: 8px; }
.crumb i { font-style: normal; opacity: .55; }
.crumb b { color: var(--ink-2); font-weight: 500; }
.edx-title {
  margin: 0; font-family: var(--font-display); font-size: 26px; font-weight: 600;
  letter-spacing: .03em; line-height: 1.3;
}
.edx-sub { margin: 6px 0 0; color: var(--muted); font-size: 12.5px; letter-spacing: .01em; }
.edx-head-actions { display: flex; gap: 8px; flex: none; padding-bottom: 3px; }

/* 分区 */
.sec {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  margin-bottom: 14px; box-shadow: var(--shadow); overflow: clip;
  animation: fade-up .32s ease both;
}
.sec:nth-child(2) { animation-delay: .04s; }
.sec:nth-child(3) { animation-delay: .08s; }
.sec:nth-child(4) { animation-delay: .12s; }
.sec:nth-child(5) { animation-delay: .16s; }
.sec-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 13px 20px; border-bottom: 1px solid var(--line); background: var(--surface);
}
.sec-bar-l { display: flex; align-items: center; gap: 11px; min-width: 0; }
.sec-idx {
  font-family: var(--font-num); font-size: 11px; letter-spacing: .1em; color: var(--red);
  border-right: 1px solid var(--line); padding-right: 11px; line-height: 1.2;
}
.sec-bar h2 { margin: 0; font-size: 14.5px; font-weight: 600; letter-spacing: .02em; white-space: nowrap; }
.sec-hint { color: var(--faint); font-size: 12px; letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sec-bar-r { display: flex; align-items: center; gap: 12px; flex: none; }
.sec-count { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.sec-toggle {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted);
  cursor: pointer; user-select: none; padding: 3px 6px; border-radius: 5px; transition: all .14s ease;
}
.sec-toggle:hover { color: var(--ink); background: var(--hover-soft); }
.sec-toggle::after { content: "⌃"; font-size: 11px; transition: transform .2s ease; }
.sec.collapsed .sec-toggle::after { transform: rotate(180deg); }
.sec.collapsed .sec-body { display: none; }
.sec-body { padding: 6px 20px 16px; }

/* 表单行 */
.row { display: flex; align-items: flex-start; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line-soft); }
.row:last-child { border-bottom: 0; }
.row-label {
  flex: 0 0 122px; padding-top: 7px; font-size: 13px; color: var(--ink-2);
  letter-spacing: .01em; line-height: 1.5;
}
.req { color: var(--red); font-style: normal; margin-left: 2px; font-size: 12px; }
.row-ctrl { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.row-ctrl > .inp, .row-ctrl > .url-input { max-width: 520px; }
.row-ctrl > .inp.wide, .row-ctrl > .url-input.wide { max-width: none; }
.row-help { flex: 1 0 100%; color: var(--faint); font-size: 11.5px; line-height: 1.7; }
.row-help.err { color: var(--red); }
.row-top { align-items: flex-start; }

.subhead {
  display: flex; align-items: center; gap: 9px; margin: 16px 0 2px;
  font-size: 12px; font-weight: 600; color: var(--ink-2); letter-spacing: .06em;
}
.subhead::before { content: ""; width: 3px; height: 12px; background: var(--red); border-radius: 2px; }
.subhead .muted { font-weight: 400; letter-spacing: 0; }

/* 勾选 / 单选 */
.checks { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 5px 0; }
.check, .radio { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.check input, .radio input {
  width: 15px; height: 15px; accent-color: var(--red); margin: 0; cursor: pointer;
  border-radius: 3px;
}
.check:hover, .radio:hover { color: var(--ink); }

/* 三列字段 */
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; padding: 10px 0 4px; }
.grid3 .field > span { font-size: 12px; color: var(--muted); }
.with-suffix { position: relative; display: block; }
.with-suffix .suffix {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-size: 11.5px; color: var(--faint); pointer-events: none;
}
.with-suffix input { padding-right: 38px; }

/* ============================ 图片上传区 ============================ */
.img-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.img-tile {
  position: relative; width: 92px; height: 92px; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--line); background: var(--surface-2); flex: none;
}
.img-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-tile .cover-flag {
  position: absolute; left: 0; top: 0; background: var(--scrim-strong); color: var(--on-dark-fg);
  font-size: 9.5px; letter-spacing: .06em; padding: 2px 6px; border-radius: 0 0 6px 0;
}
.img-tile .tile-tools {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 4px;
  background: var(--scrim-mid); opacity: 0; transition: opacity .16s ease;
}
.img-tile:hover .tile-tools { opacity: 1; }
.tile-tools button {
  width: 22px; height: 22px; display: grid; place-items: center; border: 0; border-radius: 5px;
  background: var(--glass-bg); color: var(--ink); font-size: 12px; padding: 0;
}
.tile-tools button:hover { background: var(--surface); color: var(--red); }
.img-add {
  width: 92px; height: 92px; flex: none; border: 1px dashed var(--line-strong); border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--faint); font-size: 11px; cursor: pointer; background: var(--surface-2);
  transition: all .16s ease;
}
.img-add:hover { border-color: var(--red); color: var(--red); background: var(--accent-soft); }
.img-add b { font-size: 18px; font-weight: 300; line-height: 1; }
.img-add.dragover { border-color: var(--red); background: var(--red-soft); color: var(--red); }
.img-hint { font-size: 11.5px; color: var(--faint); line-height: 1.7; margin-top: 8px; }
.img-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }

/* 文字型小按钮（抖音式） */
.set-btn {
  display: inline-flex; align-items: center; height: 26px; padding: 0 10px;
  border-radius: 5px; font-size: 12px; cursor: pointer; user-select: none;
  border: 1px solid transparent; white-space: nowrap; transition: all .14s ease;
}
.set-btn1 { color: var(--red); border-color: var(--bad-line); background: var(--accent-soft); }
.set-btn1:hover { background: var(--red-soft); border-color: var(--bad-line); }
.set-btn2 { color: var(--blue); border-color: var(--blue-line); background: var(--blue-soft); }
.set-btn2:hover { background: var(--blue-soft); border-color: var(--blue-line); }
.set-btn3 { color: var(--muted); border-color: var(--line); background: var(--surface-2); }
.set-btn3:hover { color: var(--ink); background: var(--surface-3); }
.set-btn.on { background: var(--ink); color: var(--on-accent); border-color: var(--ink); }
.dy-inline-btn { margin-left: 6px; }

/* ============================ 规格 / SKU ============================ */
.spec-list { display: flex; flex-direction: column; gap: 10px; padding-top: 6px; }
.spec-dim { border: 1px solid var(--line); border-radius: 8px; padding: 11px 13px; background: var(--surface-2); }
.spec-dim-head { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.spec-name {
  flex: 0 0 170px; height: 30px; padding: 0 10px; border: 1px solid var(--line-strong);
  border-radius: 6px; font-size: 12.5px; background: var(--input-bg); outline: none;
}
.spec-name:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .1); }
.spec-values { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 4px 0 10px;
  background: var(--surface); color: var(--ink-2); border: 1px solid var(--line-strong); border-radius: 5px; font-size: 12px;
  transition: all .14s ease;
}
.chip:hover { border-color: var(--line-strong); }
.chip.sel { background: var(--ink); border-color: var(--ink); color: var(--on-accent); }
.chip.sel .chip-x { color: var(--on-accent-dim); }
.chip-x { border: 0; background: transparent; color: var(--faint); cursor: pointer; font-size: 13px; line-height: 1; padding: 0 4px; }
.chip-x:hover { color: var(--red); }
.spec-val-input { width: 150px; height: 26px; padding: 0 8px; border: 1px dashed var(--line-strong); border-radius: 5px; font-size: 12px; background: transparent; outline: none; }
.spec-val-input:focus { border-style: solid; border-color: var(--red); background: var(--input-bg); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .08); }
.spec-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sku-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 12px 0 10px; }
.sku-tools .spacer { flex: 1; }
.sku-table-wrap { border: 1px solid var(--line); border-radius: 8px; overflow: auto; }
.sku-table { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 720px; }
.sku-table th {
  padding: 9px 10px; background: var(--surface-2); border-bottom: 1px solid var(--line);
  font-size: 11px; letter-spacing: .06em; position: sticky; top: 0; z-index: 1;
}
.sku-table td { padding: 7px 10px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.sku-table tbody tr.sel td { background: var(--accent-soft); }
.sku-table tbody tr:last-child td { border-bottom: 0; }
.sku-spec { white-space: normal; min-width: 150px; color: var(--ink); font-weight: 500; }
.sku-check { width: 14px; height: 14px; accent-color: var(--red); cursor: pointer; }
.inp-sm {
  width: 96px; height: 28px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 5px;
  font-size: 12.5px; background: var(--input-bg); outline: none; font-variant-numeric: tabular-nums;
}
.inp-sm:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .1); }
.dy-tip { color: var(--faint); font-size: 11.5px; margin: 9px 0 0; line-height: 1.7; }

/* ============================ 右侧栏 ============================ */
.edx-rail { position: sticky; top: 86px; display: flex; flex-direction: column; gap: 12px; }
.rail-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 14px; box-shadow: var(--shadow);
}
.rail-label { font-size: 9.5px; letter-spacing: .18em; color: var(--faint); text-transform: uppercase; margin-bottom: 10px; }
.rail-sum { display: flex; gap: 11px; align-items: flex-start; }
.rail-thumb {
  width: 52px; height: 52px; border-radius: 7px; background: var(--surface-2); border: 1px dashed var(--line-strong);
  display: grid; place-items: center; color: var(--faint); font-size: 16px; overflow: hidden; flex: none;
}
.rail-thumb img { width: 100%; height: 100%; object-fit: cover; }
.rail-title {
  font-size: 13px; font-weight: 500; line-height: 1.5; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 20px;
}
.rail-title.placeholder { color: var(--faint); font-weight: 400; }
.rail-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.mini-tag { font-size: 10.5px; padding: 1px 6px; border-radius: 4px; background: var(--surface-3); color: var(--muted); }
.mini-tag.red { background: var(--red-soft); color: var(--red); }
.rail-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; margin-top: 13px; padding-top: 12px; border-top: 1px dashed var(--line-soft); }
.rail-stats dt { font-size: 10.5px; color: var(--faint); letter-spacing: .04em; }
.rail-stats dd { margin: 1px 0 0; font-family: var(--font-num); font-size: 15px; color: var(--ink); letter-spacing: .01em; white-space: nowrap; }

.rail-nav { display: flex; flex-direction: column; gap: 1px; }
.rail-link {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 9px; border-radius: 5px; font-size: 12.5px; color: var(--muted);
  border-left: 2px solid transparent; cursor: pointer; transition: all .14s ease;
}
.rail-link:hover { color: var(--ink); background: var(--surface-2); }
.rail-link.on { color: var(--ink); font-weight: 500; background: var(--surface-2); border-left-color: var(--red); }
.rail-link span { font-family: var(--font-num); font-size: 10px; color: var(--faint); }

.rail-actions { display: flex; flex-direction: column; gap: 8px; }
.rail-actions .form-error { min-height: 0; text-align: center; }
.rail-note { font-size: 11px; color: var(--faint); text-align: center; line-height: 1.6; }

/* ============================ 弹窗 / 提示 ============================ */
.modal-overlay { position: fixed; inset: 0; background: var(--scrim); display: grid; place-items: center; z-index: 50; padding: 24px; backdrop-filter: blur(2px); }
.modal { width: min(760px, 100%); max-height: 90vh; background: var(--surface-solid); border-radius: 12px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 24px 70px var(--shadow-strong); }
.modal-head { padding: 16px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.icon-btn { border: 0; background: transparent; font-size: 22px; color: var(--muted); line-height: 1; padding: 0 4px; }
.modal-body { padding: 20px 22px; overflow: auto; }
.modal-foot { padding: 13px 22px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 9px; justify-content: flex-end; }
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translate(-50%, 8px);
  background: var(--toast-bg); color: var(--toast-fg); padding: 10px 18px; border-radius: 8px; z-index: 90;
  font-size: 12.5px; letter-spacing: .02em; box-shadow: 0 10px 30px var(--shadow-strong);
  opacity: 0; transition: opacity .2s ease, transform .2s ease; pointer-events: none;
}
.toast:not(.hidden) { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--red-deep); }

/* 兼容旧编辑器类名 */
.editor { max-width: none; }
.editor-head { margin-bottom: 14px; }
.editor-foot { display: flex; align-items: center; gap: 9px; justify-content: flex-end; margin-top: 16px; }
.dy-editor { max-width: none; }
.dy-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); margin-bottom: 14px; overflow: hidden; }
.dy-section-bar { display: flex; align-items: center; padding: 13px 20px; border-bottom: 1px solid var(--line); }
.dy-section-title { font-size: 14px; font-weight: 600; }
.dy-form { padding: 6px 20px 16px; }
.dy-row { display: flex; align-items: flex-start; padding: 9px 0; border-bottom: 1px dashed var(--line-soft); }
.dy-row:last-child { border-bottom: 0; }
.dy-label { flex: 0 0 122px; padding-top: 7px; font-size: 13px; color: var(--ink-2); }
.dy-control { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dy-tip { color: var(--faint); font-size: 11.5px; }
.dy-subhead { margin: 16px 0 2px; font-size: 12px; font-weight: 600; color: var(--ink-2); letter-spacing: .06em; }
.dy-checks { gap: 6px 18px; }
.dy-check, .dy-radio { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.dy-check input, .dy-radio input { width: 15px; height: 15px; accent-color: var(--red); }
.dy-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; margin-top: 12px; }
.dy-field { display: block; }
.dy-field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.dy-field input { width: 100%; height: 34px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 6px; outline: none; }
.dy-field input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .1); }

/* ============================ 编辑模式（隐藏全局顶栏） ============================ */
body.edx-mode .topbar { display: none; }
body.edx-mode .content { padding-top: 28px; }
body.edx-mode .edx-rail { top: 20px; }
.edx-mobile-bar { display: none; }

/* ============================ 响应式 ============================ */
@media (max-width: 1240px) {
  .edx { grid-template-columns: minmax(0, 1fr) 236px; }
}
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid3, .dy-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .sidebar { width: 68px; }
  .brand { padding: 20px 0; justify-content: center; }
  .brand > div, .brand-en, .nav-item span, .nav-group, .cloud-state { display: none; }
  .nav-item { justify-content: center; padding: 11px 0; }
  .nav-item i { width: 18px; height: 18px; }
  .sidebar-foot { padding: 12px 10px; }
  .sidebar .btn.ghost { font-size: 0; padding: 7px 0; }
  .sidebar .btn.ghost::after { content: "退出"; font-size: 11px; }
  .edx { grid-template-columns: minmax(0, 1fr); }
  .edx-rail { position: static; }
  .edx-mobile-bar {
    position: fixed; left: 68px; right: 0; bottom: 0; z-index: 30; display: flex;
    align-items: center; gap: 12px; padding: 10px 16px; background: var(--glass-bg);
    border-top: 1px solid var(--line); backdrop-filter: blur(8px);
  }
  .edx-mobile-bar .form-error { flex: 1; font-size: 11.5px; }
  .edx-mobile-bar .btn { flex: none; height: 36px; padding: 0 22px; }
  .content { padding: 18px 16px 90px; }
  .dy-page { margin: 0; }
  .topbar { padding: 0 16px; }
}
@media (max-width: 720px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-aside { display: none; }
  .login-card { padding: 56px 24px; }
  .row { flex-wrap: wrap; gap: 4px; }
  .row-label { flex-basis: 100%; padding-top: 0; }
  .edx-title { font-size: 22px; }
  .edx-head { flex-direction: column; align-items: flex-start; }
  .kpis { grid-template-columns: 1fr; }
  .grid3, .dy-grid, .form-grid { grid-template-columns: 1fr; }
  .sec-hint { display: none; }
}

/* ============================================================
   商品发布页 · 严格对齐平台上传页布局
   单列长表单：右侧对齐的 108px 标签列 + 控件 + 右侧按钮列
   ============================================================ */
.dy-page {
  max-width: none;
  /* .content 左右内边距 28px，负margin补偿为视觉 20px（窄屏媒体查询内恢复 0） */
  margin: 0 -8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.dy-form { padding: 2px 32px 6px; }
.dy-sec { padding: 22px 0 26px; border-bottom: 1px solid var(--dy-line); }
.dy-sec:last-child { border-bottom: 0; }
.dy-sec-t {
  margin: 0 0 16px; font-size: 15px; font-weight: 600; color: var(--ink);
  letter-spacing: .01em; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
}
.dy-sec-hint { font-weight: 400; font-size: 12px; color: var(--faint); }

/* ---------- 行 ---------- */
.dy-row {
  display: grid; grid-template-columns: 108px minmax(0, 1fr);
  gap: 3px 16px; margin-bottom: 12px; align-items: start;
}
.dy-row-3 { grid-template-columns: 108px minmax(0, 1fr) auto; }
.dy-lab {
  text-align: right; color: var(--dy-label); font-size: 13px;
  line-height: 32px; padding-right: 2px; white-space: nowrap;
}
.dy-lab .req { color: var(--red); font-style: normal; margin-left: 2px; }
.dy-ctl { min-width: 0; }
.dy-side { display: flex; gap: 8px; align-items: flex-start; }
.dy-help { color: var(--muted); font-size: 12px; line-height: 1.65; margin: 2px 0 8px; max-width: 780px; }
.dy-page .dy-ctl > .dy-help:first-child { margin-top: 6px; }

/* ---------- 控件密度 ---------- */
.dy-page .inp {
  height: 32px; padding: 0 10px; border-color: var(--dy-border);
  border-radius: 3px; font-size: 13px; background: var(--input-bg);
}
.dy-page .inp:hover { border-color: var(--line-strong); }
.dy-page .inp:focus { border-color: var(--red); box-shadow: 0 0 0 2px rgba(var(--accent-rgb), .08); }
.dy-page select.inp { padding-right: 6px; }
.dy-page .inp[readonly] { background: var(--surface-2); cursor: default; }
.dy-w-lg { width: 460px; max-width: 100%; }
.dy-w-md { width: 300px; max-width: 100%; }
.dy-w-sm { width: 180px; max-width: 100%; }
.dy-inp { width: 100%; }
.dy-inline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 32px; }
.dy-count { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.dy-link { color: var(--blue); font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.dy-link:hover { text-decoration: underline; }
.dy-quick { color: var(--faint); font-size: 12px; }

.dy-unit { position: relative; display: inline-flex; align-items: center; }
.dy-unit .inp { width: 100%; padding-right: 38px; }
.dy-suffix {
  position: absolute; right: 10px; font-size: 12px; color: var(--faint);
  pointer-events: none; letter-spacing: .02em;
}
.dy-cell .dy-unit { flex: 1 1 auto; min-width: 0; }

/* ---------- 单选行内 ---------- */
.dy-radio-inline { display: inline-flex; align-items: center; gap: 18px; flex-wrap: wrap; min-height: 32px; }
.dy-radio-inline .radio { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.dy-radio-inline .radio input { width: 14px; height: 14px; accent-color: var(--red); margin: 0; }

/* ---------- 类目属性面板 ---------- */
.dy-panel { background: var(--dy-panel); border-radius: 4px; padding: 14px 18px 6px; }

/* ============================ 类目选择弹窗（三层级联） ============================ */
.cat-mask {
  position: fixed; inset: 0; z-index: 90;
  background: var(--scrim);
  display: flex; align-items: center; justify-content: center;
  animation: fade-up .18s ease;
}
.cat-panel {
  width: min(760px, 94vw); max-height: 86vh; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-strong); overflow: hidden;
}
.cat-head {
  display: flex; align-items: center; gap: 10px; flex: none;
  padding: 15px 20px; border-bottom: 1px solid var(--line);
  font-size: 15px; font-weight: 600;
}
.cat-sub { font-weight: 400; font-size: 12px; color: var(--faint); }
.cat-close {
  margin-left: auto; border: 0; background: transparent; color: var(--muted);
  font-size: 19px; line-height: 1; padding: 3px 7px; border-radius: 6px;
}
.cat-close:hover { background: var(--hover-soft); color: var(--ink); }
.cat-cols {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  height: 340px; flex: none;
}
.cat-col { overflow-y: auto; padding: 7px; border-right: 1px solid var(--line-soft); }
.cat-col:last-child { border-right: 0; }
.cat-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 11px; border-radius: 7px; font-size: 13px; color: var(--ink-2); cursor: pointer;
}
.cat-item:hover { background: var(--hover-soft); color: var(--ink); }
.cat-item.active { background: var(--red-soft); color: var(--red-deep); font-weight: 500; }
.cat-arrow { font-style: normal; color: var(--faint); font-size: 15px; line-height: 1; }
.cat-item.active .cat-arrow { color: var(--red-deep); }
.cat-empty { padding: 14px 11px; font-size: 12px; color: var(--faint); text-align: center; }
.cat-preview {
  flex: none; padding: 10px 20px; border-top: 1px solid var(--line-soft);
  font-size: 12.5px; color: var(--muted); min-height: 38px; display: flex; align-items: center;
}
.cat-foot {
  flex: none; display: flex; justify-content: flex-end; gap: 9px;
  padding: 13px 20px; border-top: 1px solid var(--line); background: var(--surface);
}
.dy-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 22px; }
.dy-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dy-cell { display: flex; align-items: center; gap: 8px; min-width: 0; margin-bottom: 8px; }
/* 标签列固定宽度：4 字标签 + 必填星号刚好放下，
   各格输入框起点一致 → 同行/同列输入框完全等宽 */
.dy-cell-t { flex: 0 0 70px; color: var(--dy-label); font-size: 13px; white-space: nowrap; }
.dy-cell-t .req { color: var(--red); font-style: normal; margin-left: 2px; }
.dy-cell .inp { flex: 1 1 auto; min-width: 0; }
.dy-cell .dy-tags { flex: 1 1 auto; min-width: 0; }
.dy-single { background: var(--dy-panel); border-radius: 4px; padding: 14px 18px 6px; }

/* ---------- 颜色 tag ---------- */
.dy-tags {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  min-height: 32px; padding: 3px 6px; background: var(--input-bg);
  border: 1px solid var(--dy-border); border-radius: 3px;
}
.dy-tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--blue-soft); color: var(--blue);
  border-radius: 2px; padding: 1px 6px; font-size: 12px; line-height: 20px;
}
.dy-tag i { font-style: normal; cursor: pointer; opacity: .65; }
.dy-tag i:hover { opacity: 1; }
.dy-tag-input {
  flex: 1 1 60px; min-width: 56px; height: 22px; border: 0; outline: none;
  background: transparent; font-size: 12.5px;
}

/* ---------- 按钮 ---------- */
.dy-btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 32px; padding: 0 14px; border: 1px solid var(--dy-border);
  background: var(--surface); border-radius: 3px; font-size: 13px; color: var(--ink-2);
  white-space: nowrap; transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.dy-btn:hover { border-color: var(--line-strong); background: var(--surface-2); }
.dy-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.dy-btn.primary:hover { background: var(--red-deep); border-color: var(--red-deep); }
.dy-btn.purple { background: var(--dy-purple); border-color: var(--dy-purple); color: var(--on-dark-fg); }
.dy-btn.purple:hover { background: var(--dy-purple-deep); border-color: var(--dy-purple-deep); }
.dy-btn.ghost { background: var(--surface); color: var(--ink-2); }
.dy-btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }
.dy-btn.xs { height: 26px; padding: 0 10px; font-size: 12px; }
.dy-btn.lg { height: 36px; padding: 0 26px; font-size: 14px; }
.dy-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 规格 ---------- */
.dy-spec-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.dy-spec-head-t { font-size: 13px; color: var(--dy-label); }
.dy-specs { display: flex; flex-direction: column; gap: 14px; }
.dy-spec { display: grid; grid-template-columns: 108px minmax(0, 1fr); gap: 16px; }
.dy-spec-l { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.dy-spec-name {
  width: 100%; height: 28px; padding: 0 4px; border: 1px solid transparent;
  border-radius: 3px; text-align: right; font-size: 13px; color: var(--dy-label);
  background: transparent; outline: none;
}
.dy-spec-name:hover { border-color: var(--dy-border); background: var(--input-bg); }
.dy-spec-name:focus { border-color: var(--red); background: var(--input-bg); }
.dy-spec-del { border: 0; background: transparent; color: var(--faint); font-size: 11px; padding: 0; }
.dy-spec-del:hover { color: var(--red); }
.dy-chips { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.dy-chip {
  position: relative; display: flex; align-items: center; gap: 6px; height: 32px;
  padding: 0 8px; background: var(--surface); border: 1px solid var(--dy-border);
  border-radius: 3px; font-size: 12.5px; cursor: pointer; overflow: hidden;
}
.dy-chip span { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dy-chip input[type=checkbox] { width: 13px; height: 13px; accent-color: var(--red); margin: 0; flex: none; }
.dy-chip.sel { border-color: var(--red); background: var(--red-soft); }
.dy-chip-x { font-style: normal; color: var(--faint); font-size: 11px; opacity: 0; transition: opacity .12s; }
.dy-chip:hover .dy-chip-x { opacity: 1; }
.dy-chip-x:hover { color: var(--red); }
.dy-chip-add {
  height: 32px; border: 1px dashed var(--dy-border); background: var(--surface);
  border-radius: 3px; font-size: 12.5px; color: var(--dy-label); cursor: pointer;
}
.dy-chip-add:hover { border-color: var(--red); color: var(--red); }
.dy-spec-foot { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.dy-specs-empty { background: var(--dy-panel); border-radius: 4px; padding: 16px 18px; font-size: 12.5px; color: var(--faint); }

/* ---------- SKU 表 ---------- */
.dy-sku-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 2px 0 10px; flex-wrap: wrap; }
.dy-sku-tools-l, .dy-sku-tools-r { display: flex; gap: 8px; flex-wrap: wrap; }
.dy-table-wrap { border: 1px solid var(--dy-line); border-radius: 4px; overflow: auto; max-height: 540px; }
.dy-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.dy-table thead th {
  position: sticky; top: 0; z-index: 2; background: var(--dy-panel); color: var(--dy-label);
  font-weight: 500; font-size: 12px; text-align: left; padding: 10px 12px;
  border-bottom: 1px solid var(--dy-line); white-space: nowrap;
}
.dy-th-sub { color: var(--faint); font-weight: 400; }
.dy-th-cb { width: 38px; }
.dy-table tbody td { padding: 4px 12px; border-bottom: 1px solid var(--dy-line); vertical-align: middle; }
.dy-table tbody tr:hover td { background: var(--surface-2); }
.dy-table tbody tr.sel td { background: var(--red-soft); }
.dy-td-cb { width: 38px; text-align: center; }
.dy-td-cb input { width: 14px; height: 14px; accent-color: var(--red); }
.dy-td-span { background: var(--surface-2); color: var(--ink-2); border-right: 1px solid var(--dy-line); }
.dy-td-spec { color: var(--ink-2); }
.dy-td-empty { text-align: center; color: var(--faint); padding: 26px 0 !important; }
.dy-table .inp-sm { width: 100%; min-width: 92px; height: 28px; }
.dy-tip { color: var(--faint); font-size: 11.5px; margin: 9px 0 0; line-height: 1.7; }

/* ---------- 图片 ---------- */
.dy-ai { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; }
.dy-ai span { font-size: 12px; color: var(--faint); }
.dy-imgs { display: grid; grid-template-columns: repeat(5, 88px); gap: 8px; }
.dy-imgs .img-tile { width: 88px; height: 88px; border-radius: 3px; }
.dy-imgs-34 .img-tile { height: 117px; }
.dy-imgs-one { grid-template-columns: 132px; }
.dy-imgs-one .img-tile { width: 132px; height: 132px; }
.dy-img-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  width: 88px; height: 88px; border: 1px dashed var(--line-strong); border-radius: 3px;
  background: var(--surface-2); color: var(--faint); font-size: 11px; cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}
.dy-imgs-34 .dy-img-empty { height: 117px; }
.dy-imgs-one .dy-img-empty { width: 132px; height: 132px; }
.dy-img-empty i { font-style: normal; font-size: 18px; line-height: 1; color: var(--faint); }
.dy-img-empty:hover { border-color: var(--red); color: var(--red); }
.dy-img-empty:hover i { color: var(--red); }
.dy-imgs-detail { grid-template-columns: repeat(4, 88px); align-content: start; }
.dy-detail-set + .dy-detail-set { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--dy-line); }
.dy-detail-set-head { display: flex; gap: 12px; justify-content: space-between; margin-bottom: 10px; color: var(--ink-2); font-size: 12px; line-height: 1.7; }
.dy-detail-set-head span:first-child { overflow-wrap: anywhere; }
.dy-detail-set-head span:last-child { flex-shrink: 0; color: var(--faint); }
.dy-detail-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 16px; align-items: start; }
.dy-phone { border: 1px solid var(--dy-line); border-radius: 8px; background: var(--surface); overflow: hidden; }
.dy-phone-bar {
  height: 30px; display: flex; align-items: center; justify-content: center;
  background: var(--dy-panel); border-bottom: 1px solid var(--dy-line);
  font-size: 12px; color: var(--dy-label);
}
.dy-phone-body { padding: 8px; max-height: 430px; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.dy-phone-body img { width: 100%; display: block; border-radius: 2px; }
.dy-phone-empty { color: var(--faint); font-size: 12px; text-align: center; padding: 40px 0; }

/* ---------- 底部操作条 ---------- */
.dy-foot {
  position: sticky; bottom: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 32px; background: var(--glass-bg);
  backdrop-filter: blur(8px); border-top: 1px solid var(--dy-line);
}
.dy-foot-sum { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dy-foot-r { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dy-foot-r .form-error { margin-right: 2px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  .dy-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dy-chips { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dy-detail-wrap { grid-template-columns: minmax(0, 1fr); }
  .dy-phone { display: none; }
}
@media (max-width: 900px) {
  .dy-form { padding: 0 16px; }
  .dy-sec { padding: 18px 0 20px; }
  .dy-row, .dy-row-3, .dy-spec { grid-template-columns: minmax(0, 1fr); gap: 5px; }
  .dy-lab { text-align: left; line-height: 1.5; padding-right: 0; }
  .dy-lab .req { margin-left: 2px; }
  .dy-spec-l { flex-direction: row; align-items: center; justify-content: space-between; }
  .dy-spec-name { text-align: left; width: auto; flex: 1; }
  .dy-grid { grid-template-columns: minmax(0, 1fr); }
  .dy-chips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dy-imgs, .dy-imgs-detail { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dy-imgs .img-tile, .dy-img-empty { width: 100%; }
  .dy-imgs-one { grid-template-columns: 1fr; }
  .dy-imgs-one .img-tile, .dy-imgs-one .dy-img-empty { width: 100%; height: 140px; }
  .dy-side { justify-content: flex-start; flex-wrap: wrap; }
  .dy-foot { padding: 10px 16px; }
  .dy-foot-sum { display: none; }
  .dy-sku-tools-l { width: 100%; }
}

.dy-table th:nth-child(n+3) { width: 152px; }
.dy-table th:last-child { width: auto; }
.dy-btn.danger { color: var(--bad); border-color: var(--bad-line); }
.dy-btn.danger:hover { background: var(--bad-soft); border-color: var(--bad-line); }
.dy-spec-space { flex: 1 1 auto; }
.dy-spec-l { justify-content: flex-start; }
.dy-spec-name { text-align: right; }

/* ============================ 运费设置 ============================ */
.ship-rule { display: flex; flex-direction: column; gap: 12px; padding: 4px 0 6px; }
.ship-radio { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; flex-wrap: wrap; }
.ship-radio input[type="radio"] { width: 15px; height: 15px; accent-color: var(--red); margin: 0; }
.ship-num { width: 92px; height: 30px; padding: 0 8px; text-align: center; }
.ship-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px 10px; padding: 4px 0 6px; }
.ship-prov { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); cursor: pointer; padding: 4px 2px; white-space: nowrap; }
.ship-prov input { width: 15px; height: 15px; accent-color: var(--red); margin: 0; }
.ship-inline { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); padding: 2px 0 10px; }
.ship-note {
  margin: 4px 0 12px; padding: 10px 14px; background: var(--surface-2);
  border: 1px dashed var(--line-strong); border-radius: var(--r);
  font-size: 13px; line-height: 1.8; color: var(--ink-2);
}
.ship-save { display: flex; align-items: center; gap: 12px; margin: 2px 0 40px; }

/* ============================ 订单发货弹窗 ============================ */
#shipMask {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(15, 18, 25, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.ship-dialog {
  width: 460px; max-width: 100%; max-height: 90vh; overflow: auto;
  background: var(--surface, #fff); border-radius: 12px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.25);
  padding: 20px 22px 16px;
}
.ship-dialog-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.ship-dialog-head b { font-size: 16px; }
.ship-dialog-head .muted { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ship-close {
  border: none; background: none; font-size: 22px; line-height: 1;
  color: var(--ink-3, #999); cursor: pointer; padding: 4px 6px; border-radius: 6px;
}
.ship-close:hover { background: var(--surface-2, #f2f3f5); color: var(--ink, #333); }
.ship-dialog .form-grid { margin: 0; }
.ship-dialog .field span { margin-bottom: 4px; display: block; font-size: 13px; color: var(--ink-2, #555); }
.ship-dialog input, .ship-dialog select {
  width: 100%; height: 36px; padding: 0 10px; font-size: 14px;
  border: 1px solid var(--line-strong, #ddd); border-radius: 8px; background: #fff;
  box-sizing: border-box;
}
.ship-dialog input:focus, .ship-dialog select:focus { outline: none; border-color: var(--red, #e0302a); }
.ship-dialog-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.ship-dialog-foot .form-error { flex: 1 1 auto; color: var(--bad, #d54941); font-size: 13px; }
.ship-tip { margin: 10px 0 0; font-size: 12.5px; line-height: 1.7; }

/* SKU 库存明细弹窗 */
.sku-modal { width: min(880px, 100%); }
.sku-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 14px; font-size: 13px; }
.sku-only-zero { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; color: var(--text-muted); margin-left: auto; }
.sku-only-zero input { accent-color: var(--accent); }
.sku-color { margin-bottom: 16px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.sku-color-head { display: flex; align-items: center; justify-content: space-between; padding: 9px 14px; background: var(--surface-2, rgba(0,0,0,.03)); font-size: 13px; }
.sku-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sku-table th { text-align: left; padding: 7px 14px; color: var(--text-muted); font-weight: 500; border-bottom: 1px solid var(--line); }
.sku-table td { padding: 6px 14px; border-bottom: 1px solid var(--line); }
.sku-table tbody tr:last-child td { border-bottom: none; }
.sku-zero { background: rgba(220, 38, 38, .07); }
.sku-zero td:first-child { color: #dc2626; font-weight: 600; }
.sku-zero-text { color: #dc2626; }

.poster-fields { border: 0; padding: 0; margin: 0; min-width: 0; }
.poster-fields > .card { padding: 20px; margin-bottom: 16px; }
.poster-row { display: grid; grid-template-columns: minmax(100px, 180px) minmax(0, 1fr); gap: 24px; border-top: 1px solid var(--line, #ddd); padding: 16px 0; }
.poster-preview { align-self: start; aspect-ratio: 391 / 496; display: grid; place-items: center; overflow: hidden; border-radius: 8px; background: var(--bg, #f2f3f4); }
.poster-preview img { width: 100%; height: 100%; object-fit: cover; }
.poster-row .field { margin: 8px 0; }
.poster-settings { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
@media (max-width: 650px) { .poster-row { grid-template-columns: 1fr; } .poster-preview { width: 120px; } }