/* Openazis Floating Quick Palette Styles */

:root {
  --palette-opacity: 0.96;
}

.openazis-palette {
  position: fixed;
  top: 75px;
  right: 280px;
  width: 380px;
  height: 480px;
  min-width: 290px;
  min-height: 180px;
  max-width: 95vw;
  max-height: 92vh;
  background: rgba(22, 27, 34, 0.96);
  opacity: var(--palette-opacity);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(48, 54, 61, 0.85);
  border-radius: 12px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
  z-index: 9990;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #e6edf3;
  user-select: none;
  box-sizing: border-box;
  resize: both;
  transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Hover smoothly brings window to 100% opacity for clear viewing */
.openazis-palette:hover,
.openazis-palette.is-editing,
.openazis-palette.is-dragging {
  opacity: 1 !important;
}

.openazis-palette.is-editing {
  border-color: rgba(88, 166, 255, 0.6);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7), 0 0 0 2px rgba(88, 166, 255, 0.25);
}

.openazis-palette.is-dragging {
  opacity: 0.88 !important;
  cursor: grabbing !important;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.75);
}

/* ========================================================
   HEADER & ACTIONS
   ======================================================== */
.openazis-palette-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(13, 17, 23, 0.95);
  border-bottom: 1px solid rgba(48, 54, 61, 0.75);
  cursor: grab;
  flex-shrink: 0;
  gap: 6px;
}

.openazis-palette-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #58a6ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.openazis-palette-title svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  flex-shrink: 0;
}

.openazis-palette-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* 3-Way Mode Switcher: Full / Compact / Mini */
.openazis-mode-switcher {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(48, 54, 61, 0.75);
  border-radius: 6px;
  padding: 1px;
  gap: 1px;
}

.openazis-mode-btn {
  background: transparent;
  border: none;
  color: #8b949e;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  line-height: 1;
  transition: all 0.15s ease;
  padding: 0;
}

.openazis-mode-btn:hover {
  color: #f0f6fc;
  background: rgba(255, 255, 255, 0.12);
}

.openazis-mode-btn.active {
  color: #58a6ff;
  background: rgba(56, 139, 253, 0.28);
  font-weight: 700;
}

.openazis-palette-btn {
  background: transparent;
  border: none;
  color: #8b949e;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: all 0.15s ease;
  padding: 0;
}

.openazis-palette-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #f0f6fc;
}

.openazis-palette-btn.is-active {
  background: rgba(56, 139, 253, 0.25);
  color: #58a6ff;
  border: 1px solid rgba(88, 166, 255, 0.4);
}

/* ========================================================
   INLINE QUICK EDIT BAR (Режим быстрой настройки инструментов)
   ======================================================== */
.openazis-palette-edit-bar {
  background: rgba(13, 17, 23, 0.98);
  border-bottom: 1px solid rgba(88, 166, 255, 0.35);
  padding: 8px 10px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  animation: slideDownBar 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDownBar {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.palette-edit-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}

.palette-edit-status {
  display: flex;
  align-items: center;
  gap: 6px;
}

.palette-edit-badge {
  background: rgba(56, 139, 253, 0.2);
  color: #58a6ff;
  border: 1px solid rgba(88, 166, 255, 0.4);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  letter-spacing: 0.2px;
}

.palette-edit-tip {
  font-size: 11px;
  color: #8b949e;
}

.palette-edit-controls {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.palette-btn-action {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid #30363d;
  color: #c9d1d9;
  border-radius: 5px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.palette-btn-action:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: #58a6ff;
  color: #f0f6fc;
}

.palette-btn-action.is-active {
  background: rgba(56, 139, 253, 0.2);
  border-color: #58a6ff;
  color: #58a6ff;
}

.palette-btn-done {
  background: #238636;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  font-weight: 600;
  border-radius: 5px;
  padding: 3px 12px;
  font-size: 11.5px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
}

.palette-btn-done:hover {
  background: #2ea043;
  transform: translateY(-1px);
}

/* Secondary Config Row: View Modes, Opacity, Category Scheme, Headers */
.palette-edit-config-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 5px;
  border-top: 1px solid rgba(48, 54, 61, 0.6);
  font-size: 11px;
  color: #8b949e;
}

.palette-config-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.palette-opacity-slider {
  width: 75px;
  height: 4px;
  cursor: pointer;
  accent-color: #58a6ff;
  vertical-align: middle;
}

.palette-select-input {
  background: rgba(22, 27, 34, 0.95);
  border: 1px solid #30363d;
  color: #e6edf3;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  outline: none;
  cursor: pointer;
}

.palette-select-input:focus {
  border-color: #58a6ff;
}

.palette-config-checkbox {
  width: 14px;
  height: 14px;
  accent-color: #1f6feb;
  cursor: pointer;
}

/* Hidden Tools Drawer */
.palette-hidden-drawer {
  background: rgba(9, 12, 16, 0.95);
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 8px;
  margin-top: 2px;
  animation: slideDownDrawer 0.15s ease;
}

@keyframes slideDownDrawer {
  from { opacity: 0; max-height: 0; }
  to { opacity: 1; max-height: 250px; }
}

.palette-hidden-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 11px;
  color: #8b949e;
}

.palette-hidden-search input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(22, 27, 34, 0.9);
  border: 1px solid #30363d;
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 11.5px;
  color: #e6edf3;
  outline: none;
  margin-bottom: 6px;
}

.palette-hidden-search input:focus {
  border-color: #58a6ff;
}

.palette-hidden-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-height: 120px;
  overflow-y: auto;
  padding: 2px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.palette-hidden-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(33, 38, 45, 0.85);
  border: 1px solid rgba(48, 54, 61, 0.8);
  border-radius: 5px;
  padding: 3px 8px;
  font-size: 11px;
  color: #c9d1d9;
  cursor: pointer;
  transition: all 0.12s ease;
  user-select: none;
}

.palette-hidden-chip:hover {
  background: rgba(56, 139, 253, 0.2);
  border-color: #58a6ff;
  color: #58a6ff;
  transform: translateY(-1px);
}

.palette-hidden-chip .chip-add-icon {
  font-weight: 700;
  color: #3fb950;
  font-size: 12px;
}

.palette-hidden-chip .chip-icon svg,
.palette-hidden-chip .chip-icon img {
  width: 14px;
  height: 14px;
}

.palette-drawer-empty {
  font-size: 11.5px;
  color: #3fb950;
  text-align: center;
  padding: 8px;
  font-weight: 500;
}

/* Quick Search Box */
.openazis-palette-search {
  padding: 7px 10px 4px 10px;
  flex-shrink: 0;
}

.openazis-palette-search-input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(13, 17, 23, 0.85);
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 11.5px;
  color: #e6edf3;
  outline: none;
  transition: border-color 0.15s ease;
}

.openazis-palette-search-input:focus {
  border-color: #58a6ff;
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.2);
}

.openazis-palette-search-input::placeholder {
  color: #6e7681;
}

/* Category Tabs */
.openazis-palette-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  border-bottom: 1px solid rgba(48, 54, 61, 0.7);
  background: rgba(13, 17, 23, 0.5);
  padding: 4px 8px;
  flex-shrink: 0;
  overflow: visible;
}

.openazis-palette-tab {
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 600;
  color: #8b949e;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(48, 54, 61, 0.5);
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.openazis-palette-tab:hover {
  color: #c9d1d9;
  background: rgba(255, 255, 255, 0.08);
  border-color: #58a6ff55;
}

.openazis-palette-tab.active {
  color: #58a6ff;
  background: rgba(56, 139, 253, 0.16);
  border-color: #58a6ff;
  font-weight: 700;
}

/* Content Container & Tool Grid */
.openazis-palette-body {
  padding: 8px 10px 14px 10px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.openazis-palette-body::-webkit-scrollbar {
  width: 6px;
}
.openazis-palette-body::-webkit-scrollbar-track {
  background: transparent;
}
.openazis-palette-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

/* ========================================================
   SECTION HEADERS IN GRID (Разделители подгрупп)
   ======================================================== */
.openazis-section-group {
  margin-bottom: 10px;
}

.openazis-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  margin-bottom: 5px;
  background: rgba(255, 255, 255, 0.035);
  border-bottom: 1px solid rgba(48, 54, 61, 0.65);
  border-radius: 5px;
}

.openazis-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: #58a6ff;
}

.openazis-section-badge {
  font-size: 10px;
  padding: 0 5px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #8b949e;
  font-weight: 500;
}

.openazis-section-rename-btn {
  background: transparent;
  border: none;
  color: #8b949e;
  cursor: pointer;
  font-size: 11px;
  padding: 2px 4px;
  border-radius: 3px;
  transition: all 0.12s ease;
}

.openazis-section-rename-btn:hover {
  color: #58a6ff;
  background: rgba(56, 139, 253, 0.18);
}

/* ========================================================
   GRID & TOOL ITEM (DEFAULT: FULL MODE)
   ======================================================== */
.openazis-tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 6px;
}

.openazis-tool-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  background: rgba(33, 38, 45, 0.7);
  border: 1px solid rgba(48, 54, 61, 0.65);
  border-radius: 7px;
  color: #c9d1d9;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: left;
  outline: none;
  min-width: 0;
  height: 38px;
  box-sizing: border-box;
}

.openazis-tool-item:hover {
  background: rgba(56, 139, 253, 0.2);
  border-color: rgba(88, 166, 255, 0.5);
  color: #f0f6fc;
  transform: translateY(-1px);
}

.openazis-tool-item:active {
  transform: translateY(0);
}

.openazis-tool-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 15px;
}

.openazis-tool-icon svg,
.openazis-tool-icon img {
  width: 17px;
  height: 17px;
  max-width: 17px;
  max-height: 17px;
}

.openazis-tool-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  line-height: 1.2;
}

.openazis-tool-badge {
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  color: #8b949e;
  font-weight: 600;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* ========================================================
   DISPLAY MODES (FULL / COMPACT / MINI)
   ======================================================== */

/* 1. COMPACT MODE */
.openazis-palette.mode-compact {
  min-width: 210px;
}

/* Compact mode hides search box to save space */
.openazis-palette.mode-compact .openazis-palette-search {
  display: none !important;
}

.openazis-palette.mode-compact .openazis-palette-tabs {
  display: flex !important;
  gap: 3px;
  padding: 2px 8px;
  background: rgba(0, 0, 0, 0.22);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  overflow-x: auto;
}

.openazis-palette.mode-compact .openazis-palette-tab {
  padding: 2px 7px;
  font-size: 11px;
  border-radius: 4px;
}

.openazis-palette.mode-compact .openazis-palette-body {
  padding: 4px 8px;
}

.openazis-palette.mode-compact .openazis-tool-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.openazis-palette.mode-compact .openazis-tool-item {
  height: 27px;
  padding: 2px 8px;
  font-size: 11px;
  gap: 5px;
  border-radius: 5px;
  flex-shrink: 0;
  max-width: 220px;
}

.openazis-palette.mode-compact .openazis-tool-icon {
  width: 15px;
  height: 15px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.openazis-palette.mode-compact .openazis-tool-icon svg,
.openazis-palette.mode-compact .openazis-tool-icon img {
  width: 14px;
  height: 14px;
}

.openazis-palette.mode-compact .openazis-tool-badge {
  font-size: 8px;
  padding: 0 3px;
  margin-left: 2px;
}

/* 2. MINI MODE (Icon-only, ultra-compact) */
.openazis-palette.mode-mini {
  min-width: 80px !important;
  min-height: 80px !important;
  border-radius: 10px;
}

.openazis-palette.mode-mini .openazis-palette-search {
  display: none !important;
}

/* Вкладки в Мини-режиме: компактные кнопки для переключения разделов */
.openazis-palette.mode-mini .openazis-palette-tabs {
  display: flex !important;
  gap: 3px;
  padding: 2px 8px;
  background: rgba(0, 0, 0, 0.22);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  overflow-x: auto;
}

.openazis-palette.mode-mini .openazis-palette-tab {
  padding: 2px 7px;
  font-size: 10.5px;
  border-radius: 4px;
}

.openazis-palette.mode-mini .openazis-palette-header {
  padding: 3px 8px;
  height: 32px;
}

.openazis-palette.mode-mini .openazis-palette-title span {
  display: none;
}

.openazis-palette.mode-mini.is-top-docked .openazis-palette-title span {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: #c9d1d9;
}

.openazis-palette.mode-mini .openazis-palette-body {
  padding: 5px 8px;
}

.openazis-palette.mode-mini .openazis-tool-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-start;
}

.openazis-palette.mode-mini .openazis-tool-item {
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  max-width: 32px !important;
  padding: 0 !important;
  justify-content: center !important;
  align-items: center !important;
  border-radius: 5px;
  flex-shrink: 0;
}

.openazis-palette.mode-mini .openazis-tool-label,
.openazis-palette.mode-mini .openazis-tool-badge {
  display: none !important;
}

.openazis-palette.mode-mini .openazis-tool-icon {
  width: 18px;
  height: 18px;
  font-size: 15px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.openazis-palette.mode-mini .openazis-tool-icon svg,
.openazis-palette.mode-mini .openazis-tool-icon img {
  width: 16px;
  height: 16px;
}

.openazis-palette.mode-mini .openazis-section-header {
  padding: 2px 4px;
  margin-bottom: 4px;
}

.openazis-palette.mode-mini .openazis-section-name {
  display: none;
}

/* ========================================================
   DRAG AND DROP & EDIT MODE STYLES
   ======================================================== */
.openazis-tool-item[draggable="true"] {
  cursor: grab;
}

.openazis-tool-item.is-drag-source {
  opacity: 0.35 !important;
  border: 1px dashed #58a6ff !important;
  transform: scale(0.96);
}

.openazis-tool-item.drop-target-before {
  border-left: 3px solid #58a6ff !important;
  box-shadow: -4px 0 10px rgba(88, 166, 255, 0.5);
  transform: translateX(2px);
}

.openazis-tool-item.drop-target-after {
  border-right: 3px solid #58a6ff !important;
  box-shadow: 4px 0 10px rgba(88, 166, 255, 0.5);
  transform: translateX(-2px);
}

/* Edit Mode Items */
.openazis-palette.is-editing .openazis-tool-item {
  border-style: dashed;
  background: rgba(33, 38, 45, 0.85);
}

.openazis-palette.is-editing .openazis-tool-item:hover {
  border-color: #58a6ff;
  background: rgba(56, 139, 253, 0.25);
}

.openazis-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #6e7681;
  margin-right: -2px;
  cursor: grab;
  user-select: none;
}

.openazis-palette.mode-mini .openazis-drag-handle {
  display: none !important;
}

.openazis-tool-item:hover .openazis-drag-handle {
  color: #58a6ff;
}

.openazis-tool-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #da3633;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  z-index: 10;
  transition: transform 0.15s ease, background 0.15s ease;
  line-height: 1;
}

.openazis-tool-remove:hover {
  transform: scale(1.22);
  background: #f85149;
}

/* Color Accents for Special Tools */
.openazis-tool-item.accent-green { border-left: 3px solid #2ea043; }
.openazis-tool-item.accent-blue { border-left: 3px solid #58a6ff; }
.openazis-tool-item.accent-yellow { border-left: 3px solid #eab308; }
.openazis-tool-item.accent-purple { border-left: 3px solid #bc8cff; }
.openazis-tool-item.accent-cyan { border-left: 3px solid #00d4ff; }

/* Resizer Handles */
.openazis-resizer {
  position: absolute;
  z-index: 10;
}

.openazis-resizer-se {
  width: 14px;
  height: 14px;
  right: 0;
  bottom: 0;
  cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 50%, rgba(255, 255, 255, 0.3) 50%, rgba(255, 255, 255, 0.3) 65%, transparent 65%, transparent 80%, rgba(255, 255, 255, 0.3) 80%);
  border-bottom-right-radius: 12px;
}

.openazis-resizer-e {
  width: 6px;
  top: 0;
  bottom: 14px;
  right: 0;
  cursor: ew-resize;
}

.openazis-resizer-s {
  height: 6px;
  left: 0;
  right: 14px;
  bottom: 0;
  cursor: ns-resize;
}

/* Minimized Mode (Pill/Badge) */
.openazis-palette.is-collapsed {
  width: auto !important;
  height: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  resize: none !important;
  border-radius: 20px;
}

.openazis-palette.is-collapsed .openazis-palette-header {
  border-bottom: none;
  padding: 6px 12px;
}

.openazis-palette.is-collapsed .openazis-palette-edit-bar,
.openazis-palette.is-collapsed .openazis-palette-search,
.openazis-palette.is-collapsed .openazis-palette-tabs,
.openazis-palette.is-collapsed .openazis-palette-body,
.openazis-palette.is-collapsed .openazis-resizer {
  display: none !important;
}

/* Floating Dock Activator Icon (bottom right when palette is closed) */
.openazis-palette-activator {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1f6feb;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 16px rgba(31, 111, 235, 0.4);
  cursor: pointer;
  z-index: 9989;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s;
}

.openazis-palette-activator:hover {
  transform: scale(1.08);
  background: #388bfd;
}

.openazis-palette-activator svg {
  width: 22px;
  height: 22px;
}

/* Settings Tab Styling (Inside the PartEdit Settings Dialog) */
.palette-settings-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin: 6px 0;
}

.palette-settings-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.palette-tool-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #1f6feb;
}

.palette-table-row {
  cursor: pointer;
  transition: background 0.12s ease;
}

.palette-table-row:hover td {
  background: #eef3f9 !important;
}

.palette-table-row.is-checked td {
  background: #f0f7ff;
}

/* ========================================================
   TOP DOCKED MODE (Верхняя закрепленная лента / Ribbon)
   ======================================================== */

/* Бесшовное встраивание ленты в общую CSS-сетку desktop-shell */
body.has-top-palette-dock .desktop-shell {
  grid-template-rows: auto auto minmax(0, 1fr) !important;
}

body.has-top-palette-dock.is-interface-hidden .desktop-shell {
  grid-template-rows: auto minmax(0, 1fr) !important;
}

/* Скрытие базовой панели инструментов PartEdit (.toolbar-strip) при закрепленной ленте Openazis,
   так как все 143 инструмента (включая Undo, Redo, Сетку, Виды) уже входят в ленту Openazis */
body.has-top-palette-dock .toolbar-strip {
  display: none !important;
}

.openazis-palette.is-top-docked {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 100% !important;
  height: auto !important;
  margin: 0 !important;
  border-radius: 0 !important;
  border-left: none !important;
  border-right: none !important;
  border-top: 1px solid rgba(88, 166, 255, 0.35) !important;
  border-bottom: 2px solid #2d333b !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45) !important;
  background: #161b22 !important;
  opacity: 1 !important;
  z-index: 50 !important;
  resize: none !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
}

.openazis-palette.is-top-docked .openazis-resizer {
  display: none !important;
}

.openazis-palette.is-top-docked .openazis-palette-header {
  height: 32px;
  min-height: 32px;
  padding: 2px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: #161b22;
}

.openazis-palette.is-top-docked .openazis-palette-tabs {
  padding: 3px 10px;
  background: #1a2028;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.openazis-palette.is-top-docked .openazis-palette-body {
  padding: 5px 10px;
  max-height: 125px;
  overflow-y: auto;
  background: #12161c;
}

.openazis-palette.is-top-docked .openazis-tool-grid {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 5px !important;
}

/* Collapsed Ribbon: ровно 32px компактная полоса */
.openazis-palette.is-top-docked.is-collapsed {
  height: 32px !important;
  min-height: 32px !important;
  max-height: 32px !important;
  overflow: hidden !important;
  border-bottom: 1px solid rgba(56, 139, 253, 0.4) !important;
}

.openazis-palette.is-top-docked.is-collapsed .openazis-palette-header {
  border-bottom: none !important;
}

.openazis-palette.is-top-docked.is-collapsed .openazis-palette-edit-bar,
.openazis-palette.is-top-docked.is-collapsed .openazis-palette-search,
.openazis-palette.is-top-docked.is-collapsed .openazis-palette-tabs,
.openazis-palette.is-top-docked.is-collapsed .openazis-palette-body {
  display: none !important;
}

/* Рабочее пространство (.workbench) плотно примыкает снизу без зазоров */
body.has-top-palette-dock .workbench {
  margin-top: 0 !important;
  height: auto !important;
}

/* ========================================================
   RADIAL MENU QUICK-ASSIGN HUD & OVERLAY (Openazis)
   ======================================================== */
.openazis-radial-assign-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 11, 16, 0.55);
  backdrop-filter: blur(5px);
  z-index: 99998;
  opacity: 0;
  animation: openazisFadeIn 0.15s ease-out forwards;
}

@keyframes openazisFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.openazis-radial-assign-hud {
  position: fixed;
  z-index: 99999;
  width: 380px;
  background: rgba(18, 22, 30, 0.95);
  border: 1px solid rgba(88, 166, 255, 0.35);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.75), 0 0 30px rgba(56, 139, 253, 0.25);
  color: #f0f6fc;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  user-select: none;
  padding: 14px 16px 12px 16px;
  transform: translate(-50%, -50%);
  animation: openazisHudPop 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes openazisHudPop {
  0% { transform: translate(-50%, -50%) scale(0.85); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.openazis-hud-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 10px;
  margin-bottom: 10px;
}

.openazis-hud-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #58a6ff;
}

.openazis-hud-target-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(56, 139, 253, 0.18);
  border: 1px solid rgba(88, 166, 255, 0.4);
  padding: 2px 8px;
  border-radius: 6px;
  color: #ffffff;
  font-size: 12px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.openazis-hud-target-badge svg {
  width: 14px;
  height: 14px;
  stroke: #58a6ff;
  flex-shrink: 0;
}

.openazis-hud-close {
  background: none;
  border: none;
  color: #8b949e;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  line-height: 1;
}

.openazis-hud-close:hover {
  color: #f85149;
  background: rgba(248, 81, 73, 0.15);
}

/* Menu Switcher Tabs (1..9) */
.openazis-hud-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 8px;
  scrollbar-width: thin;
}

.openazis-hud-tab {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #8b949e;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.openazis-hud-tab:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #e6edf3;
  border-color: rgba(88, 166, 255, 0.3);
}

.openazis-hud-tab.active {
  background: rgba(56, 139, 253, 0.22);
  border-color: #58a6ff;
  color: #58a6ff;
  font-weight: 700;
  box-shadow: 0 0 10px rgba(56, 139, 253, 0.3);
}

.openazis-hud-tab-num {
  font-weight: 800;
  color: #ffa657;
}

/* Radial Wheel Container */
.openazis-hud-wheel-container {
  position: relative;
  width: 310px;
  height: 310px;
  margin: 4px auto;
}

/* Background visual circles */
.openazis-hud-ring-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Sectors around wheel */
.openazis-hud-sector {
  position: absolute;
  width: 66px;
  height: 66px;
  transform: translate(-50%, -50%);
  border-radius: 12px;
  background: rgba(28, 33, 44, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 4px;
  text-align: center;
  transition: transform 0.14s cubic-bezier(0.16, 1, 0.3, 1), background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
  z-index: 2;
}

.openazis-hud-sector:hover,
.openazis-hud-sector.is-hovered {
  background: rgba(31, 111, 235, 0.55) !important;
  border-color: #58a6ff !important;
  box-shadow: 0 0 22px rgba(56, 139, 253, 0.7) !important;
  transform: translate(-50%, -50%) scale(1.12) !important;
  z-index: 10;
}

.openazis-hud-sector.is-success {
  background: rgba(46, 160, 67, 0.65) !important;
  border-color: #3fb950 !important;
  box-shadow: 0 0 25px rgba(46, 160, 67, 0.8) !important;
  transform: translate(-50%, -50%) scale(1.15) !important;
}

.openazis-hud-sector-dir {
  font-size: 10px;
  font-weight: 700;
  color: #8b949e;
  line-height: 1;
  margin-bottom: 3px;
}

.openazis-hud-sector.is-hovered .openazis-hud-sector-dir {
  color: #79c0ff;
}

.openazis-hud-sector-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.openazis-hud-sector-icon svg {
  width: 20px;
  height: 20px;
  stroke: #f0f6fc;
}

.openazis-hud-sector-label {
  font-size: 9.5px;
  color: #c9d1d9;
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
  margin-top: 2px;
}

.openazis-hud-sector-empty {
  font-size: 9.5px;
  color: #6e7681;
  font-style: italic;
}

/* Center Slot */
.openazis-hud-center-slot {
  position: absolute;
  width: 76px;
  height: 76px;
  left: 155px;
  top: 155px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(22, 27, 36, 0.94);
  border: 2px solid rgba(88, 166, 255, 0.45);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5), inset 0 0 10px rgba(56, 139, 253, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 4px;
  text-align: center;
  transition: transform 0.14s cubic-bezier(0.16, 1, 0.3, 1), background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
  z-index: 5;
}

.openazis-hud-center-slot:hover,
.openazis-hud-center-slot.is-hovered {
  background: rgba(31, 111, 235, 0.55) !important;
  border-color: #58a6ff !important;
  box-shadow: 0 0 25px rgba(56, 139, 253, 0.75) !important;
  transform: translate(-50%, -50%) scale(1.12) !important;
  z-index: 10;
}

.openazis-hud-center-slot.is-success {
  background: rgba(46, 160, 67, 0.65) !important;
  border-color: #3fb950 !important;
  box-shadow: 0 0 25px rgba(46, 160, 67, 0.8) !important;
}

/* Footer Instructions */
.openazis-hud-footer {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  color: #8b949e;
  text-align: center;
  line-height: 1.4;
}

.openazis-hud-footer b {
  color: #e6edf3;
}

/* Toast confirmation */
.openazis-palette-toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(13, 17, 23, 0.96);
  border: 1px solid #3fb950;
  color: #f0f6fc;
  padding: 9px 20px;
  border-radius: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.75), 0 0 18px rgba(46, 160, 67, 0.35);
  font-size: 13px;
  font-weight: 600;
  z-index: 100000;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.openazis-palette-toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.openazis-palette-toast.is-hiding {
  transform: translateX(-50%) translateY(-15px);
  opacity: 0;
}

.openazis-palette-toast .openazis-toast-icon {
  color: #3fb950;
  font-size: 16px;
  font-weight: bold;
}

