/* ЭлаЙор — mobile.css
   Чистая версия после добавления мобильной адаптации, индикатора ожидания и микрофона.
*/

/* Перенесено из index */


/* Базовая мобильная адаптация */

@media (max-width: 720px) {
  body {
    padding: 0;
    align-items: stretch;
  }

  .chat-container {
    width: 100%;
    height: 100vh;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .chat-header {
    padding: 14px;
  }

  .chat-header h1 {
    font-size: 22px;
  }

  .chat-header p {
    font-size: 12px;
  }

  .brand-row {
    gap: 10px;
  }

  .brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }

  .login-box,
  .register-box,
  .reset-request-box,
  .reset-password-box {
    grid-template-columns: 1fr;
    padding: 10px 12px;
    gap: 8px;
  }

  .login-box button,
  .register-box button,
  .reset-request-box button,
  .reset-password-box button {
    width: 100%;
    min-height: 42px;
  }
 
  .message {
    max-width: 96%;
    font-size: 14px;
  }
  
  .message.bot {
    width: 100%;
    max-width: 100%;
    align-self: stretch;
  }

  .message.user {
    width: fit-content;
    max-width: 92%;
    align-self: flex-end;
  }
  
  .suggested-folder-box {
    max-width: 96%;
    margin-left: 0;
    margin-right: 0;
    font-size: 13px;
  }

  .suggested-folder-actions {
    flex-direction: column;
  }

  .suggested-folder-btn {
    width: 100%;
    min-height: 38px;
  }

  .account-panel {
    left: 10px;
    right: 10px;
    bottom: 58px;
    width: auto;
    max-width: none;
    z-index: 13050;
  }

  .account-panel-header {
    gap: 8px;
    padding: 12px;
  }

  .account-panel-title {
    flex: 1 1 auto;
    min-width: 108px;
  }

  .account-panel-header-actions {
    flex: 0 1 auto;
    gap: 6px;
  }

  .shell-language-control {
    flex: 0 1 auto;
    min-width: 0;
  }

  .shell-language-select {
    height: 32px;
    max-width: 132px;
    font-size: 12px;
    padding: 0 24px 0 8px;
  }

  .account-content {
    max-height: 58vh;
  }
}

/* Поле пароля: кнопка “Показать” рядом с полем */

@media (max-width: 720px) {
  .password-field {
    display: grid;
    grid-template-columns: 1fr 82px;
    gap: 8px;
    align-items: center;
  }

  .password-field input {
    padding-right: 12px !important;
  }

  .password-toggle {
    position: static !important;
    transform: none !important;
    width: 82px !important;
    min-width: 82px !important;
    height: 43px !important;
    min-height: 43px !important;
    padding: 0 6px !important;
    font-size: 11px !important;
    border-radius: 11px !important;
  }

  .password-toggle:hover {
    transform: none !important;
  }
}

/* Бренд в шапке */

.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-icon {
  width: 46px;
  height: 46px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 12px;
}

.brand-text {
  min-width: 0;
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand-topline {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
  flex-wrap: nowrap;
}

.chat-header .brand-topline h1 {
  margin: 0;
  color: #ffffff;
  font-family: Arial, sans-serif;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.2px;
  line-height: 1.02;
  white-space: nowrap;
}

.brand-separator {
  width: 1px;
  height: 22px;
  flex: 0 0 1px;
  align-self: center;
  background: rgba(210, 214, 235, 0.38);
  border-radius: 999px;
}

.chat-header .brand-tagline {
  margin: 0;
  color: #d7d9e8;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.05px;
  white-space: nowrap;
  position: relative;
  top: 1px;
}

.chat-header .brand-subline {
  margin: 4px 0 0;
  color: #c9cedf;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0.015em;
  white-space: nowrap;
  opacity: 0.94;
}

@media (max-width: 720px) {
  .brand-row {
    gap: 10px;
  }

  .brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }

  .brand-topline {
    gap: 9px;
  }

  .chat-header .brand-topline h1 {
    font-size: 22px;
    font-weight: 700;
  }

  .brand-separator {
    height: 18px;
  }

  .chat-header .brand-tagline {
    font-size: 11px;
  }

  .chat-header .brand-subline {
    margin-top: 3px;
    font-size: 11.2px;
    font-weight: 600;
    letter-spacing: 0.01em;
  }
}

@media (max-width: 420px) {
  .brand-topline {
    gap: 7px;
  }

  .chat-header .brand-topline h1 {
    font-size: 21px;
  }

  .brand-separator {
    height: 16px;
  }

  .chat-header .brand-tagline {
    font-size: 10px;
  }

  .chat-header .brand-subline {
    font-size: 10.6px;
    font-weight: 600;
    letter-spacing: 0;
  }
}

/* Предложение закрепить разговор в направлении */

.suggested-folder-box {
  align-self: flex-start;
  margin: 2px 0 12px;
  max-width: 82%;
  padding: 12px 14px;

  border: 1px solid rgba(122, 92, 255, 0.35);
  border-radius: 14px;
  background: rgba(122, 92, 255, 0.08);

  color: #eef0ff;
  font-size: 14px;
  line-height: 1.4;
}

.suggested-folder-title {
  margin-bottom: 6px;
  line-height: 1.35;
}

.suggested-folder-title strong {
  color: #ffffff;
}

.suggested-folder-text {
  margin-bottom: 10px;
  color: #b7bccb;
  line-height: 1.35;
}

.suggested-folder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.suggested-folder-btn {
  min-height: 32px;
  padding: 7px 11px;

  border: 1px solid rgba(183, 188, 203, 0.25);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);

  color: #eef0ff;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.2;
}

.suggested-folder-btn:hover {
  background: rgba(255, 255, 255, 0.10);
}

.suggested-folder-primary {
  border-color: rgba(122, 92, 255, 0.70);
  background: rgba(122, 92, 255, 0.22);
  color: #ffffff;
}

.suggested-folder-loading {
  opacity: 0.55;
  pointer-events: none;
}

.suggested-folder-chooser {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(183, 188, 203, 0.14);
}

.suggested-folder-chooser.hidden {
  display: none !important;
}

.suggested-folder-choice-title {
  margin-bottom: 8px;
  color: #dfe3f0;
  font-size: 13px;
  font-weight: 700;
}

.suggested-folder-choice-list {
  display: grid;
  gap: 8px;
}

.suggested-folder-choice {
  width: 100%;
  min-height: 44px;
  padding: 9px 10px;
  border-radius: 12px;

  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;

  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: #e7e9f3;

  text-align: left;
  font-size: 13px;
}

.suggested-folder-choice:hover {
  background: rgba(122, 92, 255, 0.15);
  border-color: rgba(122, 92, 255, 0.34);
}

.suggested-folder-choice span {
  font-weight: 800;
  color: #ffffff;
}

.suggested-folder-choice small {
  color: #aeb5c8;
  font-size: 11px;
  line-height: 1.3;
}

.suggested-folder-choice.current {
  border-color: rgba(140, 255, 176, 0.42);
  background: rgba(140, 255, 176, 0.07);
}

.suggested-folder-choice-empty {
  padding: 9px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  color: #aeb5c8;
  font-size: 13px;
  line-height: 1.35;
}

/* Лёгкий индикатор ожидания ответа */

.message.bot.thinking-message {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 6px 4px !important;
  margin: 8px 0 !important;
  max-width: 100% !important;
  width: auto !important;
  min-width: 0 !important;
  align-self: flex-start !important;
}

.message.bot.thinking-message .thinking-row {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 9px !important;
  width: auto !important;
  min-height: 20px !important;
  opacity: 0.82;
}

.message.bot.thinking-message .thinking-spinner {
  display: inline-block !important;
  width: 14px !important;
  height: 14px !important;
  min-width: 14px !important;
  min-height: 14px !important;
  border: 2px solid rgba(255, 255, 255, 0.18) !important;
  border-top-color: #8b6cff !important;
  border-radius: 50% !important;
  animation: thinking-spin 0.85s linear infinite !important;
  flex: 0 0 auto !important;
}

.message.bot.thinking-message .thinking-text {
  display: inline-block !important;
  color: rgba(233, 233, 242, 0.82) !important;
  font-size: 14px !important;
  line-height: 1.35 !important;
}

@keyframes thinking-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media (max-width: 720px) {
  .message.bot.thinking-message {
    padding: 5px 2px !important;
    margin: 7px 0 !important;
  }

  .message.bot.thinking-message .thinking-text {
    font-size: 13px !important;
  }

  .message.bot.thinking-message .thinking-spinner {
    width: 13px !important;
    height: 13px !important;
    min-width: 13px !important;
    min-height: 13px !important;
  }
}

/* Микрофон и голосовой режим */

.mic-button {
  width: 58px !important;
  min-width: 58px !important;
  height: 34px !important;
  min-height: 34px !important;
  padding: 0 !important;

  display: flex !important;
  align-items: center !important;
  justify-content: center !important;

  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 14px !important;

  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, opacity 0.15s ease;
}

.mic-button:hover {
  background: rgba(255, 255, 255, 0.04) !important;
}

.mic-button:active {
  transform: scale(0.96);
}

.mic-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.mic-button.listening {
  background: rgba(255, 61, 61, 0.18) !important;
  border: 1px solid rgba(255, 92, 92, 0.52) !important;
  box-shadow: 0 0 18px rgba(255, 61, 61, 0.28) !important;
  animation: mic-pulse 1.05s ease-in-out infinite;
}

.mic-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
  opacity: 0.92;
  pointer-events: none;
}

.voice-controls {
  grid-column: 2 / 3 !important;
  grid-row: 1 !important;

  position: relative !important;

  width: 76px !important;
  min-width: 76px !important;

  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 3px !important;
}

.voice-language-btn {
  width: 72px !important;
  min-width: 72px !important;
  height: 22px !important;
  min-height: 22px !important;
  padding: 0 6px !important;

  border-radius: 999px !important;
  border: 1px solid rgba(122, 92, 255, 0.34) !important;
  background: rgba(122, 92, 255, 0.13) !important;

  color: #dcd5ff !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  white-space: nowrap !important;

  cursor: pointer !important;
  box-shadow: 0 0 10px rgba(122, 92, 255, 0.10) !important;
}

.voice-language-btn:hover {
  background: rgba(122, 92, 255, 0.20) !important;
  color: #ffffff !important;
}

.voice-language-menu {
  position: absolute !important;
  right: 138px !important;
  bottom: 74px !important;
  z-index: 20000 !important;

  width: 210px !important;
  max-height: 280px !important;
  overflow-y: auto !important;

  padding: 8px !important;
  border-radius: 14px !important;
  border: 1px solid rgba(122, 92, 255, 0.36) !important;
  background: #171a25 !important;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.45) !important;
}

.voice-language-menu.hidden {
  display: none !important;
}

.voice-language-menu button {
  width: 100% !important;
  min-height: 32px !important;
  padding: 7px 9px !important;

  border: 0 !important;
  border-radius: 10px !important;
  background: transparent !important;

  color: #eef0ff !important;
  text-align: left !important;
  font-size: 13px !important;
  cursor: pointer !important;
}

.voice-language-menu button:hover {
  background: rgba(122, 92, 255, 0.18) !important;
}

.mic-button.listening .mic-icon {
  opacity: 1;
  filter: drop-shadow(0 0 8px rgba(255, 75, 75, 0.95));
}

@keyframes mic-pulse {
  0% {
    box-shadow:
      0 0 0 0 rgba(255, 61, 61, 0.48),
      0 0 16px rgba(255, 61, 61, 0.24);
  }

  70% {
    box-shadow:
      0 0 0 10px rgba(255, 61, 61, 0),
      0 0 20px rgba(255, 61, 61, 0.16);
  }

  100% {
    box-shadow:
      0 0 0 0 rgba(255, 61, 61, 0),
      0 0 16px rgba(255, 61, 61, 0.20);
  }
}

/* Строка состояния голосовой записи */

.voice-status {
  grid-column: 1 / 4 !important;
  grid-row: 2 !important;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  min-height: 34px;
  padding: 7px 10px;
  border-radius: 12px;

  background: rgba(122, 92, 255, 0.08);
  border: 1px solid rgba(122, 92, 255, 0.18);
  color: rgba(233, 233, 242, 0.88);
  font-size: 13px;
  line-height: 1.3;
}

.voice-status.hidden {
  display: none !important;
}

.voice-status.listening {
  background: rgba(255, 61, 61, 0.12) !important;
  border-color: rgba(255, 92, 92, 0.34) !important;
  color: #ffd6d6 !important;
}

.voice-status.listening .voice-record-dot {
  background: #ff4b4b !important;
  box-shadow: 0 0 12px rgba(255, 75, 75, 0.9) !important;
}

.voice-status.listening .voice-wave span {
  background: rgba(255, 75, 75, 0.95) !important;
}

.response-control-hint {
  grid-column: 1 / 4 !important;
  grid-row: 2 !important;
  padding: 7px 10px;
  border-radius: 12px;
  background: rgba(255, 183, 77, 0.10);
  border: 1px solid rgba(255, 183, 77, 0.24);
  color: #ffd89a;
  font-size: 12px;
  line-height: 1.35;
}

.response-control-hint.hidden {
  display: none !important;
}

#send.stop-mode {
  background: linear-gradient(135deg, #ff6b6b, #d94d4d) !important;
  color: #ffffff !important;
}

.voice-status-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.voice-record-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8b6cff;
  box-shadow: 0 0 10px rgba(139, 108, 255, 0.85);
  flex: 0 0 auto;
}

.voice-status.silent {
  background: rgba(255, 183, 77, 0.10);
  border-color: rgba(255, 183, 77, 0.24);
}

.voice-status.silent .voice-record-dot {
  background: #ffbd6b;
  box-shadow: 0 0 10px rgba(255, 189, 107, 0.8);
}

.voice-status.done {
  background: rgba(140, 255, 176, 0.08);
  border-color: rgba(140, 255, 176, 0.20);
}

.voice-status.done .voice-record-dot {
  background: #8cffb0;
  box-shadow: 0 0 10px rgba(140, 255, 176, 0.75);
}

.voice-status.error {
  background: rgba(255, 155, 155, 0.10);
  border-color: rgba(255, 155, 155, 0.25);
}

.voice-status.error .voice-record-dot {
  background: #ff9b9b;
  box-shadow: 0 0 10px rgba(255, 155, 155, 0.75);
}

.voice-wave {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 18px;
  flex: 0 0 auto;
}

.voice-wave span {
  width: 3px;
  height: 8px;
  border-radius: 999px;
  background: rgba(139, 108, 255, 0.92);
  animation: voice-wave 0.9s ease-in-out infinite;
}

.voice-wave span:nth-child(2) {
  animation-delay: 0.1s;
}

.voice-wave span:nth-child(3) {
  animation-delay: 0.2s;
}

.voice-wave span:nth-child(4) {
  animation-delay: 0.3s;
}

.voice-wave span:nth-child(5) {
  animation-delay: 0.4s;
}

.voice-status.silent .voice-wave span,
.voice-status.done .voice-wave span,
.voice-status.error .voice-wave span {
  animation: none;
  height: 7px;
  opacity: 0.45;
}

@keyframes voice-wave {
  0%, 100% {
    height: 6px;
    opacity: 0.45;
  }

  50% {
    height: 18px;
    opacity: 1;
  }
}

/* Нижняя панель на компьютере:
   [ поле сообщения ] [ микрофон ] [ отправить ]
   [ статус записи на всю ширину ]
*/

.chat-input {
  display: grid !important;
  grid-template-columns: 1fr 76px 128px !important;
  gap: 10px !important;
  align-items: end !important;
}

.chat-input textarea {
  grid-column: 1 / 2 !important;
  grid-row: 1 !important;
  width: 100% !important;
  overflow-y: auto !important;
  resize: none !important;
  align-self: end !important;
}

.chat-input textarea {
  z-index: 1 !important;
}

#input::placeholder {
  color: rgba(219, 224, 246, 0.52) !important;
  opacity: 1 !important;
}

.chat-input-hint {
  display: none !important;
}

#send {
  grid-column: 3 / 4 !important;
  grid-row: 1 !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 52px !important;
  min-height: 52px !important;
  padding: 0 18px !important;
}

/* Телефон:
   [ поле сообщения ]
   [ статус записи ]
   [ разговоры ] [ микрофон ] [ отправить ]
   Кабинет на телефоне остаётся сверху в строке аккаунта.
*/

@media (max-width: 720px) {
  .voice-wave {
    height: 16px;
  }

  .account-button {
    display: none !important;
  }
  
  .desktop-account-btn {
    display: none !important;
  }

.mic-button {
  width: 52px !important;
  min-width: 52px !important;
  height: 30px !important;
  min-height: 30px !important;
  border-radius: 12px !important;
}

.voice-language-btn {
  width: 58px !important;
  min-width: 58px !important;
  height: 17px !important;
  min-height: 17px !important;
  padding: 0 4px !important;

  font-size: 9px !important;
  border-radius: 999px !important;
}

  .mic-icon {
    width: 20px;
    height: 20px;
  }
}

@media (max-width: 420px) {
  .chat-input {
    grid-template-columns: 88px 1fr 58px !important;
  }

  .account-button {
    display: none !important;
  }

  .voice-controls {
    grid-column: 3 / 4 !important;
    grid-row: 3 !important;

    width: 58px !important;
    min-width: 58px !important;
  }

  .mic-button {
    width: 48px !important;
    min-width: 48px !important;
    height: 30px !important;
    min-height: 30px !important;
  }

  .voice-language-btn {
    width: 54px !important;
    min-width: 54px !important;
    font-size: 8.5px !important;
  }

  .mic-icon {
    width: 18px;
    height: 18px;
  }
}

/* Пространство ЭлаЙор: sidebar + активный диалог */

.app-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
}

.chat-main {
  width: 100%;
  max-width: none;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-self: stretch;
}

.space-sidebar {
  min-width: 0;
  min-height: 0;
  position: relative;
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(15, 18, 27, 0.94);
  overflow-y: auto;
  padding: 14px;
  transition:
    background 1.35s ease,
    border-color 1.35s ease,
    padding 1.35s ease;
}

.space-sidebar-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.space-close-btn {
  display: none;
  width: 34px;
  height: 34px;
  min-width: 34px;
  padding: 0;
  border-radius: 10px;
  background: #2a2f3d;
  color: #dfe3f0;
  font-size: 20px;
  line-height: 1;
}

.space-sidebar-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.space-collapse-btn {
  display: inline-flex;
  position: relative;
  z-index: 5;
  align-items: center;
  justify-content: center;

  width: 34px;
  height: 34px;
  min-width: 34px;
  padding: 0;

  border-radius: 10px;
  background: rgba(122, 92, 255, 0.12);
  border: 1px solid rgba(122, 92, 255, 0.24);
  color: #dcd5ff;

  font-size: 24px;
  line-height: 1;
  font-weight: 700;
}

.space-collapse-btn:hover {
  background: rgba(122, 92, 255, 0.22);
}

.space-section {
  margin-bottom: 16px;
}

.space-section-title {
  margin-bottom: 8px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.space-goal-card,
.space-empty {
  padding: 10px;
  border-radius: 12px;
  background: rgba(122, 92, 255, 0.08);
  border: 1px solid rgba(122, 92, 255, 0.18);
  color: #bfc6d8;
  font-size: 13px;
  line-height: 1.4;
}

.space-muted {
  margin-top: 3px;
  color: #b7bccb;
  font-size: 12px;
  line-height: 1.3;
}

.space-small-action {
  width: 100%;
  min-height: 34px;
  margin-bottom: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(122, 92, 255, 0.14);
  border: 1px solid rgba(122, 92, 255, 0.28);
  color: #e8e2ff;
  font-size: 13px;
  font-weight: 700;
}

.space-small-action:hover {
  background: rgba(122, 92, 255, 0.22);
}

/* Текущее место пользователя в пространстве */

.login-status-left {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.login-user-label {
  color: #8cffb0;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.login-status.bad .login-user-label {
  color: #ff9b9b;
}

.status-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.current-location-label {
  color: #bdaeff;
  font-size: 12px;
  line-height: 1.3;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(122, 92, 255, 0.10);
  border: 1px solid rgba(122, 92, 255, 0.20);
}

.current-location-label.hidden {
  display: none !important;
}

/* Живое поведение кнопок пространства */

.space-chat-item,
.space-small-action,
.space-folder-card,
.space-footer-link,
.space-account-button {
  cursor: pointer;
}

.space-chat-item {
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    transform 0.12s ease,
    box-shadow 0.18s ease;
}

.space-chat-item:hover {
  background: rgba(122, 92, 255, 0.15);
  border-color: rgba(122, 92, 255, 0.34);
  transform: translateY(-1px);
}

.space-chat-item:active,
.space-small-action:active,
.space-footer-link:active,
.space-account-button:active {
  transform: scale(0.985);
}

.space-chat-item.active {
  background: linear-gradient(
    135deg,
    rgba(122, 92, 255, 0.34),
    rgba(92, 124, 255, 0.20)
  ) !important;
  border-color: rgba(160, 140, 255, 0.70) !important;
  box-shadow:
    0 0 0 1px rgba(160, 140, 255, 0.16),
    0 0 20px rgba(122, 92, 255, 0.25) !important;
}

.space-chat-item.active .space-chat-text > span::before {
  content: "● ";
  color: #8cffb0;
}

.space-chat-item.active {
  background: linear-gradient(
    135deg,
    rgba(140, 255, 176, 0.14),
    rgba(122, 92, 255, 0.30)
  ) !important;
  border-color: rgba(140, 255, 176, 0.65) !important;
}

.space-loading {
  opacity: 0.72;
  pointer-events: none;
}

.space-pressed {
  background: linear-gradient(
    135deg,
    rgba(140, 255, 176, 0.22),
    rgba(122, 92, 255, 0.24)
  ) !important;
  border-color: rgba(140, 255, 176, 0.55) !important;
  color: #ffffff !important;
  box-shadow:
    0 0 0 1px rgba(140, 255, 176, 0.14),
    0 0 18px rgba(140, 255, 176, 0.18) !important;
  transform: scale(0.985) !important;
}

.space-selected {
  background: linear-gradient(
    135deg,
    rgba(140, 255, 176, 0.18),
    rgba(122, 92, 255, 0.28)
  ) !important;
  border-color: rgba(140, 255, 176, 0.62) !important;
  color: #ffffff !important;
  box-shadow:
    0 0 0 1px rgba(140, 255, 176, 0.18),
    0 0 20px rgba(140, 255, 176, 0.16) !important;
}

.space-folder-card.space-selected .space-folder-title::before,
.space-small-action.space-selected::before {
  content: "● ";
  color: #8cffb0;
  font-weight: 900;
}

.current-location-label.location-pulse {
  animation: location-pulse 0.75s ease;
}

@keyframes location-pulse {
  0% {
    background: rgba(140, 255, 176, 0.22);
    border-color: rgba(140, 255, 176, 0.58);
    color: #ffffff;
  }

  100% {
    background: rgba(122, 92, 255, 0.10);
    border-color: rgba(122, 92, 255, 0.20);
    color: #bdaeff;
  }
}

/* плавность для содержимого sidebar */

.space-sidebar-title,
.space-sidebar-content,
.space-sidebar-footer {
  transition:
    opacity 0.75s ease,
    transform 0.75s ease,
    visibility 0.75s ease;
}

.space-chat-item {
  width: 100%;
  min-height: 42px;
  margin-bottom: 8px;
  padding: 9px 10px;
  border-radius: 12px;

  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;

  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: #e7e9f3;

  text-align: left;
  font-size: 13px;
}

.space-chat-item span {
  font-weight: 700;
}

.space-chat-item small {
  color: #aeb5c8;
  font-size: 11px;
  line-height: 1.25;
}

.space-folder-card {
  margin-bottom: 10px;
  padding: 10px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.028);
  border: 1px solid rgba(255, 255, 255, 0.065);
}

.space-folder-title {
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 4px;
}

.space-folder-goal {
  color: #aeb5c8;
  font-size: 11px;
  line-height: 1.35;
  margin-bottom: 8px;
}

.space-chat-item-nested {
  min-height: 34px;
  margin-bottom: 6px;
  padding: 7px 8px;
}

.space-folder-empty {
  padding: 7px 8px;
  color: #858ca0;
  font-size: 11px;
}

/* Свернутое Пространство на компьютере */

  @media (min-width: 1101px) {
    .app-layout {
      transition: grid-template-columns 3.35s cubic-bezier(0.16, 1, 0.3, 1);
    }

  .app-layout.sidebar-collapsed {
    grid-template-columns: 54px 1fr;
  }

  .app-layout.sidebar-collapsed .space-sidebar {
    padding: 12px 6px;
    overflow: hidden;
    cursor: pointer;
    background:
      linear-gradient(
        180deg,
        rgba(18, 21, 31, 0.72),
        rgba(12, 15, 23, 0.42)
      );
    border-right: 1px solid rgba(255, 255, 255, 0.035);
  }

  .app-layout.sidebar-collapsed .space-sidebar-title,
  .app-layout.sidebar-collapsed .space-sidebar-content,
  .app-layout.sidebar-collapsed .space-sidebar-footer {
    opacity: 0;
    transform: translateX(-10px);
    pointer-events: none;
    visibility: hidden;
  }

  .app-layout.sidebar-collapsed .space-sidebar-controls {
    justify-content: center;
  }

  .app-layout.sidebar-collapsed .space-sidebar-header {
  display: flex !important;
  justify-content: center !important;
  align-items: flex-start !important;
  margin-bottom: 0 !important;
  padding-top: 2px !important;
}

.app-layout.sidebar-collapsed .space-sidebar-controls {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  width: 100% !important;
}

.app-layout.sidebar-collapsed .space-collapse-btn {
  display: inline-flex !important;
  position: absolute !important;
  top: 14px !important;
  left: 10px !important;
  z-index: 80 !important;
  pointer-events: auto !important;
  
  align-items: center !important;
  justify-content: center !important;

  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  padding: 0 !important;
  border-radius: 12px !important;

  background: rgba(122, 92, 255, 0.18) !important;
  border: 1px solid rgba(122, 92, 255, 0.34) !important;
  color: #ffffff !important;

  font-size: 22px !important;
  line-height: 1 !important;
  box-shadow: 0 0 16px rgba(122, 92, 255, 0.18) !important;
  opacity: 1 !important;
  visibility: visible !important;
}

  .app-layout.sidebar-collapsed .space-collapse-btn:hover {
    background: rgba(122, 92, 255, 0.24);
    box-shadow: 0 0 18px rgba(122, 92, 255, 0.18);
  }
}

/* относится к выезжающему меню */

@media (max-width: 1100px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .space-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(86vw, 340px);
    z-index: 12000;
    transform: translateX(-105%);
    transition: transform 0.18s ease;
    box-shadow: 18px 0 45px rgba(0, 0, 0, 0.45);
  }

  .space-sidebar.open {
    transform: translateX(0);
  }

  .space-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .space-collapse-btn {
    display: none !important;
  }
}

/* Кабинет внутри левого пространства */

.space-sidebar {
  display: flex;
  flex-direction: column;
}

.space-sidebar-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.space-sidebar-footer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.10);
}

.space-account-button {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, #7a5cff, #5c7cff);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 0 18px rgba(122, 92, 255, 0.18);
}

.space-footer-link {
  width: 100%;
  min-height: 34px;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #bfc6d8;
  font-size: 12px;
  text-align: left;
}

.space-footer-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

.space-account-button:hover {
  transform: translateY(-1px);
}

/* Внутренняя почта ЭлаЙор */

.system-letters-button {
  margin-top: 8px;
  background: linear-gradient(135deg, #2a2f3d, #3a315f) !important;
  border: 1px solid rgba(189, 174, 255, 0.26) !important;
  color: #eee9ff !important;
  box-shadow: 0 0 16px rgba(122, 92, 255, 0.14) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
}

.system-letters-button:hover {
  background: linear-gradient(135deg, #343a4d, #473978) !important;
}

.system-letters-label {
  display: inline-flex;
  align-items: center;
}

.system-letters-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-width: 22px;
  height: 22px;
  padding: 0 7px;

  border-radius: 999px;

  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.system-letters-badge.hidden {
  display: none !important;
}

.system-letters-badge-waiting {
  background: rgba(140, 255, 176, 0.18);
  border: 1px solid rgba(140, 255, 176, 0.42);
  color: #baffcc;
}

.system-letters-badge-important {
  background: rgba(255, 88, 88, 0.18);
  border: 1px solid rgba(255, 88, 88, 0.48);
  color: #ffb4b4;
  box-shadow: 0 0 14px rgba(255, 88, 88, 0.24);
}

.system-letters-button.hidden,
.system-letters-panel.hidden,
.space-awareness-button.hidden,
.space-awareness-panel.hidden {
  display: none !important;
}

.system-letters-panel {
  position: fixed;
  right: 18px;
  bottom: 68px;
  width: 520px;
  max-width: calc(100vw - 36px);
  z-index: 10000;

  background: rgba(24, 28, 39, 0.98);
  color: #ffffff;

  border-radius: 18px;
  border: 1px solid rgba(122, 92, 255, 0.32);
  box-shadow: 0 14px 45px rgba(0, 0, 0, 0.48);

  overflow: hidden;
}

.system-letters-panel.expanded {
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;

  width: auto;
  max-width: none;
  height: auto;
  max-height: none;

  display: flex;
  flex-direction: column;

  border-radius: 0;
  z-index: 40000;
}

.system-letters-panel.expanded .system-letters-content {
  flex: 1;
  max-height: none;
  min-height: 0;
  width: 100%;
}

.system-letters-panel.expanded .system-letter-card {
  width: 100%;
  max-width: none;
}

.system-letters-header {
  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 14px 16px;
  background: rgba(122, 92, 255, 0.13);
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

.system-letters-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.system-letters-expand {
  width: 34px;
  height: 34px;
  min-width: 34px;
  padding: 0;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border-radius: 999px;
  border: none;
  background: transparent;

  color: #ffffff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.system-letters-expand:hover {
  background: rgba(122, 92, 255, 0.20);
}

.system-letters-close {
  width: 34px;
  height: 34px;
  min-width: 34px;
  padding: 0;

  border-radius: 999px;
  border: none;
  background: transparent;

  color: #ffffff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.system-letters-close:hover {
  background: rgba(122, 92, 255, 0.20);
}

.system-letters-toolbar {
  display: flex;
  gap: 8px;

  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.system-letters-toolbar button {
  flex: 1;
  min-height: 34px;
  padding: 7px 9px;

  border-radius: 10px;
  background: #2a2f3d;
  color: #dfe3f0;

  font-size: 12px;
}

.system-letters-toolbar button:hover {
  background: #353b4d;
}

.system-letters-toolbar button.active {
  background: rgba(122, 92, 255, 0.28) !important;
  border: 1px solid rgba(157, 133, 255, 0.58) !important;
  color: #ffffff !important;
  box-shadow:
    0 0 0 1px rgba(157, 133, 255, 0.10),
    0 0 16px rgba(122, 92, 255, 0.20);
}

.system-letters-content {
  padding: 14px 16px;
  max-height: 62vh;
  overflow-y: auto;

  font-size: 13px;
  line-height: 1.45;
}

.system-letter-card {
  padding: 13px;
  margin-bottom: 12px;

  border-radius: 14px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.system-letter-title {
  margin-bottom: 5px;
  color: #ffffff;

  font-weight: 700;
}

.system-letter-meta {
  margin-bottom: 8px;

  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
}

.system-letter-question {
  margin-bottom: 10px;

  color: rgba(255, 255, 255, 0.90);
  white-space: pre-wrap;
}

.system-letter-details {
  margin: 8px 0 10px;

  color: rgba(255, 255, 255, 0.70);
}

.system-letter-details summary {
  cursor: pointer;
  color: #bdb2ff;
}

.system-letter-details pre {
  margin: 8px 0 0;
  padding: 9px;

  border-radius: 10px;
  background: rgba(0, 0, 0, 0.20);

  color: rgba(255, 255, 255, 0.76);
  font-size: 12px;

  white-space: pre-wrap;
  word-break: break-word;
}

.system-letter-message {
  margin-bottom: 10px;
  padding-bottom: 8px;

  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.system-letter-message:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.system-letter-reply {
  width: 100%;
  min-height: 82px;
  margin-top: 8px;
  padding: 10px;

  border-radius: 12px;
  border: 1px solid #3a4050;
  background: #11141b;

  color: #ffffff;
  font-size: 13px;

  resize: vertical;
  outline: none;
}

.system-letter-reply:focus {
  border-color: #7a5cff;
  box-shadow: 0 0 0 3px rgba(122, 92, 255, 0.18);
}

.system-letter-actions {
  display: flex;
  gap: 8px;
  margin-top: 9px;
}

.system-letter-actions button {
  flex: 1;
  min-height: 34px;
  padding: 7px 10px;

  border-radius: 10px;
  font-size: 12px;
}

.system-letter-empty {
  color: rgba(255, 255, 255, 0.65);
}

/* Письма ЭлаЙор на телефоне */

@media (max-width: 720px) {
  .system-letters-panel {
    left: 10px;
    right: 10px;
    bottom: 58px;

    width: auto;
    max-width: none;

    border-radius: 16px;
  }

  .system-letters-panel.expanded {
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;

    width: auto;
    max-width: none;

    border-radius: 0;
  }

  .system-letters-panel.expanded .system-letters-content {
    max-height: none;
    flex: 1;
  }

  .system-letters-content {
    max-height: 58vh;
    padding: 12px;
  }

  .system-letters-toolbar {
    padding: 10px 12px;
    gap: 6px;
  }

  .system-letters-toolbar button {
    min-height: 32px;
    padding: 6px 7px;
    font-size: 11px;
  }

  .system-letter-card {
    padding: 11px;
  }

  .system-letter-actions {
    flex-direction: column;
  }

  .system-letter-actions button {
    width: 100%;
  }
}

/* Переключатель активного слоя внутри левого Пространства.
   Видят только sigitas / sandra. Для клиентов блок остаётся скрытым через JS. */

.layer-switch {
  width: 100%;
  box-sizing: border-box;
  margin: 8px 0 0;
  padding: 8px 10px;

  border-radius: 13px;
  background: rgba(12, 16, 24, 0.72);
  border: 1px solid rgba(130, 255, 170, 0.16);
}

.internal-tools-panel {
  margin-top: 6px;
  padding-top: 6px;

  display: grid;
  gap: 6px;

  border-top: 1px solid rgba(130, 255, 170, 0.10);
}

.internal-tools-panel.hidden {
  display: none !important;
}

.internal-tools-panel .system-letters-button,
.internal-tools-panel .space-awareness-button {
  margin-top: 0 !important;

  min-height: 34px !important;
  height: 34px !important;
  padding: 0 10px !important;

  border-radius: 11px !important;

  font-size: 12px !important;
  font-weight: 700 !important;
  line-height: 1 !important;

  box-shadow: 0 0 10px rgba(122, 92, 255, 0.10) !important;
}

.internal-tools-panel .system-letters-label,
.internal-tools-panel .space-awareness-label {
  font-size: 12px !important;
  line-height: 1 !important;
}

.internal-tools-panel .system-letters-badge {
  min-width: 16px !important;
  height: 16px !important;
  padding: 0 5px !important;

  font-size: 9px !important;
  line-height: 1 !important;
}

.layer-switch-label {
  margin-bottom: 6px;
  text-align: center;

  color: rgba(220, 230, 255, 0.68);
  font-size: 11px;
  line-height: 1.2;
}

.layer-switch-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  width: 100%;
}

.layer-switch-btn {
  width: 100%;
  min-height: 30px;
  box-sizing: border-box;
  padding: 5px 8px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 999px;
  border: 1px solid rgba(130, 255, 170, 0.18);
  background: rgba(255, 255, 255, 0.055);

  color: rgba(230, 235, 255, 0.72);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.layer-switch.hidden {
  display: none !important;
}

.layer-switch-btn.hidden {
  display: none !important;
}

.layer-switch-btn.active {
  background: rgba(44, 213, 118, 0.20);
  border-color: rgba(110, 255, 170, 0.65);
  color: #9dffbd;

  box-shadow:
    0 0 12px rgba(44, 213, 118, 0.22),
    inset 0 0 12px rgba(44, 213, 118, 0.10);
}

.layer-switch-btn:hover {
  transform: translateY(-1px);
}

/* Око Пространства + сигнал писем на кнопке Внутренний */

.space-awareness-button {
  margin-top: 8px;
  background: linear-gradient(135deg, #182a22, #263f34) !important;
  border: 1px solid rgba(140, 255, 176, 0.24) !important;
  color: #dfffe8 !important;
  box-shadow: 0 0 16px rgba(140, 255, 176, 0.10) !important;

  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
}

.space-awareness-button:hover {
  background: linear-gradient(135deg, #20382c, #305345) !important;
  border-color: rgba(140, 255, 176, 0.38) !important;
  color: #ffffff !important;
}

.space-awareness-label {
  display: inline-flex;
  align-items: center;
}

/* Бейдж писем на кнопке "Внутренний" */

.layer-switch-btn {
  position: relative;
  gap: 6px;
  overflow: visible;
}

.internal-layer-badge {
  position: absolute;
  top: -7px;
  right: -7px;

  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  box-sizing: border-box;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border-radius: 999px;
  border: 1px solid rgba(255, 180, 200, 0.85);
  background: linear-gradient(135deg, #ff3d6e, #ff8b3d);
  color: #ffffff;

  font-size: 10px;
  font-weight: 900;
  line-height: 1;

  box-shadow:
    0 0 10px rgba(255, 70, 110, 0.70),
    0 0 22px rgba(255, 130, 70, 0.35);

  z-index: 5;
}

.internal-layer-badge.hidden {
  display: none !important;
}

.layer-switch-btn.has-internal-alert {
  border-color: rgba(255, 105, 145, 0.75) !important;
  box-shadow:
    0 0 12px rgba(255, 70, 120, 0.25),
    inset 0 0 10px rgba(255, 70, 120, 0.08) !important;
}

/* Панель Ока Пространства */

.space-awareness-panel {
  border-color: rgba(140, 255, 176, 0.26) !important;
}

.space-awareness-panel .system-letters-header {
  background: rgba(140, 255, 176, 0.08);
  border-bottom: 1px solid rgba(140, 255, 176, 0.14);
}

.space-awareness-summary {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.space-awareness-card {
  border: 1px solid rgba(140, 255, 176, 0.16);
  border-radius: 14px;
  padding: 10px 12px;

  background: rgba(255, 255, 255, 0.04);
  color: rgba(235, 240, 255, 0.86);

  font-size: 12px;
  line-height: 1.45;
}

.space-awareness-card strong {
  color: #9dffbd;
}

.space-awareness-json {
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;

  max-height: 55vh;
  padding: 12px;

  border-radius: 14px;
  border: 1px solid rgba(140, 255, 176, 0.16);
  background: rgba(0, 0, 0, 0.24);

  color: rgba(235, 240, 255, 0.84);
  font-size: 11px;
  line-height: 1.45;
}

/* Мобильная подстройка Ока Пространства */

@media (max-width: 720px) {
  .internal-layer-badge {
    top: -6px;
    right: -6px;

    min-width: 17px;
    height: 17px;

    font-size: 9px;
  }

  .space-awareness-json {
    max-height: 46vh;
    font-size: 10.5px;
  }

  .space-awareness-card {
    padding: 9px 10px;
    font-size: 11.5px;
  }
}

/* Рабочая ширина чата на широких экранах */

/* Старую fixed-кнопку больше не используем */
.account-button {
  display: none !important;
}

/* Открытие пространства через кнопку “Разговоры” */

.mobile-space-toggle {
  display: none;
}

.sidebar-overlay {
  display: none;
}

@media (max-width: 1100px) {
  .brand-row {
    width: 100%;
  }

  .brand-text {
    min-width: 0;
    flex: 0 1 auto;
  }

  .mobile-space-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;

    position: fixed;
    left: 10px;
    bottom: 10px;
    z-index: 10001;

    width: 96px;
    height: 44px;
    padding: 0 10px;

    border: none;
    background: transparent;
    color: #8cffb0;

    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;

    box-shadow: none;
  }

  .mobile-space-toggle:hover {
    background: rgba(140, 255, 176, 0.08);
  }

  .sidebar-overlay.open {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 11900;
    background: rgba(0, 0, 0, 0.48);
    backdrop-filter: blur(2px);
  }

  .space-sidebar {
    z-index: 12000;
  }
}

@media (max-width: 420px) {
  .mobile-space-toggle {
    width: 88px !important;
    height: 44px !important;
    font-size: 12px !important;
    padding: 0 8px !important;
  }
}

/* Контекстное меню разговоров */

/* Кнопка меню разговора внутри карточки */

.space-chat-item {
  position: relative;
  padding-right: 38px !important;
}

.space-chat-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
}

.space-chat-text > span,
.space-chat-text > small {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.space-chat-menu-trigger {
  position: absolute;
  right: 9px;
  top: 9px;

  width: 22px;
  height: 22px;
  min-width: 22px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);

  color: #9aa1b5 !important;
  font-size: 17px;
  font-weight: 800;
  line-height: 1;

  cursor: pointer;
  opacity: 0.72;
  z-index: 3;
}

.space-chat-menu-trigger:hover {
  background: rgba(122, 92, 255, 0.22);
  color: #ffffff !important;
  opacity: 1;
}

.space-chat-item.active .space-chat-menu-trigger {
  color: #c7ccda !important;
}

.chat-context-menu {
  position: fixed;
  z-index: 9999;

  min-width: 220px;
  max-width: 280px;
  padding: 8px;

  border: 1px solid rgba(122, 92, 255, 0.38);
  border-radius: 14px;
  background: #171a25;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.45);

  color: #eef0ff;
  font-size: 13px;
}

.chat-context-title {
  padding: 8px 9px 9px;
  color: #ffffff;
  font-weight: 800;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 6px;
}

.chat-context-item,
.chat-context-subitem {
  width: 100%;
  padding: 8px 9px;

  border: 0;
  border-radius: 10px;
  background: transparent;

  color: #eef0ff;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
}

.chat-context-item:hover,
.chat-context-subitem:hover {
  background: rgba(122, 92, 255, 0.18);
}

.chat-context-subitem.current {
  color: #9cffb3;
}

.chat-context-folders {
  padding: 4px 0 6px 10px;
}

.chat-context-folders.hidden {
  display: none !important;
}

.chat-context-empty {
  padding: 8px 9px;
  color: #9aa1b5;
  font-size: 12px;
}

.chat-context-separator {
  height: 1px;
  margin: 6px 4px;
  background: rgba(255, 255, 255, 0.08);
}

.chat-context-item.danger {
  color: #ff9f9f;
}

.chat-context-item.disabled {
  opacity: 0.45;
  cursor: default;
}

.chat-context-item.disabled:hover {
  background: transparent;
}

.space-chat-menu-trigger::before,
.space-chat-menu-trigger::after {
  content: none !important;
  display: none !important;
}

.space-chat-item.active .space-chat-menu-trigger {
  color: #9aa1b5 !important;
  background: rgba(255, 255, 255, 0.04) !important;
}

/* Строка аккаунта: Подключён как + Кабинет + Выйти */

@media (max-width: 720px) {
  .login-status {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 6px !important;
    padding: 6px 10px 7px !important;
  }

  .login-status-left {
    order: 1;
    width: 100%;
    min-width: 0;
    display: block !important;
  }

  .current-location-label {
    display: block;
    width: 100%;
    max-width: 100%;

    padding: 4px 8px;
    border-radius: 999px;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    font-size: 11px;
    line-height: 1.25;
  }

  .current-location-label.hidden {
    display: none !important;
  }

  .status-buttons {
    order: 2;
    width: 100% !important;
    min-width: 0;

    display: grid !important;
    grid-template-columns: 1fr auto auto !important;
    align-items: center !important;
    gap: 6px !important;
  }
  
  #loginStatusText {
    min-width: 0;
    max-width: 100%;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;

    font-size: 12px;
  }

  .login-user-label {
    min-width: 0;
    max-width: 100%;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    font-size: 12px;
  }

  .account-status-btn,
  .logout-btn {
    min-height: 30px !important;
    padding: 0 9px !important;
    border-radius: 9px !important;
    font-size: 12px !important;
  }

  .account-status-btn {
    min-width: 78px !important;
  }

  .logout-btn {
    min-width: 56px !important;
  }
}

@media (max-width: 420px) {
  .login-status {
    gap: 5px !important;
    padding: 5px 8px 6px !important;
  }

  .current-location-label {
    font-size: 10.5px;
    padding: 4px 7px;
  }

  #loginStatusText {
    font-size: 11px;
  }

  .account-status-btn,
  .logout-btn {
    min-height: 29px !important;
    padding: 0 7px !important;
    font-size: 11px !important;
  }

  .account-status-btn {
    min-width: 72px !important;
  }

  .logout-btn {
    min-width: 50px !important;
  }
  
}

/* Кабинет в верхней строке показываем только на телефоне.
   На компьютере кабинет находится в левом Пространстве. */

@media (min-width: 721px) {
  .account-status-btn {
    display: none !important;
  }
}

/* контекстного меню разговоров */

.space-archive-toggle {
  width: 100%;
  min-height: 38px;
  padding: 9px 10px;
  border-radius: 12px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;

  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);

  color: #e7e9f3;
  font-size: 13px;
  font-weight: 800;
  text-align: left;
}

.space-archive-toggle small {
  color: #9aa1b5;
  font-size: 11px;
  font-weight: 600;
}

.space-archive-toggle:hover {
  background: rgba(122, 92, 255, 0.15);
  border-color: rgba(122, 92, 255, 0.34);
}

.space-archive-list.hidden {
  display: none !important;
}

.space-archive-list.open {
  margin-top: 8px;
}

.space-chat-item-archived {
  opacity: 0.72;
  border-style: dashed !important;
}

.space-chat-item-archived:hover {
  opacity: 1;
}

.space-chat-item-archived .space-chat-text > span {
  color: #c8cce0;
}

.space-chat-item-archived small {
  color: #8f96aa;
}

.space-archive-more {
  margin-top: 6px;
}

/* CSS для кнопки Основной цели */

.space-section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.space-more-button {
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  border-radius: 999px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);

  color: #bfc6d8;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.space-more-button:hover {
  background: rgba(122, 92, 255, 0.18);
  border-color: rgba(122, 92, 255, 0.34);
  color: #ffffff;
}

.space-goal-card-compact {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;

  overflow: hidden;
  text-overflow: ellipsis;
  max-height: 44px;
}

.space-main-goal-section {
  position: relative;
}

.space-main-goal-menu {
  margin-top: 8px;
  padding: 10px;
  border-radius: 13px;

  background: #171a25;
  border: 1px solid rgba(122, 92, 255, 0.34);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.34);

  color: #e7e9f3;
  font-size: 13px;
  line-height: 1.4;
}

.space-main-goal-menu-title {
  margin-bottom: 7px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
}

.space-main-goal-full {
  max-height: 180px;
  overflow-y: auto;
  padding-right: 4px;
  color: #cfd4e6;
  white-space: normal;
}

.space-main-goal-edit {
  width: 100%;
  min-height: 34px;
  margin-top: 10px;
  padding: 7px 10px;
  border-radius: 10px;

  background: rgba(122, 92, 255, 0.16);
  border: 1px solid rgba(122, 92, 255, 0.35);

  color: #eee9ff;
  font-size: 12px;
  font-weight: 800;
}

.space-main-goal-edit:hover {
  background: rgba(122, 92, 255, 0.26);
  color: #ffffff;
}

/* Компактная цель папки */

.space-folder-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.space-folder-title-row .space-folder-title {
  min-width: 0;
  flex: 1;
}

.space-folder-more-button {
  width: 28px;
  min-width: 28px;
  height: 24px;
  padding: 0;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);

  color: #bfc6d8;
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
  flex-shrink: 0;
}

.space-folder-more-button:hover {
  background: rgba(122, 92, 255, 0.18);
  border-color: rgba(122, 92, 255, 0.34);
  color: #ffffff;
}

.space-folder-goal-compact {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;

  overflow: hidden;
  text-overflow: ellipsis;
  max-height: 32px;
}

/* Ограничение длинных названий папок и разговоров */

.space-chat-text {
  min-width: 0;
  overflow: hidden;
}

.space-chat-text > span {
  display: block;
  max-width: 100%;

  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.space-chat-text > small {
  display: block;
  max-width: 100%;

  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.space-folder-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;

  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
  max-height: 2.5em;
}

/* Контекстное меню папок */

.folder-context-menu {
  position: fixed;
  z-index: 10000;

  min-width: 230px;
  max-width: 300px;
  padding: 8px;

  border: 1px solid rgba(122, 92, 255, 0.38);
  border-radius: 14px;
  background: #171a25;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.45);

  color: #eef0ff;
  font-size: 13px;
}

.folder-context-title {
  padding: 8px 9px 9px;
  color: #ffffff;
  font-weight: 800;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 6px;
}

.folder-context-item {
  width: 100%;
  padding: 8px 9px;

  border: 0;
  border-radius: 10px;
  background: transparent;

  color: #eef0ff;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
}

.folder-context-item:hover {
  background: rgba(122, 92, 255, 0.18);
}

.folder-context-item.danger {
  color: #ff9f9f;
}

.folder-context-separator {
  height: 1px;
  margin: 6px 4px;
  background: rgba(255, 255, 255, 0.08);
}

.folder-context-goal {
  max-height: 180px;
  overflow-y: auto;
  margin: 6px 2px 8px;
  padding: 9px;
  border-radius: 10px;

  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);

  color: #cfd4e6;
  font-size: 12px;
  line-height: 1.45;
  white-space: normal;
}

.folder-context-goal.hidden {
  display: none !important;
}

/* Welcome-окно для нового посетителя поверх всего интерфейса */

.guest-welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 30000;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 22px;
  background: rgba(5, 7, 14, 0.72);
  backdrop-filter: blur(8px);
}

.guest-welcome-overlay.hidden {
  display: none !important;
}

.guest-welcome-modal {
  position: relative;
  width: min(720px, 100%);
  max-height: calc(100dvh - 44px);
  overflow-y: auto;

  padding: 28px;
  border: 1px solid rgba(139, 116, 255, 0.34);
  border-radius: 24px;

  background:
    radial-gradient(circle at top left, rgba(123, 92, 255, 0.24), transparent 36%),
    linear-gradient(145deg, rgba(24, 28, 42, 0.98), rgba(13, 16, 26, 0.98));

  box-shadow:
    0 28px 90px rgba(0, 0, 0, 0.58),
    0 0 0 1px rgba(255, 255, 255, 0.035);

  color: #eef0ff;
}

.guest-welcome-close {
  position: absolute;
  top: 12px;
  right: 12px;

  width: 34px;
  height: 34px;
  min-width: 34px;
  padding: 0;

  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.055);
  color: rgba(238, 240, 255, 0.78);

  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.guest-welcome-close:hover {
  background: rgba(122, 92, 255, 0.22);
  color: #ffffff;
}

.guest-welcome-kicker {
  display: inline-flex;
  align-items: center;
  margin-bottom: 12px;
  padding: 6px 11px;

  border: 1px solid rgba(157, 133, 255, 0.28);
  border-radius: 999px;
  background: rgba(123, 92, 255, 0.12);

  color: #bdb2ff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.guest-welcome-modal h2 {
  margin: 0 42px 14px 0;
  font-size: 28px;
  line-height: 1.18;
  color: #ffffff;
}

.guest-welcome-modal p {
  margin: 0 0 12px;
  color: rgba(238, 240, 255, 0.82);
  font-size: 15px;
  line-height: 1.55;
}

.guest-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 18px 0 20px;
}

.guest-examples button {
  padding: 9px 12px;

  border: 1px solid rgba(139, 116, 255, 0.30);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);

  color: #f2f2ff;
  font-size: 13px;
  cursor: pointer;

  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

.guest-examples button:hover {
  transform: translateY(-1px);
  border-color: rgba(157, 133, 255, 0.72);
  background: rgba(123, 92, 255, 0.16);
}

.guest-welcome-actions {
  display: flex;
  align-items: center;
  gap: 12px;

  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.guest-primary-btn,
.guest-secondary-btn {
  min-height: 42px;
  padding: 11px 16px;
  border-radius: 12px;

  font-weight: 700;
  cursor: pointer;
}

.guest-primary-btn {
  border: 0;
  background: linear-gradient(135deg, #7b5cff, #5f7cff);
  color: #ffffff;
  box-shadow: 0 10px 28px rgba(123, 92, 255, 0.30);
}

.guest-secondary-btn {
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.055);
  color: rgba(238, 240, 255, 0.86);
}

.guest-primary-btn:hover,
.guest-secondary-btn:hover {
  transform: translateY(-1px);
}

.guest-welcome-note {
  margin-top: 12px;
  color: rgba(238, 240, 255, 0.62);
  font-size: 13px;
  line-height: 1.4;
}

@media (max-width: 700px) {
  .guest-welcome-overlay {
    align-items: flex-start;
    padding: 14px;
    overflow-y: auto;
  }

  .guest-welcome-modal {
    width: 100%;
    max-height: none;
    margin-top: 12px;
    padding: 22px 18px 20px;
    border-radius: 20px;
  }

  .guest-welcome-close {
    top: 10px;
    right: 10px;
  }

  .guest-welcome-modal h2 {
    margin-right: 38px;
    font-size: 22px;
  }

  .guest-welcome-modal p {
    font-size: 14px;
  }

  .guest-examples {
    gap: 8px;
  }

  .guest-examples button {
    width: 100%;
    text-align: left;
    border-radius: 12px;
  }

  .guest-welcome-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .guest-primary-btn,
  .guest-secondary-btn {
    width: 100%;
  }
}

/* H1 H2 для чата  */

.message .message-heading {
  margin: 10px 0 8px;
  color: #ffffff;
  font-size: 16px;
  line-height: 1.35;
  font-weight: 800;
}

.message .message-heading:first-child {
  margin-top: 0;
}

.message .message-paragraph {
  margin: 0 0 10px;
  line-height: 1.55;
}

.message .message-paragraph:last-child {
  margin-bottom: 0;
}

.message .message-divider {
  height: 1px;
  border: 0;
  margin: 16px 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(157, 133, 255, 0.42),
    transparent
  );
}

.message .message-spacer {
  height: 8px;
}

.message .message-list {
  margin: 8px 0 12px 20px;
  padding: 0;
}

.message .message-list li {
  margin: 5px 0;
  padding-left: 4px;
  line-height: 1.5;
}

.message.bot {
  white-space: normal;
}

/*для аккуратных прозрачных надписей  */

.message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(157, 133, 255, 0.18);
  opacity: 1;
}

.message-action-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;

  padding: 4px 2px;
  border: 0;
  background: transparent;

  color: rgba(196, 184, 255, 0.88);
  font-size: 12px;
  font-weight: 700;

  cursor: pointer;
  text-shadow: 0 0 12px rgba(122, 92, 255, 0.22);

  transition:
    color 0.16s ease,
    text-shadow 0.16s ease,
    transform 0.16s ease;
}

.message-action-link:hover {
  color: #ffffff;
  text-shadow:
    0 0 10px rgba(157, 133, 255, 0.75),
    0 0 22px rgba(122, 92, 255, 0.38);
  transform: translateY(-1px);
}

.message-action-link {
  position: relative;
  justify-content: center;

  width: 28px;
  height: 28px;
  padding: 0;

  border-radius: 999px;
  font-size: 15px;
  line-height: 1;
}

.message-action-link::after {
  content: attr(data-tooltip);

  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%) translateY(3px);

  padding: 5px 8px;
  border-radius: 999px;

  background: rgba(19, 22, 34, 0.96);
  border: 1px solid rgba(157, 133, 255, 0.32);
  color: rgba(255, 255, 255, 0.94);

  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;

  opacity: 0;
  pointer-events: none;

  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.32);
  transition:
    opacity 0.14s ease,
    transform 0.14s ease;
  z-index: 20;
}

.message-action-link:hover::after,
.message-action-link:focus::after,
.message-action-link:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.message-feedback-button {
  border: 1px solid rgba(157, 133, 255, 0.12);
  background: rgba(255, 255, 255, 0.02);
}

.message-like-button.active-like,
.message-like-button.active-like:hover,
.message-like-button.active-like:focus {
  color: #ff4fd8 !important;
  background:
    radial-gradient(circle at center, rgba(255, 79, 216, 0.34), rgba(122, 92, 255, 0.18)) !important;

  border-color: rgba(255, 121, 222, 0.92) !important;

  box-shadow:
    0 0 0 1px rgba(255, 121, 222, 0.42),
    0 0 16px rgba(255, 79, 216, 0.62),
    0 0 30px rgba(122, 92, 255, 0.34),
    inset 0 0 12px rgba(255, 255, 255, 0.08) !important;

  text-shadow:
    0 0 8px rgba(255, 79, 216, 0.95),
    0 0 16px rgba(255, 79, 216, 0.62) !important;

  transform: translateY(-1px) scale(1.08);
}

.message-dislike-button.active-dislike,
.message-dislike-button.active-dislike:hover,
.message-dislike-button.active-dislike:focus {
  color: #ffd166 !important;
  background:
    radial-gradient(circle at center, rgba(255, 209, 102, 0.32), rgba(255, 125, 80, 0.16)) !important;

  border-color: rgba(255, 209, 102, 0.88) !important;

  box-shadow:
    0 0 0 1px rgba(255, 209, 102, 0.34),
    0 0 15px rgba(255, 209, 102, 0.52),
    0 0 26px rgba(255, 125, 80, 0.28),
    inset 0 0 12px rgba(255, 255, 255, 0.08) !important;

  text-shadow:
    0 0 8px rgba(255, 209, 102, 0.90),
    0 0 15px rgba(255, 176, 66, 0.52) !important;

  transform: translateY(-1px) scale(1.08);
}

.message-action-done {
  color: #9dffc4 !important;
  background: rgba(102, 255, 170, 0.12);
  border-color: rgba(157, 255, 196, 0.45);
  box-shadow: 0 0 12px rgba(102, 255, 170, 0.28);
}

.message-action-link span {
  font-size: 12px;
}

.message.bot {
  position: relative;
}

.message-conclusion-anchor {
  position: absolute;
  right: 12px;
  bottom: 12px;

  width: auto;
  min-width: 34px;
  height: 30px;
  padding: 0 8px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;

  border-radius: 999px;
  border: 1px solid rgba(140, 255, 176, 0.18);
  background: rgba(140, 255, 176, 0.04);

  color: rgba(186, 255, 204, 0.92);
  font-size: 14px;
  font-weight: 900;

  cursor: pointer;
  z-index: 5;

  box-shadow: 0 0 10px rgba(140, 255, 176, 0.08);
}

.message-conclusion-anchor:hover {
  color: #ffffff;
  background: rgba(140, 255, 176, 0.12);
  border-color: rgba(140, 255, 176, 0.45);

  box-shadow:
    0 0 12px rgba(140, 255, 176, 0.24),
    inset 0 0 10px rgba(140, 255, 176, 0.06);
}

.message-conclusion-number {
  min-width: 16px;
  height: 16px;
  padding: 0 5px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border-radius: 999px;
  background: rgba(140, 255, 176, 0.18);
  border: 1px solid rgba(140, 255, 176, 0.38);

  color: #baffcc;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.message-conclusion-number.hidden {
  display: none !important;
}

.message-conclusion-anchor.active-conclusion {
  color: #9dffc4 !important;
  background:
    radial-gradient(circle at center, rgba(140, 255, 176, 0.28), rgba(122, 92, 255, 0.12)) !important;

  border-color: rgba(157, 255, 196, 0.82) !important;

  box-shadow:
    0 0 0 1px rgba(157, 255, 196, 0.30),
    0 0 16px rgba(140, 255, 176, 0.48),
    0 0 30px rgba(122, 92, 255, 0.24),
    inset 0 0 12px rgba(255, 255, 255, 0.08) !important;
}

.message-conclusion-anchor.inactive-conclusion {
  opacity: 0.55;
  color: rgba(190, 200, 215, 0.82);
  border-color: rgba(190, 200, 215, 0.22);
  background: rgba(255, 255, 255, 0.035);
  box-shadow: none;
}

.message-actions {
  padding-right: 98px;
}

.message-conclusion-menu {
  position: absolute;
  right: 14px;
  bottom: 52px;
  z-index: 60;

  min-width: 190px;
  padding: 8px;

  display: grid;
  gap: 7px;

  border-radius: 14px;
  border: 1px solid rgba(140, 255, 176, 0.28);
  background: rgba(22, 26, 38, 0.98);

  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42);
}

.message-conclusion-menu-item {
  width: 100%;
  min-height: 34px;
  padding: 8px 10px;

  border-radius: 10px;
  border: 1px solid rgba(140, 255, 176, 0.18);
  background: rgba(140, 255, 176, 0.07);

  color: #dfffe8;
  font-size: 13px;
  font-weight: 800;
  text-align: left;

  cursor: pointer;
}

.message-conclusion-menu-item:hover {
  background: rgba(140, 255, 176, 0.14);
  border-color: rgba(140, 255, 176, 0.42);
  color: #ffffff;
}

/* Телефон: меню закладок чуть компактнее */

@media (max-width: 700px) {
  .message-conclusion-menu {
    right: 8px;
    bottom: 50px;
    min-width: 176px;
  }

  .message-conclusion-menu-item {
    font-size: 12px;
  }
}

/* Кнопки открытия сохранённых выводов / закладок */

.saved-conclusion-open-box {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(157, 133, 255, 0.18);
}

.saved-conclusion-open-button {
  min-height: 32px;
  padding: 0 12px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border-radius: 999px;
  border: 1px solid rgba(140, 255, 176, 0.28);
  background: rgba(140, 255, 176, 0.08);

  color: #baffcc;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;

  cursor: pointer;
  white-space: nowrap;

  box-shadow: 0 0 10px rgba(140, 255, 176, 0.08);

  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.saved-conclusion-open-button:hover {
  background: rgba(140, 255, 176, 0.16);
  border-color: rgba(140, 255, 176, 0.55);
  color: #ffffff;

  box-shadow:
    0 0 14px rgba(140, 255, 176, 0.24),
    inset 0 0 10px rgba(140, 255, 176, 0.05);

  transform: translateY(-1px);
}

.saved-conclusion-open-button.active {
  border-color: rgba(157, 255, 196, 0.68);
  background: rgba(140, 255, 176, 0.12);
  color: #baffcc;
}

.saved-conclusion-open-button.inactive {
  opacity: 0.55;
  color: rgba(220, 225, 235, 0.78);
  border-color: rgba(220, 225, 235, 0.22);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: none;
}

.message-jump-highlight {
  animation: elayorMessageJumpHighlight 2.2s ease;
}

@keyframes elayorMessageJumpHighlight {
  0% {
    box-shadow:
      0 0 0 1px rgba(157, 255, 196, 0.2),
      0 0 0 rgba(140, 255, 176, 0);
  }

  25% {
    box-shadow:
      0 0 0 1px rgba(157, 255, 196, 0.95),
      0 0 28px rgba(140, 255, 176, 0.52),
      0 0 44px rgba(122, 92, 255, 0.28);
  }

  100% {
    box-shadow:
      0 0 0 1px rgba(157, 255, 196, 0),
      0 0 0 rgba(140, 255, 176, 0);
  }
}

/* Summary-chain: список этапов и кнопки рядом с каждым Summary */

.summary-chain-view {
  display: grid;
  gap: 14px;
}

.summary-chain-main-title {
  font-size: 17px;
  font-weight: 900;
  margin-bottom: 4px;
}

.summary-chain-section-title {
  margin-top: 10px;
  font-size: 15px;
  font-weight: 900;
  color: #ffffff;
}

.summary-chain-inline-list {
  display: grid;
  gap: 12px;
}

.summary-chain-inline-item {
  padding: 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.summary-chain-inline-item:first-child {
  border-top: none;
}

.summary-chain-inline-item.inactive {
  opacity: 0.78;
}

.summary-chain-inline-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.summary-chain-inline-title {
  font-weight: 900;
  color: #ffffff;
}

.summary-chain-inline-text {
  color: rgba(255, 255, 255, 0.92);
  line-height: 1.5;
}

.summary-chain-inline-meta {
  margin-top: 7px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.68);
}

.summary-chain-inline-button {
  min-height: 30px;
  padding: 0 12px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border-radius: 999px;
  border: 1px solid rgba(140, 255, 176, 0.42);
  background: rgba(140, 255, 176, 0.08);

  color: #baffcc;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;

  cursor: pointer;
  white-space: nowrap;

  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    transform 0.16s ease;
}

.summary-chain-inline-button:hover {
  background: rgba(140, 255, 176, 0.16);
  border-color: rgba(140, 255, 176, 0.65);
  color: #ffffff;
  transform: translateY(-1px);
}

.summary-chain-inline-button.inactive {
  opacity: 0.62;
  color: rgba(220, 225, 235, 0.82);
  border-color: rgba(220, 225, 235, 0.25);
  background: rgba(255, 255, 255, 0.04);
}

.summary-chain-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.78);
}

/* Кнопки действий внутри Summary */

.summary-chain-inline-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.summary-chain-inline-button.danger {
  border-color: rgba(255, 130, 130, 0.42);
  background: rgba(255, 90, 90, 0.08);
  color: #ffb4b4;
}

.summary-chain-inline-button.danger:hover {
  border-color: rgba(255, 130, 130, 0.72);
  background: rgba(255, 90, 90, 0.16);
  color: #ffffff;
  box-shadow: 0 0 14px rgba(255, 90, 90, 0.18);
}

/* Иконка открытия памяти разговора рядом с закладкой */

.message-summary-chain-anchor {
  position: absolute;
  right: 58px;
  bottom: 16px;

  min-width: 34px;
  height: 28px;
  padding: 0 9px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border-radius: 999px;
  border: 1px solid rgba(157, 133, 255, 0.28);
  background: rgba(157, 133, 255, 0.08);

  color: #d8ccff;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;

  cursor: pointer;

  box-shadow: 0 0 10px rgba(157, 133, 255, 0.08);

  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.message-summary-chain-anchor:hover {
  background: rgba(157, 133, 255, 0.16);
  border-color: rgba(157, 133, 255, 0.55);
  color: #ffffff;

  box-shadow:
    0 0 14px rgba(157, 133, 255, 0.24),
    inset 0 0 10px rgba(157, 133, 255, 0.05);

  transform: translateY(-1px);
}

/* FINAL: правые иконки сообщения — память + закладка */

.message.bot > .message-summary-chain-anchor,
.message.bot > .message-conclusion-anchor {
  position: absolute !important;
  bottom: 14px !important;

  height: 30px !important;
  min-height: 30px !important;
  min-width: 34px !important;

  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  margin: 0 !important;
  box-sizing: border-box !important;
  line-height: 1 !important;
  vertical-align: middle !important;
}

/* Память разговора — всегда слева от закладки */
.message.bot > .message-summary-chain-anchor {
  right: 72px !important;

  width: 34px !important;
  padding: 0 !important;
}

/* Закладка / вывод — крайняя справа, может расширяться из-за номера */
.message.bot > .message-conclusion-anchor {
  right: 14px !important;

  width: auto !important;
  padding: 0 9px !important;
}

/* Номер закладки внутри кнопки */
.message.bot > .message-conclusion-anchor .message-conclusion-number {
  margin-left: 2px;
}

/* Верхняя строка summary-chain */

.summary-chain-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.summary-chain-header-main {
  min-width: 240px;
}

.summary-chain-unsummarized {
  margin-top: 5px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.68);
}

.summary-chain-create-button {
  min-height: 32px;
  padding: 0 14px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border-radius: 999px;
  border: 1px solid rgba(140, 255, 176, 0.42);
  background: rgba(140, 255, 176, 0.08);

  color: #baffcc;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;

  cursor: pointer;
  white-space: nowrap;

  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    transform 0.16s ease;
}

.summary-chain-create-button:hover:not(:disabled) {
  background: rgba(140, 255, 176, 0.16);
  border-color: rgba(140, 255, 176, 0.65);
  color: #ffffff;
  transform: translateY(-1px);
}

.summary-chain-create-button:disabled {
  opacity: 0.55;
  cursor: default;
  color: rgba(220, 225, 235, 0.75);
  border-color: rgba(220, 225, 235, 0.22);
  background: rgba(255, 255, 255, 0.04);
}

@media (max-width: 700px) {
  .message-actions {
    gap: 8px;
  }

  .message-action-link {
    width: 30px;
    height: 30px;
    font-size: 15px;
    color: rgba(210, 202, 255, 0.94);
  }

  .message-action-link::after {
    font-size: 10px;
    bottom: calc(100% + 7px);
  }
}

/* FINAL FIX: мобильная нижняя панель
   Кнопка “Разговоры” физически остаётся в шапке index.html,
   но на телефоне визуально закрепляется внизу слева.
*/

@media (max-width: 720px) {
  html,
  body {
    height: 100dvh !important;
    min-height: 100dvh !important;
    overflow: hidden !important;
  }

  .chat-container {
    height: 100dvh !important;
    min-height: 100dvh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
  }

  .app-layout {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  .chat-main {
    min-height: 0 !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  .chat-messages {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    padding-bottom: 12px !important;
  }

  .chat-input {
    flex: 0 0 auto !important;
    position: relative !important;
    z-index: 100 !important;

    display: grid !important;
    grid-template-columns: 88px 1fr 62px !important;
    grid-template-rows: auto auto 44px !important;
    gap: 8px !important;

    padding: 8px 8px calc(8px + env(safe-area-inset-bottom)) !important;
    background: #202431 !important;
    border-top: 1px solid #2d3240 !important;
  }

  .chat-input textarea {
    grid-column: 1 / 4 !important;
    grid-row: 1 !important;

    width: 100% !important;
    min-height: 46px !important;
    max-height: 24dvh !important;
    overflow-y: auto !important;
  }

  .chat-input-hint {
    display: none !important;
  }

  .voice-status,
  .response-control-hint {
      grid-column: 1 / 4 !important;
      grid-row: 2 !important;
    }

  #send {
    grid-column: 2 / 3 !important;
    grid-row: 3 !important;

    width: 100% !important;
    height: 44px !important;
    min-height: 44px !important;
  }

  .voice-controls {
    grid-column: 3 / 4 !important;
    grid-row: 3 !important;

    width: 62px !important;
    min-width: 62px !important;

    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 3px !important;
  }

  .chat-header .mobile-space-toggle {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;

    position: fixed !important;
    left: 8px !important;
    right: auto !important;
    top: auto !important;
    bottom: calc(8px + env(safe-area-inset-bottom)) !important;
    z-index: 30000 !important;

    width: 88px !important;
    min-width: 88px !important;
    height: 44px !important;
    min-height: 44px !important;

    margin: 0 !important;
    padding: 0 8px !important;

    border: none !important;
    border-radius: 12px !important;
    background: transparent !important;
    box-shadow: none !important;

    color: #8cffb0 !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }
}

/* На телефоне сделать запись ещё заметнее*/

@media (max-width: 720px) {
  .mic-button.listening {
    background: rgba(255, 61, 61, 0.22) !important;
    border: 1px solid rgba(255, 95, 95, 0.62) !important;
    box-shadow:
      0 0 0 1px rgba(255, 95, 95, 0.28),
      0 0 18px rgba(255, 61, 61, 0.34) !important;
  }

  .voice-status.listening {
    background: rgba(255, 61, 61, 0.14) !important;
    border-color: rgba(255, 95, 95, 0.42) !important;
    color: #ffe1e1 !important;
    font-weight: 700 !important;
  }

  .voice-status.listening #voiceStatusText {
    color: #ffe1e1 !important;
  }
}

/* FINAL MOBILE VOICE RECORDING RED STATE */

@media (max-width: 720px) {
  .mic-button.listening {
    background: rgba(255, 61, 61, 0.24) !important;
    border: 1px solid rgba(255, 95, 95, 0.70) !important;
    box-shadow:
      0 0 0 1px rgba(255, 95, 95, 0.30),
      0 0 20px rgba(255, 61, 61, 0.42) !important;
    animation: mic-pulse 1.05s ease-in-out infinite !important;
  }

  .mic-button.listening .mic-icon {
    opacity: 1 !important;
    filter: drop-shadow(0 0 8px rgba(255, 75, 75, 1)) !important;
  }

  .voice-status.listening {
    background: rgba(255, 61, 61, 0.15) !important;
    border-color: rgba(255, 95, 95, 0.48) !important;
    color: #ffe1e1 !important;
    font-weight: 800 !important;
  }

  .voice-status.listening #voiceStatusText {
    color: #ffe1e1 !important;
    font-weight: 800 !important;
  }

  .voice-status.listening .voice-record-dot {
    background: #ff3d3d !important;
    box-shadow: 0 0 13px rgba(255, 61, 61, 0.95) !important;
  }

  .voice-status.listening .voice-wave span {
    background: rgba(255, 75, 75, 0.98) !important;
  }
}

/* FINAL DESKTOP VOICE RECORDING RED STATE */

@media (min-width: 721px) {
  .mic-button.listening {
    background: rgba(255, 61, 61, 0.20) !important;
    border: 1px solid rgba(255, 95, 95, 0.62) !important;
    box-shadow:
      0 0 0 1px rgba(255, 95, 95, 0.24),
      0 0 20px rgba(255, 61, 61, 0.34) !important;
    animation: mic-pulse 1.05s ease-in-out infinite !important;
  }

  .mic-button.listening .mic-icon {
    opacity: 1 !important;
    filter: drop-shadow(0 0 8px rgba(255, 75, 75, 1)) !important;
  }

  .voice-status.listening {
    background: rgba(255, 61, 61, 0.13) !important;
    border-color: rgba(255, 95, 95, 0.42) !important;
    color: #ffe1e1 !important;
    font-weight: 700 !important;
  }

  .voice-status.listening #voiceStatusText {
    color: #ffe1e1 !important;
    font-weight: 700 !important;
  }

  .voice-status.listening .voice-record-dot {
    background: #ff3d3d !important;
    box-shadow: 0 0 13px rgba(255, 61, 61, 0.95) !important;
  }

  .voice-status.listening .voice-wave span {
    background: rgba(255, 75, 75, 0.98) !important;
  }
}


/* стиль системного предупреждения */

.message-system-notice {
  margin-top: 14px;
  padding-top: 10px;

  border-top: 1px solid rgba(157, 133, 255, 0.18);

  color: rgba(196, 184, 255, 0.88);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;

  text-shadow: 0 0 12px rgba(122, 92, 255, 0.22);
}

@media (max-width: 700px) {
  .message-system-notice {
    color: rgba(210, 202, 255, 0.94);
    font-size: 12px;
  }
}

/* ELAYOR-MOBILE-NATIVE-HINT-LOCK-20260730 */

#input::placeholder {
  color: rgba(219, 224, 246, 0.52) !important;
  opacity: 1 !important;
}

.chat-input-hint,
.chat-input.has-input-value .chat-input-hint,
.chat-input textarea.has-input-value + .chat-input-hint,
.chat-input textarea:not(:placeholder-shown) + .chat-input-hint {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  user-select: none !important;
}
/* ELAYOR-CONTEXT-MENU-VIEWPORT-GUARD-1C-CSS
   Контекстные меню разговоров и папок:
   - поверх мобильного sidebar;
   - не выходят за viewport;
   - имеют внутреннюю прокрутку;
   - список папок "Переместить в папку" прокручивается отдельно.
*/

.chat-context-menu,
.folder-context-menu {
  position: fixed !important;
  z-index: 50000 !important;

  max-width: calc(100vw - 16px) !important;

  max-height: calc(100vh - 16px) !important;
  max-height: calc(100dvh - 16px) !important;

  overflow-x: hidden !important;
  overflow-y: auto !important;

  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.chat-context-menu {
  width: min(280px, calc(100vw - 16px)) !important;
}

.folder-context-menu {
  width: min(300px, calc(100vw - 16px)) !important;
}

/* Длинный список направлений внутри "Переместить в папку". */
.chat-context-folders:not(.hidden) {
  display: block;

  max-height: min(42vh, 340px);
  max-height: min(42dvh, 340px);

  overflow-x: hidden;
  overflow-y: auto;

  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

/* Полная цель папки тоже не должна раздувать меню за экран. */
.folder-context-goal:not(.hidden) {
  max-height: min(34vh, 260px);
  max-height: min(34dvh, 260px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 720px) {
  .chat-context-menu,
  .folder-context-menu {
    z-index: 50000 !important;

    left: auto;
    right: auto;

    max-width: calc(100vw - 12px) !important;
    max-height: calc(100vh - 12px) !important;
    max-height: calc(100dvh - 12px) !important;
  }

  .chat-context-menu {
    width: min(320px, calc(100vw - 12px)) !important;
  }

  .folder-context-menu {
    width: min(320px, calc(100vw - 12px)) !important;
  }

  .chat-context-folders:not(.hidden) {
    max-height: 38vh;
    max-height: 38dvh;
  }
}

/* ELAYOR-CONTEXT-MENU-SCROLL-GUARD-1D-CSS */

.chat-context-menu,
.folder-context-menu {
  max-height: min(68vh, 560px) !important;
  max-height: min(68dvh, 560px) !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-y !important;
  scrollbar-gutter: stable !important;
  scrollbar-width: thin;
}

.chat-context-folders:not(.hidden) {
  display: block !important;
  max-height: 210px !important;
  overflow-x: hidden !important;
  overflow-y: scroll !important;
  overscroll-behavior: contain !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-y !important;
  scrollbar-gutter: stable !important;
  scrollbar-width: thin;
}

.folder-context-goal:not(.hidden) {
  max-height: 210px !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-y !important;
  scrollbar-gutter: stable !important;
  scrollbar-width: thin;
}

.chat-context-menu::-webkit-scrollbar,
.folder-context-menu::-webkit-scrollbar,
.chat-context-folders::-webkit-scrollbar,
.folder-context-goal::-webkit-scrollbar {
  width: 9px;
}

.chat-context-menu::-webkit-scrollbar-track,
.folder-context-menu::-webkit-scrollbar-track,
.chat-context-folders::-webkit-scrollbar-track,
.folder-context-goal::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.035);
  border-radius: 999px;
}

.chat-context-menu::-webkit-scrollbar-thumb,
.folder-context-menu::-webkit-scrollbar-thumb,
.chat-context-folders::-webkit-scrollbar-thumb,
.folder-context-goal::-webkit-scrollbar-thumb {
  background: rgba(157, 133, 255, 0.48);
  border-radius: 999px;
}

@media (max-width: 720px) {
  .chat-context-menu,
  .folder-context-menu {
    max-height: min(72vh, 520px) !important;
    max-height: min(72dvh, 520px) !important;
  }

  .chat-context-folders:not(.hidden) {
    max-height: min(31vh, 200px) !important;
    max-height: min(31dvh, 200px) !important;
  }

  .folder-context-goal:not(.hidden) {
    max-height: min(30vh, 190px) !important;
    max-height: min(30dvh, 190px) !important;
  }
}
