* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --brandLavenderLight: #f7ecff;
  --brandLavender: #e1cffd;
  --brandLavenderDeep: #b38dff;
  --brandInk: #3a2a4f;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'SF Pro Display', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  color: var(--brandInk);
  min-height: 100vh;
  overflow: hidden;
  background: linear-gradient(135deg, #e1cffd 0%, #c5b3f0 30%, #b8d4f0 60%, #a8c5e8 100%);
  background-attachment: fixed;
  position: relative;
}

/* Бумажная текстура */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(255, 255, 255, 0.03) 2px,
      rgba(255, 255, 255, 0.03) 4px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 2px,
      rgba(255, 255, 255, 0.03) 2px,
      rgba(255, 255, 255, 0.03) 4px
    );
  pointer-events: none;
  z-index: 0;
}

.app-container {
  display: flex;
  height: 100vh;
  padding: 20px;
  gap: 20px;
  max-width: 1400px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* Glassmorphism эффект */
.glass {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 
    0 8px 32px 0 rgba(0, 0, 0, 0.1),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.6),
    inset 0 -1px 0 0 rgba(255, 255, 255, 0.2);
  position: relative;
}

.glass::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
  pointer-events: none;
}

/* Логотип */
.app-logo {
  position: fixed;
  top: 14px;
  left: 22px;
  z-index: 500;
  pointer-events: none;
}

.app-logo-img {
  height: 36px;
  width: auto;
  display: block;
  opacity: 0.95;
}

/* Логотип на логин-экране чуть крупнее */
.login-header .app-logo-img {
  height: 64px;
  margin-bottom: 8px;
}

/* Экран логина */
.login-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e1cffd 0%, #c5b3f0 30%, #b8d4f0 60%, #a8c5e8 100%);
  z-index: 100000;
}

.login-container {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 24px;
  padding: 48px;
  min-width: 400px;
  max-width: 90vw;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    inset 0 -1px 0 rgba(255, 255, 255, 0.2);
  text-align: center;
}

.login-header {
  margin-bottom: 32px;
}

.login-subtitle {
  font-size: 14px;
  color: rgba(58, 42, 79, 0.7);
  margin: 0;
}

#telegramLoginWidget {
  display: flex;
  justify-content: center;
  align-items: center;
}

.main-app {
  display: none;
}

/* Левая панель */
.sidebar {
  width: 320px;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  overflow: hidden;
}

.sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
}

.sidebar-header h1 {
  font-size: 18px;
  font-weight: 600;
  color: var(--brandInk);
  letter-spacing: -0.02em;
}

.sidebar-actions {
  display: flex;
  gap: 6px;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--brandInk);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 16px;
  font-size: 16px;
  transition: all 0.2s ease;
  backdrop-filter: blur(20px);
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 2px 8px rgba(0, 0, 0, 0.05);
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(179, 141, 255, 0.2);
}

.btn-icon:active {
  transform: translateY(0);
}

.tree-container {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
}

/* Дерево */
.tree-node {
  user-select: none;
}

.tree-node-item {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  margin: 4px 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.tree-node-item:hover {
  background: rgba(255, 255, 255, 0.35);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.tree-node-item.selected {
  background: rgba(255, 255, 255, 0.4);
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.tree-node-item[draggable="true"] {
  cursor: grab;
}

.tree-node-item[draggable="true"]:active {
  cursor: grabbing;
}

.tree-node-item.dragging {
  opacity: 0.5;
  transform: scale(0.95);
}

.tree-node-item.drag-over {
  background: rgba(179, 141, 255, 0.3);
  backdrop-filter: blur(10px);
  box-shadow: 
    0 4px 12px rgba(179, 141, 255, 0.25),
    inset 0 0 0 2px var(--brandLavenderDeep);
  transform: scale(1.02);
}

.tree-node-item.selected::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 60%;
  background: var(--brandLavenderDeep);
  border-radius: 0 4px 4px 0;
}

.tree-node-indent {
  width: 20px;
  flex-shrink: 0;
}

.tree-node-toggle {
  width: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--brandLavenderDeep);
  font-size: 10px;
  flex-shrink: 0;
  transition: all 0.2s;
}

.tree-node-toggle:hover {
  color: var(--brandInk);
  transform: scale(1.1);
}

.tree-node-toggle.collapsed::before {
  content: '▶';
}

.tree-node-toggle.expanded::before {
  content: '▼';
}

.tree-node-toggle.hidden {
  display: none;
}

.tree-node-icon {
  margin-right: 8px;
  font-size: 16px;
  flex-shrink: 0;
  opacity: 0.7;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

/* Стиль для папок - футуристичный glass */
.tree-node-item[data-action="toggle-folder"] .tree-node-icon {
  opacity: 0.8;
  filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.5));
}

.tree-node-item[data-action="toggle-folder"] {
  background: rgba(255, 255, 255, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.tree-node-item[data-action="toggle-folder"]:hover {
  background: rgba(255, 255, 255, 0.4);
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.tree-node-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  color: var(--brandInk);
  font-weight: 600;
}

/* Стиль для промптов - стеклянная карточка */
.tree-node[data-slug] .tree-node-item {
  background: rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.tree-node[data-slug] .tree-node-item:hover {
  background: rgba(255, 255, 255, 0.35);
  border-color: rgba(255, 255, 255, 0.4);
}

.tree-node-actions {
  display: none;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

.tree-node-item:hover .tree-node-actions {
  display: flex;
}

.tree-node-action {
  background: rgba(255, 255, 255, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--brandInk);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 8px;
  font-size: 12px;
  transition: all 0.2s;
  backdrop-filter: blur(5px);
}

.tree-node-action:hover {
  background: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(179, 141, 255, 0.2);
}

.tree-node-action.delete:hover {
  background: rgba(220, 53, 69, 0.2);
  border-color: rgba(220, 53, 69, 0.3);
  color: #dc3545;
}

/* Редактор */
.editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  border-radius: 18px;
}

.editor-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.editor-placeholder {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(58, 42, 79, 0.5);
  font-size: 16px;
  font-weight: 500;
}

.editor-header {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
}

.editor-title-input {
  flex: 1;
  font-size: 22px;
  font-weight: 600;
  border: none;
  outline: none;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.3);
  color: var(--brandInk);
  transition: all 0.2s;
  backdrop-filter: blur(10px);
}

.editor-title-input:focus {
  background: rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(179, 141, 255, 0.2);
}

.editor-actions {
  display: flex;
  gap: 8px;
}

.btn {
  padding: 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.2);
  color: var(--brandInk);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  backdrop-filter: blur(20px);
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 2px 8px rgba(0, 0, 0, 0.05);
}

.btn:hover {
  background: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(179, 141, 255, 0.2);
}

.btn:active {
  transform: translateY(0);
}

.btn-danger {
  border-color: rgba(220, 53, 69, 0.3);
  background: rgba(220, 53, 69, 0.1);
  color: #dc3545;
}

.btn-danger:hover {
  background: rgba(220, 53, 69, 0.2);
  border-color: rgba(220, 53, 69, 0.4);
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.2);
}

.editor-body {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  max-height: calc(100vh - 200px);
  min-height: 0;
}

/* Контейнер для Markdown-контента при просмотре */
.editor-body .markdown-content {
  max-height: 100%;
  overflow-y: auto;
}

.editor-textarea {
  width: 100%;
  min-height: 300px;
  max-height: calc(100vh - 300px);
  border: none;
  outline: none;
  resize: vertical;
  font-family: Consolas, Menlo, Monaco, monospace;
  font-size: 15px;
  line-height: 1.7;
  color: var(--brandInk);
  background: transparent;
  padding: 12px;
  border-radius: 12px;
  transition: all 0.2s;
  overflow-y: auto;
}

.editor-textarea:focus {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
}

/* Модальное окно */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(58, 42, 79, 0.4);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(30px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 18px;
  padding: 32px;
  min-width: 400px;
  max-width: 90vw;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    inset 0 -1px 0 rgba(255, 255, 255, 0.2);
}

.modal-header {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--brandInk);
}

.modal-body {
  margin-bottom: 24px;
}

.modal-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 16px;
  font-size: 14px;
  outline: none;
  background: rgba(255, 255, 255, 0.2);
  color: var(--brandInk);
  backdrop-filter: blur(20px);
  transition: all 0.2s;
  box-shadow: 
    inset 0 1px 0 0 rgba(255, 255, 255, 0.3),
    0 2px 8px rgba(0, 0, 0, 0.05);
}

.modal-input:focus {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 
    0 0 0 3px rgba(179, 141, 255, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Скроллбар */
.tree-container::-webkit-scrollbar,
.editor-body::-webkit-scrollbar {
  width: 10px;
}

.tree-container::-webkit-scrollbar-track,
.editor-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.tree-container::-webkit-scrollbar-thumb {
  background: rgba(179, 141, 255, 0.3);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.tree-container::-webkit-scrollbar-thumb:hover {
  background: rgba(179, 141, 255, 0.5);
  background-clip: padding-box;
}

.editor-body::-webkit-scrollbar-thumb {
  background: rgba(179, 141, 255, 0.3);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.editor-body::-webkit-scrollbar-thumb:hover {
  background: rgba(179, 141, 255, 0.5);
  background-clip: padding-box;
}

/* Адаптивность */
@media (max-width: 1024px) {
  .app-container {
    flex-direction: column;
    padding: 16px;
    gap: 16px;
  }
  
  .sidebar {
    width: 100%;
    max-height: 40vh;
  }
  
  .editor {
    flex: 1;
  }
}

@media (max-width: 768px) {
  .app-container {
    padding: 12px;
  }
  
  .sidebar,
  .editor {
    border-radius: 16px;
  }
  
  .editor-header {
    padding: 16px;
  }
  
  .editor-body {
    padding: 16px;
  }
}

.app-version {
  position: fixed;
  right: 16px;
  bottom: 12px;
  font-size: 11px;
  color: rgba(58, 42, 79, 0.6);
  background: rgba(255, 255, 255, 0.55);
  padding: 4px 10px;
  border-radius: 6px;
  z-index: 9999;
  backdrop-filter: blur(6px);
}

/* Теги-чипы */
.tag-chip {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(179, 141, 255, 0.15);
  border: 1px solid rgba(179, 141, 255, 0.25);
  border-radius: 11px;
  font-size: 9px;
  color: var(--brandInk);
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
  line-height: 1.3;
  height: auto;
}

.tag-chip:hover {
  background: rgba(179, 141, 255, 0.22);
  border-color: rgba(179, 141, 255, 0.35);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(179, 141, 255, 0.15);
}

/* Тосты */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(58, 42, 79, 0.9);
  color: white;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  z-index: 10000;
  opacity: 0;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Подсветка совпадений при поиске */
mark {
  background: rgba(179, 141, 255, 0.4);
  color: var(--brandInk);
  padding: 2px 4px;
  border-radius: 4px;
  font-weight: 600;
}

/* Модалка подтверждения удаления */
.delete-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  animation: fadeIn 0.2s ease;
}

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

.delete-modal {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 26px;
  padding: 32px;
  min-width: 400px;
  max-width: 90vw;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    inset 0 -1px 0 rgba(255, 255, 255, 0.2);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.delete-modal-header {
  font-size: 20px;
  font-weight: 600;
  color: var(--brandInk);
  margin-bottom: 12px;
}

.delete-modal-text {
  font-size: 16px;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.8);
  margin-bottom: 24px;
  line-height: 1.4;
}

.delete-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.delete-modal-btn {
  padding: 10px 20px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  outline: none;
}

.delete-modal-btn-confirm {
  background: #1a1a1a;
  color: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.delete-modal-btn-confirm:hover {
  background: #2a2a2a;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

.delete-modal-btn-cancel {
  background: rgba(255, 255, 255, 0.2);
  color: var(--brandInk);
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(10px);
}

.delete-modal-btn-cancel:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.4);
}

/* Папки с вложенными папками */
.tree-node-folder-nested .tree-node-icon {
  position: relative;
}

.tree-node-folder-nested .tree-node-icon::after {
  content: '📁';
  position: absolute;
  top: -2px;
  left: 8px;
  font-size: 10px;
  opacity: 0.7;
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.6));
}

.tree-node-folder-nested {
  background: rgba(255, 255, 255, 0.34);
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  box-shadow: 
    0 6px 22px rgba(0, 0, 0, 0.12),
    inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

/* Главная папка направления (базовый стиль, потом переопределяется ниже) */
.tree-node-folder-main {
  background: linear-gradient(
    135deg,
    rgba(249, 245, 255, 0.95),
    rgba(225, 207, 253, 0.95)
  );
  border-color: rgba(179, 141, 255, 0.9);
  position: relative;
  box-shadow:
    0 10px 28px rgba(179, 141, 255, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.tree-node-folder-main .tree-node-icon {
  filter: drop-shadow(0 0 6px rgba(179, 141, 255, 0.9));
  opacity: 0.95;
}

/* Иконка настроек папки */
.tree-node-settings {
  background: rgba(255, 255, 255, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  opacity: 0.85;
  transition: all 0.2s ease;
  padding: 4px;
  margin-left: 8px;
  margin-right: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.tree-node-item:hover .tree-node-settings {
  opacity: 1;
  transform: translateY(-1px);
}

.tree-node-settings:hover {
  transform: translateY(-1px) rotate(90deg);
  box-shadow:
    0 3px 8px rgba(179, 141, 255, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* Поповер настроек папки */
.folder-settings-popover {
  z-index: 10002;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 16px;
  padding: 12px;
  box-shadow: 
    0 8px 24px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  min-width: 180px;
}

.folder-settings-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.folder-settings-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--brandInk);
  user-select: none;
}

.folder-settings-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--brandLavenderDeep);
}

/* Иконка копии */
.copy-icon {
  display: inline-block;
  font-size: 14px;
  opacity: 0.6;
  vertical-align: middle;
}

/* Цветные акценты для importance */
.prompt-important {
  filter: drop-shadow(0 0 4px rgba(255, 152, 0, 0.4));
}

.prompt-test {
  filter: drop-shadow(0 0 4px rgba(76, 175, 80, 0.4));
}

.prompt-normal {
  filter: drop-shadow(0 0 4px rgba(179, 141, 255, 0.4));
}

/* Бейдж importance */
.importance-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  backdrop-filter: blur(8px);
}

.importance-important {
  background: rgba(255, 152, 0, 0.15);
  color: rgba(255, 87, 34, 0.9);
  border: 1px solid rgba(255, 152, 0, 0.25);
}

.importance-test {
  background: rgba(76, 175, 80, 0.15);
  color: rgba(56, 142, 60, 0.9);
  border: 1px solid rgba(76, 175, 80, 0.25);
}

.importance-normal {
  background: rgba(179, 141, 255, 0.15);
  color: rgba(103, 58, 183, 0.9);
  border: 1px solid rgba(179, 141, 255, 0.25);
}

/* Теги с цветом importance */
.tag-chip-important {
  background: rgba(255, 152, 0, 0.12) !important;
  border-color: rgba(255, 152, 0, 0.2) !important;
}

.tag-chip-test {
  background: rgba(76, 175, 80, 0.12) !important;
  border-color: rgba(76, 175, 80, 0.2) !important;
}

/* Переключатель типа промпта */
.importance-selector {
  display: flex;
  gap: 8px;
}

.importance-btn {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.15);
  color: var(--brandInk);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.importance-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.4);
}

.importance-btn.active {
  background: rgba(255, 255, 255, 0.35);
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.importance-btn[data-importance="important"].active {
  background: rgba(255, 152, 0, 0.2);
  border-color: rgba(255, 152, 0, 0.3);
  color: rgba(255, 87, 34, 0.9);
}

.importance-btn[data-importance="test"].active {
  background: rgba(76, 175, 80, 0.2);
  border-color: rgba(76, 175, 80, 0.3);
  color: rgba(56, 142, 60, 0.9);
}

.importance-btn[data-importance="normal"].active {
  background: rgba(179, 141, 255, 0.2);
  border-color: rgba(179, 141, 255, 0.3);
  color: rgba(103, 58, 183, 0.9);
}

/* === OVERRIDE: ВИД ПАПОК === */

/* Любая папка */
.tree-node-item[data-action="toggle-folder"] {
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.55),
    rgba(225, 207, 253, 0.95)
  );
  border: 1px solid rgba(179, 141, 255, 0.9);
  box-shadow: 0 6px 22px rgba(179, 141, 255, 0.4);
}

/* Иконка папки — яркая */
.tree-node-item[data-action="toggle-folder"] .tree-node-icon {
  opacity: 1;
  color: #ffeb3b;
  filter: drop-shadow(0 0 12px rgba(255, 235, 59, 0.9));
}

/* Главная папка направления — больше и ярче, без левой палки */
.tree-node-folder-main {
  position: relative;
  background: linear-gradient(135deg,
    rgba(249, 245, 255, 1),
    rgba(225, 207, 253, 1)
  );
  border-color: rgba(179, 141, 255, 1);
  padding-top: 12px;
  padding-bottom: 12px;
  transform: scale(1.03);
  box-shadow:
    0 12px 30px rgba(179, 141, 255, 0.45),
    inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

/* Полностью убираем декоративную полоску */
.tree-node-folder-main::before {
  content: none;
}

/* Шестерёнка — заметная */
.tree-node-settings {
  width: 24px;
  height: 24px;
  margin-left: 8px;
  margin-right: 4px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(255, 255, 255, 0.6);
  border-radius: 999px;
  border: 1px solid rgba(179, 141, 255, 0.8);
  font-size: 14px;
  opacity: 1;
  cursor: pointer;

  box-shadow:
    0 3px 8px rgba(179, 141, 255, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: all 0.2s ease;
}

.tree-node-settings:hover {
  transform: translateY(-1px) rotate(90deg);
}

/* Стили для Markdown-контента */
.markdown-content {
  color: var(--brandInk);
  line-height: 1.7;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  font-weight: 600;
  color: var(--brandInk);
}

.markdown-content h1 {
  font-size: 2em;
  border-bottom: 2px solid rgba(58, 42, 79, 0.2);
  padding-bottom: 0.3em;
}

.markdown-content h2 {
  font-size: 1.5em;
  border-bottom: 1px solid rgba(58, 42, 79, 0.15);
  padding-bottom: 0.3em;
}

.markdown-content h3 {
  font-size: 1.25em;
}

.markdown-content p {
  margin: 1em 0;
}

.markdown-content ul,
.markdown-content ol {
  margin: 1em 0;
  padding-left: 2em;
}

.markdown-content li {
  margin: 0.5em 0;
}

.markdown-content code {
  background: rgba(58, 42, 79, 0.1);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-family: Consolas, Menlo, Monaco, monospace;
  font-size: 0.9em;
}

.markdown-content pre {
  background: rgba(58, 42, 79, 0.1);
  padding: 1em;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1em 0;
}

.markdown-content pre code {
  background: none;
  padding: 0;
}

.markdown-content blockquote {
  border-left: 4px solid rgba(58, 42, 79, 0.3);
  padding-left: 1em;
  margin: 1em 0;
  color: rgba(58, 42, 79, 0.8);
  font-style: italic;
}

.markdown-content strong {
  font-weight: 600;
}

.markdown-content em {
  font-style: italic;
}

.markdown-content a {
  color: var(--brandLavenderDeep);
  text-decoration: underline;
}

.markdown-content a:hover {
  color: var(--brandInk);
}

/* Markdown Toolbar */
.md-toolbar {
  display: flex;
  gap: 6px;
  padding: 6px 0 10px;
}

.md-toolbar button {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 13px;
  transition: 0.15s;
  color: var(--brandInk);
}

.md-toolbar button:hover {
  background: rgba(255, 255, 255, 0.32);
}

/* Editor Tabs */
.editor-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  margin-bottom: 16px;
}

.editor-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 12px 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: rgba(58, 42, 79, 0.6);
  transition: 0.15s;
}

.editor-tab:hover {
  color: var(--brandInk);
  background: rgba(255, 255, 255, 0.05);
}

.editor-tab.active {
  color: var(--brandInk);
  border-bottom-color: var(--brandInk);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* History */
.history-container {
  display: flex;
  gap: 20px;
  height: 100%;
}

.history-list {
  width: 300px;
  max-height: 600px;
  overflow-y: auto;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
  padding-right: 16px;
}

.history-item {
  padding: 12px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  cursor: pointer;
  transition: 0.15s;
  border: 1px solid transparent;
}

.history-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.history-item.active {
  background: rgba(124, 58, 237, 0.15);
  border-color: rgba(124, 58, 237, 0.3);
}

.history-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.history-version {
  font-weight: 600;
  color: var(--brandInk);
  font-size: 14px;
}

.history-date {
  font-size: 12px;
  color: rgba(58, 42, 79, 0.6);
}

.history-item-meta {
  font-size: 11px;
  color: rgba(58, 42, 79, 0.5);
}

.history-view {
  flex: 1;
  overflow-y: auto;
}

.history-view-header {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.history-view-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--brandInk);
}

/* History Diff */
.history-diff {
  margin-top: 12px;
  max-height: 520px;
  overflow: auto;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.22);
  padding: 10px 12px;
}

.history-diff-control {
  margin-bottom: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}

.history-diff-button {
  margin-top: 8px;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  cursor: pointer;
  font-size: 13px;
  color: var(--brandInk);
  transition: 0.15s;
}

.history-diff-button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.28);
}

.history-diff-button:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Diff2Html Overrides */
.history-diff .d2h-wrapper,
.history-diff .d2h-file-wrapper,
.history-diff .d2h-file-diff {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.history-diff .d2h-file-header {
  background: transparent !important;
  border: none !important;
  padding: 4px 4px 8px !important;
}

.history-diff .d2h-file-name {
  font-size: 13px;
  font-weight: 600;
  color: rgba(15, 23, 42, 0.9);
}

.history-diff .d2h-code-line,
.history-diff .d2h-code-line-ctn {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
  color: rgba(20, 24, 40, 0.96);
}

.history-diff .d2h-code-linenumber {
  color: rgba(148, 163, 184, 0.95);
  background: transparent !important;
}

/* добавленные строки */
.history-diff .d2h-ins {
  background-color: rgba(22, 163, 74, 0.20) !important;
}

.history-diff .d2h-ins .d2h-code-line-ctn {
  color: rgba(9, 47, 20, 0.98);
}

/* удалённые строки */
.history-diff .d2h-del {
  background-color: rgba(220, 38, 38, 0.20) !important;
}

.history-diff .d2h-del .d2h-code-line-ctn {
  color: rgba(76, 7, 15, 0.98);
}

/* неизменённые строки */
.history-diff .d2h-info,
.history-diff .d2h-cntx {
  background-color: rgba(255, 255, 255, 0.35) !important;
}

.history-diff .d2h-info .d2h-code-line-ctn,
.history-diff .d2h-cntx .d2h-code-line-ctn {
  color: rgba(30, 41, 59, 0.96);
}

/* Скругления для первых/последних строк блоков изменений */
.history-diff .d2h-code-line.d2h-ins:first-child {
  border-radius: 8px 0 0 0;
}

.history-diff .d2h-code-line.d2h-ins:last-child {
  border-radius: 0 0 8px 0;
}

.history-diff .d2h-code-line.d2h-del:first-child {
  border-radius: 0 8px 0 0;
}

.history-diff .d2h-code-line.d2h-del:last-child {
  border-radius: 0 0 0 8px;
}

/* Скругления для одиночных строк */
.history-diff .d2h-code-line.d2h-ins:only-child {
  border-radius: 8px 0 8px 0;
}

.history-diff .d2h-code-line.d2h-del:only-child {
  border-radius: 0 8px 0 8px;
}

.history-diff .d2h-tag {
  background: rgba(255, 255, 255, 0.5) !important;
  color: rgba(15, 23, 42, 0.9) !important;
  border-radius: 8px !important;
  padding: 2px 6px !important;
  font-size: 11px !important;
  border: none !important;
  box-shadow: none !important;
}

.history-diff .d2h-code-line-renamed {
  background: rgba(150, 150, 255, 0.15) !important;
}

.history-diff table {
  background: transparent !important;
  border-collapse: collapse;
  width: 100%;
}

.history-diff table td {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
}

.history-diff .d2h-code-side-line {
  background: transparent !important;
}

.history-diff .d2h-code-side-emptyplaceholder {
  background: transparent !important;
}

/* Убираем все белые фоны и тени */
.history-diff .d2h-file-list-wrapper,
.history-diff .d2h-file-list-header,
.history-diff .d2h-file-list,
.history-diff .d2h-file-list-line,
.history-diff .d2h-code-line-prefix,
.history-diff .d2h-code-line-prefix,
.history-diff .d2h-code-linenumber,
.history-diff .d2h-code-line-ctn {
  background: transparent !important;
  box-shadow: none !important;
}

/* Убираем границы */
.history-diff .d2h-code-line,
.history-diff .d2h-code-line-prefix,
.history-diff .d2h-code-linenumber {
  border: none !important;
}

/* Убираем отступы у обёрток */
.history-diff .d2h-wrapper {
  margin: 0 !important;
  padding: 0 !important;
}

.history-diff .d2h-file-wrapper {
  margin: 0 0 16px 0 !important;
  padding: 0 !important;
}

.history-item-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  width: 100%;
}

.history-item-checkbox {
  margin-top: 2px;
  cursor: pointer;
  flex-shrink: 0;
}

.history-item-content {
  flex: 1;
}
