/* ═══════════════════════════════════════════════════════════════
   LSTK Calculator — style.css
   Светлая тема · Зелёный акцент · Space Grotesk + JetBrains Mono
   Версия для index.php
   ═══════════════════════════════════════════════════════════════ */

/* ─── FONTS (уже подключены в <head> PHP файла) ──────────────── */
/* @import: 'JetBrains Mono' + 'Space Grotesk' */

/* ─── ТОКЕНЫ ─────────────────────────────────────────────────── */
:root {
  --bg:          #f2ede4;
  --bg-2:        #e9e3d8;
  --bg-3:        #dfd8cb;
  --panel:       #f5f1ea;
  --panel-2:     #edeae2;
  --panel-3:     #e6e1d8;
  --border:      #d8d2c8;
  --border-2:    #c4bdb0;
  --ink:         #1c1a16;
  --ink-dim:     #6b6357;
  --ink-faint:   #a09585;
  --accent:      oklch(0.50 0.16 155);
  --accent-glow: oklch(0.50 0.16 155 / 0.20);
  --accent-dim:  oklch(0.44 0.14 155);
  --blue:        oklch(0.50 0.16 240);
  --green:       oklch(0.50 0.16 155);
  --red:         oklch(0.50 0.20 15);
  --selection:   oklch(0.55 0.20 155);
  /* ── Два токена для текста панели — меняй здесь, применяется везде ── */
  --ui-heading: #000000;   /* заголовки секций, шапка панели, кнопки */
  --ui-label:   #000000;   /* labels в row */
  --mono: 'Roboto', ui-monospace, monospace;
  --sans: 'Roboto', system-ui, sans-serif;
  --radius: 4px;
  --radius-lg: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.12);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
html {
  /* Запрещаем браузеру масштабировать шрифты под системные настройки */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  touch-action: none;
}

/* ─── LAYOUT ─────────────────────────────────────────────────── */
#app {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100vh;
  width: 100vw;
}
@media (min-width: 1200px) {
  #app { grid-template-columns: 360px 1fr; }
}

/* ─── VIEWPORT ───────────────────────────────────────────────── */
#viewport {
  order: 2;
  position: relative;
  background: radial-gradient(ellipse at 50% 30%, #ddd7cd 0%, #ece7df 100%);
  overflow: hidden;
}
#viewport canvas { display: block; width: 100%; height: 100%; outline: none; }

/* ─── TOPBAR ─────────────────────────────────────────────────── */
#topbar {
  position: absolute;
  top: 16px; left: 16px; right: 16px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  z-index: 10;
  pointer-events: none;
}

/* Левая зона — Смета */
.topbar-left {
  flex-shrink: 0;
  pointer-events: auto;
}

/* Центральная зона — чипы (десктоп) / дропдаун (мобайл) */
.topbar-mid {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 5px;
  pointer-events: auto;
}
.topbar-mid-mobile {
  display: none; /* показывается только на мобайле */
  position: relative;
  pointer-events: auto;
}

/* Правая зона — кнопка закрыть */
.topbar-right {
  flex-shrink: 0;
  pointer-events: auto;
}

/* ─── ЧИПЫ (десктоп) ──────────────────────────────────────────── */
.chip {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 7px 11px;
  background: rgba(245,241,234,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  color: var(--ink-dim);
  cursor: pointer;
  border-radius: 20px;
  transition: all 0.15s;
  user-select: none;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}
.chip:hover { border-color: var(--border-2); color: var(--ink); }
.chip.active { color: #fff; background: var(--accent); border-color: var(--accent); box-shadow: 0 2px 10px var(--accent-glow); }

/* ─── МОБАЙЛ ДРОПДАУН ─────────────────────────────────────────── */
.view-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 7px 11px;
  background: rgba(245,241,234,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  color: var(--ink-dim);
  cursor: pointer;
  border-radius: 20px;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.view-dropdown-btn[aria-expanded="true"] {
  border-color: var(--border-2);
}
.view-dropdown-dot {
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
  display: none; /* показывается когда Размеры включены */
}
.view-dropdown-dot.visible { display: block; }
.view-dropdown-label { color: var(--ink); font-weight: 500; }
.view-dropdown-chevron {
  opacity: 0.55;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.view-dropdown-btn[aria-expanded="true"] .view-dropdown-chevron {
  transform: rotate(180deg);
}

/* Попover */
.view-dropdown-popover {
  display: none;
  flex-direction: column;
  gap: 3px;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 155px;
  background: rgba(245,241,234,0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  padding: 5px;
  box-shadow: var(--shadow);
  z-index: 20;
}
.view-dropdown-popover.open { display: flex; }

.view-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 12px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
  border-radius: 20px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  text-align: left;
  width: 100%;
  transition: background 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.view-dropdown-item:hover { background: rgba(0,0,0,0.04); }
.view-dropdown-item--selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent-dim);
}
.view-dropdown-item--selected:hover { background: var(--accent-dim); }
.view-dropdown-item--toggle.is-on {
  background: var(--accent-glow);
  color: var(--accent-dim);
  border-color: oklch(0.50 0.16 155 / 0.35);
}

.view-dropdown-check {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.35;
}
.view-dropdown-item--selected .view-dropdown-check { opacity: 1; }
.view-dropdown-check-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: none;
}
.view-dropdown-item--selected .view-dropdown-check-dot { display: block; }

.view-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 2px 0;
}
.view-dropdown-badge {
  font-size: 8px;
  letter-spacing: 0.08em;
  opacity: 0.65;
}

/* ─── EMBED CLOSE BUTTON ─────────────────────────────────────── */
.embed-close-btn {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 7px 11px;
  border-radius: 20px;
  border: 1px solid rgba(180, 60, 40, 0.5);
  background: rgba(140, 30, 15, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #fff;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s;
  flex-shrink: 0;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.embed-close-btn:hover { background: rgba(170, 40, 20, 0.98); }
body.embed-mode.is-fullscreen .embed-close-btn { display: flex; }

/* ─── HUD ────────────────────────────────────────────────────── */
#hud {
  position: absolute;
  bottom: 20px; left: 20px;
  z-index: 10;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  background: rgba(245,241,234,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: var(--radius-lg);
  pointer-events: none;
  line-height: 1.8;
  box-shadow: var(--shadow-sm);
}
#hud b { color: var(--ink); font-weight: 600; }
#hud .k { color: var(--accent); }
#hud #hud-w, #hud #hud-h, #hud #hud-d, #hud #hud-area, #hud #hud-volume {
  color: var(--ink);
}

/* ─── EDIT MODE ──────────────────────────────────────────────── */
/* ─── BRAND BAR ──────────────────────────────────────────────── */
.brand-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 6;
  text-decoration: none;
  transition: background 0.15s;
  flex-shrink: 0;
}
.brand-bar:hover { background: var(--panel-2); }
.brand-bar__logo {
  height: 32px;
  width: auto;
  display: block;
  object-fit: contain;
}
/* Скрываем бренд-блок в embed-режиме */
/*body.embed-mode .brand-bar { display: none; }*/

/* ─── SITE LINK (в success-модалах, только standalone) ───────── */
.order-success-site-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border-2);
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 12px;
  font-family: var(--mono);
  letter-spacing: 0.04em;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.order-success-site-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}
body.embed-mode .order-success-site-link { display: none; }

/* ─── SIDE PANEL ─────────────────────────────────────────────── */
#panel {
  order: 1;
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}
#panel::-webkit-scrollbar { width: 4px; }
#panel::-webkit-scrollbar-track { background: transparent; }
#panel::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 4px; }

.panel-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-header h1 {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ui-heading);
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-header h1 b { color: var(--accent); font-weight: 700; }

/* ─── SECTIONS ───────────────────────────────────────────────── */
.section { border-bottom: 1px solid var(--border); animation: fadeSlide 0.3s both; }
/* Когда f2/b2f2 включён — f1/b2f1 не нужна нижняя граница (один визуальный блок) */
@media (min-width: 901px) {
  .section[data-section="f1"].f2-active   { border-bottom: none; }
  .section[data-section="b2f1"].b2f2-active { border-bottom: none; }
}
.section:nth-child(1) { animation-delay: 0.04s; }
.section:nth-child(2) { animation-delay: 0.08s; }
.section:nth-child(3) { animation-delay: 0.12s; }
.section:nth-child(4) { animation-delay: 0.16s; }
.section:nth-child(5) { animation-delay: 0.20s; }
.section:nth-child(6) { animation-delay: 0.24s; }
.section:nth-child(7) { animation-delay: 0.28s; }
.section:nth-child(8) { animation-delay: 0.32s; }
@keyframes fadeSlide { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }

.section-head {
  padding: 13px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s;
  position: relative;
}
.section-head:hover { background: rgba(0,0,0,0.018); }
.section-head::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 2px; height: 14px;
  background: var(--accent);
  opacity: 0.35;
  border-radius: 2px;
}
.section-head h2 {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ui-heading);
}
.wz-comp-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ui-heading);
  margin-bottom: 5px;
  margin-top: 20px;
}

.section-body { padding: 4px 20px 18px; }

/* ─── ROWS & CONTROLS ────────────────────────────────────────── */
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}
.row label {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ui-label);
  min-width: 58px;
}
.row .ctrl { flex: 1; display: flex; align-items: center; gap: 8px; }

/* Slider */
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  flex: 1;
  height: 3px;
  background: var(--border-2);
  outline: none;
  cursor: pointer;
  border-radius: 2px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px;
  background: var(--accent);
  border-radius: 50%;
  cursor: grab;
  box-shadow: 0 0 0 3px var(--accent-glow), 0 2px 4px rgba(0,0,0,0.2);
  transition: box-shadow 0.15s, transform 0.1s;
}
input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.15); }
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  cursor: grab;
}

/* Number input */
input[type="number"] {
  font-family: var(--mono);
  font-size: 11px;
  border: 1px solid var(--border-2);
  color: var(--ink);
  padding: 6px 8px;
  width: 64px;
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="number"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { opacity: 0.4; margin-left: 4px; }

select {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--panel-3);
  border: 1px solid var(--border-2);
  color: var(--ink);
  padding: 7px 10px;
  width: 100%;
  border-radius: var(--radius);
  outline: none;
  cursor: pointer;
}

/* ─── BUTTONS ────────────────────────────────────────────────── */
.btn {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 10px 10px;
  background: var(--panel-3);
  border: 1px solid var(--border-2);
  color: var(--ui-heading);
  cursor: pointer;
  border-radius: var(--radius);
  transition: all 0.15s;
  text-align: center;
  user-select: none;
}
.btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }
.btn.active { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 2px 8px var(--accent-glow); }
.btn.active:hover { background: var(--accent-dim); border-color: var(--accent-dim); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-dim); border-color: var(--accent-dim); color: #fff; }
.btn.danger:hover { border-color: var(--red); color: var(--red); }

/* ─── MATERIAL BUTTON (профлист / сэндвич) ───────────────── */
.btn--mat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 6px 8px;
  min-height: 84px;
}
.btn--mat svg {
  display: block;
  width: 52px;
  height: 52px;
  flex-shrink: 0;
}
.btn--mat .btn-mat-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  line-height: 1.2;
  text-align: center;
}

.btn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 5px;
  margin-top: 8px;
}
.btn-grid--comp {
  grid-template-columns: repeat(4, 1fr);
}

.btn-grid--comp .btn--mat {
  background-color: #717d71;
  color: #fff;
}

.btn-grid--comp .btn--mat:hover {
  background-color: #007c36;
  color: #fff;
}

/* Segmented button */
.btn-group {
  display: flex;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  overflow: hidden;
}
.btn-seg {
  flex: 1;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 9px 6px;
  background: var(--panel-3);
  color: var(--ui-label);
  cursor: pointer;
  text-align: center;
  user-select: none;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  border-right: 1px solid var(--border-2);
}
.btn-seg:last-child { border-right: none; }
.btn-seg:hover { background: var(--panel-2); color: var(--ui-heading); }
.btn-seg.active { background: var(--accent-glow); color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }

/* Toggle */
.toggle {
  position: relative;
  width: 38px; height: 20px;
  background: var(--panel-3);
  border: 1px solid var(--border-2);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: var(--ink-faint);
  border-radius: 50%;
  transition: all 0.2s;
}
.toggle.on { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }
.toggle.on::after { left: 20px; background: #fff; }

/* ─── COLOR SWATCHES ─────────────────────────────────────────── */
.swatches { display: none; }
.swatch   { display: none; }

/* ─── COLOR GRID ─────────────────────────────────────────────── */
.color-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 8px;
}
.color-grid-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.color-trigger {
  width: 100%;
  height: 72px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
  outline: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
  position: relative;
  overflow: visible;
}
.color-swatch-footer {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 4px 5px;
  background: var(--accent);
  pointer-events: none;
  user-select: none;
  flex-shrink: 0;
  position: absolute;
  bottom: -2px;
  left: -2px;
  right: -2px;
  border-radius: 0 0 var(--radius) var(--radius);
}
.color-swatch-name {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.70);
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.color-swatch-ral {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.95);
  line-height: 1;
}
.color-trigger:hover { transform: scale(1.05); z-index: 1; box-shadow: 0 4px 12px rgba(0,0,0,0.25); }
.color-trigger.active-picker { box-shadow: 0 4px 16px rgba(0,0,0,0.3); }

/* ─── RAL PICKER ─────────────────────────────────────────────── */
#ral-picker {
  z-index: 200;
  background: var(--panel);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 12px;
  width: 290px;
  max-height: 420px;
  overflow-y: auto;
}
#ral-picker::-webkit-scrollbar { width: 4px; }
#ral-picker::-webkit-scrollbar-track { background: var(--panel); }
#ral-picker::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 4px; }

#ral-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
#ral-picker-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ui-heading);
}
#ral-picker-close {
  font-family: var(--mono);
  font-size: 11px;
  background: none;
  border: 1px solid var(--border-2);
  color: var(--ui-label);
  cursor: pointer;
  border-radius: var(--radius);
  padding: 2px 7px;
  transition: color 0.15s, border-color 0.15s;
  line-height: 1.4;
}
#ral-picker-close:hover { color: var(--red); border-color: var(--red); }

#ral-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
}
@media (max-width: 520px) {
  #ral-grid { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); }
  #ral-picker { width: calc(100vw - 32px); max-width: 340px; }
}

.ral-swatch {
  position: relative;
  aspect-ratio: 1;
  border-radius: 4px;
  border: 2px solid transparent;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.12s, border-color 0.12s;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.ral-swatch:hover { transform: scale(1.08); z-index: 1; border-color: var(--ink); }
.ral-swatch.active { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.ral-swatch .ral-code {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: inherit;
  background: rgba(0,0,0,0.38);
  width: 100%;
  text-align: center;
  padding: 2px 1px 3px;
  line-height: 1;
  user-select: none;
}

/* ─── COMPONENT LIST ─────────────────────────────────────────── */
.component-list { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.component-item {
  display: flex;
  flex-direction: column;
  background: var(--panel-3);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  transition: all 0.15s;
}
.component-item .item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  cursor: pointer;
  gap: 6px;
}

.component-item:hover { border-color: var(--border-2); }
.component-item.selected { border-color: var(--selection); background: oklch(0.55 0.20 155 / 0.07); }
.component-item .type { color: var(--accent); font-weight: 600; text-transform: uppercase; font-size: 9px; }
.component-item.selected .type { color: var(--selection); }
.component-item .meta { color: var(--ui-label); flex: 1; font-size: 9px; }
.component-item .item-head-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.component-item .x,
.component-item .edit-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: all 0.15s;
}
.component-item .x { color: #5a5956; }
.component-item .x:hover { color: var(--red); background: oklch(0.50 0.20 15 / 0.12); }
.component-item .edit-toggle { color: #5a5956; }
.component-item .edit-toggle:hover { color: oklch(0.65 0.20 145); background: oklch(0.55 0.20 145 / 0.12); }
.component-item .edit-toggle.is-open { color: oklch(0.60 0.18 145); }
.component-item .item-body { display: none; padding: 8px 10px 10px; border-top: 1px solid var(--border); }
.component-item.expanded .item-body { display: block; }

.empty { font-family: var(--mono); font-size: 9px; color: var(--ui-label); padding: 10px 0; letter-spacing: 0.05em; }
.num-display { font-family: var(--mono); font-size: 11px; color: var(--ink); min-width: 50px; text-align: right; }
.num-display .unit { color: var(--ui-label); font-size: 9px; margin-left: 2px; }

/* Sandwich-опции */
#wall-sandwich-options,
#roof-sandwich-options {
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--panel-2);
  margin-top: 8px;
}

/* ─── FOOTER ─────────────────────────────────────────────────── */
#panel > div:last-child {
  padding: 14px 20px;
  color: var(--ui-label);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  text-align: center;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

/* ─── STATS OVERLAY ──────────────────────────────────────────── */
#stats-toggle-btn {
  position: static;
  transform: none;
  z-index: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #1a1a1a;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid #1a1a1a;
  border-radius: 20px;
  color: #ffffff;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  user-select: none;
  transition: all 0.18s;
  box-shadow: var(--shadow-sm);
  pointer-events: auto;
  margin-right: auto;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
#stats-toggle-btn:focus { outline: none; }
#stats-toggle-btn:hover { background: #333; border-color: #333; color: #fff; }
#stats-toggle-btn.stats-toggle-btn--active { background: #1a1a1a; border-color: #1a1a1a; color: #fff; }

.stats-btn-icon { display: none; }
.stats-btn-label { text-transform: uppercase; font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: 0.06em; pointer-events: none; }
.stats-btn-label * { pointer-events: none; }
.stats-btn-chevron { pointer-events: none; opacity: 0.7; flex-shrink: 0; transition: transform 0.22s ease; }
#stats-toggle-btn.stats-toggle-btn--active .stats-btn-chevron { transform: rotate(180deg); }

/* BYN currency icon */
.byn-text {
  font-family: var(--mono);
  font-size: 0.72em;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: currentColor;
  margin-left: 3px;
  vertical-align: baseline;
  opacity: 0.8;
}

/* Larger in toggle button */
#stats-toggle-btn .byn-text {
  font-size: 0.78em;
}

#stats-card {
  position: fixed;
  top: 0; left: 0; transform: none;
  z-index: 200;
  width: 320px;
  max-width: calc(100vw - 32px);
  background: rgba(245,241,234,0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  pointer-events: none;
  transition: max-height 0.28s cubic-bezier(0.4,0,0.2,1), opacity 0.22s ease;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
#stats-card.stats-card--open {
  max-height: 80vh;
  opacity: 1;
  pointer-events: auto;
}
#stats-card .stats-header {
  flex-shrink: 0;
}
#stats-card .stats-body {
  overflow-y: auto;
  overscroll-behavior: contain;
}
#stats-card .stats-body::-webkit-scrollbar { width: 3px; }
#stats-card .stats-body::-webkit-scrollbar-track { background: transparent; }
#stats-card .stats-body::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
.stats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--border);
}
.stats-title {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink);
}
.stats-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
  padding: 0;
}
.stats-close-btn:hover { background: var(--bg-3); color: var(--ink); }
.stats-deduct {
  font-family: var(--mono);
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 10px;
  border: 1px solid var(--border-2);
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
  transition: all 0.15s;
}
.stats-deduct:hover { border-color: var(--border-2); color: var(--ink-dim); }
.stats-deduct.stats-deduct--on { background: var(--accent-glow); border-color: var(--accent); color: var(--accent); }
.stats-group { padding: 6px 0 4px; border-bottom: 1px solid var(--border); }
.stats-group:last-child { border-bottom: none; }
.stats-group-label { padding: 2px 12px 4px; font-family: var(--sans); font-size: 9.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); }
.stats-row { display: flex; align-items: baseline; padding: 3px 12px; gap: 0; }
.stats-name { font-family: var(--sans); font-size: 11.5px; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1 1 0; min-width: 0; margin-right: 6px; }
.stats-val { font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--ink-dim); white-space: nowrap; flex: 0 0 60px; text-align: right; }
.stats-row--total { border-top: 1px solid var(--border); margin-top: 2px; padding-top: 4px; }
.stats-row--total .stats-name { font-weight: 600; color: var(--ink-dim); }
.stats-row--total .stats-val  { font-weight: 700; color: var(--ink-dim); }
.stats-row--placeholder { opacity: 0.45; pointer-events: none; }
.stats-name--placeholder { font-style: italic; }

/* Cost column */
.stats-cost {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  flex: 0 0 54px;
  text-align: left;
  margin-left: 16px;
}
.stats-cost--total {
  font-weight: 700;
  font-size: 12px;
  color: var(--accent);
}
.stats-col-header {
  display: flex;
  align-items: baseline;
  padding: 6px 12px 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}
.stats-col-hdr-val,
.stats-col-hdr-cost {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.stats-col-hdr-val  { flex: 0 0 60px; text-align: right; margin-left: auto; }
.stats-col-hdr-cost { flex: 0 0 54px; text-align: left; margin-left: 16px; }
/* Grand total block */
.stats-grand-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 12px;
  background: var(--ink);
  border-radius: 0;
  margin-top: 8px;
  flex-shrink: 0;
}
.stats-grand-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
}
.stats-grand-value {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
}

/* Кнопки "Консультация" + "Оформить заказ" в смете — продолжают чёрный фон */
.stats-order-row {
  background: var(--ink);
  border-radius: 0 0 6px 6px;
  padding: 0 12px 14px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stats-order-btn {
  display: block;
  width: 100%;
  min-height: 52px;
  background: #FF9900;
  color: #111;
  border: none;
  border-radius: var(--radius);
  padding: 10px 16px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s;
}
.stats-order-btn:hover { background: #e68a00; }

/* Backdrop для закрытия сметы по клику вне */
#stats-backdrop {
  position: fixed;
  inset: 0;
  z-index: 199;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.22s ease;
}
#stats-backdrop.stats-backdrop--open {
  pointer-events: auto;
  opacity: 1;
}

/* ─── COMPONENT OVERLAY ──────────────────────────────────────── */
#component-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 8;
}
.comp-delete-btn {
  position: absolute;
  /* width/height set dynamically by JS based on camera distance */
  border-radius: 50%;
  background: #ab0000;
  border: 2px solid #fff;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  transition: background 0.15s, transform 0.15s;
  user-select: none;
  line-height: 0; padding: 0;
}
.comp-delete-btn svg { display: block; }
.comp-delete-btn:hover { background: var(--red); transform: translate(-50%, -50%) scale(1.15); }

.comp-move-handle {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0.92;
  color: var(--selection);
}

/* ─── ПРОМЕЖУТОЧНАЯ ПАНЕЛЬ (751px – 1199px, ширина 240px) ───── */
/* Адаптивные текстовые метки: по умолчанию — полный текст */
.lbl-short { display: none; }
.lbl-full  { display: inline; }

  #f1-comp-label,
  .wizard-slide[data-slide="comp"] .section-body > .wz-comp-label,
  .wizard-slide[data-slide="comp-b2"] #b2-comp-section-inner > .wz-comp-label {
    margin-top: 8px;
  }

@media (min-width: 751px) and (max-width: 1199px) {
  .section-head              { padding: 11px 12px; }
  .section-body              { padding: 4px 12px 14px; }
  .row                       { gap: 6px; }
  .btn-grid                  { gap: 4px; }
  .panel-header              { padding: 14px 12px 10px; }

  /* Материальные кнопки — уменьшаем иконку и высоту */
  .btn--mat                  { min-height: 68px; padding: 7px 4px 6px; gap: 4px; }
  .btn--mat svg              { width: 36px; height: 36px; }
  .btn--mat .btn-mat-label   { font-size: 9px; letter-spacing: 0.08em; }

  /* Обычные кнопки — чуть меньше padding */
  .btn                       { padding: 8px 6px; }

  /* Числовые инпуты */
  .num-input                 { width: 44px; font-size: 10px; padding: 4px 5px; }
  .num-display               { min-width: 40px; font-size: 10px; }

  /* Label в rows */
  .row label                 { font-size: 9px; min-width: 46px; letter-spacing: 0.08em; }

  /* Тогл «Добавить корпус 2» — инлайн padding перебиваем через ID */
  #b2-toggle-row-desktop     { padding: 10px 12px !important; }

  /* Сокращённые метки на узкой панели 280px */
  .lbl-full                  { display: none; }
  .lbl-short                 { display: inline; }

  /* item-body (редактор элемента/навеса внутри карточки) — вписываем в 280px */
  .component-item .item-body { padding: 8px 8px 10px; }
  .component-item .item-body .row { gap: 6px; }
  .component-item .item-body .row label { min-width: 46px; }
  .component-item .item-body input[type="number"],
  .component-item .item-body input[type="text"]  { width: 48px; font-size: 10px; padding: 4px 5px; }
}

/* ─── МОБИЛЬНЫЙ WIZARD ───────────────────────────────────────── */

@media (max-width: 750px) {

  /* #app — строго вписываем в видимый viewport */
  #app {
    display: flex;
    flex-direction: column;
    grid-template-columns: unset;
    height: 100svh; /* small viewport height — без адресной строки */
    height: 100vh;  /* fallback */
    max-height: 100vh;
    overflow: hidden;
  }

  /* Viewport занимает оставшееся пространство над wizard */
  #viewport {
    order: 1;
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
  }

  /* #panel — фиксированная высота в px, overflow убран отсюда */
  #panel {
    order: 2;
    position: relative;
    flex: 0 0 420px;
    height: 420px;
    max-height: 420px;
    width: 100%;
    border-right: none;
    border-top: none;
    border-radius: 0;
    overflow: visible;
    display: flex;
    flex-direction: column;
    transform: none !important;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.08);
    font-size: 16px;
    -webkit-text-size-adjust: none;
    text-size-adjust: none;
  }

  /* Шапка wizard — название слайда */
  .panel-header {
    padding: 0 12px;
    height: 40px;
    min-height: 40px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    position: relative;
    background: var(--ink);
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }
  /* Заголовок — название текущей секции */
  .panel-header h1 {
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.75);
    line-height: 1;
  }
  .panel-header h1 b { display: none; }

  /* Счётчик шагов справа */
  .wizard-step-counter {
    font-family: var(--mono);
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.70);
    flex-shrink: 0;
  }

  /* Контейнер слайдов — clip здесь, не на #panel */
  .wizard-slides-viewport {
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
    position: relative;
  }

  /* Трек — горизонтальная полоса из слайдов.
     visibility:hidden до первого render() — JS снимает его. */
  .wizard-slides-track {
    display: flex;
    height: 100%;
    will-change: transform;
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    visibility: hidden;
  }
  .wizard-slides-track.wz-ready { visibility: visible; }

  /* Каждый слайд — JS выставляет width inline через render() */
  .wizard-slide {
    flex-shrink: 0;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }
  .wizard-slide::-webkit-scrollbar { display: none; }

  /* Слайдеры внутри wizard: браузер не перехватывает touch сам —
     JS-обработчик решает: вертикаль → скролл, горизонталь → слайдер */
  .wizard-slide input[type="range"] { touch-action: none; }

  /* Секции внутри трека — всегда видны, без collapse */
  .section {
    display: block !important;
    border-bottom: none;
    animation: none;
  }
  .section .section-head { display: none; }
  .section .section-body {
    display: block !important;
    padding-top: 0;
  }

  /* Нижняя навигация — flex-item внутри #panel, всегда последний */
  .wizard-nav {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    height: 40px; min-height: 40px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    border-top: 1px solid rgba(255,255,255,0.08);
    background: var(--ink);
    width: 100%;
  }
  .wizard-nav-btn {
    height: 30px;
    padding: 0 12px;
    background: var(--accent);
    border: none;
    border-radius: 999px;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.03em;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    white-space: nowrap;
    transition: background 0.15s, opacity 0.15s;
    flex-shrink: 0;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }
  .wizard-nav-btn:active:not([disabled]) {
    background: var(--accent-glow);
  }
  .wizard-nav-btn[disabled] { opacity: 0.25; pointer-events: none; }

  .wizard-dots {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    overflow: hidden;
  }
  .wizard-dot {
    width: 5px; height: 5px;
    border-radius: 50%;
    background: rgba(255,255,255,0.28);
    transition: width 0.22s, background 0.22s, border-radius 0.22s;
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
  }
  .wizard-dot.active {
    background: var(--accent);
    width: 16px;
    border-radius: 3px;
  }

  /* Topbar компактный */
  #topbar { left: 10px; right: 10px; top: 10px; }

  /* Чипы прячем — показываем дропдаун */
  .topbar-mid { display: none; }
  .topbar-mid-mobile {
    display: block;
    margin-left: auto;
  }

  /* На мобайле у кнопки закрыть — только иконка, текст скрываем */
  .embed-close-label { display: none; }

  /* HUD скрыт на мобайле, показывается по кнопке "Параметры" */
  #hud { display: none; font-size: 9px; padding: 8px 10px; bottom: 62px; }
  #hud.show { display: block; }

  .desktop-only { display: none; }
  #wizard-counter { display: block; }

  /* Кнопка "Параметры" в шапке wizard */
  .panel-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
  }
  .hud-toggle-btn {
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 2px 8px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 20px;
    color: rgba(255,255,255,0.65);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    -webkit-tap-highlight-color: transparent;
  }
  .hud-toggle-btn.active {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--accent);
  }

  /* Навигация wizard — дубль удалён, стили выше */

  /* ── Единый горизонтальный отступ для всего контента слайда ── */
  .wizard-slide .section-body {
    padding: 6px 14px 10px;
  }

  /* Rows: горизонтальный padding убран — наследуется от section-body */
  .wizard-slide .row { padding: 6px 0; gap: 8px; }
  .wizard-slide .row label {
    font-size: 9px;
    letter-spacing: 0.1em;
    min-width: 52px;
  }
  .wizard-slide input[type="range"] { height: 3px; }
  .wizard-slide .num-input {
    font-size: 11px;
    padding: 4px 6px;
    width: 52px;
  }

  /* Грид кнопок — горизонтальный padding от родителя, auto-fill по 80px */
  .wizard-slide .btn-grid {
    padding: 4px 0 2px;
    gap: 6px;
    grid-template-columns: repeat(auto-fill, 80px);
    justify-content: start;
  }

  /* Все кнопки в слайдах — строго 80×80 */
  .wizard-slide .btn-grid .btn {
    width: 80px;
    height: 80px;
    font-size: 8px;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    letter-spacing: 0.08em;
  }

  .wizard-slide #slab-thickness-group .btn,
  .wizard-slide #pile-depth-group .btn {
    height: 30px;
    font-size: 9px;
  }

  /* Материальные кнопки (со SVG) */
  .wizard-slide .btn-grid .btn--mat {
    width: 80px;
    height: 80px;
    min-height: unset;
    padding: 6px 4px 5px;
    gap: 4px;
  }
  .wizard-slide .btn-grid .btn--mat svg {
    width: 38px;
    height: 38px;
  }
  .wizard-slide .btn-grid .btn--mat .btn-mat-label {
    font-size: 8px;
    letter-spacing: 0.07em;
  }

  /* Roof Buttons */

  .wizard-slide[data-slide="roof"]:has(.roof-building-col--b2:not([style*="display: none"])) .btn {
      height: 70px;
      width: 70px;
      font-size: 7px;
  }

  .wizard-slide[data-slide="roof"]:has(.roof-building-col--b2:not([style*="display:none"])) .btn svg {
      width: 30px;
      height: 30px;
  }

  /* ── Слайды «Элементы» и «Элементы · Корпус 2»: двухколоночный layout ── */

  .wizard-slide[data-slide="comp"] .wz-comp-row,
  .wizard-slide[data-slide="comp-b2"] .wz-comp-row {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
  }

  .wizard-slide[data-slide="comp"] .wz-comp-buttons,
  .wizard-slide[data-slide="comp-b2"] .wz-comp-buttons {
    flex-shrink: 0;
  }

  /* Кнопки внутри comp-слайдов — 60×60, 2 в ряд */
  .wizard-slide[data-slide="comp"] .btn-grid.btn-grid--comp,
  .wizard-slide[data-slide="comp-b2"] .btn-grid.btn-grid--comp {
    grid-template-columns: repeat(2, 56px);
    gap: 6px;
    padding: 0;
  }
  .wizard-slide[data-slide="comp"] .btn-grid.btn-grid--comp .btn--mat,
  .wizard-slide[data-slide="comp-b2"] .btn-grid.btn-grid--comp .btn--mat {
    width: 56px;
    height: 56px;
    padding: 5px 3px 4px;
    gap: 3px;
  }
  .wizard-slide[data-slide="comp"] .btn-grid.btn-grid--comp .btn--mat svg,
  .wizard-slide[data-slide="comp-b2"] .btn-grid.btn-grid--comp .btn--mat svg {
    width: 32px;
    height: 32px;
  }
  .wizard-slide[data-slide="comp"] .btn-grid.btn-grid--comp .btn--mat .btn-mat-label,
  .wizard-slide[data-slide="comp-b2"] .btn-grid.btn-grid--comp .btn--mat .btn-mat-label {
    font-size: 8px;
    letter-spacing: 0.07em;
  }

  /* Правая колонка — остаток ширины, max-height = 2×60 + gap */
  .wizard-slide[data-slide="comp"] .wz-comp-list-col,
  .wizard-slide[data-slide="comp-b2"] .wz-comp-list-col {
    flex: 1 1 0;
    min-width: 0;
    max-height: calc(56px * 2 + 14px);
    overflow-y: auto;
    overflow-x: hidden;
  }
  .wizard-slide[data-slide="comp"] .wz-comp-list-col::-webkit-scrollbar,
  .wizard-slide[data-slide="comp-b2"] .wz-comp-list-col::-webkit-scrollbar { width: 3px; }
  .wizard-slide[data-slide="comp"] .wz-comp-list-col::-webkit-scrollbar-track,
  .wizard-slide[data-slide="comp-b2"] .wz-comp-list-col::-webkit-scrollbar-track { background: transparent; }
  .wizard-slide[data-slide="comp"] .wz-comp-list-col::-webkit-scrollbar-thumb,
  .wizard-slide[data-slide="comp-b2"] .wz-comp-list-col::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
  .wizard-slide[data-slide="comp"] .wz-comp-list-col .component-list,
  .wizard-slide[data-slide="comp-b2"] .wz-comp-list-col .component-list { margin-top: 8px; gap: 5px;}

  /* Один этаж на слайде — список тянется до низа слайда */
  .wizard-slide.wz-single-floor {
    display: flex;
    flex-direction: column;
    overflow-y: hidden;
  }
  .wizard-slide.wz-single-floor .section,
  .wizard-slide.wz-single-floor .section-body {
    display: flex !important;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
  }
  .wizard-slide.wz-single-floor .wz-comp-row {
    flex: 1 1 0;
    min-height: 0;
    align-items: stretch;
  }
  .wizard-slide.wz-single-floor .wz-comp-list-col {
    max-height: none;
    flex: 1 1 0;
  }

  /* Color grid в wizard — фиксированная высота */
  .wizard-slide .color-grid {
    gap: 5px;
  }
  .wizard-slide .color-trigger {
    width: 100%;
    height: 72px;
  }
  .wizard-slide .color-grid-item {
    align-items: stretch;
  }

  .wz-comp-list-col .component-item .item-head {
    padding: 3px 8px;
  }

}

/* ─── СКРЫТЫЕ ПОЛЯ ───────────────────────────────────────────── */
input[type="file"] { display: none; }

/* Desktop (> 750px): wizard wrappers are transparent, nav hidden */
@media (min-width: 751px) {
  .wizard-slides-viewport { display: contents; }
  .wizard-slides-track    { display: contents; }
  .wizard-slide           { display: contents; }
  .wizard-nav             { display: none !important; }
  #wizard-counter         { display: none; }
  .desktop-only           { display: block; }
  /* Кнопка "Параметры" только для мобайла */
  .hud-toggle-btn         { display: none; }
  /* На десктопе panel-header-right — просто прозрачная обёртка */
  .panel-header-right     { display: contents; }
  /* Шапка панели только для мобильного wizard */
  .panel-header           { display: none; }
  /* Тогл "Добавить корпус 2": мобильный вариант (#b2-toggle-row) скрыт на десктопе */
  .b2-toggle-mobile       { display: none !important; }
}

@media (max-width: 750px) {
  /* Тогл «Добавить корпус 2»: десктопный вариант скрыт на мобиле */
  .b2-toggle-desktop      { display: none !important; }
}

/* Мобильные дубликаты тоглов — скрыты на десктопе */
@media (min-width: 751px) {
  .wz-mobile-only         { display: none !important; }
}

/* Строки тоглов, заменённые карточками — скрыты на мобиле */
@media (max-width: 750px) {
  .wz-row-desktop-only    { display: none !important; }
}

/* ─── TOGGLE CARDS — мобильный блок тоглов в виде карточек ───── */
@media (max-width: 750px) {
  .wz-toggle-cards {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
  }
  .wz-toggle-card {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    min-width: 0;
  }
  .wz-toggle-card label {
    font-size: 11px;
    line-height: 1.3;
    color: var(--ui-label);
    flex: 1;
    min-width: 0;
    margin: 0;
  }
  .wz-toggle-card .toggle {
    flex-shrink: 0;
  }
}


/* ─── КОРПУС 2 — UI элементы ─────────────────────────────────── */

/* Заголовок секции с бейджем и кнопками */
.section-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-head-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 0;
  min-width: 0;
}
.section-head-left h2 {
  margin: 0;
}
.section-head-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Бейдж «Корпус N» */
.building-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-glow);
  border: 1px solid oklch(0.50 0.16 155 / 0.35);
  border-radius: 3px;
  padding: 2px 6px;
  white-space: nowrap;
  flex-shrink: 0;
}
.building-badge--b2 {
  color: var(--blue);
  background: oklch(0.50 0.16 240 / 0.12);
  border-color: oklch(0.50 0.16 240 / 0.35);
}

/* Кнопка «+ Корпус 2» в заголовке */
.btn-add-building {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-glow);
  border: 1px solid oklch(0.50 0.16 155 / 0.40);
  border-radius: 3px;
  padding: 4px 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.btn-add-building:hover {
  background: oklch(0.50 0.16 155 / 0.30);
  border-color: var(--accent);
}

/* Кнопка-корзинка удалить корпус 2 */
.btn-delete-building {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  color: var(--ui-heading);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  flex-shrink: 0;
}
.btn-delete-building:hover {
  color: var(--red);
  border-color: var(--red);
  background: oklch(0.50 0.20 15 / 0.08);
}

/* Кровля — двухколоночный layout когда К2 активен */
.section[data-section="roof"] .section-body {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.roof-building-col {
  width: 100%;
}
.roof-building-col--b2 {
  padding-top: 8px;
}
@media (max-width: 750px) {
    .roof-building-col--b2 {
        padding-top: 0;
    }
}
.roof-col-label {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}
.roof-col-label--b2 {
  color: var(--blue);
}

/* Когда К2 активен — показываем бейдж К1 тоже */
#roof-b1-label {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

/* ─── СМЕТА — разбивка по корпусам ──────────────────────────── */

/* Заголовок корпуса в смете */
.stats-building-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-glow);
  border: 1px solid oklch(0.50 0.16 155 / 0.25);
  border-radius: 3px;
  padding: 4px 10px;
  margin: 10px 0 6px;
  display: block;
}
.stats-building-label:first-child {
  margin-top: 0;
}

/* Строка «Итого корпус» */
.stats-row--subtotal {
  border-top: 1px solid var(--border-2);
  margin-top: 4px;
  padding-top: 4px;
}
.stats-row--subtotal .stats-cost--total {
  color: var(--accent);
  font-size: 12px;
}

/* Инфо-строка «Общая стена» */
.stats-shared-wall {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ink-faint);
  background: var(--bg-2);
  border: 1px dashed var(--border-2);
  border-radius: 3px;
  padding: 4px 8px;
  margin: 8px 0;
}
.stats-shared-wall .stats-name { flex: 1; }
.stats-shared-wall .stats-val  { width: 60px; text-align: right; }
.stats-shared-wall .stats-cost { width: 80px; }

/* ─── SANDWICH POPUP & CHIPS (mobile) ───────────────────────── */

@media (max-width: 750px) {

  .mat-row-mobile {
    display: grid;
    grid-template-columns: calc(80px * 2 + 6px) 1fr;
    gap: 10px;
    align-items: start;
  }

  .sandwich-chips {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
  }
  .sandwich-chip-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
  }
  .sandwich-chip-label {
    font-family: var(--mono);
    font-size: 8px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ui-label);
    line-height: 1;
  }

  /* Чип = .btn.active, но не шире 80px */
  .sandwich-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    padding: 6px 8px;
    max-width: 100px;
    width: 100%;
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    color: #fff;
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    box-shadow: 0 2px 8px var(--accent-glow);
    cursor: pointer;
    text-align: left;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, border-color 0.15s;
  }
  .sandwich-chip:active {
    background: var(--accent-dim);
    border-color: var(--accent-dim);
  }
  .sandwich-chip-value {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }
  .sandwich-chip-edit {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    opacity: 0.75;
  }

  /* Десктопные sandwich-options скрыты на мобайле */
  #wall-sandwich-options,
  #roof-sandwich-options {
    display: none !important;
  }

  /* Backdrop — поверх #panel (position:relative) */
  /* ── Comp Editor Popup (mobile only) ── */
  #comp-popup-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.20s ease;
  }
  #comp-popup-backdrop.open {
    pointer-events: auto;
    opacity: 1;
  }

  #comp-popup {
    position: absolute;
    left: 8px;
    right: 8px;
    top: 8px;         /* viewport уже начинается под .panel-header */
    max-height: calc(100% - 16px); /* 8px отступ сверху и снизу */
    z-index: 51;
    background: var(--panel);
    border: 1px solid var(--border-2);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 24px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.10);
    pointer-events: none;
    opacity: 0;
    transform: scale(0.96) translateY(-8px);
    transform-origin: top center;
    transition: opacity 0.20s ease, transform 0.20s ease;
    display: flex;
    flex-direction: column;
  }
  #comp-popup.open {
    pointer-events: auto;
    opacity: 1;
    transform: scale(1) translateY(0);
  }

  #comp-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }
  #comp-popup-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
  }
  #comp-popup-delete {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--red);
    cursor: pointer;
    border-radius: 4px;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.12s, color 0.12s;
  }
  #comp-popup-delete:active { background: oklch(0.50 0.20 15 / 0.12); }
  #comp-popup-delete svg { width: 14px; height: 14px; }
  #comp-popup-title {
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink);
  }
  #comp-popup-close {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--ink-dim);
    cursor: pointer;
    border-radius: 4px;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.12s, color 0.12s;
  }
  #comp-popup-close:active { background: var(--bg-3); color: var(--ink); }
  #comp-popup-close svg { width: 14px; height: 14px; }

  #comp-popup-body {
    padding: 12px 14px 16px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 0 1 auto;  /* растёт по контенту, скроллится если не влезает в max-height */
  }
  #comp-popup-body::-webkit-scrollbar { width: 3px; }
  #comp-popup-body::-webkit-scrollbar-track { background: transparent; }
  #comp-popup-body::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }

  /* item-body внутри popup — убираем лишние отступы, они уже есть у popup-body */
  #comp-popup-body .item-body {
    display: block;
    padding: 0;
    border-top: none;
  }

  #sandwich-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.20s ease;
  }
  #sandwich-backdrop.open {
    pointer-events: auto;
    opacity: 1;
  }

  /* Popup — absolute внутри #panel */
  #sandwich-popup {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 48px;
    z-index: 51;
    background: var(--panel);
    border: 1px solid var(--border-2);
    border-radius: var(--radius-lg);
    box-shadow: 0 -4px 24px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.10);
    pointer-events: none;
    opacity: 0;
    transform: scale(0.96) translateY(8px);
    transform-origin: bottom center;
    transition: opacity 0.20s ease, transform 0.20s ease;
  }
  #sandwich-popup.open {
    pointer-events: auto;
    opacity: 1;
    transform: scale(1) translateY(0);
  }

  #sandwich-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
  }
  #sandwich-popup-title {
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink);
  }
  #sandwich-popup-close {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--ink-dim);
    cursor: pointer;
    border-radius: 4px;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.12s, color 0.12s;
  }
  #sandwich-popup-close:active { background: var(--bg-3); color: var(--ink); }
  #sandwich-popup-close svg { width: 14px; height: 14px; }

  #sandwich-popup-body { padding: 12px 14px 16px; }
  .sandwich-popup-section-label {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ui-label);
    margin-bottom: 6px;
  }
}

@media (min-width: 751px) {
   .sandwich-chips,
  #sandwich-backdrop,
  #sandwich-popup,
  #comp-popup-backdrop,
  #comp-popup { display: none !important; }
}

/* ─── COST SECTION ───────────────────────────────────────────── */

/* Wrapper: центрирование в мобильном слайдере */
.cost-section-inner {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
}

.cost-display {
  background: var(--panel-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  text-align: center;
}
.cost-display__label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ui-label);
  margin-bottom: 8px;
  font-weight: 700;
}
.cost-display__value {
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1;
}
.cost-display__currency {
  font-size: 14px;
  font-weight: 400;
  color: var(--ink-dim);
  margin-left: 4px;
}

/* Кнопки: стопкой, на всю ширину */
.cost-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Базовый override для всех трёх кнопок в .cost-actions —
   единый размер, flex-центровка, шрифт крупнее базового .btn */
.cost-actions .btn {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.10em;
  padding: 12px 16px;
}

/* SVG иконки внутри обычных .btn кнопок */
.btn .btn-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  vertical-align: middle;
  pointer-events: none;
}

/* Кнопка "Оформить заказ" — оранжевая, шрифт крупнее */
.btn--order {
  background: #FF9900 !important;
  color: #111 !important;
  border-color: #e68a00 !important;
  font-weight: 700 !important;
  font-size: 13px !important;
}
.btn--order:hover {
  background: #e68a00 !important;
  border-color: #cc7a00 !important;
}

/* Мобильный слайдер: контент по центру вертикально */
@media (max-width: 750px) {
  .wizard-slide[data-slide="state"] {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100%;
  }
  .wizard-slide[data-slide="state"] .section {
    border-bottom: none;
  }
  .wizard-slide[data-slide="state"] .section-body {
    padding: 32px 24px 40px;
  }
  .cost-section-inner {
    gap: 20px;
  }
  .cost-display {
    padding: 28px 24px;
  }
  .cost-display__value {
    font-size: 36px;
  }
  .cost-actions {
    gap: 12px;
  }
  .cost-actions .btn {
    padding: 14px 20px;
  }
}

/* ─── ORDER MODAL ────────────────────────────────────────────── */
.order-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.50);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.order-backdrop--open {
  opacity: 1;
  pointer-events: auto;
}

.order-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -48%) scale(0.97);
  z-index: 901;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.22);
  width: min(460px, calc(100vw - 32px));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.order-modal--open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.order-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--border);
}
.order-modal__title {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
}
.order-modal__close {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--ink-dim);
  cursor: pointer;
  border-radius: 6px;
  padding: 0;
  transition: background 0.12s, color 0.12s;
}
.order-modal__close:hover { background: var(--bg-3); color: var(--ink); }
.order-modal__close svg { width: 14px; height: 14px; }

.order-modal__body {
  padding: 22px 22px 26px;
}
.order-modal__subtitle {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-dim);
  margin-bottom: 20px;
  line-height: 1.55;
}

.order-form { display: flex; flex-direction: column; gap: 14px; width: 100%; }
.order-form__field { display: flex; flex-direction: column; gap: 5px; width: 100%; }
.order-form__label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-dim);
  font-weight: 600;
}
.order-form__input {
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius);
  padding: 11px 14px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.order-form__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: #fff;
}
.order-form__input::placeholder { color: var(--ink-faint); }

.order-form__submit {
  margin-top: 8px;
  background: #FF9900;
  color: #111;
  border: none;
  border-radius: var(--radius);
  padding: 13px 20px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  width: 100%;
  box-shadow: 0 2px 8px rgba(255,153,0,0.25);
}
.order-form__submit:hover {
  background: #e68a00;
  box-shadow: 0 4px 16px rgba(255,153,0,0.35);
}

/* ─── CONSULTATION BUTTON ────────────────────────────────────── */

/* Shared inner layout — иконка + две строки текста */
.consult-btn__icon {
  flex-shrink: 0;
  line-height: 1;
  align-self: center;
  display: flex;
  align-items: center;
  width: 20px;
  height: 20px;
  color: currentColor;
}
.consult-btn__text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.consult-btn__label {
  font-size: 1em;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}
.consult-btn__phone {
  font-size: 1em;        /* точно такой же, как label */
  white-space: nowrap;
  letter-spacing: 0.06em;
  opacity: 0.85;
}

/* В боковой панели */
.btn--consult {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent-dim) !important;
  font-weight: 600 !important;
  text-decoration: none !important;
}
.btn--consult:hover {
  background: var(--accent-dim) !important;
  border-color: var(--accent-dim) !important;
}

/* В смете */
.stats-consult-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
}
.stats-consult-btn:hover { background: var(--accent-dim); }

/* ─── ОЧЕНЬ УЗКИЙ ЭКРАН (< 350px) ──────────────────────────── */
/* .top-actions удалён — заменён мобайл-дропдауном */

/* ═══════════════════════════════════════════════════════════════
   SAVE DESIGN — FAB + Modals
   ═══════════════════════════════════════════════════════════════ */

/* ─── FLOATING ACTION BUTTON ─────────────────────────────────── */
/* ─── FAB GROUP (reset + save) ───────────────────────────────── */
.fab-group {
  position: absolute;
  bottom: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 150;
}

/* Reset FAB — иконка-корзина */
.reset-fab {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,0.30);
  opacity: 0;
  pointer-events: none;
  transform: translateY(60px);
  transition: transform 0.28s cubic-bezier(0.34,1.56,0.64,1),
              opacity 0.22s ease,
              background 0.15s;
}
.reset-fab--visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.reset-fab:hover { background: oklch(0.45 0.20 15); }

.save-fab {
  position: static;
  transform: translateY(60px);
  z-index: 150;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px;
  height: 44px;
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,0.30);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.34,1.56,0.64,1),
              opacity 0.22s ease,
              background 0.15s;
  white-space: nowrap;
}
.save-fab--visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.save-fab:hover { background: #2d2b28; }
.save-fab--saving { background: var(--ink-dim); }
.save-fab--saved  { background: var(--green, #2d7a3a) !important; }
.save-fab__icon { flex-shrink: 0; }

/* На мобайле — чуть меньше, позиция та же (внутри viewport) */
@media (max-width: 750px) {
  /* Растягиваем FAB на всю ширину: пилюлька слева, кнопки справа */
  .fab-group {
    bottom: 12px;
    right: 12px;
    left: 12px;
    justify-content: space-between;
  }
  .reset-fab { width: 38px; height: 38px; }
  .save-fab { font-size: 10px; padding: 0 14px; height: 38px; }
  /* Спейсер между пилюлькой и правыми кнопками */
  .brand-fab-spacer { flex: 1; }
  /* Брендовая пилюлька — только на мобайле, только standalone */
  .brand-fab {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 12px 0 8px;
    background: var(--ink);
    border-radius: 999px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.18);
    text-decoration: none;
    color: var(--ink-dim);
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    transition: box-shadow 0.15s, opacity 0.15s;
  }
  .brand-fab:active { opacity: 0.8; }
  .brand-fab__logo {
    height: 20px;
    width: auto;
    display: block;
    object-fit: contain;
  }
  .brand-fab__ext {
    flex-shrink: 0;
    color: #fff;
    opacity: 0.7;
  }
  /* Скрываем brand-bar внутри панели на мобайле (заменяется пилюлькой) */
  #panel .brand-bar { display: none; }
  /* Скрываем пилюлью в embed-режиме */
  /*body.embed-mode .brand-fab { display: none; }*/
}

/* На десктопе пилюлька скрыта */
@media (min-width: 751px) {
  .brand-fab { display: none; }
  .brand-fab-spacer { display: none; }
}

/* 830–751px: скрываем слово "дизайн" */
@media (max-width: 830px) and (min-width: 751px) {
  .save-fab__word-design { display: none; }
}

/* ≤ 440px: снова скрываем слово "дизайн" */
@media (max-width: 440px) {
  .save-fab__word-design { display: none; }
}

/* ≤ 380px: скрываем и "сохранить" — только иконка */
@media (max-width: 380px) {
  .save-fab__word-save { display: none; }
  .save-fab { width: 38px; padding: 0; gap: 0; justify-content: center; }
}

/* ─── SHARED BACKDROP ────────────────────────────────────────── */
.save-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 910;
  background: rgba(0,0,0,0.50);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.save-modal-backdrop--open {
  opacity: 1;
  pointer-events: auto;
}

/* ─── SHARED MODAL SHELL ─────────────────────────────────────── */
.save-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -48%) scale(0.97);
  z-index: 911;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.22);
  width: min(440px, calc(100vw - 32px));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.save-modal--open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.save-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
}
.save-modal__title {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
}
.save-modal__close {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none;
  color: var(--ink-dim); cursor: pointer;
  border-radius: 6px; padding: 0;
  transition: background 0.12s, color 0.12s;
}
.save-modal__close:hover { background: var(--bg-3); color: var(--ink); }

.save-modal__body { padding: 20px 22px 24px; }
.save-modal__subtitle {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-dim);
  margin-bottom: 18px;
  line-height: 1.55;
}

/* ─── SAVE FORM ──────────────────────────────────────────────── */
.save-form { display: flex; flex-direction: column; gap: 12px; }
.save-form__field { display: flex; flex-direction: column; gap: 4px; }
.save-form__label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-dim);
  font-weight: 600;
}
.save-form__optional { color: var(--ink-faint); font-weight: 400; }
.save-form__required { color: var(--accent); }
.save-form__input {
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius);
  padding: 10px 14px;
  background: var(--bg);
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.save-form__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: #fff;
}
.save-form__input::placeholder { color: var(--ink-faint); }
.save-form__submit {
  margin-top: 4px;
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 13px 20px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s;
  width: 100%;
}
.save-form__submit:hover { background: #2d2b28; }
.save-form__submit:disabled { opacity: 0.6; cursor: not-allowed; }

/* ─── SUCCESS MODAL EXTRAS ───────────────────────────────────── */
.save-modal--success { width: min(480px, calc(100vw - 32px)); }

.success-check {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: rgba(45,122,58,0.12);
  color: var(--green, #2d7a3a);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
}

.success-link-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.success-link-input {
  flex: 1;
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius);
  padding: 9px 12px;
  background: var(--bg-2);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-dim);
  outline: none;
  min-width: 0;
}
.success-copy-btn {
  flex-shrink: 0;
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: 0 14px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.12s;
  white-space: nowrap;
}
.success-copy-btn:hover { background: var(--border); }

.success-share-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius);
  padding: 11px 16px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-dim);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  margin-bottom: 16px;
}
.success-share-btn:hover { border-color: var(--ink); color: var(--ink); }

.success-divider {
  text-align: center;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 12px;
  position: relative;
}
.success-divider::before,
.success-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 28%;
  height: 1px;
  background: var(--border);
}
.success-divider::before { left: 0; }
.success-divider::after  { right: 0; }

.success-cta-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.success-cta-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 12px 10px;
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: background 0.15s;
  text-align: center;
  line-height: 1.3;
}
.success-cta-btn--consult {
  background: var(--accent);
  color: #fff;
}
.success-cta-btn--consult:hover { background: var(--accent-dim); }
.success-cta-btn--order {
  background: #FF9900;
  color: #111;
}
.success-cta-btn--order:hover { background: #e68a00; }

/* ─── INPUT SHAKE ANIMATION ──────────────────────────────────── */
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  40%      { transform: translateX(6px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}
.input--shake { animation: shake 0.4s ease; border-color: var(--red) !important; }

/* ─── ORDER TOAST ────────────────────────────────────────────── */
.order-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--green, #2d7a3a);
  color: #fff;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 14px 28px;
  border-radius: 6px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 9999;
  white-space: nowrap;
  pointer-events: none;
}
.order-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
