/* ── Конструктор МОДУЛЬНЫХ шкафов: дизайн-токены (родной брат /konstruktor) ── */
:root {
  --bg: #F5F2EC;
  --surface: #FFFFFF;
  --ink: #23211E;
  --muted: #8A857C;
  --line: #E7E1D6;
  --accent: #D95B29;
  --accent-deep: #B8481D;
  --accent-soft: #F7E4D9;
  --ok: #2E7D5B;
  --radius: 18px;
  --font-ui: "Golos Text", -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Unbounded", "Golos Text", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-ui); background: var(--bg); color: var(--ink);
  -webkit-font-smoothing: antialiased; line-height: 1.5;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img { max-width: 100%; }
a { color: inherit; }

/* ── Плавающая навигация ── */
.nav {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
  width: min(1180px, calc(100% - 24px));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px 10px 12px; border-radius: 999px;
  background: rgba(255,255,255,.82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(231,225,214,.9); box-shadow: 0 6px 30px rgba(35,33,30,.07);
  z-index: 50;
}
.nav .back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: none;
  padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); white-space: nowrap; transition: color .15s, border-color .15s;
}
.nav .back:hover { color: var(--ink); border-color: var(--muted); }
.nav .brand {
  font-family: var(--font-display); font-size: 14px; font-weight: 600; letter-spacing: .02em;
  text-align: right; line-height: 1.25;
}
.nav .brand em { font-style: normal; color: var(--accent); }
@media (max-width: 560px) {
  .nav .brand { font-size: 11.5px; max-width: 55%; }
}

/* ── Конфигуратор: сцена + панель ── */
.builder {
  width: min(1180px, calc(100% - 24px)); margin: 84px auto 0;
  display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 18px;
  align-items: start; padding-bottom: 40px;
}
.stage-wrap { position: sticky; top: 78px; align-self: start; }
.stage {
  position: relative; border-radius: calc(var(--radius) + 6px); overflow: hidden;
  background: linear-gradient(180deg, #EFEAE1 0%, #E9E3D8 74%, #DCD5C7 74%, #D2CABA 100%);
  border: 1px solid var(--line); height: min(72vh, 660px); min-height: 380px;
}
.stage canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.stage .dims { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 7px; flex-wrap: wrap; max-width: 75%; }
.dim-chip {
  font-family: var(--font-mono); font-size: 11.5px; color: var(--ink);
  background: rgba(255,255,255,.85); backdrop-filter: blur(6px);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; white-space: nowrap;
}
.stage .help-btn {
  position: absolute; top: 12px; left: 12px; z-index: 5;
  background: rgba(255,255,255,.9); backdrop-filter: blur(6px); border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 13px; font-size: 12px; font-weight: 700; color: var(--accent-deep);
  transition: all .15s;
}
.stage .help-btn:hover { border-color: var(--accent); background: #fff; }
.stage .fill-toggle {
  position: absolute; top: 12px; right: 12px;
  background: rgba(255,255,255,.88); backdrop-filter: blur(6px); border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 13px; font-size: 12px; font-weight: 600; transition: all .15s;
}
.stage .fill-toggle.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ── Панель ── */
.panel { display: flex; flex-direction: column; gap: 13px; min-width: 0; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px;
}
.card > .card-title {
  font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 12px;
}

/* цена */
.price-card .status-line { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700;
  border-radius: 999px; padding: 4px 10px; letter-spacing: .02em;
}
.badge.ok { background: #E7F3ED; color: var(--ok); }
.badge.custom { background: var(--accent-soft); color: var(--accent-deep); }
.price-big { font-family: var(--font-mono); font-size: 30px; font-weight: 700; letter-spacing: -.01em; line-height: 1.15; }
.price-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.price-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 13px; }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 999px; padding: 13px 18px; font-size: 15px; font-weight: 700;
  transition: background .15s, transform .05s; text-decoration: none; text-align: center;
}
.btn:active { transform: scale(.985); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-deep); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #000; }
.btn-ghost { background: var(--bg); color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--muted); }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* pills: высота */
.pills { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pills button {
  border-radius: 12px; padding: 9px 4px; font-size: 13.5px; font-weight: 600; color: var(--muted);
  background: var(--bg); border: 1px solid transparent; font-family: var(--font-mono);
  transition: all .15s; line-height: 1.2;
}
.pills button small { display: block; font-family: var(--font-ui); font-size: 10px; font-weight: 500; }
.pills button.on { background: var(--ink); color: #fff; }

/* цвета */
.swatches { display: flex; gap: 10px; }
.sw {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 9px 6px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface);
  font-size: 12px; font-weight: 600; color: var(--muted); transition: all .15s;
}
.sw .dot { width: 26px; height: 26px; border-radius: 50%; border: 1px solid rgba(0,0,0,.12); }
.sw.on { border-color: var(--ink); color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }

/* состав: список колонн */
.cols-list { display: flex; flex-direction: column; gap: 7px; }
.col-item {
  display: flex; align-items: center; gap: 4px; width: 100%;
  background: var(--bg); border: 1px solid var(--line); border-radius: 13px; padding: 6px 8px 6px 12px;
  transition: border-color .15s;
}
.col-item:hover { border-color: var(--muted); }
.col-item.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.col-item .col-main { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; text-align: left; padding: 4px 0; }
.col-item .col-del {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%; font-size: 18px; line-height: 1;
  color: var(--muted); background: var(--surface); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; transition: all .15s;
}
.col-item .col-del:hover { color: #B8481D; border-color: #B8481D; background: #FBECE6; }
.col-item .col-mv {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 12px; font-size: 16px; line-height: 1;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; transition: all .15s;
}
.col-item .col-mv:hover:not([disabled]) { border-color: var(--ink); }
.col-item .col-mv[disabled] { opacity: .3; pointer-events: none; }
.col-item .col-txt { min-width: 0; flex: 1; }
.col-item .col-name { display: block; }
.col-item .col-sub { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-item .w-tag {
  font-family: var(--font-mono); font-size: 12px; font-weight: 700; color: var(--accent-deep);
  background: var(--accent-soft); border-radius: 8px; padding: 3px 7px; flex-shrink: 0;
}
.col-item .col-name { font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.col-item .col-sub { font-size: 11.5px; color: var(--muted); line-height: 1.3; }
.col-item .chev { margin-left: auto; color: var(--muted); font-size: 15px; flex-shrink: 0; }
.add-row { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 9px; }
.empty-note { font-size: 13px; color: var(--muted); text-align: center; padding: 10px 0; }

/* ── Шторка / модалка ── */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(35,33,30,.42); z-index: 90;
  display: none; align-items: flex-end; justify-content: center;
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.sheet-backdrop.open { display: flex; }
.sheet {
  background: var(--surface); width: 100%; max-height: 86vh; overflow-y: auto;
  border-radius: 22px 22px 0 0; padding: 18px 16px calc(20px + env(safe-area-inset-bottom));
  animation: sheetUp .22s ease;
}
@keyframes sheetUp { from { transform: translateY(40px); opacity: .5; } to { transform: none; opacity: 1; } }
@media (min-width: 920px) {
  .sheet-backdrop { align-items: center; }
  .sheet { width: 460px; border-radius: 22px; padding: 22px; max-height: 82vh; }
}
.sheet h3 { font-family: var(--font-display); font-size: 17px; font-weight: 600; margin-bottom: 4px; }
.sheet .sheet-sub { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.sheet .sec-title {
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin: 15px 0 8px;
}
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opt-grid.one { grid-template-columns: 1fr; }
.opt {
  border: 1.5px solid var(--line); border-radius: 13px; padding: 11px 12px; text-align: left;
  background: var(--surface); transition: all .15s; display: block; width: 100%;
}
.opt:hover { border-color: var(--muted); }
.opt.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: #FFFBF8; }
.opt .opt-name { display: block; font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.opt .opt-sub { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; line-height: 1.3; }
.opt-row { display: flex; align-items: center; gap: 13px; }
.opt-ico { flex-shrink: 0; width: 27px; color: var(--accent-deep); }
.opt-ico svg { display: block; width: 100%; height: auto; }
.sheet-actions { display: flex; gap: 8px; margin-top: 17px; }
.sheet-actions .btn { flex: 1; padding: 12px 10px; font-size: 14px; }
.btn-danger { background: #FBECE6; color: #B8481D; }
.btn-danger:hover { background: #F6DCD2; }
.move-row { display: flex; gap: 8px; margin-top: 9px; }
.move-row .btn { flex: 1; padding: 10px; font-size: 13.5px; }
.sheet .close-x {
  position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 50%;
  background: var(--bg); font-size: 15px; display: flex; align-items: center; justify-content: center;
}
.sheet { position: relative; }

/* формы */
.field { margin-bottom: 11px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 5px; }
.field input {
  width: 100%; font-family: inherit; font-size: 16px; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink);
  outline: none; transition: border-color .15s;
}
.field input:focus { border-color: var(--ink); background: var(--surface); }
.field .err { display: none; font-size: 12px; color: #C33F1B; margin-top: 4px; }
.field.bad input { border-color: #C33F1B; }
.field.bad .err { display: block; }
.order-summary {
  background: var(--bg); border-radius: 12px; padding: 11px 13px; font-size: 13px; margin-bottom: 13px;
  line-height: 1.55;
}
.order-summary b { font-family: var(--font-mono); }
.form-ok { text-align: center; padding: 22px 6px; }
.form-ok .big { font-size: 38px; margin-bottom: 8px; }

/* мастер подбора */
.wiz-input-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.wiz-input-row input {
  font-family: var(--font-mono); font-size: 17px; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--bg); outline: none; width: 100%;
}
.wiz-input-row input:focus { border-color: var(--ink); background: var(--surface); }
.wiz-input-row .btn { padding: 12px 18px; font-size: 14px; }
.wiz-note { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.wiz-cards { display: flex; flex-direction: column; gap: 8px; margin-top: 13px; }
.wiz-card {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 13px; background: var(--surface);
  transition: all .15s;
}
.wiz-card:hover { border-color: var(--accent); }
.wiz-card .wc-w { font-family: var(--font-mono); font-size: 15px; font-weight: 700; color: var(--accent-deep); flex-shrink: 0; }
.wiz-card .wc-name { font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.wiz-card .wc-sub { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.wiz-card .wc-price { margin-left: auto; text-align: right; flex-shrink: 0; }
.wiz-card .wc-price .p { font-family: var(--font-mono); font-size: 14px; font-weight: 700; }
.wiz-card .wc-price .k { font-size: 10.5px; color: var(--ok); font-weight: 700; }

/* мобильный нижний бар */
.mbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: none; align-items: center; gap: 12px;
  background: rgba(255,255,255,.94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
}
.mbar .m-price { font-family: var(--font-mono); font-size: 17px; font-weight: 700; line-height: 1.1; }
.mbar .m-note { font-size: 10px; color: var(--muted); }
.mbar .btn { padding: 11px 14px; font-size: 13px; flex-shrink: 0; }
.mbar .mbar-add { padding: 11px 12px; }
.mbar #mBtn { margin-left: auto; }

/* размерные пилюли на 3D-сцене */
.dim3d-wrap { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 4; }
.dim3d {
  position: absolute; transform: translate(-50%, -50%); white-space: nowrap;
  font-family: var(--font-mono); font-size: 12px; font-weight: 700; color: var(--ink);
  background: rgba(255,255,255,.9); border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 10px; box-shadow: 0 1px 6px rgba(35,33,30,.06);
}
.dim3d.small {
  font-size: 10px; font-weight: 500; color: var(--muted); padding: 1px 7px;
  background: rgba(255,255,255,.75); box-shadow: none;
}

/* кнопка мастера на первом экране */
.wizard-cta { width: 100%; margin-top: 12px; }

/* инструкция */
.instr-step { margin-bottom: 18px; }
.instr-head { display: flex; align-items: center; gap: 9px; margin-bottom: 5px; }
.instr-n {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--accent);
  color: #fff; font-family: var(--font-mono); font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.instr-title { font-size: 14.5px; font-weight: 700; }
.instr-text { font-size: 13px; color: var(--muted); line-height: 1.5; margin-bottom: 8px; }
.instr-img {
  display: block; width: 100%; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg);
}
/* видео шага — «телефонная» рамка, целиком на любом экране: аспект как у съёмки
   (390×844), contain без обрезки, высота ограничена вьюпортом, центр по горизонтали */
video.instr-video {
  aspect-ratio: 390 / 844;
  object-fit: contain;
  width: auto; max-width: 100%;
  max-height: min(62vh, 560px);
  margin: 0 auto;
  border: 6px solid #1E1F22; border-radius: 22px;
  background: #1E1F22;
  box-shadow: 0 6px 22px rgba(0,0,0,.14);
}

/* тост */
.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%);
  background: var(--ink); color: #fff; font-size: 13.5px; border-radius: 999px; padding: 10px 18px;
  z-index: 120; opacity: 0; pointer-events: none; transition: opacity .25s; max-width: 90%;
}
.toast.show { opacity: 1; }

/* ── Мобильная вёрстка: сцена сверху, панель снизу ── */
@media (max-width: 919px) {
  .builder { display: block; margin-top: 72px; padding-bottom: 90px; }
  .stage-wrap { position: static; }
  .stage { height: 46vh; min-height: 300px; border-radius: var(--radius); }
  .panel { margin-top: 13px; }
  .mbar { display: flex; }
  .price-card { display: none; }   /* цену на телефоне держит нижний бар */
}
@media (min-width: 920px) {
  .mbar { display: none !important; }
}
