:root {
  --ink: #1f2a24;
  --muted: #6f786f;
  --paper: #f6f3eb;
  --card: #fffdf8;
  --line: #ded8ca;
  --green: #315a45;
  --green-soft: #dfe9e1;
  --orange: #c96d38;
  --orange-soft: #f8e5d8;
  --red: #9d3c34;
  --shadow: 0 14px 34px rgba(48, 53, 45, .08);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font-size: 14px; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 216px minmax(0, 1fr); transition: grid-template-columns .15s ease; }
.nav-collapsed .app-shell { grid-template-columns: 60px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 20px 14px 14px; background: #243a2f; color: #f6f3eb; display: flex; flex-direction: column; min-height: 0; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin: 0 2px 14px; }
.brand { display: flex; gap: 10px; align-items: center; min-width: 0; }
.brand-mark { width: 36px; height: 36px; flex-shrink: 0; border: 1px solid #839a8c; display: grid; place-items: center; font-family: Georgia, serif; font-size: 16px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; letter-spacing: .16em; }
.brand small { margin-top: 3px; color: #b8c5bd; font-size: 11px; letter-spacing: .08em; }
nav { display: grid; gap: 2px; overflow-y: auto; min-height: 0; flex: 1; align-content: start; }
nav { scrollbar-width: none; }
nav::-webkit-scrollbar { display: none; }
.nav-item { padding: 8px 10px; border-radius: 8px; color: #cdd7d1; display: flex; gap: 10px; align-items: center; transition: .15s ease; font-size: 14px; white-space: nowrap; }
.nav-item .ab { flex-shrink: 0; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px; background: rgba(255,255,255,.08); font-style: normal; font-size: 11px; color: #a9b8ae; letter-spacing: 0; }
.nav-item.active .ab { background: var(--orange); color: #fff; }
.nav-toggle { flex-shrink: 0; width: 28px; height: 28px; border: 1px solid rgba(255,255,255,.18); border-radius: 7px; background: transparent; display: grid; place-items: center; }
.nav-toggle span { width: 12px; height: 2px; background: #cdd7d1; box-shadow: 0 -4px 0 #cdd7d1, 0 4px 0 #cdd7d1; }
.nav-collapsed .sidebar { padding: 16px 10px 12px; }
.nav-collapsed .sidebar .label, .nav-collapsed .nav-group small { display: none; }
.nav-collapsed .sidebar-top { flex-direction: column; gap: 10px; margin-bottom: 12px; }
.nav-collapsed .nav-item { justify-content: center; padding: 7px 0; gap: 0; }
.nav-collapsed .nav-item.active { box-shadow: none; }
.nav-collapsed .nav-group { border-top-color: rgba(255,255,255,.14); }
.nav-collapsed .sidebar-foot { justify-content: center; padding: 10px 0 0; }
.nav-collapsed .identity { gap: 0; }
.nav-item span { color: #8fa095; font-size: 11px; font-variant-numeric: tabular-nums; }
.nav-item:hover, .nav-item.active { color: #fff; background: rgba(255,255,255,.09); }
.nav-item.active { box-shadow: inset 3px 0 var(--orange); }
.sidebar-foot { margin-top: 12px; border-top: 1px solid rgba(255,255,255,.12); padding: 12px 8px 0; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.identity { display: flex; gap: 9px; align-items: center; }
.identity .avatar { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: #e8d6b7; color: #314638; font-weight: 700; }
.identity strong, .identity small { display: block; }
.identity small { color: #aebbb3; font-size: 11px; margin-top: 2px; }
.quiet { color: #cdd7d1; background: none; border: 0; padding: 5px; }
.main { min-width: 0; padding: 0 32px 48px; }
.nav-collapsed .main { padding: 0 28px 48px; }
.demo-banner { margin: 0 -32px 28px; height: 31px; display: grid; place-items: center; background: #ead7b8; color: #6d4b25; font-size: 12px; letter-spacing: .04em; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 0 0 24px; }
.button-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font: 600 30px/1.2 Georgia, "Songti SC", serif; letter-spacing: .02em; }
.page-head p { margin: 7px 0 0; color: var(--muted); }
.head-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.metric, .card { background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 10px; }
.metric { padding: 20px; position: relative; overflow: hidden; display: block; }
a.metric:hover { border-color: var(--green); transform: translateY(-1px); }
.metric::after { content: ""; position: absolute; right: -16px; bottom: -26px; width: 72px; height: 72px; border: 1px solid var(--line); transform: rotate(38deg); }
.metric small { color: var(--muted); }
.metric strong { display: block; margin-top: 7px; font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }
.metric em { font-style: normal; color: var(--muted); font-size: 12px; }
.card { padding: 20px; }
.card h2, .card h3 { margin: 0 0 14px; }
.card h2 { font-size: 17px; }
.card h3 { font-size: 14px; }
.section { margin-top: 22px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.section-title h2 { margin: 0; font-size: 17px; }
.section-title a { color: var(--green); font-size: 13px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--card); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th { color: var(--muted); font-size: 12px; font-weight: 500; text-align: left; background: #f1eee6; }
th, td { padding: 12px 14px; border-bottom: 1px solid #e9e4d9; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbf8f1; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.strong { font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .01em; }
.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 99px; padding: 4px 9px; font-size: 12px; color: #365441; background: var(--green-soft); white-space: nowrap; }
.pill.warn { color: #814721; background: var(--orange-soft); }
.pill.danger { color: var(--red); background: #f3deda; }
.pill.neutral { color: #606861; background: #eceae4; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 0 14px; border-radius: 7px; border: 1px solid var(--green); background: var(--green); color: white; font-weight: 600; }
.btn:hover { filter: brightness(1.06); }
.btn.secondary { color: var(--green); background: transparent; }
.btn.orange { border-color: var(--orange); background: var(--orange); }
.btn.danger, .btn.small.danger { border-color: #a33428; background: #a33428; color: #fff; }
.btn.danger:disabled { opacity: .45; cursor: not-allowed; }
.btn.small { min-height: 30px; padding: 0 10px; font-size: 12px; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; max-width: 100%; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
label { display: grid; gap: 6px; color: #414a43; font-size: 12px; }
input, select, textarea { width: 100%; border: 1px solid #cfc8ba; border-radius: 7px; padding: 10px 11px; background: #fffefa; color: var(--ink); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(49,90,69,.12); }
textarea { min-height: 90px; resize: vertical; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 15px; }
.filters { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.filters label { min-width: 180px; }
.empty { padding: 34px; text-align: center; color: var(--muted); }
.timeline { position: relative; display: grid; gap: 0; }
.timeline-item { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding-bottom: 18px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot { width: 12px; height: 12px; margin: 4px auto 0; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px var(--green-soft); z-index: 1; }
.timeline-item:not(:last-child) .timeline-dot::after { content: ""; display: block; width: 1px; height: 48px; background: var(--line); margin: 12px auto 0; }
.timeline-item strong, .timeline-item small { display: block; }
.timeline-item small { color: var(--muted); margin-top: 3px; }
.sku-hero { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; }
.sku-code { font-size: 29px; font-weight: 650; letter-spacing: .035em; }
.barcode-box { min-width: 260px; padding: 14px; background: white; border: 1px solid var(--line); text-align: center; }
.barcode-box img { width: 230px; height: 58px; object-fit: fill; }
.barcode-box small { display: block; margin-top: 7px; }
.detail-list { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.detail-list div { padding: 12px 0; border-bottom: 1px solid var(--line); }
.detail-list dt { color: var(--muted); font-size: 12px; }
.detail-list dd { margin: 5px 0 0; font-weight: 600; }
dialog { width: min(720px, calc(100vw - 30px)); border: 0; padding: 0; border-radius: 11px; box-shadow: 0 24px 80px rgba(0,0,0,.25); background: var(--card); }
dialog::backdrop { background: rgba(24,31,26,.55); backdrop-filter: blur(2px); }
.dialog-body { padding: 24px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.dialog-head h2 { margin: 0; }
.icon-btn { border: 0; background: none; font-size: 22px; color: var(--muted); }
.notice { padding: 12px 14px; border-left: 3px solid var(--orange); background: var(--orange-soft); color: #704728; border-radius: 4px; }
.flow { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.flow span { background: #efece3; padding: 7px 10px; border-radius: 6px; }
.flow i { color: #9ca29b; font-style: normal; }
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; background: #23382d; }
.login-story { color: white; padding: 9vw; display: flex; flex-direction: column; justify-content: center; background: radial-gradient(circle at 20% 20%, #496d57, transparent 38%), #23382d; }
.login-story h1 { margin: 0 0 18px; font: 500 clamp(42px, 5vw, 72px)/1.06 Georgia, "Songti SC", serif; max-width: 650px; }
.login-story p { color: #c7d2ca; font-size: 16px; max-width: 560px; line-height: 1.8; }
.login-form { padding: 8vw; display: grid; place-items: center; background: var(--paper); }
.login-card { width: min(380px, 100%); }
.login-card h2 { font-size: 27px; margin: 0; }
.login-card > p { color: var(--muted); margin: 8px 0 26px; }
.login-card form { display: grid; gap: 14px; }
.error { color: var(--red); background: #f3deda; padding: 10px 12px; border-radius: 6px; }
code { padding: 2px 5px; background: #ebe8df; border-radius: 4px; }
.catalog-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 13px; }
.catalog-card { min-width: 0; overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.catalog-card > img, .catalog-placeholder { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; background: #ece8df; }
.catalog-placeholder { display: grid; place-items: center; color: var(--muted); }
.catalog-card-body { padding: 12px; }
.catalog-card-body strong, .catalog-card-body small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.catalog-card-body small { color: var(--muted); margin: 4px 0 9px; }
.tag-row { display: flex; gap: 4px; flex-wrap: wrap; min-height: 25px; margin-bottom: 9px; }
.tag-chip { display: inline-flex; padding: 3px 7px; border-radius: 99px; color: #35513f; background: var(--green-soft); font-size: 11px; }
.tag-chip.neutral { color: var(--muted); background: #eceae4; }
.image-gallery { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.image-gallery figure { margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.image-gallery img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: contain; background: #eeeae1; }
.image-gallery figcaption { padding: 9px; color: var(--muted); font-size: 11px; }
.tag-edit-list, .tag-definition-list { display: grid; gap: 7px; }
.tag-picker-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 9px; }
.tag-picker { position: relative; border: 1px solid var(--line); border-radius: 8px; background: #faf8f2; }
.tag-picker summary { cursor: pointer; display: flex; justify-content: space-between; gap: 8px; padding: 11px; font-weight: 650; }
.tag-picker summary span { color: var(--green); font-size: 12px; }
.tag-picker-options { position: absolute; z-index: 8; left: 0; right: 0; max-height: 310px; overflow: auto; padding: 8px; border: 1px solid var(--line); border-radius: 0 0 8px 8px; background: white; box-shadow: var(--shadow); }
.tag-picker-options label { display: flex; align-items: flex-start; gap: 7px; padding: 7px 5px; font-size: 12px; }
.tag-picker-options input { width: auto; margin-top: 2px; }
.tag-edit-row { display: grid; grid-template-columns: minmax(180px,1fr) auto auto auto auto; gap: 9px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.definition-row { display: grid; grid-template-columns: 120px 1fr 1.4fr 80px auto; gap: 6px; align-items: center; }
.definition-row input, .definition-row select { padding: 7px 8px; }
.flat { box-shadow: none; }
.compact { grid-template-columns: repeat(2,minmax(0,1fr)); }
.stat-value { display: block; margin-top: 5px; font-size: 24px; }
.danger-text { color: var(--red); }
.full { width: 100%; }
.action-card p { min-height: 42px; color: var(--muted); line-height: 1.55; }
.chain-mini { display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; margin: 8px 0; }
.chain-mini span { padding: 6px 3px; border-radius: 5px; background: #f1eee6; color: var(--muted); font-size: 10px; text-align: center; }
.chain-mini b { display: block; color: var(--ink); font-size: 13px; margin-top: 2px; }
.stage-grid { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 9px; }
.stage { position: relative; min-width: 0; padding: 16px 13px; border: 1px solid var(--line); border-top: 4px solid var(--green); border-radius: 9px; background: var(--card); box-shadow: var(--shadow); }
.stage > b { position: absolute; right: 11px; top: 9px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--green); font-size: 11px; }
.stage small { color: var(--orange); }
.stage h3 { margin: 8px 0 15px; font-size: 14px; }
.stage > strong { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.stage p { color: var(--muted); font-size: 11px; line-height: 1.5; margin: 7px 0 0; }
.image-strip { display: grid; grid-template-columns: 145px 1fr; gap: 17px; align-items: center; }
.image-strip > img, .image-strip > .catalog-placeholder { width: 145px; height: 180px; object-fit: contain; border-radius: 7px; background: #eeeae1; }
.compact-metrics div { padding: 10px; background: #f1eee6; border-radius: 7px; }
.compact-metrics small, .compact-metrics strong { display: block; }
.compact-metrics strong { margin-top: 6px; font-size: 20px; }
.production-sheet table { min-width: 2550px; }
.production-sheet .sticky-col { position: sticky; left: 0; z-index: 2; background: var(--card); box-shadow: 1px 0 var(--line); }
.production-sheet thead th:first-child { position: sticky; left: 0; z-index: 3; }
.demo-logins { margin-top: 20px; padding: 12px; border: 1px solid var(--line); border-radius: 7px; background: #fffdf8; }
.demo-logins p { margin: 5px 0; }
.finance-line { display: grid; grid-template-columns: 90px 90px 110px minmax(230px,1fr) 130px auto; gap: 6px; align-items: center; }
.finance-line input, .finance-line select { padding: 7px 8px; }
.pagination { display: flex; align-items: center; justify-content: space-between; color: var(--muted); }
.pagination > div { display: flex; gap: 7px; }
@media (max-width: 1040px) { .cols-4 { grid-template-columns: repeat(2, 1fr); } .detail-list { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 1180px) { .catalog-grid { grid-template-columns: repeat(4,minmax(0,1fr)); } }
@media (max-width: 1280px) { .stage-grid { grid-template-columns: repeat(3,minmax(0,1fr)); } }
@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar { position: static; height: auto; padding: 13px; }
  .brand { margin: 0 0 12px; }
  nav { display: flex; overflow-x: auto; padding-bottom: 4px; }
  .nav-item { white-space: nowrap; }
  .sidebar-foot { position: absolute; right: 12px; top: 9px; border: 0; padding: 0; }
  .sidebar-foot .identity span:not(.avatar) { display: none; }
  .sidebar-foot form { display: block; }
  .main { padding: 0 14px 36px; }
  .demo-banner { margin: 0 -14px 20px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .cols-4, .cols-3, .cols-2, .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .sku-hero { grid-template-columns: 1fr; }
  .barcode-box { min-width: 0; }
  .login-page { grid-template-columns: 1fr; }
  .login-story { display: none; }
  .login-form { min-height: 100vh; }
  .catalog-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .image-gallery { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .tag-edit-row, .definition-row { grid-template-columns: 1fr; }
  .tag-picker-grid { grid-template-columns: 1fr; }
  .tag-picker-options { position: static; box-shadow: none; }
  .stage-grid { grid-template-columns: 1fr 1fr; }
  .image-strip { grid-template-columns: 100px 1fr; }
  .image-strip > img, .image-strip > .catalog-placeholder { width: 100px; height: 130px; }
  .finance-line { grid-template-columns: 1fr; }
}

/* 数据连接 / 快售仓库事实 */
.notice.danger { border-left-color: var(--red); background: #f3deda; color: #7a2b22; }
.small.danger { color: var(--red); }
table.compact { width: 100%; min-width: 0; border-collapse: collapse; margin-top: 8px; font-size: 13px; }
table.compact th, table.compact td { padding: 6px 8px; border-bottom: 1px solid #e7e3da; text-align: left; vertical-align: top; }
table.compact th.num, table.compact td.num { text-align: right; }
label.checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #555; }
label.checkbox input { width: auto; }
.stage .ks-fact { display: block; margin-top: 4px; font-size: 12px; color: #365441; }

.nav-group { margin: 8px 0 0; padding: 6px 0 0; border-top: 1px solid rgba(255,255,255,.08); display: grid; gap: 2px; }
.nav-group small { display: block; padding: 2px 12px 4px; font-size: 11px; color: rgba(255,255,255,.45); letter-spacing: .04em; }


/* SKU 列表 */
table.sku-list { min-width: 0; }
table.sku-list td { vertical-align: middle; }
.thumb { display: block; width: 52px; height: 64px; object-fit: cover; border-radius: 6px; background: #ece8df; }
.empty-thumb { border: 1px dashed var(--line); }
.tags-cell { max-width: 320px; }
.tags-cell .tag-chip { margin: 1px 4px 1px 0; }
tr.row-link { cursor: pointer; }
tr.row-link:hover { background: #f4f1e8; }

/* 生产情况表：整宽两行布局，不横向滚动 */
.sheet-card { padding: 0; overflow: hidden; }
table.sheet { width: 100%; min-width: 0; table-layout: fixed; border-collapse: collapse; font-size: 13px; }
table.sheet thead th { font-size: 11px; color: var(--muted); text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #f7f4ec; white-space: nowrap; }
table.sheet thead th.num { text-align: right; }
table.sheet tbody + tbody tr.id td { border-top: 1px solid var(--line); }
table.sheet tr.id td { padding: 11px 12px 4px; vertical-align: top; overflow: hidden; text-overflow: ellipsis; }
table.sheet tr.nums td { padding: 0 12px 11px; }
table.sheet td.num { text-align: right; }
.figures { display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); gap: 5px; }
.figures-15 { grid-template-columns: repeat(15, minmax(0, 1fr)); }
.figures div { min-width: 0; background: #f3f0e8; border-radius: 6px; padding: 5px 7px; }
.figures div.hl { background: var(--green-soft); }
.figures small { display: block; font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.figures b { display: block; margin-top: 2px; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1100px) { .figures, .figures-15 { grid-template-columns: repeat(7, minmax(0, 1fr)); } }

/* 财务 */
table.sheet.fin td, table.sheet.fin th { vertical-align: middle; }
table.sheet.fin tbody tr td { padding: 10px 12px; border-top: 1px solid var(--line); }
.figures-7 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.figures div.bad { background: #f3deda; }
.figures div.bad b { color: var(--red); }
.cell { width: 100%; min-width: 64px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 13px; }
table.cost-table td { vertical-align: middle; }
table.cost-table td.num .cell { text-align: right; }
tr.new-row td { background: #f7f4ec; }
.line-item { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.line-item:last-of-type { border-bottom: 0; }
.inline-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-form .cell { width: auto; }

/* SKU 详情 */
.chain-top { display: grid; grid-template-columns: minmax(280px, 34%) 1fr; gap: 16px; align-items: start; }
.chain-photos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.chain-photos img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 8px; background: #ece8df; }
.chain-photos img:only-child { grid-column: 1 / -1; aspect-ratio: 4 / 3; object-fit: contain; }
.figures-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.chain-figures div { padding: 10px 12px; }
.chain-figures b { font-size: 18px; }
.tag-row.section { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; }
@media (max-width: 1000px) { .chain-top { grid-template-columns: 1fr; } .figures-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.figures-13 { grid-template-columns: repeat(13, minmax(0, 1fr)); }

/* 客户经营（CRM）内嵌 */
.crm-frame-wrap { margin: 0 -32px -48px; }
.crm-frame { display: block; width: 100%; height: calc(100vh - 8px); border: 0; background: var(--paper); }

/* 分页 */
.pager { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 14px 0 0; font-size: 13px; color: var(--muted); }
.pager-links { display: flex; gap: 4px; align-items: center; }
.pager-links a, .pager-links b { min-width: 30px; height: 30px; padding: 0 8px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); font-variant-numeric: tabular-nums; }
.pager-links b { background: var(--green); border-color: var(--green); color: #fff; }
.pager-links a:hover { border-color: var(--green); }
.pager-links i { padding: 0 4px; }
.pager-jump { display: flex; gap: 6px; align-items: center; }
.pager-jump input { width: 64px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; }
/* 筛选条 */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.filters input, .filters select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 13px; min-width: 120px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 14px; }
.tabs a { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 13px; color: var(--ink); }
.tabs a.on { background: var(--green); border-color: var(--green); color: #fff; }
.tabs a small { color: inherit; opacity: .7; margin-left: 4px; }

/* 标签矩阵 */
.tag-matrix { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.tag-dim { padding: 14px 16px; }
.tag-dim table.compact { margin-top: 4px; }
.tag-dim tr.muted td { color: #a5aba4; }
.tag-dim td a { color: var(--green); font-weight: 600; }
@media (max-width: 1200px) { .tag-matrix { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.crm-frame-wrap.embedded { margin: 0 -32px -48px; border-top: 1px solid var(--line); }

/* 数据同步 */
.data-status-grid .metric span { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; }
.task-list { display: grid; gap: 7px; }
.task-list a { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 3px 12px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: #faf8f2; }
.task-list a:hover { border-color: var(--green); }
.task-list a strong { font-size: 17px; }
.task-list a small { grid-column: 1 / -1; color: var(--muted); }
.advanced-settings > summary, .legacy-source > summary { cursor: pointer; }
.advanced-settings[open] > summary, .legacy-source[open] > summary { margin-bottom: 12px; }
.legacy-source > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.legacy-source .compact-metrics { margin-top: 12px; }

 dialog.wide { width: min(880px, calc(100vw - 30px)); }
#sku-form textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
#sku-form .form-grid label { font-size: 12px; color: var(--muted); }
@media (max-width: 900px) {
  .sidebar, .nav-collapsed .sidebar { position: sticky; top: 0; z-index: 20; height: auto; padding: 10px 14px; }
  .sidebar-top, .nav-collapsed .sidebar-top { flex-direction: row; margin: 0; }
  .nav-toggle { display: grid; position: absolute; top: 18px; right: 16px; border-color: rgba(255,255,255,.55); background: rgba(255,255,255,.08); }
  .sidebar nav { display: none; }
  .sidebar.mobile-open nav { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; max-height: calc(100vh - 112px); overflow-y: auto; margin-top: 10px; padding: 10px 0; border-top: 1px solid rgba(255,255,255,.12); }
  .sidebar.mobile-open nav > .nav-item { grid-column: 1 / -1; }
  .sidebar.mobile-open .nav-group { margin: 0; padding: 6px; border: 1px solid rgba(255,255,255,.1); border-radius: 9px; align-content: start; }
  .sidebar.mobile-open .nav-group small { padding: 2px 5px 4px; }
  .sidebar .label, .sidebar .nav-group small, .nav-collapsed .sidebar .label, .nav-collapsed .nav-group small { display: block; }
  .sidebar .nav-item, .nav-collapsed .nav-item { justify-content: flex-start; padding: 8px; gap: 8px; }
  .sidebar-foot, .nav-collapsed .sidebar-foot { display: none; position: static; }
  .sidebar.mobile-open .sidebar-foot { display: flex; margin-top: 8px; padding: 8px 0 0; }
  .sidebar.mobile-open .sidebar-foot .label { display: block; }
  .main { padding-top: 12px; }
  .page-head { margin-bottom: 16px; }
  .page-head h1 { font-size: 26px; }
  .figures, .figures-15, .figures-13, .figures-7, .figures-6 { grid-template-columns: repeat(2,minmax(0,1fr)) !important; }

  table.sku-list, table.orders-list { display: block; min-width: 0; }
  table.sku-list thead, table.orders-list thead { display: none; }
  table.sku-list tbody, table.orders-list tbody { display: grid; gap: 9px; padding: 9px; }
  table.sku-list tr, table.orders-list tr { display: grid; border: 1px solid var(--line); border-radius: 9px; background: var(--card); overflow: hidden; }
  table.sku-list tr { grid-template-columns: 58px 1fr auto; }
  table.sku-list td, table.orders-list td { border: 0; padding: 7px 9px; min-width: 0; white-space: normal; }
  table.sku-list td:nth-child(1) { grid-row: 1 / 3; }
  table.sku-list td:nth-child(2) { grid-column: 2 / 4; }
  table.sku-list td:nth-child(3) { grid-column: 2 / 4; }
  table.sku-list td:nth-child(n+4) { font-size: 12px; text-align: left; background: #f3f0e8; }
  table.sku-list td:nth-child(4)::before { content: "净销 "; color: var(--muted); }
  table.sku-list td:nth-child(5)::before { content: "可用 "; color: var(--muted); }
  table.sku-list td:nth-child(6)::before { content: "批次 "; color: var(--muted); }
  table.sku-list td:nth-child(7) { display: none; }

  table.orders-list tr { grid-template-columns: 1fr auto; }
  table.orders-list td:nth-child(1) { font-weight: 600; }
  table.orders-list td:nth-child(2) { text-align: right; }
  table.orders-list td:nth-child(3), table.orders-list td:nth-child(4) { color: var(--muted); font-size: 12px; }
  table.orders-list td:nth-child(4) { text-align: right; }
  table.orders-list td:nth-child(5), table.orders-list td:nth-child(7), table.orders-list td:nth-child(8) { background: #f3f0e8; }
  table.orders-list td:nth-child(6) { grid-column: 1 / -1; }
  table.orders-list td:nth-child(7)::before { content: "件数 "; color: var(--muted); }
  table.orders-list td:nth-child(8)::before { content: "金额 "; color: var(--muted); }
  table.orders-list.current-orders td:nth-child(8)::before { content: "已发/待发 "; }
  table.orders-list.current-orders td:nth-child(9) { background: #f3f0e8; }
  table.orders-list.current-orders td:nth-child(9)::before { content: "金额 "; color: var(--muted); }

  table.sheet thead { display: none; }
  table.sheet tbody { display: block; border-bottom: 1px solid var(--line); }
  table.sheet tr.id { display: grid; grid-template-columns: 1fr 1fr; padding: 8px; }
  table.sheet tr.id td { padding: 6px 8px; overflow: visible; }
  table.sheet tr.nums { display: block; }
  table.sheet tr.nums td { display: block; padding: 0 8px 10px; }
  table.sheet.fin tbody tr { display: grid; grid-template-columns: 1fr 1fr; padding: 8px; }
  table.sheet.fin tbody tr td { padding: 6px 8px; border: 0; text-align: left; }
  table.sheet.fin tbody tr td:nth-child(n+7) { background: #f3f0e8; }
  .tag-matrix { grid-template-columns: 1fr; }
  .crm-frame-wrap, .crm-frame-wrap.embedded { margin-left: -14px; margin-right: -14px; }
}

.style-ref { display: inline-flex; align-items: center; gap: 8px; vertical-align: middle; }
.style-refs { display: flex; flex-wrap: wrap; gap: 8px 12px; min-width: 120px; max-width: 420px; }
.style-list-more { margin-top: 6px; }
.style-list-more summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.style-list-more[open] summary { margin-bottom: 8px; }
.style-photo { display: inline-flex; flex: 0 0 auto; padding: 0; border: 1px solid #e5e2dc; border-radius: 6px; background: #fff; cursor: zoom-in; overflow: hidden; vertical-align: middle; }
.style-photo img { display: block; width: 44px; height: 56px; object-fit: contain; }
.chain-photos .style-photo { grid-column: 1 / -1; width: 100%; }
.chain-photos .style-photo img { width: 100%; height: auto; max-height: 460px; object-fit: contain; }
.style-photo:focus-visible { outline: 2px solid #856d39; outline-offset: 2px; }
.style-photo-viewer { width: auto; max-width: 94vw; padding: 12px; }
.style-photo-viewer [data-style-photo-full] { display: block; max-width: 86vw; max-height: 80vh; width: auto; height: auto; object-fit: contain; margin: auto; }
.style-photo-viewer .dialog-head { margin-bottom: 8px; }
@media(max-width:700px) {
  table.factory-orders-list { display: block; min-width: 0; }
  table.factory-orders-list thead { display: none; }
  table.factory-orders-list tbody { display: grid; gap: 10px; padding: 10px; }
  table.factory-orders-list tr { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); border: 1px solid var(--line); border-radius: 8px; }
  table.factory-orders-list td { border: 0; min-width: 0; padding: 8px; overflow-wrap: anywhere; }
  table.factory-orders-list td:nth-child(3),table.factory-orders-list td:nth-child(8) { grid-column: 1 / -1; }
  table.factory-orders-list td:nth-child(4)::before { content: '数量 '; color: var(--muted); }
  table.factory-orders-list td:nth-child(5)::before { content: '交期 '; color: var(--muted); }
}
