.selected-layout{display:block}.selected-viewport{width:100%;max-height:65vh;overflow-x:auto;overflow-y:hidden;background:#edf1ef;overscroll-behavior:auto}.selected-viewport canvas{display:block;width:100%;touch-action:none}.selected-settings input,.selected-settings select{max-width:100%;margin:6px 0;padding:10px}.selected-layer-card,.selected-result-card{padding:16px;margin:12px 0;border:1px solid #d8e1dd;border-radius:12px}.selected-layer-card button,.selected-result-card button{margin:4px}.selected-list{margin-top:20px;max-height:none;border-top:1px solid #d8e1dd;padding-top:16px}.selected-result-card img{max-width:100%;max-height:400px}.selected-result-card article{border-top:1px solid #eee;margin-top:12px;padding-top:12px}.selected-settings{padding:12px;border:1px solid #eee;margin-top:12px}
@media(max-width:700px){.selected-layout{display:block}.selected-list{max-height:none;margin-top:18px}.selected-viewport{max-height:48vh}.selected-layer-card{width:100%;box-sizing:border-box}.selected-layout .editor-controls{display:flex;flex-wrap:wrap;gap:6px}}
.selected-sort-grip{touch-action:none;cursor:grab}.selected-drop{outline:2px solid #ff3d7a}
.selected-settings textarea{display:block;width:100%;box-sizing:border-box;min-height:100px;padding:10px}.selected-settings summary{font-weight:700;cursor:pointer}.manual-save-state{position:static;padding:8px;background:#fff;border-top:1px solid #ddd}.manual-layer-example{padding:20px;background:#edf4f1;border-radius:10px}#chargeDescription{white-space:pre-line}
@media(max-width:700px){.selected-settings{position:relative;border-radius:18px 18px 0 0;background:#fff}.selected-list{border-top:1px solid #ddd}.selected-viewport{max-height:50vh}.selected-settings input,.selected-settings select{font-size:16px}.selected-layout{max-width:100%}}

.manual-layer-example[hidden],.shape-panel[hidden]{display:none!important}.manual-layer-example svg{display:block;width:100%;max-width:600px}.shape-current{display:flex;align-items:center;gap:12px;margin:12px 0}.shape-icon{display:block;width:64px;height:64px;color:#b78883;flex-shrink:0}.shape-icon svg{width:100%;height:100%}.shape-panel{padding:16px;border:1px solid #d8e1dd;border-radius:12px;background:white;margin:12px 0}.shape-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(110px,1fr));gap:10px}.shape-grid button{background:#fff7fa;color:#394b49;border:1px solid #ecd7df;display:flex;align-items:center;flex-direction:column;gap:8px;padding:12px;min-height:120px}.shape-grid button:focus-visible{outline:3px solid #ff3d7a}.selection-previews{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,240px));gap:12px;margin:12px 0}.selection-preview{border:1px solid #d8e1dd;padding:8px;border-radius:10px;min-width:0}.selection-preview.active{border:2px solid #ff3d7a;background:#fff7fa}.selection-preview button{display:block;width:100%;margin:4px 0}.selection-preview button:first-child{background:#eef4f1;color:#263b37}.selection-preview canvas{display:block;width:100%;height:auto;margin-top:8px;pointer-events:none}.selected-viewport canvas{cursor:crosshair}.selected-layout>section{min-width:0}.selected-settings input:not([type=hidden]){box-sizing:border-box}.shape-picker button{margin:4px 0}
@media(max-width:700px){.shape-panel{position:fixed;bottom:0;left:0;right:0;z-index:20;max-height:75dvh;overflow:auto;border-radius:20px 20px 0 0;box-shadow:0 -8px 40px #0003;margin:0;padding:16px;padding-bottom:calc(16px + env(safe-area-inset-bottom))}.shape-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.shape-grid button{font-size:13px;padding:8px;min-height:110px}.shape-icon{width:52px;height:52px}.selection-previews{grid-template-columns:repeat(2,minmax(0,1fr))}.selected-list{width:100%;box-sizing:border-box}}

.selected-layer-card{padding:0;overflow:visible;border-radius:14px}.layer-card-main{display:grid;grid-template-columns:minmax(0,1fr) 240px;grid-template-rows:1fr auto;column-gap:20px;padding:16px;box-sizing:border-box;height:252px}.layer-card-info{grid-column:1;grid-row:1;min-width:0}.layer-title{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;height:48px;line-height:24px;word-break:break-word}.layer-description{height:42px;line-height:21px;overflow:hidden;margin:6px 0}.layer-region-count{margin:6px 0}.layer-card-actions{grid-column:1;grid-row:2;display:flex;gap:6px;flex-wrap:wrap;align-content:end}.layer-card-actions button{margin:0;padding:8px 10px;font-size:14px}.layer-card-preview{grid-column:2;grid-row:1/3;width:240px}.layer-preview-select{display:block;width:240px;height:144px!important;padding:0!important;background:#eef3f1!important;border:1px solid #d8e1dd!important;color:transparent;overflow:hidden;margin:0!important}.layer-preview-select canvas{display:block;width:240px;height:144px;pointer-events:none}.layer-preview-nav{display:flex;align-items:center;justify-content:space-between;height:40px;margin-top:8px}.layer-preview-nav button{margin:0;min-width:36px;padding:6px 10px}.layer-preview-position{font-size:14px}.selected-layer-card.active-layer{border-color:#ff3d7a}.selected-drawer{border:0;border-top:1px solid #eee;margin:0;padding:16px;background:#fafcfb;border-radius:0 0 14px 14px;animation:layerSlide .16s ease-out}.selected-drawer h4{margin:0 0 12px}.selected-drawer[hidden]{display:none}.layer-edit-regions{display:flex;flex-direction:column;gap:6px;margin:12px 0}.layer-edit-regions>div{display:flex;gap:8px}.layer-edit-regions button{padding:6px 10px;font-size:14px}.selected-drawer input[aria-label=物料名称]{display:block;width:100%}@keyframes layerSlide{from{opacity:0;transform:translateY(-6px)}to{opacity:1;transform:translateY(0)}}
@media(max-width:700px){.layer-card-main{display:flex;flex-direction:column;align-items:stretch;height:420px;padding:14px;gap:8px}.layer-card-info{flex:0 0 116px}.layer-title{height:44px;line-height:22px}.layer-description{height:38px;line-height:19px;font-size:14px;margin:4px 0}.layer-region-count{font-size:14px;margin:4px 0}.layer-card-preview{align-self:center;flex:0 0 192px}.layer-card-actions{flex:1;justify-content:flex-start;align-content:end;gap:5px}.layer-card-actions button{font-size:13px;padding:7px 8px}.selected-drawer{border-radius:0 0 14px 14px}.selected-drawer input,.selected-drawer textarea{font-size:16px}}

.manual-help{margin:20px 0;border-top:1px solid #e9edf3;padding-top:16px}.manual-help-toggle{font-size:17px;font-weight:700;min-height:52px;padding:12px 24px;margin-bottom:12px}.manual-help-content[hidden]{display:none!important}

/* Fixed image + independently scrolling layer management. */
#workflowDialog.manual-workbench-dialog{width:96vw;max-width:1600px;max-height:96dvh;box-sizing:border-box}
.manual-workbench{display:grid;grid-template-columns:minmax(0,3fr) minmax(0,2fr);gap:20px;height:66dvh;min-height:400px}
.manual-image-pane{min-width:0;display:flex;flex-direction:column;overflow:hidden}
.manual-image-pane>h3{margin:0}.manual-image-pane>p{margin:8px 0}
.manual-image-pane .manual-help{flex:0 1 auto;max-height:22%;overflow:auto}
.manual-workbench .selected-viewport{flex:1;min-height:150px;max-height:none;position:relative;overflow-x:auto;overflow-y:hidden;display:flex;align-items:center}
.manual-workbench .selected-viewport>canvas{width:100%;height:auto;flex:none;max-width:none;aspect-ratio:var(--image-ratio);}
.manual-workbench .selected-list{margin:0;padding:0 8px 16px;max-height:100%;overflow-y:auto;min-width:0;border-top:0;box-sizing:border-box}
.manual-workbench .selected-list>button{position:sticky;top:0;z-index:2;background:white;width:100%}
.manual-workbench .layer-card-main{min-height:150px;grid-template-columns:minmax(0,1fr) 120px}.manual-workbench .layer-card-preview{width:120px}.manual-workbench .layer-card-preview canvas{width:100%;height:72px}.manual-workbench .selected-layer-card{padding:10px;margin:8px 0}.manual-workbench .layer-card-info{cursor:pointer}
.manual-workbench .selected-layer-card:not(.active-layer) .layer-card-actions{display:none}
.manual-workbench-footer{position:sticky;bottom:0;display:flex;align-items:center;justify-content:space-between;gap:10px;background:white;border-top:1px solid #e9edf3;padding:10px 0;z-index:3}.manual-workbench-footer p{margin:0}
#preparedSheetResult{grid-template-columns:repeat(2,minmax(0,1fr))}
@media(max-width:900px){.manual-workbench{display:block;height:auto;min-height:0}.manual-image-pane{position:sticky;top:0;z-index:2;background:white;max-height:48dvh}.manual-workbench .selected-viewport{min-height:160px}.manual-image-pane .manual-help{max-height:90px}.manual-workbench .selected-list{max-height:42dvh;margin-top:12px}.manual-workbench .layer-card-main{grid-template-columns:1fr}.manual-workbench .layer-card-preview{width:160px}.manual-workbench .layer-card-preview canvas{height:96px}.manual-workbench-footer{flex-wrap:wrap}#preparedSheetResult{grid-template-columns:1fr}}

.manual-workbench .layer-card-main{height:190px;padding:8px;gap:8px}.manual-workbench .layer-preview-select{width:120px;height:72px!important}.manual-workbench .layer-title{height:36px;line-height:18px}.manual-workbench .layer-description{height:36px;line-height:18px;font-size:13px}.manual-workbench .layer-preview-position{font-size:12px}.manual-workbench .editor-controls{display:flex;flex-wrap:wrap;gap:6px}.manual-workbench .editor-controls input[type=range]{flex:1 0 100%;margin:4px 0}.manual-workbench .editor-controls button{padding:6px 12px;margin:0}.works-three-rows #preparedSheetResult{grid-template-columns:repeat(2,minmax(0,1fr))}
@media(max-width:900px){#workflowDialog.manual-workbench-dialog{height:96dvh;margin:2dvh auto;overflow:hidden;padding:16px}.manual-workbench-dialog #workflowBody{overflow:hidden}.manual-workbench{display:grid;grid-template-columns:1fr;grid-template-rows:minmax(260px,44%) minmax(0,1fr);height:70dvh}.manual-image-pane{position:relative;max-height:none}.manual-image-pane>h3,.manual-image-pane>p{display:none}.manual-image-pane .manual-help{margin:0;padding:0;border:0;max-height:44px;flex:0 0 44px}.manual-help-toggle{min-height:40px;margin:0;padding:6px 12px;font-size:14px}.manual-workbench .selected-list{max-height:100%;margin:0}.manual-workbench .selected-viewport{min-height:100px}.manual-workbench .layer-card-main{height:220px;display:grid;grid-template-columns:minmax(0,1fr) 120px;grid-template-rows:1fr auto}.manual-workbench .layer-card-info{flex:none}.manual-workbench .layer-card-preview{width:120px;grid-column:2;grid-row:1;flex:none}.manual-workbench .layer-card-preview canvas{height:72px}.manual-workbench .layer-card-actions{grid-column:1/3;grid-row:2}.works-three-rows #preparedSheetResult{grid-template-columns:1fr}}

@media(max-width:900px){.manual-workbench{grid-template-rows:minmax(310px,52%) minmax(0,1fr)}.manual-workbench .editor-controls input[type=range]{flex:1 1 100px;max-width:100%}.manual-image-pane .manual-help-content{position:absolute;top:44px;left:0;right:0;background:white;box-shadow:0 4px 20px #0002;z-index:8;max-height:38dvh;overflow:auto;padding:12px}.manual-workbench-dialog .selected-list input,.manual-workbench-dialog .selected-list textarea{max-width:100%;box-sizing:border-box}}

/* Compact permanent guidance and one region per layer. */
.manual-image-pane .compact-help{display:grid;grid-template-columns:140px minmax(0,1fr);gap:12px;margin:10px 0;padding:8px 0;max-height:none;overflow:visible;flex:0 0 auto;align-items:center}.compact-help .manual-layer-example svg{width:140px;max-height:90px}.compact-help .manual-help-content{font-size:12px;line-height:1.5}.compact-help p{margin:4px 0}.shape-quick-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;margin:8px 0}.shape-quick-grid button{display:flex;align-items:center;gap:6px;font-size:12px;padding:6px;min-height:42px;background:#fff7fa;color:#663e48}.shape-quick-grid .shape-icon{width:30px;height:30px}.manual-workbench .layer-preview-nav{display:none}.manual-workbench .layer-edit-regions button{font-size:12px}.manual-workbench .layer-card-main{height:170px}
@media(max-width:900px){.manual-image-pane .compact-help{grid-template-columns:90px minmax(0,1fr);max-height:none;flex:0 0 auto;margin:4px 0;padding:0}.compact-help .manual-layer-example svg{width:90px;max-height:70px}.manual-image-pane .compact-help .manual-help-content{position:static;box-shadow:none;max-height:none;padding:0;background:none;font-size:11px}.manual-workbench .layer-card-main{height:180px}}

/* Larger example on the left, instructions on the right. */
.manual-image-pane .compact-help{grid-template-columns:minmax(220px,42%) minmax(0,1fr);gap:24px;margin:10px 0;padding:8px 0;align-items:center}.compact-help .manual-layer-example svg{width:100%;max-width:none;max-height:170px}.compact-help .manual-help-content{font-size:13px;line-height:1.8}.compact-help p{margin:8px 0}
@media(max-width:900px){.manual-image-pane>h3{display:block;font-size:16px;margin:0 0 4px}.manual-image-pane .compact-help{grid-template-columns:42% minmax(0,1fr);gap:10px;margin:4px 0;padding:0}.compact-help .manual-layer-example svg{width:100%;max-height:85px}.manual-image-pane .compact-help .manual-help-content{font-size:11px;line-height:1.5}.compact-help p{margin:3px 0}}

.manual-workbench .selected-drawer .layer-confirm-button{color:#d4a000;font-weight:700}
