/* iOS polish (viewer-ios-polish): presentation only -- ids, data-attributes and hidden toggles stay owned by src/main.js. */
:root { --bg: #f3f2ef; --ink: #1c1c1a; --ink-2: #4a4741; --muted: #6b6862; --sep: rgba(60,52,40,.12); --fill: rgba(120,108,90,.11);
  --fill-press: rgba(120,108,90,.2); --surface: rgba(255,255,255,.86); --card: #fff; --accent: #235d67; --accent-fill: rgba(35,93,103,.11);
  --shadow: 0 1px 2px rgba(30,24,16,.06), 0 8px 28px rgba(30,24,16,.12); --r-card: 18px; --gutter: 12px; --hair: .5px; }
/* Hairlines: half a pixel on Retina, a whole one where .5px would vanish. */
@media (max-resolution: 1.5dppx) { :root { --hair: 1px; } }
/* Компактнее на компьютере (владелец 19.10.2026: «на 100 % как для бабушки»): весь интерфейс поверх модели мельче,
   сцена и подписи на ней (#stage, #annotations) — как были. Попап «Отменить?» ставится по координатам кнопки — без zoom.
   Карточка детали у курсора пересчитывает left/top на этот zoom (dock-anchor.js). */
@media (pointer: fine) and (min-width: 901px) {
  body > :not(#stage):not(#annotations):not(.undo-confirm):not(script) { zoom: .85; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; background: var(--bg); color: var(--ink);
  font: 13px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
body { position: fixed; inset: 0; }
[hidden] { display: none !important; }
#stage { position: absolute; inset: 0; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#stage canvas { display: block; width: 100%; height: 100%; outline: none; touch-action: none; }
#stage canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
@media (pointer: fine) { #stage canvas { cursor: crosshair !important; } #stage canvas.shelf-grab { cursor: ns-resize !important; } }
/* Loading: the stage is empty until the renderer mounts its canvas. */
#stage:empty::before { content: ""; position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -30px 0 0 -11px; border-radius: 50%;
  border: 2px solid var(--sep); border-top-color: var(--muted); animation: spin .8s linear infinite; }
#stage:empty::after { content: "Загрузка модели…"; position: absolute; left: 0; right: 0; top: 50%; margin-top: 4px; text-align: center; color: var(--muted); font-size: 13px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { #stage:empty::before { animation-duration: 2.4s; } }

/* Buttons: one system -- plain (toolbar/menu), tinted (card actions), chip (floating over the model). */
.btn { pointer-events: auto; height: 44px; min-width: 44px; padding: 0 14px; border: 0; border-radius: 12px; background: var(--fill); color: var(--ink);
  font: inherit; font-size: 15px; font-weight: 500; letter-spacing: -.01em; white-space: nowrap; text-decoration: none; cursor: pointer;
  display: inline-grid; place-items: center; touch-action: manipulation; transition: background-color .15s, color .15s, transform .1s, opacity .15s; }
.btn:active { background: var(--fill-press); transform: scale(.97); }
@media (hover: hover) { .btn:hover { background: var(--fill-press); } }
.btn[aria-pressed="true"] { background: var(--accent-fill); color: var(--accent); }
.btn:disabled { opacity: .4; cursor: default; transform: none; }
.btn:focus-visible, .perf:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Debug header (?debug=1). */
.bar { position: absolute; top: max(10px, env(safe-area-inset-top)); left: 12px; right: 12px; display: flex; gap: 8px; align-items: center; pointer-events: none; }
/* While the 3D moves (main.js markMoving): no backdrop blur -- iOS re-blurs the moving canvas under every glass panel
   each frame; the panels turn a touch more opaque instead (17.10.2026). */
body[data-moving] { --surface: rgba(255,255,255,.95); }
body[data-moving] * { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
.bar .btn { background: var(--surface); -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4); box-shadow: 0 1px 3px rgba(0,0,0,.08); font-size: 13px; }
.title { flex: 1; min-width: 0; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.title b { color: var(--ink); font-weight: 600; }
.tag { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: #8a5a22; background: #f6e7d2; padding: 2px 6px; border-radius: 5px; margin-right: 6px; }
.perf { position: absolute; left: 10px; bottom: max(10px, env(safe-area-inset-bottom)); background: rgba(20,20,18,.78); color: #e9e7e2; border-radius: 10px;
  padding: 7px 10px; font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre; pointer-events: auto; cursor: pointer; max-width: calc(100% - 20px); overflow: hidden;
  min-height: 44px; display: grid; align-items: center; }
.perf.min { opacity: .7; }

/* Toolbar: one floating capsule, Вид · Размеры · Замер. */
.toolbar { position: absolute; top: calc(env(safe-area-inset-top) + 10px); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 2px;
  padding: 3px; border-radius: 16px; background: var(--surface); -webkit-backdrop-filter: blur(20px) saturate(1.6); backdrop-filter: blur(20px) saturate(1.6);
  box-shadow: 0 0 0 var(--hair) var(--sep), 0 4px 16px rgba(30,24,16,.08); max-width: calc(100% - 2 * var(--gutter)); }
/* Above the project pill and account avatar: the «Вид» list drops over them, taps must reach it. */
.toolbar { z-index: 25; }
body[data-debug="true"] .toolbar { top: calc(env(safe-area-inset-top) + 64px); }
.toolbar .btn { height: 44px; min-width: 44px; padding: 0 13px; border-radius: 13px; background: transparent; font-size: 14px; }
.toolbar .btn:active { background: var(--fill); }
@media (hover: hover) { .toolbar .btn:hover { background: var(--fill); } }
.toolbar .btn[aria-pressed="true"] { background: var(--card); color: var(--accent); box-shadow: 0 1px 3px rgba(30,24,16,.12), 0 0 0 var(--hair) var(--sep); }
.toolbar .btn[aria-expanded="true"] { background: var(--fill); }
/* «Скрыть фасады»: icon only; the slash appears while facades are hidden. */
.toolbar .btn.icon-btn { display: inline-flex; align-items: center; justify-content: center; padding: 0; width: 44px; }
.toolbar .btn.icon-btn[hidden] { display: none; }
.toolbar .icon-btn .slash { display: none; }
.toolbar .icon-btn[aria-pressed="true"] .slash { display: inline; }
.tools { display: flex; gap: 2px; align-items: center; }
.view-tools { position: relative; }
#view-menu { display: inline-grid; min-width: 104px; overflow: hidden; text-overflow: ellipsis; }
#view-menu .mode-short { display: none; }
#measure-step { padding: 0 10px; color: var(--accent); font-size: 14px; font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
/* Popover: an iOS menu -- separators, checkmark for the current mode instead of a filled row. */
.view-presets { display: none; position: absolute; top: calc(100% + 8px); left: -3px; width: 230px; padding: 0; overflow: hidden; border-radius: 14px;
  background: rgba(255,255,255,.94); -webkit-backdrop-filter: blur(24px) saturate(1.6); backdrop-filter: blur(24px) saturate(1.6);
  box-shadow: 0 0 0 var(--hair) var(--sep), 0 10px 32px rgba(30,24,16,.16); transform-origin: top left; animation: pop .16s ease-out; }
.view-tools[data-open="true"] .view-presets { display: grid; }
@keyframes pop { from { opacity: 0; transform: scale(.96); } }
.view-presets .btn { position: relative; width: 100%; height: 44px; justify-items: start; padding: 0 40px 0 16px; border-radius: 0; background: transparent; font-weight: 400; font-size: 15px; box-shadow: none; }
.view-presets .btn + .btn { box-shadow: inset 0 var(--hair) 0 var(--sep); }
.view-presets .btn[aria-pressed="true"] { background: transparent; color: var(--ink); font-weight: 500; }
.view-presets .btn[aria-pressed="true"]::after { content: ""; position: absolute; right: 18px; top: 50%; width: 5px; height: 10px; margin-top: -7px;
  border: solid var(--accent); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.view-presets .btn:active { background: var(--fill); transform: none; }
/* Camera angles: a 2×2 grid of compact buttons at the top of the menu. */

/* Client link: no «Вид» menu; camera angles and «Открыть» in a round pill at the bottom. */
.angle-pill { display: none; position: absolute; z-index: 20; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 16px);
  align-items: center; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface); -webkit-backdrop-filter: blur(20px) saturate(1.6); backdrop-filter: blur(20px) saturate(1.6);
  box-shadow: 0 0 0 var(--hair) var(--sep), 0 4px 16px rgba(30,24,16,.08); max-width: calc(100% - 2 * var(--gutter)); }
.angle-pill .btn { height: 44px; padding: 0 14px; border-radius: 999px; background: transparent; font-size: 14px; white-space: nowrap; }
.angle-pill .btn:active { background: var(--fill); }
@media (hover: hover) { .angle-pill .btn:hover { background: var(--fill); } }
.angle-pill .pill-fronts { margin-left: 4px; position: relative; color: var(--accent); font-weight: 500; }
.angle-pill .pill-fronts::before { content: ""; position: absolute; left: -4px; top: 12px; bottom: 12px; width: var(--hair); background: var(--sep); }
.angle-pill .pill-fronts[aria-pressed="true"] { background: var(--accent-fill); }
@media (max-width: 400px) { .angle-pill .btn { padding: 0 10px; font-size: 13px; } }
body[data-client="true"] .angle-pill { display: flex; }
body[data-client="true"] #view-tools, body[data-client="true"] .toolbar #open-fronts, body[data-client="true"] .toolbar #hide-facades { display: none !important; }
body:has(#part-card:not([hidden])) .angle-pill, body:has(#block-card:not([hidden])) .angle-pill, body:has(#measurement-card:not([hidden])) .angle-pill { display: none; }

/* Context cards: a floating card on desktop, a bottom sheet on phones. */
.part-dock { position: absolute; right: max(var(--gutter), env(safe-area-inset-right)); bottom: calc(env(safe-area-inset-bottom) + 16px);
  width: min(360px, calc(100% - 2 * var(--gutter))); display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
.part-dock > .btn { height: 44px; padding: 0 16px; border-radius: 22px; background: var(--surface); color: var(--accent);
  -webkit-backdrop-filter: blur(20px) saturate(1.6); backdrop-filter: blur(20px) saturate(1.6); box-shadow: 0 0 0 var(--hair) var(--sep), 0 4px 14px rgba(30,24,16,.1); }
@media not all and (pointer: fine) { #hide-selected, #isolate-selected { display: none !important; } }
/* Desktop: dock-anchor.js places the card next to the click (left/top set inline). */
.part-dock.at-pointer { right: auto !important; bottom: auto !important; }
@media (pointer: fine) and (min-width: 601px) and (min-height: 501px) { .part-dock .part-head { cursor: grab; } .part-dock.dragging, .part-dock.dragging .part-head { cursor: grabbing; user-select: none; } }
.part-dock > .btn:active { background: rgba(255,255,255,.7); }
.part-card { width: 100%; padding: 0 16px 16px; border-radius: var(--r-card); background: var(--card); box-shadow: 0 0 0 var(--hair) var(--sep), var(--shadow);
  pointer-events: auto; max-height: min(440px, 52dvh); overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  font-size: 14px; animation: rise .2s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@supports not (height: 1dvh) { .part-card { max-height: 52vh; } }
.part-head { position: sticky; top: 0; z-index: 1; display: flex; gap: 8px; align-items: flex-start; margin: 0 -16px; padding: 14px 6px 4px 16px; background: var(--card); }
/* Soft fade under the sticky header so scrolled content does not end on a hard cut. */
.part-head::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 10px; background: linear-gradient(var(--card), rgba(255,255,255,0)); pointer-events: none; }
.part-head h2 { flex: 1; min-width: 0; margin: 9px 0 0; font-size: 17px; line-height: 1.25; font-weight: 600; letter-spacing: -.02em; overflow-wrap: anywhere; }
/* Close: a 30px glyph inside a 44px hit area. */
.part-head .btn { position: relative; flex-shrink: 0; width: 44px; padding: 0; margin-top: -2px; background: transparent; color: var(--muted); font-size: 0; }
.part-head .btn::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--fill); transition: background-color .15s; }
.part-head .btn::after { content: ""; position: absolute; left: 50%; top: 50%; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px;
  background: linear-gradient(currentColor,currentColor) center/100% 2px no-repeat, linear-gradient(currentColor,currentColor) center/2px 100% no-repeat; transform: rotate(45deg); border-radius: 1px; }
.part-head .btn:active, .part-head .btn:hover { background: transparent; }
.part-head .btn:active::before { background: var(--fill-press); }
.part-size { margin: 0 0 12px; font-size: 15px; font-weight: 500; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.part-meta { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
#part-card .part-size { margin-bottom:8px; font-size:14px; }
#part-card .tech-group { margin-bottom:8px; }
#part-card .tech-row { padding:8px 0; }
#part-card .edge-section { padding:0; }
#part-card .action-group .part-actions { min-height:44px; }
#part-card #part-validation { display:block; margin-bottom:4px; }
#part-card #part-validation[hidden] { display:none; }
.part-footer { display:flex; align-items:center; justify-content:space-between; gap:8px; flex-wrap:wrap; }
#drilling-details { margin:0; }
#drilling-details[open] { flex-basis:100%; order:1; }
#drilling-details summary { min-height:44px; display:flex; align-items:center; cursor:pointer; color:var(--muted); font-size:13px; }
#drilling-details summary::before { content:'›'; margin-right:6px; }
#drilling-details[open] summary::before { transform:rotate(90deg); }
#block-count { margin: 0 0 12px; font-size: 15px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
/* Grouped inset list: label | value, hairline between visible rows; an all-hidden group collapses to nothing. */
.tech-group { margin: 0 0 12px; padding: 0 12px; border-radius: 12px; background: var(--fill); }
.tech-group:not(:has(> :not([hidden]))) { display: none; }
.tech-row { display: grid; grid-template-columns: 84px minmax(0,1fr); gap: 10px; padding: 11px 0; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.tech-label { color: var(--muted); font-size: 13px; line-height: 1.45; }
.edge-section { padding: 11px 0 0; }
.edge-section > .tech-label { display: block; padding-bottom: 4px; }
.edge-row { width: 100%; display: grid; grid-template-columns: 84px minmax(0,1fr); gap: 10px; min-height: 44px; padding: 11px 0; border: 0; border-radius: 0; background: transparent; color: inherit; font: inherit; font-size: 14px; text-align: left; overflow-wrap: anywhere; }
.edge-summary { display:block; color:var(--accent); font-weight:500; }
.edge-row + .edge-row { box-shadow: inset 0 var(--hair) 0 var(--sep); }
.edge-row:active { background: var(--fill); }
.edge-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.edge-row:disabled { opacity: 1; }
.tech-group > :not([hidden]) ~ :not([hidden]) { box-shadow: inset 0 var(--hair) 0 var(--sep); }
/* Toggle rows inside a group: title left, compact action right. */
.part-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; }
.action-group .part-actions { min-height: 52px; margin: 0 -6px 0 0; font-size: 14px; font-variant-numeric: tabular-nums; }
.action-group .part-actions > span:first-child { min-width: 0; overflow-wrap: anywhere; }
/* 44px touch target, 36px visible pill: the transparent border is part of the hit area. */
.action-group .btn { height: 44px; padding: 0 14px; border: 4px solid transparent; border-radius: 22px; background: var(--card) padding-box; color: var(--accent); font-size: 14px; }
.action-group .btn[aria-pressed="true"] { background: var(--accent) padding-box; color: #fff; }
.action-group .btn:active { background: var(--fill-press) padding-box; }
.action-group .btn[aria-pressed="true"]:active { background: #1b4a52 padding-box; }
@media (hover: hover) { .action-group .btn:hover { background: #fbfaf8 padding-box; } .action-group .btn[aria-pressed="true"]:hover { background: #1b4a52 padding-box; } }
.action-group .part-actions > .btn:only-child { margin-left: auto; }
#drilling-count, #block-drilling-count { white-space: nowrap; }
#drilling-info { margin: -4px 4px 12px; white-space: pre-line; font-size: 12px; line-height: 1.5; }
/* Primary card action: full width, tinted. */
.part-card > .part-actions:last-child { margin-top: 0; }
.part-card > .part-actions:last-child .btn { width: 100%; }
/* three actions in a narrow card (Материал / Вырез / Скрыть деталь): they wrap instead of the label spilling out of its button */
.part-card > .part-actions:last-child { flex-wrap: wrap; }
.part-card > .part-actions:last-child .btn { flex: 1 1 auto; width: auto; }
/* Measurement. */
.measure-card { padding: 14px 16px 16px; }
.measure-card strong { display: block; margin-bottom: 6px; font-size: 17px; }
.measure-card[data-end-mm] strong { font-size: 22px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.measure-card .part-meta { font-variant-numeric: tabular-nums; }
.measure-card .part-meta + .part-meta { margin-top: 4px; }
#annotations { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
/* The engine's warnings (warnings-ui.js): an amber badge over the parts, a tap shows the words. */
.warn-layer { position: absolute; inset: 0; pointer-events: none; }
.warn-badge { position: absolute; transform: translate(-50%, -50%); min-width: 26px; height: 26px; padding: 0 6px; border: 0; border-radius: 13px;
  background: #e08a00; color: #fff; font: 700 13px/26px system-ui, sans-serif; box-shadow: 0 2px 6px rgba(0,0,0,.25); cursor: pointer; pointer-events: auto; }
.warn-badge[hidden], .warn-pop[hidden] { display: none; }
.warn-pop { position: absolute; transform: translateX(-50%); max-width: min(320px, calc(100vw - 32px)); padding: 8px 12px; border-radius: 12px;
  background: var(--card); box-shadow: var(--shadow); font-size: 13px; line-height: 1.4; color: var(--ink); pointer-events: auto; }
.warn-pop p { margin: 0 0 4px; } .warn-pop p:last-child { margin: 0; }
.dimension-label { position: absolute; transform: translate(-50%, -50%); padding: 3px 7px; border-radius: 7px; background: rgba(255,255,255,.94);
  color: var(--ink-2); font-size: 12px; font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; box-shadow: 0 0 0 var(--hair) var(--sep), 0 1px 4px rgba(0,0,0,.1); }
.measure-label { color: var(--accent); }
/* Inner dimensions: smaller, blue, only the number (the unit is the same as outside); a facade in front hides them. */
.inner-label { z-index: 2; padding: 1px 5px; border-radius: 6px; font-size: 11px; color: #1d5fd1; }
.dimension-label { transition: opacity .15s; }
/* The wrapper is a flex box: a plain block would put the button on a text baseline and lift its label. */
.dim-tools { display: flex; align-items: center; }
.dim-tools[hidden] { display: none; }
.dim-menu { left: auto; right: -3px; width: 190px; transform-origin: top right; }
.dim-mode { margin-left: 4px; color: var(--accent); font-weight: 400; }
.measure-marker { position: absolute; transform: translate(-50%, -50%); width: 18px; height: 18px; border: 2px solid white; border-radius: 50%;
  background: var(--accent); color: white; font-size: 10px; line-height: 14px; text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.err { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--muted); background: var(--bg); font-size: 15px; }
.err a { color: var(--accent); }

/* Desktop: room for the whole passport without scrolling. */
@media (min-width: 601px) and (min-height: 501px) { .part-card { max-height: min(600px, calc(100dvh - 140px)); } }
/* Phone portrait: the card is a bottom sheet anchored to the screen edge. */
@media (max-width: 600px) {
  :root { --gutter: 8px; }
  .part-dock { left: var(--gutter); right: var(--gutter); width: auto; bottom: max(var(--gutter), env(safe-area-inset-bottom)); }
  .part-card { --r-card: 22px; max-height: min(460px, 56dvh); }
  @supports not (height: 1dvh) { .part-card { max-height: 56vh; } }
  .toolbar .btn { padding: 0 9px; }
  #view-menu { min-width: 72px; }
  #view-menu .mode-full { display: none; }
  #view-menu .mode-short { display: inline; }
  .dim-mode { display: none; }
  .toolbar #hide-facades { display: none !important; }
}
@media (max-width: 360px) { .toolbar .btn { padding: 0 7px; font-size: 13px; } #view-menu { min-width: 60px; } }
/* Phone landscape: little height -- the card docks on the right and may grow to just under the toolbar. */
@media (max-height: 500px) and (min-width: 601px) {
  .toolbar { top: max(8px, env(safe-area-inset-top)); }
  /* The dock spans from under the toolbar to the bottom; chips keep their size, the card shrinks and scrolls. */
  .part-dock { top: calc(max(8px, env(safe-area-inset-top)) + 58px); bottom: max(8px, env(safe-area-inset-bottom)); width: min(340px, 44vw); justify-content: flex-end; }
  .part-dock > .btn { flex-shrink: 0; }
  .part-card { max-height: none; min-height: 0; flex: 0 1 auto; }
}

#open-specification { border-top: var(--hair) solid var(--sep); border-radius: 0 0 10px 10px; }
.specification { position: fixed; inset: 80px 18px auto auto; margin: 0; width: min(440px, calc(100vw - 36px)); max-height: calc(100dvh - 104px); padding: 0; border: var(--hair) solid var(--sep); border-radius: 24px; background: var(--card); color: var(--ink); box-shadow: 0 12px 48px rgba(30,24,16,.18); overflow: hidden; }
.specification::backdrop { background: rgba(30,24,16,.16); }
.specification[open] { display: flex; flex-direction: column; }
.spec-head { padding: 14px 18px 12px; flex: none; border-bottom: var(--hair) solid var(--sep); }
.spec-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.spec-title h2 { font-size: 20px; margin: 0; }
#close-specification { min-width: 44px; min-height: 44px; }
#spec-summary { font-size: 12px; line-height: 1.5; color: var(--muted); margin: 4px 0 12px; }
#spec-search { box-sizing: border-box; width: 100%; min-height: 44px; border: 0; border-radius: 12px; padding: 10px 12px; background: var(--fill); color: inherit; font: inherit; font-size: 16px; }
.spec-nav { display: flex; gap: 2px; margin-top: 8px; }
.spec-nav .btn { flex: 1; min-width: 0; padding: 0 5px; font-size: 13px; }
.spec-body { overflow-y: auto; overscroll-behavior: contain; min-height: 0; padding: 0 18px 18px; }
.spec-body h3 { font-size: 15px; margin: 20px 0 8px; color: var(--muted); }
.spec-item { box-sizing: border-box; display: flex; flex-direction: column; gap: 5px; width: 100%; min-height: 44px; padding: 13px 0; border: 0; border-bottom: var(--hair) solid var(--sep); text-align: left; color: inherit; background: transparent; font: inherit; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
button.spec-item { cursor: pointer; }
button.spec-item:active { background: var(--fill); }
.spec-item strong { font-size: 15px; font-weight: 600; }
.specification :focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (max-width: 600px) {
  .specification { inset: auto 0 0; width: 100%; max-width: none; height: calc(100dvh - env(safe-area-inset-top) - 24px); max-height: none; border-radius: 24px 24px 0 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom); }
  .spec-head::before { content: ''; display: block; width: 34px; height: 5px; border-radius: 4px; background: var(--sep); margin: -5px auto 8px; }
}
/* Material preview: Viewer-only decor overrides. Side sheet on desktop, bottom sheet on phones; 3D stays visible. */
.material-sheet { position: fixed; z-index: 20; inset: 80px auto auto max(18px, env(safe-area-inset-left)); width: min(420px, calc(100vw - 36px)); max-height: calc(100dvh - 104px);
  display: flex; flex-direction: column; border-radius: 20px; background: var(--card); color: var(--ink); box-shadow: 0 0 0 var(--hair) var(--sep), 0 12px 40px rgba(30,24,16,.16); overflow: hidden; animation: rise .18s ease-out; }
.material-sheet[hidden] { display: none; }
/* Конструктор: аккордеон групп (открыта одна, у закрытых — итог строкой), секции блоками, «было …» под изменённым,
   «в чате →» вместо неактивных полей, липкая панель черновика внизу. Справа на компьютере, снизу на телефоне. */
.material-sheet.constructor-sheet { inset: 80px max(18px, env(safe-area-inset-right)) auto auto; width: min(400px, calc(100vw - 36px));
  --cx-fill: #f1f3f5; --cx-line: #e2e5e9; --cx-input: #f1f3f5; --cx-off: #d5dadf; --cx-muted: #6b7279; }
/* Нейтральная холодная гамма Конструктора (владелец 19.10.2026: «бледно-розовый — лаконичнее, серьёзнее»), акцент прежний. */
.constructor-sheet .spec-body { padding: 0 14px; }
.cx-context { display: flex; align-items: center; gap: 4px; margin: 2px 2px 4px; font-size: 13px; color: var(--cx-muted); }
.cx-context strong { color: var(--ink); font-weight: 600; }
.cx-context-note { font-size: 12px; }
.cx-context .cx-link { margin-left: auto; }
.cx-section-focus { box-shadow: inset 0 0 0 1.5px var(--accent); }
.cx-modes { margin: 10px 0 6px; background: var(--cx-fill); box-shadow: inset 0 0 0 1px var(--cx-line); }
.cx-modes button[aria-pressed="true"] { background: #fff; }
.cx-form { display: flex; flex-direction: column; }
.cx-groups { padding-bottom: 8px; }
.cx-acc { border-radius: 14px; margin: 6px 0; background: var(--cx-fill); box-shadow: inset 0 0 0 1px var(--cx-line); }
.cx-acc[data-open="true"] { background: #fff; box-shadow: inset 0 0 0 1px var(--cx-line), 0 1px 3px rgba(20,30,40,.05); }
.cx-acc-head { display: grid; grid-template-columns: auto minmax(0, 1fr) 16px; align-items: center; column-gap: 10px; row-gap: 0; width: 100%; min-height: 48px;
  padding: 0 12px 0 14px; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.cx-acc-title { font-size: 15px; font-weight: 600; }
.cx-acc-head-hint { padding-top: 12px; padding-bottom: 10px; }
.cx-acc-hint { grid-column: 1 / -1; margin-top: 3px; font-size: 12px; font-weight: 400; color: var(--cx-muted); line-height: 1.3; }
.cx-tip { margin: -4px 0 4px; font-size: 12px; color: var(--cx-muted); }
.cx-acc-sum { justify-self: end; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--cx-muted); }
.cx-chev { width: 7px; height: 7px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); justify-self: center; margin-top: -3px; transition: transform .15s; }
.cx-acc[data-open="true"] .cx-chev { transform: rotate(-135deg); margin-top: 3px; }
.cx-acc[data-open="true"] .cx-acc-sum { visibility: hidden; }
.cx-acc-body { padding: 0 12px 10px 14px; max-height: 52dvh; overflow-y: auto; overscroll-behavior: contain; }
.cx-row { padding: 1px 0; }
.cx-param { display: grid; grid-template-columns: minmax(0, 1fr) 160px; align-items: center; column-gap: 12px; min-height: 44px; font-size: 14px; color: var(--ink); }
.cx-param > span:first-child { min-width: 0; }
.cx-field { position: relative; display: flex; justify-content: flex-end; width: 160px; }
.cx-field input[type=number], .cx-field select { box-sizing: border-box; width: 100%; height: 38px; border: 0; border-radius: 10px; padding: 0 12px; background: var(--cx-input); box-shadow: inset 0 0 0 1px var(--cx-line); color: inherit; font: inherit; font-size: 15px; font-variant-numeric: tabular-nums; outline: none; }
.cx-field input[type=number]:focus, .cx-field select:focus { background: #fff; box-shadow: inset 0 0 0 1.5px var(--accent); }
.cx-field input[type=number] { text-align: right; -moz-appearance: textfield; }
.cx-field input[type=number]::-webkit-inner-spin-button, .cx-field input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.cx-field[data-unit] input { padding-right: 38px; }
.cx-suffix { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--muted); pointer-events: none; }
.cx-field select { appearance: none; -webkit-appearance: none; padding-right: 28px; text-overflow: ellipsis; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: right 15px center, right 10px center; background-size: 5px 5px; background-repeat: no-repeat; }
.cx-field input[aria-invalid=true] { box-shadow: inset 0 0 0 1.5px #c0392b; }
.cx-switch { appearance: none; -webkit-appearance: none; width: 44px; height: 26px; margin: 0; border-radius: 13px; background: var(--cx-off); position: relative; cursor: pointer; transition: background .15s; }
.cx-switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .15s; }
.cx-switch:checked { background: var(--accent); }
.cx-switch:checked::after { transform: translateX(18px); }
.cx-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cx-was { margin: -4px 0 4px; text-align: right; font-size: 12px; color: var(--accent); }
.cx-error { margin: 0 0 6px; font-size: 12px; color: #c0392b; }
.cx-chat-value { display: flex; flex-direction: column; align-items: flex-end; font-size: 14px; color: var(--ink); line-height: 1.25; }
.cx-link { border: 0; padding: 0; background: none; color: var(--accent); font: inherit; font-size: 13px; cursor: pointer; min-height: 32px; }
.cx-chat-row { min-height: 40px; color: var(--muted); }
.cx-chat-row .cx-link { justify-self: end; }
.cx-sections { display: flex; flex-direction: column; gap: 8px; padding-top: 2px; }
.cx-section { border-radius: 12px; padding: 2px 10px 4px; background: var(--cx-fill); }
.cx-section .cx-field input[type=number] { background: #fff; }
/* «Размеры» шкафа из нескольких корпусов: общая ширина — сумма (только чтение, пока корпуса разные), корпуса — с отступом */
.cx-widths .cx-row ~ .cx-row .cx-param > span:first-child { padding-left: 14px; color: var(--muted); }
.cx-field.cx-computed input[type=number] { background: transparent; box-shadow: inset 0 0 0 1px var(--cx-line); color: var(--muted); }
.cx-spread { display: block; margin: 2px 0 6px auto; }
.cx-section-head { font-size: 13px; font-weight: 600; color: var(--muted); padding: 8px 0 0; }
.cx-bar { position: sticky; bottom: 0; z-index: 2; margin: 0 -14px; padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); background: #fff; box-shadow: 0 -1px 0 var(--cx-line); }
.cx-bar-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cx-count { font-size: 14px; font-weight: 600; }
.cx-to-chat:disabled { color: var(--muted); opacity: .6; cursor: default; }
.cx-drop { display: block; margin: 8px auto 0; font-size: 12px; color: var(--cx-muted); }
.cx-sure { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 12px; margin-top: 8px; font-size: 12px; color: var(--ink); }
.cx-danger { color: #b3261e; }
.cx-status { margin: 0 0 8px; min-height: 16px; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.cx-status-error { color: #c0392b; }
.cx-apply { width: 100%; min-height: 46px; border-radius: 12px; font-size: 15px; font-weight: 600; background: var(--accent); color: #fff; }
.cx-apply:disabled { opacity: 1; background: #c9d1d6; color: #fff; }
/* общий .btn:hover красит серым — активная кнопка сборки остаётся цветной */
@media (hover: hover) { .cx-apply:not(:disabled):hover { background: var(--accent); filter: brightness(1.08); } .cx-apply:disabled:hover { background: #c9d1d6; } }
.cx-group { border-bottom: var(--hair) solid var(--sep); }
.cx-group summary { display: flex; align-items: center; min-height: 44px; font-size: 13px; color: var(--muted); cursor: pointer; }
.cx-meta { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.start-constructor { position: fixed; z-index: 15; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); min-height: 44px; padding: 0 18px; border-radius: 22px; background: var(--card); box-shadow: 0 0 0 var(--hair) var(--sep), 0 6px 24px rgba(30,24,16,.14); }
body:not([data-start]) .start-constructor { display: none; }
@media (max-width: 600px) {
  .material-sheet.constructor-sheet { inset: auto 0 0 0; width: 100%; max-height: 78dvh; border-radius: 20px 20px 0 0; }
  .cx-acc-body { max-height: 38dvh; }
  .cx-param { grid-template-columns: minmax(0, 1fr) 148px; } .cx-field { width: 148px; }
}
.material-sheet .spec-head { padding: 14px 16px 12px; }
.material-sheet .spec-title h2 { font-size: 18px; }
.material-scopes { display: flex; gap: 2px; padding: 3px; margin: 8px 0; border-radius: 12px; background: var(--fill); }
.material-scopes button { flex: 1; min-width: 0; min-height: 44px; padding: 4px 2px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font: inherit; font-size: 13px; white-space: nowrap; }
.material-scopes button[aria-pressed="true"] { background: var(--surface); color: var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.material-scopes button:disabled { opacity: .45; }
#material-target { margin: 2px 0 10px; font-size: 12px; color: var(--muted); }
#material-target strong { color: var(--accent); font-weight: 500; }
#material-search { box-sizing: border-box; width: 100%; min-height: 44px; border: 0; border-radius: 11px; padding: 8px 12px; background: var(--fill); color: inherit; font: inherit; font-size: 16px; }
.material-brands { display: flex; gap: 6px; margin-top: 8px; overflow-x: auto; scrollbar-width: none; }
.material-brands::-webkit-scrollbar { display: none; }
.material-brands .btn { flex: none; height: 44px; padding: 0 12px; border-radius: 16px; background: var(--fill); font-size: 13px; }
.material-brands .btn[aria-pressed="true"] { background: var(--accent); color: #fff; }
.material-list { overflow-y: auto; overscroll-behavior: contain; min-height: 0; padding: 6px 10px; }
.material-item { box-sizing: border-box; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 7px 6px; border: 0; border-radius: 12px; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.material-item:active { background: var(--fill); }
@media (hover: hover) { .material-item:hover { background: var(--fill); } }
.material-item[aria-pressed="true"] { background: var(--accent-fill); }
.material-item:disabled { opacity: .5; cursor: default; }
.material-swatch { flex: none; width: 52px; height: 52px; border-radius: 9px; background-size: 260% auto; background-position: center; object-fit: cover; box-shadow: inset 0 0 0 var(--hair) rgba(0,0,0,.14); }
.material-item[data-unresolved] { opacity: 1; }
.material-item[data-unresolved] .material-swatch { background: repeating-linear-gradient(135deg, var(--fill) 0 5px, transparent 5px 10px); }
.material-item[data-unresolved] .material-text { color: var(--muted); }
.material-text { display: flex; flex-direction: column; min-width: 0; font-size: 13px; line-height: 1.35; }
.material-text strong { font-size: 14px; font-weight: 600; }
.material-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.material-brand { color: var(--muted); font-size: 12px; }
.material-empty { padding: 16px 8px; color: var(--muted); font-size: 13px; }
.material-foot { display: flex; flex-wrap: wrap; flex-shrink: 0; gap: 8px; padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); border-top: var(--hair) solid var(--sep); }
.material-foot .btn { flex: 1 1 100%; min-height: 44px; border-radius: 12px; background: var(--fill); font-size: 14px; color: var(--accent); }
.material-foot p { width: 100%; margin: 0; font-size: 12px; line-height: 1.45; }
#apply-project-material { background: var(--accent); color: white; }
.material-foot .btn[hidden] { display: none; }
.preview-note { box-sizing: border-box; max-width: 100%; display: flex; align-items: center; gap: 4px; padding: 0 4px 0 14px; height: 44px; border-radius: 22px; background: var(--surface); pointer-events: auto;
  -webkit-backdrop-filter: blur(20px) saturate(1.6); backdrop-filter: blur(20px) saturate(1.6); box-shadow: 0 0 0 var(--hair) var(--sep), 0 4px 14px rgba(30,24,16,.1); font-size: 13px; color: var(--ink-2); }
.preview-note[hidden] { display: none; }
.preview-note > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-note .btn { flex: none; height: 36px; padding: 0 12px; border-radius: 18px; background: transparent; color: var(--accent); font-size: 13px; }
/* «Вырез»: the material sheet's frame; templates, two offsets from the part's edges, sizes, the engine's answer. */
.cut-part { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.cutout-sheet { overflow-y: auto; overscroll-behavior: contain; }
.cut-body { flex: none; padding: 4px 16px 8px; display: flex; flex-direction: column; gap: 10px; }
.cutout-sheet .material-foot { position: sticky; bottom: 0; background: var(--card); }
.cut-templates { display: flex; flex-wrap: wrap; gap: 6px; }
.cut-templates .btn { min-height: 44px; padding: 0 14px; border-radius: 16px; background: var(--fill); font-size: 13px; }
.cut-templates .btn[aria-pressed="true"] { background: var(--accent); color: #fff; }
.cut-shape { margin: 0; }
.cut-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cut-offset { display: flex; flex-direction: column; gap: 4px; }
.cut-offset select { min-height: 36px; border: 0; border-radius: 9px; padding: 0 8px; background: var(--fill); color: inherit; font: inherit; font-size: 14px; }
.cut-gaps { grid-template-columns: 1fr auto 1fr; gap: 6px; }
.cut-ratio { align-self: end; display: grid; place-items: center; width: 30px; height: 30px; margin-bottom: 7px; padding: 0; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; }
.cut-ratio:hover { background: var(--fill); }
.cut-ratio[aria-pressed="true"] { background: var(--accent); color: #fff; }
.cut-ratio:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cut-ratio[hidden] { display: none; }
.cut-field { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.cut-field input { box-sizing: border-box; width: 100%; min-height: 44px; border: 0; border-radius: 11px; padding: 6px 10px; background: var(--fill); color: var(--ink); font: inherit; font-size: 16px; }
.cut-hint { margin: 0; font-size: 12px; line-height: 1.4; color: var(--muted); }
.cut-group { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; cursor: pointer; }
.cut-group input { width: 22px; height: 22px; flex: none; accent-color: var(--accent); }
.part-legacy { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding-top: 8px; border-top: var(--hair) solid var(--sep); }
.part-legacy[hidden] { display: none; }
.part-legacy p { flex: 1; margin: 0; font-size: 12px; line-height: 1.4; color: var(--muted); }
.part-legacy .btn { flex: none; }
.cut-range { margin: 2px 0 0; font-size: 13px; line-height: 1.4; color: var(--ink); font-variant-numeric: tabular-nums; }
.cut-existing { display: flex; flex-direction: column; gap: 4px; }
.cut-head { color: var(--muted); font-size: 11px; }
.cut-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.cut-row .btn { min-height: 36px; padding: 0 12px; border-radius: 12px; background: var(--fill); color: #9a3b1f; font-size: 13px; }
.cut-drawing { display: block; width: calc(100% - 32px); max-height: 380px; margin: 0 16px 8px; object-fit: contain; border-radius: 10px; background: #fff; box-shadow: inset 0 0 0 var(--hair) var(--sep); }
.cut-drawing[hidden] { display: none; }
.cut-status { min-height: 18px; color: var(--muted); overflow-wrap: anywhere; }
.cut-status.cut-ok { color: #2e7d32; }
.cut-status.cut-bad { color: #9a3b1f; }
#apply-cutout, #apply-shelf, #apply-drawer { background: var(--accent); color: #fff; }
#undo-edit[data-busy="true"] svg { opacity: .4; }
@media (max-width: 600px) { #undo-edit { display: none; } }
.undo-confirm { position: fixed; z-index: 40; width: 264px; box-sizing: border-box; padding: 14px; border-radius: 14px; background: var(--card); color: var(--ink);
  box-shadow: 0 0 0 var(--hair) var(--sep), var(--shadow); }
.undo-confirm[hidden] { display: none; }
.undo-title { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.undo-note { margin: 0 0 12px; font-size: 12px; line-height: 1.4; color: var(--muted); }
.undo-row { display: flex; gap: 8px; justify-content: flex-end; }
.undo-row .btn { min-height: 36px; padding: 0 14px; }
.undo-yes { background: var(--ink); color: var(--bg); }
.material-part { flex: 1 1 100%; display: flex; flex-direction: column; gap: 6px; }
.material-part[hidden] { display: none; }
.material-part-head, .material-part-status { margin: 0; font-size: 13px; color: var(--muted); }
.material-part .material-part-option[aria-pressed="true"] { background: var(--accent); color: #fff; }
.material-part .material-part-apply { background: var(--accent); color: #fff; }
#apply-cutout:disabled, #apply-shelf:disabled, #apply-drawer:disabled { opacity: .5; }
@media (max-width: 600px) {
  .cutout-sheet { max-height: 56dvh; }
  body[data-cutout-open="true"] #stage { bottom: 56dvh; }
  body[data-cutout-open="true"] .chat-launch { display: none; }
  body[data-cutout-open="true"] .part-dock { display: none; }
  body[data-shelf-open="true"] #stage { bottom: 56dvh; }
  body[data-shelf-open="true"] .chat-launch, body[data-shelf-open="true"] .part-dock { display: none; }
  body[data-drawer-open="true"] #stage { bottom: 56dvh; }
  body[data-drawer-open="true"] .chat-launch, body[data-drawer-open="true"] .part-dock { display: none; }
  .cut-drawing { max-height: 300px; }
}
@media (max-width: 600px) {
  .material-sheet { inset: auto 0 0 0; width: 100%; max-height: 48dvh; border-radius: 20px 20px 0 0; }
  .material-sheet .spec-head::before { content: ''; display: block; width: 34px; height: 5px; border-radius: 4px; background: var(--sep); margin: -4px auto 8px; }
  body[data-material-open="true"] #stage { bottom: 48dvh; }
  body[data-material-open="true"] .part-dock { display: none; }
  /* Phones keep the compact sheet: the bigger desktop sizes stop here. */
  .material-sheet .spec-head { padding: 12px 14px 10px; }
  .material-sheet .spec-title h2 { font-size: 17px; }
  .material-scopes button { font-size: 12px; }
  .material-list { padding: 4px 8px; }
  .material-item { min-height: 56px; padding: 6px; }
  .material-swatch { width: 44px; height: 44px; }
  .material-text { line-height: 1.3; }
}
#part-validation[data-state="ok"] { background:transparent; color:#28834a; font-size:13px; font-weight:400; padding:0 8px; border-radius:6px; }
#part-validation[data-state="ok"]:hover, #part-validation[data-state="ok"]:active { background:transparent; }
#project-validation { height:auto; max-height: min(70dvh, 640px); }
.validation-error { padding-left:10px; border-left: 3px solid #c65b59; } .validation-warning { padding-left:10px; border-left: 3px solid #bf8b35; } #validation-summary { color:var(--muted); font-size:13px; }
/* Personal project navigation stays separate from the model toolbar. */
.project-pill { position:absolute; top:calc(env(safe-area-inset-top) + 12px); left:12px; display:flex; align-items:center; max-width:min(300px, calc(50vw - 164px)); height:44px; padding:0 5px; border-radius:16px; background:var(--surface); backdrop-filter:blur(20px); box-shadow:0 0 0 var(--hair) var(--sep),0 3px 12px rgba(30,24,16,.07); color:var(--ink); }
.project-pill button { display:flex; align-items:center; gap:8px; min-width:0; height:44px; border:0; background:transparent; color:inherit; font:inherit; font-size:13px; cursor:pointer; padding:0 10px; border-radius:12px; white-space:nowrap; }
.project-name { flex:1 1 auto; overflow:hidden; }
.project-name svg { flex:none; color:var(--muted); }
.project-name span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.project-pill .project-version { flex:none; min-width:54px; padding:0 9px; font-variant-numeric:tabular-nums; }
.project-dot { color:var(--muted); }
.project-pill .project-share { flex:none; width:44px; padding:0; justify-content:center; color:var(--muted); }
.project-pill button:hover { background:var(--fill); }
.project-pill button:focus-visible { outline:2px solid var(--accent); outline-offset:-2px; }
/* Account (09.10.2026): initial + name top right; on a phone only the initial, in the project pill's row. */
.account-pill { position:absolute; top:calc(env(safe-area-inset-top) + 12px); right:12px; display:flex; align-items:center; gap:8px; max-width:200px; height:44px; padding:0 12px 0 6px; border:0; border-radius:22px; background:var(--surface); backdrop-filter:blur(20px); -webkit-backdrop-filter:blur(20px); box-shadow:0 0 0 var(--hair) var(--sep),0 3px 12px rgba(30,24,16,.07); color:var(--ink); font:inherit; font-size:13px; cursor:pointer; }
.account-pill:hover { background:#fff; }
.account-pill:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.account-avatar { flex:none; width:32px; height:32px; border-radius:50%; display:grid; place-items:center; background:var(--accent); color:#fff; font-weight:600; font-size:14px; }
.account-avatar.big { width:44px; height:44px; font-size:18px; }
.account-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.account-dot { position:absolute; top:7px; left:31px; width:9px; height:9px; border-radius:50%; background:#d9822b; box-shadow:0 0 0 2px var(--card); }
.account-sheet { position:fixed; margin:0; inset:66px 12px auto auto; width:300px; max-width:calc(100vw - 24px); padding:0 0 8px; border:0; border-radius:18px; background:var(--card); color:var(--ink); box-shadow:var(--shadow); z-index:40; }
.account-sheet header { display:flex; align-items:center; gap:12px; padding:14px 8px 10px 16px; }
.account-sheet header div { flex:1; min-width:0; display:flex; flex-direction:column; gap:2px; }
.account-sheet header strong { font-size:15px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.account-sheet header small { color:var(--muted); font-size:12px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.account-sheet .account-close { background:transparent; font-size:14px; }
.account-balance { display:flex; justify-content:space-between; align-items:center; gap:12px; min-height:68px; margin:0 12px; padding:10px 12px; border-radius:12px; background:var(--fill); }
.account-balance > div { display:flex; flex-direction:column; gap:4px; }
.account-topup { position:relative; isolation:isolate; flex:none; height:44px; padding:0 10px; border:0; background:transparent; color:#fff; font:inherit; font-size:12px; font-weight:600; cursor:pointer; }
.account-topup::before { content:""; position:absolute; inset:6px 0; z-index:-1; border-radius:8px; background:#b35a0f; }
.account-topup:hover::before { background:#9a4e0c; }
.account-topup:active::before { background:#85430a; }
.account-notice { margin:8px 16px; color:var(--muted); font-size:12px; line-height:1.4; }
.avatar-upload { border:0; padding:0; cursor:pointer; overflow:hidden; }
.avatar-upload:hover { box-shadow:0 0 0 3px var(--accent-fill); }
.account-avatar img { width:100%; height:100%; object-fit:cover; border-radius:50%; }
.account-balance span { color:var(--muted); }
.account-balance b { font-size:16px; font-variant-numeric:tabular-nums; }
.account-verify { margin:10px 12px 0; padding:10px 14px; border-radius:12px; background:#f6e7d2; color:#8a5a22; font-size:13px; }
.account-verify p { margin:0 0 4px; }
.account-verify button { min-height:32px; padding:0; border:0; background:none; color:inherit; font:inherit; font-weight:600; text-decoration:underline; cursor:pointer; }
.account-verify small { display:block; }
.account-sheet nav { display:flex; flex-direction:column; padding:8px 8px 0; }
.account-row { display:flex; align-items:center; min-height:44px; padding:0 12px; border:0; border-radius:10px; background:transparent; color:var(--ink); font:inherit; font-size:14px; text-align:left; text-decoration:none; cursor:pointer; }
.account-row:hover { background:var(--fill); }
.account-row:active { background:var(--fill-press); }
.account-row .profile-icon { flex:none; margin-right:10px; }
.account-row .profile-label { min-width:0; }
.account-logout { color:#a33a2a; }
.account-links { display:flex; align-items:center; gap:4px; padding:0 4px; color:var(--muted); font-size:12px; white-space:nowrap; }
.account-links a { display:inline-flex; align-items:center; min-height:44px; padding:0 8px; color:inherit; text-decoration:none; border-radius:8px; }
.account-links a:hover { color:var(--ink); background:var(--fill); }
.account-links a:active { color:var(--ink); background:var(--fill-press); }
.account-pane { display:flex; flex-direction:column; gap:10px; padding:4px 14px 6px; }
.pane-head { display:flex; align-items:center; gap:6px; margin-left:-8px; }
.pane-head .pane-back { background:transparent; font-size:18px; }
.pane-head strong { font-size:15px; }
.pane-hint, .pane-status, .pane-card { margin:0; font-size:13px; line-height:1.4; }
.pane-hint { color:var(--muted); }
.pane-status:empty, .pane-card:empty { display:none; }
.pane-card { white-space:pre-wrap; max-height:40vh; overflow:auto; padding:10px 12px; border-radius:12px; background:var(--fill); }
.pane-actions { display:flex; flex-direction:column; gap:8px; }
.pane-actions:empty { display:none; }
.pane-actions .btn { justify-content:flex-start; text-align:left; }
.account-pane .pane-primary { background:var(--accent); color:#fff; }
.account-pane .pane-primary:disabled { opacity:.55; }
.pane-form { display:flex; flex-direction:column; gap:8px; }
.pane-form input[type=email], .pane-form input[type=password] { height:44px; padding:0 12px; border:0; border-radius:12px; background:var(--fill); color:var(--ink); font:inherit; font-size:15px; }
.pane-consent { display:flex; gap:8px; align-items:flex-start; font-size:13px; line-height:1.4; color:var(--muted); }
.pane-consent input { width:18px; height:18px; margin:1px 0 0; accent-color:var(--accent); }
.pane-consent a { color:var(--accent); }
.pane-text { width:100%; box-sizing:border-box; padding:10px 12px; border:0; border-radius:12px; background:var(--fill); color:var(--ink); font:inherit; font-size:14px; resize:vertical; }
.chat-msg .chat-cancel { align-self:flex-start; background:var(--card); color:#a33a2a; height:36px; margin-top:6px; padding:0 12px; font-size:13px; }
body[data-debug="true"] .account-pill { top:calc(env(safe-area-inset-top) + 66px); }
@media (max-width:900px) { .account-pill { padding:0 6px; width:44px; } .account-pill .account-name { display:none; } .account-dot { left:30px; } }
@media (max-width:600px) {
  .account-pill { top:calc(env(safe-area-inset-top) + 72px); padding:0 6px; width:44px; }
  .account-pill .account-name { display:none; }
  .account-dot { left:30px; }
  .account-sheet { inset:auto 0 0 0; width:100%; max-width:none; border-radius:18px 18px 0 0; padding-bottom:max(12px, env(safe-area-inset-bottom)); }
  body:has(.account-pill:not([hidden])) .project-pill { max-width:min(300px, calc(100vw - 80px)); }
  body[data-debug="true"] .account-pill { top:calc(env(safe-area-inset-top) + 126px); }
}
.project-dialog { position:fixed; margin:0; inset:66px auto auto 12px; width:300px; max-width:calc(100vw - 24px); max-height:calc(100dvh - 90px); padding:0; border:0; border-radius:20px; background:var(--card); color:var(--ink); box-shadow:0 0 0 var(--hair) var(--sep), 0 2px 6px rgba(30,24,16,.06), 0 18px 48px rgba(30,24,16,.16); }
.project-dialog[open] { display:flex; flex-direction:column; overflow:hidden; animation:project-pop .16s cubic-bezier(.2,.8,.3,1); }
.project-dialog > * { flex:none; }
@keyframes project-pop { from { opacity:0; transform:translateY(-4px) scale(.985); } }
@keyframes project-fade { from { opacity:0; } }
.project-dialog[data-tab="projects"] { width:392px; }
.project-dialog::backdrop { background:rgba(30,24,16,.10); }
.project-dialog header { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:12px 10px 4px 20px; }
.project-heading { flex:1; min-width:0; display:flex; flex-direction:column; gap:3px; }
.project-dialog header strong { font-size:17px; font-weight:650; letter-spacing:-.015em; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.project-heading small { color:var(--ink-2); font-size:12.5px; line-height:1.45; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.project-dialog header .btn { width:36px; height:36px; min-width:36px; padding:0; background:transparent; font-size:15px; color:var(--ink-2); }
.project-dialog nav { display:none; gap:4px; padding:8px 12px; }
.project-dialog nav .btn { flex:1; font-size:14px; background:transparent; }
.project-dialog nav .btn[aria-pressed="true"] { background:var(--fill); color:var(--ink); }
.project-search { padding:8px 14px 6px; display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
.project-search[hidden] { display:none; }
.project-search input[type="search"] { flex:1 0 100%; min-width:0; height:40px; border:0; background:var(--fill); border-radius:12px; padding:0 14px; font:inherit; font-size:14px; color:var(--ink); outline:none; box-shadow:0 0 0 0 transparent; transition:box-shadow .15s, background-color .15s; }
.project-search input[type="search"]::placeholder { color:var(--muted); }
.project-search input[type="search"]:focus { background:var(--card); box-shadow:0 0 0 1.5px var(--accent); }
.project-new-folder, .project-upload { flex:none; height:32px; padding:0 10px; margin-left:-4px; margin-right:4px; border:0; border-radius:9px; background:transparent; color:var(--accent); font:inherit; font-size:13px; font-weight:550; cursor:pointer; transition:background-color .15s; }
.project-new-folder:hover, .project-upload:hover { background:var(--accent-fill); }
.project-new-folder:focus-visible, .project-upload:focus-visible { outline:2px solid var(--accent); outline-offset:-2px; }
.project-new-folder[hidden], .project-upload[hidden] { display:none; }
.project-upload:disabled { opacity:.55; cursor:default; }
.project-upload-status { padding:0 20px 8px; color:var(--ink-2); font-size:12.5px; }
/* The list takes what is left of the dialog and scrolls inside it: the end is never cut by the dialog's edge. */
.project-dialog > .project-list { flex:1 1 auto; min-height:0; overflow-y:auto; padding:2px 8px 12px; overscroll-behavior:contain; }
.project-list h3 { font-size:12px; color:var(--ink-2); margin:14px 12px 4px; font-weight:600; }
.project-list h3:first-child { margin-top:6px; }
/* The row never changes its box on hover: «⋯» fades in over a padding that is always reserved (no jumping text). */
.project-row { width:100%; position:relative; display:flex; flex-direction:column; align-items:flex-start; gap:3px; min-height:56px; padding:9px 44px 9px 12px; border:0; background:transparent; color:var(--ink); border-radius:12px; text-align:left; cursor:pointer; font:inherit; transition:background-color .12s; }
.project-row b { font-size:14px; font-weight:550; letter-spacing:-.01em; max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.project-row small { color:var(--ink-2); font-size:12px; line-height:1.4; max-width:100%; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.project-dialog[data-tab="projects"] .project-row small { display:flex; align-items:baseline; gap:8px; width:100%; white-space:nowrap; }
.project-item-detail { min-width:0; overflow:hidden; text-overflow:ellipsis; }
.project-item-meta { flex:none; margin-left:auto; color:var(--muted); font-variant-numeric:tabular-nums; }
.project-row:hover { background:var(--fill); }
.project-row:active { background:var(--fill-press); }
.project-row:focus-visible { outline:2px solid var(--accent); outline-offset:-2px; }
.project-row:disabled { cursor:default; opacity:.55; }
/* Open project: accent tint, accent title, a check where «⋯» lives. */
.project-row[aria-current="page"] { background:var(--accent-fill); }
.project-row[aria-current="page"] b { color:var(--accent); }
.project-row[aria-current="page"]:hover { background:rgba(35,93,103,.16); }
.project-dialog[data-tab="projects"] .project-row[aria-current="page"]::after { content:""; position:absolute; right:14px; top:50%; width:16px; height:16px; margin-top:-8px; background:var(--accent); -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center/contain no-repeat; mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center/contain no-repeat; transition:opacity .12s; }
.project-item { position:relative; }
.project-item + .project-item { margin-top:2px; }
.project-item[hidden], .project-item > [hidden] { display:none; }
.project-more-actions { position:absolute; right:4px; top:50%; width:36px; height:36px; margin-top:-18px; display:grid; place-items:center; border:0; border-radius:10px; background:transparent; color:var(--ink-2); cursor:pointer; opacity:0; transition:opacity .12s, background-color .12s; }
.project-item:hover .project-more-actions, .project-more-actions:focus-visible { opacity:1; }
.project-item:hover .project-row[aria-current="page"]::after { opacity:0; }
.project-more-actions:hover { color:var(--ink); background:var(--fill-press); }
.project-more-actions:focus-visible { outline:2px solid var(--accent); outline-offset:-2px; }
.project-dialog[data-tab="projects"] .project-row.project-folder-row { flex-direction:row; align-items:center; gap:10px; min-height:48px; padding:0 44px 0 12px; }
.project-folder-row svg { flex:none; color:var(--accent); }
.project-folder-row b { flex:1; min-width:0; }
.project-dialog[data-tab="projects"] .project-folder-row small { display:block; width:auto; flex:none; color:var(--muted); font-variant-numeric:tabular-nums; }
.project-folder-row i { font-style:normal; color:var(--muted); font-size:18px; line-height:1; transition:opacity .12s; }
.project-folder-item:hover .project-folder-row i { opacity:0; }
.project-back { flex:none; width:36px; height:36px; padding:0; margin-left:-10px; background:transparent !important; font-size:22px; line-height:1; color:var(--ink); }
.project-back[hidden] { display:none; }
.project-rename-form { flex:1; display:flex; align-items:center; gap:6px; min-width:0; }
.project-rename-form input, .project-confirm select, .project-confirm > input { flex:1; min-width:0; height:36px; border:0; border-radius:9px; padding:0 10px; background:var(--card); color:var(--ink); font:inherit; font-size:14px; outline:none; box-shadow:0 0 0 1px var(--sep); }
.project-rename-form input:focus, .project-confirm select:focus, .project-confirm > input:focus { box-shadow:0 0 0 1.5px var(--accent); }
.project-confirm > input[hidden] { display:none; }
/* The inline bar takes exactly the row's place (height set from the row in JS), fades in, never jumps. */
.project-confirm { display:flex; flex-wrap:wrap; align-items:center; gap:6px; min-height:56px; padding:8px 8px 8px 10px; border-radius:12px; background:var(--fill); font-size:13px; outline:none; animation:project-fade .12s ease-out; }
.project-confirm span { flex:1; min-width:0; font-size:13px; line-height:1.35; color:var(--ink); overflow-wrap:anywhere; }
.project-confirm .btn { flex:none; height:34px; padding:0 12px; border-radius:9px; font-size:13px; background:var(--card); box-shadow:0 0 0 var(--hair) var(--sep), 0 1px 2px rgba(30,24,16,.06); }
.project-confirm .btn:hover { background:var(--card); box-shadow:0 0 0 1px var(--sep), 0 1px 3px rgba(30,24,16,.1); }
.project-confirm .btn:focus-visible { outline:2px solid var(--accent); outline-offset:1px; }
.project-confirm .project-close { margin-left:auto; width:34px; min-width:34px; padding:0; background:transparent; box-shadow:none; color:var(--ink-2); }
.project-confirm .project-close:hover { background:var(--fill-press); box-shadow:none; }
.project-confirm.project-actions { flex-wrap:nowrap; }
.project-confirm-yes { color:#b3261e; }
.project-confirm .project-confirm-yes:hover { background:#fdecea; }
@media (pointer:coarse) {
  .project-more-actions { opacity:1; width:44px; height:44px; margin-top:-22px; right:0; color:var(--muted); }
  .project-dialog[data-tab="projects"] .project-row[aria-current="page"]::after { content:none; }
  .project-folder-row i { display:none; }
  .project-rename-form input, .project-confirm select, .project-confirm > input { height:44px; font-size:16px; }
  .project-new-folder, .project-upload { height:40px; }
  .project-back { width:44px; height:44px; }
  .project-dialog header .btn { width:44px; height:44px; }
  .project-confirm .btn { height:44px; }
  .project-confirm .project-close { width:44px; }
}
.project-more { width:100%; margin-top:8px; }
.project-notice { position:absolute; top:78px; left:12px; right:12px; padding:14px; background:var(--card); border-radius:14px; box-shadow:var(--shadow); }
.project-notice.toast { right:auto; padding:8px 14px; font-size:14px; border-radius:999px; animation:toast-out 1.8s ease forwards; pointer-events:none; }
@keyframes toast-out { 0%,75% { opacity:1; } 100% { opacity:0; } }
body[data-debug="true"] .project-pill { top:calc(env(safe-area-inset-top) + 66px); }
@media(max-width:600px) {
 /* Phone: a compact folder chip — icon · vN · share; the project name lives in the sheet header. */
 .project-pill, body:has(.account-pill:not([hidden])) .project-pill { top:calc(env(safe-area-inset-top) + 72px); max-width:calc(100vw - 80px); padding:0 2px; border-radius:16px; }
 .project-pill .project-name { flex:none; width:44px; padding:0; justify-content:center; }
 .project-pill .project-name span, .project-pill .project-dot { display:none; }
 .project-pill .project-name svg { display:block; color:var(--ink); }
 .project-pill .project-version { min-width:0; padding:0 8px; }
 .project-dialog,.project-dialog[data-tab="projects"] { inset:auto 0 0; width:100%; max-width:100%; max-height:75dvh; border-radius:22px 22px 0 0; padding-bottom:env(safe-area-inset-bottom); }
 .project-dialog nav { display:flex; }
 .project-dialog header { padding:12px 10px 2px 20px; }
 .project-search input[type="search"] { flex-basis:100%; font-size:16px; }
 .project-dialog > .project-list { min-height:130px; padding:4px 12px 18px; }
 .project-row { min-height:60px; padding-top:10px; padding-bottom:10px; }
 .project-row b { font-size:15px; } .project-row small { font-size:12.5px; }
 body[data-debug="true"] .project-pill { top:calc(env(safe-area-inset-top) + 126px); }
}

.estimate-dialog { border:0; border-radius:20px; padding:20px; width:400px; max-width:calc(100vw - 32px); max-height:75dvh; color:var(--ink); background:var(--surface); box-shadow:0 12px 48px rgba(30,24,16,.2); }
.estimate-dialog::backdrop { background:rgba(30,24,16,.18); }
.estimate-header { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:12px; }
.estimate-header h2 { margin:0; font-size:20px; font-weight:600; }
.estimate-header .btn { min-width:44px; min-height:44px; padding:0 14px; }
.estimate-body { white-space:pre-wrap; overflow-wrap:anywhere; font:inherit; font-size:14px; line-height:1.6; margin:0; }
@media(max-width:600px) {
 .estimate-dialog { margin:0; position:fixed; inset:auto 0 0; width:100%; max-width:100%; max-height:75dvh; border-radius:22px 22px 0 0; padding:16px 18px calc(18px + env(safe-area-inset-bottom)); }
 .toolbar .btn { padding:0 9px; }
}
/* «Базис чат»: the bot's pipeline for the opened revision. A floating launcher in the bottom-right corner,
   the panel opens above it on desktop and as a bottom sheet on phones. */
.chat-launch { position:absolute; z-index:22; right:max(16px, env(safe-area-inset-right)); bottom:calc(env(safe-area-inset-bottom) + 16px); display:flex; align-items:center; gap:8px; height:52px; padding:0 22px 0 18px; border:0; border-radius:26px;
  color:#fff; font:inherit; font-size:15px; font-weight:600; letter-spacing:.01em; cursor:pointer; overflow:hidden; isolation:isolate;
  background:linear-gradient(135deg, #2f7f86 0%, #235d67 45%, #3d4f86 100%);
  box-shadow:0 0 0 1px rgba(255,255,255,.18) inset, 0 6px 18px rgba(35,93,103,.35), 0 0 28px rgba(92,140,220,.28); transition:transform .15s ease, box-shadow .2s ease; }
.chat-launch svg { flex:none; filter:drop-shadow(0 0 4px rgba(255,255,255,.55)); }
.chat-launch::after { content:''; position:absolute; inset:0; z-index:-1; background:linear-gradient(110deg, transparent 30%, rgba(255,255,255,.28) 48%, transparent 66%); transform:translateX(-120%); animation:chat-sheen 5.5s ease-in-out 1.2s infinite; }
@keyframes chat-sheen { 0%, 70% { transform:translateX(-120%); } 100% { transform:translateX(120%); } }
.chat-launch:active { transform:scale(.97); }
@media (hover:hover) { .chat-launch:hover { box-shadow:0 0 0 1px rgba(255,255,255,.24) inset, 0 8px 22px rgba(35,93,103,.42), 0 0 36px rgba(92,140,220,.42); } }
.chat-launch[hidden] { display:none; }
.chat-launch[aria-expanded="true"] { background:linear-gradient(135deg, #235d67, #2c3f6e); }
.chat-launch:focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
@media (prefers-reduced-motion: reduce) { .chat-launch::after { animation:none; } }
body[data-chat-ready="true"] .part-dock { bottom:calc(env(safe-area-inset-bottom) + 80px); }
.chat-panel { position:fixed; z-index:21; right:max(16px, env(safe-area-inset-right)); bottom:calc(env(safe-area-inset-bottom) + 80px); width:min(400px, calc(100vw - 32px)); max-height:min(620px, calc(100dvh - 170px)); display:flex; flex-direction:column; border-radius:22px; background:var(--card); color:var(--ink); box-shadow:0 0 0 var(--hair) var(--sep), 0 18px 48px rgba(30,24,16,.18); overflow:hidden; transform-origin:100% 100%; animation:chat-pop .2s ease-out; }
@keyframes chat-pop { from { opacity:0; transform:translateY(10px) scale(.97); } }
.chat-panel[hidden] { display:none; }
/* app.bazis.migman.ru/ (owner 14.10.2026): no model yet -- the chat in the middle, the rest waits for the first build */
body[data-start="true"] .toolbar, body[data-start="true"] .chat-launch, body[data-start="true"] .chat-mode, body[data-start="true"] .chat-close { display:none; }
body[data-start="true"]:not([data-docked]) .chat-panel { left:auto; top:auto; right:50%; bottom:50%; height:auto; border-radius:22px; animation:none; transform:translate(50%, 50%); width:min(560px, calc(100vw - 32px)); max-height:min(560px, calc(100dvh - 140px)); transform-origin:50% 50%; }
body[data-start="true"]:not([data-docked]) .chat-log { min-height:160px; }
/* Beta notice for a guest on the start page (beta-notice.js). */
.beta-notice { position:fixed; inset:0; z-index:60; display:flex; align-items:center; justify-content:center; padding:16px; background:rgba(28,24,18,.28); -webkit-backdrop-filter:blur(6px); backdrop-filter:blur(6px); animation:beta-fade .2s ease-out; }
.beta-notice.out { opacity:0; transition:opacity .18s; }
.beta-card { width:min(460px, 100%); max-height:calc(100dvh - 32px); overflow:auto; background:var(--card); border-radius:22px; padding:22px 22px 18px; box-shadow:0 0 0 var(--hair) var(--sep), 0 24px 64px rgba(30,24,16,.24); animation:beta-rise .26s cubic-bezier(.2,.8,.2,1); }
.beta-badge { display:inline-flex; align-items:center; gap:7px; height:28px; padding:0 12px 0 10px; border-radius:999px; background:linear-gradient(135deg,#f0a23c,#e0742b); color:#fff; font-size:12px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; box-shadow:0 4px 14px rgba(224,116,43,.3); }
.beta-badge::before { content:""; width:7px; height:7px; border-radius:50%; background:#fff; animation:beta-pulse 1.6s ease-in-out infinite; }
@keyframes beta-pulse { 0%,100% { box-shadow:0 0 0 0 rgba(255,255,255,.7); } 50% { box-shadow:0 0 0 5px rgba(255,255,255,0); } }
.beta-tags { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.beta-important { display:inline-flex; align-items:center; height:28px; padding:0 12px; border-radius:999px; background:linear-gradient(135deg,#e5484d,#d9363e); color:#fff; font-size:12px; font-weight:800; letter-spacing:.08em; text-transform:uppercase; box-shadow:0 4px 14px rgba(217,54,62,.3); }
.beta-card h2 { margin:14px 0 6px; font-size:22px; line-height:1.2; font-weight:700; letter-spacing:-.01em; }
.beta-lead { margin:0 0 14px; color:var(--ink-2); font-size:14px; line-height:1.45; }
.beta-can { list-style:none; margin:0 0 14px; padding:0; display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.beta-can li { padding:10px 12px; border-radius:14px; background:var(--fill); display:flex; flex-direction:column; gap:2px; }
.beta-can b { font-size:14px; font-weight:600; }
.beta-can b::before { content:"✓ "; color:var(--accent); }
.beta-can span { color:var(--muted); font-size:12px; line-height:1.3; }
.beta-label { color:var(--muted); font-size:12px; margin:0 0 6px; }
.beta-examples { display:flex; flex-direction:column; gap:6px; margin:0 0 14px; }
.beta-ex { min-height:40px; display:flex; align-items:center; justify-content:space-between; gap:10px; text-align:left; padding:9px 12px; border:0; border-radius:12px; background:var(--accent-fill); color:var(--accent); font:inherit; font-size:14px; cursor:pointer; transition:background .15s; }
.beta-ex svg { flex:none; opacity:.6; }
.beta-ex:hover { background:rgba(35,93,103,.18); }
.beta-ex:hover svg { opacity:1; }
.beta-ex.done { background:rgba(35,93,103,.24); }
.beta-soon { position:relative; margin:0 0 12px; padding:14px 16px 14px 44px; border-radius:14px; border-left:4px solid #e0742b; background:rgba(224,137,43,.10); color:var(--ink); font-size:15px; line-height:1.45; }
.beta-soon::before { content:"\201C"; position:absolute; left:12px; top:2px; font:700 40px/1 Georgia, serif; color:#e0742b; }
.beta-soon b { display:block; margin-bottom:3px; font-size:16px; font-weight:700; color:#9a4a12; }
.beta-phone { padding:10px 12px; border-radius:14px; background:rgba(224,137,43,.12); color:#8a4f12; font-size:13px; line-height:1.4; margin:0 0 10px; }
.beta-phone::before { content:"📱 "; }
.beta-top { display:flex; align-items:center; justify-content:space-between; }
/* Галерея «Как пользоваться» (help-ui.js): one short looping recording at a time, real interface. Opened from the «?» window. */
.help-card { width:min(560px, 100%); }
.help-card h2 { margin:0; font-size:20px; }
.help-stage { position:relative; display:flex; align-items:center; justify-content:center; margin:12px 0 10px; }
.help-media { width:100%; height:min(46vh, 380px); display:flex; align-items:center; justify-content:center; border-radius:14px; overflow:hidden; background:var(--fill); box-shadow:0 0 0 var(--hair) var(--sep); }
.help-media img { display:block; max-width:100%; max-height:100%; width:auto; height:auto; object-fit:contain; }
.help-nav { position:absolute; top:50%; transform:translateY(-50%); width:44px; height:44px; display:grid; place-items:center; border:0; border-radius:50%; background:rgba(255,255,255,.92); color:var(--ink); box-shadow:0 2px 10px rgba(0,0,0,.18); cursor:pointer; }
.help-nav.prev { left:8px; } .help-nav.next { right:8px; }
.help-nav:hover { background:#fff; } .help-nav:active { transform:translateY(-50%) scale(.94); }
.help-meta { display:flex; flex-direction:column; gap:4px; min-height:78px; font-size:14px; line-height:1.4; color:var(--ink-2); }
.help-meta b { color:var(--ink); font-size:16px; font-weight:600; }
.help-dots { display:flex; align-items:center; justify-content:center; gap:2px; margin:6px 0 12px; position:relative; }
.help-dot { width:24px; height:24px; padding:0; border:0; background:transparent; cursor:pointer; position:relative; }
.help-dot::before { content:""; position:absolute; left:50%; top:50%; width:8px; height:8px; margin:-4px 0 0 -4px; border-radius:50%; background:var(--sep); transition:background .15s, transform .15s; }
.help-dot[aria-current="true"]::before { background:var(--accent); transform:scale(1.35); }
.help-count { position:absolute; right:0; color:var(--muted); font-size:12px; }
.beta-guide { width:100%; min-height:44px; display:flex; align-items:center; justify-content:center; gap:8px; margin:0 0 8px; border:0; border-radius:14px; background:var(--accent-fill); color:var(--accent); font:inherit; font-size:14px; font-weight:600; cursor:pointer; }
.beta-guide:hover { filter:brightness(.97); }
@media (max-width: 560px) { .help-media { height:min(40vh, 300px); } .help-nav { width:40px; height:40px; } }

.beta-x { width:36px; height:36px; border:0; border-radius:50%; background:var(--fill); color:var(--ink-2); font-size:14px; cursor:pointer; }
.beta-ask { width:100%; min-height:44px; display:flex; align-items:center; justify-content:center; gap:8px; margin:0 0 8px; border:0; border-radius:14px; background:transparent; color:var(--accent); font:inherit; font-size:14px; font-weight:600; cursor:pointer; box-shadow:inset 0 0 0 1px rgba(35,93,103,.28); }
.beta-ask:hover, .beta-ask.open { background:var(--accent-fill); }
.beta-form { display:flex; flex-direction:column; gap:8px; margin:0 0 8px; }
.beta-form[hidden] { display:none; }
.beta-form input, .beta-form textarea { width:100%; border:0; border-radius:12px; background:var(--fill); color:var(--ink); font:inherit; font-size:16px; padding:11px 12px; outline:none; resize:vertical; }
.beta-form input:focus, .beta-form textarea:focus { box-shadow:0 0 0 2px rgba(35,93,103,.35); }
.beta-form-row { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.beta-status { color:#a33a2a; font-size:12px; line-height:1.3; }
.beta-send { flex:none; min-height:40px; padding:0 18px; border:0; border-radius:12px; background:var(--accent); color:#fff; font:inherit; font-size:14px; font-weight:600; cursor:pointer; }
.beta-send:disabled { opacity:.6; }
.beta-ok { width:100%; min-height:48px; margin-top:4px; border:0; border-radius:14px; background:var(--accent); color:#fff; font:inherit; font-size:16px; font-weight:600; cursor:pointer; }
.beta-ok:active { filter:brightness(.92); }
.beta-toast { position:fixed; left:50%; bottom:calc(env(safe-area-inset-bottom) + 28px); transform:translateX(-50%); padding:10px 16px; border-radius:999px; background:rgba(28,28,26,.92); color:#fff; font-size:14px; box-shadow:0 8px 24px rgba(0,0,0,.2); white-space:nowrap; pointer-events:none; }
.beta-toast.show { animation:beta-toast .22s ease-out; }
@keyframes beta-toast { from { opacity:0; transform:translate(-50%, 8px); } }
.beta-help { position:absolute; z-index:20; top:calc(env(safe-area-inset-top) + 64px); right:12px; width:44px; height:44px; display:flex; align-items:center; justify-content:center; padding:0; border:0; border-radius:50%; background:var(--surface); backdrop-filter:blur(20px); -webkit-backdrop-filter:blur(20px); box-shadow:0 0 0 var(--hair) var(--sep),0 3px 12px rgba(30,24,16,.07); color:var(--accent); cursor:pointer; }
.beta-help::after { content:""; position:absolute; top:7px; right:7px; width:7px; height:7px; border-radius:50%; background:#e0892b; box-shadow:0 0 0 2px var(--card); }
.beta-help:hover { background:#fff; }
.beta-help:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
body[data-debug="true"] .beta-help { top:calc(env(safe-area-inset-top) + 118px); }
@media (max-width:600px) { .beta-help { top:calc(env(safe-area-inset-top) + 124px); } body[data-debug="true"] .beta-help { top:calc(env(safe-area-inset-top) + 178px); } }
@keyframes beta-fade { from { opacity:0; } }
@keyframes beta-rise { from { opacity:0; transform:translateY(12px) scale(.98); } }
@media (max-width: 420px) { .beta-card { padding:18px 16px 14px; } .beta-card h2 { font-size:18px; } .beta-can { gap:6px; } .beta-can li { padding:8px 10px; } }
@media (prefers-reduced-motion: reduce) { .beta-notice, .beta-card, .beta-badge::before { animation:none; } }
.start-wait { position:absolute; left:50%; top:50%; transform:translate(-50%, -50%); display:flex; align-items:center; gap:10px; color:var(--muted); font-size:15px; }
.start-wait[hidden] { display:none; }
.start-wait .spin { width:18px; height:18px; border:2px solid var(--sep); border-top-color:var(--accent); border-radius:50%; animation:start-spin .9s linear infinite; }
@keyframes start-spin { to { transform:rotate(360deg); } }
.chat-head { display:flex; align-items:center; gap:12px; padding:12px 10px 12px 14px; border-bottom:var(--hair) solid var(--sep); flex:none; }
.chat-heading { flex:1; min-width:0; }
.chat-head h2 { margin:0; font-size:16px; font-weight:600; }
.chat-sub { display:block; color:var(--muted); font-size:12px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chat-mode { flex:none; height:36px; padding:0 12px; border-radius:18px; background:var(--accent-fill); color:var(--accent); font-size:13px; font-weight:500; white-space:nowrap; }
.chat-panel[data-mode="new"] .chat-mode { background:var(--fill); color:var(--ink-2); }
.chat-panel[data-mode="new"] .chat-options .btn.chat-primary { background:var(--accent); color:#fff; }
.chat-close { flex:none; width:44px; height:44px; border-radius:22px; background:transparent; color:var(--muted); font-size:16px; }
.chat-log { flex:1 1 auto; min-height:120px; overflow-y:auto; overscroll-behavior:contain; padding:14px; display:flex; flex-direction:column; gap:8px; }
.chat-empty { margin:auto 0; color:var(--ink-2); font-size:15px; line-height:1.5; text-align:center; }
.chat-start { margin:auto 0; display:flex; flex-direction:column; gap:8px; padding:8px 4px; }
.chat-start strong { font-size:19px; line-height:1.25; font-weight:700; color:var(--ink); }
.chat-start p { margin:0 0 6px; color:var(--ink-2); font-size:15px; line-height:1.5; }
.chat-start-label { color:var(--accent); font-size:12px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; }
.chat-start-ex { display:flex; flex-direction:column; gap:6px; text-align:left; padding:12px 14px 10px 16px; border:0; border-left:4px solid var(--accent); border-radius:14px; background:var(--accent-fill); color:var(--ink); font:inherit; cursor:pointer; transition:background .15s; }
.chat-start-ex:hover { background:rgba(35,93,103,.17); }
.chat-start-quote { font-size:15px; line-height:1.45; }
.chat-start-ex small { color:var(--accent); font-size:12px; }
.chat-msg { max-width:86%; padding:9px 12px; border-radius:16px; font-size:14px; line-height:1.45; white-space:pre-wrap; overflow-wrap:anywhere; }
.chat-me { align-self:flex-end; color:#fff; background:linear-gradient(135deg, #2b6f78, #235d67); border-bottom-right-radius:6px; }
.chat-bot { align-self:flex-start; display:flex; flex-direction:column; gap:3px; background:var(--fill); border-bottom-left-radius:6px; }
.chat-bot strong { font-weight:600; }
.chat-who { color:var(--muted); font-size:11px; }
.chat-foot { color:var(--ink-2); font-size:12px; }
.chat-usage { display:block; margin-top:2px; }
/* A running job: stage · clock, four segments with names under them; the current segment shimmers. */
.chat-progress { width:min(300px, 86%); gap:0; padding:10px 14px 12px; }
.chat-progress-head { display:flex; align-items:baseline; gap:12px; margin:4px 0 10px; }
.chat-progress-head strong { flex:1; min-width:0; font-size:14.5px; font-weight:600; color:var(--ink); }
.chat-progress-time { flex:none; font-size:13px; font-weight:500; color:var(--ink-2); font-variant-numeric:tabular-nums; }
.chat-steps { display:grid; grid-template-columns:repeat(4, 1fr); gap:4px; }
.chat-steps i { height:4px; border-radius:2px; background:rgba(120,108,90,.18); overflow:hidden; position:relative; transition:background-color .3s; }
.chat-steps i.done { background:var(--accent); }
.chat-steps i.now { background:rgba(35,93,103,.28); }
.chat-steps i.now::after { content:""; position:absolute; inset:0; width:45%; border-radius:2px; background:var(--accent); animation:chat-shimmer 1.3s cubic-bezier(.45,0,.55,1) infinite; }
@keyframes chat-shimmer { from { transform:translateX(-100%); } to { transform:translateX(230%); } }
.chat-step-names { display:grid; grid-template-columns:repeat(4, 1fr); gap:4px; margin-top:6px; }
.chat-step-names span { font-size:11px; line-height:1.2; color:var(--muted); opacity:.75; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chat-step-names span.done { opacity:1; }
.chat-step-names span.now { color:var(--accent); font-weight:600; opacity:1; }
.chat-progress .chat-cancel { margin-top:10px; }
@media (prefers-reduced-motion: reduce) { .chat-steps i.now::after { animation:none; width:100%; opacity:.6; } }
.chat-old { margin:0 12px 8px; padding:10px 12px; border-radius:14px; background:#f6e7d2; font-size:13px; line-height:1.45; }
.chat-old[hidden] { display:none; }
.chat-old p { margin:0 0 8px; }
.chat-go { min-height:44px; padding:0 14px; border-radius:14px; background:var(--accent); color:#fff; }
.chat-go[hidden], .chat-revert[hidden] { display:none; }
.chat-old-actions { display:flex; flex-wrap:wrap; gap:8px; }
.chat-revert { min-height:44px; padding:0 14px; border-radius:14px; background:var(--accent); color:#fff; }
.chat-old-actions .chat-revert:not([hidden]) + .chat-go { background:transparent; color:var(--accent); box-shadow:inset 0 0 0 1px var(--accent); }
.chat-revert:disabled { opacity:.5; }
.chat-name { display:flex; flex-direction:column; gap:4px; padding:0 12px 10px; }
.chat-name[hidden] { display:none; }
.chat-name span { color:var(--accent); font-size:13px; font-weight:600; }
.chat-name input { box-sizing:border-box; min-height:44px; padding:0 14px; border:1.5px solid rgba(35,93,103,.3); border-radius:22px; background:#fff; transition:border-color .15s, box-shadow .15s; color:inherit; font:inherit; font-size:16px; }
.chat-name input:hover { border-color:rgba(35,93,103,.55); }
.chat-name input:focus, .chat-name input:focus-visible { outline:none; border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-fill); }
.chat-name input:disabled { opacity:.6; }
.chat-options { display:flex; flex-wrap:wrap; gap:6px; padding:0 12px; }
.chat-options:not(:empty) { padding-bottom:8px; }
.chat-options .btn { min-height:44px; padding:0 14px; border-radius:22px; background:var(--accent-fill); color:var(--accent); font-size:13px; }
.chat-focus { display:flex; flex-wrap:wrap; align-items:center; gap:6px; padding:0 12px 8px; }
.chat-focus[hidden] { display:none; }
.chat-focus-head { width:100%; color:var(--muted); font-size:11px; }
.chat-chip { display:inline-flex; align-items:center; max-width:100%; min-height:32px; padding-left:12px; border-radius:16px; background:var(--accent-fill); color:var(--accent); font-size:13px; }
.chat-chip-text { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.chat-chip-x { position:relative; flex:none; width:32px; height:32px; border:0; background:none; color:inherit; font-size:12px; cursor:pointer; }
.chat-chip-x::after { content:""; position:absolute; inset:-6px; }
.chat-chip-more { padding-right:12px; }
.chat-me-focus { display:block; margin-top:4px; font-size:12px; opacity:.8; }
.chat-notice { margin:0 12px 8px; font-size:12px; line-height:1.45; color:#9a3b1f; }
.chat-notice[hidden] { display:none; }
.chat-notice .btn { min-height:36px; padding:0 10px; font-size:12px; }
.chat-form { display:flex; align-items:flex-end; gap:6px; padding:8px 10px 4px 12px; border-top:var(--hair) solid var(--sep); flex:none; }
.chat-form textarea { flex:1; box-sizing:border-box; min-height:44px; max-height:120px; resize:none; border:1.5px solid rgba(35,93,103,.45); border-radius:22px; padding:10px 14px; background:#fff; transition:border-color .15s, box-shadow .15s; color:inherit; font:inherit; font-size:16px; line-height:1.35; }
.chat-form textarea:hover { border-color:rgba(35,93,103,.7); }
.chat-form textarea:focus, .chat-form textarea:focus-visible { outline:none; border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-fill); }
.chat-form textarea:disabled { opacity:.6; }
.chat-send { flex:none; width:44px; height:44px; border-radius:22px; color:#fff; font-size:18px; background:linear-gradient(135deg, #2f7f86, #235d67 50%, #3d4f86); }
.chat-send:disabled, .chat-send.idle { background:var(--fill-press); }
.chat-send[hidden], .chat-mic[hidden] { display:none; }
/* voice: the mic stands where «send» is while the field is empty; tap -- record, tap -- stop */
.chat-mic { position:relative; flex:none; width:44px; height:44px; padding:0; display:grid; place-items:center; border-radius:22px; color:#fff;
  background:linear-gradient(135deg, #2f7f86, #235d67 50%, #3d4f86); box-shadow:0 2px 8px rgba(35,93,103,.28); transition:background-color .2s, transform .1s; }
.chat-mic > * { grid-area:1/1; }
.chat-mic:active { transform:scale(.94); }
.chat-mic:disabled { background:var(--fill-press); box-shadow:none; color:var(--muted); }
.chat-mic .chat-mic-stop, .chat-mic .chat-mic-spin { display:none; }
.chat-mic[data-state="recording"] { background:#e0483b; box-shadow:0 2px 10px rgba(224,72,59,.4); }
.chat-mic[data-state="recording"]::before { content:''; position:absolute; inset:-5px; border-radius:50%; border:2px solid rgba(224,72,59,.45); animation:chat-mic-ring 1.3s ease-out infinite; }
.chat-mic[data-state="sending"] .chat-mic-on { display:none; }
.chat-mic { touch-action:none; user-select:none; -webkit-user-select:none; -webkit-touch-callout:none; transition:transform .12s, background-color .15s, box-shadow .15s; }
.chat-mic[data-state="recording"] { transform:scale(1.12); }
.chat-mic[data-state="sending"] { background:var(--accent-fill); box-shadow:none; }
.chat-mic[data-state="sending"] .chat-mic-spin { display:block; width:18px; height:18px; border-radius:50%; border:2px solid rgba(35,93,103,.25); border-top-color:var(--accent); animation:chat-mic-spin .8s linear infinite; }
/* the common .btn:hover would paint them grey: keep the colour, just lift a little */
@media (hover: hover) {
  .chat-send:not(:disabled):not(.idle):hover, .chat-mic:not(:disabled):not([data-state]):hover, .chat-mic[data-state="idle"]:not(:disabled):hover {
    background:linear-gradient(135deg, #3a8d94, #2a6c77 50%, #4a5d98); box-shadow:0 4px 12px rgba(35,93,103,.36); }
  .chat-mic[data-state="recording"]:hover { background:#d23c30; }
  .chat-mic[data-state="sending"]:hover { background:var(--accent-fill); }
  .chat-mic:disabled:hover, .chat-send:disabled:hover, .chat-send.idle:hover { background:var(--fill-press); }
}
@keyframes chat-mic-ring { from { transform:scale(.9); opacity:1; } to { transform:scale(1.35); opacity:0; } }
@keyframes chat-mic-spin { to { transform:rotate(360deg); } }
.chat-panel[data-voice="recording"] .chat-form textarea { opacity:1; }
.chat-panel[data-voice="recording"] .chat-form textarea::placeholder { color:#c8372b; font-variant-numeric:tabular-nums; }
.chat-panel[data-voice="sending"] .chat-form textarea { opacity:1; }
@media (prefers-reduced-motion: reduce) { .chat-mic[data-state="recording"]::before { animation:none; } .chat-mic[data-state="sending"] .chat-mic-spin { animation-duration:2.4s; } }
.chat-price { margin:0; padding:0 16px calc(10px + env(safe-area-inset-bottom)); color:var(--muted); font-size:11px; flex:none; }
.chat-price:empty { padding-bottom:calc(6px + env(safe-area-inset-bottom)); }
@media (max-width:600px) {
 .chat-launch { right:max(12px, env(safe-area-inset-right)); bottom:calc(env(safe-area-inset-bottom) + 12px); height:50px; }
 body[data-chat-ready="true"] .part-dock { bottom:calc(max(var(--gutter), env(safe-area-inset-bottom)) + 64px); }
 body[data-chat-open="true"] .chat-launch { display:none; }
 .chat-panel { inset:auto 0 0 0; width:100%; max-height:none; height:58dvh; border-radius:22px 22px 0 0; animation:rise .18s ease-out; }
 .chat-head { position:relative; padding-top:18px; }
 .chat-head::before { content:''; position:absolute; left:calc(50% - 17px); top:6px; width:34px; height:5px; border-radius:4px; background:var(--sep); }
 body[data-chat-open="true"] #stage { bottom:58dvh; }
 body[data-chat-open="true"] .part-dock { display:none; }
}
@media (max-height:500px) and (min-width:601px) { body[data-chat-ready="true"] .part-dock { bottom:calc(max(8px, env(safe-area-inset-bottom)) + 64px); } }
