:root {
  --bg: #f2f4f3;
  --ink: #19342d;
  --line: #dce3df;
  --brand: #17674e;
  --muted: #64736d;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  color: var(--ink);
  font:
    14px/1.55 -apple-system,
    BlinkMacSystemFont,
    'PingFang SC',
    sans-serif;
  background: var(--bg);
}
header {
  height: 76px;
  display: flex;
  align-items: center;
  gap: 30px;
  padding: 12px 26px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
header b {
  display: block;
  font-size: 20px;
}
header span {
  font-size: 12px;
  color: var(--muted);
}
nav {
  display: flex;
  gap: 8px;
}
button,
.file {
  background: white;
  color: var(--ink);
  border: 1px solid #cdd9d2;
  padding: 9px 12px;
  border-radius: 7px;
  cursor: pointer;
  text-align: center;
  font-size: 13px;
}
button:hover,
.file:hover {
  border-color: var(--brand);
}
button.primary,
button.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
button:disabled {
  opacity: 0.4;
  cursor: wait;
}
#status {
  margin-left: auto;
  max-width: 460px;
  color: var(--brand);
  font-size: 12px;
}
.workspace {
  display: grid;
  grid-template-columns: 292px 1fr;
  min-height: calc(100vh - 154px);
}
[hidden] {
  display: none !important;
}
aside {
  padding: 20px;
  background: #fff;
  border-right: 1px solid var(--line);
  max-height: calc(100vh - 154px);
  overflow: auto;
}
h2 {
  font-size: 14px;
  margin: 20px 0 8px;
}
h2:first-child {
  margin-top: 0;
}
p {
  font-size: 12px;
  color: var(--muted);
}
label {
  display: block;
  font-size: 12px;
  margin: 9px 0;
}
input,
select,
textarea {
  font: inherit;
  border: 1px solid #cdd9d2;
  border-radius: 5px;
  padding: 7px;
  background: #fff;
  width: 100%;
  color: var(--ink);
}
input[type='file'] {
  font-size: 11px;
  margin-top: 5px;
}
aside > button {
  display: block;
  width: 100%;
  margin: 8px 0;
}
.row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin: 8px 0;
}
.triple {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}
.note {
  font-size: 11px;
  color: #75847c;
}
main {
  min-width: 0;
  padding: 20px;
  overflow: auto;
  max-height: calc(100vh - 154px);
}
h1 {
  font-size: 21px;
  margin: 0;
}
.viewHeading {
  display: flex;
  gap: 16px;
  align-items: center;
  margin: 0 0 20px;
}
.viewHeading > span {
  font-size: 12px;
  color: var(--muted);
}
.viewHeading label {
  margin-left: auto;
}
.imageGrid {
  display: grid;
  grid-template-columns: minmax(300px, 1.4fr) minmax(180px, 1fr);
  gap: 22px;
}
h3 {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}
#aiCanvas {
  max-width: 100%;
  height: auto;
  display: block;
  cursor: crosshair;
  background: white;
  border: 1px solid var(--line);
  touch-action: none;
}
.checker {
  min-height: 220px;
  display: grid;
  place-items: center;
  background: repeating-conic-gradient(#e1e7e3 0 25%, white 0 50%) 0/20px 20px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 18px;
}
#assetPreview {
  max-width: 100%;
  max-height: 560px;
}
pre {
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-word;
}
#stage {
  height: calc(100vh - 215px);
  overflow: auto;
  background: #dbe2de;
  padding: 24px;
  border: 1px solid #ccd5ce;
}
.canvas-container {
  box-shadow: 0 8px 30px #2342;
}
.layer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.layer.selected {
  background: #e4f1e9;
}
.layer span {
  font-size: 11px;
}
footer {
  height: 38px;
  padding: 8px 25px;
  background: #fff;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
}
footer a {
  float: right;
  color: var(--brand);
}
@media (max-width: 900px) {
  header {
    height: auto;
    flex-wrap: wrap;
  }
  .workspace {
    grid-template-columns: 240px 1fr;
  }
  .imageGrid {
    grid-template-columns: 1fr;
  }
  #status {
    max-width: 260px;
  }
}

#assetPreview:not([src]) {
  display: none;
}
.checker:has(img:not([src]))::after {
  content: '完成选区提取后，透明素材显示在这里';
  color: #7b8a82;
  font-size: 12px;
}

.layer.hidden-layer {
  opacity: 0.55;
}
/* P3-17：OCR 重建但未人工核对的文案（红线 4）——列表里必须一眼看见，不是藏在 JSON 里。 */
.layer.review {
  background: #fff4f2;
  box-shadow: inset 3px 0 0 #c0392b;
}
.layer.review > span {
  color: #b23b2e;
  font-weight: 600;
}
.layer > span {
  flex-shrink: 0;
  margin-left: 8px;
}
#selectionCount,
#maskInfo,
#missingGlyphs {
  display: block;
  font-size: 11px;
  margin: 6px 0;
}
#missingGlyphs {
  color: #9a5628;
}
@media (max-width: 650px) {
  .workspace {
    grid-template-columns: 1fr;
  }
  aside {
    max-height: 48vh;
    border-bottom: 1px solid var(--line);
  }
  main {
    max-height: none;
  }
  .viewHeading {
    flex-wrap: wrap;
  }
  header {
    gap: 12px;
    padding: 12px;
  }
}

.resourceNote { margin: 0; padding: 8px 26px; background: #fff3db; color: #674711; border-bottom: 1px solid #ecd6aa; font-size: 12px; }
.resourceNote a { color: inherit; margin-left: 8px; }

/* P2-07 辅助视图：标尺 + 叠加层。标尺是 DOM 覆盖层，绝不进 Design JSON 或导出。 */
.assistRow {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  padding: 6px 2px;
  font-size: 12px;
}
#stageWrap {
  position: relative;
}
#stageWrap.noruler #stage {
  margin: 0;
}
#stageWrap.noruler .ruler,
#stageWrap.noruler #rulerCorner {
  display: none;
}
#stageWrap #stage {
  margin: 20px 0 0 20px;
}
.ruler {
  position: absolute;
  background: #f2f5f3;
  z-index: 3;
  border: 1px solid #ccd5ce;
}
#rulerH {
  top: 0;
  left: 20px;
  right: 0;
  height: 20px;
}
#rulerV {
  top: 20px;
  left: 0;
  bottom: 0;
  width: 20px;
}
#rulerCorner {
  position: absolute;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  background: #e7ece8;
  border: 1px solid #ccd5ce;
  z-index: 4;
}
#assistOverlay {
  position: absolute;
  pointer-events: none;
  z-index: 2;
}
/* P2-13 版本可视 diff */
.version-diff {
  display: none;
  margin: 6px 0 2px;
  padding: 6px 8px;
  max-height: 180px;
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.5;
  background: #f4f1e8;
  border-left: 3px solid #c9a227;
  border-radius: 4px;
}
.version-diff li {
  list-style: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* P4-04 评审协作 */
#collabView aside label input,#collabView aside label select{width:100%}
.collabBanner{padding:10px 14px;border-radius:8px;margin:0 0 12px;font-weight:600}
.collabBanner.warn{background:#fff4d6;border:1px solid #e2b53c;color:#7a5b00}
.collabBanner.err{background:#ffe3e3;border:1px solid #d64545;color:#7a0000}
.collabBanner.ok{background:#e2f5e4;border:1px solid #3f9d5a;color:#0c4a20}
.collabComment{border:1px solid #d8d3c8;border-radius:8px;padding:10px 12px;margin-bottom:10px;background:#fffdf8}
.collabComment.resolved{opacity:.55}
.collabComment .meta{color:#8a8577;font-size:12px;margin-left:8px}
.collabComment p{margin:6px 0}
.collabComment button{margin-top:4px}

/* P4-36 配套件区块：这几行得在**导出之前**被看见，不能和刀模读数挤成一段话（"说了"要看得见）。
   档位分行、必报条目一眼可数；盒型不认识/清单为空时整块转红——与报价单 data-accessory-missing 同口径。 */
#boxInfo {
  display: block;
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-line;
}
#boxExtras {
  display: block;
  margin: 10px 0 0;
  padding: 9px 11px;
  border: 1px solid #e6dbb6;
  border-left: 4px solid #b8860b;
  border-radius: 7px;
  background: #fffbef;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-line;
}
#boxExtras.fail {
  border-color: #e6b8b0;
  border-left-color: #b3261e;
  background: #fff5f4;
  color: #8a1c14;
  font-weight: 600;
}

/* Product shell. Canvas and export geometry are deliberately independent. */
:root{--bg:#f3f5f4;--ink:#183b33;--line:#e0e7e2;--brand:#17634f;--muted:#60756b;--top-height:116px;--footer-height:36px}
body{font-size:14px;letter-spacing:.01em}
header{height:80px;padding:14px 24px;gap:32px;box-shadow:0 1px 0 #183b3306;position:relative;z-index:5}
.productBrand{min-width:245px}.productBrand b{font-size:22px;letter-spacing:-.6px}.productBrand>span{font-size:11px}
.brandBadge{display:inline-block!important;font-size:9px!important;letter-spacing:1.7px;background:#ecf2ed;color:var(--brand)!important;border:1px solid #d9e6dc;padding:3px 7px;margin-left:9px;vertical-align:middle;border-radius:5px;font-weight:600}
.workflowNav{padding:4px;background:#f0f3f0;border:1px solid var(--line);border-radius:10px;gap:4px}
.workflowNav button{border-color:transparent;background:transparent;white-space:nowrap;font-size:12px;padding:9px 13px}.workflowNav button.active{background:var(--brand);color:#fff;box-shadow:0 2px 5px #173c321a}
button,.file{transition:background .15s,border-color .15s,box-shadow .15s;font-family:inherit;border-color:#d1ddd5;min-height:36px;border-radius:7px}
button:hover:not(:disabled){background:#edf4ef;border-color:#7aa38b}button.primary:hover:not(:disabled),button.active:hover:not(:disabled){background:#114d3d;color:white}
button:disabled{cursor:not-allowed;opacity:.45}button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,summary:focus-visible,a:focus-visible{outline:3px solid #78aa98;outline-offset:2px}
input,select,textarea{font-size:12px;min-height:35px;border-radius:6px;background:#fcfdfc;transition:border-color .15s}textarea{resize:vertical;line-height:1.6}input[type=checkbox]{width:15px;min-height:15px;height:15px;accent-color:var(--brand);flex-shrink:0}input[type=range]{min-height:18px;accent-color:var(--brand)}input[type=color]{padding:3px}
label{line-height:1.5;color:#435e51}.note{font-size:11px;line-height:1.65;color:#61766a}p{line-height:1.65}
.resourceNote{height:36px;display:flex;align-items:center;gap:9px;padding:7px 24px;background:#f8f7f1;border-color:#e9e5d7;color:#6c644b;font-size:11px}.resourceNote strong{font-weight:600}.resourceNote a{margin-left:auto;text-decoration:none;white-space:nowrap}
#status{font-size:11px;line-height:1.6;max-width:360px;max-height:48px;overflow:auto;padding:5px 8px;border-left:2px solid #92b5a3}#status[data-tone=error]{color:#a13226;border-color:#c46656;background:#fff5f1}
.workspace{grid-template-columns:324px minmax(0,1fr);min-height:calc(100dvh - var(--top-height) - var(--footer-height))}
.workspace>aside{padding:0 16px 24px;max-height:calc(100dvh - var(--top-height) - var(--footer-height));scrollbar-width:thin;scrollbar-color:#c5d5ca transparent;overscroll-behavior:contain;background:#fbfcfb}
.inspectorNav{position:sticky;top:0;z-index:4;display:flex;flex-wrap:wrap;gap:4px;background:#fbfcfbf5;backdrop-filter:blur(10px);padding:13px 0 12px;border-bottom:1px solid var(--line);margin-bottom:18px}
.inspectorNav button{font-size:11px;min-height:29px;padding:4px 9px;border-color:transparent;color:#617367;background:transparent}.inspectorNav button:hover,.inspectorNav button.selected{background:#e4eee7;color:#1d5b42;border-color:#ccdfd1}
.inspectorSection{padding:0 0 22px;margin:0 0 22px;border-bottom:1px solid var(--line);scroll-margin-top:96px}.inspectorSection>h2{font-size:14px;margin:0 0 14px;font-weight:650;letter-spacing:.03em}.inspectorSection>button{display:block;width:100%;margin:8px 0}
.inspectorSection>p:first-of-type{margin-top:0}.inspectorSection .row{gap:6px}.inspectorSection .row>button{flex:1 1 auto}.inspectorSection .file{display:block;line-height:1.6;background:#fff}
.toolDetails{margin:10px 0;border:1px solid #e0e8e0;border-radius:7px;background:#f6f8f5;font-size:11px}.toolDetails summary{padding:9px 10px;cursor:pointer;color:#51664f;line-height:1.5}.toolDetails>output,.toolDetails>p,.toolDetails>pre{display:block;padding:0 11px 11px;margin:0!important;font-size:11px!important}.toolDetails[open] summary{border-bottom:1px solid var(--line);margin-bottom:9px}
#boxInfo{line-height:1.7}#boxExtras{font-size:11px;line-height:1.65;background:#fcfaf2;border-left-width:3px}
.workspace>main{padding:22px 24px;max-height:calc(100dvh - var(--top-height) - var(--footer-height));scrollbar-width:thin}
.viewHeading{gap:18px;min-height:52px;margin-bottom:16px;align-items:center}.viewHeading h1{font-size:22px;font-weight:600;letter-spacing:-.6px}.eyebrow{font-size:9px;font-weight:650;letter-spacing:2px;color:#7a8c7f;margin:0 0 5px}.viewHeading>span{font-size:11px}.viewHeading label{min-width:100px;font-size:10px}
.quickActions{display:flex;flex-wrap:wrap;gap:6px;padding:0 0 13px;border-bottom:1px solid #dce5de;margin-bottom:8px}.quickActions button{font-size:11px;min-height:32px;padding:6px 13px}.quickActions button[data-command=btnSave]{margin-left:auto}
.assistRow{gap:12px;padding:0 0 10px}.assistRow label{display:flex;align-items:center;gap:5px;margin:5px 0;font-size:11px}.assistRow>.note{flex-basis:100%;font-size:10px}.assistRow input[type=number]{min-height:28px;padding:3px 5px}
#stage{height:calc(100dvh - 360px);min-height:260px;background:#e3e8e3;border-color:#d4ded5;padding:24px;border-radius:3px}.canvas-container{box-shadow:0 8px 28px #203d2c15}
.imageGrid{grid-template-columns:minmax(0,1.5fr) minmax(230px,1fr);gap:24px}.imageGrid h3{font-size:11px;font-weight:600;margin:5px 0 12px;color:#4d6657}.imageGrid>div{min-width:0}#aiCanvas{border-radius:8px;border-color:#d4ddd4;max-height:calc(100dvh - 275px);width:auto;max-width:100%;object-fit:contain;object-position:top left}
.checker{min-height:220px;background-size:16px 16px;border-radius:8px;border-color:#d6e1d8}.checker:has(img:not([src]))::after{max-width:190px;text-align:center;line-height:1.8;background:#ffffffd9;padding:12px 18px;border-radius:8px;color:#537260}
#collabView>aside{padding-top:22px}#collabView aside h3{font-weight:600;font-size:12px;margin-top:26px}#collabCommentList{max-width:820px}.emptyState{margin:50px auto;padding:38px;max-width:570px;border:1px dashed #bdcebf;border-radius:12px;text-align:center;background:#f9fbf8}.emptyState h2{font-size:18px;font-weight:500;margin:0 0 10px}.emptyState p{font-size:12px}.collabComment{padding:18px;border-color:var(--line);background:#fff}.collabComment.resolved{opacity:.7}.collabComment p{font-size:13px;color:var(--ink)}
footer{height:var(--footer-height);font-size:10px;padding:9px 24px}.skipLink{position:fixed;left:10px;top:-100px;z-index:100;background:white;padding:10px;color:var(--brand)}.skipLink:focus{top:10px}
@media(min-width:1600px){.workspace{grid-template-columns:350px minmax(0,1fr)}.workspace>aside{padding-left:20px;padding-right:20px}.workspace>main{padding-left:32px;padding-right:32px}}
@media(max-width:1150px){header{gap:16px}.productBrand{min-width:210px}.workflowNav button{padding:8px 10px}#status{max-width:210px}.workspace{grid-template-columns:296px minmax(0,1fr)}.workspace>main{padding:18px}.imageGrid{grid-template-columns:1fr}#aiCanvas{max-height:none;width:100%;max-width:480px}.viewHeading h1{font-size:20px}}
@media(max-width:800px){:root{--top-height:158px}header{height:116px;padding:10px 16px;gap:6px;flex-wrap:wrap}.productBrand{min-width:0;flex:1}.productBrand>span{display:none}.productBrand b{font-size:20px}#status{max-width:48%;font-size:10px;order:1}.workflowNav{order:2;width:100%;justify-content:center}.workflowNav button{flex:1}.resourceNote{height:42px;padding:6px 16px;font-size:10px;line-height:1.4}.resourceNote strong{display:none}.resourceNote a{font-size:10px}.workspace{grid-template-columns:260px minmax(0,1fr)}.workspace>main{padding:16px}.viewHeading{flex-wrap:wrap}.quickActions button[data-command=btnSave]{margin-left:0}.assistRow>.note{display:none}footer{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}}
@media(max-width:650px){:root{--footer-height:44px}.workspace{display:flex;flex-direction:column;min-height:0}.workspace>aside{max-height:36dvh;padding:0 14px 14px;flex:none;border-right:0;border-bottom:1px solid #cedcd1}.inspectorNav{padding:8px 0;gap:3px;margin-bottom:12px}.inspectorNav button{padding:4px 8px;min-height:30px}.workspace>main{max-height:none;min-height:300px;padding:16px 14px}.viewHeading{gap:10px;margin-bottom:10px;min-height:36px}.eyebrow{font-size:8px;margin-bottom:3px}.viewHeading h1{font-size:19px}.viewHeading label{min-width:76px;margin-left:auto}.viewHeading>span{font-size:10px}.viewHeading select{min-height:30px;padding:4px}.quickActions{gap:4px;padding-bottom:9px}.quickActions button{min-height:34px;padding:6px 9px;flex:1}.assistRow{gap:8px}.assistRow label{font-size:10px}.assistRow input[type=number]{width:43px!important}#stage{height:52dvh;min-height:260px;padding:18px}.imageGrid{gap:18px}#aiCanvas{width:100%;max-width:100%}footer{height:44px;padding:10px 14px;white-space:normal;line-height:1.5}footer a{float:none;margin-left:6px}.emptyState{margin:20px 0;padding:24px 16px}#collabView>aside{padding-top:16px}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;transition:none!important}}

#brandBrief>label,#brandBrief>button,#brandBrief>pre{margin:10px;max-width:calc(100% - 20px)}#brandBrief>button{width:calc(100% - 20px)}#brandBrief .check{display:flex;align-items:center;gap:7px}#aiAccountStatus{display:block;margin:10px 0;padding:8px 10px;background:#eaf2ec;border-radius:6px;color:#305a41;font-size:11px}.aiHistoryItem{padding:12px 10px;border-bottom:1px solid var(--line);font-size:11px}.aiHistoryItem strong{font-size:11px;font-weight:600}.aiHistoryItem button{min-height:30px;font-size:11px}#aiHistoryPanel>button{margin:10px}#shapeTools .triple,#shapeTools .row,#shapeTools>.note{margin:10px}#briefVoiceStatus{font-size:10px;flex-basis:100%}

.candidateRegions{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:10px 0}.candidateRegion{display:flex;flex-direction:column;align-items:center;gap:5px;padding:8px!important}.candidateRegion canvas{max-width:100%;width:120px;height:80px;object-fit:contain}.candidateRegion span{font-size:11px}#materialOutput>label,#materialOutput>button,#materialOutput>.note{margin:10px;max-width:calc(100% - 20px)}#materialOutput .check{display:flex;align-items:flex-start;gap:6px}#materialVariants:empty{display:none}

#aiEmptyState .primary{width:auto;padding:10px 24px;margin-top:12px}input[type=file]::file-selector-button{border:0;border-radius:4px;padding:6px 9px;background:#eaf2ec;color:#17634f;margin-right:8px;cursor:pointer}

.imageToolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px}.imageToolbar h3{margin:0}.imageToolbar label{display:flex;align-items:center;gap:8px;font-size:11px;color:#53665b}.imageToolbar select{width:100px;min-height:30px;margin:0;padding:4px 8px}.aiImageViewport{overflow:auto;max-height:calc(100dvh - 310px);min-height:1px;overscroll-behavior:contain}.aiImageViewport #aiCanvas{display:block}.aiImageViewport:focus-visible{outline:2px solid #17674e;outline-offset:2px}@media(max-width:650px){.aiImageViewport{max-height:50dvh}}

.preflightReport{margin:12px 0;padding:12px;border:1px solid var(--line);border-radius:8px;background:#fff;font-size:12px;line-height:1.6}.preflightReport details{margin:8px 0}.preflightReport summary{font-weight:600;cursor:pointer}.preflightReport details p{padding:8px;background:#f6f8f5;border-radius:4px;overflow-wrap:anywhere}

/* 内部滚动条必须看得见（20261006 客户实测：Mac Studio 有滚动条、MacBook Air 没有）
   根因不在页面：这台 Studio 的系统设置是「显示滚动条 = 始终」，Air 用触控板时是浮层滚动条
   （只有滚动的一瞬间才浮现）。而这套工作台是 app-shell 布局——页面本身不滚，滚的是左栏内部
   （左栏 3.3~3.6k px 的控件压进 650~930px 的窗口）。滚动条一隐藏，用户就以为左栏少了内容。
   修法：左栏自己画一条常驻细滚动条——`::-webkit-scrollbar` 一旦定义，Safari/Chrome 都会退回
   「始终占位」的经典滚动条，不再受系统设置摆布；`scrollbar-gutter:stable` 把槽位钉死，
   免得两台机器凭空差 9px。只动左栏：`.workspace` 第一列是固定 324px，槽位从左栏内部扣，
   `#stage`/画布宽度逐像素不变，20 个在数几何与像素的门禁不受影响。 */
.workspace>aside{scrollbar-gutter:stable;scrollbar-color:#c3d3c7 #eef3ef}
.workspace>aside::-webkit-scrollbar{width:9px}
.workspace>aside::-webkit-scrollbar-track{background:#eef3ef;border-left:1px solid #dfe8e0}
.workspace>aside::-webkit-scrollbar-thumb{background:#c3d3c7;border-radius:99px;border:2px solid #eef3ef;min-height:36px}
.workspace>aside::-webkit-scrollbar-thumb:hover{background:#a7bfb0}
