
.ai-interface {
    max-width: 1130px;
    margin: 24px auto;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    padding: 16px;
    font-family: system-ui, -apple-system, sans-serif;
  }

  .ai-interface .ai-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
  }

  .ai-interface .ai-avatar {
    width: 38px;
    min-width: 38px;
    height: 38px;
    border-radius: 12px;
    background: #111827;
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 18px;
  }

  .ai-interface .ai-title {
    font-size: 15px;
    font-weight: 650;
    color: #111827;
    text-align: left;
  }

  .ai-interface .ai-subtitle {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
    text-align: left;
  }

  .ai-interface #result {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    box-sizing: border-box;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #f9fafb;
    color: #111827;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
    overflow: hidden;
    outline: none;
  }

  .ai-interface #result:focus {
    border-color: #9ca3af;
    background: #fff;
  }

  .ai-interface .ai-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
  }

  .ai-interface .features {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .ai-interface .feature-button {
    display: inline-flex;
    cursor: pointer;
  }

  .ai-interface .feature-button input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
  }

  .ai-interface .feature-button span {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    color: #4b5563;
    font-size: 13px;
    line-height: 1.2;
    white-space: nowrap;
    user-select: none;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  }

  .ai-interface .feature-button:hover span {
    background: #e5e7eb;
  }

  .ai-interface .feature-button input:checked + span {
    background: #4f5359;
    border-color: #4f5359;
    color: #ffffff;
  }

  .ai-interface .feature-button input:focus-visible + span {
    outline: 2px solid #9ca3af;
    outline-offset: 2px;
  }

  .ai-interface .send-button___ {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: #111827;
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
    margin-left: auto; 
  }

  .ai-interface .send-button {
    margin-left: auto; /* Прижимает к правому краю */
    flex-shrink: 0;
    height: 38px;
    padding: 0 16px; /* Внутренние отступы, чтобы текст не прилипал к краям */
    border: none;
    border-radius: 999px; /* Делает кнопку овальной */
    background: #111827;
    color: #fff;
    
    /* Выравниваем текст и иконку внутри по центру */
    display: inline-flex;
    align-items: center;
    gap: 8px; /* Расстояние между текстом и стрелкой */
    
    font-size: 13px; /* Размер шрифта */
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
  }

  .ai-interface .send-button:not(:disabled):hover {
    background: #374151;
    transform: translateY(-1px);
  }

  .ai-interface .send-button:not(:disabled):active {
    transform: translateY(0);
  }

  /* СТИЛИ ДЛЯ ОТКЛЮЧЕННОЙ КНОПКИ */
  .ai-interface .send-button:disabled {
    background: #e5e7eb !important;
    color: #9ca3af !important;
    cursor: default !important;
    transform: none !important;
    pointer-events: none; /* Полностью блокирует клики, если класс формы всё же сработает */
  }

  body:not(.form-restored) .ai-interface {
    visibility: hidden;
  }

  body.form-restored .ai-interface {
    visibility: visible;
  }
  body:not(.form-restored) .ai-interface .feature-button span,
  body:not(.form-restored) .ai-interface .send-button {
    transition: none !important;
  }

  @media (max-width: 800px) {
    /* Прячем блок с аватаром */
    .ai-interface .ai-header .ai-avatar {
      display: none;
    }

    /* Перестраиваем тулбар в колонку, чтобы кнопка ушла под теги */
    .ai-interface .ai-toolbar {
      flex-direction: column;
      align-items: flex-start;
      gap: 12px;
    }

    /* Разрешаем контейнеру тегов занимать всю ширину и переноситься внутри строки */
    .ai-interface .ai-toolbar .features {
      width: 100%;
      display: flex;
      flex-wrap: wrap; 
      gap: 6px;
    }

    /* Сбрасываем авто-отступ у кнопки, чтобы она встала слева под тегами */
    .ai-interface .send-button {
      margin-left: 0;
    }
  }

  @media (max-width: 599px) {
      .ai-interface {
          flex-direction: column;
          align-items: stretch;
          justify-content: flex-start;
          gap: 14px;
      }

      .ai-interface .welcome_interface .ai-header {
          margin-bottom: 0;
      }

      .ai-interface .welcome_interface .ai-toolbar {
          margin-top: 0;
          width: 100%;
      }
      .ai-interface .welcome_interface .send-button {
          margin-left: 0;
          width: 100%;
          box-sizing: border-box;
          justify-content: center;
      }
  }