.photo-editor {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 10px;
  align-items: start;
}

.photo-preview {
  width: 92px;
  height: 92px;
  border-radius: 14px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: #10171a;
  color: var(--muted);
}

.photo-preview.empty { border-style: dashed; }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-actions { display: flex; flex-wrap: wrap; gap: 7px; }

.photo-actions .photo-pick {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 8px 9px;
  border-radius: 8px;
  background: var(--accent2);
  color: #fff;
  cursor: pointer;
}

.photo-pick input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.photo-actions button { padding: 7px 9px; }
.photo-actions small {
  flex-basis: 100%;
  font-size: 10px;
  line-height: 1.35;
  color: var(--muted);
}

.tooltip-photo {
  width: 78px;
  height: 78px;
  object-fit: cover;
  border-radius: 12px;
  float: left;
  margin: 0 11px 8px 0;
  border: 1px solid var(--line);
}

.tooltip dl { clear: both; }
.detail-drawer { width: min(260px, 92vw); }
.drawer-close { right: calc(min(260px, 92vw) - 66px); }
.drawer-photo {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 18px;
  margin: 0 0 16px;
  border: 1px solid var(--line);
  box-shadow: 0 12px 28px rgba(0,0,0,.28);
}

/* Прокрутка списка карточек и связей */
#tab-layers.active {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

#tab-layers .layers-actions {
  flex-shrink: 0;
}

#layersList {
  min-height: 0;
  max-height: max(120px, calc(100dvh - 280px));
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: auto;
  scrollbar-color: #71828a #172126;
}

#layersList::-webkit-scrollbar {
  width: 12px;
}

#layersList::-webkit-scrollbar-track {
  background: #172126;
}

#layersList::-webkit-scrollbar-thumb {
  background: #71828a;
  border: 3px solid #172126;
  border-radius: 8px;
}

/* Ограничиваем высоту панели, прокручиваем только её содержимое */
body.editing main {
  min-height: 0;
  grid-template-rows: minmax(0, 1fr);
}

body.editing #inspector {
  min-height: 0;
  overflow: hidden;
}

#inspector > .aside-head,
#inspector > .aside-tabs,
#inspector > .aside-foot {
  flex: 0 0 auto;
}

#inspector > .tab {
  min-height: 0;
  flex: 1 1 0;
}

#inspector > #tab-layers.active {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#tab-layers > .layers-actions {
  flex: 0 0 auto;
}

#tab-layers > #layersList {
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  overflow-y: scroll;
  overflow-x: hidden;
}
