:root {
  --s2a-line: color-mix(in srgb, var(--line, #d8e1ef) 88%, transparent);
  --s2a-panel: color-mix(in srgb, var(--surface, #fff) 94%, transparent);
  --s2a-soft: color-mix(in srgb, var(--surface-2, #f5f8ff) 88%, transparent);
  --s2a-pink: #f0449a;
}

.staad-approval-page { background: var(--bg, #f5f8ff); color: var(--text, #17223b); }
.s2a-app { width: min(1840px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 70px; display: grid; grid-template-columns: minmax(390px, 500px) minmax(0, 1fr); gap: 22px; align-items: start; }
.s2a-control-panel, .s2a-review { border: 1px solid var(--s2a-line); background: var(--s2a-panel); border-radius: 24px; box-shadow: 0 22px 55px rgba(30, 64, 175, .08); }
.s2a-control-panel { padding: 26px; }
.s2a-review { box-sizing: border-box; min-width: 0; padding: 18px; position: sticky; top: 72px; min-height: calc(100vh - 96px); }
.s2a-custom-drawings { display: flex; align-items: flex-start; gap: 12px; margin-top: 16px; padding: 15px; border: 1px solid var(--s2a-line); border-radius: 12px; background: var(--s2a-soft); }
.s2a-custom-drawings[hidden] { display: none; }
.s2a-custom-drawings > i { display: grid; place-items: center; flex: 0 0 34px; height: 34px; border-radius: 10px; color: var(--primary, #1768e8); background: color-mix(in srgb, var(--primary, #1768e8) 12%, transparent); }
.s2a-custom-drawings > div { min-width: 0; }
.s2a-custom-drawings b { color: var(--text); font-size: .9rem; font-weight: 700; }
.s2a-custom-drawings p { margin: 4px 0 8px; color: var(--muted); font-size: .82rem; line-height: 1.55; }
.s2a-custom-drawings-links { display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px 14px; font-size: .82rem; font-weight: 600; }
.s2a-custom-drawings-links span { color: var(--muted); overflow-wrap: anywhere; }
.s2a-custom-drawings-links a { color: var(--primary, #1768e8); text-underline-offset: 3px; }
.s2a-custom-drawings-links a:hover { text-decoration: underline; }
.s2a-custom-drawings-links a:focus-visible { outline: 2px solid var(--primary, #1768e8); outline-offset: 3px; border-radius: 2px; }
.s2a-form fieldset, .s2a-section, .s2a-detected { margin: 0 0 13px; border: 1px solid var(--s2a-line); border-radius: 16px; background: var(--s2a-soft); }
.s2a-form fieldset { padding: 15px; }
.s2a-form legend { padding: 0 7px; font-size: .78rem; font-weight: 800; letter-spacing: .04em; }
.s2a-section summary { padding: 14px 15px; display: flex; justify-content: space-between; gap: 12px; cursor: pointer; list-style: none; font-weight: 750; }
.s2a-section summary::-webkit-details-marker { display: none; }
.s2a-section summary::after { content: "+"; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, #1768e8 12%, transparent); color: #1768e8; }
.s2a-section[open] summary::after { content: "−"; }
.s2a-section summary span { flex: 1; }
.s2a-section summary small { color: var(--muted, #71809b); font-weight: 500; }
.s2a-section-body { border-top: 1px solid var(--s2a-line); padding: 15px; display: grid; gap: 12px; }
.s2a-form label, .connection-dialog label { display: grid; gap: 6px; color: var(--muted, #60708d); font-size: .78rem; font-weight: 700; }
.s2a-form input:not([type="checkbox"]):not([type="radio"]), .s2a-form select, .connection-dialog input:not([type="radio"]), .s2a-preview-toolbar select { width: 100%; min-height: 42px; border: 1px solid var(--s2a-line); border-radius: 10px; padding: 9px 11px; background: var(--surface, #fff); color: var(--text, #17223b); font: inherit; outline: none; }
.s2a-form input:focus, .s2a-form select:focus, .connection-dialog input:focus { border-color: #4d8eff; box-shadow: 0 0 0 3px rgba(77, 142, 255, .17); }
.s2a-form label small { color: var(--muted, #71809b); font-weight: 450; }
.s2a-pair, .s2a-triple { display: grid; gap: 10px; }
.s2a-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.s2a-form input, .s2a-form select, .s2a-form label, .unit-input { min-width: 0; box-sizing: border-box; }
.settings-workspace > * { min-width: 0; }
.settings-wide, .settings-advanced { grid-column: 1 / -1; }
.drawing-visibility { display: none !important; }
.offset-input { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px; }
.offset-input button { min-width: 44px; min-height: 36px; padding: 6px 8px; }
.settings-card p { color: var(--muted, #60708d); font-size: .76rem; line-height: 1.55; }
.s2a-triple { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.s2a-four { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.unit-input { position: relative; display: block; }
.unit-input input { padding-right: 42px !important; }
.unit-input i { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--muted, #71809b); }
.base-size-card { border: 1px solid var(--s2a-line); border-radius: 12px; padding: 11px; background: var(--surface, #fff); }
.base-size-card > b { display: block; margin-bottom: 9px; font-size: .78rem; }
.secondary-toggle { grid-template-columns: 1fr; margin-bottom: 10px; }
.flat-roof-warning { padding: 10px 12px; border: 1px solid #daa13c; border-radius: 10px; color: var(--text); background: color-mix(in srgb, #ffc247 12%, var(--surface)); font-weight: 650; }
.flat-roof-warning[hidden], [data-secondary-settings][hidden], #defaultSpacingInputs[hidden], .spacing-context[hidden] { display: none !important; }
#plateWidthHelp { color: var(--muted); font-size: .8rem; }

.s2a-upload { min-height: 108px; place-items: center; align-content: center; text-align: center; border: 1.5px dashed #79a9ff; border-radius: 14px; background: color-mix(in srgb, #1768e8 5%, var(--surface, #fff)); cursor: pointer; }
.s2a-upload:hover { border-color: #6f55ff; }
.s2a-upload i { font-size: 1.35rem; color: #1768e8; }
.s2a-upload b { color: var(--text, #17223b); }
.s2a-upload span { color: var(--muted, #71809b); font-weight: 500; }
.s2a-upload.has-file { border-style: solid; background: color-mix(in srgb, #20a66a 8%, var(--surface, #fff)); }

.s2a-detected { padding: 14px; }
.s2a-detected-head, .s2a-review-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 10px; }
.s2a-detected-head div, .s2a-review-head div { display: grid; gap: 3px; }
.s2a-detected-head span, .s2a-review-head span { color: var(--muted, #71809b); font-size: .78rem; }
.s2a-detected-head button, .s2a-review-head button { border: 1px solid var(--s2a-line); border-radius: 9px; padding: 8px 10px; background: var(--surface, #fff); color: var(--text, #17223b); cursor: pointer; }
.s2a-frame-list { max-height: 230px; overflow: auto; display: grid; gap: 7px; }
.s2a-frame-list label { grid-template-columns: auto 32px 1fr auto; align-items: center; border: 1px solid var(--s2a-line); border-radius: 10px; padding: 9px; background: var(--surface, #fff); cursor: pointer; }
.s2a-frame-list label b:first-of-type { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: color-mix(in srgb, #1768e8 11%, transparent); color: #1768e8; }
.s2a-frame-list label span { display: grid; gap: 2px; color: var(--text, #17223b); }
.s2a-frame-list label small { color: var(--muted, #71809b); font-weight: 500; }

.s2a-switch-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.s2a-switch-grid label { min-height: 42px; grid-template-columns: 1fr auto; align-items: center; border: 1px solid var(--s2a-line); border-radius: 10px; padding: 8px 9px; background: var(--surface, #fff); cursor: pointer; }
.s2a-switch-grid input { position: absolute; opacity: 0; pointer-events: none; }
.s2a-switch-grid i { width: 36px; height: 20px; border-radius: 999px; background: #aeb9ca; position: relative; transition: .2s; }
.s2a-switch-grid i::after { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; border-radius: 50%; background: white; box-shadow: 0 1px 4px rgba(0,0,0,.25); transition: .2s; }
.s2a-switch-grid input:checked + i { background: linear-gradient(90deg, #1768e8, #7357ff); }
.s2a-switch-grid input:checked + i::after { transform: translateX(16px); }
.axis-checks { display: flex; align-items: center; gap: 6px; min-height: 42px; }
.axis-checks input { accent-color: #1768e8; }

.s2a-issue-checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.s2a-issue-checks label { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 8px 10px; border: 1px solid var(--s2a-line); border-radius: 10px; background: var(--surface, #fff); color: var(--text, #17223b); }
.s2a-issue-checks input { accent-color: #1768e8; flex: none; }
.s2a-anchor-details { border: 1px solid var(--s2a-line); border-radius: 12px; padding: 10px 12px; background: var(--surface, #fff); }
.s2a-anchor-details summary { cursor: pointer; font-weight: 750; color: var(--text, #17223b); }
.s2a-anchor-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 12px 0; }
.s2a-anchor-actions span { color: var(--muted, #60708d); font-size: .8rem; }
.s2a-anchor-scroll { overflow: auto; max-height: 320px; border: 1px solid var(--s2a-line); border-radius: 10px; }
.s2a-anchor-scroll table { border-collapse: collapse; width: 100%; min-width: 1000px; font-size: .76rem; }
.s2a-anchor-scroll th, .s2a-anchor-scroll td { padding: 6px; border-bottom: 1px solid var(--s2a-line); text-align: left; white-space: nowrap; }
.s2a-anchor-scroll th { position: sticky; top: 0; background: var(--s2a-soft); z-index: 1; }
.s2a-anchor-scroll input[type="number"] { min-width: 70px; width: 80px !important; min-height: 32px !important; padding: 5px !important; }
.s2a-anchor-scroll input[type="checkbox"] { accent-color: #1768e8; }
.s2a-readiness-summary { margin: 12px 0; border: 1px solid #eaa87b; background: color-mix(in srgb, #f59e0b 8%, var(--surface, #fff)); border-radius: 12px; padding: 10px 14px; color: var(--text, #17223b); }
.s2a-readiness-summary b { display: block; margin-bottom: 4px; }
.s2a-readiness-summary ul { margin: 0; padding-left: 20px; font-size: .82rem; line-height: 1.5; }

.s2a-actions { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; margin-top: 16px; }
.s2a-actions button, .dialog-actions button { min-height: 46px; border: 0; border-radius: 12px; padding: 10px 14px; font-weight: 800; cursor: pointer; }
.s2a-actions .primary, .dialog-actions .primary { color: white; background: linear-gradient(100deg, #0868df, #6e57ff); box-shadow: 0 10px 24px rgba(49, 91, 224, .22); }
.s2a-actions .secondary, .dialog-actions .secondary { border: 1px solid var(--s2a-line); background: var(--surface, #fff); color: var(--text, #17223b); }
.s2a-actions button:disabled { opacity: .48; cursor: not-allowed; }
.s2a-status { min-height: 22px; margin: 11px 2px 0; color: var(--muted, #60708d); font-size: .82rem; }
.s2a-status.error { color: #d93025; }
.s2a-status.stale { color: #c65a00; }

.s2a-preview-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.s2a-preview-toolbar > div { display: grid; gap: 3px; }
.s2a-preview-toolbar span { color: var(--muted, #71809b); font-size: .78rem; }
.s2a-preview-toolbar label { display: flex; align-items: center; gap: 8px; color: var(--muted, #71809b); font-size: .75rem; }
.s2a-preview-toolbar select { min-height: 36px; width: auto; }
.final-preview-controls { display: flex !important; grid-auto-flow: column; align-items: center; gap: 9px !important; }
.final-preview-controls > div { display: flex; border: 1px solid var(--s2a-line); border-radius: 9px; overflow: hidden; }
.final-preview-controls button { min-width: 34px; min-height: 34px; border: 0; border-right: 1px solid var(--s2a-line); padding: 0 9px; color: var(--text, #17223b); background: var(--surface, #fff); font: inherit; font-size: .72rem; font-weight: 800; cursor: pointer; }
.final-preview-controls button:last-child { border-right: 0; }
.s2a-final-review-grid { min-width: 0; display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(290px, .65fr); gap: 14px; align-items: stretch; }
.s2a-final-review-grid:has(.s2a-output[hidden]) { grid-template-columns: 1fr; }
.s2a-final-preview-panel { box-sizing: border-box; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; gap: 10px; padding: 14px; border: 1px solid var(--s2a-line); border-radius: 15px; background: var(--s2a-soft); }
.s2a-final-preview-panel .s2a-preview-toolbar { min-width: 0; margin: 0; flex-wrap: wrap; }
.s2a-final-preview-panel .s2a-preview-toolbar > div:first-child { min-width: 0; flex: 1 1 220px; overflow-wrap: anywhere; }
.s2a-final-preview-panel .final-preview-controls { flex-wrap: wrap; }
.s2a-slider { min-width: 0; min-height: 460px; height: clamp(460px, 58vh, 680px); }
.s2a-preview { box-sizing: border-box; min-width: 0; min-height: 0; width: 100%; height: 100%; border-radius: 13px; overflow: hidden; touch-action: none; cursor: grab; user-select: none; }
.s2a-preview.panning { cursor: grabbing; }
.s2a-preview .cad-preview-svg { width: 100%; height: 100%; }
.cad-connection-hotspot { cursor: pointer; pointer-events: all; }
.cad-connection-hotspot .cad-node-dot { fill: #f23f9d !important; stroke: #fff !important; filter: drop-shadow(0 0 4px rgba(242, 63, 157, .9)); }
.cad-connection-hotspot.cad-base-hotspot .cad-node-dot { fill: #06a8bd !important; filter: drop-shadow(0 0 4px rgba(6, 168, 189, .9)); }
.cad-connection-hotspot:hover .cad-node-dot, .cad-connection-hotspot:focus .cad-node-dot { fill: #8b5cf6 !important; stroke: #bfdbfe !important; filter: drop-shadow(0 0 6px #60a5fa); }
.cad-connection-hotspot:focus { outline: none; }

.s2a-connections, .s2a-output { margin-top: 14px; border: 1px solid var(--s2a-line); border-radius: 15px; padding: 13px; background: var(--s2a-soft); }
.s2a-final-review-grid .s2a-output { min-height: 0; margin-top: 0; display: flex; flex-direction: column; }
.s2a-final-review-grid .s2a-output[hidden] { display: none; }
.s2a-connection-list, .s2a-output-list { display: grid; gap: 7px; max-height: 270px; overflow: auto; }
.s2a-final-review-grid .s2a-output-list { flex: 1; min-height: 0; max-height: none; align-content: start; padding-right: 3px; }
.s2a-connection-row { display: grid; grid-template-columns: 50px 1fr auto; align-items: center; gap: 9px; border: 1px solid var(--s2a-line); border-radius: 10px; padding: 9px; background: var(--surface, #fff); cursor: pointer; }
.s2a-connection-row > b { color: var(--s2a-pink); }
.s2a-connection-row span { display: grid; gap: 2px; }
.s2a-connection-row small { color: var(--muted, #71809b); }
.s2a-connection-row em { padding: 4px 7px; border-radius: 999px; color: #1768e8; background: color-mix(in srgb, #1768e8 10%, transparent); font-style: normal; font-size: .72rem; font-weight: 800; }
.s2a-output-list label { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; border: 1px solid var(--s2a-line); border-radius: 10px; padding: 10px; background: var(--surface, #fff); cursor: pointer; }
.s2a-output-list input { accent-color: #1768e8; }
.s2a-output-list span { display: grid; gap: 2px; color: var(--text, #17223b); }
.s2a-output-list small { color: var(--muted, #71809b); }
.s2a-package-final-action { margin-top: 16px; padding: 16px 2px 0; display: flex; align-items: center; gap: 22px; border-top: 1px solid var(--s2a-line); }
.s2a-package-final-action[hidden] { display: none; }
.s2a-package-final-action > span { display: grid; gap: 3px; }
.s2a-package-final-action > span small, .s2a-price small { color: var(--muted, #71809b); }
.s2a-price { margin-left: auto; display: grid; justify-items: end; gap: 2px; }
.s2a-price strong { color: #1768e8; font-size: 1.35rem; }
.s2a-package-buttons { display: grid; grid-template-columns: minmax(180px, auto); gap: 7px; }
.s2a-pay { min-height: 46px; border: 0; border-radius: 11px; padding: 10px 20px; color: white; background: linear-gradient(100deg, #0868df, #6e57ff); font: inherit; font-weight: 800; cursor: pointer; box-shadow: 0 9px 22px rgba(23, 104, 232, .2); }
.s2a-pay:disabled { opacity: .45; cursor: not-allowed; }
.s2a-admin-export { min-height: 38px; border: 1px solid var(--s2a-line); border-radius: 9px; color: var(--text, #17223b); background: var(--surface, #fff); font: inherit; font-size: .72rem; font-weight: 800; cursor: pointer; }
.s2a-admin-export:disabled { opacity: .45; cursor: not-allowed; }

/* The main page stays deliberately compact; detailed controls belong to the guided workspace. */
.s2a-workflow-overview { margin: 16px 0; padding: 0; display: grid; gap: 8px; list-style: none; }
.s2a-workflow-overview li { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--s2a-line); border-radius: 12px; color: var(--muted, #71809b); background: var(--s2a-soft); }
.s2a-workflow-overview li > b { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; background: color-mix(in srgb, var(--muted, #71809b) 12%, transparent); }
.s2a-workflow-overview li span { display: grid; gap: 2px; font-weight: 800; }
.s2a-workflow-overview li small { font-weight: 500; }
.s2a-workflow-overview li.active { border-color: color-mix(in srgb, #1768e8 48%, var(--s2a-line)); color: var(--text, #17223b); background: color-mix(in srgb, #1768e8 8%, var(--surface, #fff)); }
.s2a-workflow-overview li.active > b { color: #fff; background: linear-gradient(135deg, #1768e8, #7357ff); }
.s2a-workflow-overview li.complete > b { color: #fff; background: #169b62; }
.s2a-start-actions { display: grid; gap: 9px; }
.s2a-view-source { width: 100%; min-height: 36px; margin-top: 8px; border: 1px solid var(--s2a-line); border-radius: 9px; color: #1768e8; background: var(--surface, #fff); font: inherit; font-size: .73rem; font-weight: 800; cursor: pointer; }
.s2a-view-source:hover { border-color: #1768e8; background: color-mix(in srgb, #1768e8 7%, var(--surface, #fff)); }
.s2a-view-source[hidden] { display: none; }
.s2a-start-actions button, .workflow-shell button.primary, .workflow-shell button.secondary { min-height: 44px; border-radius: 11px; padding: 9px 14px; font: inherit; font-weight: 800; cursor: pointer; }
.s2a-start-actions .primary, .workflow-shell button.primary { border: 0; color: #fff; background: linear-gradient(100deg, #0868df, #6e57ff); box-shadow: 0 10px 24px rgba(49, 91, 224, .2); }
.s2a-start-actions .secondary, .workflow-shell button.secondary { border: 1px solid var(--s2a-line); color: var(--text, #17223b); background: var(--surface, #fff); }
.s2a-start-actions button:disabled, .workflow-shell button:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.s2a-generate-detailed { margin-top: 4px; }
.admin-data-button { border-color: color-mix(in srgb, #8056f4 38%, var(--s2a-line)) !important; color: #6545dc !important; background: color-mix(in srgb, #8056f4 7%, var(--surface, #fff)) !important; }
.frame-data-inputs { gap: 11px; }
.frame-surface-inputs { border: 1px solid var(--s2a-line); border-radius: 11px; background: var(--surface, #fff); }
.frame-surface-inputs summary { padding: 10px 11px; color: var(--text, #17223b); font-size: .78rem; font-weight: 800; cursor: pointer; }
.frame-surface-inputs > div { padding: 0 10px 10px; }

/* Full-screen staged workspace for frame selection, connections and drawing settings. */
.s2a-workflow-dialog { inset: 0; width: calc(100vw - 32px); height: calc(100vh - 32px); max-width: 1780px; max-height: 1080px; margin: auto; padding: 0; border: 1px solid var(--s2a-line); border-radius: 24px; color: var(--text, #17223b); background: var(--surface, #fff); box-shadow: 0 35px 110px rgba(5, 13, 35, .38); overflow: hidden; box-sizing: border-box; }
.s2a-workflow-dialog::backdrop { background: rgba(5, 12, 28, .76); backdrop-filter: blur(8px); }
.s2a-workflow-dialog { height: calc(100dvh - 32px); }
.staad-approval-page:has(.s2a-workflow-dialog[open]) { overflow: hidden; }
.s2a-workflow-dialog *, .s2a-workflow-dialog *::before, .s2a-workflow-dialog *::after { box-sizing: border-box; }
.workflow-shell { width: 100%; max-width: 100%; height: 100%; min-width: 0; min-height: 0; display: grid; grid-template-rows: auto auto minmax(0, 1fr); background: var(--bg, #f5f8ff); overflow: hidden; }
.workflow-header { min-height: 74px; display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 14px 20px; border-bottom: 1px solid var(--s2a-line); background: var(--surface, #fff); }
.workflow-header > div { display: grid; gap: 3px; }
.workflow-header span { color: #1768e8; font-size: .66rem; font-weight: 900; letter-spacing: .12em; }
.workflow-header b { font-size: clamp(1.05rem, 2vw, 1.45rem); }
.workflow-header > button { width: 40px; height: 40px; border: 1px solid var(--s2a-line); border-radius: 50%; color: var(--text, #17223b); background: var(--surface, #fff); cursor: pointer; }
.workflow-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 10px 18px; border-bottom: 1px solid var(--s2a-line); background: var(--surface, #fff); }
.workflow-steps button { min-height: 46px; display: flex; justify-content: center; align-items: center; gap: 8px; border: 0; border-bottom: 2px solid transparent; color: var(--muted, #71809b); background: transparent; font: inherit; font-weight: 800; cursor: pointer; }
.workflow-steps button b { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--muted, #71809b) 12%, transparent); font-size: .72rem; }
.workflow-steps button.active { color: #1768e8; border-bottom-color: #6b5cff; }
.workflow-steps button.active b { color: #fff; background: linear-gradient(135deg, #1768e8, #7357ff); }
.workflow-steps button.complete b { color: #fff; background: #169b62; }
.workflow-steps button:disabled { opacity: .72; cursor: default; }
.workflow-page { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; padding: 14px; gap: 12px; }
.workflow-page[data-workflow-page="frames"] { grid-template-rows: auto auto minmax(0, 1fr) auto; }
/* Connections has no separate page heading: reserve the final row for navigation. */
.workflow-page[data-workflow-page="connections"] { grid-template-rows: minmax(0, 1fr) auto; }
.workflow-page[hidden] { display: none !important; }
.workflow-page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.workflow-page-head h2 { margin: 0 0 4px; font-size: clamp(1.15rem, 2vw, 1.55rem); }
.workflow-page-head p { margin: 0; color: var(--muted, #71809b); }
.frame-review-tools { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 9px; }
.axis-filter { display: flex; align-items: center; gap: 4px; padding: 4px; border: 1px solid var(--s2a-line); border-radius: 12px; background: var(--surface, #fff); }
.axis-filter button { min-height: 34px; display: flex; align-items: center; gap: 6px; border: 0; border-radius: 8px; padding: 6px 10px; color: var(--muted, #71809b); background: transparent; font: inherit; font-weight: 800; cursor: pointer; }
.axis-filter button b { min-width: 20px; padding: 2px 5px; border-radius: 999px; background: color-mix(in srgb, var(--muted, #71809b) 12%, transparent); font-size: .68rem; }
.axis-filter button.active { color: #fff; background: linear-gradient(100deg, #1768e8, #7357ff); }
.axis-filter button.active b { background: rgba(255,255,255,.2); }
.workflow-footer { min-width: 0; min-height: 58px; position: relative; z-index: 8; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding-top: 10px; padding-bottom: env(safe-area-inset-bottom, 0px); border-top: 1px solid var(--s2a-line); background: var(--bg, #f5f8ff); }
.workflow-footer > button { min-width: 0; }
.workflow-footer > span { color: var(--muted, #71809b); text-align: center; font-size: .78rem; }
.workflow-footer > span.error { color: #d93025; font-weight: 800; }

/* The first workflow page keeps reusable defaults visible without crowding the final drawing controls. */
.default-connections-workspace { min-height: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: 14px; overflow: auto; padding: 2px 4px 10px 2px; }
.default-connections-note { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; margin: 0; padding: 12px 14px; border: 1px solid color-mix(in srgb, #1768e8 30%, var(--s2a-line)); border-radius: 12px; color: var(--text, #17223b); background: color-mix(in srgb, #1768e8 7%, var(--surface, #fff)); }
.default-connections-note i { color: #1768e8; font-size: 1.05rem; }
.animated-wipe-copy { display: inline-block; color: var(--text, #17223b); font-size: .95rem; font-weight: 800; line-height: 1.5; }
.default-connections-note.is-attending { animation: s2a-note-attention 2.4s ease-out 3; }
.default-connections-note > i { flex: 0 0 32px; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: linear-gradient(135deg, #1768e8, #7357ff); }
.default-connections-note.is-attending > i { animation: s2a-note-pop 2.4s ease-out 3; }
.workflow-footer > button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
#cancelDefaults::before { content: none; }
.spacing-context { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr); align-items: center; gap: 8px 14px; }
.spacing-context > small { grid-column: 1 / -1; color: var(--muted, #71809b); }
.spacing-context > p { margin: 0; }
.construction-auto { justify-self: start; min-height: 30px !important; padding: 4px 8px !important; font-size: .7rem !important; }
.setup-section-heading { display: grid; gap: 3px; }
.setup-section-heading span { color: #1768e8; font-size: .66rem; font-weight: 900; letter-spacing: .11em; }
.setup-section-heading h3, .setup-section-heading p { margin: 0; }
.setup-section-heading h3 { font-size: 1rem; }
.setup-section-heading p { color: var(--muted, #71809b); font-size: .78rem; }
.default-splice-card .connection-types { margin-top: 0; }
.default-splice-card .default-connection-types { grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); }
.default-plate-fields { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.default-knee-card .connection-types { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 0; }

/* Lightweight drawing cards contain only the fast server review geometry. */
.frame-review-grid { min-height: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(480px, 1fr)); grid-auto-rows: max-content; align-content: start; gap: 14px; overflow-x: hidden; overflow-y: auto; padding: 2px 8px 14px 2px; overscroll-behavior: contain; scrollbar-gutter: stable; }
.frame-grid-editor { border: 1px solid var(--s2a-line); border-radius: 12px; background: var(--surface, #fff); margin-bottom: 12px; }
.frame-grid-editor > summary { cursor: pointer; display: flex; align-items: center; gap: 9px; padding: 11px 14px; color: var(--text, #17223b); font-weight: 700; }
.frame-grid-editor > summary span { color: var(--muted, #71809b); font-size: .76rem; font-weight: 500; }
.frame-grid-editor-body { padding: 0 14px 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.frame-grid-editor-body p { width: 100%; margin: 0; color: var(--muted, #71809b); font-size: .75rem; }
.frame-grid-label-rows { width: 100%; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; max-height: 170px; overflow-y: auto; }
.frame-grid-label-rows label { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; border: 1px solid var(--s2a-line); border-radius: 9px; color: var(--muted, #71809b); font-size: .72rem; }
.frame-grid-label-rows label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frame-grid-label-rows input { width: 72px; min-width: 0; padding: 5px 7px; border: 1px solid var(--s2a-line); border-radius: 7px; background: var(--surface, #fff); color: var(--text, #17223b); text-align: center; }
#frameGridError { color: #c94848; }
.frame-filter-empty { grid-column: 1 / -1; min-height: 260px; display: grid; place-items: center; align-content: center; gap: 7px; border: 1px dashed var(--s2a-line); border-radius: 16px; color: var(--muted, #71809b); text-align: center; background: var(--surface, #fff); }
.frame-filter-empty i { color: #7357ff; font-size: 1.45rem; }
.frame-filter-empty b { color: var(--text, #17223b); }
.frame-review-card { min-width: 0; display: grid; grid-template-rows: auto 250px auto; border: 1px solid var(--s2a-line); border-radius: 16px; overflow: hidden; background: var(--surface, #fff); transition: border-color .18s, box-shadow .18s, transform .18s; }
.frame-review-card:hover, .frame-review-card:focus-visible { border-color: #538cff; box-shadow: 0 10px 25px rgba(23, 104, 232, .13); transform: translateY(-2px); }
.frame-review-card { cursor: pointer; }
.frame-review-card:focus-visible { outline: 3px solid #81aafa; outline-offset: 2px; }
.frame-card-heading { min-height: 58px; display: grid; align-items: center; padding: 10px 12px; }
.frame-card-heading span { min-width: 0; display: grid; gap: 2px; color: var(--text, #17223b); }
.frame-card-heading b, .frame-card-heading small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.frame-card-heading small { color: var(--muted, #71809b); font-weight: 500; }
.frame-card-preview { width: 100%; height: 250px; min-height: 250px; display: block; overflow: hidden; background: #07110f; --cad-background: #07110f; --cad-foreground: #f3f7f7; --cad-member: #5fe0ce; --cad-text: #f7fbff; --cad-title: #4fd7f4; --cad-dimension: #c5ced8; }
.frame-card-preview .cad-preview-svg { width: 100% !important; height: 250px !important; min-height: 250px; display: block; }
.frame-card-preview .cad-connection-hotspot { pointer-events: none; }
.frame-review-card > footer { display: flex; justify-content: space-between; gap: 10px; padding: 9px 12px; color: var(--muted, #71809b); font-size: .72rem; }
.frame-review-card > footer strong { color: var(--s2a-pink); }

/* Connection assignment separates the CAD canvas from the review list. */
.connection-workspace { min-width: 0; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) clamp(280px, 23vw, 340px); gap: 12px; overflow: hidden; }
.connection-canvas-panel, .connection-assignment-panel { min-width: 0; min-height: 0; border: 1px solid var(--s2a-line); border-radius: 16px; background: var(--surface, #fff); }
.connection-canvas-panel { padding: 13px; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; }
.connection-assignment-panel { padding: 13px; display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; }
.connection-slider { position: relative; min-height: 0; height: 100%; }
.connection-model-key { position: absolute; z-index: 3; left: 10px; bottom: 10px; display: grid; gap: 2px; max-width: calc(100% - 20px); border: 1px solid rgba(151, 177, 190, .25); border-radius: 8px; padding: 6px 8px; color: #e8f3f6; background: rgba(8, 22, 25, .84); font-family: "Arial Narrow", Arial, sans-serif; pointer-events: none; }
.connection-model-key strong { font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; }
.connection-model-key span, .connection-model-key small { color: #c4d6db; font-size: .62rem; }
.connection-model-key small { display: flex; align-items: center; gap: 4px; }
.connection-model-key i { width: 7px; height: 7px; display: inline-block; margin-left: 4px; border-radius: 50%; background: #ec5aa0; }
.connection-model-key i.assigned { background: #169b62; }
.connection-model-key i.welded { border: 1px solid #9aa4b2; background: transparent; }
.connection-preview { position: relative; width: 100%; height: 100%; min-height: 0; overflow: hidden; border-radius: 13px; touch-action: none; overscroll-behavior: contain; cursor: grab; user-select: none; }
.connection-preview.panning { cursor: grabbing; }
.connection-preview.cross-selecting { cursor: crosshair; }
.connection-preview .cad-preview-svg { width: 100%; height: 100%; shape-rendering: geometricPrecision; text-rendering: geometricPrecision; }
.connection-preview .cad-review-member-length { display: none; pointer-events: none; opacity: 1; fill: var(--cad-text, #f7fbff); font-family: "Arial Narrow", Arial, sans-serif; font-weight: 700; paint-order: stroke fill; stroke: var(--cad-background, #07110f); stroke-width: 3px; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.connection-preview.show-member-lengths .cad-review-member-length { display: inline; }
.connection-preview-toolbar { display: flex; align-items: center; min-height: 50px; gap: 12px; margin-bottom: 8px; }
.connection-preview-toolbar > div:first-child { min-width: 0; }
.connection-preview-toolbar > .connection-view-controls { margin-left: auto; }
.connection-action-toolbar { min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin: 0 0 8px; padding: 7px; border: 1px solid var(--s2a-line); border-radius: 11px; background: var(--s2a-soft); }
.connection-action-toolbar button { min-height: 34px; flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px; border: 1px solid transparent; border-radius: 8px; padding: 7px 9px; color: var(--text, #17223b); background: transparent; font: inherit; font-size: .69rem; font-weight: 800; cursor: pointer; }
.connection-action-toolbar button:hover:not(:disabled) { border-color: color-mix(in srgb, #1768e8 28%, var(--s2a-line)); color: #1768e8; background: color-mix(in srgb, #1768e8 8%, var(--surface, #fff)); }
.connection-action-toolbar button:disabled { opacity: .36; cursor: not-allowed; }
.connection-action-toolbar button.active { color: #fff; background: linear-gradient(100deg, #1768e8, #7357ff); }
.connection-toolbar-divider { width: 1px; height: 24px; flex: 0 0 1px; margin: 0 2px; background: var(--s2a-line); }
.connection-toolbar-spacer { flex: 1 0 8px; }
/* Override .s2a-preview-toolbar > div, which otherwise stacks these controls. */
.connection-preview-toolbar > .connection-view-controls { min-width: 0; display: flex; justify-content: flex-start; align-items: center; flex-wrap: wrap; gap: 8px; }
.connection-slider > .connection-view-controls { position: absolute; z-index: 5; top: 8px; left: 8px; max-width: calc(100% - 16px); display: flex; align-items: center; flex-wrap: wrap; gap: 5px; padding: 4px; border: 1px solid var(--s2a-line); border-radius: 5px; background: var(--surface, #fff); box-shadow: 0 6px 18px rgba(0, 0, 0, .13); }
.connection-slider > .connection-view-controls > span { display: none; }
.connection-slider > .connection-view-controls > label { display: inline-flex; align-items: center; flex-direction: row; gap: 5px; min-height: 27px; }
.connection-slider > .connection-view-controls .connection-length-toggle,
.connection-slider > .connection-view-controls > div button,
.connection-slider > .connection-view-controls > label select { min-height: 27px; border-radius: 3px; }
.connection-view-controls > span { order: 1; margin-left: auto; color: var(--muted, #71809b); font-size: .7rem; }
.connection-view-controls > label { flex: 0 0 auto; white-space: nowrap; }
.connection-view-controls > label select { width: auto; min-height: 36px; padding: 6px 9px; }
.connection-view-controls .connection-length-toggle { min-height: 36px; }
.connection-length-toggle { min-height: 34px; display: inline-flex; align-items: center; gap: 7px; padding: 0 9px; border: 1px solid var(--s2a-line); border-radius: 9px; color: var(--muted, #71809b); background: var(--surface, #fff); font-size: .7rem; font-weight: 750; cursor: pointer; }
.connection-length-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.connection-length-toggle i { width: 30px; height: 17px; border-radius: 999px; background: #aeb9ca; position: relative; transition: background .18s ease; }
.connection-length-toggle i::after { content: ""; position: absolute; width: 13px; height: 13px; left: 2px; top: 2px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.22); transition: transform .18s ease; }
.connection-length-toggle input:focus-visible + i { outline: 3px solid color-mix(in srgb, #1768e8 22%, transparent); outline-offset: 2px; }
.connection-length-toggle input:checked + i { background: linear-gradient(90deg, #1768e8, #7357ff); }
.connection-length-toggle input:checked + i::after { transform: translateX(13px); }
.connection-view-controls > div { display: flex; border: 1px solid var(--s2a-line); border-radius: 9px; overflow: hidden; }
.connection-view-controls > div button { min-width: 34px; min-height: 34px; border: 0; border-right: 1px solid var(--s2a-line); color: var(--text, #17223b); background: var(--surface, #fff); font: inherit; font-weight: 800; cursor: pointer; }
.connection-view-controls > div button:last-child { border-right: 0; }
.connection-assignment-panel .s2a-connection-list { flex: 0 0 auto; min-height: 120px; max-height: none; overflow: visible; align-content: start; }
.connection-assignment-panel #connectionProgress { white-space: nowrap; }
.connection-assignment-panel .s2a-connection-row { grid-template-columns: minmax(0, 1fr) auto; gap: 5px 8px; text-align: left; }
.connection-assignment-panel .s2a-connection-row > b { grid-column: 1; grid-row: 1; }
.connection-assignment-panel .s2a-connection-row > span { grid-column: 1 / -1; grid-row: 2; }
.connection-assignment-panel .s2a-connection-row > em { grid-column: 2; grid-row: 1; justify-self: end; }
.frame-base-control { display: grid; gap: 8px; margin-bottom: 10px; padding: 11px; border: 1px solid var(--s2a-line); border-radius: 11px; background: var(--s2a-soft); }
.frame-base-control > div { display: grid; gap: 2px; }
.frame-base-control span { color: var(--muted, #71809b); font-size: .72rem; }
.frame-base-control select { width: 100%; min-height: 40px; border: 1px solid var(--s2a-line); border-radius: 9px; padding: 8px 10px; color: var(--text, #17223b); background: var(--surface, #fff); font: inherit; }
.smart-assign { width: 100%; min-height: 44px; margin-bottom: 10px; padding: 7px; border: 1px solid color-mix(in srgb, #7357ff 38%, var(--s2a-line)); border-radius: 11px; color: #5a3fe0; background: color-mix(in srgb, #7357ff 8%, var(--surface, #fff)); font: inherit; font-size: .78rem; font-weight: 800; cursor: pointer; }
.default-assignment-help { display: block; margin: -3px 2px 10px; color: var(--muted, #71809b); font-size: .7rem; line-height: 1.45; }
.s2a-connection-row.assigned { border-color: color-mix(in srgb, #169b62 38%, var(--s2a-line)); }
.s2a-connection-row.assigned > b { color: #169b62; }
.cad-connection-hotspot .cad-node-dot { transition: r .12s ease, stroke-width .12s ease, fill .12s ease, filter .12s ease; }
.cad-connection-hotspot.assigned .cad-node-dot { fill: #169b62 !important; stroke: #dfffea !important; }
.cad-connection-hotspot.welded .cad-node-dot { fill: transparent !important; fill-opacity: 0 !important; stroke: #9aa4b2 !important; filter: none !important; }
.cad-connection-hotspot.selected .cad-node-dot { fill: #6941f5 !important; stroke: #dbeafe !important; filter: drop-shadow(0 0 4px #fff) drop-shadow(0 0 10px #4f8cff); }
.cad-connection-hotspot.selected.welded .cad-node-dot { fill: transparent !important; fill-opacity: 0 !important; stroke: #8056f4 !important; stroke-width: 4px !important; filter: drop-shadow(0 0 3px #fff) drop-shadow(0 0 9px #8056f4) !important; }
.cad-connection-hotspot.selected.welded .cad-node-hit { fill: rgba(128, 86, 244, .14) !important; stroke: #9f85ff !important; stroke-width: 2.5px !important; filter: drop-shadow(0 0 7px rgba(128, 86, 244, .95)); }
.cad-connection-hotspot.selected .cad-node-label { fill: #fff !important; font-weight: 900; }
.cad-base-hotspot .cad-node-dot { rx: 0 !important; }
.cad-node-locator { fill: none; stroke: #8056f4; pointer-events: none; transform-box: fill-box; transform-origin: center; animation: s2a-node-locator 1.15s cubic-bezier(.16,.74,.23,1) forwards; }
.node-cross-selection { position: absolute; z-index: 12; border: 2px solid #7357ff; border-radius: 3px; background: color-mix(in srgb, #7357ff 16%, transparent); box-shadow: 0 0 0 1px rgba(255,255,255,.45) inset; pointer-events: none; }
.connection-tooltip { position: fixed; z-index: 10070; width: min(290px, calc(100vw - 24px)); display: grid; gap: 4px; padding: 10px 12px; border: 1px solid rgba(125, 151, 255, .58); border-radius: 11px; color: #f8fbff; background: rgba(12, 22, 40, .94); box-shadow: 0 14px 38px rgba(0, 0, 0, .34); pointer-events: none; backdrop-filter: blur(9px); }
.connection-tooltip[hidden] { display: none; }
.connection-tooltip b { font-size: .78rem; }
.connection-tooltip span { color: #cbd7ec; font-size: .7rem; line-height: 1.4; }
.connection-selection-status { display: grid; gap: 2px; margin: 0 0 10px; padding: 9px 10px; border: 1px solid var(--s2a-line); border-radius: 11px; color: var(--muted, #71809b); background: var(--s2a-soft); }
.connection-selection-status > span { font-size: .74rem; font-weight: 800; }
.connection-selection-status > small { font-size: .68rem; }
.quick-connection-panel { min-width: 0; flex: 0 0 auto; display: grid; gap: 8px; margin-bottom: 10px; padding: 10px; border: 1px solid color-mix(in srgb, #1768e8 30%, var(--s2a-line)); border-radius: 11px; background: color-mix(in srgb, #1768e8 5%, var(--surface, #fff)); }
.quick-connection-panel > b { font-size: .8rem; color: var(--text, #17223b); }
.quick-connection-panel p { margin: 0; color: var(--muted, #71809b); font-size: .69rem; line-height: 1.45; }
.quick-connection-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.quick-connection-heading > div { min-width: 0; display: grid; gap: 2px; }
.quick-connection-heading b { color: var(--text, #17223b); font-size: .79rem; }
.quick-connection-heading small { overflow: hidden; color: var(--muted, #71809b); font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
.quick-connection-heading > button { flex: none; min-height: 28px; border: 1px solid var(--s2a-line); border-radius: 7px; padding: 4px 7px; color: var(--text, #17223b); background: var(--surface, #fff); font: inherit; font-size: .66rem; font-weight: 800; cursor: pointer; }
.quick-connection-types { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.quick-connection-types button { min-width: 0; min-height: 47px; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 0 4px; border: 1px solid var(--s2a-line); border-radius: 8px; padding: 5px 7px; color: var(--text, #17223b); text-align: left; background: var(--surface, #fff); font: inherit; cursor: pointer; }
.quick-connection-types button:hover, .quick-connection-heading > button:hover { border-color: #1768e8; color: #1768e8; }
.quick-connection-types button:disabled { opacity: .5; cursor: not-allowed; }
.quick-connection-types button:focus-visible, .quick-connection-heading > button:focus-visible { outline: 3px solid color-mix(in srgb, #1768e8 35%, transparent); outline-offset: 1px; }
.quick-connection-types button.suggested { border-color: #1768e8; background: color-mix(in srgb, #1768e8 9%, var(--surface, #fff)); }
.quick-connection-types button.current { box-shadow: inset 0 0 0 2px #169b62; }
.quick-connection-types strong { grid-column: 1; font-size: .75rem; }
.quick-connection-types span { grid-column: 1 / -1; min-width: 0; overflow: hidden; color: var(--muted, #71809b); font-size: .62rem; text-overflow: ellipsis; white-space: nowrap; }
.quick-connection-types em { grid-column: 2; grid-row: 1; justify-self: end; color: #1768e8; font-size: .56rem; font-style: normal; font-weight: 850; }
.s2a-connection-row.selected { border-color: #7357ff; box-shadow: 0 0 0 3px color-mix(in srgb, #7357ff 15%, transparent); }
.s2a-connection-row.welded > b { color: #8b95a5; }
.s2a-connection-row.base-node > b { color: #0ea5a5; }

/* Common settings keep major engineering inputs on the left and presentation controls on the right. */
.settings-workspace { min-width: 0; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(360px, .82fr); gap: 14px; overflow-y: auto; overflow-x: hidden; padding-right: 4px; }
.settings-major, .settings-secondary { min-width: 0; display: grid; align-content: start; gap: 12px; }
.settings-card { min-width: 0; border: 1px solid var(--s2a-line); border-radius: 15px; padding: 14px; background: var(--surface, #fff); }
.settings-card h3 { margin: 0 0 12px; font-size: .92rem; }
.settings-card > label, .settings-card > .s2a-pair, .settings-card > .base-size-card { margin-top: 10px; }
/* Compact engineering values: five digits plus native spinner/padding space.
   Keep units outside the box and wrap whole fields instead of stretching them. */
.steel-level-fields { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.steel-level-fields > * { flex: 0 0 auto; min-width: 0; max-width: 100%; }
.steel-level-height { display: flex; align-items: flex-end; gap: 6px; }
.steel-level-fields .unit-input { display: flex; align-items: center; gap: 5px; }
.steel-level-fields .unit-input input[type="number"] { flex: none; width: calc(5ch + 36px); min-height: 36px; padding: 7px 8px; padding-right: 8px !important; font-variant-numeric: tabular-nums; }
.steel-level-fields .unit-input i { position: static; transform: none; }
.steel-level-height .construction-auto { min-height: 36px !important; white-space: nowrap; }
.flange-brace-inputs > p { margin: 0 0 10px; color: var(--muted, #71809b); font-size: .76rem; line-height: 1.45; }
.settings-collapse { padding: 0; }
.settings-collapse > summary { padding: 14px; cursor: pointer; font-weight: 850; }
.settings-collapse-body { display: grid; gap: 10px; padding: 0 14px 14px; }
.settings-advanced .settings-collapse-body { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.settings-advanced .settings-collapse-body > p { grid-column: 1 / -1; }

/* Output settings and confirmation share the fourth step without repeating empty modal space. */
.output-confirm-workspace { min-width: 0; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 12px; overflow: auto; padding: 2px 4px 10px 2px; }
.confirm-settings-host { min-width: 0; display: grid; gap: 10px; }
.confirm-settings-host > .setup-section-heading { display: none; }
.confirm-settings-host .settings-workspace { grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; padding: 0; }
.confirm-panel { min-width: 0; width: 100%; display: grid; grid-template-columns: auto minmax(180px, 1fr) minmax(400px, 1.2fr); align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--s2a-line); border-radius: 15px; background: var(--surface, #fff); }
.confirm-copy { min-width: 0; display: grid; gap: 4px; }
.confirm-copy h2 { font-size: 1rem; }
.confirm-copy p { font-size: .76rem; line-height: 1.45; }
.confirm-panel .missing-assignments { grid-column: 1 / -1; }
.confirm-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; color: #fff; font-size: 1.15rem; background: linear-gradient(135deg, #1768e8, #7357ff); }
.confirm-panel h2, .confirm-panel p { margin: 0; }
.confirm-panel p { color: var(--muted, #71809b); }
.confirm-metrics { min-width: 0; width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.confirm-metrics div { min-width: 0; display: grid; gap: 3px; padding: 9px; border: 1px solid var(--s2a-line); border-radius: 10px; background: var(--s2a-soft); }
.confirm-metrics span { color: var(--muted, #71809b); font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; }
.missing-assignments { width: 100%; display: flex; align-items: center; gap: 11px; padding: 12px; border: 1px solid rgba(217, 48, 37, .3); border-radius: 12px; color: #b3261e; text-align: left; background: rgba(217, 48, 37, .07); }
.missing-assignments[hidden] { display: none; }
.missing-assignments i { font-size: 1.2rem; }
.missing-assignments span { display: grid; gap: 2px; }

.connection-dialog { width: min(640px, calc(100% - 24px)); max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--s2a-line); border-radius: 18px; padding: 0; background: var(--surface, #fff); color: var(--text, #17223b); box-shadow: 0 35px 100px rgba(7, 20, 55, .35); }
.connection-dialog::backdrop { background: rgba(5, 12, 28, .72); backdrop-filter: blur(7px); }
.connection-dialog, .connection-dialog * { box-sizing: border-box; }
/* Grid/card display rules must not reveal options hidden for this node's role. */
.connection-dialog [hidden] { display: none !important; }
.connection-dialog form { padding: 18px; position: relative; }
.connection-dialog label, .connection-dialog input, .connection-dialog .s2a-pair, .connection-dialog .s2a-triple { min-width: 0; }
.connection-dialog-kicker { margin: 0 40px 5px 0; color: var(--accent-strong); font-size: .68rem; font-weight: 850; letter-spacing: .13em; }
.connection-dialog h2 { margin: 0 40px 7px 0; font-size: 1.15rem; line-height: 1.3; }
.connection-dialog p { color: var(--muted, #71809b); }
.connection-dialog #connectionReason { margin: 8px 0; font-size: .78rem; line-height: 1.5; }
.connection-dialog #plateWidthHelp { margin: 8px 0; font-size: .72rem; line-height: 1.4; }
.connection-dialog #plateWidthHelp:empty { display: none; }
.connection-dialog input:not([type="radio"]) { min-height: 36px; max-width: 100%; padding: 7px 9px; border-radius: 8px; }
.dialog-close { position: absolute; right: 16px; top: 16px; width: 34px; height: 34px; border: 1px solid var(--s2a-line); border-radius: 50%; background: var(--surface, #fff); color: var(--text, #17223b); cursor: pointer; }
.connection-types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin: 16px 0; }
.connection-types label { min-height: 72px; border: 1px solid var(--s2a-line); border-radius: 12px; padding: 10px; position: relative; cursor: pointer; background: var(--s2a-soft); }
.connection-types input { position: absolute; opacity: 0; }
.connection-types b { color: #1768e8; font-size: 1.05rem; }
.connection-types span { font-size: .7rem; font-weight: 500; }
.connection-types label:has(input:checked) { border-color: var(--s2a-pink); box-shadow: 0 0 0 3px rgba(240, 68, 154, .15); }
.connection-detail-settings { border: 1px solid var(--s2a-line); border-radius: 12px; padding: 13px; background: var(--s2a-soft); }
.connection-detail-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.connection-detail-heading h3 { margin: 0; font-size: .9rem; }
.connection-detail-heading span { color: var(--muted, #71809b); font-size: .72rem; text-align: right; }
.connection-detail-settings .s2a-triple, .connection-detail-settings .s2a-pair { margin-top: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 17px; }
.base-connection-types { grid-template-columns: repeat(2, 1fr); }
.connection-dialog .connection-types { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin: 12px 0; }
.connection-dialog .base-connection-types { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.connection-dialog .connection-types label { min-height: 58px; align-content: center; gap: 4px; padding: 8px 9px; border-radius: 9px; }
.connection-dialog .connection-types b { font-size: .9rem; line-height: 1.2; }
.connection-dialog .connection-types span { line-height: 1.35; overflow-wrap: anywhere; }
.connection-dialog .connection-types label:has(input:focus-visible) { outline: 2px solid var(--accent-strong, #1768e8); outline-offset: 2px; }
.connection-dialog .connection-detail-settings { padding: 10px; }
.connection-dialog .connection-detail-heading { display: grid; gap: 4px; }
.connection-dialog .connection-detail-heading span { text-align: left; }
.connection-dialog .s2a-triple { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.connection-dialog .s2a-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.connection-dialog .s2a-triple, .connection-dialog .s2a-pair { align-items: end; gap: 8px; margin-top: 10px; }
.connection-dialog .dialog-actions { position: sticky; bottom: -18px; margin: 12px -18px -18px; padding: 12px 18px; border-top: 1px solid var(--s2a-line); background: var(--surface, #fff); z-index: 1; }
.connection-dialog .dialog-actions button { min-width: 0; min-height: 38px; padding: 8px 12px; border-radius: 9px; font-size: .78rem; line-height: 1.3; }
@media (max-width: 420px) {
  .connection-dialog form { padding: 14px; }
  .connection-dialog .connection-types { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .connection-dialog .dialog-actions { bottom: -14px; margin: 12px -14px -14px; padding: 10px 14px; }
  .connection-dialog .dialog-actions button { flex: 1; }
}
.connection-context-menu { position: fixed; z-index: 10050; width: 210px; padding: 6px; border: 1px solid var(--s2a-line); border-radius: 11px; background: var(--surface, #fff); box-shadow: 0 18px 48px rgba(4, 12, 34, .28); }
.connection-context-menu[hidden] { display: none; }
.connection-context-menu button { width: 100%; min-height: 38px; display: flex; align-items: center; gap: 9px; border: 0; border-radius: 8px; padding: 8px 10px; color: var(--text, #17223b); background: transparent; font: inherit; font-size: .78rem; text-align: left; cursor: pointer; }
.connection-context-menu button:hover:not(:disabled) { color: #1768e8; background: color-mix(in srgb, #1768e8 9%, transparent); }
.connection-context-menu button:disabled { opacity: .38; cursor: not-allowed; }
.connection-context-menu hr { height: 1px; margin: 5px 4px; border: 0; background: var(--s2a-line); }

/* Administrator-only view of the exact normalized input sent to the common frame composer. */
.frame-data-dialog { width: min(1500px, calc(100vw - 32px)); height: min(920px, calc(100vh - 32px)); padding: 0; overflow: hidden; border: 1px solid var(--s2a-line); border-radius: 22px; color: var(--text, #17223b); background: var(--bg, #f5f8ff); box-shadow: 0 35px 110px rgba(5, 13, 35, .4); }
.frame-data-dialog::backdrop { background: rgba(5, 12, 28, .76); backdrop-filter: blur(8px); }
.frame-data-shell { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.frame-data-shell > header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 20px; border-bottom: 1px solid var(--s2a-line); background: var(--surface, #fff); }
.frame-data-shell > header > div { display: grid; gap: 4px; }
.frame-data-shell > header span { color: #1768e8; font-size: .66rem; font-weight: 900; letter-spacing: .12em; }
.frame-data-shell > header h2, .frame-data-shell > header p { margin: 0; }
.frame-data-shell > header p { color: var(--muted, #71809b); font-size: .78rem; }
.frame-data-shell > header button { width: 40px; height: 40px; flex: 0 0 auto; border: 1px solid var(--s2a-line); border-radius: 50%; color: var(--text, #17223b); background: var(--surface, #fff); cursor: pointer; }
.frame-data-content { min-height: 0; display: grid; align-content: start; gap: 12px; padding: 16px; overflow: auto; }
.frame-data-card { border: 1px solid var(--s2a-line); border-radius: 15px; overflow: clip; background: var(--surface, #fff); }
.frame-data-card > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; cursor: pointer; list-style: none; }
.frame-data-card > summary::-webkit-details-marker { display: none; }
.frame-data-card > summary span { display: grid; gap: 3px; }
.frame-data-card > summary small { color: var(--muted, #71809b); font-size: .7rem; }
.frame-data-card[open] > summary { border-bottom: 1px solid var(--s2a-line); background: color-mix(in srgb, #1768e8 6%, var(--surface, #fff)); }
.frame-data-card[open] > summary > i { transform: rotate(180deg); }
.frame-data-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 14px; }
.frame-data-body > section { min-width: 0; padding: 12px; border: 1px solid var(--s2a-line); border-radius: 12px; background: var(--s2a-soft); }
.frame-data-body > section:has(.frame-data-table) { grid-column: 1 / -1; }
.frame-data-body h3 { margin: 0 0 10px; font-size: .84rem; }
.frame-data-body p { margin: 0; color: var(--text, #17223b); font-size: .78rem; }
.frame-data-metrics, .frame-data-secondary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.frame-data-metrics div, .frame-data-secondary div, .frame-data-origins div { display: grid; gap: 3px; padding: 8px; border: 1px solid var(--s2a-line); border-radius: 9px; background: var(--surface, #fff); }
.frame-data-metrics span, .frame-data-secondary span, .frame-data-origins span { color: var(--muted, #71809b); font-size: .64rem; text-transform: uppercase; letter-spacing: .04em; }
.frame-data-metrics b, .frame-data-secondary b, .frame-data-origins b { overflow-wrap: anywhere; font-size: .74rem; }
.frame-data-table { max-width: 100%; overflow: auto; border: 1px solid var(--s2a-line); border-radius: 9px; background: var(--surface, #fff); }
.frame-data-table table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: .72rem; }
.frame-data-table th, .frame-data-table td { padding: 8px 9px; border-bottom: 1px solid var(--s2a-line); text-align: left; white-space: nowrap; }
.frame-data-table th { position: sticky; top: 0; z-index: 1; color: var(--muted, #71809b); background: var(--surface, #fff); font-size: .64rem; text-transform: uppercase; letter-spacing: .04em; }
.frame-data-table tr:last-child td { border-bottom: 0; }
.frame-data-origins { display: grid; gap: 6px; }
.frame-data-global-warning { display: flex; align-items: start; gap: 10px; padding: 12px 14px; border: 1px solid rgba(191, 123, 0, .3); border-radius: 12px; color: #895800; background: rgba(255, 176, 32, .1); }
.frame-data-global-warning ul, .frame-data-warnings ul { margin: 0; padding-left: 18px; font-size: .75rem; line-height: 1.5; }
.frame-data-empty { padding: 30px; color: var(--muted, #71809b); text-align: center; }

/* Checkout follows the shared Staad2CAD review-and-confirm pattern. */
.s2a-payment-modal { position: fixed; inset: 0; z-index: 10100; display: grid; place-items: center; padding: 20px; background: rgba(7, 13, 18, .66); backdrop-filter: blur(6px); }
.s2a-payment-modal[hidden] { display: none; }
.s2a-payment-card { position: relative; width: min(440px, 100%); max-height: calc(100vh - 40px); padding: 27px; overflow-y: auto; border: 1px solid var(--s2a-line); border-radius: 18px; color: var(--text, #17223b); background: var(--surface, #fff); box-shadow: 0 26px 80px rgba(0, 0, 0, .3); }
.s2a-payment-close { position: absolute; right: 14px; top: 12px; width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 50%; color: var(--muted, #71809b); background: transparent; cursor: pointer; }
.s2a-payment-close:hover { color: var(--text, #17223b); background: var(--s2a-soft); }
.s2a-payment-kicker { color: #1768e8; font-size: .65rem; font-weight: 900; letter-spacing: .12em; }
.s2a-payment-card h2 { margin: 9px 36px 7px 0; font-size: 1.5rem; }
.s2a-payment-card > p { margin: 0; color: var(--muted, #71809b); font-size: .76rem; line-height: 1.5; }
.s2a-checkout-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 20px 0 12px; }
.s2a-checkout-summary > div { min-height: 78px; display: flex; flex-direction: column; justify-content: center; gap: 5px; padding: 13px 14px; border: 1px solid var(--s2a-line); border-radius: 11px; background: var(--s2a-soft); }
.s2a-checkout-summary span { color: var(--muted, #71809b); font-size: .66rem; font-weight: 650; }
.s2a-checkout-summary strong { font-size: .92rem; }
.s2a-checkout-summary > div:last-child strong { color: #1768e8; font-size: 1.35rem; }
.s2a-checkout-warning { display: grid; gap: 8px; margin-bottom: 12px; padding: 12px; border: 1px solid #eaa87b; border-radius: 11px; background: color-mix(in srgb, #f59e0b 8%, var(--surface, #fff)); font-size: .75rem; }
.s2a-checkout-warning[hidden] { display: none; }
.s2a-checkout-warning p { margin: 0; line-height: 1.45; }
.s2a-checkout-warning ul { max-height: 150px; overflow-y: auto; margin: 0; padding-left: 19px; line-height: 1.45; }
.s2a-checkout-warning button { justify-self: start; }
.s2a-checkout-warning label { display: flex; align-items: flex-start; gap: 8px; font-weight: 700; line-height: 1.4; cursor: pointer; }
.s2a-checkout-warning label input { flex: none; margin-top: 2px; }
.s2a-checkout-security { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; align-items: start; padding: 12px 13px; border: 1px solid color-mix(in srgb, #1768e8 25%, var(--s2a-line)); border-radius: 11px; background: color-mix(in srgb, #1768e8 7%, var(--surface, #fff)); }
.s2a-checkout-security > i { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; color: #fff; background: linear-gradient(105deg, #1a73e8, #7c4dff); }
.s2a-checkout-security > span { display: flex; flex-direction: column; gap: 3px; }
.s2a-checkout-security b { font-size: .72rem; }
.s2a-checkout-security small { color: var(--muted, #71809b); font-size: .66rem; line-height: 1.45; }
.s2a-checkout-security a { width: max-content; display: inline-flex; align-items: center; gap: 4px; margin-top: 3px; color: #1768e8; font-size: .65rem; font-weight: 800; text-decoration: none; }
.s2a-checkout-security a:hover { text-decoration: underline; }
.s2a-confirm-checkout { width: 100%; min-height: 44px; margin-top: 13px; border: 0; border-radius: 10px; color: #fff; background: linear-gradient(100deg, #0868df, #6e57ff); font: inherit; font-weight: 800; cursor: pointer; box-shadow: 0 9px 22px rgba(23, 104, 232, .24); }
.s2a-confirm-checkout:disabled { opacity: .45; cursor: not-allowed; }

@keyframes s2a-text-wipe { from { background-position: 120% 0; } to { background-position: -120% 0; } }
@keyframes s2a-note-attention { 0%, 55%, 100% { box-shadow: 0 0 0 0 rgba(23,104,232,0); } 20% { box-shadow: 0 0 0 4px rgba(23,104,232,.16), 0 5px 18px rgba(115,87,255,.14); } }
@keyframes s2a-note-pop { 0%, 40%, 100% { transform: scale(1); } 15% { transform: scale(1.16); } 25% { transform: scale(.96); } }
@keyframes s2a-ready-pulse { 0%, 100% { box-shadow: 0 10px 24px rgba(49, 91, 224, .2); transform: translateX(0); } 50% { box-shadow: 0 0 0 6px rgba(105, 87, 255, .15), 0 12px 28px rgba(49, 91, 224, .34); transform: translateX(3px); } }
@keyframes s2a-node-locator { 0% { opacity: 0; transform: scale(.42); } 16% { opacity: 1; } 100% { opacity: 0; transform: scale(3.3); } }
.workflow-next.ready-to-continue { animation: s2a-ready-pulse 1.45s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .animated-wipe-copy, .workflow-next.ready-to-continue, .default-connections-note.is-attending, .default-connections-note.is-attending > i { animation: none; } }

[data-theme="dark"] .s2a-control-panel, [data-theme="dark"] .s2a-review { box-shadow: 0 20px 60px rgba(0,0,0,.28); }
@media (min-width: 1280px) {
  .default-plate-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1120px) {
  .s2a-app { grid-template-columns: 1fr; }
  .s2a-review { position: static; min-height: auto; }
  .settings-workspace, .s2a-final-review-grid { grid-template-columns: 1fr; }
  .default-connections-workspace { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .default-plate-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .default-knee-card .connection-types { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .workflow-header { min-height: 64px; padding: 10px 16px; }
  .workflow-steps { padding: 6px 12px; }
  .workflow-page-head { flex-wrap: wrap; gap: 8px; }
  .frame-review-tools { justify-content: flex-start; }
  .connection-view-controls > span { display: none; }
  .confirm-panel { grid-template-columns: auto minmax(0, 1fr); }
  .confirm-metrics { grid-column: 1 / -1; }
  .s2a-final-review-grid .s2a-output-list { max-height: 360px; }
}
@media (max-width: 900px) {
  .connection-workspace { grid-template-columns: minmax(0, 1fr); grid-auto-rows: max-content; overflow: auto; }
  .connection-canvas-panel { height: clamp(430px, 65dvh, 640px); }
  .connection-assignment-panel { max-height: 400px; }
  .default-connections-workspace, .confirm-settings-host .settings-workspace { grid-template-columns: minmax(0, 1fr); }
  .settings-advanced .settings-collapse-body { grid-template-columns: minmax(0, 1fr); }
  .spacing-context { grid-template-columns: minmax(0, 1fr); }
  .frame-review-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-height: 650px) and (min-width: 901px) {
  .connection-workspace { overflow: auto; }
  .connection-canvas-panel, .connection-assignment-panel { min-height: 500px; }
}
@media (max-width: 680px) {
  .s2a-app { width: min(100% - 18px, 1840px); padding-top: 12px; }
  .s2a-control-panel, .s2a-review { border-radius: 17px; padding: 14px; }
  .s2a-pair, .s2a-triple, .s2a-four, .s2a-switch-grid, .connection-types { grid-template-columns: 1fr; }
  .s2a-actions { grid-template-columns: 1fr; }
  .s2a-slider { height: 430px; min-height: 360px; }
  .s2a-workflow-dialog { width: 100%; max-width: none; height: 100vh; height: 100dvh; max-height: none; border: 0; border-radius: 0; }
  .workflow-page { padding: 10px; gap: 10px; }
  .workflow-steps { padding: 6px; }
  .workflow-steps button span { display: none; }
  .workflow-footer { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
  .workflow-footer > button { font-size: .75rem; padding: 8px; }
  .workflow-footer > span { grid-column: 1 / -1; grid-row: 1; }
  .frame-review-grid { grid-template-columns: minmax(0, 1fr); }
  .confirm-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .confirm-metrics > div:last-child { grid-column: 1 / -1; }
  .default-plate-fields, .default-splice-card .default-connection-types, .default-knee-card .connection-types { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .frame-review-card { grid-template-rows: auto 220px auto; }
  .frame-card-preview, .frame-card-preview .cad-preview-svg { height: 220px !important; min-height: 220px; }
  .workflow-page-head { align-items: stretch; flex-direction: column; }
  .frame-review-tools { flex-wrap: wrap; }
  .connection-preview-toolbar > .connection-view-controls { gap: 6px; }
  .connection-view-controls > span { margin-left: 0; }
  .connection-action-toolbar { flex-wrap: wrap; gap: 2px; padding: 4px; }
  .connection-action-toolbar button { padding: 6px; min-height: 36px; }
  .connection-toolbar-spacer, .connection-toolbar-divider { display: none; }
  .axis-filter { width: 100%; }
  .axis-filter button { flex: 1; justify-content: center; }
  .connection-canvas-panel { height: auto; grid-template-rows: auto auto 280px auto; padding: 10px; }
  .final-preview-controls { align-items: stretch; flex-direction: column; }
  .final-preview-controls > div { justify-content: center; }
  .s2a-package-final-action { align-items: stretch; flex-direction: column; gap: 12px; }
  .s2a-price { margin-left: 0; justify-items: start; }
  .s2a-package-buttons { grid-template-columns: 1fr; }
  .s2a-checkout-summary { grid-template-columns: 1fr; }
  .frame-data-dialog { width: 100vw; height: 100vh; max-height: none; border: 0; border-radius: 0; }
  .frame-data-body { grid-template-columns: 1fr; }
  .frame-data-metrics, .frame-data-secondary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
