/* Polygon calibration keeps the source image central and leaves deliberate room for precision controls. */
.custom-region-dialog{--cre-blue:#1684ff;--cre-ink:#26313d;--cre-line:#e0e6ed;box-sizing:border-box;width:min(1320px,calc(100vw - 36px));max-width:none;height:min(900px,calc(100dvh - 36px));max-height:none;padding:0;border:1px solid #d9e0e8;border-radius:16px;background:#fff;color:var(--cre-ink);box-shadow:0 24px 100px #192b4440;font:13px/1.6 -apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif;overflow:hidden}
.custom-region-dialog[open]{display:flex;flex-direction:column}.custom-region-dialog::backdrop{background:#26364870;backdrop-filter:blur(3px)}.custom-region-dialog [hidden]{display:none!important}.custom-region-dialog *{box-sizing:border-box}.custom-region-dialog button,.custom-region-dialog input,.custom-region-dialog select{font:inherit}.custom-region-dialog button{border:1px solid #d8e0e8;border-radius:7px;background:#fff;color:#536170;padding:6px 10px;cursor:pointer;min-height:33px;line-height:1.4}.custom-region-dialog button:hover:enabled{border-color:#99c6fb;background:#f1f7ff;color:#187ddf}.custom-region-dialog button:disabled{opacity:.4;cursor:default}.custom-region-dialog button:focus-visible,.custom-region-dialog input:focus-visible,.custom-region-dialog select:focus-visible,.custom-region-dialog canvas:focus-visible{outline:2px solid var(--cre-blue);outline-offset:2px}.custom-region-dialog input[type=checkbox]{accent-color:var(--cre-blue);width:15px;height:15px;margin:0}
.cre-header{display:flex;align-items:center;justify-content:space-between;flex-shrink:0;gap:20px;padding:18px 22px 14px}.cre-header h2{margin:0;font-size:19px;font-weight:650;letter-spacing:-.3px}.cre-header p{margin:4px 0 0;color:#8290a0;font-size:12px}.custom-region-dialog .cre-close{width:35px;padding:0;font-size:25px;line-height:1;color:#8995a4;background:transparent;border:0}.cre-notice{flex-shrink:0;margin:0;padding:10px 22px;background:#eff6fe;border-top:1px solid #e4effb;border-bottom:1px solid #dfebf9;color:#47719c;font-size:12px;line-height:1.8}.cre-body{display:grid;grid-template-columns:minmax(0,1fr) 300px;min-height:0;flex:1;overflow:hidden}.cre-map{display:flex;flex-direction:column;min-height:0;min-width:0;background:#eef1f4}.cre-tools{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 12px;background:#fff;border-bottom:1px solid var(--cre-line);flex-shrink:0}.cre-mode-tools{display:flex;gap:5px}.cre-mode-tools button{border-color:transparent;font-size:12px}.cre-mode-tools button[aria-pressed=true]{border-color:#b6d8fd;color:#107fe9;background:#edf6ff}.cre-history{display:flex;gap:4px}.cre-history button{width:33px;padding:0;font-size:21px}.cre-view-tools{display:flex;align-items:center;justify-content:space-between;flex-shrink:0;gap:12px;padding:8px 12px;background:#fafbfd;border-bottom:1px solid var(--cre-line);font-size:11px;color:#8a96a3}.cre-view-tools>span{display:flex;align-items:center;gap:5px}.cre-view-tools button{min-height:29px;min-width:29px;padding:3px 7px;font-size:11px}.cre-view-tools output{min-width:41px;text-align:center;font-variant-numeric:tabular-nums}.cre-view-tools label{display:flex;align-items:center;gap:6px;white-space:nowrap}.cre-stage{position:relative;flex:1;min-height:260px;overflow:hidden}.cre-stage canvas{display:block;width:100%;height:100%;touch-action:none;background:#e9edf1}.cre-draw-actions{position:absolute;bottom:12px;left:12px;right:12px;display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:5px;padding:9px;background:#fffffff2;border:1px solid #dce6f0;border-radius:9px;box-shadow:0 4px 16px #23354b0e}.cre-draw-actions span{margin-right:auto;color:#6d8299;font-size:11px}.cre-draw-actions button{min-height:30px;font-size:11px}.cre-draw-actions button[data-cre=finish]{background:var(--cre-blue);border-color:var(--cre-blue);color:#fff}.cre-canvas-hint{flex-shrink:0;padding:8px 12px;margin:0;color:#7e8c9a;background:#f9fbfd;border-top:1px solid var(--cre-line);font-size:11px;line-height:1.7}.cre-properties{overflow:auto;overscroll-behavior:contain;padding:0 18px;border-left:1px solid var(--cre-line);background:#fff;scrollbar-width:thin;scrollbar-color:#d8e2ee transparent}.cre-properties>section{padding:16px 0;border-bottom:1px solid #eaf0f5}.cre-properties>section:last-child{border-bottom:0}.cre-properties h3{font-size:13px;font-weight:600;margin:0 0 9px;color:#3b4857}.cre-section-heading{display:flex;align-items:center;justify-content:space-between;gap:8px}.cre-section-heading h3{margin:0}.cre-section-heading output{font-size:10px;color:#7791aa;font-variant-numeric:tabular-nums;white-space:nowrap}.cre-help{color:#91a0af;font-size:11px;line-height:1.8;margin:7px 0 12px}.cre-empty{font-size:11px;color:#6d859f;line-height:1.9;margin:8px 0 0}.cre-field{display:flex;flex-direction:column;gap:5px;font-size:11px;color:#788797;margin:0 0 12px}.custom-region-dialog .cre-properties input[type=text],.custom-region-dialog .cre-properties input[type=number],.custom-region-dialog .cre-properties select{display:block;width:100%;max-width:100%;min-width:0;border:1px solid #d8e1eb;border-radius:6px;background:#fff;color:#4d5e71;padding:7px 8px;min-height:34px;font-size:12px;line-height:1.5}.custom-region-dialog select[data-cre=panels]{width:100%;min-height:117px;padding:4px;font-size:11px;border-color:#e1e8ef;background:#fdfefe}.custom-region-dialog select[data-cre=panels] option{padding:5px 6px;border-radius:3px}.cre-inline{display:flex;align-items:center;justify-content:space-between;gap:7px;margin:0 0 12px;font-size:11px;color:#8796a7}.cre-inline button{font-size:11px;min-height:31px;padding:4px 7px}.custom-region-dialog .cre-danger{font-size:11px;color:#b57569;background:#fffafa;border-color:#edddd8}.custom-region-dialog .cre-danger:hover:enabled{color:#b9513b;background:#fff0ea;border-color:#dfb6a9}.cre-vertex{padding:9px 10px;margin:9px 0 12px;border:1px solid #dce8f5;border-radius:7px;background:#f8fbff}.cre-vertex p{margin:0 0 7px;font-size:11px;color:#5c7fa4}.cre-vertex>div{display:grid;grid-template-columns:1fr 1fr;gap:8px}.cre-vertex label{display:flex;align-items:center;gap:5px;color:#93a4b4;font-size:11px}.cre-vertex small{display:block;margin-top:5px;font-size:10px;color:#9dabb9}.cre-hinge-actions{display:flex;flex-wrap:wrap;gap:5px}.cre-hinge-actions button{font-size:11px;padding:5px 8px;min-height:31px}.cre-hinge-actions button[data-cre=save-hinge]{background:#edf6ff;border-color:#b9d8f7;color:#187ddf}.cre-check p{font-size:11px;line-height:1.8;margin:0 0 8px;color:#8b99a7}.cre-check [data-valid=true]{color:#559078}.cre-check [data-valid=false]{color:#c46c4b}.cre-check p:last-child{margin:0;color:#b09357}.cre-footer{display:flex;justify-content:space-between;align-items:center;gap:18px;flex-shrink:0;padding:13px 20px;border-top:1px solid var(--cre-line);background:#fff}.cre-footer p{font-size:11px;color:#7e90a3;margin:0;line-height:1.8;max-width:750px}.cre-footer p[data-error=true]{color:#c1694d}.cre-footer>div{display:flex;gap:8px;flex-shrink:0}.custom-region-dialog .cre-primary{background:var(--cre-blue);border-color:var(--cre-blue);color:#fff;padding:8px 18px;min-height:36px}.custom-region-dialog .cre-primary:hover:enabled{background:#0874ef;border-color:#0874ef;color:#fff}
.cre-angle-presets{display:flex;gap:5px;margin:-5px 0 12px}.cre-angle-presets button{flex:1;min-height:28px;padding:3px 7px;font-size:11px;color:#6d88a2;background:#f7fbff;border-color:#dfebf7}
.cre-calibration .cre-section-heading output{color:#a18a52;background:#fff8e9;border-radius:4px;padding:2px 6px}.cre-calibration .cre-section-heading output[data-measured=true]{color:#4e8e75;background:#eef8f3}.cre-scale-summary{color:#7b91a6;font-size:11px;line-height:1.8;margin:8px 0 0;font-variant-numeric:tabular-nums}.cre-measure-distance{display:block;padding:7px 9px;margin:0 0 11px;border:1px solid #dceaf9;border-radius:5px;background:#f4f9ff;color:#5592ca;font-size:11px;font-variant-numeric:tabular-nums}.custom-region-dialog [data-cre=measure-apply]{color:#187ddf;background:#edf6ff;border-color:#b9d8f7}
@media(max-width:900px){.custom-region-dialog{width:calc(100vw - 18px);height:calc(100dvh - 18px);border-radius:12px}.cre-body{grid-template-columns:minmax(0,1fr) 270px}.cre-properties{padding:0 13px}.cre-header{padding:15px 17px 12px}.cre-notice{padding:9px 17px}.cre-view-tools{flex-wrap:wrap;gap:6px}.cre-view-tools label{font-size:10px}.cre-section-heading{flex-wrap:wrap;gap:4px}.cre-footer{padding:11px 16px}}
@media(max-width:620px){.custom-region-dialog{width:100vw;height:100dvh;max-height:100dvh;border:0;border-radius:0}.cre-header{padding:12px 14px 10px}.cre-header h2{font-size:17px}.cre-header p{font-size:11px}.cre-notice{padding:9px 14px;font-size:11px}.cre-body{display:flex;flex-direction:column;overflow:auto;overscroll-behavior:contain}.cre-map{min-height:430px;flex:0 0 58dvh}.cre-stage{min-height:220px}.cre-properties{flex:0 0 auto;overflow:visible;border-left:0;border-top:1px solid var(--cre-line);padding:0 15px}.cre-properties>section{padding:15px 0}.cre-section-heading{flex-wrap:nowrap}.cre-properties h3{font-size:14px}.custom-region-dialog .cre-properties input[type=text],.custom-region-dialog .cre-properties input[type=number],.custom-region-dialog .cre-properties select{min-height:38px;font-size:13px}.cre-field{font-size:12px}.cre-help,.cre-empty,.cre-check p{font-size:12px}.cre-tools{padding:8px 9px;gap:7px}.cre-mode-tools{gap:2px}.cre-mode-tools button{font-size:11px;padding:5px 7px}.cre-history button{width:30px;min-height:30px}.cre-view-tools{padding:7px 10px}.cre-view-tools label{font-size:11px}.cre-canvas-hint{padding:7px 10px;font-size:10px}.cre-footer{padding:10px 12px;gap:10px}.cre-footer p{font-size:10px;max-width:calc(100% - 170px)}.cre-footer>div{gap:6px}.custom-region-dialog .cre-primary{padding:8px 12px}.cre-draw-actions{padding:7px;left:8px;right:8px;bottom:8px}.cre-draw-actions span{width:100%;font-size:10px}.cre-inline button{font-size:12px;min-height:35px}.cre-vertex{padding:10px}.cre-hinge-actions button{font-size:12px;min-height:35px}}
