/* ========== «Создай сам» ========== */
.designer { padding: clamp(20px, 3vw, 36px) 0 clamp(64px, 8vw, 112px); }
.d-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin-bottom: 28px; }
.d-steps { list-style: none; display: flex; gap: 6px; margin: 0; padding: 4px; background: var(--paper); border-radius: 999px; }
.d-steps button { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; border-radius: 999px; padding: 8px 16px 8px 8px; font-size: 14px; font-weight: 600; color: var(--muted); transition: background .3s var(--ease), color .3s; }
.d-steps button span { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-2); font-size: 12px; transition: .3s var(--ease); }
.d-steps button:hover { color: var(--ink); }
.d-steps .is-done { color: var(--ink-2); }
.d-steps .is-done span { background: var(--sage-soft); border-color: var(--sage-soft); color: var(--ok); }
.d-steps .is-current { background: var(--ink); color: var(--paper); }
.d-steps .is-current span { background: var(--clay); border-color: var(--clay); color: #fff; }

.d-layout { display: grid; grid-template-columns: 1fr 440px; gap: 20px; align-items: start; }
.d-stage { position: sticky; top: calc(var(--header-h) + 16px); background: var(--paper); border-radius: calc(var(--radius) + 4px); padding: 20px 20px 16px; overflow: hidden; isolation: isolate; }
.d-stage::before {
  content: ''; position: absolute; inset: 0; z-index: -1; opacity: .55;
  background-image: linear-gradient(var(--bg-2) 1px, transparent 1px), linear-gradient(90deg, var(--bg-2) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse at 50% 55%, #000 30%, transparent 75%);
}
.d-stage-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 40px; }
.d-title { font-weight: 600; font-size: 15px; background: var(--bg); padding: 8px 14px; border-radius: 999px; }
.d-canvas { aspect-ratio: 760 / 600; }
.d-canvas svg { width: 100%; height: 100%; display: block; }
.d-stage-note { margin: 0; font-size: 12.5px; color: var(--muted); text-align: center; }

.d-panel { background: var(--paper); border-radius: calc(var(--radius) + 4px); display: flex; flex-direction: column; }
.d-panel-body { padding: 26px 26px 8px; }
.d-panel-head { margin-bottom: 8px; }
.d-panel-num { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--clay); }
.d-panel-head h2 { font-size: 28px; font-weight: 500; letter-spacing: -.03em; margin: 6px 0 8px; line-height: 1.1; }
.d-panel-head p { margin: 0; color: var(--muted); font-size: 14.5px; }
.d-group { padding: 20px 0; border-bottom: 1px solid var(--line); display: grid; gap: 12px; }
.d-group:last-child { border-bottom: 0; }
.d-group h3 { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.d-note { margin: 0; font-size: 13.5px; color: var(--muted); }

/* Option cards */
.d-cards { display: grid; gap: 8px; }
.d-cards--2 { grid-template-columns: 1fr 1fr; }
.d-cards--4 { grid-template-columns: repeat(4, 1fr); }
.d-card { display: flex; align-items: center; gap: 10px; text-align: left; padding: 10px 12px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--bg); min-height: 60px; transition: border-color .2s, background .2s, transform .2s var(--ease); }
.d-cards--4 .d-card { flex-direction: column; text-align: center; gap: 4px; padding: 12px 6px; }
.d-cards--4 .d-card small { display: none; }
.d-card svg { width: 34px; height: 34px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; color: var(--ink-2); }
.d-card-text { display: grid; line-height: 1.25; }
.d-card b { font-size: 14.5px; font-weight: 600; }
.d-card small { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.d-card:hover:not(:disabled) { border-color: var(--line-2); transform: translateY(-1px); }
.d-card.is-active { border-color: var(--ink); background: var(--paper); box-shadow: 0 0 0 3px rgba(29, 28, 26, .06); }
.d-card.is-active svg { color: var(--clay); }
.d-card:disabled { opacity: .45; cursor: not-allowed; }

/* Dimensions */
.d-dim { display: grid; gap: 6px; }
.d-dim + .d-dim { margin-top: 6px; }
.d-dim-head { display: flex; justify-content: space-between; align-items: center; }
.d-dim-head label { font-weight: 600; font-size: 15px; }
.d-num { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 999px; height: 40px; padding: 0 4px; background: var(--paper); }
.d-num button { width: 30px; height: 30px; border-radius: 50%; border: 0; background: transparent; font-size: 18px; color: var(--ink-2); }
.d-num button:hover { background: var(--bg-2); }
.d-num input { width: 46px; border: 0; background: transparent; text-align: right; font-weight: 700; font-size: 16px; outline: none; -moz-appearance: textfield; appearance: textfield; }
.d-num input::-webkit-inner-spin-button { -webkit-appearance: none; }
.d-num em { font-style: normal; color: var(--muted); font-size: 13px; margin: 0 6px 0 3px; }
.d-dim input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 6px; background: linear-gradient(90deg, var(--clay) var(--p), var(--bg-2) var(--p)); outline: none; margin: 8px 0 0; cursor: pointer; }
.d-dim input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; border-radius: 50%; background: var(--paper); border: 2px solid var(--clay); box-shadow: 0 2px 8px rgba(0, 0, 0, .15); cursor: grab; transition: transform .2s; }
.d-dim input[type=range]::-webkit-slider-thumb:active { transform: scale(1.12); cursor: grabbing; }
.d-dim input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--paper); border: 2px solid var(--clay); cursor: grab; }
.d-dim input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--clay-soft); }
.d-dim-scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

/* Segmented, tabs, counters */
.d-seg { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.d-seg > span { font-size: 14px; font-weight: 600; margin-right: 6px; }
.d-seg button { min-width: 48px; height: 42px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--bg); font-weight: 600; font-size: 14.5px; transition: .2s; }
.d-seg button:hover:not(:disabled) { border-color: var(--line-2); }
.d-seg button.is-active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.d-seg button:disabled { opacity: .4; cursor: not-allowed; }
.d-tabs { display: flex; gap: 4px; background: var(--bg); border-radius: 999px; padding: 4px; overflow-x: auto; scrollbar-width: none; }
.d-tabs button { flex: 1; white-space: nowrap; border: 0; background: transparent; border-radius: 999px; padding: 8px 12px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.d-tabs button.is-active { background: var(--paper); color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, .08); }
.d-counter { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.d-counter-label { display: grid; font-weight: 600; font-size: 15px; }
.d-counter-label small { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.d-counter .stepper { height: 44px; }
.d-row { display: flex; gap: 18px; flex-wrap: wrap; }

/* Door styles & swatches */
.d-styles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.d-style { display: grid; gap: 8px; justify-items: center; padding: 10px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--bg); font-size: 13.5px; font-weight: 600; transition: .2s; }
.d-style.is-active { border-color: var(--ink); background: var(--paper); }
.d-style i { width: 44px; height: 58px; border-radius: 4px; background: #D9C3A2; position: relative; }
.d-style-frame::after { content: ''; position: absolute; inset: 7px; border: 1.5px solid rgba(0, 0, 0, .18); border-radius: 2px; }
.d-style i.d-style-fluted { background-image: repeating-linear-gradient(90deg, transparent 0 4px, rgba(0, 0, 0, .12) 4px 5px); }
.d-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.d-swatch { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 8px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--bg); text-align: left; font-size: 13.5px; font-weight: 500; line-height: 1.2; transition: .2s; }
.d-swatch i { width: 30px; height: 30px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); }
.d-swatch i.is-same { background: repeating-conic-gradient(var(--line-2) 0 25%, var(--paper) 0 50%) 0 0 / 10px 10px; }
.d-swatch.is-active { border-color: var(--ink); background: var(--paper); }
.d-swatch:hover { border-color: var(--line-2); }

/* Free-layout editor */
.d-cards--3 { grid-template-columns: repeat(3, 1fr); }
.d-cards--3 .d-card { flex-direction: column; text-align: center; gap: 4px; padding: 12px 6px; }
.d-cards--3 .d-card small { font-size: 11.5px; }
.d-tools { display: flex; align-items: center; gap: 6px; }
.d-tool { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--paper); display: grid; place-items: center; transition: .2s; }
.d-tool svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.d-tool:hover:not(:disabled) { border-color: var(--ink); }
.d-tool:disabled { opacity: .35; cursor: default; }
.d-canvas.is-flat [data-cell] { transition: fill .15s; }
.d-canvas.is-flat [data-cell]:hover { fill: rgba(181, 100, 60, .07); }
.d-canvas.is-flat [data-door]:hover { fill: rgba(181, 100, 60, .1); }
.d-canvas [data-panel] { touch-action: none; }
.d-canvas [data-panel]:hover { fill: rgba(181, 100, 60, .18); }
.d-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.d-chip { border: 1.5px solid var(--line); background: var(--paper); border-radius: 999px; padding: 7px 14px; font-size: 13.5px; font-weight: 600; transition: .2s; }
.d-chip:hover { border-color: var(--ink); }
.d-chip.is-active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.d-group--soft { background: var(--bg); margin: 12px -14px 0; padding: 14px; border-radius: 16px; border: 0; }
.d-group h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.d-h3-meta { font-size: 13px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted); }
.d-sub { font-size: 13px; font-weight: 600; color: var(--muted); margin-top: 4px; }
.d-field label { display: grid; font-weight: 600; font-size: 15px; }
.d-field label small { font-weight: 400; font-size: 12px; color: var(--muted); }
.d-pick { display: grid; gap: 10px; padding: 14px; background: var(--bg); border-radius: 14px; }
.d-pick p { margin: 0; font-size: 14.5px; }
.d-warn { color: #9A4F2A; background: var(--clay-soft); padding: 8px 12px; border-radius: 10px; font-size: 13.5px !important; }
.d-empty-hint { margin: 0; padding: 18px; border: 1.5px dashed var(--line-2); border-radius: 14px; color: var(--muted); font-size: 14.5px; text-align: center; }
.d-row { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.d-row--end { justify-content: flex-end; padding-top: 4px; }
.d-seg > span { min-width: 70px; }

.d-hidden-note { margin: 14px 0 0; padding: 10px 14px; border-radius: 12px; background: #E6E3F0; color: #3F3963; font-size: 13.5px; line-height: 1.45; }
.d-hidden-note .link-btn { color: inherit; font-weight: 700; font-size: inherit; }

/* Summary */
.d-spec { margin: 0; padding: 0 0 0 18px; display: grid; gap: 6px; font-size: 14px; color: var(--ink-2); }
.d-spec li::marker { color: var(--clay); }
.d-breakdown summary { cursor: pointer; font-weight: 600; font-size: 14px; padding: 4px 0; }
.d-breakdown .summary-rows { margin-top: 10px; }

/* Footer bar */
.d-foot { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; background: var(--paper); border-top: 1px solid var(--line); border-radius: 0 0 calc(var(--radius) + 4px) calc(var(--radius) + 4px); z-index: 2; }
.d-price { display: grid; line-height: 1.1; }
.d-price small { font-size: 12px; color: var(--muted); }
.d-price b { font-size: 26px; font-weight: 500; letter-spacing: -.03em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.d-nav { display: flex; gap: 8px; }
.d-nav [data-prev] { padding: 0 20px; }
.d-reset { align-self: center; margin: 4px 0 16px; font-size: 13px; color: var(--muted); }

@media (max-width: 1100px) {
  .d-layout { grid-template-columns: 1fr 400px; }
}
@media (max-width: 960px) {
  .d-layout { grid-template-columns: 1fr; }
  .d-stage {
    position: sticky; top: var(--header-h); z-index: 3; padding: 10px 12px 6px;
    border-radius: 0 0 var(--radius) var(--radius); margin: 0 calc(-1 * clamp(16px, 4vw, 48px));
    box-shadow: 0 10px 24px -18px rgba(0, 0, 0, .3);
  }
  .d-canvas { aspect-ratio: auto; height: 34vh; }
  .d-stage-note { display: none; }
  .d-steps { width: 100%; overflow-x: auto; scrollbar-width: none; }
  .d-steps li { flex: 1; }
  .d-steps button { width: 100%; justify-content: center; padding: 8px 10px 8px 6px; }
  .d-foot { position: fixed; left: 0; right: 0; bottom: 0; border-radius: 0; box-shadow: 0 -10px 30px -18px rgba(0, 0, 0, .3); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .d-panel { padding-bottom: 76px; }
  .page-create .site-footer { padding-bottom: 100px; }
}
@media (max-width: 560px) {
  .d-cards--4 { grid-template-columns: repeat(2, 1fr); }
  .d-cards--2 { grid-template-columns: 1fr; }
  .d-cards--3 { grid-template-columns: repeat(3, 1fr); }
  .d-stage-top { flex-wrap: wrap; }
  .d-tools .btn { --h: 34px; padding: 0 12px; font-size: 13px; }
  .d-steps button { font-size: 0; gap: 0; padding: 6px; }
  .d-steps button span { font-size: 12px; }
  .d-steps .is-current { font-size: 13px; gap: 6px; padding-right: 12px; }
  .d-panel-body { padding: 20px 16px 4px; }
  .d-title { font-size: 13px; padding: 6px 12px; white-space: nowrap; }
  .d-stage-top .btn { --h: 34px; padding: 0 12px; font-size: 13px; }
  .d-panel-head h2 { font-size: 24px; }
  .d-price b { font-size: 21px; }
}
