:root {
  --bg: #f5f2ed;
  --text: #1a1917;
  --muted: #6b6760;
  --line: rgba(26, 25, 23, 0.12);
  --red: #c44;
  --accent: #3a6bd5;
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font:
    300 15px/1.6 system-ui,
    sans-serif;
  background: var(--bg);
  color: var(--text);
}
a {
  color: inherit;
}
input,
textarea,
select,
button {
  font: inherit;
}
button {
  cursor: pointer;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  gap: 12px;
}
.header h1 {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
/* Только «плоские» текст-кнопки шапки. .btn-компоненты (Сохранить/Опубликовать/
   Полная регенерация/…) НЕ трогаем — иначе этот color на :hover перебивал бы по
   специфичности их светлый текст, оставляя тёмный текст на тёмном фоне .btn:hover. */
.header-actions button:not(.btn),
.header-actions a:not(.btn) {
  font-size: 11px;
  color: var(--muted);
  background: none;
  border: none;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
}
.header-actions button:not(.btn):hover,
.header-actions a:not(.btn):hover {
  color: var(--text);
}
.user-badge {
  font-size: 11px;
  color: var(--muted);
  margin-right: 8px;
}

/* Login */
.login {
  max-width: 360px;
  margin: 120px auto 0;
}
.login h1 {
  font-size: 20px;
  font-weight: 300;
  margin-bottom: 32px;
}
.field {
  margin-bottom: 18px;
}
.field label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 0;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  font-size: 14px;
  color: var(--text);
  outline: none;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-bottom-color: var(--text);
}
.field textarea {
  min-height: 60px;
  resize: vertical;
  line-height: 1.6;
}
.field--inline {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.hint {
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.5;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 24px;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid var(--text);
  background: transparent;
  color: var(--text);
}
.btn:hover {
  background: var(--text);
  color: var(--bg);
}
.btn--primary {
  background: var(--text);
  color: var(--bg);
}
.btn--primary:hover {
  opacity: 0.85;
}
.btn--sm {
  padding: 6px 14px;
  font-size: 10px;
}
.btn--ghost {
  border-color: var(--line);
  color: var(--muted);
}
.btn--ghost:hover {
  border-color: var(--text);
  background: transparent;
  color: var(--text);
}
.btn--danger {
  border-color: var(--red);
  color: var(--red);
}
.btn--danger:hover {
  background: var(--red);
  color: #fff;
}
.actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* Dashboard */
.project-list {
  list-style: none;
}
.project-item {
  display: grid;
  grid-template-columns: auto 56px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 10px;
  border: 1px solid var(--line);
  margin-bottom: 8px;
  background: #fff;
  transition:
    box-shadow 0.15s,
    opacity 0.15s;
}
.project-item__thumb {
  width: 56px;
  height: 40px;
  object-fit: cover;
  background: #e8e3dc;
  display: block;
}
.project-item__thumb--empty {
  border: 1px dashed var(--line);
}
.project-item__left strong {
  font-size: 14px;
  font-weight: 400;
  display: block;
}
.project-item__left span {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
  display: block;
}
.project-item__toggles {
  display: flex;
  gap: 16px;
  margin-top: 6px;
}
.project-item__right {
  display: flex;
  gap: 16px;
  align-items: center;
}
.project-item__right a,
.project-item__right button {
  font-size: 10px;
  color: var(--muted);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: none;
  border: none;
}
.project-item__right a:hover,
.project-item__right button:hover {
  color: var(--text);
}

/* Editor layout: form column + live preview column */
/* ── Полноэкранный редактор: слева инструменты, справа широкий предпросмотр ── */
body.is-editor {
  overflow: hidden;
}
body.is-editor .app {
  max-width: none;
  margin: 0;
  padding: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}
body.is-editor .header {
  margin: 0;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
body.is-editor #msgZone {
  flex: 0 0 auto;
}
body.is-editor #msgZone:not(:empty) {
  padding: 8px 20px 0;
}

.editor-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 440px minmax(0, 1fr);
}
.editor-form {
  min-width: 0;
  height: 100%;
  overflow-y: auto;
  padding: 20px;
  border-right: 1px solid var(--line);
}
.editor-preview {
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #e3ddd4; /* «стол» вокруг устройства */
}
.editor-preview__bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0;
  padding: 9px 16px;
  background: var(--cream);
  border-bottom: 1px solid var(--line);
}
.editor-preview__bar h3 {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}
.editor-preview__bar .btn--ghost {
  margin-left: auto;
}

/* переключатель устройства desktop / mobile */
.device-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.device-switch__btn {
  border: 0;
  background: transparent;
  padding: 5px 14px;
  font: inherit;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
  cursor: pointer;
}
.device-switch__btn + .device-switch__btn {
  border-left: 1px solid var(--line);
}
.device-switch__btn.is-active {
  background: var(--black);
  color: var(--cream);
}

/* сцена предпросмотра + масштабируемое «устройство» (размеры задаёт JS) */
.preview-stage {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
.preview-scaler {
  position: relative;
  flex: 0 0 auto;
}
.preview-frame {
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 10px 40px rgba(26, 25, 23, 0.14);
  display: block;
}

/* Section panels */
.panel {
  border: 1px solid var(--line);
  margin-bottom: 18px;
  background: rgba(255, 255, 255, 0.4);
}
.panel__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
}
.panel__head h3 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.panel__head .chev {
  font-size: 10px;
  color: var(--muted);
  transition: transform 0.15s;
}
.panel.collapsed .chev {
  transform: rotate(-90deg);
}
.panel__body {
  padding: 0 16px 16px;
}
.panel.collapsed .panel__body {
  display: none;
}

.sub-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 18px 0 8px;
}

/* Key-value facts editor */
.kv-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}
.kv-row input {
  padding: 6px 0;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  font-size: 13px;
  outline: none;
}
.kv-row input:focus {
  border-bottom-color: var(--text);
}
.kv-del {
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
}
.kv-del:hover {
  color: var(--red);
}

/* Block list */
.blocks-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 24px 0 12px;
}
.blocks-head h2 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.block-card {
  border: 1px solid var(--line);
  margin-bottom: 12px;
  background: #fff;
  transition:
    box-shadow 0.15s,
    opacity 0.15s;
}
.block-card__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(26, 25, 23, 0.02);
}
.block-card__type {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  flex: 1;
}
.block-card__type .ico {
  margin-right: 6px;
  opacity: 0.5;
}
.block-card__body {
  padding: 14px 12px;
}
.block-card__del {
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
}
.block-card__del:hover {
  color: var(--red);
}
.block-card__move,
.block-card__collapse {
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.block-card__move:hover:not(:disabled),
.block-card__collapse:hover {
  color: var(--text);
}
.block-card__move:disabled {
  opacity: 0.25;
  cursor: default;
}
.block-card.is-collapsed .block-card__body {
  display: none;
}
.block-card.is-collapsed {
  opacity: 0.92;
}

/* Drag handle */
.drag-handle {
  cursor: grab;
  width: 18px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 2px;
  opacity: 0.3;
  transition: opacity 0.15s;
}
.drag-handle:active {
  cursor: grabbing;
}
.drag-handle:hover {
  opacity: 0.75;
}
.drag-handle i {
  display: block;
  width: 11px;
  height: 1px;
  background: var(--text);
}

/* Drag states (HTML5 DnD) */
.dragging {
  opacity: 0.35 !important;
}
.drag-over-above {
  box-shadow: 0 -2px 0 0 var(--accent) !important;
}
.drag-over-below {
  box-shadow: 0 2px 0 0 var(--accent) !important;
}

/* Add-block menu */
.add-block {
  position: relative;
}
.add-block__menu {
  position: absolute;
  z-index: 20;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  min-width: 180px;
}
.add-block__menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border: none;
  background: none;
  font-size: 12px;
}
.add-block__menu button:hover {
  background: rgba(26, 25, 23, 0.04);
}
.add-block__menu .ico {
  margin-right: 8px;
  opacity: 0.5;
}

/* Drop zone */
.dropzone {
  border: 1px dashed var(--line);
  padding: 18px;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  transition: 0.15s;
  border-radius: 2px;
}
.dropzone:hover {
  border-color: var(--accent);
}
.dropzone.dragover {
  border-color: var(--accent);
  background: rgba(58, 107, 213, 0.05);
  color: var(--accent);
}
.dropzone strong {
  color: var(--text);
  font-weight: 500;
}

/* Image item (gallery / floorplan) */
.img-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 12px;
}
/* Слот блока «до/после»: тег роли кадра над самим .img-item */
.ba-slot__tag {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.img-item {
  display: grid;
  grid-template-columns: auto 88px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 8px;
  border: 1px solid var(--line);
  background: #fafaf8;
  transition:
    box-shadow 0.15s,
    opacity 0.15s;
}
.img-item__thumb {
  width: 88px;
  height: 64px;
  object-fit: cover;
  background: #e8e3dc;
  display: block;
}
.img-item__fields {
  min-width: 0;
}
.img-item__fields input {
  width: 100%;
  padding: 5px 0;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  font-size: 12px;
  outline: none;
  margin-bottom: 4px;
}
.img-item__fields input:focus {
  border-bottom-color: var(--text);
}
.width-switch {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
}
.width-switch button {
  padding: 3px 8px;
  font-size: 9px;
  letter-spacing: 0.04em;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  text-transform: uppercase;
}
.width-switch button.active {
  border-color: var(--text);
  color: var(--text);
  background: rgba(26, 25, 23, 0.03);
}

/* Числовой ввод размера (проценты) рядом с пресетами */
.width-num-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.width-num-row--inline {
  margin-left: auto;
}
.width-num {
  width: 62px;
  padding: 3px 6px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
}
.width-num:focus {
  border-color: var(--accent);
  outline: none;
}
.width-num__unit {
  font-size: 10px;
  color: var(--muted);
}

/* Выделение блока/кадра (двусторонняя связь с превью) */
.block-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.block-card__head {
  cursor: pointer;
}
.img-item.is-selected {
  outline: 1px solid var(--accent);
  outline-offset: 1px;
}
.img-item__del {
  width: 22px;
  height: 22px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  align-self: center;
}
.img-item__del:hover {
  color: var(--red);
}

/* Lighting variants (доп. кадры того же ракурса внутри одного фото) */
.variants {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}
.variants__head {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.variants__hint {
  margin-bottom: 10px;
}
.variants__hint b {
  color: var(--text);
  font-weight: 500;
}
.variants__list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}
.variant-item {
  display: grid;
  grid-template-columns: auto 56px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 5px;
  border: 1px solid var(--line);
  background: #fff;
  transition:
    box-shadow 0.15s,
    opacity 0.15s;
}
.variant-item__thumb {
  width: 56px;
  height: 40px;
  object-fit: cover;
  background: #e8e3dc;
  display: block;
}
.variant-item input {
  width: 100%;
  padding: 4px 0;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  font-size: 12px;
  outline: none;
}
.variant-item input:focus {
  border-bottom-color: var(--text);
}
.variant-item__del {
  width: 22px;
  height: 22px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
}
.variant-item__del:hover {
  color: var(--red);
}
.dropzone--sm {
  padding: 9px;
  font-size: 10px;
}

/* Panorama list */
.pano-list {
  list-style: none;
  margin-top: 12px;
}
.pano-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  margin-bottom: 6px;
  background: #fafaf8;
  font-size: 12px;
  transition:
    box-shadow 0.15s,
    opacity 0.15s;
}
.pano-item__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pano-item__del {
  width: 22px;
  height: 22px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
}
.pano-item__del:hover {
  color: var(--red);
}

/* Rich text toolbar */
.rt-toolbar {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.rt-toolbar button {
  padding: 5px 10px;
  font-size: 11px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  min-width: 30px;
}
.rt-toolbar button:hover {
  border-color: var(--text);
}
.rt-editor {
  min-height: 90px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.6;
  outline: none;
  background: #fff;
}
.rt-editor:focus {
  border-color: var(--text);
}
.rt-editor h3 {
  font-size: 18px;
  font-weight: 500;
  margin: 8px 0;
}
.rt-editor ul {
  padding-left: 20px;
  margin: 6px 0;
}
.rt-editor p {
  margin: 6px 0;
}

/* radio group */
.radio-group {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}
.radio-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  cursor: pointer;
}

.upload-progress {
  font-size: 11px;
  color: var(--accent);
  margin-top: 8px;
}
.msg {
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 12px;
}
.msg--ok {
  background: #e8f0e4;
  color: #2d5a1e;
}
.msg--err {
  background: #fce8e8;
  color: #8b1a1a;
}
.msg--warn {
  background: #fdf3e0;
  color: #7a521a;
}

.empty-blocks {
  padding: 28px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  border: 1px dashed var(--line);
}

/* Home / registry panel */
.registry-list {
  list-style: none;
}
.registry-item {
  display: grid;
  grid-template-columns: auto 56px 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 12px 10px;
  border: 1px solid var(--line);
  margin-bottom: 8px;
  background: #fff;
  transition:
    box-shadow 0.15s,
    opacity 0.15s;
}
.registry-item__body strong {
  font-size: 14px;
  font-weight: 400;
  display: block;
}
.registry-item__body span {
  font-size: 11px;
  color: var(--muted);
}
.registry-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
}
.registry-legend {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 16px;
  line-height: 1.6;
}
.registry-legend b {
  color: var(--text);
  font-weight: 500;
}

.hidden {
  display: none !important;
}

/* Hotspots (точки перехода) — кнопка/список в блоке панорамы */
.hs-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.hs-warn {
  font-size: 11px;
  color: var(--red);
  margin-top: 8px;
  line-height: 1.5;
}
.hs-rolist {
  list-style: none;
  margin-top: 8px;
}
.hs-rolist li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
}
.hs-rolist .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

/* Hotspot editor modal */
.hs-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(26, 25, 23, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.hs-modal__panel {
  background: var(--bg);
  width: min(960px, 96vw);
  max-height: 94vh;
  overflow: auto;
  border: 1px solid var(--line);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.hs-modal__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 2;
}
.hs-modal__head h3 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.hs-modal__close {
  border: none;
  background: none;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
}
.hs-modal__close:hover {
  color: var(--text);
}
.hs-modal__body {
  padding: 20px;
}
.hs-scenes {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.hs-scene-btn {
  font-size: 11px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  background: #fff;
  letter-spacing: 0.04em;
}
.hs-scene-btn.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.hs-stage {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  aspect-ratio: 1/1;
  background: var(--text);
}
.hs-stage .panorama-viewer {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
}
.hs-tip {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin: 10px 0 0;
}
.hs-list {
  list-style: none;
  margin-top: 16px;
}
.hs-list li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.hs-list .hs-target {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.hs-list select,
.hs-list input {
  padding: 6px 8px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 12px;
}
.hs-list .hs-del {
  width: 26px;
  height: 26px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 16px;
}
.hs-list .hs-del:hover {
  color: var(--red);
}
.hs-empty {
  font-size: 12px;
  color: var(--muted);
  margin-top: 14px;
}

@media (max-width: 860px) {
  body.is-editor {
    overflow: auto;
  }
  body.is-editor .app {
    height: auto;
  }
  .editor-wrap {
    grid-template-columns: 1fr;
  }
  .editor-form {
    height: auto;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .editor-preview {
    height: 78vh;
  }
}

/* ─── Контекстные подсказки: значок «?» + модалка ─── */
.help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  margin-left: 6px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
  transition:
    border-color 0.15s,
    color 0.15s;
  flex: none;
}
.help-btn:hover,
.help-btn:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}
.block-card__type .help-btn {
  margin-left: 8px;
}

.help-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.help-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 25, 23, 0.45);
}
.help-modal__panel {
  position: relative;
  background: var(--bg);
  width: min(440px, 94vw);
  max-height: 90vh;
  overflow: auto;
  border: 1px solid var(--line);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.help-modal__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--bg);
}
.help-modal__head h3 {
  font-size: 15px;
  font-weight: 600;
}
.help-modal__close {
  border: none;
  background: none;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}
.help-modal__close:hover {
  color: var(--text);
}
.help-modal__body {
  padding: 18px 20px;
}
.help-sect {
  margin-bottom: 16px;
}
.help-sect:last-child {
  margin-bottom: 0;
}
.help-sect__label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 5px;
}
.help-sect__text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-line;
}
.help-sect__example {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  background: rgba(26, 25, 23, 0.04);
  border-left: 2px solid var(--accent);
  padding: 8px 12px;
  font-style: italic;
  white-space: pre-line;
}

.hint--warn {
  color: #b00020;
}

/* Home content — фото-слоты (about / contact / contact-bg) */
.home-photo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}
.home-photo__thumb {
  width: 88px;
  height: 64px;
  object-fit: cover;
  background: #e8e3dc;
  display: block;
  flex-shrink: 0;
}
.home-photo__thumb--empty {
  border: 1px dashed var(--line);
}
.home-photo .dropzone--sm {
  flex: 1;
  padding: 10px;
}

/* Home content — карточки команды («О студии») */
.team-item {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.team-item .home-photo {
  flex: 0 0 auto;
  flex-direction: column;
  align-items: stretch;
  width: 120px;
  margin-top: 0;
}
.team-item .home-photo__thumb,
.team-item .home-photo__thumb--empty {
  width: 120px;
  height: 120px;
}
.team-item__fields {
  flex: 1 1 auto;
  min-width: 0;
}
.team-item__actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* Home content — карточки тарифов */
.plan-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.plan-item__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.plan-item__spacer {
  flex: 1 1 auto;
}

/* Home content — пункты услуг */
.service-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 8px;
  border: 1px solid var(--line);
  background: #fafaf8;
  margin-bottom: 8px;
}
.service-item__fields input,
.service-item__fields textarea {
  width: 100%;
  padding: 5px 0;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  font-size: 12px;
  outline: none;
  margin-bottom: 4px;
}
.service-item__fields input:focus,
.service-item__fields textarea:focus {
  border-bottom-color: var(--text);
}

/* Home content — контактные строки */
.contact-detail {
  display: grid;
  grid-template-columns: auto 1fr 1fr 90px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid var(--line);
  background: #fafaf8;
  margin-bottom: 6px;
}
.contact-detail input,
.contact-detail select {
  padding: 5px 4px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 12px;
}

.registry-item__thumb {
  width: 56px;
  height: 40px;
  object-fit: cover;
  background: #e8e3dc;
  display: block;
}
.registry-item__thumb--empty {
  border: 1px dashed var(--line);
}

/* Home / registry — вкладки */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.tab {
  border: none;
  background: none;
  padding: 10px 16px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab.is-active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* Обложка проекта на главной */
.cover-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}
.cover-picker__thumb {
  width: 88px;
  height: 64px;
  object-fit: cover;
  background: #e8e3dc;
  display: block;
  flex-shrink: 0;
}
.cover-picker__thumb--empty {
  border: 1px dashed var(--line);
}
.cover-picker__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  max-height: 60vh;
  overflow-y: auto;
}
.cover-picker__opt {
  border: 2px solid transparent;
  padding: 0;
  background: none;
  cursor: pointer;
}
.cover-picker__opt:hover {
  border-color: var(--accent);
}
.cover-picker__opt img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  display: block;
}

/* ── История правок: индикатор состояния + кнопки undo/redo ── */
.hist-status {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
  align-self: center;
}
.hist-status.is-clean {
  color: #3a8a5a;
}
.hist-status.is-dirty {
  color: #b06a1a;
  background: rgba(176, 106, 26, 0.1);
}
.hist-status.is-unpub {
  color: #3a6bd5;
  background: rgba(58, 107, 213, 0.1);
}
.hist-btn {
  font-size: 16px;
  line-height: 1;
  padding: 6px 10px;
}
.hist-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* Баннер восстановления черновика из localStorage */
.hist-restore {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 14px;
  padding: 12px 16px;
  background: rgba(176, 106, 26, 0.1);
  border: 1px solid rgba(176, 106, 26, 0.35);
  border-radius: 8px;
  font-size: 14px;
}
.hist-restore__actions {
  display: flex;
  gap: 8px;
}

/* Кнопка дублирования блока — рядом с move/del */
.block-card__dup {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 15px;
  color: var(--muted);
  padding: 4px 6px;
}
.block-card__dup:hover {
  color: var(--accent);
}

/* ── Статус-бейджи на дашборде ── */
.pbadge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  vertical-align: middle;
  white-space: nowrap;
}
.pbadge--draft {
  color: #6b6760;
  background: rgba(107, 103, 96, 0.12);
}
.pbadge--changed {
  color: #3a6bd5;
  background: rgba(58, 107, 213, 0.12);
}
.pbadge--live {
  color: #3a8a5a;
  background: rgba(58, 138, 90, 0.12);
}
.pbadge--locked {
  color: #9a6a1a;
  background: rgba(154, 106, 26, 0.12);
}

/* ── Панель «Доступ» (пароль на проект) ── */
.protect-state {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}
.protect-state--on {
  color: #9a6a1a;
}
.protect-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

/* ── SEO-панель: SERP-превью ── */
.serp {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
}
.serp__url {
  font-size: 12px;
  color: #4d5156;
  word-break: break-all;
}
.serp__title {
  color: #1a0dab;
  font-size: 18px;
  line-height: 1.3;
  margin: 2px 0;
}
.serp__desc {
  font-size: 13px;
  color: #4d5156;
  line-height: 1.5;
}

/* ── SEO-панель: карточка шаринга (OG) ── */
.ogcard {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  max-width: 420px;
}
.ogcard__img {
  display: block;
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--line);
}
.ogcard__img--empty {
  display: block;
  width: 100%;
  height: 200px;
  background: repeating-linear-gradient(
    45deg,
    #eee,
    #eee 10px,
    #e4e4e4 10px,
    #e4e4e4 20px
  );
}
.ogcard__body {
  padding: 10px 14px;
}
.ogcard__title {
  font-weight: 500;
  font-size: 15px;
  line-height: 1.3;
}
.ogcard__desc {
  font-size: 13px;
  color: var(--muted);
  margin: 3px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ogcard__url {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
}
.og-picker {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

/* ── SEO-панель: чеклист ── */
.seo-check {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.seo-check li {
  font-size: 13px;
}
.seo-check li.ok {
  color: #3a8a5a;
}
.seo-check li.warn {
  color: #b06a1a;
}

/* ── Фокусная точка обложки ── */
.focus-edit {
  margin-top: 12px;
}
.focus-box {
  position: relative;
  width: 100%;
  max-width: 280px;
  aspect-ratio: 3 / 2;
  border-radius: 8px;
  overflow: hidden;
  cursor: crosshair;
  touch-action: none;
  border: 1px solid var(--line);
}
.focus-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}
.focus-dot {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: rgba(58, 107, 213, 0.9);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.3);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* ── Медиатека ── */
.blocks-head__actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.help-modal__panel--wide {
  max-width: 900px;
  width: 92vw;
}
.media-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.media-count {
  font-size: 13px;
  color: var(--muted);
}
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.media-item {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.media-item--unused {
  border-color: rgba(176, 106, 26, 0.5);
}
.media-item__thumb {
  width: 100%;
  height: 110px;
  object-fit: cover;
  display: block;
  background: var(--line);
}
.media-item__thumb--broken {
  opacity: 0.25;
}
.media-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  color: #fff;
}
.media-badge--used {
  background: rgba(58, 138, 90, 0.9);
}
.media-badge--unused {
  background: rgba(176, 106, 26, 0.95);
}
.media-item__name {
  font-size: 11px;
  color: var(--muted);
  padding: 6px 8px 4px;
  word-break: break-all;
  flex: 1;
}
.media-item__del {
  border: none;
  border-top: 1px solid var(--line);
  background: none;
  padding: 6px;
  cursor: pointer;
  font-size: 12px;
  color: var(--red);
}
.media-item__del:disabled {
  color: var(--muted);
  opacity: 0.5;
  cursor: default;
}
.media-item__del:not(:disabled):hover {
  background: rgba(204, 68, 68, 0.08);
}

/* ── Заявки ── */
.lead-badge {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
}
.leads {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 720px;
}
.lead {
  border: 1px solid var(--line);
  border-left: 3px solid var(--muted);
  border-radius: 8px;
  padding: 12px 16px;
  background: #fff;
}
.lead--new {
  border-left-color: var(--red);
}
.lead--in_progress {
  border-left-color: #3a6bd5;
}
.lead--closed {
  border-left-color: #3a8a5a;
  opacity: 0.7;
}
.lead__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.lead__date {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.lead__contact {
  font-size: 14px;
  margin-top: 2px;
}
.lead__msg {
  font-size: 14px;
  color: var(--muted);
  margin-top: 6px;
  white-space: pre-wrap;
}
.lead__foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}
.lead__status {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
}
.lead__tg {
  font-size: 12px;
  color: #3a8a5a;
}
