/* Montavo 3D line configurator, styled with the Montavo design system tokens from site.css */
.cfg-intro { background: var(--surface-sunken); border-bottom: 1px solid var(--line); padding: var(--space-4) 0; flex: none; }
.cfg-intro__inner { display: flex; justify-content: space-between; align-items: end; gap: var(--space-8); flex-wrap: wrap; }
.cfg-intro h1 { font-size: clamp(1.5rem, 2.2vw, 2rem); line-height: 1.15; margin: 0; }
.cfg-intro .eyebrow { margin-bottom: var(--space-2); }
.cfg-intro p { max-width: 64ch; margin: 0; color: var(--ink-muted); font-size: 14px; line-height: 22px; }

/* Mode colours differ in lightness, not hue: auto = graphite, semi = steel, manual = white with a strong outline */
[data-mode="auto"] { --mc: var(--graphite); --mc-ink: var(--on-action); --mc-line: var(--graphite); }
[data-mode="semi"] { --mc: var(--steel); --mc-ink: #ffffff; --mc-line: var(--steel); }
[data-mode="manual"] { --mc: #ffffff; --mc-ink: var(--ink); --mc-line: var(--line-strong); }

/* Intro and configurator share one screen below the header, so the whole tool is visible without page scrolling */
.cfg-page { display: flex; flex-direction: column; height: calc(100vh - var(--header-h)); height: calc(100svh - var(--header-h)); min-height: 600px; max-height: 1100px; }
.cfg { display: grid; grid-template-columns: 380px 1fr; flex: 1; min-height: 0; border-bottom: 1px solid var(--line); }
.cfg-side { position: relative; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; overflow-y: auto; scrollbar-width: thin; }
.cfg-block { padding: var(--space-6); border-bottom: 1px solid var(--line); }
.cfg-block--grow { flex: 1; }
/* The proposal button stays in view at the bottom of the scrolling sidebar */
.cfg-block--cta { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); border-bottom: 0; padding-top: var(--space-4); padding-bottom: var(--space-4); z-index: 1; }
.cfg-block--cta .cfg-cta { margin-top: var(--space-3); }
.cfg-h { font: 600 12px/16px var(--font-sans); text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-muted); margin: 0 0 var(--space-3); display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); font-variation-settings: normal; }
.cfg-h small { font: 400 12px/16px var(--font-sans); letter-spacing: 0; text-transform: none; display: inline-flex; gap: 6px; align-items: center; }
.cfg-h small i { width: 10px; height: 10px; border-radius: 1px; display: inline-block; background: var(--mc); border: 1px solid var(--mc-line); }

.cfg-products { display: grid; gap: var(--space-2); }
.cfg-product { text-align: left; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); color: var(--ink); cursor: pointer; font: inherit; }
.cfg-product strong { display: block; font-size: 15px; line-height: 22px; font-weight: 600; }
.cfg-product span { font-size: 13px; line-height: 20px; color: var(--ink-muted); }
.cfg-product:hover { background: var(--surface-sunken); }
.cfg-product[aria-checked="true"] { background: var(--action); border-color: var(--action); color: var(--on-action); }
.cfg-product[aria-checked="true"] span { color: #c4cad1; }
.cfg-spec span { white-space: nowrap; }
.cfg-spec { font: 400 12px/18px var(--font-mono); color: var(--ink-muted); margin: var(--space-3) 0 0; }
.cfg-note { font-size: 13px; line-height: 20px; color: var(--warning); margin: var(--space-2) 0 0; }

.cfg-row { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); font-size: 14px; margin-bottom: var(--space-3); flex-wrap: wrap; }
.cfg-row:last-child { margin-bottom: 0; }
.cfg-seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-md); overflow: hidden; flex-shrink: 0; }
.cfg-seg button { font: 600 12px/16px var(--font-sans); letter-spacing: 0.02em; color: var(--ink); background: var(--surface); border: 0; border-left: 1px solid var(--line); padding: 8px 10px; cursor: pointer; min-width: 40px; min-height: 34px; }
.cfg-seg button:first-child { border-left: 0; }
.cfg-seg button:hover { background: var(--surface-sunken); }
.cfg-seg button[aria-checked="true"] { background: var(--mc, var(--action)); color: var(--mc-ink, var(--on-action)); box-shadow: inset 0 0 0 1px var(--mc-line, var(--action)); }
[data-cfg-shifts] button[aria-checked="true"] { background: var(--action); color: var(--on-action); }
.cfg-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.cfg-presets button { font: 600 12px/16px var(--font-sans); color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); padding: 8px 10px; border-radius: var(--radius-md); cursor: pointer; min-height: 34px; }
.cfg-presets button:hover { background: var(--surface-sunken); }

.cfg-stations { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.cfg-station .cfg-seg, .cfg-station .cfg-fixed { width: 168px; }
.cfg-station .cfg-seg button { flex: 1; min-width: 0; padding-left: 4px; padding-right: 4px; }
.cfg-station .cfg-fixed { justify-content: center; }
.cfg-station { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: 6px 6px 6px 4px; border-radius: var(--radius-md); border: 1px solid transparent; }
.cfg-station:hover { background: var(--surface-sunken); }
.cfg-station.is-selected { background: var(--surface-sunken); border-color: var(--line-strong); }
.cfg-station__name { display: flex; align-items: center; gap: 10px; background: none; border: 0; color: var(--ink); font: 500 14px/18px var(--font-sans); text-align: left; cursor: pointer; padding: 2px; min-width: 0; }
.cfg-station__name b { flex-shrink: 0; width: 24px; height: 24px; border-radius: var(--radius-sm); border: 1px solid var(--line); color: var(--ink-muted); display: grid; place-items: center; font: 500 11px/1 var(--font-mono); }
.cfg-station__name em { display: block; font-style: normal; font-size: 11px; line-height: 16px; color: var(--danger); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.cfg-station.is-bottleneck .cfg-station__name b { background: var(--danger); border-color: var(--danger); color: #ffffff; }
.cfg-fixed { font-size: 12px; color: var(--ink-muted); padding: 6px 8px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.cfg-fixed::before { content: ""; width: 8px; height: 8px; border-radius: 1px; background: var(--mc); border: 1px solid var(--mc-line); }

.cfg-details summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink); }
.cfg-assumptions { display: grid; gap: var(--space-2); margin-top: var(--space-3); }
.cfg-assume { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-muted); }
.cfg-assume__input { display: inline-flex; align-items: center; gap: 4px; }
.cfg-assume input { width: 84px; background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink); border-radius: var(--radius-sm); padding: 6px 8px; font: 400 13px/18px var(--font-mono); text-align: right; }
.cfg-assume i { font-style: normal; width: 24px; color: var(--ink-muted); font-family: var(--font-mono); font-size: 12px; }
.cfg-link { background: none; border: 0; color: var(--copper-text); font: inherit; font-size: 13px; cursor: pointer; justify-self: start; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
.cfg-cta { width: 100%; margin-top: var(--space-4); }

/* Viewport */
.cfg-view { position: relative; overflow: hidden; min-width: 0; background: var(--surface-sunken); }
.cfg-stage { position: absolute; inset: 0; }
.cfg-view canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; opacity: 0; transition: opacity .5s; }
.cfg-view.is-ready canvas { opacity: 1; }
.cfg-view canvas:active { cursor: grabbing; }
.cfg-labels { position: absolute; inset: 0; pointer-events: none; }
.cfg-label { position: absolute; left: 0; top: 0; pointer-events: auto; display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px 3px 3px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); color: var(--ink); font: 500 12px/16px var(--font-sans); white-space: nowrap; cursor: pointer; }
.cfg-label b { width: 20px; height: 20px; border-radius: var(--radius-sm); background: var(--mc); color: var(--mc-ink); border: 1px solid var(--mc-line); display: grid; place-items: center; font: 500 11px/1 var(--font-mono); }
.cfg-label span { max-width: 230px; overflow: hidden; text-overflow: ellipsis; }
.cfg-label.is-compact { padding: 2px; }
.cfg-label.is-compact span { display: none; }
.cfg-label:hover, .cfg-label.is-hover { border-color: var(--line-strong); z-index: 2; }
.cfg-label.is-bottleneck { border-color: var(--danger); }
.cfg-label.is-bottleneck b { background: var(--danger); border-color: var(--danger); color: #ffffff; }
.cfg-label.is-selected { background: var(--action); color: var(--on-action); border-color: var(--action); z-index: 3; }

.cfg-kpis { position: absolute; top: var(--space-4); left: var(--space-4); right: var(--space-4); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2); pointer-events: none; z-index: 2; }
.cfg-kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); min-width: 0; }
.cfg-kpi small { display: block; font: 600 11px/16px var(--font-sans); text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-muted); }
.cfg-kpi strong { display: block; font: 500 24px/32px var(--font-mono); color: var(--ink); margin: 2px 0; }
.cfg-kpi strong.is-changed { animation: kpiFlash .7s ease; }
.cfg-kpi span { display: block; font-size: 12px; line-height: 16px; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes kpiFlash { 0% { color: var(--copper-text); } 100% { color: var(--ink); } }

.cfg-detail { position: absolute; top: 120px; right: var(--space-4); bottom: var(--space-4); width: 340px; z-index: 3; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-2); padding: var(--space-6); font-size: 14px; scrollbar-width: thin; }
.cfg-detail[hidden] { display: none; }
.cfg-detail__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-2); }
.cfg-detail__num { font: 600 11px/16px var(--font-sans); color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.1em; }
.cfg-detail__nav { display: flex; gap: 4px; }
.cfg-detail__nav button { width: 32px; height: 32px; border-radius: var(--radius-md); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; font-size: 16px; line-height: 1; }
.cfg-detail__nav button:hover { background: var(--surface-sunken); }
.cfg-detail h3 { font-size: 20px; line-height: 28px; margin: var(--space-1) 0 var(--space-3); }
.cfg-detail h4 { font: 600 11px/16px var(--font-sans); text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-muted); margin: var(--space-6) 0 var(--space-2); font-variation-settings: normal; }
.cfg-detail ul { margin: 0; padding-left: 18px; color: var(--ink); }
.cfg-detail li { margin-bottom: 4px; }
.cfg-detail li::marker { color: var(--ink-muted); }
.cfg-detail__modes { margin-bottom: var(--space-4); }
.cfg-alert { display: flex; gap: 8px; align-items: baseline; border: 1px solid var(--danger); color: var(--danger); padding: 8px 10px; border-radius: var(--radius-sm); font-size: 13px; line-height: 18px; margin: 0 0 var(--space-3); }
.cfg-alert::before { content: ""; width: 8px; height: 8px; border-radius: 1px; background: var(--danger); flex: none; }
.cfg-compare { width: 100%; border-collapse: collapse; font-size: 13px; }
.cfg-compare th, .cfg-compare td { white-space: nowrap; padding: 6px; text-align: right; border-bottom: 1px solid var(--line); font-family: var(--font-mono); }
.cfg-compare th { font: 600 11px/16px var(--font-sans); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); }
.cfg-compare th:first-child, .cfg-compare td:first-child { text-align: left; color: var(--ink-muted); font-family: var(--font-sans); }
.cfg-compare .is-current { background: var(--surface-sunken); color: var(--ink); font-weight: 600; }

.cfg-toolbar { position: absolute; left: var(--space-4); bottom: var(--space-4); display: flex; gap: 6px; }
.cfg-toolbar button { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--radius-md); padding: 8px 12px; font: 600 12px/16px var(--font-sans); cursor: pointer; min-height: 36px; }
.cfg-toolbar button:hover { background: var(--surface-sunken); }
.cfg-toolbar svg { width: 16px; height: 16px; }
.cfg-toolbar [aria-pressed="true"] { background: var(--action); color: var(--on-action); border-color: var(--action); }
.cfg-legend { position: absolute; right: var(--space-4); bottom: var(--space-4); display: flex; gap: var(--space-3); font-size: 12px; color: var(--ink-muted); background: var(--surface); padding: 8px 12px; border-radius: var(--radius-md); border: 1px solid var(--line); }
.cfg-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 1px; margin-right: 6px; vertical-align: -1px; }
.lg-in { background: var(--steel); }
.lg-out { background: var(--graphite); }
.lg-bn { background: transparent; border: 2px solid var(--danger); }
.cfg-noscript { position: absolute; inset: 0; display: grid; place-items: center; }
.cfg-hint { display: none; }

/* Summary */
.cfg-summary { display: grid; grid-template-columns: 1fr 1.6fr; gap: var(--space-8); align-items: start; }
.cfg-summary > * { min-width: 0; }
.cfg-summary__side { display: grid; gap: var(--space-6); }
.cfg-summary__side .cfg-disclaimer { margin: 0; }
.cfg-table-note { font-size: 13px; line-height: 20px; color: var(--ink-muted); margin: var(--space-4) 0 0; }
.cfg-bar { margin-bottom: var(--space-4); }
.cfg-bar__label { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; gap: var(--space-3); }
.cfg-bar__label span { color: var(--ink-muted); }
.cfg-bar__label strong { font: 500 14px/20px var(--font-mono); }
.cfg-bar__track { height: 8px; background: var(--surface-sunken); border-radius: 1px; overflow: hidden; }
.cfg-bar__track i { display: block; height: 100%; background: var(--steel); transition: width .4s; }
.cfg-bar--total { border-top: 1px solid var(--line); padding-top: var(--space-4); margin-top: var(--space-6); }
.cfg-bar--total span { color: var(--ink); font-weight: 600; }
.cfg-bar--total strong { font: 500 20px/28px var(--font-mono); }
.cfg-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.cfg-table th, .cfg-table td { padding: 8px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.cfg-table td:nth-child(n+4), .cfg-table td:first-child { font-family: var(--font-mono); font-size: 13px; }
.cfg-table td:nth-child(2) { white-space: normal; }
.cfg-table th { font: 600 11px/16px var(--font-sans); text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-muted); background: var(--surface-sunken); }
.cfg-table th:nth-child(n+4), .cfg-table td:nth-child(n+4) { text-align: right; }
.cfg-table tr.is-bottleneck td:last-child { color: var(--danger); font-weight: 600; }
.cfg-table tr.is-bottleneck td:last-child::before { content: "Bottleneck · "; font-family: var(--font-sans); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.cfg-table .cfg-total td { font-weight: 600; color: var(--ink); border-bottom: 0; border-top: 2px solid var(--ink); }
.cfg-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.cfg-pill::before { content: ""; width: 8px; height: 8px; border-radius: 1px; background: var(--mc); border: 1px solid var(--mc-line); }
.cfg-disclaimer { font-size: 14px; color: var(--ink-muted); }

@media (max-width: 1100px) {
  .cfg { grid-template-columns: 330px 1fr; }
  /* Keep the four KPIs in one compact row so they don't cover the line */
  .cfg-kpis { top: 8px; left: 8px; right: 8px; gap: 6px; }
  .cfg-kpi { padding: 8px 10px; }
  .cfg-kpi small { font-size: 10px; letter-spacing: 0.06em; }
  .cfg-kpi strong { font-size: 18px; line-height: 24px; }
  .cfg-kpi span { font-size: 11px; }
  .cfg-detail { top: 92px; width: 320px; padding: var(--space-4); }
  .cfg-compare th, .cfg-compare td { padding: 6px 4px; }
  .cfg-legend { display: none; }
}
@media (max-width: 860px) {
  .cfg-page { display: block; height: auto; min-height: 0; max-height: none; }
  .cfg-intro { padding: var(--space-6) 0; }
  .cfg { grid-template-columns: 1fr; }
  .cfg-view { order: -1; overflow: visible; display: flex; flex-direction: column; }
  .cfg-kpis { order: -1; }
  /* Stacked layout: KPIs above the model, station details below it, nothing on top of the 3D view */
  .cfg-kpis { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 8px; }
  .cfg-stage { position: relative; inset: auto; height: 58vh; height: 58svh; min-height: 320px; max-height: 520px; overflow: hidden; }
  .cfg-detail { position: static; width: auto; max-height: none; margin: 8px; box-shadow: none; }
  .cfg-side { border-right: 0; overflow: visible; }
  .cfg-block--cta { position: static; border-top: 0; }
  .cfg-label span { display: none; }
  .cfg-label { padding: 2px; }
  .cfg-summary { grid-template-columns: 1fr; }
  .cfg-toolbar button span { display: none; }
  .cfg-toolbar button { min-width: 44px; min-height: 44px; justify-content: center; }
  .cfg-hint { display: block; position: absolute; left: 50%; top: 10px; transform: translateX(-50%); margin: 0; padding: 4px 10px; border-radius: var(--radius-md); background: rgba(255, 255, 255, 0.9); border: 1px solid var(--line); font-size: 12px; line-height: 16px; color: var(--ink-muted); white-space: nowrap; pointer-events: none; transition: opacity .4s; }
  .cfg-hint.is-hidden { opacity: 0; }
  .cfg-table th:nth-child(5), .cfg-table td:nth-child(5) { display: none; }
  .cfg-table th, .cfg-table td { padding: 8px 6px; }
}
@media (max-width: 420px) {
  .cfg-station .cfg-seg, .cfg-station .cfg-fixed { width: 156px; }
}
