*{box-sizing:border-box}
body{font-family:system-ui,-apple-system,sans-serif;margin:0;background:#f1f5f9;color:#0f172a}
header{background:#0f172a;color:#fff;padding:20px 30px}
h1{margin:0;font-size:24px}header p{margin:6px 0 0;color:#94a3b8}
h2{font-size:18px;margin:0 0 8px}h3{font-size:15px;margin:16px 0 6px}
main{margin:auto;max-width:1700px;padding:16px}
.toolbar{background:#fff;border:1px solid #cbd5e1;border-radius:12px;padding:12px;display:flex;align-items:center;flex-wrap:wrap;gap:12px}
.toolbar a{color:#0369a1}.sep{flex:1}
label{display:block;font-size:13px;color:#334155;margin:6px 0}
label.inline{display:inline-flex;align-items:center;gap:6px;margin:0}
input:not([type=checkbox]):not([type=file]),select,textarea{width:100%;padding:6px 8px;border:1px solid #cbd5e1;border-radius:6px;font:inherit}
.tools input{width:auto}.toolbar input[type=text]{width:200px}
button{padding:6px 12px;border:1px solid #0369a1;background:#0284c7;color:#fff;border-radius:6px;cursor:pointer;font:inherit}
button.danger{background:#dc2626;border-color:#b91c1c}
button.tool{background:#fff;color:#0369a1}button.tool.active{background:#0284c7;color:#fff}
button.mini{padding:0 6px;font-size:13px;line-height:22px;background:#fff;color:#0f172a;border-color:#cbd5e1}
#message{min-height:20px;margin:8px 4px;color:#0f172a}#message.error{color:#b91c1c}
.layout{display:grid;grid-template-columns:minmax(0,2fr) minmax(380px,1fr);gap:16px}
.diagramPane,aside{background:#fff;border:1px solid #cbd5e1;border-radius:12px;padding:12px}
.tools{display:flex;align-items:center;gap:10px;margin-bottom:8px}.hint{color:#64748b;font-size:12px}
.stage{overflow:auto;max-height:80vh;border:1px solid #e2e8f0;background:#f8fafc}
.empty{padding:40px;color:#64748b;text-align:center}
.imageWrap{position:relative;display:inline-block;max-width:100%}
.imageWrap img{display:block;max-width:100%;height:auto;user-select:none;-webkit-user-drag:none}
.overlay{position:absolute;inset:0;width:100%;height:100%;touch-action:none}
.overlay.drawing{cursor:crosshair}
.hotspot{fill:#38bdf8;fill-opacity:.18;stroke:#0284c7;stroke-width:2;cursor:pointer;vector-effect:non-scaling-stroke}
.hotspot.proposed{fill:#f59e0b;stroke:#b45309;stroke-dasharray:6 4}
.hotspot.rejected{fill:#94a3b8;stroke:#64748b;fill-opacity:.1;stroke-dasharray:2 4}
.hotspot.draft{fill:#22c55e;stroke:#15803d}
.hotspot:hover{fill-opacity:.4}.hotspot.active{stroke:#dc2626;stroke-width:3;fill-opacity:.35}
.hotlabel{fill:#0f172a;paint-order:stroke;stroke:#fff;stroke-width:3;pointer-events:none;font-weight:600}
.handle{fill:#dc2626;stroke:#fff;stroke-width:2;cursor:nwse-resize}
.report{font-size:13px;margin-bottom:8px}.report .warn{color:#b45309}.report .ok{color:#15803d}
table.items{width:100%;border-collapse:collapse;font-size:13px}
.items th{text-align:left;color:#64748b;border-bottom:1px solid #cbd5e1;padding:4px}
.items td{padding:4px;border-bottom:1px solid #e2e8f0;vertical-align:middle}
.items tbody tr{cursor:pointer}.items tr.unplaced td:first-child{border-left:3px solid #f59e0b}
.items tr.selected,.items tr.linked{background:#e0f2fe}
.rowActions{white-space:nowrap}
.chip{padding:1px 6px;border-radius:10px;font-size:11px}
.chip.verified{background:#dcfce7;color:#166534}.chip.proposed{background:#fef3c7;color:#92400e}.chip.rejected{background:#e2e8f0;color:#475569}
.row{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.actions{display:flex;gap:8px;margin-top:8px}
.calloutBox{display:grid;grid-template-columns:90px 1fr auto auto;gap:8px;align-items:center}
.calloutBox .hint{grid-column:1/-1}
details{margin-top:14px}summary{cursor:pointer;font-weight:600}
.toolbar select{width:auto;max-width:360px}
.gate{font-size:13px;margin:6px 0;padding:6px 8px;border-radius:6px;border:1px solid #cbd5e1;background:#f8fafc}
.gate.ready{border-color:#86efac;background:#f0fdf4}.gate.blocked{border-color:#fcd34d;background:#fffbeb}
.gate ul{margin:4px 0 0 18px;padding:0}.gate .warn{color:#b45309}.gate .stop{color:#b91c1c}
.reviewTools{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin:8px 0}.reviewTools input:not([type=checkbox]){width:80px}
.reviewList{max-height:260px;overflow:auto;border:1px solid #e2e8f0;border-radius:6px;font-size:13px}
.reviewRow{display:grid;grid-template-columns:22px 70px 1fr auto;gap:6px;align-items:center;padding:3px 6px;border-bottom:1px solid #f1f5f9;cursor:pointer}
.reviewRow.sel{background:#e0f2fe}.reviewRow .lowconf{color:#b91c1c;font-weight:600}
dialog{width:min(900px,95vw);max-height:90vh;border:1px solid #cbd5e1;border-radius:12px;padding:16px}
dialog::backdrop{background:rgba(15,23,42,.45)}.dlgHead{display:flex;justify-content:space-between;align-items:center}
dialog .row{grid-template-columns:repeat(auto-fit,minmax(180px,1fr))}dialog textarea{resize:vertical}
dialog em{font-style:normal;font-weight:600}
.group{display:inline-flex;gap:4px}.tools{flex-wrap:wrap}
button.mini:disabled{opacity:.4;cursor:default}
.stage.panning,.stage.panning .overlay{cursor:grabbing}.stage.canpan,.stage.canpan .overlay{cursor:grab}
.keys{margin-top:8px;font-size:12px;color:#475569}.keys ul{margin:6px 0 0 18px;padding:0}
kbd{background:#f1f5f9;border:1px solid #cbd5e1;border-bottom-width:2px;border-radius:4px;padding:0 4px;font:inherit;font-size:11px}
.imageWrap.zoomed{max-width:none}.imageWrap.zoomed img{max-width:none;width:100%}

.publish{display:flex;flex-wrap:wrap;gap:6px;align-items:center;margin-top:6px}.publish input[type=text]{flex:1 1 220px;min-width:0}
.pubs{margin:6px 0 0 18px;padding:0;font-size:12px}

.chip.cand{background:#fef3c7;color:#92400e;margin-left:4px}
.chip.inshop{background:#dcfce7;color:#166534}.chip.noshop{background:#e2e8f0;color:#475569}.chip.unavailable{background:#fee2e2;color:#991b1b}
.shopChip{margin-left:4px}
.candBox{margin-top:12px;border:1px solid #fcd34d;background:#fffbeb;border-radius:6px;padding:6px 8px;font-size:13px}
.candBox h3{margin:0 0 4px}
.candRow{display:grid;grid-template-columns:90px 1fr auto auto;gap:6px;align-items:center;padding:3px 0;border-bottom:1px solid #fde68a}
.candRow:last-of-type{border-bottom:0}
.candRow.unsure .candConf{color:#b91c1c;font-weight:600}
.chip.candBadge{background:#fef3c7;color:#92400e;border:1px dashed #b45309}
