:root {
  --bg: #f5f3ef;
  --card: #ffffff;
  --ink: #1d2321;
  --muted: #6b726f;
  --line: #e5e2db;
  --soft: #f0eee9;
  --accent: #1f6f5c;
  --accent-ink: #ffffff;
  --accent-soft: #e3efea;
  --person: #e0703a;
  --danger: #b4432f;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 25, 0.06), 0 8px 24px rgba(20, 30, 25, 0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.5; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
[hidden] { display: none !important; }

.screen { display: none; min-height: 100dvh; }
.screen.active { display: flex; }

/* ---------- бренд ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; }
.brand.small { font-size: 17px; }
.logo-mark {
  width: 26px; height: 26px; border-radius: 8px; background: var(--accent); position: relative; flex: none;
}
.logo-mark::after {
  content: ""; position: absolute; left: 6px; right: 6px; bottom: 6px; height: 7px;
  border-radius: 3px 3px 2px 2px; background: #f5f3ef;
}

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--card); border-radius: 11px;
  padding: 10px 14px; font-weight: 600; text-decoration: none; transition: background .15s, border-color .15s;
}
.btn:hover:not(:disabled) { border-color: #cfcbc2; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); padding: 13px 18px; }
.btn.primary:hover:not(:disabled) { background: #195c4c; }
.btn.ghost { background: var(--soft); border-color: transparent; }
.btn.ghost:hover:not(:disabled) { background: #e8e5de; }
.btn.danger { color: var(--danger); }
.btn.small { padding: 6px 10px; font-size: 13px; border-radius: 9px; }
.btn.wide { width: 100%; }
.link { background: none; border: 0; color: var(--accent); font-weight: 600; padding: 6px 0; text-decoration: underline; text-underline-offset: 3px; }
.link.quiet { color: var(--muted); text-decoration: none; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 9px; border: 0; background: var(--soft);
  display: inline-grid; place-items: center; flex: none;
}
.icon-btn:hover { background: #e6e3dc; }

/* ---------- старт ---------- */
.start { margin: auto; max-width: 640px; width: 100%; padding: 40px 16px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 18px; }
.start h1 { font-size: clamp(30px, 6vw, 46px); line-height: 1.08; margin-top: 18px; }
.lead { color: var(--muted); font-size: 17px; max-width: 520px; margin: 0; }
.lead.small { font-size: 15px; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; width: 100%; margin-top: 10px; }
.choice {
  background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 26px 18px;
  display: flex; flex-direction: column; align-items: center; gap: 6px; box-shadow: var(--shadow);
  transition: transform .15s, border-color .15s;
}
.choice:hover { transform: translateY(-2px); border-color: var(--accent); }
.choice svg { width: 52px; height: 52px; fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 6px; }
.choice strong { font-size: 19px; }
.choice span { color: var(--muted); font-size: 14px; }
.steps-mini { display: flex; gap: 8px; list-style: none; padding: 0; margin: 14px 0 0; color: var(--muted); font-size: 13px; counter-reset: s; flex-wrap: wrap; justify-content: center; }
.steps-mini li { counter-increment: s; background: var(--soft); padding: 5px 11px; border-radius: 999px; }
.steps-mini li::before { content: counter(s) ". "; font-weight: 700; color: var(--ink); }

/* ---------- экраны загрузки ---------- */
.flow { margin: 0 auto; max-width: 620px; width: 100%; padding: 24px 16px 48px; display: flex; flex-direction: column; gap: 16px; }
.flow > div { display: flex; flex-direction: column; gap: 16px; }
.back { align-self: flex-start; background: none; border: 0; color: var(--muted); font-weight: 600; padding: 4px 0; }
.flow h2 { font-size: 28px; }
.tips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tip { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 12px; text-align: center; }
.tip svg { width: 64px; height: 48px; fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2; }
.tip svg .room { fill: none; stroke: #b9b5ac; stroke-dasharray: 3 3; }
.tip svg text { fill: var(--accent); stroke: none; font-size: 12px; font-weight: 800; text-anchor: middle; }
.tip p { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.drop {
  border: 2px dashed #cdc8bd; border-radius: 18px; background: var(--card); padding: 30px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop strong { font-size: 17px; color: var(--accent); }
.drop span { color: var(--muted); font-size: 14px; }
.flow .thumbs, .thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.thumbs:empty { display: none; }
.thumb { position: relative; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: var(--soft); }
.thumb img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-name { position: absolute; inset: 0; display: grid; place-items: center; padding: 8px; font-size: 12px; color: var(--muted); text-align: center; word-break: break-all; }
.thumb button { z-index: 2; }
.thumb button { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; }
.note { color: var(--muted); font-size: 13px; margin: 0; }
.plan-svg { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.plan-svg svg { width: 100%; height: auto; display: block; }
.plan-room rect { fill: #faf9f6; stroke: #2c2f2e; stroke-width: 5; cursor: pointer; transition: fill .15s; }
.plan-room:hover rect { fill: var(--accent-soft); }
.plan-room.selected rect { fill: #cfe5dc; stroke: var(--accent); }
.plan-room text, .plan-extra text { text-anchor: middle; font-size: 15px; font-weight: 700; fill: var(--ink); pointer-events: none; }
.plan-room text.dim { font-size: 12px; font-weight: 600; fill: var(--muted); }
.plan-extra rect { fill: #efede8; stroke: #2c2f2e; stroke-width: 5; }
.plan-extra text { fill: #9a9890; font-size: 12px; }

/* ---------- редактор ---------- */
#screen-editor { flex-direction: column; height: 100dvh; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); flex: none; }
.stepper { display: flex; gap: 6px; margin: 0 auto; }
.step-btn {
  display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 7px 12px 7px 7px; border-radius: 999px; font-weight: 600; color: var(--muted);
}
.step-btn b { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); font-size: 13px; }
.step-btn.active { background: var(--accent-soft); color: var(--accent); }
.step-btn.active b { background: var(--accent); color: #fff; }
.step-btn.done b { background: #cfe5dc; color: var(--accent); }

.editor { flex: 1; display: grid; grid-template-columns: 370px minmax(0, 1fr); min-height: 0; }
.panel { overflow-y: auto; background: var(--card); border-right: 1px solid var(--line); padding: 20px 18px 28px; display: flex; flex-direction: column; gap: 18px; }
.panel-head h2 { font-size: 23px; margin: 2px 0 6px; }
.kicker { font-size: 12px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; }
.hint { color: var(--muted); font-size: 14px; margin: 0; }
.group { display: flex; flex-direction: column; gap: 10px; }
.group h3 { font-size: 15px; }
.panel-foot { display: flex; flex-direction: column; gap: 8px; align-items: center; margin-top: auto; padding-top: 4px; }
.small { font-size: 13px; color: var(--muted); margin: 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > .btn { flex: 1; }
.row.tools > .btn { padding: 8px 6px; font-size: 13px; }

.field { display: flex; flex-direction: column; gap: 4px; }
.field.inline { flex-direction: row; justify-content: space-between; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.field-head { display: flex; justify-content: space-between; align-items: center; font-size: 14px; font-weight: 600; }
.num { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; font-weight: 500; }
.num input { width: 70px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 8px; text-align: right; font-weight: 700; color: var(--ink); background: #fff; }
input[type="range"] { width: 100%; accent-color: var(--accent); margin: 2px 0; }
.op-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.op-head { display: flex; align-items: center; gap: 8px; }
.op-head strong, .op-head .op-type { flex: 1; }
.op-head .op-type { font-size: 15px; }
.op-head select { border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; background: #fff; font-weight: 600; }

.catalog { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.cat-item {
  border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 6px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 12.5px; font-weight: 600; text-align: center; line-height: 1.2; transition: border-color .15s, background .15s;
}
.cat-item:hover { border-color: var(--accent); background: var(--accent-soft); }
.ico { font-size: 22px; line-height: 1; }
.sel-card { background: var(--accent-soft); border-radius: 14px; padding: 12px; }
.sel-head { display: flex; align-items: center; gap: 10px; }
.sel-head > div { flex: 1; display: flex; flex-direction: column; }
.sel-head span:not(.ico) { color: var(--muted); font-size: 13px; }
.sel-card .btn.ghost { background: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
/* плинтус, потолок, молдинг: кнопки с рисунком сечения */
.trim-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin: 8px 0; }
.trim { border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 6px 4px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.trim span { font-size: 11.5px; line-height: 1.2; }
.trim.on { border-color: var(--accent); background: var(--accent-soft); }
.trim:hover { border-color: var(--accent); }
.trim svg { display: block; }
.ceil-swatch { width: 56px; height: 40px; border-radius: 6px; border: 1px solid var(--line); display: block; }
.ceil-swatch.stretch-satin { background-image: linear-gradient(135deg, rgba(255,255,255,.0) 30%, rgba(255,255,255,.55) 50%, rgba(255,255,255,0) 70%) !important; }
.ceil-swatch.stretch-gloss { background-image: linear-gradient(135deg, rgba(255,255,255,0) 20%, rgba(255,255,255,.9) 45%, rgba(255,255,255,0) 55%, rgba(255,255,255,.5) 70%, rgba(255,255,255,0) 80%) !important; }
.trim-colors { flex-wrap: wrap; gap: 6px; align-items: center; }
.chip.ral-custom { flex: none; }
.trim-colors .chip-color { width: 32px; height: 32px; border-radius: 8px; }
.chip-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); margin-right: 5px; vertical-align: -2px; }
.zone-card { margin-bottom: 10px; border-color: #2fbf6f; }
.zone-card .snap { flex-wrap: wrap; gap: 6px; align-items: center; }
/* ведомость материалов и работ */
.qty summary { cursor: pointer; list-style: none; }
.qty summary::-webkit-details-marker { display: none; }
.qty summary h3 { display: inline; }
.qty summary h3::after { content: ' ▾'; color: var(--muted); font-weight: 400; }
.qty[open] summary h3::after { content: ' ▴'; }
.qty-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0 12px; }
.qty-table td { padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.qty-table td em { display: block; font-style: normal; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.qty-table td.num { text-align: right; font-weight: 700; white-space: nowrap; }
.qty-table td:last-child { width: 52px; color: var(--muted); white-space: nowrap; }
.qty-sec th { text-align: left; padding: 12px 4px 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 11px; font-size: 13px; font-weight: 600; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.placed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.placed-item { width: 100%; display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 6px 8px; border-radius: 9px; font-weight: 600; text-align: left; }
.placed-item:hover, .placed-item.on { background: var(--soft); }
.placed-item em { margin-left: auto; color: var(--muted); font-style: normal; font-weight: 500; font-size: 13px; }

/* Цвет стен: RAL */
.seg.tabs button.own::after { content: '•'; margin-left: 3px; color: var(--accent); }
.seg.tabs button.own.on::after { color: #fff; }
.color-now { display: flex; align-items: center; gap: 10px; margin: 12px 0 8px; }
.chip-color { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); flex: none; }
.color-now div { display: flex; flex-direction: column; line-height: 1.25; }
.color-now strong { font-size: 15px; }
.color-now span { font-size: 13px; color: var(--muted); }
.color-now em { font-style: normal; font-size: 12px; color: #9a6a1c; }
.ral-tabs { margin-top: 10px; }
.ral-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(30px, 1fr)); gap: 5px; margin: 8px 0; }
.ral { aspect-ratio: 1; border-radius: 7px; border: 1px solid rgba(0, 0, 0, .12); padding: 0; }
.ral.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); }
.ral-tools { gap: 8px; align-items: stretch; }
.ral-search { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; background: #fff; font-weight: 600; font-size: 13px; flex: 1; }
.ral-search input { border: 0; outline: 0; width: 100%; min-width: 0; font: inherit; font-weight: 500; padding: 8px 0; background: none; }
.ral-search input:invalid { color: #b3261e; }
.ral-custom { position: relative; flex: 1; justify-content: center; }
.ral-custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }

/* библиотека материалов */
.group h3 .muted { color: var(--muted); font-weight: 500; }
.seg.tabs { box-shadow: none; background: #f3f1ec; overflow-x: auto; }
.seg.tabs button { flex: 1; justify-content: center; white-space: nowrap; padding: 6px 8px; }
.mat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mat, .tone { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 4px; display: flex; flex-direction: column; gap: 4px; text-align: left; }
.mat img, .tone img { width: 100%; aspect-ratio: 1; border-radius: 7px; background: #ece8e1; object-fit: cover; display: block; }
.mat span { font-size: 11.5px; line-height: 1.2; padding: 0 2px 2px; }
.mat.on, .tone.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.tones { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.tone span { font-size: 10.5px; text-align: center; color: var(--muted); line-height: 1.15; }

/* Замена на похожий предмет */
.alt { margin-top: 12px; }
.alt h4 { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.alt-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; max-height: 260px; overflow-y: auto; padding: 2px; }
.alt-item { border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 3px; display: flex; flex-direction: column; gap: 2px; text-align: left; }
.alt-item img, .alt-ico { width: 100%; aspect-ratio: 1; border-radius: 6px; background: #f4f2ef; object-fit: contain; display: flex; align-items: center; justify-content: center; font-size: 26px; }
.alt-item span:last-child { font-size: 10.5px; line-height: 1.15; padding: 0 2px 2px; }
.alt-item:hover { border-color: #bdb8ae; }
.alt-item.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.alt-item.busy { opacity: .55; cursor: progress; }
.colors { margin-top: 12px; }
.colors h4, .tv-f h4 { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.tv-f { margin-bottom: 10px; }
.color-row { display: flex; flex-wrap: wrap; gap: 8px; }
.part-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.part-row .color-f { flex: 0 0 190px; }
.part-row select { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: #fff; font-size: 13px; }
.color-f { display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 13px; cursor: pointer; }
.color-f input { width: 28px; height: 28px; padding: 0; border: none; border-radius: 50%; background: none; cursor: pointer; }
.color-f input::-webkit-color-swatch-wrapper { padding: 0; }
.color-f input::-webkit-color-swatch { border: 1px solid rgba(0, 0, 0, .15); border-radius: 50%; }

/* Отменить / вернуть */
.undo-seg button { font-size: 15px; }
.undo-seg button span { font-size: 13px; }
.undo-seg button:disabled { opacity: .35; cursor: default; }

/* Выключатель лампы */
.lamp-btn { margin-top: 8px; }
.lamp-btn.on { background: #fff4df; border-color: #f0c98a; color: #7a4d12; }
#btn-lamps { margin-right: 6px; }

/* Библиотека моделей */
.lib-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.lib-item { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 4px; display: flex; flex-direction: column; gap: 3px; text-align: left; }
.lib-item img { width: 100%; aspect-ratio: 1; border-radius: 7px; background: #f4f2ef; object-fit: contain; display: block; }
.lib-item img.broken { opacity: 0.3; }
.lib-item span { font-size: 11.5px; line-height: 1.2; padding: 0 2px; }
.lib-item em { font-style: normal; font-size: 10.5px; color: var(--muted); padding: 0 2px 2px; }
.lib-item:hover { border-color: var(--accent); }
/* поля с числами — без стрелок «больше/меньше»: человек просто кликает и пишет цифры */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.view-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.view-item { border: 2px solid var(--line); background: #fff; border-radius: 10px; padding: 3px; display: flex; flex-direction: column; gap: 3px; text-align: left; }
.view-item img { width: 100%; aspect-ratio: 8 / 5; object-fit: cover; border-radius: 7px; display: block; }
.view-item span { font-size: 11.5px; line-height: 1.2; padding: 0 2px 2px; font-weight: 600; }
.view-item.on { border-color: var(--accent); }
.view-item:hover { border-color: var(--accent); }
.model-ico { width: 28px; height: 28px; border-radius: 6px; object-fit: contain; background: #f4f2ef; vertical-align: middle; }
.size-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 10px 0 4px; }
.size-f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.size-f .num { display: flex; align-items: center; gap: 4px; color: var(--ink, inherit); }
.size-f input { width: 100%; min-width: 0; }

.viewport { position: relative; min-height: 0; overflow: hidden; background: #eef0f2; }
.viewport canvas { display: block; touch-action: none; }
.labels { position: absolute; inset: 0; pointer-events: none; }
.vp-toolbar { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; gap: 8px; justify-content: space-between; flex-wrap: wrap; z-index: 2; pointer-events: none; }
.vp-toolbar > * { pointer-events: auto; }
.seg { display: flex; background: rgba(255,255,255,.92); border: 1px solid var(--line); border-radius: 12px; padding: 3px; box-shadow: var(--shadow); }
.seg button { border: 0; background: none; padding: 6px 10px; border-radius: 9px; font-weight: 600; font-size: 13px; display: flex; gap: 5px; align-items: center; }
.seg button.on { background: var(--ink); color: #fff; }
.vp-right { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.chip-btn { border: 1px solid var(--line); background: rgba(255,255,255,.92); border-radius: 12px; padding: 7px 12px; font-weight: 600; font-size: 13px; box-shadow: var(--shadow); }
.vp-hint { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); background: rgba(29,35,33,.78); color: #fff; font-size: 12.5px; padding: 6px 12px; border-radius: 999px; white-space: nowrap; pointer-events: none; z-index: 2; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis; }
.eye-banner { position: absolute; top: 60px; left: 50%; transform: translateX(-50%); background: var(--person); color: #fff; border-radius: 12px; padding: 7px 8px 7px 14px; display: flex; gap: 10px; align-items: center; font-size: 13px; font-weight: 600; z-index: 2; box-shadow: var(--shadow); max-width: calc(100% - 24px); }
.viewport.eye .vp-hint { display: none; }
/* рамка выделения мебели (Shift + протянуть) */
.select-box { position: fixed; z-index: 50; pointer-events: none; border: 1.5px dashed #2f7d5b; background: rgba(47, 125, 91, .12); border-radius: 2px; }
.viewport.eye .eye-banner { top: auto; bottom: 10px; background: rgba(29,35,33,.82); font-weight: 500; }
/* рамка кадра в режиме «глазами» (как Safe Frame): снаружи затемнено */
.cam-frame { position: absolute; pointer-events: none; z-index: 1; outline: 1.5px solid rgba(255,255,255,.85); box-shadow: 0 0 0 9999px rgba(20,24,22,.55); }
.cam-frame::after { content: attr(data-label); position: absolute; right: 8px; top: 8px; color: #fff; font-size: 11px; font-weight: 600; background: rgba(0,0,0,.4); padding: 2px 6px; border-radius: 6px; }
.eye-banner button { border: 0; background: rgba(255,255,255,.25); color: #fff; border-radius: 8px; padding: 5px 10px; font-weight: 700; }

/* подписи в 3D */
.lbl { background: rgba(255,255,255,.94); border: 1px solid var(--line); padding: 3px 8px; border-radius: 999px; font: 600 12px Manrope, system-ui, sans-serif; color: var(--ink); white-space: nowrap; box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.lbl.wall { background: var(--ink); color: #fff; border-color: var(--ink); }
.lbl.height { background: var(--accent-soft); color: var(--accent); border-color: #cfe5dc; }
/* размеры проёма на стене: число можно нажать и вписать своё */
.lbl.dim { pointer-events: auto; cursor: text; background: #fff; color: #1f6f55; border-color: #1f6f55; padding: 1px 6px; font-size: 11.5px; }
.lbl.dim:hover { background: var(--accent-soft); }
.lbl.edit { pointer-events: auto; cursor: text; }
.lbl .t { display: inline-block; white-space: nowrap; }
.lbl.dim-del { pointer-events: auto; cursor: pointer; background: #fff; color: #c0392b; border-color: #e3b4ae; }
.lbl.dim-del:hover { background: #c0392b; color: #fff; border-color: #c0392b; }
.dim-input { width: 64px; border: 0; outline: 0; background: transparent; font: inherit; color: inherit; text-align: center; padding: 0; }
.lbl.sel { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- оверлеи ---------- */
.overlay { position: fixed; inset: 0; background: rgba(22, 26, 25, .55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.progress-card { background: var(--card); border-radius: 20px; padding: 28px 28px 22px; width: min(380px, 100%); box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.progress-card ul { list-style: none; padding: 0; margin: 0; width: 100%; display: flex; flex-direction: column; gap: 6px; }
.progress-card li { color: #a9a69e; font-weight: 600; padding-left: 26px; position: relative; }
.progress-card li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.progress-card li.active { color: var(--ink); }
.progress-card li.active::before { background: var(--person); }
.progress-card li.done { color: var(--accent); }
.progress-card li.done::before { content: "✓"; background: none; color: var(--accent); top: 0; left: 3px; width: auto; height: auto; font-weight: 800; }
.spinner { width: 38px; height: 38px; border-radius: 50%; border: 4px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.ask-card { background: var(--card); border-radius: 20px; padding: 22px; width: min(380px, 100%); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 16px; }
.ask-card p { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.4; white-space: pre-line; }
.ask-card .row { gap: 8px; }
.render-task { margin: 8px 0 4px; font-size: 13px; }
.render-task summary { cursor: pointer; font-weight: 600; }
.render-task ul { margin: 6px 0; padding-left: 18px; color: var(--muted); }
.render-task pre { white-space: pre-wrap; font-size: 11px; line-height: 1.4; background: #f4f2ef; border-radius: 8px; padding: 8px; max-height: 220px; overflow: auto; }
.known { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow); }
.known .seg { display: flex; flex-wrap: wrap; }
.known-input { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; }
.known-input input { width: 96px; font-size: 18px; }
/* Окно рендера на широком экране — фиксированной высоты, правая колонка (отделка, мебель) прокручивается сама.
   Иначе длинный список мебели растягивал ряд, картинка вставала по центру этой высоты и уходила за низ окна. */
.render-card { position: relative; background: var(--card); border-radius: 20px; width: min(1100px, 100%); height: min(760px, calc(100dvh - 32px)); display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); overflow: hidden; }
.render-card .close { position: absolute; top: 10px; right: 10px; z-index: 2; background: rgba(255,255,255,.9); }
.render-img-wrap { position: relative; background: #111; display: grid; place-items: center; min-height: 0; }
.render-img-wrap img { width: 100%; height: 100%; object-fit: contain; display: block; }
.render-badge { position: absolute; left: 12px; bottom: 12px; right: 12px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; padding: 6px 10px; border-radius: 9px; }
.render-badge.error { background: rgba(160, 40, 30, .88); font-size: 13px; font-weight: 600; }
/* «Сохранить рендер» — заметная кнопка поверх картинки (внизу справа; показывается только для настоящего рендера) */
.render-save { position: absolute; right: 14px; bottom: 14px; z-index: 2; display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: 12px; background: #14305A; color: #fff; font-size: 15px; font-weight: 600; text-decoration: none; box-shadow: 0 8px 22px rgba(0,0,0,.35); cursor: pointer; }
.render-save:hover { background: #1c3f73; }
.render-save[hidden] { display: none; }
.render-save svg { flex-shrink: 0; }
.render-side { padding: 22px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.render-side h2 { font-size: 24px; margin-bottom: 4px; }
.products { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.products li { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; grid-template-areas: "dot name price" "dot meta btn"; column-gap: 10px; row-gap: 4px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.p-dot { grid-area: dot; width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,.12); }
.products strong { grid-area: name; font-size: 14px; line-height: 1.25; }
.products .meta { grid-area: meta; font-size: 12px; color: var(--muted); }
.products b { grid-area: price; white-space: nowrap; }
.products .btn { grid-area: btn; }
.total { display: flex; justify-content: space-between; align-items: baseline; font-size: 16px; border-top: 1px solid var(--line); padding-top: 10px; }
.total b { font-size: 20px; }

/* ---------- мобильная версия ---------- */
@media (max-width: 820px) {
  .editor { grid-template-columns: minmax(0, 1fr); grid-template-rows: 52dvh minmax(0, 1fr); }
  .viewport { order: -1; }
  .panel { border-right: 0; border-top: 1px solid var(--line); }
  .topbar { gap: 8px; padding: 8px 12px; }
  .brand-name { display: none; }
  .step-btn { padding: 6px; white-space: nowrap; font-size: 13px; }
  .step-btn span { display: none; }
  #btn-new { white-space: nowrap; font-size: 13px; }
  .step-btn.active span { display: inline; }
  .seg button span { display: none; }
  .render-card { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; height: auto; max-height: calc(100dvh - 32px); overflow-y: auto; }
  .render-img-wrap { min-height: 220px; }
  .render-side { overflow: visible; }
}
@media (max-width: 560px) {
  .choice-grid { grid-template-columns: minmax(0, 1fr); }
  .tips { grid-template-columns: minmax(0, 1fr); }
  .tip { display: flex; align-items: center; gap: 12px; text-align: left; }
  .tip p { margin: 0; }
  .vp-hint { display: none; }
}
