:root {
  --bg: #f4f2ee;
  --panel: #ffffff;
  --line: #e2ded6;
  --ink: #23201c;
  --mute: #7b746a;
  --acc: #b0702c;
  --acc-ink: #ffffff;
  --sel: #2f7df6;
  --soft: #f7f5f1;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body { display: flex; flex-direction: column; overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button {
  border: 1px solid var(--line); background: var(--panel); border-radius: 6px;
  padding: 5px 9px; cursor: pointer; white-space: nowrap;
}
button:hover { border-color: #c9c2b6; background: var(--soft); }
button.on { background: #2b2824; color: #fff; border-color: #2b2824; }
button.accent { background: var(--acc); color: var(--acc-ink); border-color: var(--acc); }
button.accent:hover { filter: brightness(1.07); }
button.ico { font-size: 15px; padding: 2px 9px; }
button:disabled { opacity: .4; cursor: default; }
input[type=number], input[type=text], input:not([type]), select {
  border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; background: #fff; min-width: 0;
}
input:focus, select:focus { outline: 2px solid #c9a06c55; border-color: var(--acc); }

.bar {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px;
  background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 15px; letter-spacing: .2px; }
.brand span { color: var(--mute); font-weight: 400; }
.pname { width: 180px; font-weight: 600; }
.grp { display: flex; gap: 4px; align-items: center; }
.spacer { flex: 1; }
.tabs { display: flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.tabs button { border: 0; border-radius: 0; padding: 6px 14px; }
.lbl { color: var(--mute); font-size: 12px; }

main { flex: 1; display: flex; min-height: 0; position: relative; }
.list {
  width: 210px; background: var(--panel); border-right: 1px solid var(--line);
  overflow-y: auto; padding: 8px 6px;
}
.list h4 { margin: 4px 6px 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--mute); }
.li {
  display: flex; align-items: center; gap: 7px; padding: 5px 6px; border-radius: 6px; cursor: pointer;
  border: 1px solid transparent;
}
.li:hover { background: var(--soft); }
.li.sel { background: #eaf2ff; border-color: #bcd4fb; }
.li img { width: 22px; height: 22px; border-radius: 4px; flex: none; }
.li .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .d { color: var(--mute); font-size: 11px; font-variant-numeric: tabular-nums; }

.view { flex: 1; position: relative; min-width: 0; }
#canvas-wrap { position: absolute; inset: 0; }
#canvas-wrap canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.vtools {
  position: absolute; left: 10px; top: 10px; display: flex; gap: 8px; flex-wrap: wrap;
  pointer-events: none;
}
.vtools .grp { pointer-events: auto; background: #ffffffe8; padding: 4px; border-radius: 8px; border: 1px solid var(--line); }
.vtools button { padding: 3px 8px; }
.vtools select { padding: 2px 4px; }
.sizebadge {
  position: absolute; left: 10px; bottom: 10px; background: #1f1d1ad9; color: #fff;
  padding: 5px 9px; border-radius: 7px; font-variant-numeric: tabular-nums; pointer-events: none;
}
.empty {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center;
  color: var(--mute); line-height: 1.6; pointer-events: none; background: #ffffffc0; padding: 16px 22px; border-radius: 10px;
}
.empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

.props {
  width: 300px; background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0;
}
#props { overflow-y: auto; padding: 12px; flex: 1; }
.rtabs { display: flex; border-bottom: 1px solid var(--line); flex: none; overflow-x: auto; }
.rtabs button { border: 0; border-radius: 0; background: none; padding: 9px 4px 8px; font-size: 12px; color: var(--mute); border-bottom: 2px solid transparent; flex: 1; }
.rtabs button.on { color: var(--ink); border-bottom-color: var(--acc); font-weight: 600; background: none; }
.props h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--mute); margin: 16px 0 7px; font-weight: 600; }
.props h3:first-child { margin-top: 0; }
.props .title { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.props .sub { color: var(--mute); }
.props input.name { width: 100%; font-weight: 600; font-size: 14px; }
.g3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.g3 label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--mute); }
.g3 label.thick { color: var(--acc); font-weight: 600; }
.g3 label.thick input { border-color: #e1c49f; background: #fffaf2; }
.g3 input { width: 100%; font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; align-items: center; }
.chips button { padding: 2px 7px; font-size: 12px; }
.chips .lbl { margin-right: 2px; }
.decors { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.decors button {
  padding: 0; aspect-ratio: 1; border-radius: 6px; overflow: hidden; border: 2px solid transparent; position: relative;
  background-size: cover;
}
.decors button.on { border-color: var(--sel); box-shadow: 0 0 0 1px #fff inset; }
.decors button:hover { border-color: #9ab9ef; }
.decname { margin-top: 5px; color: var(--mute); }
.tints { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; }
.tints button { padding: 0; aspect-ratio: 1; border-radius: 50%; border: 1px solid #0002; }
.tints button.on { outline: 2px solid var(--sel); outline-offset: 1px; }
.tintrow { display: flex; gap: 6px; align-items: center; margin-top: 7px; color: var(--mute); }
.tintrow input[type=color] { width: 34px; height: 24px; padding: 0; border: 1px solid var(--line); border-radius: 5px; background: none; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; padding: 3px 8px; font-size: 12px; }
.seg button + button { border-left: 1px solid var(--line); }
.edgebox { margin-top: 8px; background: var(--soft); border-radius: 8px; padding: 6px; }
.edgebox svg { display: block; width: 100%; height: auto; }
.edgebox .side { cursor: pointer; }
.edgebox .side:hover .vis { stroke-opacity: .6; }
.row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; align-items: center; }
.actions { display: flex; gap: 6px; margin-top: 18px; flex-wrap: wrap; }
.danger { color: #c0392b; }
.kbd { font-size: 12px; color: var(--mute); line-height: 1.8; }
.kbd b { display: inline-block; min-width: 88px; color: var(--ink); font-weight: 500; }
.note { color: var(--mute); font-size: 12px; line-height: 1.5; }

.status {
  padding: 5px 12px; background: var(--panel); border-top: 1px solid var(--line); color: var(--mute);
  font-variant-numeric: tabular-nums; display: flex; gap: 18px; flex-wrap: wrap;
}

/* список деталей */
.cut { position: absolute; inset: 0; background: var(--bg); overflow: auto; padding: 18px 22px 40px; z-index: 5; }
.cut h2 { margin: 0 0 4px; font-size: 20px; }
.cut .opts { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin: 12px 0 18px; }
.cut .opts label { display: flex; gap: 6px; align-items: center; }
.cut h3 { margin: 22px 0 8px; font-size: 14px; display: flex; gap: 10px; align-items: baseline; }
.cut h3 span { color: var(--mute); font-weight: 400; font-size: 12px; }
.cut table { border-collapse: collapse; width: 100%; background: var(--panel); border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.cut th, .cut td { border-bottom: 1px solid var(--line); padding: 5px 8px; text-align: left; vertical-align: middle; }
.cut th { font-size: 11px; color: var(--mute); font-weight: 600; background: var(--soft); text-transform: uppercase; letter-spacing: .4px; }
.cut td.num, .cut th.num { text-align: right; }
.cut td.big { font-weight: 600; font-size: 14px; }
.cut td.e span { display: inline-block; min-width: 30px; padding: 1px 5px; border-radius: 4px; font-size: 11px; text-align: center; }
.cut tr:hover td { background: #fbf9f5; }
.cut .sum { margin-top: 18px; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.cut .card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.cut .card h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--mute); }
.cut .card div { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; }
.cut .emptycut { color: var(--mute); padding: 40px 0; }

.dlg { border: 0; border-radius: 12px; padding: 20px 22px; box-shadow: 0 20px 60px #0004; max-width: 94vw; }
.dlg::backdrop { background: #0004; }
.dlg h2 { margin: 0 0 14px; font-size: 17px; }
.fgrid { display: grid; grid-template-columns: repeat(2, 170px); gap: 10px 14px; }
.fgrid label { display: flex; flex-direction: column; gap: 4px; color: var(--mute); font-size: 12px; }
.fgrid label.chk { flex-direction: row; align-items: center; grid-column: span 2; color: var(--ink); font-size: 13px; }
.hint { color: var(--mute); font-size: 12px; max-width: 360px; line-height: 1.5; }
.dbtns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.plist { min-width: 360px; max-height: 50vh; overflow: auto; }
.plist .pi { display: flex; gap: 8px; align-items: center; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.plist .pi .n { flex: 1; font-weight: 600; }
.plist .pi .d { color: var(--mute); font-size: 12px; }
.plist .pi.cur .n::after { content: " · открыт"; color: var(--acc); font-weight: 400; }

@media (max-width: 900px) {
  .list { display: none; }
  .props { width: 250px; }
}
@media (max-width: 640px) {
  body { overflow: auto; }
  main { flex-direction: column; }
  .view { min-height: 58vh; }
  .props { width: auto; border-left: 0; border-top: 1px solid var(--line); }
  .pname { width: 130px; }
}
@media print {
  .bar, .list, .view, .props, .status, .cut .opts, .noprint { display: none !important; }
  body, html { overflow: visible; height: auto; background: #fff; }
  main { display: block; }
  .cut { position: static; padding: 0; background: #fff; }
  .cut[hidden] { display: block !important; }
}

/* библиотека декоров */
.dtabs { margin-bottom: 7px; display: flex; }
.dtabs button { flex: 1; }
.libbar select { flex: 1; min-width: 0; }
.libbar input { width: 90px; }
.libbar { margin: 0 0 7px; }
.decors button { background-color: #ece8e1; }
.note.dnd { margin-top: 6px; }
.libcats-list { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 14px; max-height: 44vh; overflow: auto; margin: 8px 0; padding: 8px; background: var(--soft); border-radius: 8px; }
.libcats-list label { display: flex; gap: 6px; align-items: center; font-size: 12px; }
.libcats-list label span { color: var(--mute); margin-left: auto; }
#dlg-lib { width: 560px; }
#dlg-msg { max-width: 460px; }
#dlg-msg .body p { margin: 0 0 8px; }

/* примеры */
.dlg h3.dh { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--mute); margin: 16px 0 4px; }
.empty .demos { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; pointer-events: auto; }
.empty .demos span { width: 100%; }
.empty .demos:empty { display: none; }

/* раскрой и смета */
.cuttabs { margin: 10px 0 6px; }
.cuttabs button { padding: 5px 14px; font-size: 13px; }
.sheets { display: flex; flex-wrap: wrap; gap: 16px; }
.sheet { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px; max-width: 100%; }
.sheet svg { max-width: 100%; height: auto; display: block; }
.sheet .sh-h { font-size: 12px; color: var(--mute); margin-bottom: 6px; }
.warn { background: #fff1e6; border: 1px solid #f3c79c; color: #8a4a12; padding: 6px 10px; border-radius: 8px; margin: 6px 0; }
table.cost { max-width: 900px; }
table.cost input[type=number] { width: 100px; text-align: right; }
table.cost .hwname { width: 100%; min-width: 220px; }
table.cost tr.grp td { background: var(--soft); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--mute); font-weight: 600; }
table.cost tfoot td { font-weight: 700; font-size: 15px; background: var(--soft); }
table.cost .row button { font-size: 12px; padding: 3px 8px; }
@media print { .sheet { break-inside: avoid; } .cuttabs { display: none; } table.cost input { border: 0; } }

/* изделия, скрытые, размеры */
.lg { padding: 6px 6px 3px; font-weight: 600; font-size: 12px; cursor: pointer; border-radius: 6px; color: #5b4630; display: flex; gap: 6px; }
.lg span { margin-left: auto; color: var(--mute); font-weight: 400; }
.lg:hover { background: var(--soft); }
.lg.sel { background: #eaf2ff; }
.li.sub { padding-left: 16px; }
.li.hid { opacity: .4; }
.list h4 a, .status a { color: var(--acc); }
.dims { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.dims div { position: absolute; left: 0; top: 0; background: #1d5fd6; color: #fff; font-size: 11px; font-weight: 600; padding: 1px 5px; border-radius: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; }
input.share { width: 100%; font-size: 12px; }

/* габариты */
.li.ref .n { font-style: italic; color: var(--mute); }
.refchk { display: flex; gap: 6px; align-items: flex-start; font-size: 12px; color: var(--mute); margin: 8px 0 2px; line-height: 1.35; }

/* окно «Проекты» */
.dlg-wide { width: min(1100px, 96vw); max-height: 90vh; padding: 16px 18px; }
.dlg-wide form { display: flex; flex-direction: column; max-height: calc(90vh - 32px); }
.phead { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.phead .ptabs { margin-right: auto; }
.ptabs button { padding: 7px 16px; font-size: 14px; }
#pgrid { overflow-y: auto; min-height: 200px; }
.pcats { margin-bottom: 12px; flex-wrap: wrap; }
.pcats button { padding: 4px 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.pcard { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--panel); transition: border-color .15s, box-shadow .15s; }
.pcard:hover { border-color: #c9a06c; box-shadow: 0 4px 16px #0001; }
.pcard.cur { border-color: var(--acc); }
.pthumb { aspect-ratio: 16 / 10; background: #efece6; }
.pthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pthumb:empty { background: linear-gradient(90deg, #efece6, #f7f5f1, #efece6); background-size: 200% 100%; animation: pshine 1.4s linear infinite; }
@keyframes pshine { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .pthumb:empty { animation: none; } }
.pname { padding: 8px 10px 2px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.pmeta { padding: 0 10px 9px; color: var(--mute); font-size: 12px; }
.pmeta b { color: var(--acc); font-weight: 600; }
.pdel { position: absolute; top: 6px; right: 6px; padding: 2px 7px; background: #fffe; opacity: 0; }
.pcard:hover .pdel { opacity: 1; }
.pempty { color: var(--mute); padding: 40px 0; text-align: center; }

/* скины */
.skin { display: grid; gap: 5px; }
.skin label { display: grid; grid-template-columns: 1fr 112px 30px; gap: 6px; align-items: center; font-size: 12px; }
.skin label em { color: var(--mute); font-style: normal; }
.skin select { min-width: 0; font-size: 12px; }
.skin input[type=color] { width: 30px; height: 24px; padding: 0; border: 1px solid var(--line); border-radius: 5px; background: none; }
.skhist { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.skhist button { display: flex; gap: 2px; padding: 3px; }
.skhist i { width: 14px; height: 14px; border-radius: 3px; background-size: cover; display: block; }

.openseg { flex-wrap: wrap; }
.openseg button { font-size: 12px; padding: 3px 7px; }

/* «Добавить» */
.addgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.addcard { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 4px 8px; white-space: normal; text-align: center; cursor: grab; }
.addcard b { font-size: 12px; font-weight: 600; }
.addcard span { font-size: 10px; color: var(--mute); line-height: 1.2; }
.ic { display: block; height: 30px; width: 40px; position: relative; }
.ic::after { content: ""; position: absolute; background: #e6cfa6; border: 1px solid #b08a5a; }
.ic-h::after { left: 2px; right: 2px; top: 12px; height: 6px; }
.ic-v::after { left: 17px; width: 6px; top: 0; bottom: 0; }
.ic-f::after { left: 8px; right: 8px; top: 0; bottom: 0; }
.assetlist { display: flex; flex-direction: column; gap: 4px; }
.assetlist button { text-align: left; white-space: normal; font-size: 12px; }
.assetlist .acat { font-size: 11px; color: var(--mute); margin: 6px 0 2px; }
.li .d b { color: var(--acc); font-weight: 600; }
.dims div.faint { background: #1d5fd655; }

/* модули */
.msecs { display: grid; gap: 6px; margin-top: 8px; }
.msec { display: grid; grid-template-columns: 16px 64px 1fr; gap: 4px 6px; align-items: center; font-size: 12px; background: var(--soft); border-radius: 7px; padding: 6px; }
.msec b { color: var(--mute); }
.msec select, .msec input { font-size: 12px; min-width: 0; }
.msec select:nth-of-type(2), .msec select:nth-of-type(3) { grid-column: 2 / -1; }
#props .warn { font-size: 12px; margin: 6px 0; }

/* сверление */
.cut .legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 8px 0 14px; font-size: 12px; }
.drillcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); gap: 14px; }
.dcard { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; break-inside: avoid; page-break-inside: avoid; }
.dcard .dh { font-size: 13px; margin-bottom: 6px; }
.dcard .dh span { color: var(--mute); margin-left: 6px; }
.dcard .dv + .dv { border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 8px; }
.dcard .dvt { font-size: 11px; color: var(--mute); text-transform: uppercase; letter-spacing: .4px; }
.dcard .drillsvg { display: block; max-width: 100%; height: auto; margin: 4px 0; }
.cut table.dt { font-size: 11px; }
.cut table.dt td, .cut table.dt th { padding: 2px 5px; }
@media (max-width: 520px) { .drillcards { grid-template-columns: 1fr; } }
@media print { .drillcards { display: block; } .dcard { margin-bottom: 10px; } }

/* сборка */
.asmsteps { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.astep { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; break-inside: avoid; page-break-inside: avoid; }
.astep img { width: 100%; height: auto; aspect-ratio: 480 / 300; background: #efece6; border-radius: 6px; display: block; }
.astep .at { margin: 8px 0 3px; font-size: 14px; }
.astep .ap { font-size: 12px; color: var(--mute); margin-bottom: 4px; }
@media print { .asmsteps { display: block; } .astep { margin-bottom: 10px; } }

/* замер */
#dlg-measure { width: min(860px, 96vw); max-height: 92vh; overflow: auto; }
#dlg-measure h3 { font-size: 13px; margin: 14px 0 4px; }
.mrow { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.mrow > div > label { display: flex; flex-direction: column; gap: 4px; color: var(--mute); font-size: 12px; margin-bottom: 10px; }
.msvg { width: 100%; height: auto; }
.fgrid.f3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fgrid input { width: 100%; box-sizing: border-box; }
.obst .orow { display: grid; grid-template-columns: 1.4fr repeat(5, 1fr) auto; gap: 6px; margin-bottom: 6px; }
.obst .orow input, .obst .orow select { min-width: 0; width: 100%; box-sizing: border-box; }
.mres { margin: 12px 0; padding: 10px 12px; background: var(--soft); border-radius: 8px; font-size: 13px; line-height: 1.5; }
.mres .bad { color: #b3261e; font-weight: 600; }
.howto { font-size: 13px; color: var(--mute); margin-bottom: 8px; }
.howto summary { cursor: pointer; color: var(--ink); }
@media (max-width: 640px) { .mrow { grid-template-columns: 1fr; } .fgrid.f3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .obst .orow { grid-template-columns: repeat(3, 1fr); } }
.mylib .myel { display: flex; gap: 4px; }
.mylib .myel button:first-child { flex: 1; text-align: left; }
.lg b[data-fold] { cursor: pointer; width: 12px; display: inline-block; color: var(--mute); font-weight: 400; }
.lg.hid { opacity: .5; }
.ly { display: flex; gap: 6px; align-items: center; padding: 3px 6px; font-size: 12px; cursor: pointer; border-radius: 6px; }
.ly:hover { background: var(--soft); }
.ly.off { color: var(--mute); }
.ly span { margin-left: auto; color: var(--mute); }
.ly input { margin: 0; pointer-events: none; }
.rotang input { width: 64px; }
.ly i { font-style: normal; font-size: 10px; color: var(--mute); }

/* каталог PRO100 во вкладке «Добавить» */
.catbar { display: flex; gap: 6px; margin-bottom: 8px; }
.catbar select { flex: 1; min-width: 0; }
.catbar input { width: 40%; min-width: 0; }
.p100grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.p100el { display: flex; flex-direction: column; align-items: stretch; padding: 4px; gap: 3px; text-align: left; }
.p100el img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #efece6; border-radius: 4px; }
.p100el span { font-size: 11px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p100grid .more { grid-column: 1 / -1; }
.g2f { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.g2f label, label.notes { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--mute); }
.g2f input, label.notes textarea { width: 100%; box-sizing: border-box; font: inherit; color: var(--ink); }
label.notes { margin-top: 6px; }
.lyed { display: flex; gap: 6px; align-items: center; margin-bottom: 4px; font-size: 11px; }
.lyed input[data-lname] { flex: 1; min-width: 0; }
.lyed label { display: flex; gap: 2px; align-items: center; color: var(--mute); }
.shapebox { display: flex; gap: 8px; align-items: flex-start; }
.shcs { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.shc { display: flex; gap: 4px; align-items: center; font-size: 11px; }
.shc b { color: #b35c00; width: 10px; }
.shc select { flex: 1; min-width: 0; }
.shc input { width: 52px; }
.shh { display: flex; gap: 4px; align-items: center; font-size: 11px; margin-top: 4px; }
.shh input { width: 56px; }
.rulers div { background: #b35c00; }
.rulers small { font-weight: 400; opacity: .85; margin-left: 4px; }
.rulers b { pointer-events: auto; cursor: pointer; margin-left: 4px; opacity: .8; }

/* чертежи */
.drawcard { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; break-inside: avoid; page-break-inside: avoid; }
.drawcard .dh span { color: var(--mute); margin-left: 6px; font-size: 12px; }
.drawviews { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.drawviews figure { margin: 0; }
.drawviews figcaption { font-size: 11px; color: var(--mute); text-align: center; }
.drawsvg { max-width: 100%; height: auto; display: block; }

/* выключатель: всплывает по клику на клавишу или светильник, кнопки крупные — удобно тыкать */
.swpop {
  position: absolute; z-index: 20; width: max-content; max-width: calc(100% - 16px); max-height: calc(100% - 16px); overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(35, 32, 28, .18); padding: 10px; display: flex; flex-direction: column; gap: 8px;
}
.swpop[hidden] { display: none; }
.swpop .swhead { cursor: move; user-select: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.swpop .swhead b { font-size: 15px; margin-right: auto; }
.swpop .swhead button.on { background: var(--ink, #2b2824); color: #fff; border-radius: 6px; }
.swpop .ctninfo { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 7px; display: flex; flex-direction: column; gap: 6px; }
.swpop .ctninfo p { color: var(--mute); font-size: 12px; line-height: 1.35; }
.swpop .swhead button { border: 0; background: none; font-size: 16px; padding: 4px 8px; }
/* копия устройства: чёрная рамка, клавиши с огоньком, нажатая половина темнее */
.swpop .swdev { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 4px 0 6px; }
.swpop .swframe { display: flex; gap: 6px; padding: 8px; background: #1c1c1c; border-radius: 12px; box-shadow: inset 0 1px 0 #3a3a3a, 0 2px 6px rgba(0,0,0,.25); }
.swpop .swpost { width: 136px; height: 124px; display: flex; gap: 4px; padding: 4px; background: #111; border-radius: 6px; }
.swpop .swk { flex: 1; position: relative; border: 0; padding: 0; border-radius: 4px; cursor: pointer;
  background: linear-gradient(#262626 0 50%, #141414 50%); box-shadow: inset 0 -3px 0 #2e2e2e; }
.swpop .swk.on { background: linear-gradient(#141414 0 50%, #2a2a2a 50%); box-shadow: inset 0 3px 0 #2e2e2e; }
.swpop .swk:focus-visible { outline: 2px solid var(--sel); outline-offset: 2px; }
.swpop .swled { position: absolute; left: 50%; bottom: 12px; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: #444; }
.swpop .swk.on .swled { background: #ffc35a; box-shadow: 0 0 6px #ffb733; }
.swpop .sock { align-items: center; justify-content: center; }
.swpop .sockface { width: 76px; height: 76px; border-radius: 50%; background: #1a1a1a; box-shadow: inset 0 2px 5px #000; display: flex; align-items: center; justify-content: center; gap: 16px; }
.swpop .sockface i { width: 9px; height: 9px; border-radius: 50%; background: #000; box-shadow: inset 0 1px 1px #000, 0 1px 0 #333; }
.swpop .swlabs { display: flex; gap: 6px; padding: 0 8px; }
.swpop .swlab { width: 136px; display: flex; gap: 4px; padding: 0 4px; }
.swpop .swlab span { flex: 1; font-size: 12px; line-height: 1.25; text-align: center; color: var(--ink, #2b2824); hyphens: manual; overflow-wrap: normal; }
.swpop .swwire { width: 3px; height: 18px; background: #e07b39; border-radius: 2px; position: relative; }
.swpop .swwire.up::before, .swpop .swwire.down::after { content: ''; position: absolute; left: -4px; border: 5px solid transparent; }
.swpop .swwire.up::before { top: -8px; border-bottom-color: #e07b39; }
.swpop .swwire.down::after { bottom: -8px; border-top-color: #e07b39; }
.swpop .swwire.down { margin-bottom: 6px; }
.swpop .swwire.up { margin-top: 6px; }
.swpop .swrow { display: flex; align-items: center; gap: 10px; }
.swpop .swwire.left, .swpop .swwire.right { width: 18px; height: 3px; }
.swpop .swwire.left::before, .swpop .swwire.right::after { content: ''; position: absolute; top: -4px; border: 5px solid transparent; }
.swpop .swwire.left::before { left: -8px; border-right-color: #e07b39; }
.swpop .swwire.right::after { right: -8px; border-left-color: #e07b39; }
/* термостат: чёрный квадрат, экран и сенсорные кнопки */
.swpop .thermo { width: 180px; padding: 12px; background: #161616; border-radius: 14px; box-shadow: inset 0 1px 0 #3a3a3a, 0 2px 6px rgba(0,0,0,.25); display: flex; flex-direction: column; gap: 10px; }
.swpop .thscreen { height: 92px; border-radius: 8px; background: #0b0b0b; color: #8fd3ff; display: grid; grid-template-columns: 1fr auto; align-content: center; padding: 0 12px; font-variant-numeric: tabular-nums; }
.swpop .thermo.on .thscreen { background: #0d1a22; box-shadow: inset 0 0 12px rgba(120, 200, 255, .25); }
.swpop .thset { font-size: 34px; font-weight: 600; grid-column: 1; }
.swpop .thfloor { font-size: 13px; opacity: .8; grid-column: 1; }
.swpop .thheat { grid-column: 2; grid-row: 1 / 3; align-self: center; font-size: 26px; color: #ff9a3c; opacity: 0; }
.swpop .thheat.go { opacity: 1; }
.swpop .thbtns { display: flex; justify-content: space-between; }
.swpop .thbtns button { width: 46px; height: 40px; border: 0; border-radius: 8px; background: #222; color: #cfe9ff; font-size: 20px; cursor: pointer; }
.swpop .thbtns button:disabled { opacity: .35; cursor: default; }
.swpop .thbtns button:focus-visible { outline: 2px solid var(--sel); outline-offset: 2px; }
/* тумблер «Стена с дверью» */
.tgl { display: inline-flex; align-items: center; gap: 7px; padding: 3px 8px 3px 4px; cursor: pointer; user-select: none; white-space: nowrap; }
.tgl[hidden] { display: none; }
.tgl input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tgl-track { width: 30px; height: 18px; border-radius: 9px; background: #cfc9bf; position: relative; transition: background .15s; flex: none; }
.tgl-track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.tgl input:checked + .tgl-track { background: #2b2824; }
.tgl input:checked + .tgl-track::after { transform: translateX(12px); }
.tgl input:focus-visible + .tgl-track { outline: 2px solid var(--sel); outline-offset: 2px; }
#view:fullscreen { background: var(--bg); }
@media (prefers-reduced-motion: reduce) { .tgl-track, .tgl-track::after { transition: none; } }

/* «Пройтись»: прицел, панель роста, джойстик на телефоне */
.walkcross { position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; pointer-events: none; z-index: 15; }
.walkcross::before, .walkcross::after { content: ''; position: absolute; background: #fff; box-shadow: 0 0 2px rgba(0,0,0,.6); }
.walkcross::before { left: 6px; top: 0; width: 2px; height: 14px; }
.walkcross::after { top: 6px; left: 0; height: 2px; width: 14px; }
.walkcross[hidden], .walkbar[hidden], .walkpad[hidden], .walkhint[hidden] { display: none; }
/* при ходьбе на экране только прицел: рост и выход — уголком справа сверху, подсказка гаснет сама */
.walkbar { position: absolute; right: 12px; top: 12px; z-index: 16; display: flex; align-items: center; gap: 4px;
  padding: 4px 5px; background: rgba(255,255,255,.8); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 2px 10px rgba(35,32,28,.12); font-size: 12px; }
.walkbar label { display: flex; align-items: center; gap: 4px; color: var(--mute); }
.walkbar input { width: 54px; }
.walkbar button { padding: 3px 7px; display: inline-flex; align-items: center; }
.walkhint { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 16; max-width: calc(100% - 32px);
  padding: 6px 12px; border-radius: 10px; background: rgba(32,30,27,.72); color: #fff; font-size: 12px; pointer-events: none; transition: opacity .7s; }
.walkhint.off { opacity: 0; }
@media (pointer: coarse) { .walkhint { display: none; } }
.walkpad { position: absolute; left: 20px; bottom: 80px; width: 120px; height: 120px; border-radius: 50%; background: rgba(255,255,255,.35); border: 2px solid rgba(255,255,255,.7); z-index: 16; touch-action: none; }
.walkpad i { position: absolute; left: 35px; top: 35px; width: 50px; height: 50px; border-radius: 50%; background: rgba(255,255,255,.85); box-shadow: 0 2px 6px rgba(0,0,0,.25); }

/* меню «Файл» */
.menuwrap { position: relative; }
.menupop { position: absolute; top: calc(100% + 4px); left: 0; z-index: 40; min-width: 280px; display: flex; flex-direction: column; padding: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(35,32,28,.18); }
.menupop[hidden] { display: none; }
.menupop button { border: 0; background: none; text-align: left; padding: 7px 10px; border-radius: 6px; }
.menupop button:hover, .menupop button:focus-visible { background: #f1ede6; }
.menusep { font-size: 11px; color: var(--mute); text-transform: uppercase; letter-spacing: .5px; padding: 8px 10px 2px; border-top: 1px solid var(--line); margin-top: 4px; }

/* боковые панели прячутся */
body.noList #list, body.noProps .props { display: none; }
/* слои — окно над сценой */
.layerpop { position: absolute; left: 12px; top: 96px; z-index: 30; min-width: 260px; max-height: calc(100% - 120px); overflow: auto; padding: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(35,32,28,.18); display: flex; flex-direction: column; gap: 2px; }
.layerpop[hidden] { display: none; }
.layerpop .lyrow { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 6px; cursor: pointer; }
.layerpop .lyrow:hover { background: #f1ede6; }
.layerpop .lyrow span { margin-left: auto; color: var(--mute); font-size: 12px; }
/* подписи на плане */
.note3d { position: absolute; left: 0; top: 0; padding: 2px 6px; font-size: 11px; line-height: 1.25; max-width: 180px; background: #fffdf6e6; border: 1px solid #e3d9c6; border-radius: 5px; color: #4a4036; pointer-events: none; white-space: normal; }

/* режим «Планировка»: мебельные кнопки спрятаны */
body.mode-plan .furn { display: none !important; }
.tabs.modes button { padding: 6px 12px; }
/* меню штор */
.swpop .ctn { display: flex; flex-direction: column; gap: 8px; width: 300px; font-size: 13px; }
.swpop .ctn p { margin: 0; line-height: 1.35; }
.swpop .ctnbig { font-size: 15px; }
.swpop .ctnsub { color: var(--mute); font-size: 12px; }
.swpop .ctnrow { display: flex; align-items: center; gap: 6px; }
.swpop .ctnrow > span { width: 96px; color: var(--mute); }
.swpop .ctnrow input[type=range] { flex: 1; }
.swpop .ctngo { margin-top: 4px; padding: 10px; }
/* меню изделия: батарея, ванна, дверь, окно */
.swpop .ctnform { width: 330px; gap: 6px; }
.swpop .ctnform .ctnrow { flex-wrap: wrap; }
.swpop .ctnopts { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.swpop .ctnopts button { padding: 5px 8px; }
.swpop .ctnrow button.on { background: var(--ink, #2b2824); color: #fff; border-color: transparent; }
.swpop .ctnrow input[type=number] { width: 72px; }
.swpop .ctnrow em { font-style: normal; color: var(--mute); }
.swpop .ctnrow small { flex-basis: 100%; padding-left: 128px; color: var(--mute); font-size: 11px; }
/* иконки настроек: у строки и у каждого варианта (правило проекта) */
.ic { width: 16px; height: 16px; flex: none; }
.swpop .ctnform .ctnrow > span { width: 122px; display: flex; align-items: center; gap: 6px; }
.swpop .ctnopts button, .swpop .ctntabs button { display: inline-flex; align-items: center; gap: 5px; }
.swpop .ctntabs { display: flex; gap: 4px; padding-bottom: 7px; margin-bottom: 1px; border-bottom: 1px solid var(--line); }
.swpop .ctntabs button { padding: 5px 9px; }
.swpop .ctntabs button.on { background: var(--ink, #2b2824); color: #fff; border-color: transparent; }
.swpop .ctnchips { display: flex; flex-wrap: wrap; gap: 4px; flex-basis: 100%; padding-left: 128px; margin-top: 3px; }
.swpop .ctnchips button { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; font-size: 12px; }
.swpop .ctnchips button.on { background: var(--ink, #2b2824); color: #fff; border-color: transparent; }
.swpop .ctnhist { display: flex; flex-direction: column; gap: 4px; flex-basis: 100%; padding-left: 128px; margin-top: 2px; }
.swpop .ctnhist button { justify-content: flex-start; gap: 6px; display: inline-flex; align-items: center; font-size: 12px; padding: 4px 8px; }
.swpop .sw { width: 14px; height: 14px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); }
.swpop .ctnsect { margin: 4px 0 0; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--mute); }
.swpop .swhead button .ic { width: 14px; height: 14px; }
/* габариты и счётчик деталей: при ходьбе и в режиме «Планировка» не нужны */
.status:empty { display: none; }
body.walking .status { display: none; }

/* прицел над тем, с чем можно что-то сделать, — рука */
.walkcross.hand { width: 28px; height: 28px; margin: -14px 0 0 -14px; }
.walkcross.hand::before, .walkcross.hand::after { display: none; }
.walkcross.hand { background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 11V5.5a1.5 1.5 0 0 1 3 0V11m0-1.5V4a1.5 1.5 0 0 1 3 0v6m0-1a1.5 1.5 0 0 1 3 0v5c0 4-2.5 7-6.5 7S6 19 4.5 16L3 13.2a1.4 1.4 0 0 1 2.4-1.4L7 14V7.5a1.5 1.5 0 0 1 3 0' fill='%23fff' stroke='%23222' stroke-width='1.4' stroke-linejoin='round'/%3E%3C/svg%3E"); }
