.layout-edit-mode [data-layout-id] {
  cursor: move;
  pointer-events: auto;
}

.layout-edit-mode [data-layout-id]:hover {
  outline: 1px dashed rgba(53, 245, 208, 0.34);
  outline-offset: 2px;
}

.layout-edit-mode [data-layout-id].layout-editor-selected {
  outline: 2px solid rgba(53, 245, 208, 0.9);
  outline-offset: 3px;
}

.layout-edit-mode .brand-layer-item {
  pointer-events: auto;
}

.layout-edit-mode .brand-telegram,
.layout-edit-mode .tab,
.layout-edit-mode .market-mode,
.layout-edit-mode .exchange-mode,
.layout-edit-mode .rank-sort {
  cursor: move;
}

.layout-editor-overlay {
  position: fixed;
  inset: 0;
  z-index: 99980;
  pointer-events: none;
}

.layout-editor-box {
  position: fixed;
  border: 1px dashed rgba(53, 245, 208, 0.62);
  border-radius: 4px;
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(3, 11, 15, 0.72);
}

.layout-editor-box.is-selected {
  border-color: rgba(255, 255, 255, 0.95);
  box-shadow:
    0 0 0 1px rgba(16, 224, 192, 0.35),
    0 0 24px rgba(16, 224, 192, 0.18);
}

.layout-editor-label {
  position: absolute;
  left: 0;
  top: -20px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid rgba(53, 245, 208, 0.4);
  border-radius: 4px;
  padding: 2px 5px;
  background: rgba(2, 8, 12, 0.94);
  color: #35f5d0;
  font: 10px/1.2 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  letter-spacing: 0;
}

.layout-editor-handle {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 12px;
  height: 12px;
  border: 1px solid rgba(53, 245, 208, 0.85);
  border-radius: 2px;
  background: #071820;
  cursor: nwse-resize;
  pointer-events: auto;
}

.layout-editor-panel {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 99990;
  width: min(360px, calc(100vw - 24px));
  max-height: min(78vh, 720px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid rgba(53, 245, 208, 0.28);
  border-radius: 10px;
  padding: 10px;
  background:
    linear-gradient(180deg, rgba(10, 24, 31, 0.98), rgba(3, 9, 13, 0.98)),
    #040b10;
  color: #d6e5ea;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45);
  font: 12px/1.35 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  letter-spacing: 0;
  pointer-events: auto;
}

.layout-editor-panel.is-collapsed {
  width: auto;
  max-height: none;
  padding: 0;
  border-color: rgba(53, 245, 208, 0.45);
}

.layout-editor-panel.is-collapsed .layout-editor-body {
  display: none;
}

.layout-editor-panel.is-collapsed .layout-editor-title {
  display: none;
}

.layout-editor-panel.is-collapsed .layout-editor-header {
  padding: 0;
  cursor: default;
}

.layout-editor-panel.is-collapsed .layout-editor-toggle {
  min-height: 34px;
  padding-inline: 13px;
}

.layout-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: move;
  user-select: none;
}

.layout-editor-title {
  color: #35f5d0;
  font-weight: 900;
}

.layout-editor-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
}

.layout-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.layout-editor-panel label {
  display: grid;
  gap: 4px;
  color: rgba(214, 229, 234, 0.78);
}

.layout-editor-panel input,
.layout-editor-panel select,
.layout-editor-panel textarea {
  width: 100%;
  border: 1px solid rgba(67, 94, 106, 0.7);
  border-radius: 5px;
  padding: 6px 7px;
  background: rgba(2, 8, 12, 0.92);
  color: #f2fbff;
  font: inherit;
}

.layout-editor-panel textarea {
  min-height: 92px;
  resize: vertical;
}

.layout-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.layout-editor-panel button {
  min-height: 30px;
  border: 1px solid rgba(53, 245, 208, 0.36);
  border-radius: 5px;
  padding: 6px 8px;
  background: rgba(16, 224, 192, 0.08);
  color: #35f5d0;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.layout-editor-panel button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.layout-editor-panel button:hover {
  border-color: rgba(53, 245, 208, 0.75);
  background: rgba(16, 224, 192, 0.14);
}

.layout-editor-readout {
  min-height: 16px;
  color: rgba(214, 229, 234, 0.72);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layout-editor-snap {
  display: inline-flex !important;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 7px;
}

.layout-editor-snap input {
  width: auto;
}
