.msm-profile-view,
.msm-drive-view {
    --ms-vis-accent: var(--a, #1f65d6);
    box-sizing: border-box;
}
.msm-visual-split--stacked { grid-template-columns: minmax(0,1fr) !important; }
.msm-visual-split--equal { grid-template-columns: minmax(0,1fr) minmax(0,1fr) !important; }
.msm-profile-view--wide { margin-top: 0; min-height: 0; width: 100%; }
.msm-profile-view *,
.msm-drive-view *,
.msm-vis-modal * { box-sizing: border-box; }
.msm-profile-head { align-items: flex-start; display: flex; gap: .75rem; justify-content: space-between; margin-bottom: .65rem; }
.msm-profile-head h3,
.msm-profile-head h4 { color: var(--text, #17232c); margin: 0 0 .18rem; }
.msm-profile-head h4 { font-size: 1.05rem; }
.msm-profile-head h3 { font-size: 1.3rem; }
.msm-profile-head small,
.msm-profile-head p { color: var(--muted, #50606b); line-height: 1.4; margin: 0; }
.msm-profile-head small { display: block; font-size: .75rem; }
.msm-measure-kicker { color: var(--ms-vis-accent); display: block; font-size: .78rem; font-weight: 800; letter-spacing: .06em; margin-bottom: .2rem; text-transform: uppercase; }
.msm-profile-head button,
.msm-profile-controls button,
.msm-vis-dialog button {
    appearance: none;
    background: #fff;
    border: 1px solid var(--border-strong, #9eb3c2);
    border-radius: 8px;
    color: #24343f;
    cursor: pointer;
    font: inherit;
    font-size: .84rem;
    font-weight: 750;
    min-height: 38px;
    padding: .4rem .65rem;
}
.msm-profile-head [data-ms-vis-open] { background: var(--ms-vis-accent); border-color: var(--ms-vis-accent); color: #fff; flex: 0 0 auto; }
.msm-profile-stage {
    background: linear-gradient(160deg,#f8fbfd,#edf3f7);
    border: 1px solid var(--border, #c9d4dc);
    border-radius: 9px;
    min-height: 255px;
    overflow: hidden;
    position: relative;
}
.msm-profile-view--wide .msm-profile-stage { min-height: 430px; }
.msm-profile-stage canvas { cursor: grab; display: block; height: 270px; touch-action: none; width: 100%; }
.msm-profile-view--wide .msm-profile-stage canvas { height: clamp(430px,38vw,650px); }
.msm-profile-stage canvas:active { cursor: grabbing; }
.msm-profile-stage canvas:focus-visible { outline: 3px solid rgba(31,101,214,.35); outline-offset: -3px; }
.msm-profile-drag {
    background: rgba(255,255,255,.9);
    border: 1px solid #dce5eb;
    border-radius: 6px;
    bottom: .45rem;
    color: #52646f;
    font-size: .72rem;
    left: .45rem;
    padding: .25rem .4rem;
    pointer-events: none;
    position: absolute;
}
.msm-profile-controls { display: grid; gap: .35rem; grid-template-columns: repeat(3,minmax(0,1fr)); margin-top: .5rem; }
.msm-profile-controls button.is-active { background: var(--ms-vis-accent); border-color: var(--ms-vis-accent); color: #fff; }
.msm-profile-note { color: var(--muted, #50606b); font-size: .78rem; line-height: 1.45; margin: .65rem 0 0; }
.msm-drive-view {
    background: #fff;
    border: 1px solid var(--border, #c9d4dc);
    border-radius: 16px;
    color: var(--text, #17232c);
    margin: 0 0 1rem;
    overflow: hidden;
    padding: 1.25rem;
}
.msm-drive-stage { min-height: 360px; }
.msm-drive-stage canvas { height: 560px; }
.msm-drive-actions { display: flex; flex: 0 0 auto; gap: .45rem; }
.msm-drive-actions [data-ms-vis-report] { background: #fff; color: var(--ms-vis-accent); }
.msm-drive-product-selects { display: grid; gap: .55rem; grid-template-columns: repeat(3,minmax(0,1fr)); margin: .8rem 0; }
.msm-drive-product-selects label { color: var(--muted,#50606b); display: grid; font-size: .75rem; font-weight: 750; gap: .25rem; }
.msm-drive-product-selects select,
.msm-vis-profile-select select { background: #fff; border: 1px solid var(--border-strong,#9eb3c2); border-radius: 7px; color: #24343f; font: inherit; min-height: 38px; padding: .35rem .45rem; width: 100%; }
.msm-vis-profile-select { align-items: center; color: #50606b; display: flex; font-size: .76rem; font-weight: 700; gap: .35rem; }
.msm-vis-profile-select select { min-height: 34px; width: auto; }
.msm-measure-readout { background: #edf5fb; border: 1px solid #cfe0eb; border-radius: 8px; color: #243b4a; font-size: .92rem; font-weight: 750; margin-top: .65rem; padding: .65rem .75rem; }
.msm-vis-modal[hidden] { display: none !important; }
.msm-vis-modal {
    align-items: center;
    background: rgba(10,20,28,.78);
    display: flex;
    inset: 0;
    justify-content: center;
    padding: clamp(.5rem,2vw,1.5rem);
    position: fixed;
    z-index: 999999;
}
.msm-vis-dialog {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 28px 90px rgba(0,0,0,.38);
    display: grid;
    grid-template-rows: auto auto minmax(300px,1fr) auto;
    max-height: calc(100vh - 2rem);
    max-width: 1280px;
    overflow: hidden;
    width: 100%;
}
.msm-vis-dialog header { align-items: center; border-bottom: 1px solid #dbe4e9; display: flex; gap: 1rem; justify-content: space-between; padding: .8rem 1rem; }
.msm-vis-dialog header span { color: #1f65d6; display: block; font-size: .72rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.msm-vis-dialog header h3 { color: #17232c; font-size: 1.18rem; margin: .1rem 0 0; }
.msm-vis-dialog [data-ms-vis-close] { background: #1f65d6; border-color: #1f65d6; color: #fff; }
.msm-vis-tools { background: #f5f8fa; border-bottom: 1px solid #dbe4e9; display: flex; gap: .35rem; justify-content: center; padding: .45rem; }
.msm-vis-3d-stage { background: radial-gradient(circle at 50% 35%,#fff,#e5edf2); min-height: 420px; position: relative; }
.msm-vis-3d-stage canvas { cursor: grab; display: block; height: min(68vh,720px); min-height: 420px; touch-action: none; width: 100%; }
.msm-vis-3d-stage canvas:active { cursor: grabbing; }
.msm-vis-3d-stage p { background: rgba(255,255,255,.9); border: 1px solid #d8e2e8; border-radius: 7px; bottom: .65rem; color: #50616c; font-size: .78rem; left: 50%; margin: 0; padding: .35rem .55rem; pointer-events: none; position: absolute; transform: translateX(-50%); white-space: nowrap; }
.msm-vis-dialog footer { color: #53646f; font-size: .78rem; line-height: 1.4; padding: .65rem 1rem; }
body.msm-vis-lock { overflow: hidden !important; }

/* Servo desktop workspace: live result above, input and visualization at 50/50. */
.msm-tab-assistant .msm-servo-layout-wide { grid-template-columns: minmax(0,1fr) !important; }
.msm-tab-assistant > .msm-summary--horizontal { margin: 0 0 1rem; width: 100%; }
.msm-tab-assistant > .msm-summary--horizontal .msm-summary-sticky {
    align-items: stretch;
    display: grid;
    gap: .65rem;
    grid-template-columns: minmax(155px,.7fr) minmax(165px,.8fr) minmax(280px,1.35fr) minmax(245px,1.2fr) minmax(145px,.65fr);
    position: static;
    top: auto;
}
.msm-summary--horizontal .msm-summary-head { align-content: center; border-bottom: 0; border-right: 1px solid var(--border, #c9d4dc); display: grid; margin: 0; padding: 0 .65rem 0 0; }
.msm-summary--horizontal .msm-summary-primary { min-width: 0; }
.msm-summary--horizontal .msm-summary-grid { margin: 0; }
.msm-summary--horizontal .msm-status-list { border: 0; grid-template-columns: repeat(3,minmax(0,1fr)); margin: 0; padding: 0; }
.msm-summary--horizontal .msm-status-list > div { align-content: center; }
.msm-summary--horizontal .msm-summary-cta { margin: 0; padding: .5rem; text-align: center; }

@media (max-width: 1220px) {
    .msm-tab-assistant > .msm-summary--horizontal .msm-summary-sticky { grid-template-columns: minmax(150px,.7fr) minmax(165px,.8fr) minmax(280px,1.4fr) minmax(145px,.7fr); }
    .msm-summary--horizontal .msm-status-list { grid-column: 1 / -1; grid-row: 2; }
}

@media (max-width: 900px) {
    .msm-visual-split--equal { grid-template-columns: minmax(0,1fr) !important; }
    .msm-profile-view--wide { margin-top: 1rem; }
    .msm-tab-assistant > .msm-summary--horizontal .msm-summary-sticky { grid-template-columns: minmax(150px,.7fr) minmax(160px,.8fr) minmax(280px,1.4fr); }
    .msm-summary--horizontal .msm-summary-cta { grid-column: 1 / -1; }
}

/* Progressive tab assistant: sections remain in the DOM, so inputs and results persist. */
.msm-tab-assistant .msm-step-nav { overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-width: thin; }
.msm-tab-assistant .msm-step-nav [role="tab"] { border: 1px solid transparent; position: relative; }
.msm-tab-assistant .msm-step-nav [role="tab"].is-active { background: var(--a, #1f4e78); color: #fff !important; }
.msm-tab-assistant .msm-step-nav [role="tab"].is-active span { background: #fff; color: var(--a-dark, #143650); }
.msm-tab-assistant .msm-step-nav [role="tab"].is-complete:not(.is-active) span { background: #e7f4e4; color: #17451c; }
.msm-tab-assistant .msm-step-nav [role="tab"].is-complete:not(.is-active) span::after { content: '✓'; font-size: .75rem; }
.msm-tab-assistant .msm-step-nav [role="tab"].is-complete:not(.is-active) span { font-size: 0; }
.msm-tab-assistant .msm-step-nav [role="tab"].has-error { border-color: #b64141; }
.msm-tab-assistant .msm-step-nav [role="tab"]:focus-visible { outline: 3px solid rgba(31,101,214,.3); outline-offset: 2px; }
.msm-tab-assistant .msm-flow > [role="tabpanel"][hidden] { display: none !important; }
.msm-tab-assistant .msm-flow > [role="tabpanel"].is-active { animation: msm-tab-in .18s ease-out; }
.msm-tab-actions { align-items: center; border-top: 1px solid var(--border, #c9d4dc); display: flex; justify-content: space-between; margin-top: 1.25rem; padding-top: 1rem; }
.msm-tab-actions button { appearance: none; background: #fff; border: 1px solid var(--border-strong, #9eb3c2); border-radius: 8px; color: #24343f; cursor: pointer; font: inherit; font-size: .92rem; font-weight: 750; min-height: 44px; padding: .55rem .9rem; }
.msm-tab-actions button.is-primary { background: var(--a, #1f4e78); border-color: var(--a, #1f4e78); color: #fff; }
@keyframes msm-tab-in { from { opacity: .45; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 760px) {
    .msm-profile-head { display: block; }
    .msm-profile-head [data-ms-vis-open] { margin-top: .55rem; width: 100%; }
    .msm-profile-stage canvas { height: 250px; }
    .msm-profile-view--wide .msm-profile-stage { min-height: 330px; }
    .msm-profile-view--wide .msm-profile-stage canvas { height: 330px; }
    .msm-profile-controls { grid-template-columns: 1fr; }
    .msm-tab-assistant .msm-step-nav { display: flex; flex-wrap: nowrap; }
    .msm-tab-assistant .msm-step-nav [role="tab"] { flex: 0 0 auto; min-width: 150px; }
    .msm-tab-actions { gap: .6rem; }
    .msm-tab-actions button { flex: 1; }
    .msm-tab-assistant > .msm-summary--horizontal .msm-summary-sticky { grid-template-columns: 1fr 1fr; }
    .msm-summary--horizontal .msm-summary-head { border-bottom: 1px solid var(--border, #c9d4dc); border-right: 0; grid-column: 1 / -1; padding: 0 0 .55rem; }
    .msm-summary--horizontal .msm-summary-grid { grid-template-columns: 1fr !important; }
    .msm-summary--horizontal .msm-status-list,
    .msm-summary--horizontal .msm-summary-cta { grid-column: 1 / -1; }
    .msm-summary--horizontal .msm-status-list { grid-row: auto; }
    .msm-drive-stage canvas { height: 520px; }
    .msm-drive-actions { display: grid; margin-top: .55rem; width: 100%; }
    .msm-drive-product-selects { grid-template-columns: 1fr; }
    .msm-vis-profile-select { align-items: stretch; flex-direction: column; width: 100%; }
    .msm-vis-profile-select select { width: 100%; }
    .msm-vis-dialog { border-radius: 0; max-height: 100vh; }
    .msm-vis-modal { padding: 0; }
    .msm-vis-dialog header { align-items: stretch; flex-direction: column; }
    .msm-vis-dialog [data-ms-vis-close] { width: 100%; }
    .msm-vis-3d-stage,
    .msm-vis-3d-stage canvas { height: 58vh; min-height: 330px; }
    .msm-vis-3d-stage p { bottom: .4rem; max-width: calc(100% - .8rem); text-align: center; white-space: normal; }
}

/* 1.19.0 – verbindliche geführte Servokonfiguration mit dauerhaftem 2D/3D-Viewer. */
.msm-guided-servo .msm-step-nav { grid-template-columns: repeat(5,minmax(0,1fr)); }
.msm-guided-servo-layout {
    grid-template-columns: minmax(350px,.86fr) minmax(470px,1.14fr) !important;
    gap: 1rem;
    align-items: start;
}
.msm-guided-visual-shell {
    min-width: 0;
    position: sticky;
    top: 84px;
}
.msm-guided-visual-shell .msm-visual-card { min-height: 0; padding: 1rem; }
.msm-guided-visual-shell .msm-summary { margin-top: .8rem; }
.msm-guided-visual-shell .msm-summary-sticky { position: static; top: auto; }
.msm-profile-view--guided .msm-profile-head { align-items: center; margin-bottom: .7rem; }
.msm-profile-view--guided .msm-profile-head p { font-size: .86rem; }
.msm-view-toggle {
    background: #edf2f5;
    border-radius: 9px;
    display: flex;
    flex: 0 0 auto;
    gap: 4px;
    padding: 3px;
}
.msm-view-toggle button,
.msm-vis-toolbar button {
    appearance: none;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #24343f;
    cursor: pointer;
    font: inherit;
    font-size: .78rem;
    font-weight: 750;
    min-height: 36px;
    padding: .35rem .55rem;
}
.msm-view-toggle button.is-active,
.msm-vis-toolbar button.is-active,
.msm-vis-toolbar button[aria-pressed="true"] { background: #fff; border-color: var(--border,#c9d4dc); box-shadow: 0 1px 4px rgba(23,59,87,.14); color: var(--a-dark,#143650); }
.msm-vis-toolbar {
    align-items: center;
    background: #f5f8fa;
    border: 1px solid var(--border,#c9d4dc);
    border-radius: 9px;
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    justify-content: space-between;
    margin-bottom: .55rem;
    padding: .35rem;
}
.msm-vis-zoom,.msm-vis-camera { align-items: center; display: flex; flex-wrap: wrap; gap: .25rem; }
.msm-vis-zoom output { color: #52646f; font-size: .75rem; font-variant-numeric: tabular-nums; min-width: 48px; text-align: center; }
.msm-vis-layers { border: 1px solid var(--border,#c9d4dc); border-radius: 9px; margin-bottom: .55rem; padding: .2rem .65rem .55rem; }
.msm-vis-layers summary { color: var(--a-dark,#143650); cursor: pointer; font-size: .82rem; font-weight: 750; padding: .4rem 0; }
.msm-vis-layers p { color: var(--muted,#50606b); font-size: .75rem; line-height: 1.4; margin: 0 0 .4rem; }
.msm-vis-layers > div { display: grid; gap: .35rem; grid-template-columns: repeat(3,minmax(0,1fr)); }
.msm-vis-layers label { align-items: center; color: #344b59; display: flex; font-size: .78rem; gap: .35rem; }
.msm-vis-layers input { flex: 0 0 auto; min-height: 18px; order: initial; padding: 0; width: 18px; }
.msm-profile-stage--guided { min-height: 430px; }
.msm-profile-stage--guided canvas { display: block; height: clamp(430px,45vw,620px); min-height: 430px; touch-action: none; width: 100%; }
.msm-profile-stage--guided canvas[hidden] { display: none !important; }
.msm-profile-view--guided .msm-visual-values { grid-template-columns: repeat(3,minmax(0,1fr)); }
.msm-profile-view--guided:fullscreen,
.msm-profile-view--guided.is-pseudo-fullscreen {
    background: #fff;
    border: 0;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    inset: 0;
    max-width: none;
    padding: 1rem;
    width: 100vw;
    z-index: 999999;
}
.msm-profile-view--guided.is-pseudo-fullscreen { position: fixed; }
.msm-profile-view--guided:fullscreen .msm-profile-stage--guided,
.msm-profile-view--guided.is-pseudo-fullscreen .msm-profile-stage--guided { flex: 1; min-height: 0; }
.msm-profile-view--guided:fullscreen .msm-profile-stage--guided canvas,
.msm-profile-view--guided.is-pseudo-fullscreen .msm-profile-stage--guided canvas { height: 100%; min-height: 0; }
.msm-guided-review { background: #edf7ea; border: 1px solid #b7d5b0; border-radius: 10px; display: grid; gap: .15rem; margin-bottom: .8rem; padding: .8rem .9rem; }
.msm-guided-review strong { color: #215928; font-size: .9rem; }
.msm-guided-review span { color: #183e1e; font-size: 1rem; font-weight: 800; }
.msm-guided-review small { color: #49634c; font-size: .82rem; line-height: 1.4; }
.msm-guided-review [data-state="pending"] { color: #6a500d; }
.msm-guided-review [data-state="warning"] { color: #8b2929; }

@media (max-width: 1180px) {
    .msm-guided-servo-layout { grid-template-columns: minmax(330px,.9fr) minmax(430px,1.1fr) !important; }
    .msm-profile-stage--guided,.msm-profile-stage--guided canvas { min-height: 390px; }
    .msm-profile-stage--guided canvas { height: 430px; }
}
@media (max-width: 900px) {
    .msm-guided-servo-layout { grid-template-columns: minmax(0,1fr) !important; }
    .msm-guided-visual-shell { order: -1; position: static; top: auto; }
    .msm-guided-visual-shell .msm-summary { order: initial; }
    .msm-profile-stage--guided,.msm-profile-stage--guided canvas { min-height: 330px; }
    .msm-profile-stage--guided canvas { height: 360px; }
}
@media (max-width: 680px) {
    .msm-guided-servo .msm-step-nav { display: flex; flex-wrap: nowrap; grid-template-columns: none; overflow-x: auto; }
    .msm-guided-servo .msm-step-nav a { flex: 0 0 auto; min-width: 142px; }
    .msm-profile-view--guided .msm-profile-head { display: flex; }
    .msm-view-toggle { width: auto; }
    .msm-vis-toolbar { align-items: stretch; flex-direction: column; }
    .msm-vis-zoom,.msm-vis-camera { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); }
    .msm-vis-camera { grid-template-columns: repeat(3,minmax(0,1fr)); }
    .msm-vis-layers > div { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .msm-profile-stage--guided,.msm-profile-stage--guided canvas { min-height: 280px; }
    .msm-profile-stage--guided canvas { height: 300px; }
    .msm-profile-view--guided .msm-visual-values { grid-template-columns: 1fr; }
}
