/*
 * LinsGeek ERP —— 商品管理：手动关联已有刊登、解除关联（原型，配合 74-sku-link.js）
 * 样式名用 sl- 前缀；弹窗挂在 #lg-sl 下。回滚：删除 74-sku-link.css + 74-sku-link.js。
 */
#lg-sl, .sl-cf-mask, .sl-add-cell, .sl-add-pop, .sl-add-edit, .sl-un, .sl-empty-more { --l-brand: #0d7b6d; --l-soft: #e7f2f0; --l-ink: #0f1a18; --l-muted: #5f6e6b; --l-line: #e6ecea; --l-bad: #b3261e; font-family: 'Noto Sans SC', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif; }

/* ---------- 入口按钮 ---------- */
.sl-add-cell, .sl-add-pop, .sl-add-edit { display: inline-flex; align-items: center; gap: 4px; border: 1px dashed #b9cbc7; border-radius: 14px; background: #fff; color: var(--l-brand); font: inherit; font-size: 12px; line-height: 1; white-space: nowrap; cursor: pointer; }
.sl-add-cell i, .sl-add-pop i, .sl-add-edit i { font-style: normal; font-weight: 700; font-size: 14px; }
.sl-add-cell:hover, .sl-add-pop:hover, .sl-add-edit:hover { border-style: solid; background: var(--l-soft); }
.sl-add-cell:focus-visible, .sl-add-pop:focus-visible, .sl-add-edit:focus-visible, .sl-un:focus-visible { outline: 2px solid #13b8a6; outline-offset: 2px; }
/* 70 把「关联」格里除了它自己的图标以外的东西都藏了，这里要放出来 */
.custom_td.lg-mp-linkcell > button.sl-add-cell { display: flex !important; flex-direction: column; align-items: flex-start; gap: 4px; max-width: 100%; height: auto; padding: 0; border: 0; border-radius: 6px; background: none; }
.custom_td.lg-mp-linkcell > button.sl-add-cell i { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border: 1px dashed #9fbdb7; border-radius: 6px; font-size: 14px; line-height: 1; }
.custom_td.lg-mp-linkcell > button.sl-add-cell span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-size: 11.5px; line-height: 16px; }
.custom_td.lg-mp-linkcell > button.sl-add-cell:hover { background: none; }
.custom_td.lg-mp-linkcell > button.sl-add-cell:hover i { border-style: solid; background: var(--l-soft); }
.custom_td.lg-mp-linkcell > button.sl-add-cell:hover span { text-decoration: underline; }
.sl-add-pop { display: flex; justify-content: center; width: 100%; height: 32px; margin-top: 8px; font-size: 13px; }
.sl-add-edit { height: 30px; margin-left: auto; padding: 0 12px; font-size: 13px; font-weight: 600; }
#lg-se #se-links h2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sl-empty-more { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed #d5dedb; }
.sl-empty-more span { color: var(--l-muted); font-size: 13px; }
.sl-empty-more .sl-add-edit { margin-left: 0; }

/* 解除关联（列表明细弹层、编辑页的刊登列表里每一条后面） */
.sl-un { flex: none; height: 24px; padding: 0 8px; border: 0; border-radius: 12px; background: none; color: var(--l-muted); font: inherit; font-size: 12px; white-space: nowrap; cursor: pointer; }
.sl-un:hover { background: #fdecec; color: var(--l-bad); }
.sl-un.sure { background: var(--l-bad); color: #fff; }

/* ---------- 弹窗 ---------- */
#lg-sl.sl-mask { position: fixed; inset: 0; z-index: 3000; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(10, 30, 26, .45); }
#lg-sl * { box-sizing: border-box; }
#lg-sl .sl-dlg { display: flex; flex-direction: column; width: min(1000px, 100%); max-height: calc(100vh - 32px); padding: 20px 20px 16px; border-radius: 16px; background: #fff; color: var(--l-ink); font-size: 14px; line-height: 1.5; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .35); }
#lg-sl .sl-h { display: flex; align-items: flex-start; gap: 12px; }
#lg-sl .sl-h > div { flex: 1; min-width: 0; }
#lg-sl h2 { margin: 0; font-size: 18px; font-weight: 700; }
#lg-sl .sl-h p { margin: 2px 0 0; color: var(--l-muted); font-size: 13px; }
#lg-sl .sl-x { flex: none; width: 32px; height: 32px; border: 0; border-radius: 50%; background: none; color: var(--l-muted); font-size: 22px; line-height: 1; cursor: pointer; }
#lg-sl .sl-x:hover { background: #eef2f1; }
#lg-sl .sl-prod { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: #f7faf9; border: 1px solid var(--l-line); }
#lg-sl .sl-prod img { flex: none; width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: var(--l-soft); }
#lg-sl .sl-prod div { min-width: 0; display: flex; flex-direction: column; }
#lg-sl .sl-prod b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#lg-sl .sl-prod span { color: var(--l-muted); font-size: 12.5px; }
#lg-sl .sl-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
#lg-sl .sl-f select, #lg-sl .sl-f input { height: 36px; padding: 0 10px; border: 1px solid #d5dedb; border-radius: 10px; background: #fff; color: var(--l-ink); font: inherit; font-size: 13.5px; outline: none; }
#lg-sl .sl-f select:focus, #lg-sl .sl-f input:focus { border-color: #13b8a6; box-shadow: 0 0 0 3px rgba(19, 184, 166, .15); }
#lg-sl .sl-f.kw { flex: 1; min-width: 200px; }
#lg-sl .sl-f.kw input { width: 100%; }
#lg-sl .sl-list { flex: 1 1 auto; min-height: 220px; margin-top: 12px; overflow: auto; border: 1px solid var(--l-line); border-radius: 12px; }
#lg-sl .sl-list h3 { position: sticky; top: 0; z-index: 1; margin: 0; padding: 6px 12px; background: #f3f6f5; color: var(--l-muted); font-size: 12px; font-weight: 700; }
#lg-sl .sl-l + .sl-l, #lg-sl .sl-l + h3 { border-top: 1px solid var(--l-line); }
#lg-sl .sl-l header { display: flex; align-items: center; gap: 10px; padding: 10px 12px 6px; }
#lg-sl .sl-l header > div { min-width: 0; display: flex; flex-direction: column; }
#lg-sl .sl-l header b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#lg-sl .sl-l header span { color: var(--l-muted); font-size: 12px; overflow-wrap: anywhere; }
#lg-sl .mp-logo { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 28px; height: 28px; border-radius: 7px; overflow: hidden; font-size: 10px; font-weight: 700; }
#lg-sl .mp-logo img { width: 100%; height: 100%; object-fit: contain; }
/* 变种行：固定列宽（勾选 | 变种和平台 SKU | 匹配原因 | 售价 | 平台库存 | 状态 | 关联 | 解绑），每一行的列都对齐 */
#lg-sl .sl-v { display: grid; grid-template-columns: 18px minmax(0, 1fr) 108px 80px 96px 82px 140px 88px;   /* 宽度按葡语算（Título parecido、Em análise、Vinculado a SKU-…、Desvincular 都放得下），中文也用同一套 */ align-items: center; column-gap: 10px; margin: 0 12px 6px 50px; padding: 7px 10px; border: 1px solid var(--l-line); border-radius: 10px; cursor: pointer; }
#lg-sl .sl-c { display: flex; align-items: center; min-width: 0; }
#lg-sl .sl-c.why, #lg-sl .sl-c.st { justify-content: flex-start; }
#lg-sl .sl-c.act { justify-content: flex-end; }
#lg-sl .sl-v:hover { background: #f7faf9; }
#lg-sl .sl-v.on { border-color: var(--l-brand); background: var(--l-soft); }
#lg-sl .sl-v.linked { cursor: default; background: #fafbfb; }
#lg-sl .sl-v input { flex: none; width: 17px; height: 17px; margin: 0; accent-color: var(--l-brand); cursor: pointer; }
#lg-sl .sl-v.linked input { cursor: not-allowed; }
#lg-sl .sl-va { min-width: 0; display: flex; flex-direction: column; }
#lg-sl .sl-va b { font-weight: 600; font-size: 13.5px; }
#lg-sl .sl-va small { display: flex; flex-wrap: wrap; column-gap: 8px; color: var(--l-muted); font-size: 12px; }
#lg-sl .sl-va small span { white-space: nowrap; }
#lg-sl .sl-why { padding: 1px 8px; border-radius: 9px; background: #ecebfb; color: #4a43b5; font-style: normal; font-size: 12px; font-weight: 600; white-space: nowrap; }
#lg-sl .sl-num { text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
#lg-sl .sl-num.stock { color: var(--l-muted); }
#lg-sl .sl-pill { padding: 1px 8px; border-radius: 9px; background: #eef2f1; color: #4b5a57; font-size: 12px; white-space: nowrap; }
#lg-sl .sl-pill.ok { background: #e3f5ec; color: #17794a; }
#lg-sl .sl-pill.warn { background: #fff4df; color: #9a6410; }
#lg-sl .sl-own { color: var(--l-muted); font-size: 12px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#lg-sl .sl-own.mine { color: var(--l-brand); font-weight: 600; }
#lg-sl .sl-own.other { color: #9a6410; font-weight: 600; }
#lg-sl .sl-unbind { flex: none; height: 26px; padding: 0 9px; border: 1px solid #f1c4c0; border-radius: 13px; background: #fff; color: var(--l-bad); font: inherit; font-size: 12px; white-space: nowrap; cursor: pointer; }
#lg-sl .sl-unbind:hover { background: #fdecec; }
#lg-sl .sl-unbind:focus-visible { outline: 2px solid #13b8a6; outline-offset: 2px; }
#lg-sl .sl-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 48px 16px; text-align: center; }
#lg-sl .sl-empty span { max-width: 460px; color: var(--l-muted); font-size: 13px; }
#lg-sl .sl-f2 { margin-top: 12px; }
#lg-sl .sl-sync { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; cursor: pointer; }
#lg-sl .sl-sync input { width: 17px; height: 17px; margin: 0; accent-color: var(--l-brand); }
#lg-sl .sl-note { margin: 4px 0 0; color: var(--l-muted); font-size: 12.5px; }
#lg-sl .sl-note.warn { padding: 6px 10px; border-radius: 8px; background: #fff8e6; color: #6b4e00; }
#lg-sl .sl-btns { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 12px; }
#lg-sl .sl-btns span { margin-right: auto; color: var(--l-brand); font-size: 13px; font-weight: 600; }
#lg-sl .sl-btn { height: 36px; padding: 0 18px; border: 1px solid #d5dedb; border-radius: 18px; background: #fff; color: var(--l-ink); font: inherit; white-space: nowrap; cursor: pointer; }
#lg-sl .sl-btn.pri { border-color: var(--l-brand); background: var(--l-brand); color: #fff; font-weight: 600; }
#lg-sl .sl-btn[disabled] { opacity: .45; cursor: not-allowed; }
#lg-sl .sl-btn:focus-visible, #lg-sl .sl-x:focus-visible { outline: 2px solid #13b8a6; outline-offset: 2px; }

@media (max-width: 767px) {
  #lg-sl .sl-dlg { padding: 16px; }
  #lg-sl .sl-v { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-left: 12px; }
  #lg-sl .sl-va { flex: 1 1 60%; }
  #lg-sl .sl-c.why:empty, #lg-sl .sl-c.act:empty { display: none; }
  #lg-sl .sl-num, #lg-sl .sl-own { text-align: left; }
  #lg-sl .sl-btns .sl-btn { flex: 1; }
  #lg-sl .sl-btns span { flex-basis: 100%; }
  #lg-sl .sl-btns { flex-wrap: wrap; }
}

/* ---------- 确认框（解绑确认、关联后选怎么处理库存）：挂在 body 上，叠在关联弹窗上面 ---------- */
.sl-cf-mask { position: fixed; inset: 0; z-index: 3100; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(10, 30, 26, .35); }
.sl-cf-mask * { box-sizing: border-box; }
.sl-cf { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 18px 20px 16px; border-radius: 16px; background: #fff; color: var(--l-ink); font-size: 14px; line-height: 1.55; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .4); }
.sl-cf-h { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.sl-cf-h h3 { flex: 1; margin: 0; font-size: 17px; font-weight: 700; }
.sl-cf .sl-x { flex: none; width: 30px; height: 30px; border: 0; border-radius: 50%; background: none; color: var(--l-muted); font-size: 22px; line-height: 1; cursor: pointer; }
.sl-cf .sl-x:hover { background: #eef2f1; }
.sl-cf-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--l-line); border-radius: 12px; background: #f7faf9; }
.sl-cf-item > div { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.sl-cf-item b { font-weight: 600; overflow-wrap: anywhere; }
.sl-cf-item span { color: var(--l-muted); font-size: 12.5px; overflow-wrap: anywhere; }
.sl-cf-item strong { color: var(--l-ink); }
.sl-cf .mp-logo { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 28px; height: 28px; border-radius: 7px; overflow: hidden; font-size: 10px; font-weight: 700; }
.sl-cf .mp-logo img { width: 100%; height: 100%; object-fit: contain; }
.sl-cf-list { margin: 10px 0 0; padding-left: 18px; color: #2b3533; font-size: 13.5px; }
.sl-cf-list li + li { margin-top: 3px; }
.sl-opt { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--l-line); border-radius: 12px; }
.sl-opt + .sl-opt { margin-top: 8px; }
.sl-opt.pri { border-color: #b9dcd5; background: #f3faf8; }
.sl-opt b { font-size: 14px; }
.sl-opt span { color: var(--l-muted); font-size: 13px; }
.sl-opt-warn { display: block; margin-top: 6px; padding: 6px 10px; border-radius: 8px; background: #fff8e6; color: #6b4e00; font-style: normal; font-size: 12.5px; }
.sl-opt-warn.soft { background: #f7faf9; color: var(--l-muted); }
.sl-opt .sl-cf-list { margin-top: 4px; font-size: 12.5px; color: #6b4e00; }
.sl-cf-f { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.sl-cf .sl-btn { height: 36px; padding: 0 16px; border: 1px solid #d5dedb; border-radius: 18px; background: #fff; color: var(--l-ink); font: inherit; white-space: nowrap; cursor: pointer; }
.sl-cf .sl-btn.pri { border-color: var(--l-brand); background: var(--l-brand); color: #fff; font-weight: 600; }
.sl-cf .sl-btn.bad { border-color: var(--l-bad); background: var(--l-bad); color: #fff; font-weight: 600; }
.sl-cf .sl-btn:focus-visible, .sl-cf .sl-x:focus-visible { outline: 2px solid #13b8a6; outline-offset: 2px; }
@media (max-width: 767px) { .sl-cf-f .sl-btn { flex: 1; } }

/* ---------- SPU 商品、组合商品列表的「关联」列（原生那一格的内容藏起来，换成自己的按钮） ---------- */
.sl-linkcell > :not(.sl-cellbox) { display: none !important; }
.sl-cellbox { --l-brand: #0d7b6d; --l-soft: #e7f2f0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; max-width: 100%; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--l-brand); font: inherit; cursor: pointer; }
.sl-cellbox > i { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border: 1px dashed #9fbdb7; border-radius: 6px; font-style: normal; font-weight: 700; font-size: 14px; line-height: 1; }
.sl-cellbox > span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-size: 11.5px; line-height: 16px; white-space: nowrap; }
.sl-cellbox:hover > i { border-style: solid; background: var(--l-soft); }
.sl-cellbox:hover > span:last-child { text-decoration: underline; }
.sl-cellbox:focus-visible { outline: 2px solid #13b8a6; outline-offset: 2px; }
.sl-cellbox .sl-stack { display: flex; align-items: center; height: 20px; }
.sl-cellbox .sl-stack > * + * { margin-left: -8px; }
.sl-cellbox .mp-logo { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 20px; height: 20px; border-radius: 6px; overflow: hidden; font-size: 9px; font-weight: 700; box-shadow: 0 0 0 1.5px #fff; }
.sl-cellbox .mp-logo img { width: 100%; height: 100%; object-fit: contain; }
.sl-cellbox .sl-stack em { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 6px; background: var(--l-soft); font-style: normal; font-size: 10px; font-weight: 700; box-shadow: 0 0 0 1.5px #fff; }

/* SPU 弹窗：勾选的在线产品下面一行选「对应变种」 */
#lg-sl .sl-to { grid-column: 2 / -1; display: flex; align-items: center; gap: 8px; padding-top: 6px; color: var(--l-muted); font-size: 12.5px; }
#lg-sl .sl-to select { max-width: 100%; height: 30px; padding: 0 8px; border: 1px solid #b9dcd5; border-radius: 8px; background: #fff; color: var(--l-ink); font: inherit; font-size: 13px; }
#lg-sl .sl-to select:focus { outline: none; border-color: #13b8a6; box-shadow: 0 0 0 3px rgba(19, 184, 166, .15); }
@media (max-width: 767px) { #lg-sl .sl-to { flex-basis: 100%; flex-wrap: wrap; } }

/* 接真实后端：分页、加载时变淡 */
#lg-sl .sl-pager { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px; border-top: 1px solid var(--l-line); color: var(--l-muted); font-size: 13px; }
#lg-sl .sl-pager .sl-btn { height: 30px; padding: 0 12px; font-size: 13px; }
#lg-sl .sl-list.sl-dim { opacity: .55; pointer-events: none; }
