.smi-layers-group {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.smi-layers-group--banner {
  position: absolute;
  width: 100%;
  z-index: 0;
}

.smi-layers-container {
  position: absolute;
  inset: 0;
}

.smi-layers-layer {
  position: absolute;
  inset: 0;
  display: flex;
  overflow: hidden;
}

.smi-layers-layer-content {
  max-width: 100%;
  box-sizing: border-box;
  word-break: break-word;
  overflow-wrap: break-word;
}

.smi-layers-edit-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--theme-main-color);
  color: var(--theme-button-text-color);
  font-size: 1rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: opacity 0.15s ease;
}
.smi-layers-edit-btn:hover {
  opacity: 0.85;
}

.smi-layers-editor-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.smi-layers-editor-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 900px;
  background: var(--theme-main-background-color);
  overflow: hidden;
}

.smi-layers-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--theme-secondary-background-color);
  flex-shrink: 0;
}

.smi-layers-editor-title {
  font-weight: 600;
  color: var(--theme-main-text-color);
  font-size: 1rem;
}

.smi-layers-editor-close {
  font-size: 1.2rem;
  color: var(--theme-secondary-text-color);
  cursor: pointer;
}
.smi-layers-editor-close:hover {
  color: var(--theme-main-text-color);
}

.smi-layers-layer-settings {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--theme-secondary-background-color);
  border-top: 1px solid rgba(128, 128, 128, 0.15);
  flex-shrink: 0;
}

.smi-layers-setting-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 120px;
}

.smi-layers-setting-label {
  font-size: 0.75rem;
  color: var(--theme-secondary-text-color);
  font-weight: 500;
}

.smi-layers-setting-select {
  padding: 0.3rem 0.5rem;
  background: var(--theme-main-background-color);
  color: var(--theme-main-text-color);
  border: 1px solid rgba(128, 128, 128, 0.3);
  border-radius: 4px;
  font-size: 0.85rem;
}

.smi-layers-setting-input {
  padding: 0.3rem 0.5rem;
  background: var(--theme-main-background-color);
  color: var(--theme-main-text-color);
  border: 1px solid rgba(128, 128, 128, 0.3);
  border-radius: 4px;
  font-size: 0.85rem;
  width: 140px;
}
.smi-layers-setting-input::placeholder {
  color: var(--theme-secondary-text-color);
  opacity: 1;
}

.smi-layers-pivot-grid {
  display: grid;
  grid-template-columns: repeat(3, 1.4rem);
  grid-template-rows: repeat(3, 1.4rem);
  gap: 2px;
}

.smi-layers-pivot-cell {
  display: block;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 3px;
  border: 1px solid rgba(128, 128, 128, 0.35);
  background: var(--theme-main-background-color);
  cursor: pointer;
  transition: background 0.1s ease, border-color 0.1s ease;
}
.smi-layers-pivot-cell:hover {
  background: var(--theme-main-color-highlight);
}
.smi-layers-pivot-cell--active {
  background: var(--theme-main-color);
  border-color: var(--theme-main-color);
}

.smi-layers-pivot-custom-group {
  min-width: 180px;
}

.smi-layers-editor-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}
.smi-layers-editor-body .CodeMirror,
.smi-layers-editor-body .EasyMDEContainer,
.smi-layers-editor-body .CodeMirror-scroll {
  height: 100%;
}
.smi-layers-editor-body .EasyMDEContainer {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.smi-layers-editor-body .CodeMirror {
  flex: 1;
}

.smi-layers-editor-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--theme-secondary-background-color);
  border-top: 1px solid rgba(128, 128, 128, 0.15);
  flex-shrink: 0;
}

.smi-layers-manage-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.smi-layers-manage-panel {
  background: var(--theme-main-background-color);
  border-radius: 8px;
  width: min(480px, 95vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.smi-layers-manage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--theme-secondary-background-color);
  flex-shrink: 0;
}

.smi-layers-manage-title {
  font-weight: 600;
  color: var(--theme-main-text-color);
  font-size: 0.95rem;
}

.smi-layers-manage-close {
  font-size: 1.1rem;
  color: var(--theme-secondary-text-color);
  cursor: pointer;
}
.smi-layers-manage-close:hover {
  color: var(--theme-main-text-color);
}

.smi-layers-manage-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.smi-layers-manage-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  background: var(--theme-secondary-background-color);
  margin-bottom: 0.4rem;
  cursor: grab;
  user-select: none;
}
.smi-layers-manage-row:active {
  cursor: grabbing;
}
.smi-layers-manage-row--dragging {
  opacity: 0.4;
}
.smi-layers-manage-row--drag-over {
  outline: 2px solid var(--theme-main-color);
}

.smi-layers-manage-drag {
  color: var(--theme-tertiary-text-color);
  font-size: 1rem;
  flex-shrink: 0;
}

.smi-layers-manage-label {
  flex: 1;
  color: var(--theme-main-text-color);
  font-size: 0.9rem;
}

.smi-layers-manage-btn {
  color: var(--theme-secondary-text-color);
  font-size: 1rem;
  flex-shrink: 0;
  padding: 0.15rem;
  border-radius: 4px;
  transition: color 0.1s ease;
}
.smi-layers-manage-btn:hover {
  color: var(--theme-main-text-color);
}
.smi-layers-manage-btn--disabled {
  opacity: 0.3;
  pointer-events: none;
}

.smi-layers-manage-add-row {
  padding: 0.5rem 0;
}

.smi-layers-manage-add-btn {
  width: 100%;
  padding: 0.5rem;
  border-radius: 6px;
  background: var(--theme-main-color);
  color: var(--theme-button-text-color);
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s ease;
}
.smi-layers-manage-add-btn:hover {
  opacity: 0.85;
}
