:root {
  color-scheme: light;
  font-family: 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --ink: #1d2821;
  --muted: #59675c;
  --paper: #fbfcf7;
  --background: #f1f3ec;
  --line: #dbe2d7;
  --green: #214936;
  --light-green: #e3eddf;
  --radius: 18px;
  color: var(--ink);
  background: var(--background);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; line-height: 1.5; }
button, input, textarea, select { font: inherit; color: inherit; }
button, select, summary { cursor: pointer; }
button, input:not([type='checkbox'],[type='file']), textarea, select { border: 1px solid var(--line); border-radius: 9px; }
input:not([type='checkbox'],[type='file']), textarea, select { width: 100%; min-width: 0; padding: 9px 10px; background: #fff; }
textarea { resize: vertical; }
input[type='checkbox'] { flex: 0 0 auto; width: 18px; height: 18px; margin: 2px 0; accent-color: var(--green); }
button { padding: 9px 13px; background: var(--paper); font-weight: 600; font-size: .86rem; white-space: nowrap; }
button:hover:not(:disabled) { background: var(--light-green); }
button:disabled { opacity: .45; cursor: default; }
.primary { padding: 11px 17px; border-color: var(--green); background: var(--green); color: #fff; }
.primary:hover:not(:disabled) { background: #2c5d45; }
a { color: var(--green); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); font-weight: 600; font-size: .86rem; text-decoration: none; white-space: nowrap; }
.button:hover { background: var(--light-green); }
.button.primary { border-color: var(--green); background: var(--green); color: #fff; }
.button.primary:hover { background: #2c5d45; }
:where(a,button,input,textarea,select,summary):focus-visible { outline: 2px solid #548469; outline-offset: 3px; }
p, h1, h2, h3, figure { margin: 0; }
[hidden] { display: none !important; }
.muted { color: var(--muted); font-size: .85rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.topbar { border-bottom: 1px solid var(--line); background: var(--paper); }
.topbar-inner { max-width: 1216px; margin: 0 auto; padding: 16px 28px; display: flex; align-items: center; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font-size: 1.08rem; font-weight: 750; white-space: nowrap; }
.mark { display: inline-block; width: 23px; height: 24px; background: var(--green); clip-path: polygon(50% 0, 74% 31%, 63% 31%, 88% 63%, 73% 63%, 100% 96%, 0 96%, 27% 63%, 12% 63%, 37% 31%, 26% 31%); }
.topbar-label { padding-left: 16px; border-left: 1px solid var(--line); color: var(--muted); font-size: .82rem; }
.topbar-action { margin-left: auto; }
.shell { max-width: 1216px; margin: 0 auto; padding: 43px 28px 70px; }
.intro h1 { font-size: clamp(1.85rem, 3.2vw, 2.65rem); font-weight: 740; letter-spacing: -.04em; line-height: 1.2; }
.intro p { margin-top: 10px; color: var(--muted); }
.workflow { display: flex; flex-wrap: wrap; gap: 12px 25px; padding: 0; margin: 25px 0 29px; list-style: none; }
.workflow li { display: inline-flex; align-items: center; gap: 9px; color: var(--muted); font-size: .9rem; }
.workflow span, .step-number { display: inline-grid; place-items: center; width: 28px; height: 28px; flex-shrink: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--paper); font-size: .78rem; font-weight: 700; }
.workflow li[aria-current] { color: var(--green); font-weight: 700; }
.workflow li[aria-current] span { border-color: var(--green); background: var(--green); color: #fff; }
.workflow .complete span { background: var(--light-green); color: var(--green); }
.feedback { margin-bottom: 18px; padding: 11px 15px; border: 1px solid #cddfcb; border-radius: 10px; background: #e8f1e5; color: #254830; font-size: .92rem; }
.feedback.error { background: #f8eae5; border-color: #ebcec3; color: #772b21; }
.loading { padding: 24px 0; color: var(--muted); }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.panel-title { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 16px; }
.panel-title h2 { font-weight: 720; font-size: 1.1rem; }
.panel-title a { font-size: .85rem; }
.manual-list { margin-top: 20px; padding: clamp(14px, 2.5vw, 24px); }
.manual-list ul { margin: 0; padding: 0; list-style: none; }
.manual-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; border-top: 1px solid var(--line); padding: 12px 0; }
.manual-entry .manual-name { font-weight: 690; overflow-wrap: anywhere; }
.manual-entry .muted { margin-top: 3px; }
.import-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(230px, 320px); gap: 20px; }
.upload-panel { padding: clamp(18px, 3vw, 29px); }
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 202px; padding: 18px; border: 1px dashed #9baa99; border-radius: 12px; background: #f4f7ee; cursor: pointer; text-align: center; overflow-wrap: anywhere; }
.dropzone:hover, .dropzone:focus-within { border-color: var(--green); background: var(--light-green); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.dropzone small { color: var(--muted); }
.file-icon { display: grid; place-items: center; width: 46px; height: 54px; margin-bottom: 5px; border: 1px solid #afbcac; border-radius: 8px; color: var(--green); background: #fff; font-size: .75rem; font-weight: 750; letter-spacing: .05em; }
.field { display: block; font-weight: 650; font-size: .86rem; }
.field :is(input,textarea) { display: block; margin-top: 6px; font-weight: 400; }
.sku-field { margin: 18px 0; max-width: 290px; }
.sku-field span { margin-left: 3px; font-size: .74rem; font-weight: 400; }
.sample { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; min-height: 240px; padding: clamp(22px, 3vw, 33px); color: #f4f7ec; background: #244633; border-radius: var(--radius); }
.sample-label { color: #d4e5d3; font-size: .83rem; }
.sample h2 { margin: 12px 0 10px; font-size: clamp(1.8rem, 3vw, 2.5rem); letter-spacing: -.02em; line-height: 1.15; }
.sample h2 span { display: block; margin-top: 5px; font-size: 1rem; letter-spacing: 0; }
.sample p:not(.sample-label) { color: #d4e5d3; font-size: .87rem; }
.sample a { color: #fff; margin-top: 26px; font-size: .88rem; }

.draft-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 13px; }
.draft-toolbar > div:last-child { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: .88rem; }
.review-layout { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 17px; align-items: start; }
.source-panel { position: sticky; top: 16px; padding: 16px; }
.source-panel .panel-title { margin-bottom: 4px; }
.source-name { overflow-wrap: anywhere; font-size: .8rem; color: var(--muted); margin-bottom: 12px; }
.source-nav { display: grid; grid-template-columns: auto 1fr auto; gap: 7px; margin-bottom: 9px; }
.source-image { background: #ecf0e8; border-radius: 9px; display: flex; justify-content: center; overflow: hidden; }
.source-image img { display: block; max-width: 100%; max-height: min(66vh, 720px); object-fit: contain; }
.editor { display: grid; gap: 14px; min-width: 0; }
.review-panel { padding: clamp(13px, 1.9vw, 22px); }
.product-fields { display: grid; grid-template-columns: 3fr 2fr; gap: 10px; }
.review-note { padding: 11px 13px; border-radius: 9px; margin-top: 13px; background: #f7efd8; color: #604a21; font-size: .85rem; }
.review-note p { margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.count, .tag { display: inline-block; border-radius: 30px; padding: 2px 8px; background: var(--light-green); color: var(--green); font-size: .75rem; font-weight: 650; white-space: nowrap; }
.count { vertical-align: 1px; margin-left: 3px; }
.parts-editor, .steps-editor { display: grid; gap: 8px; }
.part-row { display: grid; grid-template-columns: minmax(70px, 1.7fr) minmax(53px, 1.05fr) minmax(60px, 1fr) 49px 48px auto; gap: 6px; align-items: end; padding: 9px; border: 1px solid var(--line); border-radius: 10px; }
.part-row label, .source-reference label { color: var(--muted); font-size: .73rem; }
.part-row :is(input,select), .source-reference input { margin-top: 3px; font-size: .81rem; padding: 6px 4px; }
.row-actions, .source-reference { display: flex; gap: 5px; align-items: center; }
.model-bindings { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.model-bindings h3 { margin-bottom: 7px; font-size: .94rem; }
.binding-row { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.4fr) auto; gap: 7px; align-items: center; padding: 4px 0; }
.binding-row :is(label,select) { font-size: .8rem; }
.binding-row select { padding: 5px; text-overflow: ellipsis; }
.binding-row select[data-binding-issue] { border-color: #aa7837; }
.binding-row button { padding: 5px 8px; }
.model-check h3 { font-size: .9rem; }
.model-check ul { margin: 7px 0 0; padding-left: 19px; }
.model-check li + li { margin-top: 7px; }
.model-check a { font-weight: 650; }
.trace { color: var(--green); padding: 5px; border-color: transparent; background: var(--light-green); font-size: .72rem; }
.remove { padding: 4px 7px; background: transparent; color: #6b756d; border-color: transparent; font-size: 1rem; line-height: 1.25; }
.step-editor { padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.step-heading { display: flex; gap: 8px; align-items: center; }
.step-number { background: var(--light-green); color: var(--green); }
.step-heading input { font-weight: 650; }
.source-reference { margin-top: 7px; }
.source-reference input { display: inline-block; width: 53px; }
.uses { margin-top: 9px; border-top: 1px solid var(--line); padding-top: 8px; font-size: .84rem; }
.uses p { margin: 5px 0; }
.use-summary { color: var(--muted); padding-left: 4px; }
.use-row { display: grid; grid-template-columns: minmax(0, 1fr) 68px; gap: 8px; align-items: center; padding: 3px 0; }
.use-row input { padding: 4px 7px; }
.use-row small { color: var(--muted); }
.publish { scroll-margin-top: 12px; }
.ack { display: flex; gap: 9px; align-items: flex-start; margin: 16px 0 12px; font-size: .9rem; }
.publish-actions { display: flex; gap: 8px; }
#save-hint { margin-top: 7px; }
.share { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 14px; background: #eef4ea; border-radius: 12px; margin-top: 16px; padding: 12px; }
.share img { display: block; background: #fff; border-radius: 8px; }
.share h3 { font-size: 1rem; }
.share p, .share-url, .share-actions { font-size: .81rem; }
.share p { color: var(--muted); margin-top: 4px; }
.share-url { display: block; margin: 6px 0; overflow-wrap: anywhere; }
.share-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.part-preview h2 { font-size: 1.16rem; }
.part-preview { width: min(430px, calc(100vw - 28px)); padding: 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--paper); }
.part-preview::backdrop { background: #16271fa1; }
.part-preview figure { margin: 9px 0; padding: 10px; border-radius: 8px; background: #edf1e8; }
.part-preview img { display: block; width: 100%; height: min(48vh, 265px); object-fit: contain; }
.part-preview figcaption, .part-preview p { color: var(--muted); font-size: .81rem; }
.part-preview figcaption { text-align: center; }
.preview-heading { display: flex; gap: 9px; align-items: center; justify-content: space-between; }
.part-model-button { margin-top: 5px; padding: 4px 8px; border-color: #c5d5c3; background: #edf3e9; color: var(--green); font-size: .76rem; }
.asset-stage { position: relative; height: clamp(200px, 50vh, 300px); margin: 9px 0; border-radius: 8px; overflow: hidden; background: #eef2e9; }
.asset-stage canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.asset-status { position: absolute; inset: 0; display: grid; place-items: center; }
.library-dialog { width: min(540px, calc(100vw - 28px)); }
.library-list { list-style: none; margin: 9px 0; padding: 0; }
.library-list li { display: flex; justify-content: space-between; align-items: center; gap: 6px; border-top: 1px solid var(--line); padding: 6px 0; font-size: .85rem; }
.library-list small { display: block; color: var(--muted); }
.library-upload { padding-top: 8px; border-top: 1px solid var(--line); }
.library-form { display: grid; gap: 8px; margin: 8px 0; }
@media (max-width: 1000px) and (min-width: 781px) {
  .part-row { grid-template-columns: 1.4fr 1fr 1fr; }
}
@media (max-width: 780px) {
  .shell { padding: 26px 14px 45px; }
  .topbar-inner { padding-inline: 14px; }
  .import-layout, .review-layout { grid-template-columns: minmax(0, 1fr); }
  .source-panel { position: static; }
  .source-image img { max-height: 52vh; }
  .sample { min-height: 184px; }
}
@media (max-width: 520px) {
  .workflow { gap: 9px 11px; }
  .workflow li { font-size: .8rem; }
  .part-row { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); }
  .share { padding: 8px; }
  .share img { width: 96px; height: 96px; }
}
