/* LEDOM — мастер (второй вид). Изолированные стили. */
:root{--b:#2e5c8a;--b2:#3a75b5;--ln:#e3e7ee;--ln2:#d6dbe3;--mut:#6b7280;--mut2:#8892a0;--ok:#34c759}

#wizardRoot{position:fixed;inset:0;z-index:100;display:none;font-family:'Segoe UI',Tahoma,sans-serif;color:#222;overflow:hidden;pointer-events:none}
#wizardRoot.on{display:block}
#wizardRoot .rail,
#wizardRoot .trCard,
#wizardRoot .popup{pointer-events:auto}

/* Кнопка-переключатель в шапке */
#wizardToggleBtn{background:#fff !important;color:var(--b) !important;font-weight:600;border:none;border-radius:6px;padding:8px 16px;font-size:13px;cursor:pointer;transition:.15s;font-family:inherit;display:none}
#wizardToggleBtn:hover{background:#e8f1ff !important}
#wizardToggleBtn.on{background:var(--ok) !important;color:#fff !important}

/* ============================================================
   Режим мастера.
   Центр (чертёж = #itemsContainer) — рабочий и кликабельный.
   Левую и правую панели классики убираем, чтобы освободить место
   под rail и правую карточку. Шапку .panel.center скрываем,
   оставляем только itemsContainer.
   ============================================================ */
body.wiz-open .main-container{
  grid-template-columns: 1fr;
  max-width: none;
  padding-left: 84px;
  padding-right: 384px;
  padding-top: 0;
}
body.wiz-open .panel.left,
body.wiz-open .panel.right{ display:none !important; }
body.wiz-open .panel.center{
  filter: none;
  opacity: 1;
  pointer-events: auto;
  padding: 0;
  background: transparent;
  box-shadow: none;
}
body.wiz-open .panel.center .canvas-header{ display:none !important; }
body.wiz-open .panel.center #itemsContainer{ padding: 12px; }

/* ============ Rail ============ */
#wizardRoot .rail{position:absolute;left:12px;top:66px;bottom:12px;width:60px;background:#fff;border-radius:10px;box-shadow:0 2px 10px rgba(0,0,0,.08);display:flex;flex-direction:column;padding:8px 6px;gap:2px;z-index:20}
#wizardRoot .modeStack{display:none}
#wizardRoot .railSep{height:1px;background:var(--ln);margin:4px 6px}
#wizardRoot .railBtn{width:46px;height:42px;border-radius:8px;border:1.5px solid transparent;background:transparent;cursor:pointer;display:flex;align-items:center;justify-content:center;padding:9px;color:#4b5563;position:relative;transition:.12s;font-family:inherit}
#wizardRoot .railBtn:hover{background:#f4f8ff;border-color:var(--ln2);color:var(--b)}
#wizardRoot .railBtn.active{background:#e8f1ff;border-color:var(--b);color:var(--b)}
#wizardRoot .railBtn svg{width:100%;height:100%;display:block}
#wizardRoot .railBtn[data-tip]::after{content:attr(data-tip);position:absolute;left:calc(100% + 10px);top:50%;transform:translateY(-50%);background:rgba(15,23,35,.92);color:#fff;padding:6px 10px;border-radius:6px;white-space:nowrap;font-size:12px;font-weight:500;opacity:0;pointer-events:none;transition:opacity .14s;z-index:200;box-shadow:0 4px 12px rgba(0,0,0,.25)}
#wizardRoot .railBtn[data-tip]:hover::after{opacity:1}

/* Авто/ручной через классы на body */
body.wiz-open.auto #wizardRoot .railBtn[data-manual-only]{ display:none; }
body.wiz-open.ruch #wizardRoot .railBtn[data-manual-only]{ display:flex; }

/* ============ Правая карточка ============ */
#wizardRoot .trCard{position:absolute;right:12px;top:66px;width:360px;max-height:calc(100vh - 78px);background:#fff;border-radius:12px;box-shadow:0 6px 24px rgba(0,0,0,.12);z-index:25;display:flex;flex-direction:column;border:1px solid var(--ln);overflow:hidden}
#wizardRoot .trHead{padding:10px 12px;display:flex;flex-direction:column;gap:8px;flex-shrink:0}
#wizardRoot .trRow{display:flex;gap:6px;align-items:center;flex-wrap:wrap}
#wizardRoot .modeInline{display:flex;border:1.5px solid var(--ln2);border-radius:7px;overflow:hidden;flex-shrink:0}
#wizardRoot .modeInline button{border:none;background:#fff;padding:6px 12px;cursor:pointer;font-size:11px;font-weight:700;color:var(--mut);font-family:inherit;transition:.12s}
#wizardRoot .modeInline button:hover{background:#f4f8ff;color:var(--b)}
#wizardRoot .modeInline button.active{background:var(--b);color:#fff}
#wizardRoot .sizeChip{padding:6px 10px;border-radius:7px;background:#f4f8ff;border:1px solid #c5dcff;font-size:12px;color:var(--b);font-weight:700;white-space:nowrap}
#wizardRoot .sysBtn{padding:6px 10px;border-radius:7px;border:1.5px solid var(--ln2);background:#fff;cursor:pointer;font-size:11px;font-weight:600;font-family:inherit;color:#333;width:auto;white-space:nowrap;transition:.12s}
#wizardRoot .sysBtn:hover{border-color:var(--b);background:#f4f8ff}
#wizardRoot .sysBtn.save{background:#34c759;color:#fff;border-color:#34c759}
#wizardRoot .sysBtn.save:hover{background:#28a745}
#wizardRoot .sysRow{margin-left:auto;display:flex;gap:5px;flex-wrap:wrap}

/* Кнопка-картинка выхода из мастера */
#wizardRoot .exitWizardBtn{
  width:32px;height:32px;padding:5px;
  border-radius:7px;border:1.5px solid var(--ln2);
  background:#fff;cursor:pointer;color:#a33;
  display:flex;align-items:center;justify-content:center;
  flex-shrink:0;transition:.12s;font-family:inherit;
}
#wizardRoot .exitWizardBtn:hover{background:#fdecec;border-color:#a33;color:#a33}
#wizardRoot .exitWizardBtn svg{width:100%;height:100%;display:block}

/* Кнопка Заказ */
#wizardRoot .orderToggle{width:100%;padding:9px 12px;border:none;border-top:1px solid var(--ln);background:#fafbfd;cursor:pointer;display:flex;justify-content:space-between;align-items:center;font-size:13px;font-weight:700;color:#333;font-family:inherit;transition:.12s;flex-shrink:0}
#wizardRoot .orderToggle:hover{background:#f4f8ff;color:var(--b)}
#wizardRoot .orderToggle .badge{background:#e8f1ff;color:var(--b);border-radius:11px;padding:1px 8px;font-size:11px;font-weight:700;margin-left:6px}
#wizardRoot .orderToggle .arrow{font-size:11px;color:var(--mut);transition:transform .2s}
#wizardRoot .orderToggle.open .arrow{transform:rotate(180deg)}
#wizardRoot .orderBody{max-height:0;overflow:hidden;transition:max-height .3s ease;display:flex;flex-direction:column}
#wizardRoot .orderBody.open{max-height:calc(100vh - 200px);overflow-y:auto}

/* Блок изделия */
#wizardRoot .itemBlock{border-bottom:1px solid var(--ln);background:#fff}
#wizardRoot .itemBlock:last-child{border-bottom:none}
#wizardRoot .itemRow{display:flex;align-items:center;gap:6px;padding:8px 10px;cursor:pointer;transition:.12s;background:#fff}
#wizardRoot .itemRow:hover{background:#f8fbff}
#wizardRoot .itemRow.active{background:#e8f1ff}

#wizardRoot .itemRow .label{flex:1 1 auto;min-width:0;font-size:12px;font-weight:600;color:#333;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#wizardRoot .itemRow.active .label{color:var(--b)}
#wizardRoot .itemRow .label .n{flex-shrink:0;color:#333;font-weight:700;margin-right:6px}
#wizardRoot .itemRow.active .label .n{color:var(--b)}
#wizardRoot .itemRow .label .sz{flex-shrink:0;color:var(--mut);font-weight:600;font-size:11px}
#wizardRoot .itemRow.active .label .sz{color:var(--b)}
#wizardRoot .miniBtn{width:auto;flex:0 0 auto;padding:4px 8px;border-radius:6px;border:1.5px solid var(--ln2);background:#fff;cursor:pointer;font-size:10px;font-weight:700;color:var(--mut);font-family:inherit;transition:.12s;text-transform:uppercase;letter-spacing:.3px;display:inline-flex;align-items:center;gap:4px}

#wizardRoot .miniBtn:hover{border-color:var(--b);color:var(--b);background:#f4f8ff}
#wizardRoot .miniBtn.on{background:var(--b);color:#fff;border-color:var(--b)}
#wizardRoot .miniBtn .ar{font-size:8px;transition:transform .2s}
#wizardRoot .miniBtn.on .ar{transform:rotate(180deg)}
#wizardRoot .miniBtn i{font-style:normal;font-weight:800;font-size:11px;line-height:1;width:9px;text-align:center}
#wizardRoot .expand{max-height:0;overflow:hidden;transition:max-height .28s ease;background:#fafbfd;border-top:1px solid transparent}
#wizardRoot .expand.open{max-height:400px;border-top:1px solid var(--ln);overflow-y:auto}
#wizardRoot .expandInner{padding:10px 12px;font-size:11.5px;line-height:1.55;color:#333}
#wizardRoot .specList .r,#wizardRoot .sizeList .r{display:flex;justify-content:space-between;padding:3px 0;border-bottom:1px dashed #eef0f4}
#wizardRoot .specList .r:last-child,#wizardRoot .sizeList .r:last-child{border-bottom:none}
#wizardRoot .specList .r span:first-child,#wizardRoot .sizeList .r span:first-child{color:var(--mut)}
#wizardRoot .sizeList .r strong{color:var(--b)}
#wizardRoot .sizeList .r.tot{border-top:1.5px solid var(--b);border-bottom:none;margin-top:5px;padding-top:6px;font-weight:700;color:var(--b)}
#wizardRoot .addWrap{padding:10px;border-bottom:1px solid var(--ln)}
#wizardRoot .addBtn{width:100%;padding:9px;border:1.5px dashed var(--ln2);background:#fff;border-radius:7px;cursor:pointer;font-size:12px;font-weight:700;color:var(--b);font-family:inherit;transition:.12s}
#wizardRoot .addBtn:hover{border-color:var(--b);background:#f4f8ff}
#wizardRoot .totalWrap{padding:10px}
#wizardRoot .totalBtn{width:100%;padding:10px 12px;border:1.5px solid var(--b);background:#e8f1ff;border-radius:8px;cursor:pointer;font-size:13px;font-weight:700;color:var(--b);font-family:inherit;display:flex;justify-content:space-between;align-items:center;transition:.12s}
#wizardRoot .totalBtn:hover{background:#d6e7ff}
#wizardRoot .totalBtn .arrow{font-size:11px;transition:transform .2s}
#wizardRoot .totalBtn.open .arrow{transform:rotate(180deg)}
#wizardRoot .totalBody{max-height:0;overflow:hidden;transition:max-height .25s ease}
#wizardRoot .totalBody.open{max-height:420px;margin-top:8px;overflow-y:auto}
#wizardRoot .totalBody .calcRow{display:flex;justify-content:space-between;padding:4px 0;font-size:12px;border-bottom:1px dashed #eef0f4}
#wizardRoot .totalBody .calcRow:last-child{border-bottom:none}
#wizardRoot .totalBody .calcRow.totalRow{border-top:2px solid var(--b);border-bottom:none;margin-top:6px;padding-top:8px;font-size:13px;font-weight:700;color:var(--b)}
#wizardRoot .totalBody .sectTtl{font-size:10px;color:var(--mut);font-weight:700;text-transform:uppercase;letter-spacing:.4px;margin:8px 0 4px}
#wizardRoot .totalBody .sectTtl:first-child{margin-top:0}

/* ============ Попап функций ============ */
#wizardRoot .popup{position:absolute;left:82px;top:66px;width:400px;max-height:calc(100vh - 78px);background:#fff;border-radius:12px;box-shadow:0 20px 60px rgba(0,0,0,.35);border:1.5px solid var(--b);display:none;flex-direction:column;overflow:hidden;z-index:100;animation:wizPop .18s ease-out}
#wizardRoot .popup.open{display:flex}
#wizardRoot .popup[data-size="wide"]{width:480px}
#wizardRoot .popupHead{padding:12px 16px;border-bottom:1px solid var(--ln);display:flex;justify-content:space-between;align-items:center;gap:10px;flex-shrink:0}
#wizardRoot .popupHead .ttl{font-weight:700;color:var(--b);font-size:14px}
#wizardRoot .popupHead .cls{background:none;border:none;cursor:pointer;font-size:20px;color:var(--mut);width:60px;padding:0 8px;text-align:center;line-height:1;font-family:inherit}
#wizardRoot .popupBody{padding:14px 16px;overflow-y:auto}
#wizardRoot .popupFoot{padding:10px 16px;border-top:1px solid var(--ln);display:flex;gap:8px;justify-content:flex-end;background:#fafbfd;flex-shrink:0}
#wizardRoot .popupFoot button{padding:9px 18px;border-radius:8px;border:none;cursor:pointer;font-size:13px;font-weight:600;font-family:inherit}
#wizardRoot .popupFoot .pGhost{background:#f1f3f7;color:#333}
#wizardRoot .popupFoot .pPrimary{background:linear-gradient(135deg,var(--b),var(--b2));color:#fff}
@keyframes wizPop{from{opacity:0;transform:scale(.97)}to{opacity:1;transform:scale(1)}}

#wizardRoot .fRow{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:10px}
#wizardRoot .fCol{flex:1;min-width:100px}
#wizardRoot .fCol label{display:block;font-size:10px;color:var(--mut);font-weight:600;margin-bottom:3px;text-transform:uppercase;letter-spacing:.3px}
#wizardRoot .fCol label.wizRadioItem{display:flex}
#wizardRoot .fCol input,#wizardRoot .fCol select{width:100%;padding:8px 10px;border:1.5px solid var(--ln2);border-radius:7px;font-size:13px;font-family:inherit;background:#fff;color:#333}
#wizardRoot .fCol input:focus,#wizardRoot .fCol select:focus{outline:0;border-color:var(--b)}
#wizardRoot .sectTtl{font-size:10px;color:var(--mut);font-weight:700;text-transform:uppercase;letter-spacing:.4px;margin:4px 0 6px}
#wizardRoot .shapeGrid{display:grid;grid-template-columns:repeat(5,1fr);gap:5px;margin-top:2px}
#wizardRoot .shapeGrid button{padding:5px;border:2px solid transparent;background:#f8f9fa;border-radius:7px;cursor:pointer;display:flex;align-items:center;justify-content:center;aspect-ratio:1;transition:.12s}
#wizardRoot .shapeGrid button:hover{background:#e9ecef;border-color:#adb5bd}
#wizardRoot .shapeGrid button.active{background:#e3f0ff;border-color:var(--b)}
#wizardRoot .shapeGrid img,#wizardRoot .shapeGrid svg{width:26px;height:26px;object-fit:contain;display:block;color:#333}
#wizardRoot .shapeGrid button.active img,#wizardRoot .shapeGrid button.active svg{color:var(--b)}
#wizardRoot .shapeGrid polygon,#wizardRoot .shapeGrid rect{display:none}
#wizardRoot .wizInsertRow {align-items: flex-start}
#wizardRoot .wizInsertOrientation {flex: 0 0 auto}
#wizardRoot .wizRadioStack {display:flex; align-items: flex-start;flex-direction: column; gap: 6px; margin-top:13px}
#wizardRoot .wizRadioItem {display: flex; align-items: center; gap: 6px; font-size: 13px; color: #333; cursor: pointer}
#wizardRoot .wizDashBtn {width: 100%; padding: 10px;border: 1.5px dashed #c5dcff; border-radius: 7px;background: #f4f8ff; color: var(--b);font-weight: 700; font-family: inherit; font-size:12px;cursor:pointer;margin-bottom:12px}
#wizardRoot .wizDashBtn:hover { border-color: var(--b); }
@media (max-width:820px){
  body.wiz-open .main-container{ padding-left:12px; padding-right:12px; padding-top:12px; }
  #wizardRoot .trCard{left:82px;right:12px;width:auto;top:66px;max-height:calc(100vh - 78px)}
  #wizardRoot .popup{left:12px;right:12px;top:auto;bottom:12px;width:auto;max-height:70vh}
  #wizardRoot .popup[data-size="wide"]{width:auto}
}