@font-face {
  font-family: 'Manrope';
  src: url('/static/vendor/fonts/manrope-cyrillic-wght-normal.woff2') format('woff2');
  font-weight: 200 800; font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Manrope';
  src: url('/static/vendor/fonts/manrope-latin-wght-normal.woff2') format('woff2');
  font-weight: 200 800; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --bg: #efebe5;
  --desk: #e7e2da;
  --surface: rgba(255, 253, 249, 0.96); /* без размытия фона: оно дорогое при перерисовке 3D */
  --surface-solid: #fffdf9;
  --ink: #1d1b19;
  --ink-2: #4a4640;
  --muted: #847e75;
  --line: rgba(29, 27, 25, 0.1);
  --line-2: rgba(29, 27, 25, 0.16);
  --accent: #2d5b4f;
  --accent-2: #3b7263;
  --accent-soft: rgba(45, 91, 79, 0.1);
  --coral: #e4572e;
  --radius: 18px;
  --shadow-lg: 0 18px 50px rgba(52, 40, 26, 0.16), 0 3px 10px rgba(52, 40, 26, 0.07);
  --shadow-sm: 0 4px 14px rgba(52, 40, 26, 0.1);
  --chat-w: clamp(320px, 26vw, 400px);
  --ease: cubic-bezier(0.22, 0.8, 0.24, 1);
  --sheet-h: 0px;
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
kbd {
  display: inline-block; min-width: 1.5em; padding: 0 0.35em; margin: 0 1px; border-radius: 5px;
  border: 1px solid var(--line-2); background: #fff; font: 600 11px/1.6 inherit; text-align: center;
}

#app { position: fixed; inset: 0; overflow: hidden; background: var(--bg); }

/* ───────── кнопки ───────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 12px;
  border: 1px solid transparent; font-weight: 600; font-size: 14px; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { background: var(--surface); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--line-2); background: #fff; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; border: 0;
  background: transparent; color: var(--ink-2); transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ───────── 3D ───────── */
#stage3d {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1;
  background:
    radial-gradient(120% 90% at 50% 0%, #fbf9f5 0%, #f1ece4 55%, #e6dfd4 100%);
  transition: top 0.5s var(--ease), left 0.5s var(--ease), width 0.5s var(--ease), height 0.5s var(--ease),
    border-radius 0.5s var(--ease), box-shadow 0.5s var(--ease);
  overflow: hidden;
}
#stage3d .scene-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.scene-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.room-label {
  position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 6px 11px 7px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 253, 249, 0.86);
  box-shadow: 0 6px 18px rgba(52, 40, 26, 0.14); color: var(--ink); line-height: 1.15; white-space: nowrap;
  transition: opacity 0.2s; will-change: transform;
}
.room-label b { font-size: 12.5px; font-weight: 700; }
.room-label span { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.room-label:hover { border-color: var(--accent); }
.span-label {
  position: absolute; left: 0; top: 0; padding: 4px 10px; border-radius: 999px; background: var(--coral); color: #fff;
  font-weight: 800; font-size: 13px; box-shadow: 0 6px 16px rgba(228, 87, 46, 0.35); white-space: nowrap;
}
.pip-caption { display: none; }

/* превью 3D в режиме «План» */
#app[data-mode="plan"] #stage3d {
  top: calc(100% - var(--pip-bottom, 96px) - var(--pip-h, 200px)); left: 16px; width: var(--pip-w, 300px); height: var(--pip-h, 200px);
  border-radius: 18px; z-index: 6;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.7) inset;
}
#app[data-mode="plan"][data-chat="left"] #stage3d { left: calc(100% - 16px - var(--pip-w, 300px)); }
#app[data-mode="plan"][data-pip="off"] #stage3d { opacity: 0; pointer-events: none; }
#app[data-mode="plan"] .pip-caption {
  display: flex; align-items: center; gap: 7px; position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 2;
  padding: 7px 10px; border-radius: 11px; border: 0; background: rgba(255, 253, 249, 0.9);
  font-size: 12px; font-weight: 600; color: var(--ink-2); text-align: left;
}
.pip-caption b { margin-left: auto; color: var(--accent); }
.pip-dot { width: 7px; height: 7px; border-radius: 50%; background: #3aa76d; box-shadow: 0 0 0 3px rgba(58, 167, 109, 0.18); }
#app[data-mode="plan"] .scene-labels, #app[data-mode="plan"] .fly-touch { display: none; }

/* ───────── бумажный план ───────── */
#plan2d {
  position: absolute; inset: 0; z-index: 2; background: var(--desk); opacity: 0; pointer-events: none;
  transition: opacity 0.4s var(--ease);
}
#app[data-mode="plan"] #plan2d { opacity: 1; pointer-events: auto; }
.plan-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; user-select: none; -webkit-user-select: none; }
.plan-svg * { vector-effect: non-scaling-stroke; }
.plan-svg text { vector-effect: none; font-family: 'Manrope', sans-serif; text-anchor: middle; }
.plan-svg .paper { fill: #fffdf9; }
.plan-svg .paper-sh1 { fill: rgba(59, 47, 34, 0.1); }
.plan-svg .paper-sh2 { fill: rgba(59, 47, 34, 0.05); }
.plan-svg .paper-frame { fill: none; stroke: #1d1b19; stroke-width: 1px; }
.plan-svg .underlay { opacity: 0.32; pointer-events: none; }
.plan-svg .grid line { stroke: rgba(45, 91, 79, 0.13); stroke-width: 1px; }
.plan-svg .room { fill: transparent; pointer-events: all; transition: fill 0.15s; }
.plan-svg .room.is-sel { fill: rgba(45, 91, 79, 0.08); }
.plan-svg .room.is-target { fill: rgba(228, 87, 46, 0.14); animation: pulse-fill 1.6s ease-in-out infinite; }
@keyframes pulse-fill { 50% { fill: rgba(228, 87, 46, 0.24); } }
.plan-svg .wall { stroke: #1d1b19; stroke-width: 0.8px; }
.plan-svg .w-bearing { fill: url(#hatch-bearing); }
.plan-svg .w-partition { fill: url(#hatch-light); }
.plan-svg .w-unknown { fill: #36322e; }
.plan-svg .wall.draft { fill: rgba(45, 91, 79, 0.55); stroke: var(--accent); stroke-width: 1.5px; pointer-events: none; }
#plan2d[data-tool="select"] .wall:hover { stroke: var(--accent); stroke-width: 2px; }
#plan2d[data-tool="select"] .wall.h { cursor: ns-resize; }
#plan2d[data-tool="select"] .wall.v { cursor: ew-resize; }
.plan-svg .wall.is-sel { stroke: var(--accent); stroke-width: 3px; }
.plan-svg .wall.is-target { stroke: var(--coral); stroke-width: 3px; animation: pulse-stroke 1.4s ease-in-out infinite; }
@keyframes pulse-stroke { 50% { stroke-opacity: 0.45; } }
.plan-svg .cut { fill: #fffdf9; stroke: none; }
.plan-svg .thin { stroke: #1d1b19; stroke-width: 0.8px; fill: none; }
.plan-svg .leaf { stroke: #1d1b19; stroke-width: 1.8px; }
.plan-svg .swing { stroke: #1d1b19; stroke-width: 0.7px; fill: none; }
.plan-svg .o-hit { fill: transparent; pointer-events: all; }
#plan2d[data-tool="select"] .opening { cursor: grab; }
.plan-svg .o-sel { fill: rgba(45, 91, 79, 0.1); stroke: var(--accent); stroke-width: 2px; pointer-events: none; }
.plan-svg .o-target { fill: rgba(228, 87, 46, 0.14); stroke: var(--coral); stroke-width: 2px; pointer-events: none; }
.plan-svg .ghost { opacity: 0.55; pointer-events: none; }
.plan-svg .dim { stroke: #5b564f; stroke-width: 0.7px; }
.plan-svg .dim-tick { stroke: #5b564f; stroke-width: 1.2px; }
.plan-svg .dim-ext { stroke: #5b564f; stroke-width: 0.5px; }
.plan-svg .dim-text { font-size: 0.14px; fill: #5b564f; font-weight: 500; pointer-events: none; }
.plan-svg .dim-text.outer { font-size: 0.19px; font-weight: 600; fill: #3c3833; }
.plan-svg .dim.outer, .plan-svg .dim-tick.outer { stroke: #3c3833; }
.plan-svg .label { cursor: grab; }
.plan-svg .label-hit { fill: transparent; stroke: none; }
.plan-svg .label.is-sel .label-hit { fill: rgba(45, 91, 79, 0.07); stroke: var(--accent); stroke-width: 1px; }
.plan-svg .l-num { font-size: 0.15px; fill: #8a847b; font-weight: 600; }
.plan-svg .l-name { font-size: 0.19px; fill: #2d2a26; font-weight: 600; }
.plan-svg .l-area { font-size: 0.27px; fill: #1d1b19; font-weight: 800; }
.plan-svg .handle { fill: #fff; stroke: var(--accent); stroke-width: 2px; cursor: crosshair; }
.plan-svg .snap-dot { fill: var(--accent); pointer-events: none; }
.plan-svg .target-span line { stroke: var(--coral); stroke-width: 2.2px; }
.plan-svg .target-span rect { fill: var(--coral); stroke: none; }
.plan-svg .target-span text { fill: #fff; font-size: 0.2px; font-weight: 800; }
.plan-svg .target-point circle { fill: rgba(228, 87, 46, 0.18); stroke: var(--coral); stroke-width: 2px; }
.plan-svg .target-point .core { fill: var(--coral); }
.plan-svg .stamp rect, .plan-svg .stamp line { fill: none; stroke: #1d1b19; stroke-width: 0.8px; }
.plan-svg .stamp text { text-anchor: start; fill: #1d1b19; }
.plan-svg .st-title { font-size: 0.2px; font-weight: 800; letter-spacing: 0.02em; }
.plan-svg .st-row { font-size: 0.15px; fill: #4a4640; }
.plan-svg .st-val { font-size: 0.16px; font-weight: 700; }
.plan-svg .st-sub { font-size: 0.14px; fill: #6b665e; }
.plan-svg .utility circle, .plan-svg .utility rect, .plan-svg .utility path, .plan-svg .utility line { stroke-width: 1.4px; }
.plan-svg .u-txt { font-weight: 800; text-anchor: middle; }
.plan-svg .u-txt.light { fill: #fff; font-size: 0.11px; }
.plan-svg .u-hit, .plan-svg .fx-hit { fill: transparent; stroke: none; pointer-events: all; }
#plan2d[data-tool="select"] .utility, #plan2d[data-tool="select"] .fixture { cursor: grab; }
.plan-svg .u-sel, .plan-svg .fx-sel { fill: none; stroke: var(--accent); stroke-width: 2px; stroke-dasharray: 4 3; pointer-events: none; }
.plan-svg .utilities.is-target circle:not(.u-hit) { animation: pulse-util 1.2s ease-in-out infinite; }
@keyframes pulse-util { 50% { stroke: var(--coral); stroke-width: 3.5px; } }
.plan-svg .fx-o { fill: #fffdf9; stroke: #2b2825; stroke-width: 1px; }
.plan-svg .fx-i { fill: none; stroke: #6b665e; stroke-width: 0.8px; }

.plan-tip {
  position: absolute; left: 0; top: 0; z-index: 8; padding: 4px 9px; border-radius: 8px; background: var(--ink); color: #fff;
  font-size: 12px; font-weight: 700; pointer-events: none; white-space: nowrap; box-shadow: var(--shadow-sm);
}

/* инспектор выбранного на плане */
.inspector {
  position: absolute; top: 72px; left: 90px; right: 16px; margin: 0 auto; width: fit-content; z-index: 7;
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; max-width: 760px;
  padding: 8px 10px 8px 14px; border-radius: 16px; background: var(--surface); border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow-lg); font-size: 13.5px;
}
#app[data-chat="right"] .inspector { right: calc(var(--chat-w) + 28px); }
#app[data-chat="left"] .inspector { left: calc(var(--chat-w) + 104px); }
.inspector.anchored { left: 0; right: auto; top: 0; margin: 0; width: max-content; max-width: min(560px, calc(100vw - 32px)); }
#app[data-state]:not([data-state="ready"]) .inspector { display: none; }
.ins-title { font-weight: 800; display: flex; flex-direction: column; line-height: 1.15; }
.ins-title small { font-weight: 600; color: var(--muted); font-size: 11px; }
.ins-field { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; font-size: 12.5px; }
.ins-field input, .ins-field select {
  height: 32px; border-radius: 9px; border: 1px solid var(--line-2); background: #fff; padding: 0 8px;
  font-weight: 700; color: var(--ink); font-size: 13.5px;
}
.ins-field input { width: 70px; text-align: right; }
.ins-field.wide input { width: 180px; text-align: left; }
.ins-field em { font-style: normal; color: var(--muted); }
.ins-field input:focus, .ins-field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ins-toggle, .ins-btn {
  height: 32px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line-2); background: #fff; font-weight: 700; font-size: 13px;
}
.ins-toggle.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.ins-btn:hover, .ins-toggle:hover { border-color: var(--accent); }
.ins-del { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: #b8442a; }
.ins-del:hover { background: rgba(228, 87, 46, 0.1); }
.ins-seg { display: inline-flex; padding: 3px; border-radius: 10px; background: rgba(29, 27, 25, 0.06); gap: 2px; }
.ins-seg button { height: 28px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; font-weight: 700; font-size: 12.5px; color: var(--ink-2); }
.ins-seg button[aria-checked="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1); }
.ins-note { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.inspector .room-card.in-plan { min-width: 300px; }

/* ───────── карточка комнаты ───────── */
.room-card { font-size: 13.5px; }
.room-card.floating {
  position: absolute; z-index: 7; left: 16px; top: 66px; width: 300px; padding: 14px 16px 12px;
  max-height: calc(100vh - 66px - 270px); overflow: auto;
  border-radius: var(--radius); background: var(--surface); border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow-lg);
  animation: card-in 0.25s var(--ease);
}
@keyframes card-in { from { opacity: 0; transform: translateY(6px); } }
#app[data-chat="left"] .room-card.floating { left: calc(var(--chat-w) + 30px); }
.rc-head { display: flex; align-items: center; gap: 8px; padding-right: 26px; }
.rc-name { font-size: 16px; font-weight: 800; flex: 1; min-width: 0; }
input.rc-name { height: 34px; border: 1px solid var(--line-2); border-radius: 9px; padding: 0 9px; background: #fff; }
input.rc-name:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.rc-wet { flex: none; padding: 3px 8px; border-radius: 999px; background: rgba(47, 127, 216, 0.12); color: #2265b3; font-size: 11.5px; font-weight: 800; }
.rc-area { display: flex; align-items: baseline; gap: 8px; margin: 6px 0 8px; }
.rc-area b { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }
.rc-area small { color: var(--muted); font-weight: 600; }
.rc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin: 0; }
.rc-grid div { display: flex; flex-direction: column; padding-top: 6px; border-top: 1px solid var(--line); }
.rc-grid dt { color: var(--muted); font-size: 11.5px; font-weight: 600; }
.rc-grid dd { margin: 0; font-weight: 800; font-size: 14px; }
.rc-actions { display: flex; gap: 8px; margin-top: 12px; }
.rc-actions .btn { height: 34px; padding: 0 12px; font-size: 13px; }
.rc-close { position: absolute; top: 9px; right: 9px; }

/* ───────── первый экран ───────── */
#hero, #working, #failed {
  position: absolute; inset: 0; z-index: 3; display: none; align-items: center; justify-content: center;
  padding: 80px 32px 40px; background: var(--bg);
}
#app[data-state="empty"] #hero, #app[data-state="boot"] #hero { display: flex; }
#app[data-state="working"] #working { display: flex; }
#app[data-state="error"] #failed { display: flex; }
#app[data-chat="right"] #hero, #app[data-chat="right"] #working, #app[data-chat="right"] #failed { padding-right: calc(var(--chat-w) + 48px); }
#app[data-chat="left"] #hero, #app[data-chat="left"] #working, #app[data-chat="left"] #failed { padding-left: calc(var(--chat-w) + 48px); }
.hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.bp-plan path { stroke: rgba(45, 91, 79, 0.07); stroke-linecap: round; stroke-linejoin: round; }
.bp-ext { stroke-width: 16; }
.bp-int { stroke-width: 6; }
.bp-win { stroke: rgba(255, 253, 249, 0.95) !important; stroke-width: 10; }
.bp-door { stroke-width: 2.5; stroke-dasharray: 5 6; }
.bp-plan { animation: bp-float 14s ease-in-out infinite alternate; transform-origin: 600px 400px; }
@keyframes bp-float { to { transform: translateY(-14px) scale(1.02); } }
.hero-inner { position: relative; width: min(640px, 100%); }
.eyebrow { margin: 0 0 12px; color: var(--accent); font-weight: 800; font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; }
#hero h1 { margin: 0; font-size: clamp(32px, 4.3vw, 54px); line-height: 1.04; letter-spacing: -0.025em; font-weight: 800; }
.lede { margin: 16px 0 26px; font-size: 17px; line-height: 1.5; color: var(--ink-2); max-width: 560px; }
.dropzone {
  display: grid; justify-items: center; gap: 6px; padding: 30px 24px 26px; border-radius: 24px; text-align: center; cursor: pointer;
  border: 2px dashed rgba(45, 91, 79, 0.32); background: rgba(255, 253, 249, 0.82);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, transform 0.2s var(--ease), box-shadow 0.2s, background 0.2s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-lg); background: #fffefb; }
.dz-icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; background: var(--accent-soft); color: var(--accent); margin-bottom: 6px; }
.dz-title { font-size: 18px; font-weight: 800; }
.dz-sub { color: var(--ink-2); font-size: 14.5px; }
.dz-sub u { text-decoration-color: rgba(45, 91, 79, 0.45); text-underline-offset: 3px; color: var(--accent); font-weight: 700; }
.dz-formats { margin-top: 6px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.steps { list-style: none; padding: 0; margin: 26px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.steps li { display: flex; gap: 10px; align-items: flex-start; }
.steps b {
  flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--ink); color: #fff; font-size: 12.5px; font-weight: 800;
}
.steps strong { display: block; font-size: 14px; margin-bottom: 2px; }
.steps span { display: block; font-size: 12.5px; line-height: 1.4; color: var(--muted); }

/* распознавание */
.work-card {
  position: relative; display: flex; gap: 20px; align-items: center; width: min(560px, 100%); padding: 20px;
  border-radius: 24px; background: var(--surface-solid); box-shadow: var(--shadow-lg);
}
.work-thumb { position: relative; flex: none; width: 150px; height: 150px; border-radius: 16px; overflow: hidden; background: #f3efe8; }
.work-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.work-thumb img:not([src]) { visibility: hidden; }
.scan {
  position: absolute; left: 0; right: 0; height: 40%; top: -40%;
  background: linear-gradient(180deg, transparent, rgba(45, 91, 79, 0.28) 85%, rgba(45, 91, 79, 0.7));
  animation: scan 1.8s ease-in-out infinite;
}
@keyframes scan { to { top: 100%; } }
.work-body { flex: 1; min-width: 0; }
.work-title { font-size: 19px; font-weight: 800; }
.work-step { margin: 6px 0 12px; color: var(--ink-2); font-weight: 600; min-height: 1.4em; }
.work-bar, .job-bar, .upload-bar { height: 6px; border-radius: 999px; background: rgba(29, 27, 25, 0.08); overflow: hidden; }
.work-bar i, .job-bar i, .upload-bar i { display: block; height: 100%; width: 4%; border-radius: inherit; background: var(--accent); transition: width 0.6s var(--ease); }
.work-note { margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.work-card.fail .work-title { color: #b8442a; }
.fail-text { color: var(--ink-2); line-height: 1.5; margin: 8px 0 16px; }

/* особенности: выступы, короба, колонны */
.plan-svg .feature { fill: url(#hatch-light); stroke: #1d1b19; stroke-width: 1px; }
.plan-svg .feature.f-niche { fill: none; stroke-dasharray: 4 3; }
.plan-svg .feature.f-beam { fill: none; stroke-dasharray: 8 3 2 3; }
.ins-mat { flex-basis: 100%; display: grid; gap: 4px; margin: 2px 0 0; padding-top: 8px; border-top: 1px solid var(--line); max-width: 600px; }
.ins-mat div { display: grid; grid-template-columns: 78px 1fr; gap: 8px; }
.ins-mat dt { color: var(--muted); font-weight: 700; font-size: 12px; }
.ins-mat dd { margin: 0; font-size: 12.5px; line-height: 1.4; color: var(--ink-2); font-weight: 500; }

/* разрезы */
.plan-svg.has-layer .dims, .plan-svg.has-layer .labels, .plan-svg.has-layer .fixtures { opacity: 0.38; }
.plan-svg.has-layer .wall { opacity: 0.75; }
.plan-svg .item circle, .plan-svg .item path, .plan-svg .item line { stroke-width: 1.5px; }
#plan2d[data-tool="select"] .item { cursor: grab; }
.plan-svg .link { stroke: #b39200; stroke-width: 1.2px; stroke-dasharray: 5 4; fill: none; }
.plan-svg .link.is-on { stroke: var(--accent); stroke-width: 1.8px; }
.plan-svg .i-linked { fill: rgba(45, 91, 79, 0.12); stroke: var(--accent); stroke-width: 2px; pointer-events: none; }
#legend small { color: var(--muted); font-weight: 600; margin-left: 2px; }
#legend .lg-ico { display: grid; place-items: center; width: 18px; height: 18px; flex: none; color: var(--ink-2); }
#legend .lg-ico svg { width: 18px; height: 18px; }
#legend .lg-count { margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--line); font-weight: 700; color: var(--ink); line-height: 1.4; }

/* ───────── верхняя строка ───────── */
#topbar { position: absolute; top: 14px; left: 16px; z-index: 9; display: flex; align-items: center; gap: 8px; max-width: calc(100% - 32px); }
#app[data-chat="left"] #topbar { left: calc(var(--chat-w) + 30px); }
.brand {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 44px; height: 44px; padding: 0; border-radius: 14px; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid rgba(255, 255, 255, 0.8); box-shadow: var(--shadow-sm);
}
.brand-mark { display: block; width: 34px; height: 34px; border-radius: 10px; }
.brand-logo { display: block; height: 20px; width: auto; }
.proj-meta {
  height: 40px; display: inline-flex; align-items: center; gap: 10px; padding: 0 14px; border-radius: 14px; font-size: 13.5px; font-weight: 700;
  background: var(--surface); border: 1px solid rgba(255, 255, 255, 0.8); box-shadow: var(--shadow-sm); white-space: nowrap;
}
.proj-meta span { color: var(--muted); font-weight: 600; }
.save-state { font-size: 12.5px; font-weight: 700; color: var(--muted); padding: 0 6px; }
.save-state.err { color: #b8442a; }
.new-btn { height: 40px; border-radius: 14px; }

/* ───────── список комнат ───────── */
#rooms {
  position: absolute; z-index: 6; top: 66px; left: 16px; width: 236px; border-radius: var(--radius); overflow: hidden;
  background: var(--surface); border: 1px solid rgba(255, 255, 255, 0.8); box-shadow: var(--shadow-sm);
}
#app[data-chat="left"] #rooms { left: calc(var(--chat-w) + 30px); }
#app[data-mode="plan"] #rooms, #app[data-mode="plan"] #room-card { display: none; }
.rooms-head { display: flex; align-items: center; gap: 8px; width: 100%; height: 40px; padding: 0 14px; border: 0; background: transparent; font-weight: 800; font-size: 13.5px; }
.rooms-total { margin-left: auto; color: var(--muted); font-weight: 700; }
.chev { width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-2px); transition: transform 0.2s; }
.rooms-head[aria-expanded="false"] .chev { transform: rotate(-45deg); }
#rooms ul { list-style: none; margin: 0; padding: 0 6px 6px; max-height: max(120px, calc(100vh - 420px)); overflow: auto; }
.rooms-head[aria-expanded="false"] + ul { display: none; }
#rooms li button {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border: 0; border-radius: 10px; background: transparent; text-align: left; font-size: 13.5px; font-weight: 600;
}
#rooms li button:hover, #rooms li button.is-active { background: var(--accent-soft); }
#rooms li i { flex: none; width: 10px; height: 10px; border-radius: 3px; }
#rooms li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#rooms li b { color: var(--muted); font-weight: 700; font-size: 12.5px; }

/* ───────── нижний переключатель ───────── */
#dock {
  position: absolute; z-index: 9; left: 50%; bottom: calc(18px + var(--sheet-h)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 20px;
  background: var(--surface); border: 1px solid rgba(255, 255, 255, 0.85); box-shadow: var(--shadow-lg); max-width: calc(100% - 24px);
}
#app[data-chat="right"] #dock { left: calc(50% - var(--chat-w) / 2 - 7px); }
#app[data-chat="left"] #dock { left: calc(50% + var(--chat-w) / 2 + 7px); }
.seg { position: relative; display: flex; padding: 3px; border-radius: 15px; background: rgba(29, 27, 25, 0.06); }
.seg button {
  position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 16px;
  border: 0; border-radius: 12px; background: transparent; font-weight: 700; font-size: 14px; color: var(--ink-2); transition: color 0.2s;
}
.seg button[aria-selected="true"] { color: #fff; }
.seg-thumb {
  position: absolute; z-index: 0; top: 3px; bottom: 3px; left: 0; width: 0; border-radius: 12px; background: var(--ink);
  box-shadow: 0 4px 12px rgba(29, 27, 25, 0.25); transition: left 0.35s var(--ease), width 0.35s var(--ease);
}
.dock-tools { display: flex; align-items: center; gap: 4px; }
.dock-tools:empty { display: none; }
.dock-tools .sep { width: 1px; height: 26px; background: var(--line-2); margin: 0 4px; }
.tg {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 11px; border-radius: 12px; border: 1px solid transparent;
  background: transparent; font-weight: 700; font-size: 13px; color: var(--ink-2); white-space: nowrap;
}
.tg:hover { background: rgba(29, 27, 25, 0.05); }
.tg[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: rgba(45, 91, 79, 0.25); }
.tg svg { flex: none; }
.layer-pick { position: relative; }
.layer-menu {
  position: absolute; bottom: calc(100% + 10px); right: 0; min-width: 220px; padding: 6px; border-radius: 14px;
  background: var(--surface-solid); box-shadow: var(--shadow-lg); border: 1px solid var(--line);
}
.layer-menu button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 10px; border: 0; border-radius: 10px; background: transparent; font-weight: 700; font-size: 13.5px; text-align: left; }
.layer-menu button:hover { background: var(--accent-soft); }
.layer-menu button[aria-checked="true"] { color: var(--accent); }
.layer-menu i { width: 10px; height: 10px; border-radius: 50%; flex: none; }

/* условные обозначения на листе */
.plan-svg .legend-sheet { pointer-events: none; }
.plan-svg .legend-sheet text { text-anchor: start; }
.plan-svg .lg-title { font-size: 0.16px; font-weight: 800; fill: #1d1b19; }
.plan-svg .lg-text { font-size: 0.14px; font-weight: 500; fill: #3c3833; }
.plan-svg .lg-count { font-size: 0.14px; font-weight: 700; fill: #1d1b19; }
.plan-svg .lg { opacity: 1; }

/* встроенный шкаф */
.plan-svg .room.closet { fill: #fffdf9; stroke: #1d1b19; stroke-width: 1px; }
.plan-svg .closet-x { stroke: #1d1b19; stroke-width: 0.8px; pointer-events: none; }
.plan-svg .l-closet { font-size: 0.15px; font-weight: 700; fill: #4a4640; }

/* балконы, лоджии, низкие стены */
.plan-svg .room.summer { fill: url(#hatch-floor); }
.plan-svg .room.summer.is-sel { fill: rgba(45, 91, 79, 0.08); }
.plan-svg .w-low { fill: #c9c3ba; }
.plan-svg .glass { stroke: #4f9ec4; stroke-width: 1.6px; pointer-events: none; }
.plan-svg .rect-draft { fill: rgba(45, 91, 79, 0.08); stroke: var(--accent); stroke-width: 1.6px; stroke-dasharray: 6 4; pointer-events: none; }
#plan2d[data-tool="room"] .plan-svg, #plan2d[data-tool="balcony"] .plan-svg, #plan2d[data-tool="loggia"] .plan-svg, #plan2d[data-tool="wall"] .plan-svg { cursor: crosshair; }
.rc-coef { margin: -2px 0 8px; font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.rc-rules { margin: 10px 0 0; padding: 8px 10px 8px 26px; border-radius: 10px; background: rgba(228, 87, 46, 0.07); font-size: 12.5px; line-height: 1.4; color: var(--ink-2); }
.rc-rules li + li { margin-top: 4px; }
.pt-add { position: relative; }
.pt-menu {
  position: absolute; left: calc(100% + 10px); top: 0; z-index: 2; min-width: 210px; padding: 6px; border-radius: 14px;
  background: var(--surface-solid); box-shadow: var(--shadow-lg); border: 1px solid var(--line); display: grid; gap: 2px;
}
.pt-menu-title { padding: 6px 10px 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.pt-menu button { text-align: left; padding: 9px 10px; border: 0; border-radius: 10px; background: transparent; font-weight: 700; font-size: 13.5px; }
.pt-menu button:hover { background: var(--accent-soft); color: var(--accent); }

/* опции */
.opts-pick { position: relative; }
.opts-menu {
  position: absolute; bottom: calc(100% + 10px); right: 0; width: 300px; padding: 6px; border-radius: 16px;
  background: var(--surface-solid); box-shadow: var(--shadow-lg); border: 1px solid var(--line); display: grid; gap: 2px;
}
.opt { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border-radius: 11px; cursor: pointer; }
.opt:hover { background: var(--accent-soft); }
.opt input { margin: 3px 0 0; width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.opt b { display: block; font-size: 13.5px; font-weight: 700; }
.opt small { display: block; font-size: 12px; color: var(--muted); line-height: 1.35; margin-top: 1px; }
.room-label i { font-style: normal; font-size: 11px; color: var(--muted); font-weight: 600; }
/* вид стены сбоку в свойствах проёма */
.ins-elev { display: block; flex: none; }
.ins-elev .ev-wall { fill: #f3efe8; stroke: #8d867c; stroke-width: 1; }
.ins-elev .ev-ceil { stroke: #8d867c; stroke-dasharray: 3 3; }
.ins-elev .ev-floor { stroke: #1d1b19; stroke-width: 1.5; }
.ins-elev .ev-open { fill: #fff; stroke: var(--accent); stroke-width: 1.6; }
.ins-elev .ev-open.window { fill: #e3f0f4; }
.ins-elev .ev-other { fill: #fff; stroke: #b5aea4; stroke-width: 1; }
.ins-elev text { font: 600 9.5px 'Manrope', sans-serif; fill: #6b665e; }
.ins-elev .ev-dim { stroke: var(--accent); stroke-width: 1; }
.ins-elev .ev-val { fill: var(--accent); font-weight: 800; }

/* легенда конструктива/разреза */
#legend {
  position: absolute; z-index: 6; left: 16px; bottom: calc(96px + var(--sheet-h)); max-width: 260px; padding: 12px 14px; border-radius: 16px;
  background: var(--surface); border: 1px solid rgba(255, 255, 255, 0.85); box-shadow: var(--shadow-sm); font-size: 12.5px;
}
#app[data-chat="left"] #legend { left: auto; right: 16px; }
#app[data-mode="plan"] #legend { bottom: calc(240px + var(--sheet-h)); }
#legend h4 { margin: 0 0 8px; font-size: 13px; font-weight: 800; }
#legend ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
#legend li { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink-2); }
#legend li i { width: 14px; height: 14px; border-radius: 4px; flex: none; border: 1px solid rgba(0, 0, 0, 0.08); }
#legend li i.cap { height: 5px; border-radius: 2px; background: #d2492a; }
#legend .lg-note { margin-top: 8px; color: var(--muted); line-height: 1.4; }

/* ───────── инструменты плана ───────── */
#plan-tools {
  position: absolute; z-index: 8; left: 16px; top: 66px; display: flex; flex-direction: column; gap: 4px; padding: 6px; border-radius: 18px;
  background: var(--surface); border: 1px solid rgba(255, 255, 255, 0.85); box-shadow: var(--shadow-lg);
}
#app[data-chat="left"] #plan-tools { left: calc(var(--chat-w) + 30px); }
.pt { position: relative; display: grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 12px; background: transparent; color: var(--ink-2); }
.pt:hover { background: rgba(29, 27, 25, 0.06); }
.pt[aria-pressed="true"] { background: var(--ink); color: #fff; }
.pt:disabled { opacity: 0.35; cursor: default; background: transparent; }
.pt-sep { height: 1px; margin: 3px 6px; background: var(--line-2); }
.pt[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
  padding: 5px 9px; border-radius: 8px; background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; white-space: nowrap; pointer-events: none;
}
.pt i.dot { width: 14px; height: 14px; border-radius: 50%; display: block; }

/* ───────── полёт ───────── */
#fly-hint {
  position: absolute; z-index: 7; top: 16px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 32px);
  padding: 9px 14px; border-radius: 14px; background: rgba(29, 27, 25, 0.78); color: #fff; font-size: 12.5px; font-weight: 500; line-height: 1.6; text-align: center; transition: opacity 0.3s;
}
#app[data-chat="right"] #fly-hint { left: calc(50% - var(--chat-w) / 2 - 7px); max-width: calc(100% - var(--chat-w) - 64px); }
#fly-hint kbd { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.25); color: #fff; }
#fly-hint.is-locked { opacity: 0.35; }
.fh-touch { display: none; }
@media (pointer: coarse) { .fh-desktop { display: none; } .fh-touch { display: inline; } }
#here {
  position: absolute; z-index: 7; left: 50%; bottom: calc(90px + var(--sheet-h)); transform: translateX(-50%);
  padding: 8px 14px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-sm); font-weight: 800; font-size: 14px;
}
#app[data-chat="right"] #here { left: calc(50% - var(--chat-w) / 2 - 7px); }
#here span { color: var(--muted); font-weight: 700; margin-left: 6px; }
.fly-touch { position: absolute; z-index: 5; left: 18px; bottom: calc(96px + var(--sheet-h)); display: flex; align-items: flex-end; gap: 14px; }
.joy { position: relative; width: 112px; height: 112px; border-radius: 50%; background: rgba(255, 253, 249, 0.55); border: 1px solid rgba(255, 255, 255, 0.8); box-shadow: var(--shadow-sm); touch-action: none; }
.joy-knob { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: var(--ink); opacity: 0.8; transition: transform 0.08s; }
.fly-updown { display: flex; flex-direction: column; gap: 8px; }
.fly-updown button { width: 46px; height: 46px; border-radius: 14px; border: 0; background: rgba(255, 253, 249, 0.8); box-shadow: var(--shadow-sm); font-size: 14px; touch-action: none; }

/* ───────── чат ───────── */
.chat {
  position: absolute; z-index: 10; top: 14px; right: 14px; width: var(--chat-w); height: min(calc(100% - 28px), 820px);
  display: flex; flex-direction: column; border-radius: 22px; overflow: hidden;
  background: var(--surface); border: 1px solid rgba(255, 255, 255, 0.85); box-shadow: var(--shadow-lg);
  transition: left 0.3s var(--ease), right 0.3s var(--ease), opacity 0.2s;
}
.chat[data-dock="left"] { right: auto; left: 14px; }
.chat[data-dock="free"] { right: auto; transition: none; }
.chat.is-dragging { box-shadow: 0 26px 70px rgba(52, 40, 26, 0.26); }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 10px 10px 14px; cursor: grab; touch-action: none; user-select: none; }
.chat.is-dragging .chat-head { cursor: grabbing; }
.chat-avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: var(--accent); color: #fff; flex: none; }
.chat-mark { width: 30px; height: 30px; border-radius: 8px; flex: none; display: block; }
.chat-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.chat-title b { font-size: 15px; font-weight: 800; }
.chat-title small { font-size: 12px; color: var(--muted); font-weight: 600; }
.stages { list-style: none; margin: 0; padding: 4px 8px 12px; display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.st { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; position: relative; }
.st:not(:last-child)::after { content: ''; position: absolute; top: 11px; left: calc(50% + 14px); right: calc(-50% + 14px); height: 2px; border-radius: 2px; background: var(--line-2); }
.st-done:not(:last-child)::after { background: var(--accent); }
.st-dot { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-size: 11px; font-weight: 800; background: rgba(29, 27, 25, 0.07); color: var(--muted); }
.st-done .st-dot { background: var(--accent); color: #fff; }
.st-active .st-dot { background: #fff; color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.st-soon { opacity: 0.55; }
.st-name { font-size: 10px; letter-spacing: -0.01em; font-weight: 700; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.st-active .st-name, .st-done .st-name { color: var(--ink); }
.chat-log { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 4px; overscroll-behavior: contain; scroll-padding-bottom: 12px; }
.msg { max-width: 88%; font-size: 14.5px; line-height: 1.45; border-radius: 18px; padding: 9px 13px; overflow-wrap: anywhere; }
.msg.anim, .msg.typing, .msg.is-pending { animation: msg-in 0.32s var(--ease) both; animation-delay: var(--d, 0ms); }
@keyframes msg-in { from { opacity: 0; transform: translateY(10px); } }
.msg.anim .chip { animation: chip-pop 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.25) both; animation-delay: calc(var(--d, 0ms) + 140ms + var(--i, 0) * 45ms); }
@keyframes chip-pop { from { opacity: 0; transform: scale(0.85); } }
/* каркас, пока проект грузится */
.skel { height: 54px; border-radius: 18px; background: linear-gradient(90deg, #f1ede6 0%, #faf8f4 50%, #f1ede6 100%); background-size: 200% 100%; animation: shimmer 1.1s linear infinite; }
.skel-a { width: 78%; } .skel-b { width: 60%; align-self: flex-end; height: 40px; } .skel-c { width: 84%; height: 72px; }
@keyframes shimmer { to { background-position: -200% 0; } }
#app[data-state="loading"] #stage3d::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.45) 50%, transparent 70%); background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}
/* стадия завершилась — линия дорисовывается, точка «щёлкает» */
.st.just-done::after { animation: line-grow 0.45s var(--ease) both; transform-origin: left; }
.st.just-done .st-dot { animation: dot-pop 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.4) both; }
@keyframes line-grow { from { transform: scaleX(0); } }
@keyframes dot-pop { from { transform: scale(0.6); } }
/* подписи комнат после появления модели */
.scene-labels.hide .room-label { opacity: 0 !important; }
.scene-labels.pop .room-label { animation: label-pop 0.38s cubic-bezier(0.2, 0.9, 0.3, 1.3) both; }
@keyframes label-pop { from { scale: 0.6; } }
.msg:not(.cont) { margin-top: 6px; }
.msg p { margin: 0; }
.msg p + p { margin-top: 7px; }
.msg-assistant { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg-user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 6px; }
.msg-user.is-pending { opacity: 0.7; }
.msg.has-q { max-width: 100%; }
.att { display: block; margin: -3px -7px 6px; border-radius: 12px; overflow: hidden; color: inherit; text-decoration: none; }
.msg-user .att:only-child { margin: -3px -7px -3px; }
.att-img img { display: block; width: 100%; max-width: 240px; max-height: 200px; object-fit: cover; background: #fff; }
.att-file { display: flex; align-items: center; gap: 8px; padding: 6px 8px; font-weight: 700; font-size: 13.5px; }
.upload-bar { margin-top: 6px; background: rgba(255, 255, 255, 0.3); }
.upload-bar i { background: #fff; }
.q { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.q-hint { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  height: 34px; padding: 0 13px; border-radius: 999px; border: 1px solid rgba(45, 91, 79, 0.35); background: #fff; color: var(--accent);
  font-weight: 700; font-size: 13.5px; transition: background 0.15s, color 0.15s, transform 0.1s;
}
.chip:hover { background: var(--accent); color: #fff; }
.chip:active { transform: scale(0.97); }
.q-free { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.q-input { display: flex; align-items: center; gap: 6px; }
.q-input input { flex: 1; min-width: 0; height: 36px; border-radius: 11px; border: 1px solid var(--line-2); padding: 0 10px; background: #fbfaf7; font-size: 14px; }
.q-input input:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px var(--accent-soft); }
.q-input em { font-style: normal; color: var(--muted); font-weight: 700; }
.q-input button { height: 36px; padding: 0 13px; border-radius: 11px; border: 0; background: var(--accent); color: #fff; font-weight: 700; font-size: 13.5px; }
.q-skip { align-self: flex-start; border: 0; background: transparent; padding: 2px 0; color: var(--muted); font-weight: 700; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); }
.q-skip:hover { color: var(--ink); }
.typing { display: flex; gap: 4px; padding: 13px 14px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: dot 1.1s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.chat-job { padding: 10px 14px; border-top: 1px solid var(--line); }
.job-text { font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 7px; }
.composer { display: flex; align-items: flex-end; gap: 6px; padding: 10px; border-top: 1px solid var(--line); background: rgba(255, 255, 255, 0.5); }
.composer textarea {
  flex: 1; min-width: 0; resize: none; max-height: 140px; min-height: 40px; padding: 9px 12px; border-radius: 13px; border: 1px solid var(--line-2);
  background: #fff; font-size: 14.5px; line-height: 1.4;
}
.composer textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer .attach { width: 40px; height: 40px; }
.send { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 13px; background: var(--accent); color: #fff; flex: none; }
.send:hover { background: var(--accent-2); }
.sel-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px 0; min-width: 0; }
.sel-chip {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 4px 0 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13px; border: 1px solid rgba(45, 91, 79, 0.25);
  white-space: nowrap; flex: none;
}
.sel-chip i { width: 8px; height: 8px; border-radius: 2px; background: var(--accent); }
.sel-chip button { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 0; background: transparent; color: var(--accent); font-size: 11px; }
.sel-chip button:hover { background: rgba(45, 91, 79, 0.15); }
.sel-hint { font-size: 12px; color: var(--muted); font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-sel {
  display: inline-flex; align-items: center; margin: 0 0 6px; padding: 3px 9px; border-radius: 999px; border: 0;
  background: rgba(255, 255, 255, 0.22); color: inherit; font-weight: 700; font-size: 12.5px; cursor: pointer;
}
.msg-sel::before { content: ''; width: 7px; height: 7px; border-radius: 2px; background: currentColor; margin-right: 6px; opacity: 0.8; }
.msg-sel:hover { background: rgba(255, 255, 255, 0.34); }

#chat-bubble {
  position: absolute; z-index: 10; right: 18px; bottom: 18px; width: 58px; height: 58px; border-radius: 50%; border: 0;
  display: grid; place-items: center; background: var(--accent); color: #fff; box-shadow: var(--shadow-lg);
  animation: card-in 0.25s var(--ease);
}
#chat-bubble[data-dock="left"] { right: auto; left: 18px; }
#chat-bubble .badge { position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--coral); font-size: 11.5px; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--bg); }

/* ───────── перетаскивание файла ───────── */
#drop { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(45, 91, 79, 0.18); }
.drop-card { padding: 26px 34px; border-radius: 22px; background: var(--surface-solid); border: 2px dashed var(--accent); font-weight: 800; font-size: 18px; color: var(--accent); box-shadow: var(--shadow-lg); pointer-events: none; }
#toast {
  position: absolute; z-index: 31; left: 50%; bottom: calc(96px + var(--sheet-h)); transform: translateX(-50%); max-width: min(520px, calc(100% - 32px));
  padding: 11px 16px; border-radius: 14px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 600; line-height: 1.4; box-shadow: var(--shadow-lg);
  animation: card-in 0.2s var(--ease);
}

/* ───────── телефон ───────── */
@media (max-width: 720px) {
  :root { --chat-w: 100vw; }
  #app[data-chat] #hero, #app[data-chat] #working, #app[data-chat] #failed { padding: 72px 16px calc(var(--sheet-h) + 20px); align-items: flex-start; overflow-y: auto; }
  #app[data-chat] #topbar, #app[data-chat] #rooms, #app[data-chat] #plan-tools, #app[data-chat] .room-card.floating { left: 12px; }
  #app[data-chat] #dock, #app[data-chat] #fly-hint, #app[data-chat] #here, #app[data-chat] .inspector { left: 50%; }
  #topbar { top: 10px; left: 12px; max-width: calc(100% - 24px); }
  .brand { height: 38px; }
  .proj-meta { height: 38px; padding: 0 10px; font-size: 12.5px; }
  .new-btn { height: 38px; padding: 0 12px; font-size: 13px; margin-left: auto; }
  #hero h1 { font-size: 30px; }
  .lede { font-size: 15px; margin: 12px 0 18px; }
  .dropzone { padding: 22px 16px; }
  .steps { grid-template-columns: 1fr; gap: 10px; margin-top: 18px; }
  .work-card { flex-direction: column; align-items: stretch; }
  .work-thumb { width: 100%; height: 160px; }
  #rooms { display: none; }
  .room-card.floating { top: 58px; left: 12px; right: 12px; width: auto; }
  #dock { bottom: calc(10px + var(--sheet-h)); padding: 5px; gap: 4px; }
  .seg button { height: 38px; padding: 0 12px; }
  .seg button svg { display: none; }
  .tg span { display: none; }
  .tg { padding: 0 9px; }
  #legend { left: 12px; bottom: calc(76px + var(--sheet-h)); max-width: calc(100% - 24px); padding: 9px 12px; }
  #legend .lg-note { display: none; }
  #plan-tools { top: 56px; left: 12px; right: 12px; flex-direction: row; overflow-x: auto; }
  .pt { width: 40px; height: 40px; flex: none; }
  .pt-sep { width: 1px; height: auto; margin: 6px 3px; }
  .pt[data-tip]:hover::after { display: none; }
  .inspector { top: 112px; max-width: calc(100% - 24px); }
  #app[data-mode="plan"] #stage3d { display: none; }
  #fly-hint { top: 58px; font-size: 12px; }
  #here { bottom: calc(70px + var(--sheet-h)); }
  .fly-touch { bottom: calc(80px + var(--sheet-h)); }

  .chat.is-sheet {
    top: auto; left: 0 !important; right: 0; bottom: 0; width: 100%; height: 78vh; border-radius: 22px 22px 0 0;
    transition: height 0.35s var(--ease); border-bottom: 0;
  }
  .chat.is-sheet[data-sheet="peek"] { height: 136px; }
  .chat.is-sheet[data-sheet="peek"] .stages, .chat.is-sheet[data-sheet="peek"] .composer, .chat.is-sheet[data-sheet="peek"] .chat-job { display: none; }
  .chat.is-sheet .chat-head { padding-top: 16px; position: relative; }
  .chat.is-sheet .chat-head::before { content: ''; position: absolute; top: 6px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 2px; background: var(--line-2); }
  .chat.is-sheet [data-act="dock"] { display: none; }
  .chat.is-sheet[data-sheet="peek"] .chat-log { overflow: hidden; padding-top: 0; justify-content: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* компактный вид, когда места мало (решает app.js → layoutChrome) */
#topbar.compact .proj-meta span { display: none; }
#topbar.tight .save-state { display: none; }
#topbar.tight .new-btn { padding: 0 12px; }
#dock.compact .seg button svg { display: none; }
#dock.compact .seg button { padding: 0 14px; }
#dock.compact .tg span { max-width: 9ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ───────── загрузка: волна, полёт миниатюры, кольцо прогресса, «смотрю…» ───────── */
.dropzone { position: relative; overflow: hidden; }
.dropzone.is-drop::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%;
  background: rgba(45, 91, 79, 0.18); animation: ripple 0.65s var(--ease) forwards; pointer-events: none;
}
@keyframes ripple { to { transform: scale(18); opacity: 0; } }
.flyer { position: fixed; z-index: 40; margin: 0; pointer-events: none; border-radius: 12px; overflow: hidden; box-shadow: 0 18px 40px rgba(40, 30, 20, 0.28); }
.att.is-upload { position: relative; }
.att-file.is-upload { padding-right: 46px; }
.up-ring { position: absolute; right: 6px; bottom: 6px; width: 32px; height: 32px; transform: rotate(-90deg); filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.25)); }
.up-ring circle { fill: rgba(29, 27, 25, 0.35); stroke: rgba(255, 255, 255, 0.35); stroke-width: 3; }
.up-ring .up-val { fill: none; stroke: #fff; stroke-linecap: round; transition: stroke-dashoffset 0.25s var(--ease); }
.att.is-processing { position: relative; }
.att.is-processing::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 25%, rgba(255, 255, 255, 0.55) 50%, transparent 75%); background-size: 220% 100%;
  animation: shimmer 1.2s linear infinite;
}
.att-note { position: absolute; left: 8px; bottom: 8px; padding: 3px 9px; border-radius: 999px; background: rgba(29, 27, 25, 0.7); color: #fff; font-size: 12px; font-weight: 700; }
.work-thumb { width: 200px; height: 200px; background: #fff; }
.work-thumb img { object-fit: contain; }
.work-step.swap { animation: step-swap 0.3s var(--ease); }
@keyframes step-swap { from { opacity: 0; transform: translateY(6px); } }
.work-thumb.tracing .scan { display: none; }
.trace { position: absolute; inset: 0; }
.trace svg { display: block; }
.trace line { stroke: var(--accent); stroke-width: 3.2; stroke-linecap: round; stroke-dasharray: var(--len); stroke-dashoffset: var(--len);
  animation: trace 0.5s var(--ease) forwards; animation-delay: calc(var(--i) * 25ms); }
@keyframes trace { to { stroke-dashoffset: 0; } }
@media (max-width: 720px) { .work-thumb { width: 100%; height: 200px; } }

/* ───────── отклик на действия ───────── */
.btn, .chip, .tg, .pt, .icon-btn, .send, .seg button, .ins-btn, .ins-toggle, .ins-del, .rooms-head, #rooms li button, .q-skip, .opt, .layer-menu button, .pt-menu button {
  transition: transform 0.12s var(--ease), background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.btn:active, .chip:active, .tg:active, .pt:active, .icon-btn:active, .send:active, .seg button:active, .ins-btn:active, .ins-toggle:active,
.ins-del:active, #rooms li button:active, .layer-menu button:active, .pt-menu button:active { transform: scale(0.96); }
.opts-menu, .layer-menu { transform-origin: bottom right; animation: pop-in 0.18s var(--ease); }
.pt-menu { transform-origin: top left; animation: pop-in 0.18s var(--ease); }
.inspector.pop { animation: pop-in 0.2s var(--ease); }
.inspector.anchored.pop { transform-origin: bottom center; }
@keyframes pop-in { from { opacity: 0; transform: scale(0.94) translateY(4px); } }
.save-state.flash { animation: saved 0.35s var(--ease); color: var(--accent); }
@keyframes saved { from { opacity: 0; transform: translateY(3px); } }
#toast { display: flex; align-items: center; gap: 14px; }
#toast.in { animation: toast-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.15); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 14px); } to { transform: translate(-50%, 0); } }
#toast button { border: 0; background: transparent; color: #b9e3d6; font-weight: 800; font-size: 14px; padding: 0; cursor: pointer; }
#toast button:hover { color: #fff; }
.chip-morph { position: fixed; z-index: 40; display: flex; align-items: center; padding: 0 13px; font-weight: 700; font-size: 14px;
  pointer-events: none; overflow: hidden; white-space: nowrap; box-sizing: border-box; }
input.shake { animation: shake 0.32s ease-in-out; border-color: var(--coral) !important; }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
.plan-svg .wall.is-sel, .plan-svg .o-sel, .plan-svg .label.is-sel .label-hit { animation: sel-in 0.25s var(--ease); }
@keyframes sel-in { from { stroke-opacity: 0; } }
.plan-svg .wall.is-new { animation: wall-draw 0.7s var(--ease); stroke: var(--accent); stroke-width: 2px; }
@keyframes wall-draw { from { stroke-dasharray: 2 400; fill-opacity: 0; } 60% { fill-opacity: 0.3; } to { stroke-dasharray: 400 0; fill-opacity: 1; } }

#app.ins-open #rooms { display: none; }
