.editor-page {margin:0;padding:0;color:var(--color-text-primary);background:var(--color-surface-inset);font-size:14px;line-height:1.4;overflow:hidden;}
.editor-page * {box-sizing:border-box;}
.editor-page [hidden] {display:none!important;}
.ed-app {height:100dvh;display:grid;grid-template-rows:56px minmax(0,1fr) 28px;}
.ed-header {display:flex;align-items:center;gap:12px;padding:8px 16px;border-bottom:1px solid var(--color-border-soft);background:var(--color-surface-card-strong);min-width:0;}
.ed-header h1 {font-size:17px;white-space:nowrap;margin:0 8px 0 0;font-weight:650;letter-spacing:-.4px;}
.ed-brand {display:flex;align-items:center;}
.ed-filename {overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;color:var(--color-text-secondary);}
.ed-history {display:flex;gap:4px;}.ed-history button{font-size:22px;min-width:40px;padding:4px;}
.ed-workspace {display:grid;grid-template-columns:112px minmax(0,1fr) 304px;min-height:0;}
.ed-tools {display:flex;flex-direction:column;gap:4px;padding:12px 8px;border-right:1px solid var(--color-border-soft);background:var(--color-surface-card);}
.ed-tool {display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;min-height:62px;width:100%;border:1px solid transparent;background:transparent;border-radius:var(--radius-sm);color:var(--color-text-secondary);font:inherit;cursor:pointer;}
.ed-tool svg {width:23px;height:23px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;}
.ed-tool:hover:not(:disabled) {background:var(--color-surface-inset);color:var(--color-text-primary);}
.ed-tool[aria-pressed=true] {background:var(--color-accent-soft);border-color:var(--color-accent);color:var(--color-text-primary);}
.ed-viewport {position:relative;min-width:0;min-height:0;background:radial-gradient(ellipse at 50% 40%,var(--color-surface-card),var(--color-surface-inset));overflow:hidden;}
#ed-scene {position:absolute;inset:0;}#ed-scene canvas {display:block;touch-action:none;}
.ed-measure-label {position:absolute;transform:translate(-50%,-50%);padding:4px 8px;border:1px solid var(--color-border-strong);border-radius:var(--radius-sm);background:var(--color-surface-card-strong);color:var(--color-text-primary);font-size:13px;font-weight:600;line-height:1.4;white-space:nowrap;pointer-events:none;user-select:none;}
.ed-views {position:absolute;top:14px;left:14px;display:flex;gap:4px;z-index:1;}
.ed-views .button {font-size:13px;min-height:34px;padding:5px 10px;background:var(--color-surface-overlay);}
.ed-camera-hint {position:absolute;bottom:12px;left:16px;right:16px;text-align:center;font-size:12px;color:var(--color-text-secondary);pointer-events:none;}
#ed-empty {position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:32px;text-align:center;gap:16px;}
#ed-empty h2 {font-size:clamp(24px,2.3vw,34px);line-height:1.2;max-width:430px;letter-spacing:-1px;margin:0;font-weight:600;}
#ed-empty p {margin:0;max-width:400px;color:var(--color-text-secondary);}
.ed-kicker {font-size:11px;letter-spacing:1.5px;color:var(--color-text-secondary);font-weight:650;}
.ed-small {font-size:12px;line-height:1.7;}.ed-note {font-size:14px;color:var(--color-text-secondary);line-height:1.5;margin:0;}
.ed-inspector {display:flex;flex-direction:column;gap:12px;min-height:0;padding:20px 16px 16px;background:var(--color-surface-card-strong);border-left:1px solid var(--color-border-soft);}
.ed-inspector-heading h2 {font-size:21px;margin:3px 0 2px;letter-spacing:-.5px;}
.ed-target-label {font-size:12px;color:var(--color-text-secondary);margin-bottom:-8px;}
.editor-page select,.editor-page input:not([type=checkbox]) {width:100%;min-width:0;min-height:40px;padding:8px 10px;border:1px solid var(--color-border-strong);border-radius:var(--radius-sm);background:var(--color-surface-inset);color:var(--color-text-primary);font:inherit;}
.editor-page .button {font-size:14px;min-height:40px;white-space:nowrap;cursor:pointer;}
.editor-page button:disabled {opacity:.4;cursor:default;}
.editor-page button:focus-visible,.editor-page input:focus-visible,.editor-page select:focus-visible,.ed-link:focus-visible {outline:2px solid var(--color-accent);outline-offset:2px;}
#ed-panel {display:flex;flex-direction:column;gap:14px;min-height:0;}
.ed-fields {display:grid;gap:9px;}.ed-field {display:grid;grid-template-columns:24px minmax(0,1fr) 34px;align-items:center;gap:7px;}.ed-field span:last-child {font-size:12px;color:var(--color-text-secondary);}
.ed-axis-x {color:#c34f44}.ed-axis-y {color:#3b8651}.ed-axis-z {color:#486cae}
.ed-check {display:flex;align-items:center;gap:8px;cursor:pointer;min-height:30px;}.ed-check input {width:16px;height:16px;accent-color:var(--color-accent);}
.ed-row {display:flex;gap:6px;align-items:center;}.ed-row>* {flex:1;min-width:0;}.ed-row .button {padding:6px 8px;}
.ed-label {font-size:12px;color:var(--color-text-secondary);display:block;margin-bottom:6px;}
.ed-apply-row {display:flex;gap:8px;margin-top:auto;padding-top:8px;}.ed-apply-row .button {flex:1;padding-inline:10px;}
#ed-error {color:var(--color-danger);font-size:13px;line-height:1.35;margin:0;overflow-wrap:anywhere;}
.ed-status {display:flex;gap:16px;align-items:center;justify-content:space-between;border-top:1px solid var(--color-border-soft);padding:0 16px;background:var(--color-surface-card);font-size:12px;min-width:0;}
.ed-status span {overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.ed-link {color:var(--color-text-primary);text-underline-offset:4px;}
#ed-progress {position:absolute;inset:0;z-index:10;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:16px;background:var(--color-surface-overlay);}
#ed-session-recovery {display:flex;flex-wrap:wrap;gap:8px;align-items:center;}
#ed-session-recovery .ed-note {flex-basis:100%;}
#ed-session-recovery .button {flex:1;min-width:0;}
.ed-spinner {width:28px;height:28px;border-radius:50%;border:3px solid var(--color-border-strong);border-top-color:var(--color-accent);animation:ed-spin 1s linear infinite;}
@keyframes ed-spin {to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.ed-spinner{animation:none}}
.ed-parts {display:flex;flex-direction:column;gap:5px;}.ed-part {display:grid;grid-template-columns:minmax(0,1fr) 32px 32px;gap:4px;}.ed-part button {min-height:34px;padding:5px;font:inherit;background:var(--color-surface-inset);border:1px solid var(--color-border-soft);border-radius:5px;color:var(--color-text-primary);cursor:pointer;}.ed-part .ed-part-name {overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left;}.ed-part[aria-current=true] .ed-part-name {border-color:var(--color-accent);}
.ed-value {font-size:26px;letter-spacing:-.8px;font-variant-numeric:tabular-nums;margin:8px 0;}
#ed-dialog {width:min(480px,calc(100vw - 32px));padding:24px;border:1px solid var(--color-border-soft);border-radius:var(--radius-md);background:var(--color-surface-card-strong);color:var(--color-text-primary);font:inherit;}
#ed-dialog::backdrop {background:rgba(0,0,0,.4);}#ed-dialog h2 {margin:0 0 16px;font-size:21px;}#ed-dialog-content {display:flex;flex-direction:column;gap:12px;}#ed-dialog-actions {display:flex;gap:8px;justify-content:flex-end;margin-top:20px;}#ed-dialog-content p {margin:0;line-height:1.6;}
.ed-app.is-dragging .ed-viewport {outline:3px solid var(--color-accent);outline-offset:-3px;}
@media(max-width:1100px),(max-height:699px){.ed-workspace {grid-template-columns:88px minmax(0,1fr);}.ed-tools {padding:6px;gap:0;}.ed-tool {min-height:52px;}.ed-inspector {position:absolute;right:0;top:56px;bottom:28px;width:280px;z-index:3;box-shadow:-4px 0 20px #0001;gap:8px;padding:12px;}.ed-tool svg {width:18px;height:18px;}.ed-inspector-heading h2{font-size:18px}.ed-filename{display:none;}.ed-header{gap:6px;padding:8px;}.ed-header h1{font-size:14px}.ed-camera-hint{display:none;}}
@media(max-width:700px){.ed-header h1,.ed-brand,.ed-history{display:none}.ed-header #ed-open{margin-right:auto}.ed-inspector{width:245px;top:56px;bottom:28px}.ed-viewport{min-width:0}.ed-tools{z-index:4}.ed-views{left:6px;top:6px;flex-direction:column}.ed-status{padding:0 8px}.ed-status #ed-info{display:none}#ed-empty{padding:12px;justify-content:flex-start;padding-top:60px}#ed-empty h2{font-size:22px}.ed-workspace{grid-template-columns:80px minmax(0,1fr)}.ed-inspector:has(#ed-target:disabled){display:none}}

/* The split panel uses a compact XYZ row instead of stacking all angles. */
#ed-panel[data-active-tool="split"] {gap:8px;}
#ed-panel[data-active-tool="split"] .ed-fields {grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;}
#ed-panel[data-active-tool="split"] .ed-field {grid-template-columns:minmax(0,1fr) 16px;gap:4px;}
#ed-panel[data-active-tool="split"] .ed-field>span:first-child {grid-column:1/-1;}
#ed-panel[data-active-tool="split"] .ed-field input {padding-inline:6px;}
.editor-page .button:not(.button--primary) {background:var(--color-surface-inset);color:var(--color-text-primary);border:1px solid var(--color-border-strong);box-shadow:none;}
.editor-page .button:not(.button--primary):hover:not(:disabled) {background:var(--color-surface-card);}
.ed-tool {box-shadow:none;}

#ed-panel[data-active-tool="parts"] {gap:8px;}

/* A contextual error replaces the tool introduction, preserving control space. */
.ed-inspector:has(#ed-error:not([hidden])) #ed-panel > .ed-note:first-child {display:none;}

.editor-page #ed-export-format {width:76px;flex:none;padding-inline:6px;}
#ed-repair-fields,#ed-surface-fields {display:flex;flex-direction:column;gap:8px;}

.ed-connectors-form {display:flex;flex-direction:column;gap:10px;max-height:65vh;overflow:auto;}
.ed-connector-fields {display:grid;grid-template-columns:1fr 1fr;gap:8px;}
#ed-connector-list {display:flex;flex-direction:column;gap:4px;}
#ed-panel[data-active-tool="split"] .ed-note {font-size:12px;line-height:1.3;}
#ed-panel[data-active-tool="split"] .ed-row .button {font-size:12px;}
.ed-inspector:has(#ed-panel[data-active-tool="split"]) {gap:8px;padding:16px 12px;}
#ed-panel[data-active-tool="split"] input,#ed-panel[data-active-tool="split"] select {min-height:34px;padding:6px 8px;}
#ed-panel[data-active-tool="split"] .button {min-height:34px;}

/* Section editing keeps placement and validation next to the actual cut face. */
#ed-dialog.ed-cut-dialog {width:min(1000px,calc(100vw - 32px));max-height:calc(100dvh - 32px);padding:20px;overflow:auto;}
.ed-cut-editor {display:grid;grid-template-columns:minmax(0,1fr) 285px;gap:20px;min-height:0;}
.ed-cut-map,.ed-cut-settings,#ed-cut-connector-settings {display:flex;flex-direction:column;gap:10px;min-width:0;}
.ed-cut-editor .ed-note {font-size:12px;line-height:1.4;}
.ed-cut-editor label {display:block;font-size:12px;color:var(--color-text-secondary);}
.ed-cut-editor input,.ed-cut-editor select {margin-top:4px;min-height:34px!important;padding:5px 8px!important;}
.ed-cut-editor .button {min-height:34px;font-size:12px;}
#ed-cut-svg {display:block;width:100%;height:min(46vh,420px);min-height:200px;background:var(--color-surface-inset);border:1px solid var(--color-border-strong);border-radius:var(--radius-sm);touch-action:none;cursor:crosshair;}
.ed-cut-area {fill:var(--color-accent-soft);stroke:var(--color-text-secondary);stroke-width:1.5;vector-effect:non-scaling-stroke;}
.ed-cut-area.is-selected {fill:#f7b267;stroke:#a55013;stroke-width:2;}
.ed-cut-number {fill:var(--color-text-primary);text-anchor:middle;dominant-baseline:central;pointer-events:none;font-weight:650;}
.ed-cut-number.is-selected,.ed-cut-marker .ed-cut-number {fill:#173c32;}
.ed-cut-marker {cursor:grab;}
.ed-cut-marker>circle,.ed-cut-marker>rect {fill:#70c6b2;stroke:#215e50;stroke-width:2;vector-effect:non-scaling-stroke;}
.ed-cut-marker.is-selected>circle,.ed-cut-marker.is-selected>rect {stroke:var(--color-text-primary);stroke-width:3;}
.ed-cut-marker>.ed-cut-clearance {fill:none;stroke:#31534b;stroke-dasharray:4 3;stroke-width:1;}
.ed-cut-marker.is-invalid>circle,.ed-cut-marker.is-invalid>rect {fill:#efb6b6;stroke:var(--color-danger);}
.ed-cut-region-list,.ed-cut-connector-list {display:flex;flex-wrap:wrap;gap:6px;max-height:100px;overflow:auto;padding:2px;}
.ed-cut-editor button[aria-pressed=true] {border-color:var(--color-accent)!important;background:var(--color-accent-soft)!important;}
.ed-cut-view-controls #ed-cut-plus,.ed-cut-view-controls #ed-cut-minus {flex:0 0 34px;font-size:18px;}
#ed-connector-error {color:var(--color-danger);font-size:13px;line-height:1.4;margin:0;}
#ed-connector-error:empty {display:none;}
#ed-dialog.ed-cut-dialog #ed-dialog-actions {margin-top:14px;}
@media(max-width:740px){.ed-cut-editor{grid-template-columns:minmax(0,1fr)}#ed-cut-svg{height:260px}.ed-cut-settings{max-height:none}#ed-dialog.ed-cut-dialog{padding:14px}.ed-cut-view-controls .button{white-space:normal}}

.ed-tools {position:relative;z-index:4;}
.ed-tool {position:relative;}
.ed-tooltip {position:fixed;left:var(--ed-tip-x,120px);top:var(--ed-tip-y,100px);transform:translateY(-50%);width:260px;padding:10px 12px;border:1px solid var(--color-border-strong);border-radius:var(--radius-sm);background:var(--color-surface-card-strong);color:var(--color-text-primary);box-shadow:0 4px 16px #0002;text-align:left;font-size:13px;line-height:1.45;font-weight:400;visibility:hidden;opacity:0;pointer-events:none;z-index:20;}
.ed-tool:not(.is-tip-dismissed):is(:hover,:focus-visible) .ed-tooltip {visibility:visible;opacity:1;}
/* Fixed tooltips must stay anchored to the viewport, not a transformed button. */
.editor-page .ed-tool,.editor-page .ed-tool:hover,.editor-page .ed-tool:active {transform:none;padding:4px;transition:background-color .18s,border-color .18s;}
.ed-tools {overflow-y:auto;}
.ed-tool {min-height:52px;flex-shrink:0;font-size:12px;gap:2px;}
#ed-panel[data-active-tool="text"] {gap:8px;}
.ed-inspector:has(#ed-panel[data-active-tool="text"]) {gap:8px;padding:12px;}
#ed-panel[data-active-tool="text"] {gap:4px;}
#ed-panel[data-active-tool="text"] .ed-label {font-size:12px;line-height:1.3;margin-bottom:3px;}
#ed-panel[data-active-tool="text"] .ed-note {font-size:12px;line-height:1.35;margin:0;}
#ed-panel[data-active-tool="text"] .ed-row .button {font-size:12px;padding-inline:8px;}
#ed-panel[data-active-tool="text"] input,#ed-panel[data-active-tool="text"] select {padding:5px 7px;min-height:32px;}
#ed-text-content {box-sizing:border-box;resize:none;height:44px;width:100%;padding:6px 8px;border:1px solid var(--color-border-soft);border-radius:var(--radius-sm);color:var(--color-text-primary);background:var(--color-surface-inset);font:inherit;}
.ed-text-offset summary {font-size:12px;cursor:pointer;color:var(--color-text-secondary);}
.ed-text-offset[open] .ed-row {margin-top:6px;}
#ed-panel[data-active-tool="text"]:has(.ed-text-offset[open]) > .ed-note:first-child {display:none;}
.editor-page textarea:focus-visible {outline:2px solid var(--color-accent);outline-offset:2px;}
