/* Конструктор заказа */
.order { padding: 40px 0 96px; }
.order-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 28px; }
.order-head .h2 { font-size: clamp(28px, 3.6vw, 44px); }
.progress { list-style: none; display: flex; gap: 8px; margin: 0; padding: 0; }
.progress li {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px 8px 8px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--dim); font-size: 14px; font-weight: 600; transition: all .2s;
}
.progress li span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); font-size: 11px; }
.progress li.on { color: var(--text); border-color: var(--line-2); }
.progress li.on span { background: var(--layer); color: #06101f; }
.progress li.done span { background: var(--ok); color: #06140d; }

.builder { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 20px; align-items: start; }

/* ——— сцена ——— */
.viewer {
  position: relative; aspect-ratio: 4 / 3; border-radius: 22px; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 30%, #1b2340 0%, #10131c 62%, #0c0e15 100%);
  border: 1px solid var(--line-2);
}
.viewer canvas { width: 100%; height: 100%; touch-action: none; }
.viewer-top { position: absolute; left: 14px; right: 14px; top: 14px; display: flex; justify-content: space-between; gap: 10px; pointer-events: none; }
.viewer-top .chip { background: rgba(11, 13, 19, .7); color: var(--text); max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-top .chip:empty { display: none; }
.viewer-tools { position: absolute; right: 14px; bottom: 14px; display: flex; gap: 6px; }
.tool {
  height: 34px; min-width: 34px; padding: 0 10px; border-radius: 10px; cursor: pointer; font-size: 13px; font-weight: 600;
  background: rgba(11, 13, 19, .72); border: 1px solid var(--line-2); color: var(--muted); transition: color .15s, border-color .15s;
}
.tool:hover { color: var(--text); border-color: rgba(150, 172, 235, .45); }
.viewer-hint { position: absolute; left: 16px; bottom: 18px; margin: 0; font-size: 12.5px; color: var(--dim); pointer-events: none; }
.viewer.empty .viewer-tools, .viewer.empty .viewer-hint, .viewer.manual .viewer-tools, .viewer.manual .viewer-hint { display: none; }

.dropzone {
  position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 24px; text-align: center;
  background:
    linear-gradient(rgba(159, 180, 255, .045) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, rgba(159, 180, 255, .045) 1px, transparent 1px) 0 0 / 32px 32px;
}
.viewer.empty .dropzone { display: flex; }
.drop-icon { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; color: var(--cyan); background: rgba(63, 208, 232, .08); border: 1px dashed rgba(63, 208, 232, .45); }
.drop-icon svg { width: 34px; }
.drop-title { font: 600 20px/1.3 var(--display); margin: 6px 0 0; letter-spacing: -.01em; }
.drop-note { color: var(--muted); font-size: 14px; margin: 0 0 8px; }
.drop-samples { margin-top: 18px; display: grid; gap: 10px; justify-items: center; color: var(--dim); font-size: 13.5px; }
.drop-samples > div { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.drop-photo { color: var(--cyan); font-weight: 600; text-decoration: none; margin-top: 4px; }
.drop-photo:hover { text-decoration: underline; }
.add-tpl { display: grid; gap: 8px; justify-items: center; margin-top: 12px; color: var(--dim); font-size: 13px; }
.add-tpl > div { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.tpl-sec { background: linear-gradient(180deg, rgba(255, 159, 67, .06), transparent); }
.tpl-fields { display: grid; gap: 14px; }
.tpl-fields .hint { margin: -4px 0 0; }
.tpl-fields .field input { padding: 10px 12px; font-size: 15px; }
.mini {
  height: 32px; padding: 0 12px; border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--line-2); color: var(--muted); transition: all .15s;
}
.mini:hover { color: var(--text); border-color: var(--cyan); }

.drop-overlay {
  position: absolute; inset: 10px; border-radius: 16px; display: grid; place-items: center; pointer-events: none;
  border: 2px dashed var(--cyan); background: rgba(11, 20, 40, .82); color: var(--cyan); font-weight: 700; font-size: 18px;
  opacity: 0; transition: opacity .15s;
}
.viewer.dragging .drop-overlay { opacity: 1; }
.viewer-busy, .manual-note {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: 14px;
  background: rgba(11, 13, 19, .86); border: 1px solid var(--line-2); font-weight: 600; font-size: 14px;
}
.manual-note { flex-direction: column; text-align: center; max-width: 340px; gap: 6px; }
.manual-note span { color: var(--muted); font-weight: 500; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--cyan); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* список моделей */
.models { display: flex; gap: 10px; margin-top: 12px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.models:empty { display: none; }
.model-tab {
  position: relative; flex: 0 0 auto; display: flex; align-items: center; gap: 10px; min-width: 180px; max-width: 260px;
  padding: 10px 36px 10px 12px; border-radius: 14px; cursor: pointer; text-align: left;
  background: var(--surface); border: 1px solid var(--line); color: var(--text); transition: border-color .15s, background .15s;
}
.model-tab:hover { border-color: var(--line-2); }
.model-tab.active { border-color: var(--cyan); background: var(--surface-2); box-shadow: inset 0 0 0 1px rgba(63, 208, 232, .25); }
.model-tab .dot { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .2); }
.model-tab .meta { display: grid; min-width: 0; }
.model-tab .meta b { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.model-tab .meta span { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.model-tab .x {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border-radius: 8px;
  border: 0; background: transparent; color: var(--dim); cursor: pointer; font-size: 16px;
}
.model-tab .x:hover { color: var(--danger); background: rgba(255, 107, 107, .1); }
.model-tab.error .meta span { color: var(--danger); }

.warnings { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.warnings li {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 14px;
  background: rgba(255, 181, 71, .07); border: 1px solid rgba(255, 181, 71, .25); color: #ffd9a0;
}
.warnings li::before { content: '!'; flex: 0 0 auto; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--warn); color: #1a1006; font-weight: 800; font-size: 12px; }
.warnings li.err { background: rgba(255, 107, 107, .07); border-color: rgba(255, 107, 107, .3); color: #ffc4c4; }
.warnings li.err::before { background: var(--danger); }
.warnings button { margin-left: auto; }

/* ——— панель настроек ——— */
.panel {
  position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow-y: auto; overscroll-behavior: contain;
  border-radius: 22px; background: var(--surface); border: 1px solid var(--line-2); scrollbar-width: thin;
}
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.panel-head b { font: 600 16px/1.2 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-sec { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.sec-title { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 14.5px; margin-bottom: 12px; }
.sec-title .n { color: var(--hot); font-size: 12px; }
.sec-title.sub { margin: 16px 0 10px; font-weight: 600; font-size: 13.5px; }
.sec-title .right { margin-left: auto; font-weight: 500; font-size: 12.5px; }
.hint { color: var(--dim); font-size: 13px; margin: 10px 0 0; line-height: 1.5; }
.hint:empty { display: none; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button {
  height: 34px; padding: 0 12px; border-radius: 10px; cursor: pointer; font-size: 13.5px; font-weight: 600;
  background: var(--bg); border: 1px solid var(--line-2); color: var(--muted); transition: all .15s;
}
.chips button:hover { color: var(--text); }
.chips button[aria-checked=true] { color: var(--text); border-color: var(--cyan); background: rgba(63, 208, 232, .08); }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches button {
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer; padding: 0; position: relative;
  border: 1px solid rgba(255, 255, 255, .22); transition: transform .12s;
}
.swatches button:hover { transform: scale(1.1); }
.swatches button[aria-checked=true] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--cyan); }

.seg { display: grid; gap: 6px; }
.seg-3 { grid-template-columns: repeat(3, 1fr); }
.seg-4 { grid-template-columns: repeat(4, 1fr); }
.seg button {
  display: grid; gap: 2px; padding: 10px 8px; border-radius: 12px; cursor: pointer; text-align: center;
  background: var(--bg); border: 1px solid var(--line-2); color: var(--muted); transition: all .15s;
}
.seg button b { color: var(--text); font-size: 14px; }
.seg button small { font-size: 12px; }
.seg button[aria-checked=true] { border-color: var(--cyan); background: rgba(63, 208, 232, .08); color: var(--text); }
.seg-sm button { padding: 6px; font-weight: 700; }

.qty-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stepper { display: flex; align-items: center; height: 42px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg); overflow: hidden; }
.stepper button { width: 40px; height: 100%; border: 0; background: transparent; color: var(--muted); font-size: 20px; cursor: pointer; }
.stepper button:hover { color: var(--text); background: var(--surface-2); }
.stepper input { width: 64px; height: 100%; border: 0; background: transparent; text-align: center; font-weight: 700; font-size: 16px; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.qty-presets { display: flex; gap: 6px; }

.adv summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; font-weight: 700; font-size: 14.5px; }
.adv summary::-webkit-details-marker { display: none; }
.adv summary::before { content: '+'; color: var(--hot); font-weight: 400; font-size: 20px; line-height: 1; margin-right: -2px; }
.adv[open] summary::before { content: '−'; }
.adv summary > span:first-of-type { margin-right: auto; }
.adv summary .muted { font-weight: 500; font-size: 12.5px; text-align: right; }
.adv-body { display: grid; gap: 14px; margin-top: 16px; }
.field-row { display: grid; gap: 8px; font-size: 14px; font-weight: 600; }
.field-row > span { display: flex; justify-content: space-between; gap: 8px; }
.field-row small { display: block; font-weight: 500; font-size: 12.5px; }
.toggle-row { grid-template-columns: 1fr auto; align-items: center; }
.toggle-row > span { display: block; }
input[type=range] { width: 100%; accent-color: var(--cyan); }
.toggle { appearance: none; width: 44px; height: 26px; border-radius: 999px; background: var(--surface-3); position: relative; cursor: pointer; transition: background .15s; }
.toggle::after { content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; }
.toggle:checked { background: var(--blue); }
.toggle:checked::after { transform: translateX(18px); }
.scale-row { display: flex; gap: 6px; align-items: center; }
.scale-row input { width: 90px; height: 32px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg); font-weight: 700; }

/* расчёт */
.estimate { padding: 18px 20px 20px; background: linear-gradient(180deg, rgba(61, 123, 245, .06), transparent); }
.est-rows { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; margin: 0 0 14px; font-size: 14px; }
.est-rows:empty { display: none; }
.est-rows dt { color: var(--muted); }
.est-rows dd { margin: 0; text-align: right; font-weight: 600; }
.est-rows .sep { grid-column: 1 / -1; height: 1px; background: var(--line); margin: 4px 0; }
.est-rows .off { color: var(--ok); }
.est-total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.est-total span { color: var(--muted); font-weight: 600; font-size: 14px; }
.est-total strong { font: 700 32px/1 var(--display); letter-spacing: -.02em; white-space: nowrap; }
.w100 { width: 100%; margin-top: 16px; }
.add-more { display: block; text-align: center; margin-top: 12px; color: var(--cyan); font-weight: 600; font-size: 14px; cursor: pointer; }
.add-more:hover { text-decoration: underline; }
.add-more.off { color: var(--dim); pointer-events: none; }

/* ——— заявка ——— */
.checkout { margin-top: 56px; padding: 40px; border-radius: 26px; background: var(--surface); border: 1px solid var(--line-2); display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 48px; }
.checkout.locked { opacity: .5; pointer-events: none; filter: saturate(.6); }
.checkout-head { position: sticky; top: 100px; align-self: start; }
.checkout-head .h2 { font-size: clamp(26px, 3vw, 38px); margin-bottom: 14px; }
.lead-form { display: grid; gap: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .field:first-child { grid-column: 1 / -1; }
.field { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
.field input, .field textarea {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg);
  font-weight: 500; font-size: 15.5px; transition: border-color .15s, box-shadow .15s; resize: vertical;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(63, 208, 232, .15); }
.field.invalid input { border-color: var(--danger); }
.field small { font-weight: 500; }
.delivery { border: 0; margin: 0; padding: 0; }
.delivery legend { font-size: 14px; font-weight: 600; margin-bottom: 8px; padding: 0; }
.radio-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.radio-cards label {
  display: grid; gap: 2px; padding: 12px 14px; border-radius: 12px; cursor: pointer;
  background: var(--bg); border: 1px solid var(--line-2); transition: all .15s;
}
.radio-cards input { position: absolute; opacity: 0; pointer-events: none; }
.radio-cards b { font-size: 14.5px; }
.radio-cards small { color: var(--dim); font-size: 12.5px; }
.radio-cards label:has(input:checked) { border-color: var(--cyan); background: rgba(63, 208, 232, .07); }
.radio-cards label:has(input:focus-visible) { outline: 2px solid var(--cyan); outline-offset: 2px; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 14.5px; cursor: pointer; }
.check input { flex: 0 0 auto; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--hot); }
.check small { display: block; font-size: 13px; }
.check a { color: var(--cyan); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.summary { border-radius: 16px; border: 1px dashed var(--line-2); padding: 14px 16px; display: grid; gap: 8px; font-size: 14px; }
.summary:empty { display: none; }
.summary .row { display: flex; justify-content: space-between; gap: 12px; }
.summary .row span:first-child { color: var(--muted); min-width: 0; overflow-wrap: anywhere; }
.summary .row b { white-space: nowrap; }
.summary .total { padding-top: 8px; border-top: 1px solid var(--line); font-size: 16px; }
.summary .total b { font: 700 20px/1.2 var(--display); }

.form-error { margin: 0; padding: 12px 14px; border-radius: 12px; background: rgba(255, 107, 107, .08); border: 1px solid rgba(255, 107, 107, .3); color: #ffc4c4; font-size: 14px; }
.upload-bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.upload-bar i { display: block; height: 100%; width: 0; background: var(--layer); transition: width .2s; }
.lead-form .btn[type=submit] { justify-self: start; }

.success { grid-column: 2; display: grid; justify-items: start; gap: 12px; align-content: start; }
.success-mark { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; font-size: 28px; font-weight: 800; background: rgba(60, 207, 142, .12); color: var(--ok); border: 1px solid rgba(60, 207, 142, .4); }
.success h3 { font: 700 24px/1.2 var(--display); margin: 4px 0 0; }
.success p { color: var(--muted); margin: 0 0 8px; max-width: 520px; }

/* ——— деталь по фото ——— */
.photo-steps { grid-template-columns: repeat(3, 1fr); margin: 8px 0 0; }
.price-from { color: var(--muted); margin: 0 0 20px; }
.price-from b { color: var(--text); }
.tips { padding: 18px 20px; border-radius: 16px; background: var(--bg); border: 1px solid var(--line); font-size: 14px; }
.tips b { display: block; margin-bottom: 8px; }
.tips ul { margin: 0; padding-left: 18px; color: var(--muted); display: grid; gap: 6px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; border-radius: 14px; transition: background .15s; }
.photos.dragging { background: rgba(63, 208, 232, .08); outline: 2px dashed var(--cyan); outline-offset: 4px; }
.photo, .photo-add { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; }
.photo { background: var(--bg); border: 1px solid var(--line-2); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo .x {
  position: absolute; right: 4px; top: 4px; width: 26px; height: 26px; border-radius: 8px; border: 0; cursor: pointer;
  background: rgba(11, 13, 19, .75); color: var(--text); font-size: 16px;
}
.photo .x:hover { color: var(--danger); }
.file-tile { display: grid; place-content: center; gap: 4px; height: 100%; padding: 8px; text-align: center; }
.file-tile b { color: var(--cyan); }
.file-tile small { color: var(--dim); font-size: 11px; word-break: break-all; }
.photo-add {
  display: grid; place-content: center; justify-items: center; gap: 4px; cursor: pointer; text-align: center;
  border: 1px dashed rgba(63, 208, 232, .5); background: rgba(63, 208, 232, .05); color: var(--cyan); font-size: 13px; font-weight: 600;
}
.photo-add .plus { font-size: 26px; line-height: 1; }
.photo-add:hover { background: rgba(63, 208, 232, .1); }
.form-grid.two .field:first-child { grid-column: auto; }
.field select {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg);
  font-weight: 500; font-size: 15.5px;
}

@media (max-width: 1080px) {
  .builder { grid-template-columns: minmax(0, 1fr) 380px; }
}
@media (max-width: 900px) {
  .builder { grid-template-columns: 1fr; }
  .panel { position: static; max-height: none; }
  .order-head { flex-direction: column; align-items: start; }
  .checkout { grid-template-columns: minmax(0, 1fr); padding: 28px 22px; gap: 24px; }
  .checkout-head { position: static; }
  .success { grid-column: 1; }
}
@media (max-width: 560px) {
  .order { padding-top: 28px; }
  .progress li { padding-right: 10px; font-size: 13px; }
  .viewer { aspect-ratio: 1 / 1; border-radius: 18px; }
  .drop-title { font-size: 17px; }
  .viewer-hint { display: none; }
  .form-grid, .radio-cards, .photo-steps { grid-template-columns: 1fr; }
  .checkout { padding: 22px 16px; border-radius: 20px; }
  .lead-form .btn[type=submit] { width: 100%; }
  .est-total strong { font-size: 28px; }
}
