:root {
  --sidebar-bg: #141824;
  --sidebar-panel: #1d2233;
  --sidebar-border: #2b3248;
  --canvas-bg: #f3f5f9;
  --card-bg: #ffffff;
  --line: #e3e7ef;
  --line-strong: #cdd4e0;
  --text-main: #1f2329;
  --text-sub: #646a73;
  --ali-blue: #1664ff;
  --ali-orange: #ff6a00;
  --ali-purple: #6e46ff;
  --success: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 13.5px;
  color: var(--text-main);
  background: var(--canvas-bg);
}

.hidden { display: none !important; }
.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ==================== 左侧深色商品导航栏 ==================== */
.sidebar {
  background: var(--sidebar-bg);
  color: #eef1f8;
  display: flex;
  flex-direction: column;
  height: 100vh;
  border-right: 1px solid var(--sidebar-border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 14px;
  border-bottom: 1px solid var(--sidebar-border);
}
.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--ali-orange), var(--ali-blue));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
}
.brand-title { font-weight: 700; font-size: 15px; }
.brand-sub { font-size: 11.5px; color: #94a3b8; }

.sidebar-actions { padding: 12px 12px 6px; }
.sidebar-search { padding: 4px 12px 10px; }
.sidebar-search input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 7px;
  border: 1px solid var(--sidebar-border);
  background: #0d1018;
  color: #eef1f8;
  font-size: 12.5px;
}

.product-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 10px;
}
.product-item {
  display: flex;
  gap: 10px;
  padding: 9px;
  border-radius: 9px;
  cursor: pointer;
  border: 1px solid transparent;
  margin-bottom: 6px;
  transition: all 0.15s;
}
.product-item:hover { background: var(--sidebar-panel); }
.product-item.active {
  background: rgba(22, 100, 255, 0.22);
  border-color: rgba(22, 100, 255, 0.65);
}
.product-thumb {
  width: 46px;
  height: 46px;
  border-radius: 6px;
  background: #fff;
  object-fit: contain;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.product-meta { flex: 1; min-width: 0; }
.product-name {
  font-weight: 600;
  font-size: 12.5px;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.product-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 11px;
  color: #94a3b8;
}

.sidebar-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--sidebar-border);
}
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
  margin-right: 6px;
}
.status-dot.ok { background: #22c55e; }

/* ==================== 右侧仿阿里国际站白底发品画布 ==================== */
.main-canvas {
  overflow-y: auto;
  height: 100vh;
  scroll-behavior: smooth;
  position: relative;
}

.welcome-wrap {
  max-width: 960px;
  margin: 36px auto;
  padding: 0 24px;
}
.welcome-hero { padding: 36px !important; }
.welcome-hero h1 { font-size: 25px; margin: 14px 0 10px; color: #111827; }
.sub-desc { color: var(--text-sub); line-height: 1.65; font-size: 14px; }
.welcome-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 22px;
}
.step-card {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
}
.step-num { font-weight: 800; color: var(--ali-orange); font-size: 18px; margin-bottom: 4px; }
.step-card h4 { margin: 0 0 6px; font-size: 14.5px; }
.step-card p { margin: 0; font-size: 12.5px; color: var(--text-sub); line-height: 1.5; }

/* 顶部吸顶大纲栏 */
.publish-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 10px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.anchor-nav { display: flex; gap: 18px; flex-wrap: wrap; }
.anchor-link {
  text-decoration: none;
  color: var(--text-sub);
  font-weight: 600;
  font-size: 13.5px;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
}
.anchor-link:hover, .anchor-link.active {
  color: var(--ali-blue);
  border-bottom-color: var(--ali-blue);
}
.topbar-right { display: flex; gap: 8px; align-items: center; }

.publish-body {
  max-width: 1180px;
  margin: 18px auto 40px;
  padding: 0 24px;
}

/* 国际站风格白卡 */
.ali-card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
}
.ali-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid #f0f2f5;
}
.ali-card-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #111827;
}
.header-tip { font-size: 12px; color: var(--text-sub); margin-right: auto; }

/* 类目条 */
.category-bar {
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.cat-left { display: flex; align-items: center; gap: 8px; flex: 1; }
.cat-label { font-weight: 600; color: var(--text-sub); white-space: nowrap; }
.cat-input {
  flex: 1;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  background: #f8fafc;
}

/* 字段与标签 */
.ali-field-block { margin-bottom: 22px; }
.ali-label-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.ali-label { font-weight: 700; font-size: 13.5px; color: #1f2329; }
.ali-label.required::before, .ali-sub-label.required::before {
  content: "* ";
  color: var(--danger);
}
.ali-sub-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #4b5563;
  margin-bottom: 5px;
}
.field-hint { font-size: 12px; color: #86909c; }
.link-action { font-size: 12.5px; color: var(--ali-blue); text-decoration: none; font-weight: 600; }

.ali-input, .ali-input-lg, .ali-textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 8px 11px;
  font-size: 13px;
  color: var(--text-main);
  background: #fff;
  font-family: inherit;
  transition: border-color 0.15s;
}
.ali-input-lg { padding: 10px 12px; font-size: 14px; font-weight: 500; }
.ali-input:focus, .ali-input-lg:focus, .ali-textarea:focus {
  outline: none;
  border-color: var(--ali-blue);
  box-shadow: 0 0 0 2px rgba(22, 100, 255, 0.1);
}

.info-notice-bar {
  margin-top: 10px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.inline-kw-input {
  flex: 1;
  min-width: 240px;
  border: 1px solid #93c5fd;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  background: #fff;
}

/* ==================== 1:1 主图 6 槽位 + 视频槽位 ==================== */
.main-slots-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
}
.slot-box {
  position: relative;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.slot-box.filled { border-style: solid; border-color: var(--line); background: #fff; }
.slot-box img, .slot-box video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.slot-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--ali-purple);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 4px;
  z-index: 2;
}
.slot-hover-menu {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.76);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 3;
}
.slot-box:hover .slot-hover-menu { opacity: 1; }
.slot-empty-text { font-size: 12px; color: #94a3b8; text-align: center; padding: 6px; }

/* 网格系统 */
.ali-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ali-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.ali-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

/* 三列商品属性网格（1:1 复刻国际站属性框） */
.ali-attrs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 16px;
}
.attr-cell {
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
}
.attr-cell-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.attr-key-inp {
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: #4e5969;
  width: 85%;
  padding: 0;
}
.attr-key-inp:focus { outline: none; color: var(--ali-blue); }

.custom-attr-row {
  display: grid;
  grid-template-columns: 240px 1fr auto;
  gap: 10px;
  margin-bottom: 8px;
}

/* 阶梯价 & 发货期表格 */
.ali-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.ali-table th {
  background: #f7f8fa;
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  color: #4e5969;
  font-size: 12px;
}
.ali-table td {
  border: 1px solid var(--line);
  padding: 6px 8px;
}

/* 结构化商详图集 */
.detail-slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.detail-slot-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.detail-slot-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
  background: #f8fafc;
}
.detail-slot-foot {
  padding: 6px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fafbfc;
  border-top: 1px solid #f0f2f5;
}

.faq-row {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.html-collapse {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  background: #fafbfc;
}
.html-collapse summary { cursor: pointer; font-weight: 600; color: #4e5969; font-size: 13px; }
.html-preview-box {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 16px;
  max-height: 460px;
  overflow: auto;
}
.html-preview-box img { max-width: 100%; height: auto; }

/* 素材工坊分栏 */
.studio-split {
  display: grid;
  grid-template-columns: 1.6fr 0.95fr;
  gap: 18px;
  align-items: start;
}
.studio-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 10px;
  max-height: 580px;
  overflow-y: auto;
  padding-right: 4px;
}
.media-card {
  border: 2px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.media-card.ref-active { border-color: var(--ali-blue); }
.media-card img {
  width: 100%;
  height: 130px;
  object-fit: contain;
  cursor: pointer;
  background: #f8fafc;
}
.media-card-body { padding: 7px; font-size: 11px; }

.side-panel-card {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}
.side-panel-card h4 { margin: 0 0 10px; font-size: 14px; }

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.video-card { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.video-card video { width: 100%; max-height: 180px; background: #000; display: block; }

/* 自动上传通道说明卡 */
.channel-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fafbfc;
}
.channel-card.active-channel {
  border-color: #fdba74;
  background: #fff7ed;
}
.channel-card h4 { margin: 6px 0; font-size: 14px; }
.channel-card p { margin: 0; font-size: 12px; color: var(--text-sub); line-height: 1.55; }
.ch-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--ali-orange);
  background: rgba(255, 106, 0, 0.12);
  padding: 2px 8px;
  border-radius: 4px;
}

/* 底部固定提交栏（复刻国际站吸底栏） */
.publish-bottom-bar {
  position: fixed;
  left: 280px;
  right: 0;
  bottom: 0;
  background: #ffffff;
  border-top: 1px solid var(--line);
  padding: 12px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06);
  z-index: 45;
}
.bottom-left { display: flex; align-items: center; gap: 10px; }
.bottom-live-msg { font-size: 12.5px; color: var(--text-sub); }
.bottom-actions { display: flex; gap: 10px; align-items: center; }

/* 告警、徽章与按钮 */
.ali-alert-warn {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
}
.ali-alert-head { color: #b45309; margin-bottom: 8px; }
.hard-spec-row {
  display: grid;
  grid-template-columns: 160px 1fr 200px auto;
  gap: 10px;
  align-items: center;
  background: #fff;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 6px 10px;
  margin-bottom: 6px;
}

.compliance-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.metric-box { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.metric-val { font-size: 18px; font-weight: 700; margin-top: 4px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 15px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-lg { padding: 11px 22px; font-size: 14px; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-xs { padding: 4px 9px; font-size: 11.5px; }

.btn-primary { background: var(--ali-blue); color: #fff; }
.btn-primary:hover { filter: brightness(0.94); }
.btn-orange { background: var(--ali-orange); color: #fff; }
.btn-orange:hover { filter: brightness(1.06); }
.btn-ai { background: linear-gradient(135deg, #6e46ff, #1664ff); color: #fff; }
.btn-ai-ghost {
  background: #f3f0ff;
  color: #5b21b6;
  border-color: #ddd6fe;
}
.btn-ai-ghost:hover { background: #ede9fe; }
.btn-outline { background: #fff; color: #374151; border-color: var(--line-strong); }
.btn-outline:hover { border-color: var(--ali-blue); color: var(--ali-blue); }
.btn-danger-outline { background: #fff; color: var(--danger); border-color: #fecaca; }
.btn-sidebar-ghost {
  background: #1d2233;
  color: #cbd5e1;
  border-color: var(--sidebar-border);
  justify-content: flex-start;
  font-size: 12px;
}

.ali-tag-orange {
  display: inline-block;
  background: #fff7ed;
  color: var(--ali-orange);
  border: 1px solid #fed7aa;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: #e2e8f0;
  color: #475569;
}
.badge-indigo { background: #dbeafe; color: #1d4ed8; }
.badge-warn { background: #fef3c7; color: #b45309; }
.badge-ok { background: #dcfce7; color: #15803d; }
.badge-danger { background: #fee2e2; color: #b91c1c; }

.filter-pills { display: flex; gap: 6px; }
.pill {
  background: #f1f5f9;
  border: 1px solid var(--line);
  color: #475569;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.pill.active { background: var(--ali-blue); border-color: var(--ali-blue); color: #fff; }

.alt-box {
  margin-top: 8px;
  background: #faf5ff;
  border: 1px dashed #c4b5fd;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
}
.alt-item { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; }
.variants-bar {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 14px;
  font-size: 12.5px;
}
.job-row {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 8px;
}
.progress-track {
  height: 6px;
  background: #e2e8f0;
  border-radius: 999px;
  margin-top: 6px;
  overflow: hidden;
}
.progress-fill { height: 100%; background: var(--ali-orange); transition: width 0.3s; }

.chk-line { display: flex; align-items: center; gap: 7px; font-size: 12.5px; margin: 8px 0; cursor: pointer; }
.char-counter { font-family: ui-monospace, monospace; font-size: 12px; color: var(--text-sub); }
.char-counter.over { color: var(--danger); font-weight: 700; }
.mono-id { font-family: ui-monospace, monospace; font-size: 11.5px; color: #94a3b8; }
.status-msg { font-size: 12px; color: var(--text-sub); margin-top: 6px; }
.empty-hint { padding: 24px 12px; text-align: center; color: #94a3b8; font-size: 12.5px; }
.divider { border: none; border-top: 1px solid var(--line); margin: 14px 0; }

/* 弹窗 */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal {
  background: #fff;
  border-radius: 12px;
  width: 650px;
  max-width: 94vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-header h3 { margin: 0; font-size: 15.5px; }
.icon-btn { background: transparent; border: none; font-size: 18px; cursor: pointer; color: #64748b; }
.modal-tabs { display: flex; border-bottom: 1px solid var(--line); padding: 0 20px; }
.modal-tab {
  background: transparent;
  border: none;
  padding: 10px 14px;
  cursor: pointer;
  color: var(--text-sub);
  border-bottom: 2px solid transparent;
}
.modal-tab.active { color: var(--ali-blue); border-bottom-color: var(--ali-blue); font-weight: 600; }
.modal-body { padding: 18px 20px; }
.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 12px; font-weight: 600; color: #4b5563; margin-bottom: 5px; }
.modal-footer { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 16px; }

.chip-group { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip {
  background: #f1f5f9;
  border: 1px solid var(--line-strong);
  color: #334155;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  cursor: pointer;
}
.chip:hover { border-color: var(--ali-blue); color: var(--ali-blue); }

.single-img-preview-row { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 12px; }
.single-img-preview-row img {
  width: 136px;
  height: 136px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 72px;
  background: #1e293b;
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  z-index: 200;
  font-size: 13px;
}
