/* CNCApp Editor — full-screen design surface chrome.
   Solid Windows blue with neutral, high-contrast chrome. */

:root {
    --ed-accent: #0067c0;
    --ed-accent-light: #005a9e;
    --ed-chrome: #ffffff;
    --ed-chrome-dark: #e5f3ff;
    --ed-border: #a0a0a0;
    --ed-text: #171717;
    --ed-canvas-bg: #ffffff;
    --ed-muted: #505050;
    --ed-selection: #e5f3ff;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 13px;
    color: var(--ed-text);
    background: var(--ed-chrome);
}

#ed-root { display: flex; flex-direction: column; height: 100vh; }

.d-none { display: none !important; }

/* ======= Menu bar ======= */
#ed-menubar {
    display: flex;
    align-items: stretch;
    background: var(--ed-accent);
    color: #fff;
    height: 38px;
    flex: 0 0 auto;
    user-select: none;
}
#ed-brand {
    display: flex; align-items: center;
    padding: 0 14px;
    font-weight: 700; font-size: 15px;
    color: #fff; text-decoration: none;
    background: rgba(0,0,0,.15);
}
#ed-brand span { font-weight: 300; }
.ed-menus { display: flex; }
.ed-menu { position: relative; display: flex; }
.ed-menu-btn {
    background: none; border: none; color: #fff;
    padding: 0 13px; font-size: 13px; cursor: pointer;
}
.ed-menu-btn:hover, .ed-menu.open .ed-menu-btn { background: rgba(255,255,255,.15); }
.ed-menu-drop {
    display: none;
    position: absolute; top: 100%; left: 0; z-index: 100;
    background: #fff; color: var(--ed-text);
    min-width: 240px;
    border: 1px solid var(--ed-border);
    box-shadow: 0 6px 18px rgba(0,0,0,.25);
    padding: 4px 0;
}
.ed-menu.open .ed-menu-drop { display: block; }
.ed-menu-drop button {
    display: flex; justify-content: space-between; gap: 20px;
    width: 100%; text-align: left;
    background: none; border: none;
    padding: 7px 14px; font-size: 13px; cursor: pointer;
}
.ed-menu-drop button:hover { background: var(--ed-chrome-dark); }
.ed-menu-drop hr { margin: 4px 0; border: none; border-top: 1px solid var(--ed-border); }
.ed-kbd { color: #738da9; font-size: 11px; }
.ed-menubar-right { margin-left: auto; display: flex; align-items: center; padding-right: 8px; }
.ed-iconbtn {
    background: none; border: none; color: #fff;
    font-size: 17px; padding: 2px 10px; cursor: pointer; border-radius: 4px;
}
.ed-iconbtn:hover { background: rgba(255,255,255,.15); }
.ed-iconbtn:disabled { opacity: .35; cursor: default; }
.ed-cloud-btn {
    display: flex; align-items: center; gap: 7px;
    margin-right: 6px; padding: 4px 9px;
    max-width: 240px;
    border: 1px solid rgba(255,255,255,.28); border-radius: 4px;
    background: rgba(255,255,255,.1); color: #fff; cursor: pointer;
    font-size: 12px;
}
.ed-cloud-btn #ed-cloud-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-cloud-btn:hover { background: rgba(255,255,255,.2); }
.ed-cloud-dot { width: 7px; height: 7px; border-radius: 50%; background: #c8f36b; }
.ed-cloud-btn.dirty .ed-cloud-dot { background: #ffd166; box-shadow: 0 0 0 2px rgba(255,209,102,.2); }
.ed-cloud-btn.saving .ed-cloud-dot { background: #71d7ff; animation: ed-pulse 1s infinite alternate; }
@keyframes ed-pulse { to { opacity: .35; } }

/* ======= Body layout ======= */
#ed-body { display: flex; flex: 1 1 auto; min-height: 0; }

/* ======= Aspire-style design toolbox ======= */
#ed-toolbar {
    flex: 0 0 316px;
    min-width: 270px;
    background: #fff;
    border-right: 1px solid #abbbcb;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.ed-primary-pane { display: none; flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 7px 8px 18px; }
.ed-primary-pane.active { display: block; }
.ed-tool-group {
    margin-bottom: 8px;
    border: 1px solid #c2ccd6;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(36,31,40,.05);
}
.ed-tool-group h2 {
    margin: 0;
    padding: 6px 8px;
    border-bottom: 1px solid #d1d9e1;
    background: linear-gradient(#f0f2f5, #e2e6eb);
    color: #3c4e61;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .02em;
}
.ed-tool-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; padding: 5px; }
.ed-tool-grid-four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ed-tool-tile {
    min-width: 0;
    min-height: 58px;
    padding: 5px 3px;
    border: 1px solid transparent;
    border-radius: 3px;
    background: transparent;
    color: #303e4e;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 3px;
    font: inherit;
    font-size: 10px;
    line-height: 1.15;
    text-align: center;
    cursor: pointer;
}
.ed-tool-tile:hover { border-color: #aebece; background: #eef1f4; }
.ed-tool-tile.active {
    border-color: var(--ed-accent-light);
    background: #e3e7ec;
    color: var(--ed-accent);
    box-shadow: inset 0 0 0 1px rgba(0,103,192,.12);
}
.ed-job-setup-tile { background: #fff; border-color: #b9c4d0; }
.ed-tool-glyph {
    display: grid;
    place-items: center;
    height: 27px;
    min-width: 28px;
    color: #3f5368;
    font: 700 23px/1 "Segoe UI Symbol", "Segoe UI", sans-serif;
}
.ed-tool-grid-four .ed-tool-tile { min-height: 56px; }
.ed-tool-grid-four .ed-tool-glyph { font-size: 21px; }
.ed-compact-command-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; padding: 6px; }
.ed-compact-command-grid button {
    min-width: 0;
    height: 29px;
    padding: 2px;
    border: 1px solid #c1cbd6;
    border-radius: 3px;
    background: #f9fafb;
    color: #3e5165;
    cursor: pointer;
}
.ed-compact-command-grid button:hover { border-color: var(--ed-accent-light); background: #e9ecf0; }
/* ======= Tabbed job workspace ======= */
#ed-workspace { flex: 1 1 auto; min-width: 320px; display: flex; flex-direction: column; background: var(--ed-canvas-bg); }
#ed-document-toolbar {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 39px;
    padding: 4px 8px;
    border-bottom: 1px solid #97abc0;
    background: linear-gradient(#f3f5f7, #dfe4ea);
    color: #394b5d;
}
.ed-document-job-button {
    padding: 6px 12px;
    border: 1px solid #4f6780;
    border-radius: 4px;
    background: var(--ed-accent);
    color: #fff;
    font-weight: 650;
    cursor: pointer;
}
#ed-document-summary { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ed-document-spacer { flex: 1 1 auto; }
.ed-document-button {
    padding: 5px 8px;
    border: 1px solid #b6c2ce;
    border-radius: 3px;
    background: #fff;
    color: #37495b;
    cursor: pointer;
}
.ed-view-tabs { display: flex; gap: 2px; padding: 4px 7px 0; border-bottom: 1px solid #5f7d9c; background: #bfc9d4; }
.ed-view-tab {
    min-width: 104px;
    padding: 7px 16px;
    border: 1px solid #748eaa;
    border-bottom: 0;
    border-radius: 5px 5px 0 0;
    background: #96aabf;
    color: #26323f;
    font-weight: 650;
    cursor: pointer;
}
.ed-view-tab.active { position: relative; top: 1px; background: #eef1f4; color: var(--ed-accent); }
#ed-workspace-views { position: relative; flex: 1 1 auto; min-height: 0; }
#ed-canvas-wrap { position: absolute; inset: 0; background: var(--ed-canvas-bg); }
#ed-canvas { position: absolute; inset: 0; width: 100%; height: 100%; outline: none; display: block; }
#ed-root.ed-no-job-open #ed-sidebar,
#ed-root.ed-no-job-open #ed-document-toolbar,
#ed-root.ed-no-job-open .ed-view-tabs,
#ed-root.ed-no-job-open #ed-toolbar .ed-tool-group:not(.ed-file-operations) { opacity: .48; }
.ed-menu-drop button:disabled, .ed-tool-tile:disabled { opacity: .42; cursor: default; }
.ed-menu-drop button:disabled:hover, .ed-tool-tile:disabled:hover { background: transparent; border-color: transparent; }

/* ======= Right sidebar ======= */
#ed-sidebar {
    flex: 0 0 300px;
    background: var(--ed-chrome);
    border-left: 1px solid var(--ed-border);
    display: flex; flex-direction: column; min-height: 0;
}
.ed-sidebar-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    padding: 6px 9px;
    border-bottom: 1px solid var(--ed-border);
    background: var(--ed-chrome-dark);
    color: #516983;
    font-size: 11px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: .035em;
}
.ed-sidebar-selector select {
    flex: 1 1 auto;
    width: auto;
    padding: 5px 7px;
    border: 1px solid #aebdcd;
    border-radius: 3px;
    background: #fff;
    color: #314050;
    font-size: 12px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
}
.ed-tabpage { display: none; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.ed-tabpage.active { display: flex; }
.ed-toolpath-operations .ed-tool-grid { padding: 3px 4px 5px; }
.ed-toolpath-operations .ed-tool-tile { min-height: 50px; }
.ed-toolpath-operations .ed-tool-glyph { height: 22px; font-size: 19px; }
.ed-toolpath-setup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 5px; }
.ed-toolpath-setup-grid button { min-width: 0; }

.ed-section { padding: 10px 12px; border-bottom: 1px solid var(--ed-border); }
.ed-section-grow { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
.ed-section h3 {
    margin: 0 0 8px; font-size: 11px; letter-spacing: .08em;
    text-transform: uppercase; color: #607d9c;
}
.ed-mat-summary { font-size: 12.5px; line-height: 1.5; margin-bottom: 8px; white-space: pre-line; }

.ed-op-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

/* Text dimensions are measured from the actual generated vector outlines. */
.ed-text-dialog { width: min(960px, calc(100vw - 32px)); }
.ed-text-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; }
.ed-text-controls, .ed-text-preview { min-width: 0; }
.ed-text-controls .ed-field-row { flex-wrap: wrap; gap: 10px; }
.ed-text-controls .ed-field-row label { min-width: 0; flex: 1 1 90px; }
.ed-text-controls .ed-field-row label.ed-check { flex-basis: 160px; }
.ed-text-controls input[type=number], .ed-text-controls select { width: 100%; min-width: 0; box-sizing: border-box; }
.ed-text-controls label > span { display: block; }
#text-arch-opts [hidden] { display: none !important; }
.ed-text-controls textarea { box-sizing: border-box; }
.ed-text-controls .ed-muted, .ed-text-preview .ed-muted { font-size: 11px; line-height: 1.45; }
.ed-text-preview { align-self: start; border: 1px solid var(--ed-border); background: #f8fafb; padding: 12px; }
.ed-text-preview h3 { margin: 0 0 12px; }
#text-preview { display: block; width: 100%; height: auto; background: white; border: 1px solid #dce3e8; box-sizing: border-box; }
.ed-text-measurement { font-variant-numeric: tabular-nums; font-weight: 600; min-height: 18px; }
.ed-text-position { margin: 10px 0 0; padding: 8px 0 0; border: 0; border-top: 1px solid var(--ed-border); min-width: 0; }
.ed-text-position legend { font-weight: 600; padding: 0 6px 0 0; font-size: 12px; }
.ed-text-position .ed-btn { align-self: end; margin-bottom: 0; }
.ed-text-pair-options { margin:10px 0; border-block:1px solid var(--ed-border); padding:8px 0; }
.ed-text-pair-options summary { font-weight:600; font-size:12px; cursor:pointer; }
.ed-text-pair-options .ed-field-row { flex-wrap:wrap; }
.ed-text-pair-options .ed-btn { align-self:end; }
.ed-text-pair-options input { min-width:0; }
.ed-text-pair-navigation { align-items:center; }
.ed-text-pair-adjustment label { flex:1 1 160px; }
#text-pair-label { overflow-wrap:anywhere; }
.ed-text-dialog .ed-dialog-actions { position: sticky; bottom: -16px; background: white; padding: 10px 0; border-top: 1px solid var(--ed-border); z-index: 1; }
#text-preview-status { min-height: 32px; font-size: 12px; line-height: 1.4; }
@media (max-width: 800px) { .ed-text-layout { grid-template-columns: 1fr; } }

/* Measured model cross-section: source location, then the resulting profile. */
.ed-model-section { width: min(940px, calc(100vw - 32px)); }
.ed-model-section-layout { display: grid; grid-template-columns: minmax(230px, 290px) minmax(0, 1fr); gap: 18px; }
.ed-section-controls { display: grid; gap: 12px; align-content: start; }
.ed-section-controls fieldset { margin: 0; padding: 10px; border: 1px solid var(--ed-border); }
.ed-section-controls legend { font-weight: 600; font-size: 12px; padding: 0 4px; }
.ed-section-controls legend span { color: #647384; font-weight: normal; margin-left: 5px; }
.ed-section-controls label { display: grid; gap: 4px; margin: 8px 0; font-size: 12px; }
.ed-section-controls input, .ed-section-controls select { min-width: 0; width: 100%; box-sizing: border-box; }
.ed-section-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ed-section-presets { display: flex; flex-wrap: wrap; gap: 5px; }
.ed-section-controls .ed-muted { font-size: 11px; margin: 6px 0 0; }
.ed-section-plots { min-width: 0; }
.ed-section-plots svg { width: 100%; display: block; border: 1px solid var(--ed-border); background: #f8fafb; margin-bottom: 10px; }
.ed-section-plots text { font: 11px system-ui, sans-serif; fill: #425366; }
.ed-section-plots .section-footprint { fill: #e7ecf0; stroke: #a9b5c0; stroke-width: 1; }
.ed-section-plots .section-cut { fill: none; stroke: #096c93; stroke-width: 1.6; }
.ed-section-plots .section-endpoint { fill: #096c93; }
.ed-section-plots .section-grid { stroke: #dde4e9; stroke-width: 1; }
.ed-section-summary { font-size: 12px; font-variant-numeric: tabular-nums; }
.ed-section-error { color: #ae2929; }
#section-status { min-height: 18px; font-size: 12px; }
.ed-model-slices { width: min(790px, calc(100vw - 32px)); }
.ed-section-controls .ed-slice-check { display: flex; flex-direction: row; align-items: start; gap: 7px; }
.ed-section-controls .ed-slice-check input { width: auto; margin-top: 2px; }
.ed-slice-table-wrap { max-height: 160px; overflow: auto; border: 1px solid var(--ed-border); }
.ed-slice-table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.ed-slice-table th, .ed-slice-table td { text-align: right; padding: 5px 9px; border-bottom: 1px solid #e2e8ee; }
.ed-slice-table th { position: sticky; top: 0; background: #f1f5f8; font-weight: 600; }
.ed-slice-table button { border: 0; background: transparent; color: #075f86; text-decoration: underline; cursor: pointer; font: inherit; padding: 0 5px; }
.ed-slice-table tr.selected { background: #e5f0f7; }
.ed-slice-visuals { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px; }
.ed-slice-visuals figure { margin: 0 0 10px; display: grid; align-content: center; min-width: 0; }
.ed-slice-visuals canvas { display: block; width: 100%; height: 190px; object-fit: contain; background: #f8f8f8; border: 1px solid var(--ed-border); }
.ed-slice-visuals figcaption { font-size: 11px; text-align: center; margin-top: 6px; }
#slice-status { min-height: 18px; font-size: 12px; }
@media (max-width: 720px) { .ed-model-section-layout { grid-template-columns: 1fr; } }

/* ======= 3D relief components ======= */
.ed-relief-list { display: grid; gap: 5px; max-height: 190px; overflow-y: auto; }
.ed-relief-row {
    display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px;
    padding: 7px 8px; border: 1px solid var(--ed-border); border-radius: 5px; background: #fff; cursor: pointer;
}
.ed-relief-row:hover { background: var(--ed-chrome); }
.ed-relief-row.selected { border-color: var(--ed-accent); box-shadow: inset 3px 0 var(--ed-accent); }
.ed-relief-row-details { min-width: 0; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.ed-relief-row-details > span { display: block; }
.ed-relief-row-details:focus-visible { outline: 2px solid var(--ed-accent); outline-offset: 3px; }
.ed-relief-row-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; font-weight: 600; }
.ed-relief-row-meta { margin-top: 2px; color: #738da9; font-size: 10.5px; text-transform: capitalize; }
.ed-relief-empty { padding: 20px 10px; border: 1px dashed var(--ed-border); border-radius: 5px; color: #738da9; font-size: 12px; line-height: 1.45; text-align: center; }
.ed-relief-actions { margin-top: 7px; }
.ed-relief-actions .ed-btn { flex: 1; }
.ed-relief-group-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.ed-relief-group-head h3 { margin: 0; }
.ed-relief-group-list { display: grid; gap: 4px; margin-bottom: 7px; }
.ed-relief-group-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 6px; padding: 5px 7px; border-radius: 5px; background: #fff; font-size: 11px; }
.ed-relief-group-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-relief-group-row button { border: 0; background: transparent; color: #8d3b49; cursor: pointer; }
.ed-relief-group-badge { display: inline-block; margin-left: 4px; padding: 1px 5px; border-radius: 99px; background: #e3e8ed; color: #4a6178; font-size: 9px; }
.ed-relief-sculpt, .ed-relief-mask, .ed-relief-pattern, .ed-relief-inspector { margin-top: 14px; padding: 10px; border: 1px solid #d1d9e1; border-radius: 6px; background: #fff; }
.ed-relief-sculpt h3, .ed-relief-mask h3, .ed-relief-pattern h3, .ed-relief-inspector h3 { margin-bottom: 9px; }
.ed-relief-sculpt .ed-muted, .ed-relief-pattern .ed-muted { margin: 7px 0 0; line-height: 1.4; }
.ed-relief-sculpt .ed-field-row[hidden], #relief-pattern-grid-fields[hidden], #relief-pattern-radial-fields[hidden], #relief-pattern-curve-fields[hidden], #relief-pattern-spacing-wrap[hidden], #relief-pattern-curve-count-wrap[hidden] { display: none; }
.ed-relief-sculpt .ed-field-row { flex-wrap: wrap; }
.ed-relief-sculpt .ed-field-row > label { min-width: 72px; }
#relief-sculpt-texture-options > label:first-child { flex-basis: 100%; }
.ed-relief-pattern .ed-field-row { flex-wrap: wrap; }
.ed-relief-pattern .ed-btn { min-width: 72px; }
.ed-relief-mask .ed-muted { margin: 6px 0 0; line-height: 1.35; }
.ed-relief-feature-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ed-relief-feature-head h3 { margin: 0; }
.ed-relief-preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; align-items: end; margin-bottom: 9px; }
.ed-relief-preset-row label { grid-column: 1 / -1; }
.ed-relief-layers { margin-top: 11px; padding-top: 10px; border-top: 1px solid #d1d9e1; }
.ed-relief-layer-list { display: grid; gap: 4px; max-height: 150px; overflow-y: auto; margin-top: 7px; }
.ed-relief-layer-row { display: grid; grid-template-columns: auto minmax(0, 1fr) 82px; gap: 5px; align-items: center; padding: 5px 6px; border: 1px solid var(--ed-border); border-radius: 4px; background: #fff; cursor: pointer; }
.ed-relief-layer-row.active { border-color: var(--ed-accent); box-shadow: inset 3px 0 var(--ed-accent); }
.ed-relief-layer-row input[type="text"] { min-width: 0; }
.ed-relief-layer-row label { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 3px; font-size: 10px; }
.ed-relief-layer-row input[type="range"] { min-width: 0; width: 100%; }
.ed-relief-layer-empty { padding: 8px; border: 1px dashed var(--ed-border); border-radius: 4px; color: #6885a3; font-size: 11px; text-align: center; }
.ed-relief-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; margin: 8px 0; }
.ed-relief-analysis-state { grid-column: 1 / -1; padding: 8px; color: var(--ed-muted, #5d6974); font-size: 12px; }
.ed-relief-analysis-state .ed-btn { margin-left: 8px; }
.ed-relief-metric { padding: 6px 7px; border-radius: 4px; background: #fff; border: 1px solid #dde2e8; }
.ed-relief-metric span, .ed-relief-metric strong { display: block; }
.ed-relief-metric span { color: #63809f; font-size: 9px; text-transform: uppercase; }
.ed-relief-metric strong { margin-top: 2px; font-size: 12px; }
#relief-inspect-sample { margin-bottom: 0; }
#relief-pattern-curve-fields { display: grid; gap: 8px; }
.ed-relief-machining { margin-top: auto; padding-top: 14px; }
.ed-relief-machining > label { margin-bottom: 7px; }
.ed-relief-dialog { width: min(930px, 94vw); }
.ed-model-dialog { width: min(790px, 94vw); }
.ed-callout { padding: 9px 11px; margin: 8px 0; border-left: 3px solid var(--ed-accent-light); border-radius: 3px; background: #fff; color: #485f76; font-size: 12px; line-height: 1.45; }
.ed-relief-import-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 14px; }
.ed-relief-preview-wrap {
    min-height: 340px; display: flex; align-items: center; justify-content: center; overflow: hidden;
    border: 1px solid var(--ed-border); border-radius: 6px; background: #1b232c;
}
#relief-import-preview { display: block; max-width: 100%; max-height: 440px; }
.ed-relief-import-layout > div:last-child { display: grid; align-content: start; gap: 10px; padding: 12px; border-radius: 6px; background: var(--ed-chrome); }

@media (max-width: 800px) {
    .ed-relief-import-layout { grid-template-columns: 1fr; }
    .ed-relief-preview-wrap { min-height: 230px; }
}

/* ======= Buttons / fields ======= */
.ed-btn {
    padding: 7px 12px; font-size: 13px;
    border: 1px solid var(--ed-border); border-radius: 4px;
    background: #fff; cursor: pointer; color: var(--ed-text);
}
.ed-btn:hover { background: var(--ed-chrome-dark); }
.ed-btn-primary { background: var(--ed-accent); border-color: var(--ed-accent); color: #fff; }
.ed-btn-primary:hover { background: var(--ed-accent-light); }
.ed-btn-danger { border-color: #b94452; color: #9c2635; background: #fff6f7; }
.ed-btn-danger:hover { background: #f8e2e5; }
.ed-btn-sm { padding: 5px 10px; font-size: 12px; }
.ed-btn:disabled { opacity: .45; cursor: default; }

label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: #3b4d60; }
.ed-lbl { font-size: 12px; color: #3b4d60; margin-bottom: 3px; }
input[type="text"], input[type="number"], select {
    padding: 5px 7px; font-size: 13px;
    border: 1px solid var(--ed-border); border-radius: 4px;
    background: #fff; color: var(--ed-text);
    width: 100%; min-width: 0;
}
input:focus, select:focus { outline: 2px solid var(--ed-accent-light); outline-offset: -1px; }
.ed-field-row { display: flex; gap: 8px; margin-bottom: 9px; align-items: flex-end; }
.ed-field-row > label { flex: 1; }
.ed-check { flex-direction: row !important; align-items: center; gap: 6px; margin: 4px 0; font-size: 12.5px; }
.ed-check input { width: auto; }
.ed-muted { color: #738da9; font-size: 12px; }
.ed-warn { color: #a33; font-size: 12.5px; min-height: 1.2em; margin-bottom: 6px; white-space: pre-line; }

/* ======= Toolpath list ======= */
.ed-tp-list { list-style: none; margin: 0 0 8px; padding: 0; overflow-y: auto; flex: 1 1 auto; }
.ed-tp-list li {
    display: flex; align-items: center; gap: 7px;
    background: #fff; border: 1px solid var(--ed-border); border-radius: 4px;
    padding: 6px 8px; margin-bottom: 5px; font-size: 12.5px;
}
.ed-tp-list li.selected { border-color: var(--ed-accent); box-shadow: 0 0 0 1px var(--ed-accent); }
.ed-tp-list .tp-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: default; }
.ed-tp-list .tp-swatch { width: 10px; height: 10px; border-radius: 2px; flex: 0 0 auto; }
.ed-tp-list .tp-mini {
    background: none; border: none; cursor: pointer; padding: 1px 4px;
    color: #546d88; font-size: 13px; border-radius: 3px;
}
.ed-tp-list .tp-mini:hover { background: var(--ed-chrome-dark); color: var(--ed-text); }
.ed-tp-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.ed-tp-actions .ed-btn { flex: 1 1 auto; padding-left: 7px; padding-right: 7px; }

/* ======= Machining preflight ======= */
.ed-preflight-dialog { width: min(900px, 94vw); }
.ed-preflight-banner {
    display: flex; align-items: center; justify-content: space-between; gap: 15px;
    padding: 12px 15px; margin: 7px 0 12px; border-radius: 6px;
    border: 1px solid var(--ed-border); font-size: 13px;
}
.ed-preflight-banner strong { font-size: 16px; }
.ed-preflight-banner.ready { color: #176b36; background: #e6f5ea; border-color: #a6d8b4; }
.ed-preflight-banner.review { color: #755100; background: #fff5d6; border-color: #e8ca6c; }
.ed-preflight-banner.not-ready { color: #92232a; background: #fbe5e7; border-color: #e2a3a8; }
.ed-preflight-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 7px; }
.ed-preflight-metric { padding: 8px 9px; border: 1px solid var(--ed-border); border-radius: 5px; background: var(--ed-chrome); }
.ed-preflight-metric span { display: block; color: #607d9c; font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-preflight-metric strong { display: block; margin-top: 2px; font-size: 14px; }
.ed-preflight-heading { margin: 16px 0 7px; color: #546e8a; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.ed-preflight-issues { list-style: none; padding: 0; margin: 0; max-height: 150px; overflow-y: auto; display: grid; gap: 5px; }
.ed-preflight-issues li { display: grid; grid-template-columns: 48px 1fr; gap: 7px; padding: 7px 9px; border-radius: 4px; background: #fff; font-size: 12px; }
.ed-preflight-issues li > span { font-size: 10px; font-weight: 700; text-transform: uppercase; }
.ed-preflight-issues li.error { color: #92232a; background: #fbe9ea; }
.ed-preflight-issues li.warning { color: #755100; background: #fff7df; }
.ed-preflight-issues li.ok { color: #176b36; background: #eaf6ed; }
.ed-preflight-table-wrap { max-height: 220px; overflow: auto; border: 1px solid var(--ed-border); border-radius: 5px; }
.ed-preflight-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.ed-preflight-table th { position: sticky; top: 0; background: var(--ed-chrome-dark); color: #546d88; text-align: left; padding: 7px; }
.ed-preflight-table td { padding: 7px; border-top: 1px solid var(--ed-border); }
.ed-preflight-table small { display: block; color: #738da9; text-transform: capitalize; }

@media (max-width: 720px) {
    .ed-preflight-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ed-preflight-table th:nth-child(6), .ed-preflight-table td:nth-child(6) { display: none; }
}

/* ======= Status bar ======= */
#ed-statusbar {
    display: flex; align-items: center; gap: 18px;
    background: var(--ed-chrome);
    border-top: 1px solid var(--ed-border);
    padding: 4px 12px; height: 30px; flex: 0 0 auto;
    font-size: 12px; color: #3b4d60; user-select: none;
}
#ed-statusbar label { flex-direction: row; align-items: center; gap: 5px; }
#ed-statusbar input[type="number"] { padding: 1px 4px; font-size: 12px; }
#ed-status-pos { font-family: Consolas, monospace; min-width: 170px; }
.ed-status-spacer { flex: 1; }
#ed-status-hint { color: #738da9; font-style: italic; }

/* ======= Dialogs ======= */
.ed-dialog {
    border: 1px solid var(--ed-border); border-radius: 8px;
    box-shadow: 0 12px 40px rgba(0,0,0,.35);
    padding: 18px 20px;
    min-width: 430px; max-width: 92vw;
    font-size: 13px; color: var(--ed-text);
}
.ed-dialog::backdrop { background: rgba(30, 24, 44, .45); }
.ed-dialog h2 { margin: 0 0 14px; font-size: 17px; color: var(--ed-accent); }
.ed-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.ed-dialog-wide { min-width: 640px; }
.ed-inspection-dialog { width: 440px; min-width: 0; }
.ed-inspection-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ed-inspection-fields label { display: flex; flex-direction: column; gap: 4px; }
.ed-inspection-fields input { width: 100%; box-sizing: border-box; }
#ed-inspection-error { color: #a42c2c; }
.ed-finish-tool-editor { width: 460px; min-width: 0; max-height: 90vh; overflow: auto; }
.ed-finish-tool-editor label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; min-width: 0; }
.ed-finish-tool-editor input[type="number"] { width: 100%; min-width: 0; box-sizing: border-box; }
#finish-tool-fields, #finish-tool-rest-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.ed-finish-tool-editor .ed-dialog-actions { position: sticky; bottom: 0; padding-top: 8px; background: var(--ed-panel, white); }
.ed-finish-tool-row { margin: 10px 0; padding-left: 2px; }
.ed-finish-tool-row strong, .ed-finish-tool-summary { display: block; margin-bottom: 5px; }
.ed-finish-tool-row .ed-btn { margin-right: 6px; }
.ed-pocket-cutter-list { list-style: none; padding: 0; }
.ed-pocket-cutter-list .ed-finish-tool-row { padding: 8px 0; border-bottom: 1px solid var(--ed-border, #d4d9df); }
.ed-pocket-cutter-list .ed-finish-tool-row > div { display: flex; flex-wrap: wrap; gap: 5px; }
.ed-pocket-cutter-list .ed-btn { margin: 0; }
.ed-clearance-cutting-summary { display: block; font-size: 11px; font-weight: normal; margin: 5px 0 8px; line-height: 1.5; }
.ed-clearance-strategy { margin-top: 8px; }
.ed-relief-selector { width: 460px; min-width: 0; max-height: 90vh; overflow: auto; }
.ed-relief-selector input[type="search"] { width: 100%; box-sizing: border-box; }
.ed-relief-choice-actions { display: flex; gap: 8px; margin-top: 10px; }
#relief-selector-list { max-height: 280px; overflow: auto; border: 1px solid var(--ed-border, #ccc); padding: 6px; }
.ed-relief-selector .ed-relief-choice { display: flex; flex-direction: row; gap: 9px; align-items: flex-start; padding: 6px; margin: 0; }
.ed-relief-choice > input { flex: 0 0 auto; margin: 2px 0 0; }
.ed-relief-choice > span { min-width: 0; overflow-wrap: anywhere; }
.ed-relief-choice strong, .ed-relief-choice span span { display: block; }
.ed-relief-selector .ed-dialog-actions { position: sticky; bottom: 0; padding-top: 8px; background: var(--ed-panel, white); }
#dlg-node-properties { width: 470px; min-width: 0; max-height: calc(100dvh - 32px); overflow: hidden; box-sizing: border-box; }
#dlg-node-properties > form { display: flex; flex-direction: column; max-height: calc(100dvh - 56px); }
#dlg-node-properties h2, #dlg-node-properties .ed-dialog-actions { flex-shrink: 0; }
#node-properties-body { min-height: 0; overflow-y: auto; }
#node-properties-reference { overflow-wrap: anywhere; }
#dlg-node-properties label { margin-bottom: 9px; min-width: 0; }
#dlg-node-properties input[type="number"] { width: 100%; min-width: 0; }
#dlg-node-properties [hidden] { display: none !important; }
#node-handle-preview, #node-position-preview { display: block; width: 100%; height: auto; border: 1px solid var(--ed-border); background: white; box-sizing: border-box; }
#node-handle-summary { font-variant-numeric: tabular-nums; }
#dlg-node-arc { width: 450px; min-width: 0; max-height: 90vh; overflow-y: auto; }
#dlg-node-arc [hidden] { display: none !important; }
#dlg-node-arc label { margin-bottom: 9px; min-width: 0; }
#dlg-node-arc .ed-field-row { align-items: flex-start; }
#dlg-node-arc input[type="number"] { width: 100%; min-width: 0; }
#node-arc-preview { width: 100%; height: 130px; display: block; margin-bottom: 12px; }
#dlg-node-line { width: 470px; min-width: 0; max-height: 90vh; overflow-y: auto; }
#dlg-node-line [hidden] { display: none !important; }
#dlg-node-line label { margin-bottom: 9px; min-width: 0; }
#dlg-node-line .ed-field-row { align-items: flex-start; }
#dlg-node-line input[type="number"], #dlg-node-line select { width: 100%; min-width: 0; }
#node-line-preview { width: 100%; height: auto; display: block; margin-bottom: 12px; }
#node-line-preview[aria-invalid="true"] { opacity: .25; }
#node-line-summary { font-variant-numeric: tabular-nums; }
.ed-post-dialog { width: min(1020px, 96vw); max-width: 96vw; }
.ed-post-layout { display: grid; grid-template-columns: 245px minmax(0, 1fr); gap: 20px; }
.ed-post-layout aside { min-width: 0; }
.ed-post-layout label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.ed-post-layout .ed-check { flex-direction: row; align-items: center; }
.ed-post-layout [hidden], #machine-custom-block[hidden] { display: none !important; }
.ed-post-layout .ed-field-row > label { flex: 1; min-width: 90px; }
.ed-post-layout select, .ed-post-layout input:not([type=checkbox]), .ed-post-layout textarea { width: 100%; box-sizing: border-box; }
.ed-post-layout #post-list { height: 300px; margin: 8px 0; }
.ed-post-buttons { display: flex; gap: 6px; margin-bottom: 8px; }
.ed-post-buttons > button { flex: 1; }
.ed-post-editor { min-width: 0; }
.ed-post-editor fieldset { margin: 6px 0 12px; }
.ed-post-editor fieldset:disabled { opacity: .78; }
.ed-post-editor details { margin: 10px 0; }
.ed-post-editor summary { cursor: pointer; margin-bottom: 10px; }
.ed-post-editor textarea, #post-preview { font-family: Consolas, monospace; font-size: 12px; }
#post-preview { max-height: 220px; overflow: auto; padding: 10px; background: var(--ed-bg); border: 1px solid var(--ed-border); }
#post-status { min-height: 20px; margin-top: 12px; }
#post-reload[hidden] { display: none !important; }
@media (max-width: 760px) { .ed-post-layout { grid-template-columns: 1fr; } .ed-post-layout #post-list { height: 135px; } }
.ed-tool-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.ed-tool-dialog-head h2 { margin-bottom: 3px; }

/* ======= Live setup and machining guides ======= */
.ed-guided-dialog {
    box-sizing: border-box;
    width: min(1010px, 96vw);
    max-height: 94vh;
    overflow: auto;
}
.ed-toolpath-dialog { width: min(1080px, 96vw); }
.ed-guided-layout {
    display: grid;
    grid-template-columns: minmax(390px, 1.03fr) minmax(380px, .97fr);
    gap: 18px;
    align-items: start;
}
.ed-toolpath-guided-layout { grid-template-columns: minmax(470px, 1.15fr) minmax(360px, .85fr); }
.ed-guide-controls { min-width: 0; }
.ed-live-guide {
    position: sticky;
    top: 0;
    min-width: 0;
    padding: 13px;
    border: 1px solid #ced6de;
    border-radius: 8px;
    background: #fff;
    box-shadow: inset 0 1px rgba(255,255,255,.8);
}
.ed-guide-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.ed-guide-heading h3 { margin: 1px 0 0; color: #3b4e61; font-size: 14px; }
.ed-guide-eyebrow { color: #6885a3; font-size: 9.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.ed-guide-badge {
    flex: 0 0 auto;
    padding: 4px 8px;
    border: 1px solid #bdc8d3;
    border-radius: 999px;
    background: #fff;
    color: #4b627a;
    font-size: 10px;
    font-weight: 700;
}
.ed-guide-svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
    border: 1px solid #cbd4dd;
    border-radius: 7px;
    background: #fff;
}
.ed-guide-caption { min-height: 38px; margin: 9px 2px 5px; color: #3e5266; font-size: 11.5px; line-height: 1.45; }
.ed-guide-note { margin: 7px 2px 0; color: #6b87a5; font-size: 10.5px; line-height: 1.4; }
.ed-guide-legend { display: flex; flex-wrap: wrap; gap: 8px 13px; padding-top: 7px; border-top: 1px solid #d5dce3; color: #56718d; font-size: 10px; }
.ed-guide-legend span { display: inline-flex; align-items: center; gap: 5px; }
.ed-legend-swatch { display: inline-block; width: 14px; height: 3px; border-radius: 3px; background: #5a7592; }
.ed-legend-swatch.datum { width: 8px; height: 8px; border-radius: 50%; background: #d84050; box-shadow: 0 0 0 2px #ffd8dc; }
.ed-legend-swatch.zzero { background: #d84050; }
.ed-legend-swatch.safe { border-top: 2px dashed #2a7b9b; background: transparent; }
.ed-guide-svg .guide-label { fill: #465b71; font: 11px system-ui, sans-serif; }
.ed-guide-svg .guide-label-strong { fill: #3b4e61; font: 700 11px system-ui, sans-serif; }
.ed-guide-svg .guide-small { fill: #5c7997; font: 9.5px system-ui, sans-serif; }
.ed-guide-svg .guide-dimension { fill: #4d657d; font: 700 10.5px system-ui, sans-serif; text-anchor: middle; }
.ed-guide-svg .guide-vector { fill: none; stroke: #415569; stroke-width: 2.2; stroke-dasharray: 5 4; }
.ed-guide-svg .guide-toolpath { fill: none; stroke: #147fa3; stroke-width: 3; }
.ed-guide-svg .guide-toolpath-soft { fill: none; stroke: #51abc5; stroke-width: 2; }
.ed-guide-svg .guide-cut { fill: rgba(35,137,169,.14); stroke: #147fa3; stroke-width: 1.5; }
.ed-guide-svg .guide-dim-line { fill: none; stroke: #587390; stroke-width: 1; }
.ed-guide-svg .guide-safe-line { fill: none; stroke: #2a7b9b; stroke-width: 1.6; stroke-dasharray: 5 4; }
.ed-guide-svg .guide-zero-line { fill: none; stroke: #d84050; stroke-width: 2.3; }
.ed-guide-svg .guide-cutter { fill: #cfdae0; stroke: #566b76; stroke-width: 1.4; }
.ed-guide-svg .guide-flute { fill: none; stroke: #6c8793; stroke-width: 1.3; }
.ed-guide-svg .guide-axis { fill: none; stroke: #5a7592; stroke-width: 1.5; }

@media (max-width: 880px) {
    .ed-guided-layout, .ed-toolpath-guided-layout { grid-template-columns: 1fr; }
    .ed-live-guide { position: static; }
    .ed-job-dialog, .ed-toolpath-dialog { width: min(720px, 96vw); }
}

/* ======= Bitmap trace ======= */
.ed-trace-dialog { width: min(920px, 94vw); }
.ed-trace-layout { display: grid; grid-template-columns: minmax(0, 1fr) 245px; gap: 14px; }
.ed-trace-preview-wrap { min-height: 330px; display: flex; align-items: center; justify-content: center; overflow: hidden; border: 1px solid var(--ed-border); border-radius: 6px; background: #fff; }
#trace-preview { display: block; max-width: 100%; max-height: 430px; image-rendering: auto; }
.ed-trace-controls { display: grid; align-content: start; gap: 12px; padding: 12px; border-radius: 6px; background: var(--ed-chrome); }
.ed-trace-controls label { display: grid; gap: 4px; }
.ed-trace-controls .ed-check { display: flex; }

/* ======= Cloud projects ======= */
.ed-cloud-dialog { width: min(920px, 94vw); }
.ed-cloud-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.ed-cloud-head h2 { margin-bottom: 3px; }
.ed-cloud-head p { margin: 0 0 12px; }
.ed-cloud-savebar {
    display: flex; align-items: flex-end; gap: 10px;
    padding: 10px; margin-bottom: 8px; border-radius: 6px;
    background: var(--ed-chrome);
}
.ed-cloud-savebar label { flex: 1; min-width: 140px; }
.ed-cloud-toolbar { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 5px; }
.ed-cloud-toolbar label { min-width: 170px; }
.ed-cloud-toolbar .ed-cloud-search { flex: 1; }
#cloud-status { min-height: 20px; padding: 2px 1px 7px; }
.ed-cloud-list { max-height: 370px; overflow-y: auto; display: grid; gap: 7px; }
.ed-cloud-project {
    display: grid; grid-template-columns: 120px minmax(0, 1fr) auto;
    align-items: center; gap: 10px; padding: 10px 12px;
    border: 1px solid var(--ed-border); border-radius: 6px; background: #fff;
}
.ed-cloud-project.current { border-color: var(--ed-accent); box-shadow: inset 3px 0 var(--ed-accent); }
.ed-cloud-thumb { width: 120px; height: 72px; object-fit: cover; display: flex; align-items: center; justify-content: center; border: 1px solid var(--ed-border); border-radius: 4px; background: var(--ed-chrome); color: #738da9; font-size: 11px; }
.ed-cloud-project-details { min-width: 0; }
.ed-cloud-project-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-cloud-project-meta { color: #738da9; font-size: 11.5px; margin-top: 2px; }
.ed-cloud-folder-badge { display: inline-block; max-width: 100%; margin-top: 5px; padding: 2px 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 999px; background: #fff; color: #475d73; font-size: 11px; }
.ed-cloud-project-actions { display: flex; gap: 6px; }
.ed-cloud-empty { text-align: center; padding: 38px 16px; border: 1px dashed var(--ed-border); border-radius: 6px; color: #5c7896; }
.ed-cloud-guest { padding: 24px; text-align: center; background: var(--ed-chrome); border-radius: 6px; }
.ed-cloud-guest h3 { margin: 0 0 6px; color: var(--ed-accent); }
.ed-cloud-guest p { max-width: 520px; margin: 0 auto 18px; line-height: 1.5; }
.ed-cloud-guest .ed-btn { display: inline-block; text-decoration: none; }

/* ======= Machine profiles and controller validation ======= */
.ed-gcode-dialog { width: min(760px, 94vw); }
.ed-machine-report { margin: 9px 0; padding: 9px 11px; border: 1px solid #bdd9d2; border-left: 4px solid #188b7c; border-radius: 5px; background: #eef8f5; font-size: 12px; }
.ed-machine-report.review { border-color: #e3c58d; border-left-color: #b87312; background: #fff8eb; }
.ed-machine-report.blocked { border-color: #e0adb4; border-left-color: #a33; background: #fff1f3; }
.ed-machine-report ul { margin: 6px 0 0; padding-left: 19px; }
.ed-machine-report li { margin: 3px 0; line-height: 1.35; }
.ed-machine-report li.error { color: #8f2637; }
.ed-machine-report li.warning { color: #875608; }
.ed-machine-report details { margin-top: 7px; }
#dlg-gcode > .ed-dialog-actions { position: sticky; bottom: 0; background: white; box-shadow: 0 12px 0 white; }
#gcode-tp-list { max-height: 170px; overflow-y: auto; }
#gcode-machine-report { max-height: min(30vh, 240px); overflow-y: auto; }
.ed-machines-dialog { width: min(1120px, 96vw); max-height: 92vh; overflow-y: auto; }
.ed-machine-layout { display: grid; grid-template-columns: 235px minmax(0, 1fr); gap: 14px; min-height: 510px; }
.ed-machine-layout > aside { padding-right: 12px; border-right: 1px solid var(--ed-border); }
.ed-machine-new { display: grid; gap: 6px; margin-bottom: 9px; }
.ed-machine-list { display: grid; align-content: start; gap: 6px; max-height: 460px; overflow-y: auto; }
.ed-machine-card { width: 100%; padding: 9px 10px; border: 1px solid var(--ed-border); border-radius: 6px; background: #fff; color: var(--ed-text); text-align: left; cursor: pointer; }
.ed-machine-card:hover, .ed-machine-card.selected { border-color: var(--ed-accent); background: #fff; box-shadow: inset 3px 0 var(--ed-accent); }
.ed-machine-card strong, .ed-machine-card span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-machine-card span { margin-top: 2px; color: #6481a0; font-size: 10.5px; }
.ed-machine-editor { min-width: 0; }
.ed-machine-section { margin-bottom: 10px; padding: 10px 11px; border: 1px solid var(--ed-border); border-radius: 6px; background: #fff; }
.ed-machine-section h3 { margin: 0 0 9px; color: var(--ed-accent); font-size: 12px; letter-spacing: .35px; text-transform: uppercase; }
.ed-machine-fields-six { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); gap: 8px; }
.ed-machine-section textarea { width: 100%; resize: vertical; font-family: Consolas, monospace; font-size: 11px; }
.ed-disabled-section { opacity: .55; }
#machine-status { min-height: 19px; }
.ed-machine-subhead { margin-top: 13px !important; padding-top: 10px; border-top: 1px solid var(--ed-border); }
.ed-controller-capabilities { margin: 7px 0; padding: 7px 9px; border: 1px solid #c8dcd7; border-radius: 5px; background: #f0f8f6; color: #526966; font-size: 11px; }
.ed-controller-capabilities.warning { border-color: #e3c58d; background: #fff8eb; color: #805711; }

/* ======= Sheet nesting and material inventory ======= */

.ed-nesting-dialog { width: min(1180px, 96vw); max-height: 92vh; overflow-y: auto; }
.ed-nesting-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 14px; }
.ed-nesting-setup { display: grid; align-content: start; gap: 9px; padding-right: 13px; border-right: 1px solid var(--ed-border); }
.ed-nesting-setup > label, .ed-nesting-fields label { display: grid; gap: 4px; }
.ed-nesting-setup > .ed-check { display: flex; }
.ed-nesting-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ed-nest-part-summary { padding: 8px 9px; border-radius: 5px; background: var(--ed-chrome); color: #4f6881; font-size: 11px; line-height: 1.45; }
.ed-nesting-result { min-width: 0; }
.ed-nest-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-bottom: 8px; }
.ed-nest-metrics > div { min-width: 0; padding: 8px 10px; border-radius: 5px; background: var(--ed-chrome); }
.ed-nest-metrics span, .ed-nest-metrics strong { display: block; }
.ed-nest-metrics span { color: #617f9e; font-size: 9.5px; letter-spacing: .4px; text-transform: uppercase; }
.ed-nest-metrics strong { margin-top: 2px; color: var(--ed-accent); font-size: 15px; }
.ed-nest-tabs { display: flex; gap: 5px; overflow-x: auto; padding: 1px 0 7px; }
.ed-nest-tabs button { flex: 0 0 auto; padding: 4px 9px; border: 1px solid var(--ed-border); border-radius: 999px; background: #fff; color: var(--ed-text); cursor: pointer; font-size: 11px; }
.ed-nest-tabs button.active { border-color: var(--ed-accent); background: #e8ecf0; color: var(--ed-accent); font-weight: 700; }
.ed-nest-preview-wrap { display: flex; align-items: center; justify-content: center; min-height: 340px; overflow: hidden; border: 1px solid var(--ed-border); border-radius: 6px; background: #fff; }
#nest-preview { display: block; width: 100%; max-height: 490px; }
#nest-sheet-summary, #nest-status { min-height: 20px; padding-top: 6px; }
.ed-nest-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 5px 0 10px; }
.ed-saved-nests { border-top: 1px solid var(--ed-border); padding-top: 8px; }
.ed-saved-nests h3 { margin: 0 0 7px; color: var(--ed-accent); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.ed-nest-saved-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 6px; max-height: 140px; overflow-y: auto; }
.ed-nest-plan-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: center; padding: 7px 8px; border: 1px solid var(--ed-border); border-radius: 5px; background: #fff; }
.ed-nest-plan-card strong, .ed-nest-plan-card span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-nest-plan-card span { margin-top: 2px; color: #617f9e; font-size: 10px; }
.ed-nest-plan-actions { display: flex; gap: 4px; }
.ed-material-dialog { width: min(900px, 95vw); }
.ed-material-layout { display: grid; grid-template-columns: 245px minmax(0, 1fr); gap: 13px; min-height: 390px; }
.ed-material-layout > aside { padding-right: 11px; border-right: 1px solid var(--ed-border); }
.ed-material-list { display: grid; align-content: start; gap: 6px; max-height: 390px; overflow-y: auto; margin-top: 8px; }
.ed-material-card { width: 100%; padding: 8px 9px; border: 1px solid var(--ed-border); border-radius: 5px; background: #fff; text-align: left; color: var(--ed-text); cursor: pointer; }
.ed-material-card:hover, .ed-material-card.selected { border-color: var(--ed-accent); background: #fff; box-shadow: inset 3px 0 var(--ed-accent); }
.ed-material-card strong, .ed-material-card span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-material-card span { margin-top: 2px; color: #617f9e; font-size: 10.5px; }
.ed-material-editor { display: grid; align-content: start; gap: 10px; }
.ed-material-editor > label { display: grid; gap: 4px; }
.ed-material-editor textarea { width: 100%; box-sizing: border-box; resize: vertical; }
.ed-material-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.ed-material-fields label { display: grid; gap: 4px; }
#material-status { min-height: 19px; }

/* ======= Fixture and keep-out safety ======= */
.ed-fixture-dialog { width: min(920px, 95vw); }
.ed-fixture-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 13px; min-height: 330px; }
.ed-fixture-layout > aside { padding-right: 11px; border-right: 1px solid var(--ed-border); }
.ed-fixture-list { display: grid; align-content: start; gap: 6px; max-height: 350px; overflow-y: auto; margin-top: 9px; }
.ed-fixture-card { width: 100%; padding: 9px 10px; border: 1px solid var(--ed-border); border-radius: 5px; background: #fff; text-align: left; color: var(--ed-text); cursor: pointer; }
.ed-fixture-card:hover, .ed-fixture-card.selected { border-color: #bd394f; background: #fff4f5; box-shadow: inset 3px 0 #bd394f; }
.ed-fixture-card.disabled { opacity: .58; }
.ed-fixture-card strong, .ed-fixture-card span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-fixture-card span { margin-top: 3px; color: #617f9e; font-size: 10.5px; }
.ed-fixture-editor { display: grid; align-content: start; gap: 11px; }
.ed-fixture-editor > label { display: grid; gap: 4px; }
.ed-fixture-editor textarea { width: 100%; box-sizing: border-box; resize: vertical; }
.ed-fixture-fields { display: grid; grid-template-columns: 1.3fr .8fr .8fr; gap: 9px; }
.ed-fixture-fields label { display: grid; gap: 4px; }
.ed-fixture-geometry { padding: 10px; border: 1px dashed #c9a3ab; border-radius: 5px; background: #fff7f8; color: #7e4250; }
.ed-fixture-actions { justify-content: flex-end; }
.ed-fixture-actions .ed-btn-danger { margin-right: auto; }
#fixture-status { min-height: 20px; padding-top: 8px; }
#fixture-status.error { color: #a3263b; }
.ed-fixture-assistant { margin-top: 14px; padding: 13px; border: 1px solid #cad2db; border-radius: 7px; background: #fff; }
.ed-fixture-assistant-head { display: flex; align-items: start; justify-content: space-between; gap: 14px; }
.ed-fixture-assistant h3 { margin: 0 0 3px; color: #3c4f63; font-size: 14px; }
.ed-fixture-assistant p { margin: 0; }
.ed-fixture-suggest-fields { display: grid; grid-template-columns: repeat(5,minmax(105px,1fr)); gap: 8px; margin-top: 11px; }
.ed-fixture-suggest-fields label { display: grid; gap: 4px; }
.ed-fixture-suggestions { display: grid; grid-template-columns: repeat(auto-fit,minmax(175px,1fr)); gap: 7px; margin-top: 11px; }
.ed-fixture-suggestion { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: start; padding: 8px; border: 1px solid #cfd7df; border-radius: 5px; background: rgba(255,255,255,.9); }
.ed-fixture-suggestion strong, .ed-fixture-suggestion span { display: block; }
.ed-fixture-suggestion span { margin-top: 2px; color: #57718d; font-size: 10.5px; }
.ed-fixture-suggestion-actions { margin-top: 9px; }




/* ======= 3D model and relief component studio ======= */

.ed-surface-dialog { width: min(1320px,97vw); height: min(920px,96vh); max-height:96vh; overflow:hidden; }
.ed-surface-dialog [hidden] { display:none !important; }
.ed-surface-dialog > .ed-cloud-head { margin-bottom:10px; }
.ed-surface-layout { display:grid; grid-template-columns:minmax(310px,.78fr) minmax(560px,1.55fr); gap:14px; height:calc(100% - 58px); min-height:0; }
.ed-surface-controls { min-width:0; overflow-y:auto; padding-right:11px; border-right:1px solid var(--ed-border); }
.ed-surface-controls section,.ed-surface-registration { margin-bottom:10px; padding:10px; border:1px solid #d4dbe3; border-radius:7px; background:#fff; }
.ed-surface-controls h3,.ed-surface-registration h3 { margin:1px 0 8px; color:var(--ed-accent); font-size:13px; }
.ed-surface-controls label,.ed-surface-registration label { display:grid; gap:4px; margin-bottom:7px; }
.ed-surface-controls label.ed-check,.ed-surface-registration label.ed-check { display:flex; }
.ed-surface-workspace { display:grid; grid-template-rows:minmax(310px,1fr) auto auto auto; gap:9px; min-width:0; min-height:0; overflow-y:auto; }
.ed-surface-preview-wrap { display:flex; flex-direction:column; position:relative; min-height:310px; overflow:hidden; border:1px solid #c3cdd7; border-radius:4px; background:#fff; }
.ed-surface-preview-wrap::after { content:'Drag to orbit · wheel to zoom'; position:absolute; right:10px; bottom:8px; padding:3px 5px; color:#536273; background:rgba(255,255,255,.85); font-size:10px; pointer-events:none; }
.ed-surface-preview-wrap canvas { display:block; flex:1 1 0; width:100%; height:0; min-height:310px; cursor:grab; touch-action:none; }
.ed-surface-preview-wrap canvas:active { cursor:grabbing; }
.ed-surface-view-buttons { display:flex; flex:0 0 auto; align-items:center; flex-wrap:wrap; gap:4px; padding:7px; border-bottom:1px solid #d4dbe3; background:#f5f7f9; }
.ed-surface-view-buttons button { padding:5px 7px; border:1px solid #c3cdd7; border-radius:3px; color:#34495e; background:#fff; font-size:11px; cursor:pointer; }
.ed-surface-view-buttons button:hover { border-color:#647e98; background:#e9eff5; }
.ed-surface-view-buttons button[aria-pressed="true"] { border-color:#526c86; color:#fff; background:#526c86; }
.ed-surface-view-buttons label { display:flex; align-items:center; gap:5px; margin-left:auto; color:#536273; font-size:11px; }
.ed-surface-view-buttons select { max-width:140px; padding:4px; border:1px solid #c3cdd7; border-radius:3px; color:#34495e; background:#fff; font-size:11px; }
.ed-model-orientations { display:grid; grid-template-columns:repeat(3,1fr); gap:4px; margin:0 0 8px; }
.ed-model-orientations button,.ed-model-unit-buttons button { padding:6px 7px; border:1px solid #c3cdd7; border-radius:4px; color:#42576c; background:#fff; cursor:pointer; }
.ed-model-orientations button:hover,.ed-model-orientations button.active,.ed-model-unit-buttons button:hover,.ed-model-unit-buttons button.active { border-color:#5a7592; color:#fff; background:#5a7592; }
.ed-model-auto-flat { margin:9px 0 8px !important; padding:7px 8px; border-radius:5px; color:#394b5e; background:#fff; }
.ed-model-lay-flat-row { display:flex; flex-wrap:wrap; align-items:center; gap:6px; margin:-2px 0 8px; }
.ed-model-lay-flat-row span { flex:1 1 100%; line-height:1.35; }
.ed-model-size-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; }
.ed-model-size-grid label { min-width:0; }
.ed-model-size-grid input { min-width:0; width:100%; box-sizing:border-box; }
.ed-model-import-heading { display:flex; align-items:center; justify-content:space-between; gap:8px; margin:8px 0 5px; }
.ed-model-import-heading label.ed-check { margin:0; font-size:10px; }
.ed-model-unit-buttons { display:flex; gap:3px; }
.ed-model-unit-buttons button { min-width:58px; padding:4px 7px; }
.ed-model-import-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:6px; margin:6px 0 3px; }
.ed-model-position-title { display:block; margin:9px 0 4px; }
.ed-surface-dialog.import-active .ed-surface-controls > section:not(.ed-surface-staged-card),
.ed-surface-dialog.import-active .ed-surface-more,
.ed-surface-dialog.import-active .ed-surface-registration { display:none; }
.ed-surface-staged-actions { display:flex; flex-wrap:wrap; gap:6px; }
.ed-surface-staged-card p { overflow-wrap:anywhere; }
.ed-surface-dialog.import-active .ed-surface-workspace { grid-template-rows:minmax(390px,1fr) auto auto; }
#surface-import-summary { margin:7px 0 3px; }
.ed-surface-component-list { display:grid; gap:5px; max-height:190px; overflow-y:auto; margin-bottom:7px; }
.ed-surface-component-row { display:grid; grid-template-columns:auto minmax(0,1fr); gap:7px; align-items:center; padding:6px; border:1px solid #d4dbe3; border-radius:5px; background:#fff; }
.ed-surface-component-row.selected { border-color:#5a7592; box-shadow:inset 3px 0 #5a7592; }
.ed-surface-component-row button { min-width:0; padding:0; border:0; color:inherit; background:transparent; text-align:left; cursor:pointer; }
.ed-surface-component-row strong,.ed-surface-component-row span { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ed-surface-component-row span { margin-top:2px; color:#597491; font-size:10px; }
.ed-surface-metrics { display:grid; grid-template-columns:repeat(4,minmax(90px,1fr)); gap:7px; }
.ed-surface-metrics > div { padding:7px 9px; border-radius:5px; background:#fff; }
.ed-surface-metrics span,.ed-surface-metrics strong { display:block; }.ed-surface-metrics span { color:#546e8a; font-size:9px; text-transform:uppercase; }.ed-surface-metrics strong { margin-top:2px; color:#394a5c; }
.ed-surface-validation { display:grid; gap:5px; }.ed-surface-validation .ed-callout { margin:0; }
.ed-surface-validation .ed-ok { border-left-color:#26806b; color:#285f55; background:#edf7f3; }
.ed-surface-registration { margin:0; }.ed-surface-registration-grid { display:grid; grid-template-columns:repeat(3,minmax(130px,1fr)); gap:7px; align-items:end; }
.ed-surface-registration .ed-dialog-actions { margin-top:8px; padding-top:8px; }
.ed-file-button { padding:8px; border:1px dashed #6b87a5; border-radius:6px; color:#455b71; background:#fff; cursor:pointer; }
.ed-file-button input[type="file"] { width:100%; margin-top:4px; font-size:10px; }
#surface-source-summary { min-height:28px; margin:6px 0; }
#surface-status { min-height:19px; padding:2px 2px 8px; }

@media (max-width: 920px) {
    .ed-menu-btn { padding: 0 8px; }
    #ed-cloud-label { display: none; }
    .ed-cloud-btn { padding: 7px; }
    .ed-cloud-project { grid-template-columns: 90px minmax(0, 1fr); }
    .ed-cloud-thumb { width: 90px; height: 60px; }
    .ed-cloud-project-actions { grid-column: 1 / -1; justify-content: flex-end; }
    .ed-cloud-savebar { flex-wrap: wrap; }
    .ed-trace-layout, .ed-machine-layout, .ed-nesting-layout, .ed-material-layout, .ed-fixture-layout, .ed-surface-layout { grid-template-columns: 1fr; }
    .ed-trace-preview-wrap { min-height: 230px; }
    .ed-machine-layout > aside, .ed-material-layout > aside, .ed-fixture-layout > aside, .ed-nesting-setup, .ed-surface-controls {
        padding: 0 0 10px;
        border-right: 0;
        border-bottom: 1px solid var(--ed-border);
    }
    .ed-machine-list, .ed-material-list, .ed-fixture-list { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); max-height: 150px; }
    .ed-machine-fields-six, .ed-fixture-suggest-fields { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
    .ed-nesting-setup { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ed-nesting-fields, .ed-nesting-setup > button, .ed-nest-part-summary { grid-column: 1 / -1; }
    .ed-surface-dialog { overflow-y: auto; }
    .ed-surface-layout { height: auto; }
    .ed-surface-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; overflow: visible; }
    .ed-surface-controls .ed-surface-components-card, .ed-surface-controls .ed-surface-staged-card { grid-column: 1 / -1; }
    .ed-surface-workspace { overflow: visible; }
    .ed-surface-preview-wrap, .ed-surface-preview-wrap canvas { min-height: 430px; }
}

@media (max-width: 560px) {
    .ed-dialog, .ed-dialog-wide { box-sizing: border-box; min-width: 0; width: 96vw; padding: 13px; }
    .ed-machine-layout > aside, .ed-machine-fields-six, .ed-nesting-setup, .ed-nesting-fields, .ed-nest-metrics,
    .ed-material-fields, .ed-fixture-fields, .ed-fixture-suggest-fields { grid-template-columns: 1fr; }
    .ed-fixture-assistant-head { display: grid; }
    .ed-field-row, .ed-dialog-actions { flex-wrap: wrap; }
    .ed-surface-controls { grid-template-columns: 1fr; }
    .ed-surface-controls section:first-child { grid-column: auto; }
    .ed-surface-registration-grid, .ed-surface-metrics { grid-template-columns: 1fr 1fr; }
    .ed-surface-preview-wrap, .ed-surface-preview-wrap canvas { min-height: 320px; }
    .ed-model-size-grid { grid-template-columns: 1fr; }
}



/* Datum picker: 5 buttons arranged like the material corners/centre */
.ed-datum {
    position: relative; width: 92px; height: 64px;
    border: 2px solid var(--ed-border); border-radius: 3px; background: #fafafa;
}
.ed-datum button {
    position: absolute; width: 16px; height: 16px;
    border: 1px solid var(--ed-border); border-radius: 50%;
    background: #fff; cursor: pointer; padding: 0;
}
.ed-datum button.active { background: var(--ed-accent); border-color: var(--ed-accent); }
.ed-datum [data-datum="tl"] { top: -8px; left: -8px; }
.ed-datum [data-datum="tr"] { top: -8px; right: -8px; }
.ed-datum [data-datum="bl"] { bottom: -8px; left: -8px; }
.ed-datum [data-datum="br"] { bottom: -8px; right: -8px; }
.ed-datum [data-datum="c"]  { top: 50%; left: 50%; transform: translate(-50%, -50%); }

/* ======= Integrated 3D job view ======= */
.ed-3d-overlay {
    position: absolute; inset: 0; z-index: 2;
    background: #151b22;
    display: flex; flex-direction: column;
}
.ed-3d-bar {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px 13px;
    padding: 7px 10px; background: #324151; color: #fff;
    flex: 0 0 auto;
}
.ed-3d-title { font-weight: 700; font-size: 14px; }
.ed-3d-bar .ed-muted { color: rgba(255,255,255,.75); }
#ed-3d-summary { flex: 1 1 260px; min-width: 160px; }
.ed-3d-bar .ed-check { color: #fff; margin: 0; flex: 0 0 auto; }
.ed-3d-quality { color: #fff; flex-direction: row; align-items: center; gap: 5px; white-space: nowrap; }
.ed-3d-quality select { width: auto; padding: 3px 5px; font-size: 12px; }
.ed-3d-playback {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    padding: 6px 10px;
    border-top: 1px solid rgba(255,255,255,.13);
    border-bottom: 1px solid #283440;
    background: #283542;
    color: #fff;
    flex: 0 0 auto;
    font-size: 12px;
}
.ed-3d-playback #ed-3d-progress { flex: 1 1 180px; min-width: 90px; accent-color: #8fa5bb; }
.ed-3d-playback #ed-3d-progress-label { min-width: 76px; color: rgba(255,255,255,.82); font-variant-numeric: tabular-nums; }
.ed-3d-playback label { display: flex; align-items: center; gap: 5px; white-space: nowrap; color: #fff; }
.ed-3d-playback select { width: auto; padding: 3px 5px; font-size: 12px; }
.ed-3d-playback .ed-check { margin: 0; }
.ed-3d-view-buttons { display: inline-flex; align-items: center; gap: 3px; }
.ed-3d-view-buttons > span { margin: 0 2px 0 4px; color: rgba(255,255,255,.72); }
.ed-3d-view-buttons .ed-btn { min-width: 34px; padding: 3px 6px; }
.ed-3d-view-buttons .ed-btn.active { border-color: #b8c3cf; background: #4f6780; color: #fff; }
.ed-3d-camera-hint { color: rgba(255,255,255,.62); white-space: nowrap; }
.ed-3d-overlay canvas { flex: 1 1 auto; display: block; width: 100%; min-height: 0; }

/* ======= Tool database dialog ======= */
.ed-tooldb { display: flex; gap: 16px; }
.ed-tooldb-left { flex: 0 0 220px; display: flex; flex-direction: column; }
.ed-tooldb-left ul {
    list-style: none; margin: 0 0 8px; padding: 0;
    border: 1px solid var(--ed-border); border-radius: 4px;
    height: 260px; overflow-y: auto; background: #fff;
}
.ed-tooldb-left li { padding: 6px 10px; cursor: pointer; border-bottom: 1px solid #eee; }
.ed-tooldb-left li.selected { background: var(--ed-accent); color: #fff; }
.ed-tooldb-listactions { display: flex; gap: 6px; }
.ed-tooldb-right { flex: 1; }
.ed-tool-assembly-fields { margin: 11px 0; padding: 10px; border: 1px solid #cfd7df; border-radius: 7px; background: #fafafb; }
.ed-tool-assembly-fields legend { padding: 0 6px; color: #4a627a; font-size: 12px; font-weight: 700; }
.ed-tool-assembly-fields .ed-check { display: flex; min-height: 30px; }
@media(max-width:700px){
    .ed-tooldb{display:grid;grid-template-columns:minmax(0,1fr)}
    .ed-tooldb-left{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:7px;min-width:0}
    .ed-tooldb-left ul{grid-column:1 / -1;height:120px}.ed-tooldb-listactions{align-items:start}
    .ed-tool-assembly-fields .ed-field-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-items:end}
    .ed-tool-assembly-fields .ed-field-row>label{min-width:0}.ed-tool-assembly-fields input:not([type="checkbox"]){box-sizing:border-box;width:100%}
}
@media(max-width:390px){.ed-tool-assembly-fields .ed-field-row{grid-template-columns:1fr}}
.ed-field-help{font-size:.74rem;font-weight:400;color:var(--ed-muted,#57728f)}

.ed-template-files { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.ed-template-files > label { flex: 1 1 240px; }
.ed-template-files select { width: 100%; }
#template-status { margin: 10px 0; }

#gcode-mode { width: 100%; }
#gcode-file-list { max-height: 150px; overflow: auto; padding-left: 24px; font-size: 12px; }
#gcode-file-list li { padding: 3px 0; overflow-wrap: anywhere; }

#gcode-scope { width: 100%; }

.ed-calculation { width: 410px; min-width: 0; max-width: calc(100vw - 28px); box-sizing: border-box; }
.ed-calculation #calculation-expression { display: block; width: 100%; box-sizing: border-box; margin-top: 5px; font: 17px Consolas, monospace; }
.ed-calculation #calculation-result { display: block; margin-top: 12px; font-size: 20px; font-weight: 600; overflow-wrap: anywhere; }
.ed-calculation .ed-muted, .ed-calculation .ed-error { overflow-wrap: anywhere; }

.ed-vector-shape { width: 800px; max-width: calc(100vw - 32px); box-sizing: border-box; }
.ed-vector-shape-layout { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 22px; }
.ed-vector-shape-layout input, .ed-vector-shape-layout select { width: 100%; box-sizing: border-box; min-width: 0; }
.ed-vector-shape-layout .ed-field-row > label { min-width: 0; flex: 1; }
#relief-dome-custom-controls { flex-wrap: wrap; }
#relief-dome-custom-controls > label:first-child:has(#relief-dome-custom-placement) { flex: 1 0 100%; }
.ed-vector-shape-layout [hidden] { display: none !important; }
.ed-vector-shape-plots { border-left: 1px solid var(--ed-border); padding-left: 18px; }
.ed-vector-shape-image { height: 230px; display: flex; align-items: center; justify-content: center; background: #f8f8f8; border: 1px solid var(--ed-border); }
#relief-dome-preview { max-width: 100%; max-height: 100%; object-fit: contain; }
#relief-dome-section { width: 100%; display: block; font: 11px Consolas, monospace; fill: #465c6b; }
#relief-dome-summary { white-space: pre-line; font-variant-numeric: tabular-nums; }
.ed-vector-shape > .ed-dialog-actions { position: sticky; bottom: 0; padding-top: 8px; background: white; box-shadow: 0 12px 0 white; }
@media (max-width: 650px) {
    .ed-vector-shape-layout { grid-template-columns: minmax(0,1fr); gap: 12px; }
    .ed-vector-shape-plots { border-left: 0; padding-left: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    .ed-vector-shape-image { height: 150px; }
    .ed-vector-shape-plots > p { grid-column: 1 / -1; }
}
.ed-turned-model { width: 800px; max-width: calc(100vw - 32px); box-sizing: border-box; }
.ed-turn-layout { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 22px; }
.ed-turn-layout input:not([type="checkbox"]), .ed-turn-layout select { width: 100%; box-sizing: border-box; min-width: 0; }
.ed-turn-layout .ed-field-row > label { min-width: 0; flex: 1; }
.ed-turn-plots { border-left: 1px solid var(--ed-border); padding-left: 18px; }
#turn-profile { width: 100%; display: block; font: 11px Consolas, monospace; }
.ed-turn-image { height: 260px; display: flex; align-items: center; justify-content: center; background: #f8f8f8; border: 1px solid var(--ed-border); }
#turn-preview { max-width: 100%; max-height: 100%; object-fit: contain; }
#turn-summary { font-variant-numeric: tabular-nums; }
.ed-turned-model > .ed-dialog-actions { position: sticky; bottom: 0; padding-top: 8px; background: white; box-shadow: 0 12px 0 white; }
@media(max-height:780px) {
    .ed-turn-image { height: 180px; }
    #turn-profile { height: 145px; }
}
@media(max-width:650px) {
    .ed-turn-layout { grid-template-columns: minmax(0,1fr); gap: 12px; }
    .ed-turn-plots { border-left: 0; padding-left: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    .ed-turn-image { height: 180px; }
    .ed-turn-plots > p { grid-column: 1 / -1; }
}
